|
|
@ -141,8 +141,8 @@ class ConnectionFactoryBuilderTests {
|
|
|
|
.withUrl(EmbeddedDatabaseConnection.H2.getUrl(intialDatabaseName)).build();
|
|
|
|
.withUrl(EmbeddedDatabaseConnection.H2.getUrl(intialDatabaseName)).build();
|
|
|
|
ConnectionFactoryOptions initialOptions = ((OptionsCapableConnectionFactory) connectionFactory).getOptions();
|
|
|
|
ConnectionFactoryOptions initialOptions = ((OptionsCapableConnectionFactory) connectionFactory).getOptions();
|
|
|
|
String derivedDatabaseName = UUID.randomUUID().toString();
|
|
|
|
String derivedDatabaseName = UUID.randomUUID().toString();
|
|
|
|
ConnectionFactory derived = ConnectionFactoryBuilder.derivefrom(connectionFactory).database(derivedDatabaseName)
|
|
|
|
ConnectionFactory derived = ConnectionFactoryBuilder.derivedFrom(connectionFactory)
|
|
|
|
.build();
|
|
|
|
.database(derivedDatabaseName).build();
|
|
|
|
ConnectionFactoryOptions derivedOptions = ((OptionsCapableConnectionFactory) derived).getOptions();
|
|
|
|
ConnectionFactoryOptions derivedOptions = ((OptionsCapableConnectionFactory) derived).getOptions();
|
|
|
|
assertThat(derivedOptions.getRequiredValue(ConnectionFactoryOptions.DATABASE)).isEqualTo(derivedDatabaseName);
|
|
|
|
assertThat(derivedOptions.getRequiredValue(ConnectionFactoryOptions.DATABASE)).isEqualTo(derivedDatabaseName);
|
|
|
|
assertMatchingOptions(derivedOptions, initialOptions, ConnectionFactoryOptions.CONNECT_TIMEOUT,
|
|
|
|
assertMatchingOptions(derivedOptions, initialOptions, ConnectionFactoryOptions.CONNECT_TIMEOUT,
|
|
|
@ -156,7 +156,7 @@ class ConnectionFactoryBuilderTests {
|
|
|
|
ConnectionFactory connectionFactory = ConnectionFactoryBuilder
|
|
|
|
ConnectionFactory connectionFactory = ConnectionFactoryBuilder
|
|
|
|
.withUrl(EmbeddedDatabaseConnection.H2.getUrl(UUID.randomUUID().toString())).build();
|
|
|
|
.withUrl(EmbeddedDatabaseConnection.H2.getUrl(UUID.randomUUID().toString())).build();
|
|
|
|
ConnectionFactoryOptions initialOptions = ((OptionsCapableConnectionFactory) connectionFactory).getOptions();
|
|
|
|
ConnectionFactoryOptions initialOptions = ((OptionsCapableConnectionFactory) connectionFactory).getOptions();
|
|
|
|
ConnectionFactory derived = ConnectionFactoryBuilder.derivefrom(connectionFactory).username("admin")
|
|
|
|
ConnectionFactory derived = ConnectionFactoryBuilder.derivedFrom(connectionFactory).username("admin")
|
|
|
|
.password("secret").build();
|
|
|
|
.password("secret").build();
|
|
|
|
ConnectionFactoryOptions derivedOptions = ((OptionsCapableConnectionFactory) derived).getOptions();
|
|
|
|
ConnectionFactoryOptions derivedOptions = ((OptionsCapableConnectionFactory) derived).getOptions();
|
|
|
|
assertThat(derivedOptions.getRequiredValue(ConnectionFactoryOptions.USER)).isEqualTo("admin");
|
|
|
|
assertThat(derivedOptions.getRequiredValue(ConnectionFactoryOptions.USER)).isEqualTo("admin");
|
|
|
@ -173,7 +173,7 @@ class ConnectionFactoryBuilderTests {
|
|
|
|
ConnectionFactoryOptions initialOptions = ((OptionsCapableConnectionFactory) connectionFactory).getOptions();
|
|
|
|
ConnectionFactoryOptions initialOptions = ((OptionsCapableConnectionFactory) connectionFactory).getOptions();
|
|
|
|
ConnectionPoolConfiguration poolConfiguration = ConnectionPoolConfiguration.builder(connectionFactory).build();
|
|
|
|
ConnectionPoolConfiguration poolConfiguration = ConnectionPoolConfiguration.builder(connectionFactory).build();
|
|
|
|
ConnectionPool pool = new ConnectionPool(poolConfiguration);
|
|
|
|
ConnectionPool pool = new ConnectionPool(poolConfiguration);
|
|
|
|
ConnectionFactory derived = ConnectionFactoryBuilder.derivefrom(pool).username("admin").password("secret")
|
|
|
|
ConnectionFactory derived = ConnectionFactoryBuilder.derivedFrom(pool).username("admin").password("secret")
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
assertThat(derived).isNotInstanceOf(ConnectionPool.class).isInstanceOf(OptionsCapableConnectionFactory.class);
|
|
|
|
assertThat(derived).isNotInstanceOf(ConnectionPool.class).isInstanceOf(OptionsCapableConnectionFactory.class);
|
|
|
|
ConnectionFactoryOptions derivedOptions = ((OptionsCapableConnectionFactory) derived).getOptions();
|
|
|
|
ConnectionFactoryOptions derivedOptions = ((OptionsCapableConnectionFactory) derived).getOptions();
|
|
|
|