Skip to content

Commit 7a4c7e7

Browse files
authored
Merge pull request #41 from OpenLiberty/staging
Merge staging to prod: Update to MP6 and JEE10
2 parents f8db81b + 413d174 commit 7a4c7e7

File tree

30 files changed

+408
-400
lines changed

30 files changed

+408
-400
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ jobs:
4545
working-directory: finish
4646
steps:
4747
- uses: actions/checkout@v2
48-
- name: Set up JDK 8
48+
- name: Set up JDK 11
4949
uses: actions/setup-java@v1
5050
with:
51-
java-version: 8
51+
java-version: 11
5252
- run: unset _JAVA_OPTIONS
5353
- name: Run tests
5454
run: |

LICENSE

Lines changed: 246 additions & 172 deletions
Large diffs are not rendered by default.

finish/inventory/pom.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
<properties>
1515
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1616
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
17-
<maven.compiler.source>1.8</maven.compiler.source>
18-
<maven.compiler.target>1.8</maven.compiler.target>
17+
<maven.compiler.source>11</maven.compiler.source>
18+
<maven.compiler.target>11</maven.compiler.target>
1919
<!-- Default test properties -->
2020
<system.ip>localhost</system.ip>
2121
<system.http.port>9080</system.http.port>
@@ -29,13 +29,13 @@
2929
<dependency>
3030
<groupId>jakarta.platform</groupId>
3131
<artifactId>jakarta.jakartaee-api</artifactId>
32-
<version>9.1.0</version>
32+
<version>10.0.0</version>
3333
<scope>provided</scope>
3434
</dependency>
3535
<dependency>
3636
<groupId>org.eclipse.microprofile</groupId>
3737
<artifactId>microprofile</artifactId>
38-
<version>5.0</version>
38+
<version>6.0</version>
3939
<type>pom</type>
4040
<scope>provided</scope>
4141
</dependency>
@@ -49,19 +49,19 @@
4949
<dependency>
5050
<groupId>org.junit.jupiter</groupId>
5151
<artifactId>junit-jupiter-engine</artifactId>
52-
<version>5.8.2</version>
52+
<version>5.9.2</version>
5353
<scope>test</scope>
5454
</dependency>
5555
<dependency>
5656
<groupId>org.jboss.resteasy</groupId>
5757
<artifactId>resteasy-client</artifactId>
58-
<version>6.0.0.Final</version>
58+
<version>6.2.3.Final</version>
5959
<scope>test</scope>
6060
</dependency>
6161
<dependency>
6262
<groupId>org.jboss.resteasy</groupId>
6363
<artifactId>resteasy-json-binding-provider</artifactId>
64-
<version>6.0.0.Final</version>
64+
<version>6.2.3.Final</version>
6565
<scope>test</scope>
6666
</dependency>
6767
<dependency>
@@ -89,13 +89,13 @@
8989
<plugin>
9090
<groupId>org.apache.maven.plugins</groupId>
9191
<artifactId>maven-surefire-plugin</artifactId>
92-
<version>2.22.2</version>
92+
<version>3.0.0</version>
9393
</plugin>
9494
<!-- Plugin to run functional tests -->
9595
<plugin>
9696
<groupId>org.apache.maven.plugins</groupId>
9797
<artifactId>maven-failsafe-plugin</artifactId>
98-
<version>2.22.2</version>
98+
<version>3.0.0</version>
9999
<configuration>
100100
<systemPropertyVariables>
101101
<system.ip>${system.ip}</system.ip>

finish/inventory/src/main/java/io/openliberty/guides/inventory/InventoryApplication.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
/*******************************************************************************
33
* Copyright (c) 2017, 2022 IBM Corporation and others.
44
* All rights reserved. This program and the accompanying materials
5-
* are made available under the terms of the Eclipse Public License v1.0
5+
* are made available under the terms of the Eclipse Public License 2.0
66
* which accompanies this distribution, and is available at
7-
* http://www.eclipse.org/legal/epl-v10.html
7+
* http://www.eclipse.org/legal/epl-2.0/
88
*
9-
* Contributors:
10-
* IBM Corporation - Initial implementation
9+
* SPDX-License-Identifier: EPL-2.0
1110
*******************************************************************************/
1211
// end::copyright[]
1312
package io.openliberty.guides.inventory;

finish/inventory/src/main/java/io/openliberty/guides/inventory/InventoryManager.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
/*******************************************************************************
33
* Copyright (c) 2017, 2022 IBM Corporation and others.
44
* All rights reserved. This program and the accompanying materials
5-
* are made available under the terms of the Eclipse Public License v1.0
5+
* are made available under the terms of the Eclipse Public License 2.0
66
* which accompanies this distribution, and is available at
7-
* http://www.eclipse.org/legal/epl-v10.html
7+
* http://www.eclipse.org/legal/epl-2.0/
88
*
9-
* Contributors:
10-
* IBM Corporation - Initial implementation
9+
* SPDX-License-Identifier: EPL-2.0
1110
*******************************************************************************/
1211
// end::copyright[]
1312
package io.openliberty.guides.inventory;

finish/inventory/src/main/java/io/openliberty/guides/inventory/InventoryResource.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
/*******************************************************************************
33
* Copyright (c) 2017, 2022 IBM Corporation and others.
44
* All rights reserved. This program and the accompanying materials
5-
* are made available under the terms of the Eclipse Public License v1.0
5+
* are made available under the terms of the Eclipse Public License 2.0
66
* which accompanies this distribution, and is available at
7-
* http://www.eclipse.org/legal/epl-v10.html
7+
* http://www.eclipse.org/legal/epl-2.0/
88
*
9-
* Contributors:
10-
* IBM Corporation - Initial implementation
9+
* SPDX-License-Identifier: EPL-2.0
1110
*******************************************************************************/
1211
// end::copyright[]
1312
package io.openliberty.guides.inventory;
Lines changed: 24 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
// tag::copyright[]
22
/*******************************************************************************
3-
* Copyright (c) 2017, 2022 IBM Corporation and others.
3+
* Copyright (c) 2017, 2023 IBM Corporation and others.
44
* All rights reserved. This program and the accompanying materials
5-
* are made available under the terms of the Eclipse Public License v1.0
5+
* are made available under the terms of the Eclipse Public License 2.0
66
* which accompanies this distribution, and is available at
7-
* http://www.eclipse.org/legal/epl-v10.html
7+
* http://www.eclipse.org/legal/epl-2.0/
88
*
9-
* Contributors:
10-
* IBM Corporation - Initial implementation
9+
* SPDX-License-Identifier: EPL-2.0
1110
*******************************************************************************/
1211
// end::copyright[]
1312
package io.openliberty.guides.inventory.client;
@@ -39,65 +38,40 @@ public class SystemClient {
3938

4039
// Wrapper function that gets properties
4140
public Properties getProperties(String hostname) {
42-
String url = buildUrl(PROTOCOL, hostname,
43-
Integer.valueOf(systemHttpPort), SYSTEM_PROPERTIES);
44-
Builder clientBuilder = buildClientBuilder(url);
45-
return getPropertiesHelper(clientBuilder);
46-
}
47-
48-
// tag::doc[]
49-
/**
50-
* Builds the URI string to the system service for a particular host.
51-
* @param protocol
52-
* - http or https.
53-
* @param host
54-
* - name of host.
55-
* @param port
56-
* - port number.
57-
* @param path
58-
* - Note that the path needs to start with a slash!!!
59-
* @return String representation of the URI to the system properties service.
60-
*/
61-
// end::doc[]
62-
protected String buildUrl(String protocol, String host, int port, String path) {
41+
Properties properties = null;
42+
Client client = ClientBuilder.newClient();
6343
try {
64-
URI uri = new URI(protocol, null, host, port, path, null, null);
65-
return uri.toString();
44+
Builder builder = getBuilder(hostname, client);
45+
properties = getPropertiesHelper(builder);
6646
} catch (Exception e) {
67-
System.err.println("Exception thrown while building the URL: " + e.getMessage());
68-
return null;
47+
System.err.println(
48+
"Exception thrown while getting properties: " + e.getMessage());
49+
} finally {
50+
client.close();
6951
}
52+
return properties;
7053
}
7154

7255
// Method that creates the client builder
73-
protected Builder buildClientBuilder(String urlString) {
74-
try {
75-
Client client = ClientBuilder.newClient();
56+
private Builder getBuilder(String hostname, Client client) throws Exception {
57+
URI uri = new URI(
58+
PROTOCOL, null, hostname, Integer.valueOf(systemHttpPort),
59+
SYSTEM_PROPERTIES, null, null);
60+
String urlString = uri.toString();
7661
Builder builder = client.target(urlString).request();
77-
return builder.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
78-
} catch (Exception e) {
79-
System.err.println("Exception thrown while building the client: "
80-
+ e.getMessage());
81-
return null;
82-
}
62+
builder.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
63+
return builder;
8364
}
8465

8566
// Helper method that processes the request
86-
protected Properties getPropertiesHelper(Builder builder) {
87-
try {
67+
private Properties getPropertiesHelper(Builder builder) throws Exception {
8868
Response response = builder.get();
8969
if (response.getStatus() == Status.OK.getStatusCode()) {
90-
return response.readEntity(Properties.class);
70+
return response.readEntity(Properties.class);
9171
} else {
92-
System.err.println("Response Status is not OK.");
72+
System.err.println("Response Status is not OK.");
73+
return null;
9374
}
94-
} catch (RuntimeException e) {
95-
System.err.println("Runtime exception: " + e.getMessage());
96-
} catch (Exception e) {
97-
System.err.println("Exception thrown while invoking the request: "
98-
+ e.getMessage());
99-
}
100-
return null;
10175
}
10276

10377
}

finish/inventory/src/main/java/io/openliberty/guides/inventory/model/InventoryList.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
/*******************************************************************************
33
* Copyright (c) 2017, 2018 IBM Corporation and others.
44
* All rights reserved. This program and the accompanying materials
5-
* are made available under the terms of the Eclipse Public License v1.0
5+
* are made available under the terms of the Eclipse Public License 2.0
66
* which accompanies this distribution, and is available at
7-
* http://www.eclipse.org/legal/epl-v10.html
7+
* http://www.eclipse.org/legal/epl-2.0/
88
*
9-
* Contributors:
10-
* IBM Corporation - Initial implementation
9+
* SPDX-License-Identifier: EPL-2.0
1110
*******************************************************************************/
1211
// end::copyright[]
1312
package io.openliberty.guides.inventory.model;

finish/inventory/src/main/liberty/config/server.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<server description="Sample Liberty server">
22

33
<featureManager>
4-
<feature>restfulWS-3.0</feature>
5-
<feature>jsonb-2.0</feature>
6-
<feature>jsonp-2.0</feature>
7-
<feature>cdi-3.0</feature>
4+
<feature>restfulWS-3.1</feature>
5+
<feature>jsonb-3.0</feature>
6+
<feature>jsonp-2.1</feature>
7+
<feature>cdi-4.0</feature>
88
<feature>mpConfig-3.0</feature>
99
</featureManager>
1010

finish/inventory/src/main/webapp/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ <h2>Eclipse MicroProfile</h2>
3030
<p>
3131
For more information about the features used in this application, see the Open Liberty documentation:
3232
<ul>
33-
<li><a href="https://openliberty.io/docs/ref/feature/#microProfile-4.0.html" target="_blank" rel="noopener noreferrer">MicroProfile 4.0</a></li>
34-
<li><a href="https://openliberty.io/docs/ref/feature/#mpConfig-2.0.html" target="_blank" rel="noopener noreferrer">MicroProfile Config 2.0</a></li>
35-
<li><a href="https://openliberty.io/docs/ref/feature/#cdi-2.0.html" target="_blank" rel="noopener noreferrer">Contexts and Dependency Injection 2.0</a></li>
36-
<li><a href="https://openliberty.io/docs/ref/feature/#jaxrs-2.1.html" target="_blank" rel="noopener noreferrer">Java RESTful Services 2.1</a></li>
37-
<li><a href="https://openliberty.io/docs/ref/feature/#jsonp-1.1.html" target="_blank" rel="noopener noreferrer">JavaScript Object Notation Processing 1.1</a></li>
33+
<li><a href="https://openliberty.io/docs/ref/feature/#microProfile-6.0.html" target="_blank" rel="noopener noreferrer">MicroProfile 6.0</a></li>
34+
<li><a href="https://openliberty.io/docs/ref/feature/#mpConfig-3.0.html" target="_blank" rel="noopener noreferrer">MicroProfile Config 3.0</a></li>
35+
<li><a href="https://openliberty.io/docs/ref/feature/#cdi-4.0.html" target="_blank" rel="noopener noreferrer">Jakarta Contexts and Dependency Injection 4.0</a></li>
36+
<li><a href="https://openliberty.io/docs/ref/feature/#restfulWS-3.1.html" target="_blank" rel="noopener noreferrer">Jakarta RESTful Web Services 3.1</a></li>
37+
<li><a href="https://openliberty.io/docs/ref/feature/#jsonp-2.1.html" target="_blank" rel="noopener noreferrer">Jakarta JSON Processing 2.1</a></li>
3838
</ul>
3939
</p>
4040
</div>

0 commit comments

Comments
 (0)