diff --git a/pom.xml b/pom.xml index 079a262d0429..62bea4bb8668 100644 --- a/pom.xml +++ b/pom.xml @@ -105,7 +105,7 @@ 3.8.2 0.13.1 1.7.2 - 2.13.2 + 3.2.2 0.9.1 8.0.1 6.0.0 @@ -115,7 +115,7 @@ 2.1.1.RELEASE 1.2.5 1.2.5 - 1.16.0 + 1.16.1 2.4.7 3.1.8.Final @@ -169,6 +169,8 @@ -Dfile.encoding=UTF-8 -Duser.language=en -Duser.region=US -showversion -Xmx4g -Xms2g -Xlog:gc:stderr:time,level,tags false /tmp + + 3.2.20 src/it/settings.xml 0 diff --git a/tests/test-distribution/pom.xml b/tests/test-distribution/pom.xml index 9cbe571d6745..8fd6b8c0c473 100644 --- a/tests/test-distribution/pom.xml +++ b/tests/test-distribution/pom.xml @@ -179,6 +179,11 @@ gcloud test + + org.testcontainers + mongodb + test + org.testcontainers junit-jupiter diff --git a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/HazelcastSessionDistributionTests.java b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/HazelcastSessionDistributionTests.java index f9ef069f0908..3bc508fbf541 100644 --- a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/HazelcastSessionDistributionTests.java +++ b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/HazelcastSessionDistributionTests.java @@ -20,6 +20,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.time.Duration; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -30,13 +31,10 @@ import org.eclipse.jetty.client.api.ContentResponse; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.tests.distribution.JettyHomeTester; -import org.junit.jupiter.api.Assumptions; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.testcontainers.DockerClientFactory; import org.testcontainers.containers.BindMode; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.output.Slf4jLogConsumer; @@ -53,24 +51,21 @@ public class HazelcastSessionDistributionTests extends AbstractSessionDistributi private static final Logger LOGGER = LoggerFactory.getLogger(HazelcastSessionDistributionTests.class); - private GenericContainer hazelcast; - - private Path hazelcastJettyPath; - - @BeforeEach - public void setupHazelcast() - { - hazelcast = new GenericContainer<>("hazelcast/hazelcast:" + System.getProperty("hazelcast.version", "4.1")) + private GenericContainer hazelcast = new GenericContainer<>("hazelcast/hazelcast:" + System.getProperty("hazelcast.version", "4.2.2")) .withExposedPorts(5701) - .waitingFor(Wait.forListeningPort()) + .waitingFor(Wait.forLogMessage(".*is STARTED.*", 1)) + //.waitingFor(Wait.forListeningPort().withStartupTimeout(Duration.ofSeconds(120L))) .withLogConsumer(new Slf4jLogConsumer(HAZELCAST_LOG)); - } + + private Path hazelcastJettyPath; @Override public void startExternalSessionStorage() throws Exception { - hazelcast.start(); - + if (!hazelcast.isRunning()) + { + hazelcast.start(); + } String hazelcastHost = hazelcast.getContainerIpAddress(); int hazelcastPort = hazelcast.getMappedPort(5701); diff --git a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/MongodbSessionDistributionTests.java b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/MongodbSessionDistributionTests.java index 4d8f2e56b770..5ac3fdc8935f 100644 --- a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/MongodbSessionDistributionTests.java +++ b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/MongodbSessionDistributionTests.java @@ -21,8 +21,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.MongoDBContainer; import org.testcontainers.containers.output.Slf4jLogConsumer; import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy; +import org.testcontainers.utility.DockerImageName; /** * @@ -35,11 +37,12 @@ public class MongodbSessionDistributionTests extends AbstractSessionDistribution private static final int MONGO_PORT = 27017; - final String imageName = "mongo:" + System.getProperty("mongo.docker.version", "2.2.7"); - final GenericContainer mongoDBContainer = - new GenericContainer(imageName) - .withLogConsumer(new Slf4jLogConsumer(MONGO_LOG)) - .withExposedPorts(MONGO_PORT); + final String imageName = "mongo:" + System.getProperty("mongo.docker.version", "3.2.20"); + + final MongoDBContainer mongoDBContainer = + new MongoDBContainer(DockerImageName.parse(imageName)) + .withLogConsumer(new Slf4jLogConsumer(MONGO_LOG)); + private String host; private int port; diff --git a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanTestSupport.java b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanTestSupport.java index 7638eb552aae..fffcd98a1170 100644 --- a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanTestSupport.java +++ b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanTestSupport.java @@ -36,6 +36,7 @@ import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.output.Slf4jLogConsumer; import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy; +import org.testcontainers.containers.wait.strategy.Wait; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -69,8 +70,7 @@ public class RemoteInfinispanTestSupport .withEnv("PASS", "foobar") .withEnv("MGMT_USER", "admin") .withEnv("MGMT_PASS", "admin") - .waitingFor(new LogMessageWaitStrategy() - .withRegEx(".*Infinispan Server.*started in.*\\s")) + .waitingFor(Wait.forLogMessage(".*Infinispan Server.*started in.*\\s", 1)) .withExposedPorts(4712, 4713, 8088, 8089, 8443, 9990, 9993, 11211, 11222, 11223, 11224) .withLogConsumer(new Slf4jLogConsumer(INFINISPAN_LOG)); infinispan.start(); diff --git a/tests/test-sessions/test-mongodb-sessions/pom.xml b/tests/test-sessions/test-mongodb-sessions/pom.xml index 781c1adbddfb..576e8c775225 100644 --- a/tests/test-sessions/test-mongodb-sessions/pom.xml +++ b/tests/test-sessions/test-mongodb-sessions/pom.xml @@ -11,8 +11,6 @@ ${project.groupId}.sessions.mongo localhost - - 2.2.7 @@ -118,6 +116,11 @@ junit-jupiter test + + org.testcontainers + mongodb + test + org.slf4j slf4j-simple diff --git a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/MongoTestHelper.java b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/MongoTestHelper.java index ef3f81887984..ae54a55a824d 100644 --- a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/MongoTestHelper.java +++ b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/MongoTestHelper.java @@ -30,8 +30,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.MongoDBContainer; import org.testcontainers.containers.output.Slf4jLogConsumer; import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy; +import org.testcontainers.utility.DockerImageName; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -50,10 +52,9 @@ public class MongoTestHelper private static final int MONGO_PORT = 27017; - static GenericContainer mongo = - new GenericContainer("mongo:" + System.getProperty("mongo.docker.version", "2.2.7")) - .withLogConsumer(new Slf4jLogConsumer(MONGO_LOG)) - .withExposedPorts(MONGO_PORT); + static MongoDBContainer mongo = + new MongoDBContainer(DockerImageName.parse("mongo:" + System.getProperty("mongo.docker.version", "3.2.20"))) + .withLogConsumer(new Slf4jLogConsumer(MONGO_LOG)); static MongoClient mongoClient;