Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

Commit

Permalink
Remove SimpleFlatMapper record mapper from database + test db configu…
Browse files Browse the repository at this point in the history
…rations (#621)

* Remove DatabaseUtil

* Remove SFM record mapper db config

* Remove SFM record mapper test db config

* Add newDbContext override method with Clock

* Spotless
  • Loading branch information
woobianca authored Apr 9, 2021
1 parent 0945bb6 commit 5e2c931
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ static DSLContext dbContext(
.set(dbExecutor)
.set(SQLDialect.MYSQL)
.set(new Settings().withRenderSchema(false))
.set(new DataSourceConnectionProvider(dataSource))
.set(DatabaseUtil.sfmRecordMapperProvider());
.set(new DataSourceConnectionProvider(dataSource));
if (config.getLogQueries()) {
configuration.set(new QueryLogger());
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

import com.google.common.collect.ImmutableList;
import java.sql.SQLException;
import org.curioswitch.common.server.framework.database.DatabaseUtil;
import java.time.Clock;
import org.jooq.DSLContext;
import org.jooq.Record;
import org.jooq.Result;
Expand Down Expand Up @@ -71,11 +71,18 @@ public static MockDataProvider mockProvider() {
public static DSLContext newDbContext(MockDataProvider dataProvider) {
MockConnection connection = new MockConnection(dataProvider);
DSLContext db = DSL.using(connection, SQLDialect.MYSQL);
db.configuration().set(DatabaseUtil.sfmRecordMapperProvider());
db.settings().setRenderSchema(false);
return db;
}

/**
* Returns a {@link DSLContext} with a mock connection using the provided {@link MockDataProvider}
* and {@link Clock} to override the system's current time with a fixed timestamp.
*/
public static DSLContext newDbContext(MockDataProvider dataProvider, Clock clock) {
return newDbContext(dataProvider).configuration().set(clock).dsl();
}

/**
* Setup a {@link MockDataProviderStubber} which can be used to set an expectation to return
* records or throw an exception when the {@code query} is executed on the {@code provider}.
Expand Down

0 comments on commit 5e2c931

Please sign in to comment.