org.testcontainers.containers.CassandraContainer Java Examples

The following examples show how to use org.testcontainers.containers.CassandraContainer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CassandraDatabaseDelegate.java    From testcontainers-java with MIT License 5 votes vote down vote up
@Override
protected Session createNewConnection() {
    try {
        return CassandraContainer.getCluster(container)
                .newSession();
    } catch (DriverException e) {
        log.error("Could not obtain cassandra connection");
        throw new ConnectionCreationException("Could not obtain cassandra connection", e);
    }
}
 
Example #2
Source File: CassandraDatastaxIT.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
@BeforeClass
    public static void startUpBeforeClass() {
        Assume.assumeTrue("Docker not enabled", DockerMachineClient.instance().isInstalled());

        cassandra.start();

//        String containerIpAddress = cassandra.getContainerIpAddress();
        final int port = cassandra.getMappedPort(CassandraContainer.CQL_PORT);
        CASSANDRA_ADDRESS = HOST + ":" + port;
        cluster = newCluster(HOST, port);
        init(cluster);
    }
 
Example #3
Source File: CassandraDatastaxITBase.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
public static void startCassandra(String dockerImageVersion) {
        Assume.assumeTrue("Docker not enabled", DockerMachineClient.instance().isInstalled());
        cassandra = new CassandraContainer(dockerImageVersion);
        cassandra.start();

//        String containerIpAddress = cassandra.getContainerIpAddress();
        final int port = cassandra.getMappedPort(CassandraContainer.CQL_PORT);
        CASSANDRA_ADDRESS = HOST + ":" + port;
        cluster = newCluster(HOST, port);
        init(cluster);
    }