Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/main/java/io/ebean/test/containers/Localstack2Container.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
*
* <pre>{@code
*
* Localstack2Container container = Localstack2Container.builder("0.14")
* Localstack2Container container = Localstack2Container.builder("4.0.3")
* // .port(4566)
* // .image("localstack/localstack:0.14")
* // .image("localstack/localstack:4.0.3")
* .build();
*
* container.start();
Expand Down Expand Up @@ -46,10 +46,11 @@ public static class Builder extends BaseBuilder<Localstack2Container, Builder> {

private String services = "dynamodb";
private String awsRegion = "ap-southeast-2";
private String healthUri = "_localstack/health";
private String startWeb;

/**
* Create with a version of localstack/localstack (example, 0.14)
* Create with a version of localstack/localstack (example, 4.0.3)
*/
private Builder(String version) {
super("localstack", 4566, 4566, version);
Expand All @@ -62,6 +63,7 @@ protected void extraProperties(Properties properties) {
services = prop(properties, "services", services);
awsRegion = prop(properties, "awsRegion", awsRegion);
startWeb = prop(properties, "startWeb", startWeb);
healthUri = prop(properties, "healthUri", healthUri);
}

/**
Expand Down Expand Up @@ -90,6 +92,14 @@ public Builder startWeb(String startWeb) {
return self();
}

/**
* Set the healthUri option - defaults to _localstack/health.
*/
public Builder healthUri(String healthUri) {
this.healthUri = healthUri;
return self();
}

/**
* Build and return the LocalstackContainer to then start().
*/
Expand All @@ -107,6 +117,7 @@ public Localstack2Container start() {
private final String services;
private final String awsRegion;
private final String startWeb;
private final String healthUri;

/**
* Create the container using the given config.
Expand All @@ -116,11 +127,12 @@ public Localstack2Container(Localstack2Container.Builder builder) {
this.services = builder.services;
this.awsRegion = builder.awsRegion;
this.startWeb = builder.startWeb;
this.healthUri = builder.healthUri;
this.serviceNames = TrimSplit.split(services);
}

private String healthUrl() {
return String.format("http://%s:%s/health", config.getHost(), config.getPort());
return String.format("http://%s:%s/%s", config.getHost(), config.getPort(), healthUri);
}

/**
Expand Down
20 changes: 16 additions & 4 deletions src/main/java/io/ebean/test/containers/LocalstackContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*
* <pre>{@code
*
* LocalstackContainer container = LocalstackContainer.builder("0.14")
* LocalstackContainer container = LocalstackContainer.builder("4.0.3")
* // .port(4566)
* // .image("localstack/localstack:0.14")
* // .image("localstack/localstack:4.0.3")
* .build();
*
* container.start();
Expand Down Expand Up @@ -58,10 +58,11 @@ public static class Builder extends BaseBuilder<LocalstackContainer, Builder> {

private String services = "dynamodb";
private String awsRegion = "ap-southeast-2";
private String healthUri = "_localstack/health";
private String startWeb;// = "0";

/**
* Create with a version of localstack/localstack (example, 0.14)
* Create with a version of localstack/localstack (example, 4.0.3)
*/
private Builder(String version) {
super("localstack", 4566, 4566, version);
Expand All @@ -74,6 +75,7 @@ protected void extraProperties(Properties properties) {
services = prop(properties, "services", services);
awsRegion = prop(properties, "awsRegion", awsRegion);
startWeb = prop(properties, "startWeb", startWeb);
healthUri = prop(properties, "healthUri", healthUri);
}

/**
Expand Down Expand Up @@ -102,6 +104,14 @@ public Builder startWeb(String startWeb) {
return self();
}

/**
* Set the healthUri option - defaults to _localstack/health.
*/
public Builder healthUri(String healthUri) {
this.healthUri = healthUri;
return self();
}

/**
* Build and return the LocalstackContainer to then start().
*/
Expand All @@ -119,6 +129,7 @@ public LocalstackContainer start() {
private final String services;
private final String awsRegion;
private final String startWeb;
private final String healthUri;

/**
* Create the container using the given config.
Expand All @@ -128,11 +139,12 @@ public LocalstackContainer(LocalstackContainer.Builder builder) {
this.services = builder.services;
this.awsRegion = builder.awsRegion;
this.startWeb = builder.startWeb;
this.healthUri = builder.healthUri;
this.serviceNames = TrimSplit.split(services);
}

private String healthUrl() {
return String.format("http://%s:%s/health", config.getHost(), config.getPort());
return String.format("http://%s:%s/%s", config.getHost(), config.getPort(), healthUri);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public S3Client s3Client() {

@Override
public Region region() {
return Region.of(awsRegion);
return awsRegion == null ? null : Region.of(awsRegion);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ class LocalstackContainerV2Test {
@Disabled
@Test
void start_viaBuilder() {
Localstack2Container container = Localstack2Container.builder("0.14.4")
Localstack2Container container = Localstack2Container.builder("4.0.3")
.awsRegion("ap-southeast-2")
.services("dynamodb,kinesis,sns,sqs,s3")
//.port(4567)
.containerName("ut_localstack_dkss2")
.image("localstack/localstack:0.14.4")
.image("localstack/localstack:4.0.3")
.port(4577)
.build();

Expand Down
Loading