use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project spring-integration by spring-projects.
the class JdbcOutboundGatewayTests method testSetMaxRowsPerPollWithoutSelectQuery.
@Test
public void testSetMaxRowsPerPollWithoutSelectQuery() {
EmbeddedDatabase dataSource = new EmbeddedDatabaseBuilder().build();
JdbcOutboundGateway jdbcOutboundGateway = new JdbcOutboundGateway(dataSource, "update something");
try {
jdbcOutboundGateway.setMaxRowsPerPoll(10);
jdbcOutboundGateway.setBeanFactory(mock(BeanFactory.class));
jdbcOutboundGateway.afterPropertiesSet();
fail("Expected an IllegalArgumentException to be thrown.");
} catch (IllegalArgumentException e) {
assertEquals("If you want to set 'maxRowsPerPoll', then you must provide a 'selectQuery'.", e.getMessage());
}
dataSource.shutdown();
}
use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project spring-integration by spring-projects.
the class PersistentAcceptOnceFileListFilterExternalStoreTests method testFileSystemWithJdbcMetadataStore.
@Test
public void testFileSystemWithJdbcMetadataStore() throws Exception {
EmbeddedDatabase dataSource = new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).addScript("classpath:/org/springframework/integration/jdbc/schema-drop-h2.sql").addScript("classpath:/org/springframework/integration/jdbc/schema-h2.sql").build();
JdbcMetadataStore metadataStore = new JdbcMetadataStore(dataSource);
metadataStore.afterPropertiesSet();
try {
testFileSystem(metadataStore);
List<Map<String, Object>> metaData = new JdbcTemplate(dataSource).queryForList("SELECT * FROM INT_METADATA_STORE");
assertEquals(1, metaData.size());
assertEquals("43", metaData.get(0).get("METADATA_VALUE"));
} finally {
dataSource.shutdown();
}
}
use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project ff4j by ff4j.
the class JdbcEventRepositorySchemaTest method initStore.
/**
* {@inheritDoc}
*/
public void initStore() {
builder = new EmbeddedDatabaseBuilder();
db = builder.setType(EmbeddedDatabaseType.HSQL).build();
testedStore = new JdbcEventRepository(db);
}
use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project ff4j by ff4j.
the class JdbcEventRepositoryTest method initRepository.
/**
* {@inheritDoc}
*/
@Override
protected EventRepository initRepository() {
builder = new EmbeddedDatabaseBuilder();
db = //
builder.setType(EmbeddedDatabaseType.HSQL).addScript(//
"classpath:schema-ddl.sql").addScript(//
"classpath:ff-store.sql").build();
return new JdbcEventRepository(db);
}
use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project ff4j by ff4j.
the class JdbcPropertyStoreSchemaTest method initStore.
/**
* {@inheritDoc}
*/
public void initStore() {
builder = new EmbeddedDatabaseBuilder();
db = builder.setType(EmbeddedDatabaseType.HSQL).build();
testedStore = new JdbcPropertyStore();
testedStore.setDataSource(db);
}
Aggregations