Class LocalStackContainer

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

@Deprecated public class LocalStackContainer extends org.testcontainers.containers.GenericContainer<LocalStackContainer>
Deprecated.
use LocalStackContainer instead.
Testcontainers implementation for LocalStack.

Supported images: localstack/localstack, localstack/localstack-pro

Exposed ports: 4566

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Deprecated.
     
    static enum 
    Deprecated.
     

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

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

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Deprecated.

    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
    Deprecated.
    Deprecated.
    LocalStackContainer(org.testcontainers.utility.DockerImageName dockerImageName)
    Deprecated.
     
    LocalStackContainer(org.testcontainers.utility.DockerImageName dockerImageName, boolean useLegacyMode)
    Deprecated.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Deprecated.
     
    protected void
    containerIsStarting(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)
    Deprecated.
     
    Deprecated.
    Provides a default access key that is preconfigured to communicate with a given simulated service.
    Deprecated.
    Provides an endpoint to communicate with LocalStack service.
    Deprecated.
    Provides an endpoint override that is preconfigured to communicate with a given simulated service.
    Deprecated.
     
    Deprecated.
    Provides a default region that is preconfigured to communicate with a given simulated service.
    Deprecated.
    Provides a default secret key that is preconfigured to communicate with a given simulated service.
    Deprecated.
    Declare a set of simulated AWS services that should be launched by this container.
    Deprecated.
     

    Methods inherited from class org.testcontainers.containers.GenericContainer

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

  • Constructor Details

    • LocalStackContainer

      @Deprecated public LocalStackContainer()
      Deprecated.
    • LocalStackContainer

      @Deprecated public LocalStackContainer(String version)
      Deprecated.
    • LocalStackContainer

      public LocalStackContainer(org.testcontainers.utility.DockerImageName dockerImageName)
      Deprecated.
      Parameters:
      dockerImageName - image name to use for Localstack
    • LocalStackContainer

      @Deprecated public LocalStackContainer(org.testcontainers.utility.DockerImageName dockerImageName, boolean useLegacyMode)
      Deprecated.
      Parameters:
      dockerImageName - image name to use for Localstack
      useLegacyMode - if true, each AWS service is exposed on a different port
  • Method Details

    • configure

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

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

      public LocalStackContainer withServices(LocalStackContainer.Service... services)
      Deprecated.
    • withServices

      public LocalStackContainer withServices(LocalStackContainer.EnabledService... services)
      Deprecated.
      Declare a set of simulated AWS services that should be launched by this container.
      Parameters:
      services - one or more service names
      Returns:
      this container object
    • getEndpointOverride

      public URI getEndpointOverride(LocalStackContainer.Service service)
      Deprecated.
    • getEndpointOverride

      public URI getEndpointOverride(LocalStackContainer.EnabledService service)
      Deprecated.
      Provides an endpoint override that is preconfigured to communicate with a given simulated service. The provided endpoint override should be set in the AWS Java SDK v2 when building a client, e.g.:
      S3Client s3 = S3Client
                   .builder()
                   .endpointOverride(localstack.getEndpointOverride(LocalStackContainer.Service.S3))
                   .credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(
                   localstack.getAccessKey(), localstack.getSecretKey()
                   )))
                   .region(Region.of(localstack.getRegion()))
                   .build()
                   

      Please note that this method is only intended to be used for configuring AWS SDK clients that are running on the test host. If other containers need to call this one, they should be configured specifically to do so using a Docker network and appropriate addressing.

      Parameters:
      service - the service that is to be accessed
      Returns:
      an URI endpoint override
    • getEndpoint

      public URI getEndpoint()
      Deprecated.
      Provides an endpoint to communicate with LocalStack service. The provided endpoint should be set in the AWS Java SDK v2 when building a client, e.g.:
      S3Client s3 = S3Client
                   .builder()
                   .endpointOverride(localstack.getEndpoint())
                   .credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(
                   localstack.getAccessKey(), localstack.getSecretKey()
                   )))
                   .region(Region.of(localstack.getRegion()))
                   .build()
                   

      Please note that this method is only intended to be used for configuring AWS SDK clients that are running on the test host. If other containers need to call this one, they should be configured specifically to do so using a Docker network and appropriate addressing.

      Returns:
      an URI endpoint
    • getAccessKey

      public String getAccessKey()
      Deprecated.
      Provides a default access key that is preconfigured to communicate with a given simulated service. AWS Access Key The access key can be used to construct AWS SDK v2 clients:
      S3Client s3 = S3Client
                   .builder()
                   .endpointOverride(localstack.getEndpointOverride(LocalStackContainer.Service.S3))
                   .credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(
                   localstack.getAccessKey(), localstack.getSecretKey()
                   )))
                   .region(Region.of(localstack.getRegion()))
                   .build()
           
      Returns:
      a default access key
    • getSecretKey

      public String getSecretKey()
      Deprecated.
      Provides a default secret key that is preconfigured to communicate with a given simulated service. AWS Secret Key The secret key can be used to construct AWS SDK v2 clients:
      S3Client s3 = S3Client
                   .builder()
                   .endpointOverride(localstack.getEndpointOverride(LocalStackContainer.Service.S3))
                   .credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(
                   localstack.getAccessKey(), localstack.getSecretKey()
                   )))
                   .region(Region.of(localstack.getRegion()))
                   .build()
           
      Returns:
      a default secret key
    • getRegion

      public String getRegion()
      Deprecated.
      Provides a default region that is preconfigured to communicate with a given simulated service. The region can be used to construct AWS SDK v2 clients:
      S3Client s3 = S3Client
                   .builder()
                   .endpointOverride(localstack.getEndpointOverride(LocalStackContainer.Service.S3))
                   .credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(
                   localstack.getAccessKey(), localstack.getSecretKey()
                   )))
                   .region(Region.of(localstack.getRegion()))
                   .build()
           
      Returns:
      a default region