Package io.ebean.test.containers
Class LocalstackContainer
java.lang.Object
io.ebean.test.containers.LocalstackContainer
- All Implemented Interfaces:
Container<LocalstackContainer>
Localstack container support.
LocalstackContainer container = LocalstackContainer.builder("0.14")
// .port(4566)
// .image("localstack/localstack:0.14")
.build();
container.start();
AmazonDynamoDB amazonDynamoDB = container.dynamoDB();
createTable(amazonDynamoDB);
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for LocalstackContainer. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate the container using the given config. -
Method Summary
Modifier and TypeMethodDescriptionstatic LocalstackContainer.BuilderCreate a builder for LocalstackContainer given the localstack image version.config()Returns the container configuration.protected ProcessBuildercreateProcessBuilder(List<String> args) com.amazonaws.services.dynamodbv2.AmazonDynamoDBdynamoDB()Return the AmazonDynamoDB (V1 SDK) that can be used for this container.endpoint()booleanReturn true if the container is running.com.amazonaws.services.kinesis.AmazonKinesiskinesis()Return AmazonKinesis (V1 SDK) that can be used for this container.static LocalstackContainer.BuildernewBuilder(String version) Deprecated.intport()Return the port this container is using.protected StringreadUrlContent(String url) Return http GET content given the url.voidRegister a JVM Shutdown hook to stop the container with the given mode.protected ProcessBuilderReturn the ProcessBuilder used to execute the container run command.sdk1()Return the AWS v1 SDK compatible helper that provides API for AmazonDynamoDB client, AmazonSNS, AmazonSQS etc.sdk2()Return the AWS v2 SDK compatible helper that provides API for DynamoDB client, SNSClient, SQQClient etc.protected voidSet a default container name if not using random port.protected booleanshutdownHook(boolean started) com.amazonaws.services.sns.AmazonSNSsns()Return the AmazonSNS (V1 SDK) client for this container.com.amazonaws.services.sqs.AmazonSQSsqs()Return the AmazonSQS (V1 SDK) client for this container.start()Start and return the container.booleanStart the container returning true if successful.voidStart the container or throw a IllegalStateException.protected booleanvoidstop()Stop using the configured stopMode of 'stop' or 'remove'.voidStop and remove the container effectively deleting the container.
-
Field Details
-
buildConfig
protected final io.ebean.test.containers.BaseBuilder<?,?> buildConfig -
config
protected io.ebean.test.containers.InternalConfig config -
commands
-
waitForConnectivityAttempts
protected int waitForConnectivityAttempts -
shutdownMode
-
usingContainerId
protected boolean usingContainerId -
usingRandomPort
protected boolean usingRandomPort -
removeOnExit
protected boolean removeOnExit
-
-
Constructor Details
-
LocalstackContainer
Create the container using the given config.
-
-
Method Details
-
start
Description copied from interface:ContainerStart and return the container.Throws an IllegalStateException if the container can not be started.
-
builder
Create a builder for LocalstackContainer given the localstack image version. -
newBuilder
Deprecated.Deprecated - migrate to builder(). -
dynamoDB
public com.amazonaws.services.dynamodbv2.AmazonDynamoDB dynamoDB()Return the AmazonDynamoDB (V1 SDK) that can be used for this container.This should be used AFTER the container is started.
-
kinesis
public com.amazonaws.services.kinesis.AmazonKinesis kinesis()Return AmazonKinesis (V1 SDK) that can be used for this container.This should be used AFTER the container is started.
-
sns
public com.amazonaws.services.sns.AmazonSNS sns()Return the AmazonSNS (V1 SDK) client for this container. -
sqs
public com.amazonaws.services.sqs.AmazonSQS sqs()Return the AmazonSQS (V1 SDK) client for this container. -
sdk2
Return the AWS v2 SDK compatible helper that provides API for DynamoDB client, SNSClient, SQQClient etc. -
sdk1
Return the AWS v1 SDK compatible helper that provides API for AmazonDynamoDB client, AmazonSNS, AmazonSQS etc. -
endpoint
-
endpointUrl
-
awsRegion
-
runProcess
Return the ProcessBuilder used to execute the container run command. -
config
Description copied from interface:ContainerReturns the container configuration. -
startMaybe
public boolean startMaybe()Description copied from interface:ContainerStart the container returning true if successful.- Specified by:
startMaybein interfaceContainer<C extends Container<C>>
-
startOrThrow
public void startOrThrow()Description copied from interface:ContainerStart the container or throw a IllegalStateException.- Specified by:
startOrThrowin interfaceContainer<C extends Container<C>>
-
port
public int port()Description copied from interface:ContainerReturn the port this container is using.This is typically useful if the container was started with a random port and, we need to know what that port was.
-
setDefaultContainerName
protected void setDefaultContainerName()Set a default container name if not using random port. -
isRunning
public boolean isRunning()Description copied from interface:ContainerReturn true if the container is running. -
registerShutdownHook
public void registerShutdownHook()Register a JVM Shutdown hook to stop the container with the given mode. -
shutdownHook
protected boolean shutdownHook(boolean started) -
startWithConnectivity
protected boolean startWithConnectivity() -
stop
public void stop()Stop using the configured stopMode of 'stop' or 'remove'.Remove additionally removes the container (expected use in build agents).
-
stopRemove
public void stopRemove()Stop and remove the container effectively deleting the container.- Specified by:
stopRemovein interfaceContainer<C extends Container<C>>
-
createProcessBuilder
-
dockerRun
-
readUrlContent
Return http GET content given the url.- Throws:
IOException
-