Class YugabyteDBYCQLContainer

java.lang.Object
org.testcontainers.containers.GenericContainer<YugabyteDBYCQLContainer>
org.testcontainers.containers.YugabyteDBYCQLContainer
All Implemented Interfaces:
AutoCloseable, org.testcontainers.containers.Container<YugabyteDBYCQLContainer>, org.testcontainers.containers.ContainerState, org.testcontainers.containers.traits.LinkableContainer, org.testcontainers.containers.wait.strategy.WaitStrategyTarget, org.testcontainers.lifecycle.Startable

public class YugabyteDBYCQLContainer extends org.testcontainers.containers.GenericContainer<YugabyteDBYCQLContainer>
Testcontainers implementation for YugabyteDB YCQL API.

Supported image: yugabytedb/yugabyte

Exposed ports:

  • YCQL: 5433
  • Master dashboard: 7000
  • Tserver dashboard: 9000
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.testcontainers.containers.Container

    org.testcontainers.containers.Container.ExecResult
  • Field Summary

    Fields inherited from class org.testcontainers.containers.GenericContainer

    CONTAINER_RUNNING_TIMEOUT_SEC, dependencies, dockerClient, INTERNAL_HOST_HOSTNAME, waitStrategy

    Fields inherited from interface org.testcontainers.containers.ContainerState

    STATE_HEALTHY
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    YugabyteDBYCQLContainer(org.testcontainers.utility.DockerImageName imageName)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Configures the environment variables.
    protected void
    containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)
    Executes the initialization script
    Returns a InetSocketAddress representation of YCQL's contact point info
    Keyspace getter method
     
    Returns the local datacenter name
    Password getter method
    Username getter method
    withInitScript(String initScript)
     
    Setting this would create the keyspace
    withPassword(String password)
    Setting this along with withUsername(String) would enable authentication
    withUsername(String username)
    Setting this would create the custom user role

    Methods inherited from class org.testcontainers.containers.GenericContainer

    addEnv, addExposedPort, addExposedPorts, addFileSystemBind, addFixedExposedPort, addFixedExposedPort, addLink, canBeReused, containerIsCreated, containerIsStarted, containerIsStarting, containerIsStarting, containerIsStopped, containerIsStopping, copyFileFromContainer, createVolumeDirectory, dependsOn, dependsOn, dependsOn, doStart, equals, getBinds, getCommandParts, getContainerId, getContainerInfo, getContainerName, getCopyToFileContainerPathMap, getCreateContainerCmdModifiers, getDependencies, getDockerClient, getDockerImageName, getEnv, getEnvMap, getExposedPorts, getExtraHosts, getImage, getIpAddress, getLabels, getLinkedContainers, getLivenessCheckPort, 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, stop, 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, withWorkingDirectory

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.testcontainers.containers.Container

    addFileSystemBind, followOutput, followOutput, self, withEnv, withFileSystemBind

    Methods inherited from interface org.testcontainers.containers.ContainerState

    copyFileFromContainer, copyFileToContainer, copyFileToContainer, execInContainer, execInContainer, execInContainer, execInContainer, execInContainerWithUser, execInContainerWithUser, getBoundPortNumbers, getContainerIpAddress, getCurrentContainerInfo, getFirstMappedPort, getHost, getLogs, getLogs, getMappedPort, isCreated, isHealthy, isRunning

    Methods inherited from interface org.testcontainers.lifecycle.Startable

    close
  • Constructor Details

    • YugabyteDBYCQLContainer

      public YugabyteDBYCQLContainer(String imageName)
      Parameters:
      imageName - image name
    • YugabyteDBYCQLContainer

      public YugabyteDBYCQLContainer(org.testcontainers.utility.DockerImageName imageName)
      Parameters:
      imageName - image name
  • Method Details

    • getLivenessCheckPortNumbers

      public Set<Integer> getLivenessCheckPortNumbers()
      Specified by:
      getLivenessCheckPortNumbers in interface org.testcontainers.containers.wait.strategy.WaitStrategyTarget
      Overrides:
      getLivenessCheckPortNumbers in class org.testcontainers.containers.GenericContainer<YugabyteDBYCQLContainer>
    • configure

      protected void configure()
      Configures the environment variables. Setting up these variables would create the custom objects. Setting withKeyspaceName(String), withUsername(String), withPassword(String) these parameters will initialize the database with those custom values
      Overrides:
      configure in class org.testcontainers.containers.GenericContainer<YugabyteDBYCQLContainer>
    • withInitScript

      public YugabyteDBYCQLContainer withInitScript(String initScript)
      Parameters:
      initScript - path of the initialization script file
      Returns:
      YugabyteDBYCQLContainer instance
    • withKeyspaceName

      public YugabyteDBYCQLContainer withKeyspaceName(String keyspace)
      Setting this would create the keyspace
      Parameters:
      keyspace - keyspace
      Returns:
      YugabyteDBYCQLContainer instance
    • withUsername

      public YugabyteDBYCQLContainer withUsername(String username)
      Setting this would create the custom user role
      Parameters:
      username - user name
      Returns:
      YugabyteDBYCQLContainer instance
    • withPassword

      public YugabyteDBYCQLContainer withPassword(String password)
      Setting this along with withUsername(String) would enable authentication
      Parameters:
      password - password
      Returns:
      YugabyteDBYCQLContainer instance
    • containerIsStarted

      protected void containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)
      Executes the initialization script
      Overrides:
      containerIsStarted in class org.testcontainers.containers.GenericContainer<YugabyteDBYCQLContainer>
      Parameters:
      containerInfo - containerInfo
    • getContactPoint

      public InetSocketAddress getContactPoint()
      Returns a InetSocketAddress representation of YCQL's contact point info
      Returns:
      contactpoint
    • getLocalDc

      public String getLocalDc()
      Returns the local datacenter name
      Returns:
      localdc name
    • getUsername

      public String getUsername()
      Username getter method
      Returns:
      username
    • getPassword

      public String getPassword()
      Password getter method
      Returns:
      password
    • getKeyspace

      public String getKeyspace()
      Keyspace getter method
      Returns:
      keyspace