@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ConditionMessage.Builder message = ConditionMessage .forCondition("EmbeddedDataSource"); if (anyMatches(context, metadata, this.pooledCondition)) { return ConditionOutcome .noMatch(message.foundExactly("supported pooled data source")); } EmbeddedDatabaseType type = EmbeddedDatabaseConnection .get(context.getClassLoader()).getType(); if (type == null) { return ConditionOutcome .noMatch(message.didNotFind("embedded database").atAll()); } return ConditionOutcome.match(message.found("embedded database").items(type)); }
public EmbeddedDatabase getEmbeddedDatabase() { EmbeddedDatabaseConnection connection = this.environment.getProperty( "spring.test.database.connection", EmbeddedDatabaseConnection.class, EmbeddedDatabaseConnection.NONE); if (EmbeddedDatabaseConnection.NONE.equals(connection)) { connection = EmbeddedDatabaseConnection.get(getClass().getClassLoader()); } return new EmbeddedDatabaseBuilder().setType(connection.getType()).build(); }
@Before public void init() { EmbeddedDatabaseConnection db = EmbeddedDatabaseConnection.HSQL; this.dataSource = new SingleConnectionDataSource(db.getUrl() + ";shutdown=true", "sa", "", false); this.dataSource.setDriverClassName(db.getDriverClassName()); }
private String getDefaultDdlAuto(DataSource dataSource) { if (EmbeddedDatabaseConnection.isEmbedded(dataSource)) { return "create-drop"; } return "none"; }