Fix tests failures in the Apache Geode, Inline Caching support Integration Tests involving Apache Cassandra due to the DataStax 4.x Driver upgrade in Spring Data Neumann/2.3.
This commit is contained in:
@@ -48,19 +48,34 @@ public abstract class TestCassandraConfiguration extends AbstractCassandraConfig
|
||||
|
||||
private static final String CASSANDRA_DATA_CQL = "cassandra-data.cql";
|
||||
private static final String CASSANDRA_SCHEMA_CQL = "cassandra-schema.cql";
|
||||
private static final String CLUSTER_NAME = "CustomerServiceCluster";
|
||||
private static final String LOCAL_DATA_CENTER = "datacenter1";
|
||||
private static final String KEYSPACE_NAME = "CustomerService";
|
||||
|
||||
@Nullable @Override
|
||||
protected String getClusterName() {
|
||||
return CLUSTER_NAME;
|
||||
}
|
||||
private static final String SESSION_NAME = "CustomerServiceCluster";
|
||||
|
||||
@NonNull @Override
|
||||
protected String getKeyspaceName() {
|
||||
return KEYSPACE_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("all")
|
||||
protected String getLocalDataCenter() {
|
||||
return LOCAL_DATA_CENTER;
|
||||
}
|
||||
|
||||
@Nullable @Override
|
||||
protected String getSessionName() {
|
||||
return SESSION_NAME;
|
||||
}
|
||||
|
||||
/*
|
||||
@Nullable @Override
|
||||
protected KeyspacePopulator keyspacePopulator() {
|
||||
return cqlSession -> loadCassandraCqlScripts().forEach(cqlSession::execute);
|
||||
}
|
||||
*/
|
||||
|
||||
// TODO: Remove use of deprecation after Spring Data for Apache Cassandra issues are resolved!
|
||||
@Override
|
||||
protected List<String> getStartupScripts() {
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.context.annotation.Profile;
|
||||
import org.testcontainers.containers.GenericContainer;
|
||||
|
||||
/**
|
||||
* Spring {@link @Configuration} for Apache Cassandra.
|
||||
* Spring {@link @Configuration} for Apache Cassandra using Testcontainers.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.springframework.context.annotation.Bean
|
||||
@@ -34,11 +34,12 @@ import org.testcontainers.containers.GenericContainer;
|
||||
@Configuration
|
||||
@Profile("inline-caching-cassandra")
|
||||
@SuppressWarnings("unused")
|
||||
public class CassandraConfiguration extends TestCassandraConfiguration {
|
||||
public class TestcontainersCassandraConfiguration extends TestCassandraConfiguration {
|
||||
|
||||
private static final String CASSANDRA_DOCKER_IMAGE_NAME = "cassandra:latest";
|
||||
|
||||
@Bean
|
||||
@SuppressWarnings("rawtypes")
|
||||
GenericContainer cassandraContainer() {
|
||||
|
||||
GenericContainer cassandraContainer = newCassandraContainer()
|
||||
@@ -49,11 +50,13 @@ public class CassandraConfiguration extends TestCassandraConfiguration {
|
||||
return cassandraContainer;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private GenericContainer newCassandraContainer() {
|
||||
return new GenericContainer(CASSANDRA_DOCKER_IMAGE_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("all")
|
||||
protected String getContactPoints() {
|
||||
return cassandraContainer().getContainerIpAddress();
|
||||
}
|
||||
Reference in New Issue
Block a user