Class CouchbaseContainer

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

public class CouchbaseContainer extends org.testcontainers.containers.GenericContainer<CouchbaseContainer>
Testcontainers implementation for Couchbase.

Supported image: couchbase/server

Exposed ports:

  • Console: 8091

Note that it does not depend on a specific couchbase SDK, so it can be used with both the Java SDK 2 and 3 as well as the Scala SDK 1 or newer. We recommend using the latest and greatest SDKs for the best experience.

  • 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
    CouchbaseContainer(String dockerImageName)
    Creates a new couchbase container with the specified image name.
    CouchbaseContainer(org.testcontainers.utility.DockerImageName dockerImageName)
    Create a new couchbase container with the specified image name.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     
    protected void
    containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)
     
    protected void
    containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo, boolean reused)
     
    protected void
    containerIsStarting(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)
     
    protected void
    containerIsStarting(com.github.dockerjava.api.command.InspectContainerResponse containerInfo, boolean reused)
     
    int
     
    int
     
     
    final String
     
    final String
     
    Enables the analytics service which is not enabled by default.
    withBucket(BucketDefinition bucketDefinition)
     
    withCredentials(String username, String password)
    Set custom username and password for the admin user.
     
    Enables the eventing service which is not enabled by default.
    withServiceQuota(CouchbaseService service, int quotaMb)
    Configures a custom memory quota for a given service.

    Methods inherited from class org.testcontainers.containers.GenericContainer

    addEnv, addExposedPort, addExposedPorts, addFileSystemBind, addFixedExposedPort, addFixedExposedPort, addLink, canBeReused, containerIsCreated, 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, 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, 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

    • CouchbaseContainer

      public CouchbaseContainer(String dockerImageName)
      Creates a new couchbase container with the specified image name.
      Parameters:
      dockerImageName - the image name that should be used.
    • CouchbaseContainer

      public CouchbaseContainer(org.testcontainers.utility.DockerImageName dockerImageName)
      Create a new couchbase container with the specified image name.
      Parameters:
      dockerImageName - the image name that should be used.
  • Method Details

    • withCredentials

      public CouchbaseContainer withCredentials(String username, String password)
      Set custom username and password for the admin user.
      Parameters:
      username - the admin username to use.
      password - the password for the admin user.
      Returns:
      this CouchbaseContainer for chaining purposes.
    • withBucket

      public CouchbaseContainer withBucket(BucketDefinition bucketDefinition)
    • withEnabledServices

      public CouchbaseContainer withEnabledServices(CouchbaseService... enabled)
    • withServiceQuota

      public CouchbaseContainer withServiceQuota(CouchbaseService service, int quotaMb)
      Configures a custom memory quota for a given service.
      Parameters:
      service - the service to configure the quota for.
      quotaMb - the memory quota in MB.
      Returns:
      this CouchbaseContainer for chaining purposes.
    • withAnalyticsService

      public CouchbaseContainer withAnalyticsService()
      Enables the analytics service which is not enabled by default.
      Returns:
      this CouchbaseContainer for chaining purposes.
    • withEventingService

      public CouchbaseContainer withEventingService()
      Enables the eventing service which is not enabled by default.
      Returns:
      this CouchbaseContainer for chaining purposes.
    • getUsername

      public final String getUsername()
    • getPassword

      public final String getPassword()
    • getBootstrapCarrierDirectPort

      public int getBootstrapCarrierDirectPort()
    • getBootstrapHttpDirectPort

      public int getBootstrapHttpDirectPort()
    • getConnectionString

      public String getConnectionString()
    • configure

      protected void configure()
      Overrides:
      configure in class org.testcontainers.containers.GenericContainer<CouchbaseContainer>
    • containerIsStarting

      protected void containerIsStarting(com.github.dockerjava.api.command.InspectContainerResponse containerInfo, boolean reused)
      Overrides:
      containerIsStarting in class org.testcontainers.containers.GenericContainer<CouchbaseContainer>
    • containerIsStarting

      protected void containerIsStarting(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)
      Overrides:
      containerIsStarting in class org.testcontainers.containers.GenericContainer<CouchbaseContainer>
    • containerIsStarted

      protected void containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo, boolean reused)
      Overrides:
      containerIsStarted in class org.testcontainers.containers.GenericContainer<CouchbaseContainer>
    • containerIsStarted

      protected void containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)
      Overrides:
      containerIsStarted in class org.testcontainers.containers.GenericContainer<CouchbaseContainer>