use of uk.gov.justice.services.jdbc.persistence.JdbcRepositoryHelper in project microservice_framework by CJSCommonPlatform.
the class EventRepositoryFactory method getEventJdbcRepository.
public static EventJdbcRepository getEventJdbcRepository(final DataSource dataSource) throws NamingException {
final EventJdbcRepository eventJdbcRepository = new EventJdbcRepository();
eventJdbcRepository.dataSource = dataSource;
eventJdbcRepository.jdbcDataSourceProvider = new JdbcDataSourceProvider();
eventJdbcRepository.logger = getLogger(EventJdbcRepository.class);
eventJdbcRepository.jdbcRepositoryHelper = new JdbcRepositoryHelper();
eventJdbcRepository.eventInsertionStrategy = new AnsiSQLEventLogInsertionStrategy();
return eventJdbcRepository;
}
use of uk.gov.justice.services.jdbc.persistence.JdbcRepositoryHelper in project microservice_framework by CJSCommonPlatform.
the class EventJdbcRepositoryIT method initialize.
@Before
public void initialize() {
try {
jdbcRepository.dataSource = new TestDataSourceFactory(LIQUIBASE_EVENT_STORE_DB_CHANGELOG_XML).createDataSource();
jdbcRepository.logger = mock(Logger.class);
jdbcRepository.eventInsertionStrategy = new AnsiSQLEventLogInsertionStrategy();
jdbcRepository.jdbcRepositoryHelper = new JdbcRepositoryHelper();
final Poller poller = new Poller();
poller.pollUntilFound(() -> {
try {
jdbcRepository.dataSource.getConnection().prepareStatement("SELECT COUNT (*) FROM event_log;").execute();
return Optional.of("Success");
} catch (SQLException e) {
e.printStackTrace();
fail("EventJdbcRepository construction failed");
return Optional.empty();
}
});
} catch (final Exception e) {
e.printStackTrace();
fail("EventJdbcRepository construction failed");
}
}
Aggregations