Skip to content

Commit

Permalink
Merge branch 'jetty-11.0.x' into jetty-12.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
olamy committed Dec 25, 2022
2 parents 838091d + 0cfc5bd commit 56af845
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.DatastoreEmulatorContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.utility.DockerImageName;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -65,28 +64,10 @@ public class GCloudSessionTestSupport
private static final Logger LOGGER = LoggerFactory.getLogger(GCloudSessionTestSupport.class);
private static final Logger GCLOUD_LOG = LoggerFactory.getLogger("org.eclipse.jetty.gcloud.session.gcloudLogs");

public DatastoreEmulatorContainer emulator = new CustomDatastoreEmulatorContainer(
public DatastoreEmulatorContainer emulator = new DatastoreEmulatorContainer(
DockerImageName.parse("gcr.io/google.com/cloudsdktool/cloud-sdk:316.0.0-emulators")
).withLogConsumer(new Slf4jLogConsumer(GCLOUD_LOG));

private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse("gcr.io/google.com/cloudsdktool/cloud-sdk");

private static final String CMD = "gcloud beta emulators datastore start --project test-project --host-port 0.0.0.0:8081 --consistency=1.0";
private static final int HTTP_PORT = 8081;

public static class CustomDatastoreEmulatorContainer extends DatastoreEmulatorContainer
{
public CustomDatastoreEmulatorContainer(DockerImageName dockerImageName)
{
super(dockerImageName);

dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME);

withExposedPorts(HTTP_PORT);
setWaitStrategy(Wait.forHttp("/").forStatusCode(200));
withCommand("/bin/sh", "-c", CMD);
}
}
).withLogConsumer(new Slf4jLogConsumer(GCLOUD_LOG))
.withFlags("--consistency=1.0");

public static class TestGCloudSessionDataStoreFactory extends GCloudSessionDataStoreFactory
{
Expand Down
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@
<plexus-utils.version>3.5.0</plexus-utils.version>
<slf4j.version>2.0.5</slf4j.version>
<springboot.version>2.1.1.RELEASE</springboot.version>
<testcontainers.version>1.17.5</testcontainers.version>
<taglibs-standard-impl.version>1.2.5</taglibs-standard-impl.version>
<taglibs-standard-spec.version>1.2.5</taglibs-standard-spec.version>
<testcontainers.version>1.17.6</testcontainers.version>
<weld.version>4.0.3.Final</weld.version>
<wildfly.common.version>1.6.0.Final</wildfly.common.version>
<wildfly.elytron.version>2.0.0.Final</wildfly.elytron.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.DatastoreEmulatorContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.utility.DockerImageName;

/**
Expand All @@ -36,30 +35,12 @@ public class GCloudSessionDistributionTests extends AbstractSessionDistributionT
private static final Logger GCLOUD_LOG = LoggerFactory.getLogger("org.eclipse.jetty.tests.distribution.session.gcloudLogs");

public DatastoreEmulatorContainer emulator =
new CustomDatastoreEmulatorContainer(DockerImageName.parse("gcr.io/google.com/cloudsdktool/cloud-sdk:316.0.0-emulators"))
.withLogConsumer(new Slf4jLogConsumer(GCLOUD_LOG));

private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse("gcr.io/google.com/cloudsdktool/cloud-sdk");

private static final String CMD = "gcloud beta emulators datastore start --project test-project --host-port 0.0.0.0:8081 --consistency=1.0";
private static final int HTTP_PORT = 8081;
new DatastoreEmulatorContainer(DockerImageName.parse("gcr.io/google.com/cloudsdktool/cloud-sdk:316.0.0-emulators"))
.withLogConsumer(new Slf4jLogConsumer(GCLOUD_LOG))
.withFlags("--consistency=1.0");

String host;

public static class CustomDatastoreEmulatorContainer extends DatastoreEmulatorContainer
{
public CustomDatastoreEmulatorContainer(DockerImageName dockerImageName)
{
super(dockerImageName);

dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME);

withExposedPorts(HTTP_PORT);
setWaitStrategy(Wait.forHttp("/").forStatusCode(200));
withCommand("/bin/sh", "-c", CMD);
}
}

@Override
public void startExternalSessionStorage() throws Exception
{
Expand Down

0 comments on commit 56af845

Please sign in to comment.