Skip to content

Commit

Permalink
Fix deprecation of o.t.containers.CassandraContainer
Browse files Browse the repository at this point in the history
... in favor of `org.testcontainers.cassandra.CassandraContainer`. It seems that has been introduced by the testcontainers bump in projectnessie#9675.
  • Loading branch information
snazy committed Oct 1, 2024
1 parent b444b12 commit ef561d5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.projectnessie.versioned.storage.cassandra2tests;

import static java.lang.String.format;
import static org.testcontainers.containers.CassandraContainer.CQL_PORT;

import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.metadata.Metadata;
Expand All @@ -32,7 +31,7 @@
import org.projectnessie.versioned.storage.testextension.BackendTestFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.CassandraContainer;
import org.testcontainers.cassandra.CassandraContainer;
import org.testcontainers.containers.ContainerLaunchException;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.utility.DockerImageName;
Expand All @@ -42,11 +41,12 @@ public abstract class AbstractCassandraBackendTestFactory implements BackendTest
private static final Logger LOGGER =
LoggerFactory.getLogger(AbstractCassandraBackendTestFactory.class);
public static final String KEYSPACE_FOR_TEST = "nessie";
public static final Integer CQL_PORT = 9042;

private final String dbName;
private final List<String> args;

private CassandraContainer<?> container;
private CassandraContainer container;
private InetSocketAddress hostAndPort;
private String localDc;

Expand Down Expand Up @@ -117,8 +117,8 @@ public void start(Optional<String> containerNetworkId) {
.asCompatibleSubstituteFor("cassandra");

for (int retry = 0; ; retry++) {
CassandraContainer<?> c =
new CassandraContainer<>(dockerImageName)
CassandraContainer c =
new CassandraContainer(dockerImageName)
.withLogConsumer(new Slf4jLogConsumer(LOGGER))
.withCommand(args.toArray(new String[0]));
configureContainer(c);
Expand Down Expand Up @@ -161,7 +161,7 @@ public String getLocalDc() {
return localDc;
}

protected abstract void configureContainer(CassandraContainer<?> c);
protected abstract void configureContainer(CassandraContainer c);

@Override
public void start() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import static java.util.Collections.emptyList;

import org.projectnessie.versioned.storage.cassandra2.Cassandra2BackendFactory;
import org.testcontainers.containers.CassandraContainer;
import org.testcontainers.cassandra.CassandraContainer;

public class CassandraBackendTestFactory extends AbstractCassandraBackendTestFactory {

Expand All @@ -37,7 +37,7 @@ public String getName() {
}

@Override
protected void configureContainer(CassandraContainer<?> c) {
protected void configureContainer(CassandraContainer c) {
c.withEnv("JVM_OPTS", JVM_OPTS_TEST);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import static java.lang.String.format;
import static java.util.Arrays.asList;

import org.testcontainers.containers.CassandraContainer;
import org.testcontainers.cassandra.CassandraContainer;

public class ScyllaDBBackendTestFactory extends AbstractCassandraBackendTestFactory {

Expand All @@ -47,5 +47,5 @@ public String getName() {
}

@Override
protected void configureContainer(CassandraContainer<?> c) {}
protected void configureContainer(CassandraContainer c) {}
}

0 comments on commit ef561d5

Please sign in to comment.