Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@
import com.zaxxer.hikari.HikariDataSource;
import oracle.jdbc.internal.OpaqueString;
import oracle.jdbc.pool.OracleDataSource;
import oracle.ucp.config.PoolPropertiesException;
import oracle.ucp.jdbc.PoolDataSource;
import oracle.ucp.jdbc.PoolDataSourceImpl;
import org.apache.commons.dbcp2.BasicDataSource;
import org.assertj.core.util.introspection.FieldSupport;
import org.h2.Driver;
import org.h2.jdbcx.JdbcDataSource;
import org.jspecify.annotations.Nullable;
Expand Down Expand Up @@ -383,8 +385,9 @@ void buildWhenDerivedFromOracleDataSourceWithPasswordSetReturnsDataSource() thro
.password("secret2")
.build();
assertThat(built.getUser()).isEqualTo("test2");
assertThat(built).extracting("password")
.extracting((opaque) -> ((OpaqueString) opaque).get())
assertThat(built)
.extracting((target) -> FieldSupport.extraction().fieldValue("password", OpaqueString.class, target))
.extracting(OpaqueString::get)
.isEqualTo("secret2");
assertThat(built.getURL()).isEqualTo("example.com");
}
Expand All @@ -398,12 +401,19 @@ void buildWhenDerivedFromOracleUcpWithPasswordSetReturnsDataSource() throws SQLE
DataSourceBuilder<?> builder = DataSourceBuilder.derivedFrom(dataSource);
PoolDataSource built = (PoolDataSource) builder.username("test2").password("secret2").build();
assertThat(built.getUser()).isEqualTo("test2");
assertThat(built).extracting("password")
.extracting((opaque) -> ((oracle.ucp.util.OpaqueString) opaque).get())
.isEqualTo("secret2");
assertThat(built).extracting(this::getPassword).isEqualTo("secret2");
assertThat(built.getURL()).isEqualTo("example.com");
}

private String getPassword(PoolDataSource target) {
try {
return ((oracle.ucp.util.OpaqueString) target.getPoolProperties().getPoolProperty("password")).get();
}
catch (PoolPropertiesException ex) {
throw new IllegalStateException(ex);
}
}

@Test
void buildWhenDerivedFromEmbeddedDatabase() {
EmbeddedDatabase database = new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.HSQL).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import javax.sql.DataSource;

import oracle.ucp.config.PoolPropertiesException;
import oracle.ucp.jdbc.PoolDataSource;
import oracle.ucp.jdbc.PoolDataSourceImpl;
import oracle.ucp.util.OpaqueString;
Expand Down Expand Up @@ -123,13 +124,20 @@ void usesCustomJdbcConnectionDetailsWhenDefined() {
assertThat(dataSource).isInstanceOf(PoolDataSourceImpl.class);
PoolDataSourceImpl oracleUcp = (PoolDataSourceImpl) dataSource;
assertThat(oracleUcp.getUser()).isEqualTo("user-1");
assertThat(oracleUcp).extracting("password")
.extracting((o) -> ((OpaqueString) o).get())
.isEqualTo("password-1");
assertThat(oracleUcp).extracting(this::getPassword).isEqualTo("password-1");
assertThat(oracleUcp.getConnectionFactoryClassName())
.isEqualTo(DatabaseDriver.POSTGRESQL.getDriverClassName());
assertThat(oracleUcp.getURL()).isEqualTo("jdbc:customdb://customdb.example.com:12345/database-1");
});
}

private String getPassword(PoolDataSource target) {
try {
return ((OpaqueString) target.getPoolProperties().getPoolProperty("password")).get();
}
catch (PoolPropertiesException ex) {
throw new IllegalStateException(ex);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import java.sql.SQLException;

import oracle.ucp.config.PoolPropertiesException;
import oracle.ucp.jdbc.PoolDataSource;
import oracle.ucp.jdbc.PoolDataSourceImpl;
import oracle.ucp.util.OpaqueString;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -49,11 +51,18 @@ void setUsernamePasswordUrlAndDriverClassName() throws SQLException {
new TestJdbcConnectionDetails());
assertThat(dataSource.getURL()).isEqualTo("jdbc:customdb://customdb.example.com:12345/database-1");
assertThat(dataSource.getUser()).isEqualTo("user-1");
assertThat(dataSource).extracting("password")
.extracting((password) -> ((OpaqueString) password).get())
.isEqualTo("password-1");
assertThat(dataSource).extracting(this::getPassword).isEqualTo("password-1");
assertThat(dataSource.getConnectionFactoryClassName())
.isEqualTo(DatabaseDriver.POSTGRESQL.getDriverClassName());
}

private String getPassword(PoolDataSource target) {
try {
return ((OpaqueString) target.getPoolProperties().getPoolProperty("password")).get();
}
catch (PoolPropertiesException ex) {
throw new IllegalStateException(ex);
}
}

}
4 changes: 0 additions & 4 deletions platform/spring-boot-dependencies/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -1120,10 +1120,6 @@ bom {
contains ".alpha"
because "we don't want alpha dependencies"
}
prohibit {
versionRange "[12.1.9]"
because "it contains a regression (https://github.com/jetty/jetty.project/issues/15021)"
}
group("org.eclipse.jetty.ee11") {
bom("jetty-ee11-bom")
}
Expand Down
Loading