use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project ff4j by ff4j.
the class SpringJdbcFeatureStorePrefixTest method initStore.
/**
* {@inheritDoc}
*/
@Override
protected FeatureStore initStore() {
builder = new EmbeddedDatabaseBuilder();
db = builder.setType(//
EmbeddedDatabaseType.HSQL).addScript(//
"classpath:ddl-prefix-schema.sql").addScript("classpath:ddl-prefix-data.sql").build();
FeatureStoreSpringJdbc jdbcStore = new FeatureStoreSpringJdbc();
jdbcStore.setQueryBuilder(new JdbcQueryBuilder("T_FF4J_", "_01"));
jdbcStore.setDataSource(db);
return jdbcStore;
}
use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project tutorials by eugenp.
the class PersistenceConfig method dataSource.
@Bean
public DataSource dataSource() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.H2).addScript("schema-expressions.sql").addScript("data-expressions.sql").build();
return db;
}
use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project spring-integration by spring-projects.
the class JdbcPollingChannelAdapterIntegrationTests method setUp.
@BeforeClass
public static void setUp() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
builder.setType(EmbeddedDatabaseType.DERBY).addScript("classpath:org/springframework/integration/jdbc/pollingChannelAdapterIntegrationTest.sql");
embeddedDatabase = builder.build();
jdbcTemplate = new JdbcTemplate(embeddedDatabase);
}
use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project spring-boot by spring-projects.
the class DataSourceBuilderTests method buildWhenDerivedFromEmbeddedDatabase.
@Test
void buildWhenDerivedFromEmbeddedDatabase() {
EmbeddedDatabase database = new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.HSQL).build();
SimpleDriverDataSource built = (SimpleDriverDataSource) DataSourceBuilder.derivedFrom(database).username("test").password("secret").build();
assertThat(built.getUsername()).isEqualTo("test");
assertThat(built.getPassword()).isEqualTo("secret");
assertThat(built.getUrl()).startsWith("jdbc:hsqldb:mem");
}
use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project spring-framework by spring-projects.
the class H2SequenceMaxValueIncrementerTests method incrementsSequenceUsingH2EmbeddedDatabaseConfigurer.
/**
* Tests that the incrementer works when using the JDBC connection URL used
* in the {@code H2EmbeddedDatabaseConfigurer} which is used transparently
* when using Spring's {@link EmbeddedDatabaseBuilder}.
*
* <p>In other words, this tests compatibility with the default H2
* <em>compatibility mode</em>.
*/
@Test
void incrementsSequenceUsingH2EmbeddedDatabaseConfigurer() {
EmbeddedDatabase database = new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).generateUniqueName(true).addScript("classpath:/org/springframework/jdbc/support/incrementer/schema.sql").build();
assertIncrements(database);
database.shutdown();
}
Aggregations