diff --git a/integration-tests/cassandraql/pom.xml b/integration-tests/cassandraql/pom.xml index c0fed2366c21..025df4b50a49 100644 --- a/integration-tests/cassandraql/pom.xml +++ b/integration-tests/cassandraql/pom.xml @@ -30,34 +30,6 @@ Camel Quarkus :: Integration Tests :: Cassandra CQL Integration tests for Camel Quarkus Cassandra CQL extension - - - - - com.datastax.cassandra - cassandra-driver-core - ${cassandra-driver-test.version} - - - com.github.stephenc.jcip - jcip-annotations - - - com.google.code.findbugs - jsr305 - - - com.google.guava - listenablefuture - - - org.checkerframework - checker-qual - - - - - org.apache.camel.quarkus @@ -108,19 +80,12 @@ com.github.jnr jnr-posix - com.datastax.cassandra cassandra-driver-core - - - com.datastax.cassandra - cassandra-driver-core - test - io.quarkus quarkus-junit4-mock diff --git a/integration-tests/cassandraql/src/test/java/org/apache/camel/quarkus/component/cassandraql/it/CassandraqlTestResource.java b/integration-tests/cassandraql/src/test/java/org/apache/camel/quarkus/component/cassandraql/it/CassandraqlTestResource.java index 3d3670057fc9..bba4709952c0 100644 --- a/integration-tests/cassandraql/src/test/java/org/apache/camel/quarkus/component/cassandraql/it/CassandraqlTestResource.java +++ b/integration-tests/cassandraql/src/test/java/org/apache/camel/quarkus/component/cassandraql/it/CassandraqlTestResource.java @@ -17,36 +17,38 @@ package org.apache.camel.quarkus.component.cassandraql.it; +import java.net.InetSocketAddress; +import java.time.Duration; import java.util.Map; -import com.datastax.driver.core.Cluster; -import com.datastax.driver.core.Session; +import com.datastax.oss.driver.api.core.CqlSession; +import com.datastax.oss.driver.api.core.CqlSessionBuilder; +import com.datastax.oss.driver.api.core.config.DefaultDriverOption; +import com.datastax.oss.driver.api.core.config.DriverConfigLoader; import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; import org.apache.camel.util.CollectionHelper; import org.eclipse.microprofile.config.ConfigProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.testcontainers.containers.CassandraContainer; +import org.testcontainers.cassandra.CassandraContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.utility.DockerImageName; import org.testcontainers.utility.TestcontainersConfiguration; -import static org.testcontainers.containers.CassandraContainer.CQL_PORT; - public class CassandraqlTestResource implements QuarkusTestResourceLifecycleManager { private static final Logger LOGGER = LoggerFactory.getLogger(CassandraqlTestResource.class); private static final int PORT = 9042; private static final String DOCKER_IMAGE_NAME = ConfigProvider.getConfig().getValue("cassandra.container.image", String.class); - protected CassandraContainer container; + protected CassandraContainer container; @Override public Map start() { LOGGER.info(TestcontainersConfiguration.getInstance().toString()); try { DockerImageName imageName = DockerImageName.parse(DOCKER_IMAGE_NAME).asCompatibleSubstituteFor("cassandra"); - container = new CassandraContainer<>(imageName) + container = new CassandraContainer(imageName) .withExposedPorts(PORT) .waitingFor(Wait.forLogMessage(".*Created default superuser role.*", 1)) .withEnv("JVM_EXTRA_OPTS", "-Xss448k") @@ -73,15 +75,16 @@ public Map start() { } } - private void initDB(CassandraContainer container) { - Cluster cluster = Cluster.builder() - .addContactPoint(container.getHost()) - .withPort(container.getMappedPort(CQL_PORT)) - .withCredentials(container.getUsername(), container.getPassword()) - .withoutJMXReporting() - .build(); + private void initDB(CassandraContainer container) { + InetSocketAddress endpoint = new InetSocketAddress(container.getHost(), container.getMappedPort(PORT)); + CqlSessionBuilder builder = CqlSession.builder() + .withLocalDatacenter(container.getLocalDatacenter()) + .withAuthCredentials(container.getUsername(), container.getPassword()) + .withConfigLoader(DriverConfigLoader.programmaticBuilder() + .withDuration(DefaultDriverOption.REQUEST_TIMEOUT, Duration.ofSeconds(5)).build()) + .addContactPoint(endpoint); - try (Session session = cluster.connect()) { + try (CqlSession session = builder.build()) { session.execute("CREATE KEYSPACE IF NOT EXISTS " + CassandraqlRoutes.KEYSPACE + " WITH replication = \n" + "{'class':'SimpleStrategy','replication_factor':'1'};"); diff --git a/pom.xml b/pom.xml index 7e10e3700a36..f07fe77945e3 100644 --- a/pom.xml +++ b/pom.xml @@ -79,7 +79,6 @@ 1.53.0 1.14.0 1.0.0-beta.24 - 3.7.1 1.79 3.1.8 ${commons-beanutils-version}