Switch order of ContainerConnectionDetailsFactory generics

Switch `ContainerConnectionDetailsFactory` so that `Container`
is before `ConnectionDetails`.
pull/35165/head
Phillip Webb 2 years ago
parent fc5339f81c
commit c21cf31853

@ -40,7 +40,7 @@ import org.springframework.util.ObjectUtils;
* @author Phillip Webb
* @since 3.1.0
*/
public abstract class ContainerConnectionDetailsFactory<D extends ConnectionDetails, C extends Container<?>>
public abstract class ContainerConnectionDetailsFactory<C extends Container<?>, D extends ConnectionDetails>
implements ConnectionDetailsFactory<ContainerConnectionSource<C>, D> {
/**
@ -78,9 +78,9 @@ public abstract class ContainerConnectionDetailsFactory<D extends ConnectionDeta
}
try {
Class<?>[] generics = resolveGenerics();
Class<?> connectionDetailsType = generics[0];
Class<?> containerType = generics[1];
if (source.accepts(this.connectionName, connectionDetailsType, containerType)) {
Class<?> containerType = generics[0];
Class<?> connectionDetailsType = generics[1];
if (source.accepts(this.connectionName, containerType, connectionDetailsType)) {
return getContainerConnectionDetails(source);
}
}

@ -36,7 +36,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
* @author Phillip Webb
*/
class RabbitContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<RabbitConnectionDetails, RabbitMQContainer> {
extends ContainerConnectionDetailsFactory<RabbitMQContainer, RabbitConnectionDetails> {
@Override
protected RabbitConnectionDetails getContainerConnectionDetails(

@ -36,7 +36,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
* @author Phillip Webb
*/
class CassandraContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<CassandraConnectionDetails, CassandraContainer<?>> {
extends ContainerConnectionDetailsFactory<CassandraContainer<?>, CassandraConnectionDetails> {
@Override
protected CassandraConnectionDetails getContainerConnectionDetails(

@ -33,7 +33,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
* @author Phillip Webb
*/
class CouchbaseContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<CouchbaseConnectionDetails, CouchbaseContainer> {
extends ContainerConnectionDetailsFactory<CouchbaseContainer, CouchbaseConnectionDetails> {
@Override
protected CouchbaseConnectionDetails getContainerConnectionDetails(

@ -36,7 +36,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
* @author Phillip Webb
*/
class ElasticsearchContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<ElasticsearchConnectionDetails, ElasticsearchContainer> {
extends ContainerConnectionDetailsFactory<ElasticsearchContainer, ElasticsearchConnectionDetails> {
private static final int DEFAULT_PORT = 9200;

@ -31,7 +31,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
* @author Andy Wilkinson
*/
class FlywayContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<FlywayConnectionDetails, JdbcDatabaseContainer<?>> {
extends ContainerConnectionDetailsFactory<JdbcDatabaseContainer<?>, FlywayConnectionDetails> {
@Override
protected FlywayConnectionDetails getContainerConnectionDetails(

@ -32,7 +32,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
* @author Phillip Webb
*/
class JdbcContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<JdbcConnectionDetails, JdbcDatabaseContainer<?>> {
extends ContainerConnectionDetailsFactory<JdbcDatabaseContainer<?>, JdbcConnectionDetails> {
@Override
protected JdbcConnectionDetails getContainerConnectionDetails(

@ -35,7 +35,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
* @author Phillip Webb
*/
class KafkaContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<KafkaConnectionDetails, KafkaContainer> {
extends ContainerConnectionDetailsFactory<KafkaContainer, KafkaConnectionDetails> {
@Override
protected KafkaConnectionDetails getContainerConnectionDetails(ContainerConnectionSource<KafkaContainer> source) {

@ -31,7 +31,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
* @author Andy Wilkinson
*/
class LiquibaseContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<LiquibaseConnectionDetails, JdbcDatabaseContainer<?>> {
extends ContainerConnectionDetailsFactory<JdbcDatabaseContainer<?>, LiquibaseConnectionDetails> {
@Override
protected LiquibaseConnectionDetails getContainerConnectionDetails(

@ -33,7 +33,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
* @author Phillip Webb
*/
class MongoContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<MongoConnectionDetails, MongoDBContainer> {
extends ContainerConnectionDetailsFactory<MongoDBContainer, MongoConnectionDetails> {
MongoContainerConnectionDetailsFactory() {
super(ANY_CONNECTION_NAME, "com.mongodb.ConnectionString");

@ -36,7 +36,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
* @author Phillip Webb
*/
class Neo4jContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<Neo4jConnectionDetails, Neo4jContainer<?>> {
extends ContainerConnectionDetailsFactory<Neo4jContainer<?>, Neo4jConnectionDetails> {
Neo4jContainerConnectionDetailsFactory() {
super(ANY_CONNECTION_NAME, "org.neo4j.driver.AuthToken");

@ -34,7 +34,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
* @author Phillip Webb
*/
class MariaDbR2dbcContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<R2dbcConnectionDetails, MariaDBContainer<?>> {
extends ContainerConnectionDetailsFactory<MariaDBContainer<?>, R2dbcConnectionDetails> {
MariaDbR2dbcContainerConnectionDetailsFactory() {
super(ANY_CONNECTION_NAME, "io.r2dbc.spi.ConnectionFactoryOptions");

@ -34,7 +34,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
* @author Phillip Webb
*/
class MySqlR2dbcContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<R2dbcConnectionDetails, MySQLContainer<?>> {
extends ContainerConnectionDetailsFactory<MySQLContainer<?>, R2dbcConnectionDetails> {
MySqlR2dbcContainerConnectionDetailsFactory() {
super(ANY_CONNECTION_NAME, "io.r2dbc.spi.ConnectionFactoryOptions");

@ -32,7 +32,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
* @author Eddú Meléndez
*/
class OracleR2dbcContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<R2dbcConnectionDetails, OracleContainer> {
extends ContainerConnectionDetailsFactory<OracleContainer, R2dbcConnectionDetails> {
OracleR2dbcContainerConnectionDetailsFactory() {
super(ANY_CONNECTION_NAME, "io.r2dbc.spi.ConnectionFactoryOptions");

@ -34,7 +34,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
* @author Phillip Webb
*/
class PostgresR2dbcContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<R2dbcConnectionDetails, PostgreSQLContainer<?>> {
extends ContainerConnectionDetailsFactory<PostgreSQLContainer<?>, R2dbcConnectionDetails> {
PostgresR2dbcContainerConnectionDetailsFactory() {
super(ANY_CONNECTION_NAME, "io.r2dbc.spi.ConnectionFactoryOptions");

@ -34,7 +34,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
* @author Phillip Webb
*/
class SqlServerR2dbcContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<R2dbcConnectionDetails, MSSQLServerContainer<?>> {
extends ContainerConnectionDetailsFactory<MSSQLServerContainer<?>, R2dbcConnectionDetails> {
SqlServerR2dbcContainerConnectionDetailsFactory() {
super(ANY_CONNECTION_NAME, "io.r2dbc.spi.ConnectionFactoryOptions");

@ -34,7 +34,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
* @author Phillip Webb
*/
class RedisContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<RedisConnectionDetails, Container<?>> {
extends ContainerConnectionDetailsFactory<Container<?>, RedisConnectionDetails> {
RedisContainerConnectionDetailsFactory() {
super("redis");

@ -33,7 +33,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
* @author Eddú Meléndez
*/
class RedpandaContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<KafkaConnectionDetails, RedpandaContainer> {
extends ContainerConnectionDetailsFactory<RedpandaContainer, KafkaConnectionDetails> {
@Override
protected KafkaConnectionDetails getContainerConnectionDetails(

@ -111,7 +111,7 @@ class ContainerConnectionDetailsFactoryTests {
* Test {@link ContainerConnectionDetailsFactory}.
*/
static class TestContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<JdbcConnectionDetails, JdbcDatabaseContainer<?>> {
extends ContainerConnectionDetailsFactory<JdbcDatabaseContainer<?>, JdbcConnectionDetails> {
TestContainerConnectionDetailsFactory() {
this(ANY_CONNECTION_NAME);

Loading…
Cancel
Save