public class CassandraContainer extends org.testcontainers.containers.GenericContainer<CassandraContainer>
Supported image: cassandra
Exposed ports: 9042
| Constructor and Description |
|---|
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) |
java.net.InetSocketAddress |
getContactPoint()
Retrieve an
InetSocketAddress for connecting to the Cassandra container via the driver. |
java.lang.String |
getLocalDatacenter()
Retrieve the Local Datacenter for connecting to the Cassandra container via the driver.
|
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
|
CassandraContainer |
withConfigurationOverride(java.lang.String configLocation)
Initialize Cassandra with the custom overridden Cassandra configuration
|
CassandraContainer |
withInitScript(java.lang.String initScriptPath)
Initialize Cassandra with init CQL script
|
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, setContainerDef, 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, withCopyToContainer, 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, execInContainer, execInContainer, execInContainerWithUser, execInContainerWithUser, getBoundPortNumbers, getContainerIpAddress, getCurrentContainerInfo, getFirstMappedPort, getHost, getLogs, getLogs, getMappedPort, isCreated, isHealthy, isRunningpublic CassandraContainer(java.lang.String dockerImageName)
public CassandraContainer(org.testcontainers.utility.DockerImageName dockerImageName)
protected void configure()
configure in class org.testcontainers.containers.GenericContainer<CassandraContainer>protected void containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)
containerIsStarted in class org.testcontainers.containers.GenericContainer<CassandraContainer>public CassandraContainer 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 CassandraContainer withInitScript(java.lang.String initScriptPath)
CQL script will be applied after container is started (see using WaitStrategy).
initScriptPath - relative classpath resourcepublic java.lang.String getUsername()
public java.lang.String getPassword()
public java.net.InetSocketAddress getContactPoint()
InetSocketAddress for connecting to the Cassandra container via the driver.public java.lang.String getLocalDatacenter()