Skip to content

Commit

Permalink
Remove redundant dependency overrides for org.testcontainers:cassandra
Browse files Browse the repository at this point in the history
Fixes #3773
  • Loading branch information
jamesnetherton committed Dec 9, 2024
1 parent 83bbb39 commit 2c1a72d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 51 deletions.
35 changes: 0 additions & 35 deletions integration-tests/cassandraql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,6 @@
<name>Camel Quarkus :: Integration Tests :: Cassandra CQL</name>
<description>Integration tests for Camel Quarkus Cassandra CQL extension</description>

<dependencyManagement>
<dependencies>
<!-- Handle temporary version of cassandra-driver-core see https://github.com/apache/camel-quarkus/issues/3773 -->
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>${cassandra-driver-test.version}</version>
<exclusions>
<exclusion>
<groupId>com.github.stephenc.jcip</groupId>
<artifactId>jcip-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>listenablefuture</artifactId>
</exclusion>
<exclusion>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
Expand Down Expand Up @@ -108,19 +80,12 @@
<groupId>com.github.jnr</groupId>
<artifactId>jnr-posix</artifactId>
</exclusion>
<!-- Handle temporary version of cassandra-driver-core see https://github.com/apache/camel-quarkus/issues/3773 -->
<exclusion>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit4-mock</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> 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")
Expand All @@ -73,15 +75,16 @@ public Map<String, String> 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'};");

Expand Down
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
<azure-core.version>1.53.0</azure-core.version><!-- @sync com.azure:azure-sdk-bom:${azure-sdk-bom.version} dep:com.azure:azure-core -->
<azure-identity.version>1.14.0</azure-identity.version><!-- @sync com.azure:azure-sdk-bom:${azure-sdk-bom.version} dep:com.azure:azure-identity -->
<azure-core-http-vertx.version>1.0.0-beta.24</azure-core-http-vertx.version> <!-- TODO: https://github.com/apache/camel-quarkus/issues/4181 -->
<cassandra-driver-test.version>3.7.1</cassandra-driver-test.version><!-- Keep in sync with testcontainers instead of Debezium bom -->
<bouncycastle.version>1.79</bouncycastle.version><!-- @sync io.quarkus:quarkus-bom:${quarkus.version} dep:org.bouncycastle:bcprov-jdk18on -->
<caffeine.version>3.1.8</caffeine.version><!-- @sync io.quarkus:quarkus-bom:${quarkus.version} dep:com.github.ben-manes.caffeine:caffeine -->
<commons-beanutils.version>${commons-beanutils-version}</commons-beanutils.version>
Expand Down

0 comments on commit 2c1a72d

Please sign in to comment.