public class CassandraContainer<SELF extends CassandraContainer<SELF>>
extends org.testcontainers.containers.GenericContainer<SELF>
| Modifier and Type | Field and Description |
|---|---|
static java.lang.Integer |
CQL_PORT |
static java.lang.String |
IMAGE
Deprecated.
|
| Constructor and Description |
|---|
CassandraContainer()
Deprecated.
use
CassandraContainer(DockerImageName) instead |
CassandraContainer(org.testcontainers.utility.DockerImageName dockerImageName) |
CassandraContainer(java.lang.String dockerImageName) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configure() |
protected void |
containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo) |
com.datastax.driver.core.Cluster |
getCluster()
Get configured Cluster
Can be used to obtain connections to Cassandra in the container
|
static com.datastax.driver.core.Cluster |
getCluster(org.testcontainers.containers.ContainerState containerState) |
static com.datastax.driver.core.Cluster |
getCluster(org.testcontainers.containers.ContainerState containerState,
boolean enableJmxReporting) |
java.lang.String |
getPassword()
Get password
By default Cassandra has authenticator: AllowAllAuthenticator in cassandra.yaml
If username and password need to be used, then authenticator should be set as PasswordAuthenticator
(through custom Cassandra configuration) and through CQL with default cassandra-cassandra credentials
user management should be modified
|
java.lang.String |
getUsername()
Get username
By default Cassandra has authenticator: AllowAllAuthenticator in cassandra.yaml
If username and password need to be used, then authenticator should be set as PasswordAuthenticator
(through custom Cassandra configuration) and through CQL with default cassandra-cassandra credentials
user management should be modified
|
protected void |
optionallyMapResourceParameterAsVolume(java.lang.String pathNameInContainer,
java.lang.String resourceLocation)
Map (effectively replace) directory in Docker with the content of resourceLocation if resource location is not null
Protected to allow for changing implementation by extending the class
|
SELF |
withConfigurationOverride(java.lang.String configLocation)
Initialize Cassandra with the custom overridden Cassandra configuration
|
SELF |
withInitScript(java.lang.String initScriptPath)
Initialize Cassandra with init CQL script
|
SELF |
withJmxReporting(boolean enableJmxReporting)
Initialize Cassandra client with JMX reporting enabled or disabled
|
addEnv, addExposedPort, addExposedPorts, addFileSystemBind, addFixedExposedPort, addFixedExposedPort, addLink, apply, canBeReused, containerIsCreated, containerIsStarted, containerIsStarting, containerIsStarting, containerIsStopped, containerIsStopping, copyFileFromContainer, createVolumeDirectory, dependsOn, dependsOn, dependsOn, doStart, equals, failed, finished, getBinds, getCommandParts, getContainerId, getContainerInfo, getContainerName, getCopyToFileContainerPathMap, getCreateContainerCmdModifiers, getDependencies, getDockerClient, getDockerImageName, getEnv, getEnvMap, getExposedPorts, getExtraHosts, getImage, getIpAddress, getLabels, getLinkedContainers, getLivenessCheckPort, getLivenessCheckPortNumbers, getLivenessCheckPorts, getLogConsumers, getNetwork, getNetworkAliases, getNetworkMode, getPortBindings, getShmSize, getStartupAttempts, getStartupCheckStrategy, getTestHostIpAddress, getTmpFsMapping, getVolumesFroms, getWaitStrategy, getWorkingDirectory, hashCode, isHostAccessible, isPrivilegedMode, isShouldBeReused, logger, setBinds, setCommand, setCommand, setCommandParts, setCopyToFileContainerPathMap, setDockerImageName, setEnv, setExposedPorts, setExtraHosts, setHostAccessible, setImage, setLabels, setLinkedContainers, setLogConsumers, setNetwork, setNetworkAliases, setNetworkMode, setPortBindings, setPrivilegedMode, setShmSize, setStartupAttempts, setStartupCheckStrategy, setTmpFsMapping, setVolumesFroms, setWaitStrategy, setWorkingDirectory, start, starting, stop, succeeded, toString, waitingFor, waitUntilContainerStarted, withAccessToHost, withClasspathResourceMapping, withClasspathResourceMapping, withCommand, withCommand, withCopyFileToContainer, withCreateContainerCmdModifier, withEnv, withEnv, withExposedPorts, withExtraHost, withFileSystemBind, withImagePullPolicy, withLabel, withLabels, withLogConsumer, withMinimumRunningDuration, withNetwork, withNetworkAliases, withNetworkMode, withPrivilegedMode, withReuse, withSharedMemorySize, withStartupAttempts, withStartupCheckStrategy, withStartupTimeout, withTmpFs, withVolumesFrom, withWorkingDirectoryclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddFileSystemBind, followOutput, followOutput, self, withEnv, withFileSystemBindcopyFileFromContainer, copyFileToContainer, copyFileToContainer, execInContainer, execInContainer, getBoundPortNumbers, getContainerIpAddress, getCurrentContainerInfo, getFirstMappedPort, getHost, getLogs, getLogs, getMappedPort, isCreated, isHealthy, isRunning@Deprecated public static final java.lang.String IMAGE
public static final java.lang.Integer CQL_PORT
@Deprecated public CassandraContainer()
CassandraContainer(DockerImageName) insteadpublic CassandraContainer(java.lang.String dockerImageName)
public CassandraContainer(org.testcontainers.utility.DockerImageName dockerImageName)
protected void configure()
configure in class org.testcontainers.containers.GenericContainer<SELF extends CassandraContainer<SELF>>protected void containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)
containerIsStarted in class org.testcontainers.containers.GenericContainer<SELF extends CassandraContainer<SELF>>protected void optionallyMapResourceParameterAsVolume(java.lang.String pathNameInContainer,
java.lang.String resourceLocation)
pathNameInContainer - path in dockerresourceLocation - relative classpath to resourcepublic SELF withConfigurationOverride(java.lang.String configLocation)
Be aware, that Docker effectively replaces all /etc/cassandra content with the content of config location, so if Cassandra.yaml in configLocation is absent or corrupted, then Cassandra just won't launch
configLocation - relative classpath with the directory that contains cassandra.yaml and other configuration filespublic SELF withInitScript(java.lang.String initScriptPath)
CQL script will be applied after container is started (see using WaitStrategy)
initScriptPath - relative classpath resourcepublic SELF withJmxReporting(boolean enableJmxReporting)
public java.lang.String getUsername()
public java.lang.String getPassword()
public com.datastax.driver.core.Cluster getCluster()
public static com.datastax.driver.core.Cluster getCluster(org.testcontainers.containers.ContainerState containerState,
boolean enableJmxReporting)
public static com.datastax.driver.core.Cluster getCluster(org.testcontainers.containers.ContainerState containerState)