Skip to content

Commit 148e29c

Browse files
committed
Merge remote-tracking branch 'origin/arcadedb' into arcadedb
2 parents f3db06a + d179033 commit 148e29c

File tree

15 files changed

+285
-240
lines changed

15 files changed

+285
-240
lines changed

modules/consul/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ description = "Testcontainers :: Consul"
33
dependencies {
44
api project(':testcontainers')
55

6+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.11.0'
7+
8+
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.4'
69
testImplementation 'com.ecwid.consul:consul-api:1.4.5'
710
testImplementation 'io.rest-assured:rest-assured:5.5.6'
811
testImplementation 'org.assertj:assertj-core:3.27.4'
912
}
13+
14+
test {
15+
useJUnitPlatform()
16+
}

modules/consul/src/test/java/org/testcontainers/consul/ConsulContainerTest.java

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
import com.ecwid.consul.v1.Response;
55
import com.ecwid.consul.v1.kv.model.GetValue;
66
import io.restassured.RestAssured;
7-
import org.junit.ClassRule;
8-
import org.junit.Test;
7+
import org.junit.jupiter.api.AfterAll;
8+
import org.junit.jupiter.api.BeforeAll;
9+
import org.junit.jupiter.api.Test;
910
import org.testcontainers.containers.GenericContainer;
1011

1112
import java.io.IOException;
@@ -16,25 +17,30 @@
1617

1718
import static org.assertj.core.api.Assertions.assertThat;
1819

19-
/**
20-
* This test shows the pattern to use the ConsulContainer @ClassRule for a junit test. It also has tests that ensure
21-
* the properties were added correctly by reading from Consul with the CLI and over HTTP.
22-
*/
23-
public class ConsulContainerTest {
20+
class ConsulContainerTest {
2421

25-
@ClassRule
26-
public static ConsulContainer consulContainer = new ConsulContainer("hashicorp/consul:1.15")
22+
private static ConsulContainer consul = new ConsulContainer("hashicorp/consul:1.15")
2723
.withConsulCommand("kv put config/testing1 value123");
2824

25+
@BeforeAll
26+
static void setup() {
27+
consul.start();
28+
}
29+
30+
@AfterAll
31+
static void teardown() {
32+
consul.stop();
33+
}
34+
2935
@Test
30-
public void readFirstPropertyPathWithCli() throws IOException, InterruptedException {
31-
GenericContainer.ExecResult result = consulContainer.execInContainer("consul", "kv", "get", "config/testing1");
36+
void readFirstPropertyPathWithCli() throws IOException, InterruptedException {
37+
GenericContainer.ExecResult result = consul.execInContainer("consul", "kv", "get", "config/testing1");
3238
final String output = result.getStdout().replaceAll("\\r?\\n", "");
3339
assertThat(output).contains("value123");
3440
}
3541

3642
@Test
37-
public void readFirstSecretPathOverHttpApi() {
43+
void readFirstSecretPathOverHttpApi() {
3844
io.restassured.response.Response response = RestAssured
3945
.given()
4046
.when()
@@ -46,11 +52,8 @@ public void readFirstSecretPathOverHttpApi() {
4652
}
4753

4854
@Test
49-
public void writeAndReadMultipleValuesUsingClient() {
50-
final ConsulClient consulClient = new ConsulClient(
51-
consulContainer.getHost(),
52-
consulContainer.getFirstMappedPort()
53-
);
55+
void writeAndReadMultipleValuesUsingClient() {
56+
final ConsulClient consulClient = new ConsulClient(consul.getHost(), consul.getFirstMappedPort());
5457

5558
final Map<String, String> properties = new HashMap<>();
5659
properties.put("value", "world");
@@ -70,6 +73,6 @@ public void writeAndReadMultipleValuesUsingClient() {
7073
}
7174

7275
private String getHostAndPort() {
73-
return consulContainer.getHost() + ":" + consulContainer.getMappedPort(8500);
76+
return consul.getHost() + ":" + consul.getMappedPort(8500);
7477
}
7578
}

modules/couchbase/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ dependencies {
55
// TODO use JDK's HTTP client and/or Apache HttpClient5
66
shaded 'com.squareup.okhttp3:okhttp:5.1.0'
77

8+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.11.0'
9+
10+
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.4'
811
testImplementation 'com.couchbase.client:java-client:3.9.0'
912
testImplementation 'org.awaitility:awaitility:4.3.0'
1013
testImplementation 'org.assertj:assertj-core:3.27.4'
@@ -15,3 +18,7 @@ tasks.japicmp {
1518
"org.testcontainers.couchbase.CouchbaseContainer"
1619
]
1720
}
21+
22+
test {
23+
useJUnitPlatform()
24+
}

modules/couchbase/src/test/java/org/testcontainers/couchbase/CouchbaseContainerTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import com.couchbase.client.java.Cluster;
2121
import com.couchbase.client.java.Collection;
2222
import com.couchbase.client.java.json.JsonObject;
23-
import org.junit.Test;
23+
import org.junit.jupiter.api.Test;
2424
import org.testcontainers.containers.ContainerLaunchException;
2525

2626
import java.time.Duration;
@@ -30,7 +30,7 @@
3030
import static org.assertj.core.api.Assertions.assertThatThrownBy;
3131
import static org.awaitility.Awaitility.await;
3232

33-
public class CouchbaseContainerTest {
33+
class CouchbaseContainerTest {
3434

3535
private static final String COUCHBASE_IMAGE_ENTERPRISE = "couchbase/server:enterprise-7.0.3";
3636

@@ -41,22 +41,22 @@ public class CouchbaseContainerTest {
4141
private static final String COUCHBASE_IMAGE_COMMUNITY_RECENT = "couchbase/server:community-7.6.2";
4242

4343
@Test
44-
public void testBasicContainerUsageForEnterpriseContainer() {
44+
void testBasicContainerUsageForEnterpriseContainer() {
4545
testBasicContainerUsage(COUCHBASE_IMAGE_ENTERPRISE);
4646
}
4747

4848
@Test
49-
public void testBasicContainerUsageForEnterpriseContainerRecent() {
49+
void testBasicContainerUsageForEnterpriseContainerRecent() {
5050
testBasicContainerUsage(COUCHBASE_IMAGE_ENTERPRISE_RECENT);
5151
}
5252

5353
@Test
54-
public void testBasicContainerUsageForCommunityContainer() {
54+
void testBasicContainerUsageForCommunityContainer() {
5555
testBasicContainerUsage(COUCHBASE_IMAGE_COMMUNITY);
5656
}
5757

5858
@Test
59-
public void testBasicContainerUsageForCommunityContainerRecent() {
59+
void testBasicContainerUsageForCommunityContainerRecent() {
6060
testBasicContainerUsage(COUCHBASE_IMAGE_COMMUNITY_RECENT);
6161
}
6262

@@ -89,7 +89,7 @@ private void testBasicContainerUsage(String couchbaseImage) {
8989
}
9090

9191
@Test
92-
public void testBucketIsFlushableIfEnabled() {
92+
void testBucketIsFlushableIfEnabled() {
9393
BucketDefinition bucketDefinition = new BucketDefinition("mybucket").withFlushEnabled(true);
9494

9595
try (
@@ -119,7 +119,7 @@ public void testBucketIsFlushableIfEnabled() {
119119
* edition which is not supported.
120120
*/
121121
@Test
122-
public void testFailureIfCommunityUsedWithAnalytics() {
122+
void testFailureIfCommunityUsedWithAnalytics() {
123123
try (
124124
CouchbaseContainer container = new CouchbaseContainer(COUCHBASE_IMAGE_COMMUNITY)
125125
.withEnabledServices(CouchbaseService.KV, CouchbaseService.ANALYTICS)
@@ -136,7 +136,7 @@ public void testFailureIfCommunityUsedWithAnalytics() {
136136
* edition which is not supported.
137137
*/
138138
@Test
139-
public void testFailureIfCommunityUsedWithEventing() {
139+
void testFailureIfCommunityUsedWithEventing() {
140140
try (
141141
CouchbaseContainer container = new CouchbaseContainer(COUCHBASE_IMAGE_COMMUNITY)
142142
.withEnabledServices(CouchbaseService.KV, CouchbaseService.EVENTING)

modules/elasticsearch/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ description = "Testcontainers :: elasticsearch"
22

33
dependencies {
44
api project(':testcontainers')
5+
6+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.11.0'
7+
8+
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.4'
59
testImplementation "org.elasticsearch.client:elasticsearch-rest-client:9.1.2"
610
testImplementation "org.elasticsearch.client:transport:7.17.29"
711
testImplementation 'org.assertj:assertj-core:3.27.4'
@@ -12,3 +16,7 @@ tasks.japicmp {
1216
"org.testcontainers.elasticsearch.ElasticsearchContainer"
1317
]
1418
}
19+
20+
test {
21+
useJUnitPlatform()
22+
}

0 commit comments

Comments
 (0)