Skip to content

Commit 5f0279c

Browse files
authored
Merge pull request #1 from OpenLiberty/updates
Updates
2 parents 0b5acfc + 5140b5c commit 5f0279c

File tree

3 files changed

+102
-1
lines changed

3 files changed

+102
-1
lines changed

mongo/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mongo:6.0.6
1+
FROM mongo:7.0.7
22

33
ENV MONGO_INITDB_DATABASE=testdb
44

pom.xml

+34
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,25 @@
6565
<version>[1.0.21,)</version>
6666
<scope>provided</scope>
6767
</dependency>
68+
<!-- Test Dependencies-->
69+
<dependency>
70+
<groupId>org.junit.jupiter</groupId>
71+
<artifactId>junit-jupiter</artifactId>
72+
<version>5.10.3</version>
73+
<scope>test</scope>
74+
</dependency>
75+
<dependency>
76+
<groupId>org.jboss.resteasy</groupId>
77+
<artifactId>resteasy-client</artifactId>
78+
<version>6.2.9.Final</version>
79+
<scope>test</scope>
80+
</dependency>
81+
<dependency>
82+
<groupId>org.eclipse.parsson</groupId>
83+
<artifactId>parsson</artifactId>
84+
<version>1.1.6</version>
85+
<scope>test</scope>
86+
</dependency>
6887
</dependencies>
6988

7089
<build>
@@ -90,6 +109,21 @@
90109
</bootstrapProperties>
91110
</configuration>
92111
</plugin>
112+
<plugin>
113+
<groupId>org.apache.maven.plugins</groupId>
114+
<artifactId>maven-failsafe-plugin</artifactId>
115+
<version>3.3.1</version>
116+
<configuration>
117+
<systemPropertyVariables>
118+
<http.port>${http.port}</http.port>
119+
</systemPropertyVariables>
120+
</configuration>
121+
</plugin>
122+
<plugin>
123+
<groupId>org.apache.maven.plugins</groupId>
124+
<artifactId>maven-war-plugin</artifactId>
125+
<version>3.4.0</version>
126+
</plugin>
93127
</plugins>
94128
</build>
95129
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2024 IBM Corporation and others.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-v20.html
7+
*
8+
* Contributors:
9+
* IBM Corporation - initial API and implementation
10+
*******************************************************************************/
11+
package io.openliberty.sample.it;
12+
13+
import static org.junit.jupiter.api.Assertions.assertEquals;
14+
import static org.junit.jupiter.api.Assertions.assertTrue;
15+
16+
import java.io.StringReader;
17+
import java.net.URI;
18+
import java.util.concurrent.TimeUnit;
19+
20+
import org.junit.jupiter.api.AfterAll;
21+
import org.junit.jupiter.api.BeforeAll;
22+
import org.junit.jupiter.api.Test;
23+
24+
import jakarta.json.Json;
25+
import jakarta.json.JsonArray;
26+
import jakarta.json.JsonObject;
27+
import jakarta.json.JsonReader;
28+
import jakarta.ws.rs.client.Client;
29+
import jakarta.ws.rs.client.ClientBuilder;
30+
import jakarta.ws.rs.client.Entity;
31+
import jakarta.ws.rs.core.Response;
32+
33+
public class MongoIT {
34+
35+
private static Client restClient;
36+
37+
38+
private static String baseURL;
39+
40+
@BeforeAll
41+
public static void setup() throws Exception {
42+
String port = System.getProperty("http.port");
43+
baseURL = "http://localhost:" + port + "/db/crew/";
44+
45+
restClient = ClientBuilder.newClient();
46+
}
47+
48+
@AfterAll
49+
public static void teardown() throws Exception {
50+
restClient.close();
51+
}
52+
53+
/**
54+
* Calls the schedule endpoint, and confirms the first two messages over the
55+
* websocket are available and increment.
56+
*/
57+
@Test
58+
public void CreateRetrieveDeleteTest() throws InterruptedException {
59+
//{"name":"Test","rank":"Captain","crewID":"12345"}
60+
restClient.target(baseURL + "it").request().post(Entity.json("{\"name\":\"Test\",\"rank\":\"Captain\",\"crewID\":\"12345\"}"));
61+
62+
Response response = restClient.target(baseURL).request().get();
63+
JsonReader reader = Json.createReader(new StringReader(response.readEntity(String.class)));
64+
JsonArray array = reader.readArray();
65+
System.out.println(array);
66+
}
67+
}

0 commit comments

Comments
 (0)