Spring Framework EmbeddedDatabaseBuilder - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework EmbeddedDatabaseBuilder class.

This code example shows how to use the following methods:
		return new DataSourceTransactionManager(dataSource()); 
	} 
 
	@Bean 
	public DataSource dataSource() { 
		return new EmbeddedDatabaseBuilder()// 
		.setName("empty-sql-scripts-test-db")// 
		.build(); 
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:
		return new DataSourceTransactionManager(dataSource()); 
	} 
 
	@Bean 
	public DataSource dataSource() { 
		return new EmbeddedDatabaseBuilder()// 
		.setName("populated-sql-scripts-test-db")// 
		.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql") // 
		.build(); 
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:
 * @since 4.0.3 
 * @see JdbcTestUtilsTests 
 */ 
public class JdbcTestUtilsIntegrationTests { 
 
	private final EmbeddedDatabase db = new EmbeddedDatabaseBuilder().build(); 
 
	private JdbcTemplate jdbcTemplate = new JdbcTemplate(db); 
 
 
	@After 
	public void shutdown() { 
		db.shutdown(); 
	} 
 
	@Test 
	@SuppressWarnings("deprecation") 
	public void executeSqlScriptsAndcountRowsInTableWhere() throws Exception { 
 
		for (String script : Arrays.asList("schema.sql", "data.sql")) { 
6
CodeRank
This code example shows how to use the following methods:
	JdbcTemplate jdbcTemplate; 
 
 
	@Before 
	public void setUp() { 
		db = new EmbeddedDatabaseBuilder().setType(getEmbeddedDatabaseType()).build(); 
		jdbcTemplate = new JdbcTemplate(db); 
	} 
 
	@After 
	public void shutDown() { 
		if (TransactionSynchronizationManager.isSynchronizationActive()) { 
			TransactionSynchronizationManager.clear(); 
			TransactionSynchronizationManager.unbindResource(db); 
		} 
		db.shutdown(); 
	} 
 
	abstract EmbeddedDatabaseType getEmbeddedDatabaseType(); 
 
6
CodeRank
This code example shows how to use the following methods:
			return new DataSourceTransactionManager(dataSource()); 
		} 
 
		@Bean 
		public DataSource dataSource() { 
			return new EmbeddedDatabaseBuilder()// 
			.addScript("classpath:/org/springframework/test/context/junit4/spr9051/schema.sql")// 
			// Ensure that this in-memory database is only used by this class: 
			.setName(getClass().getName())// 
			.build(); 
		} 
 
	} 
 
 
	@Before 
	public void compareDataSources() throws Exception { 
		// NOTE: the two DataSource instances ARE the same! 
		assertSame(dataSourceFromTxManager, dataSourceViaInjection); 
	} 
6
CodeRank
This code example shows how to use the following methods:build
    private static EmbeddedDatabase database; 
    private static Flyway flyway; 
 
    @BeforeClass 
    public static void init() { 
        EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder(); 
        database = builder.build(); 
        flyway = new Flyway(); 
        flyway.setInitVersion("1.5.2"); 
        flyway.setLocations("classpath:/org/cloudfoundry/identity/uaa/db/hsqldb/"); 
        flyway.setDataSource(database); 
        flyway.migrate(); 
    } 
 
    @Before 
    public void setup() { 
 
        JdbcTemplate jdbcTemplate = new JdbcTemplate(database); 
        JdbcScimUserProvisioning dao = new JdbcScimUserProvisioning(jdbcTemplate, 
                        new JdbcPagingListFactory(jdbcTemplate, new DefaultLimitSqlAdapter())); 
6
CodeRank
This code example shows how to use the following methods:
	@Configuration 
	static class Config { 
 
		@Bean 
		public DataSource dataSource() {
			return new EmbeddedDatabaseBuilder()//
			.setName("empty-sql-scripts-without-tx-mgr-test-db")//
			.build();
		} 
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:
			return new DataSourceTransactionManager(dataSource2()); 
		} 
 
		@Bean 
		public DataSource dataSource1() { 
			return new EmbeddedDatabaseBuilder()// 
			.setName("database1")// 
			.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")// 
			.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")// 
			.build(); 
		} 
 
		@Bean 
		public DataSource dataSource2() { 
			return new EmbeddedDatabaseBuilder()// 
			.setName("database2")// 
			.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")// 
			.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")// 
			.build(); 
		} 
6
CodeRank
This code example shows how to use the following methods:
			return new DataSourceTransactionManager(dataSource2()); 
		} 
 
		@Bean 
		public DataSource dataSource1() { 
			return new EmbeddedDatabaseBuilder()// 
			.setName("database1")// 
			.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")// 
			.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")// 
			.build(); 
		} 
 
		@Bean 
		public DataSource dataSource2() { 
			return new EmbeddedDatabaseBuilder()// 
			.setName("database2")// 
			.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")// 
			.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")// 
			.build(); 
		} 
6
CodeRank
This code example shows how to use the following methods:
	private EmbeddedDatabase db;
 
	@Before 
	public void setUp() throws Exception {
		// creates a HSQL in-memory db populated from default scripts classpath:schema.sql and classpath:data.sql 
		db = new EmbeddedDatabaseBuilder().addDefaultScripts().build();
		authorizationCodeServices = new JdbcAuthorizationCodeServices(db);
	} 
 
	@After 
	public void tearDown() throws Exception {
		db.shutdown();
	} 
 
	@Override 
	AuthorizationCodeServices getAuthorizationCodeServices() { 
		return authorizationCodeServices;
	} 
} 
6
CodeRank
See Code Examples for Spring Framework EmbeddedDatabaseBuilder Methods: