Skip to content

Commit b9e4701

Browse files
authored
Merge pull request #177 from OpenLiberty/staging
Merge staging to prod: Update to MP6 and JEE10
2 parents 93c61a0 + 265e1b5 commit b9e4701

46 files changed

Lines changed: 471 additions & 483 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ jobs:
4848
working-directory: finish
4949
steps:
5050
- uses: actions/checkout@v2
51-
- name: Set up JDK 8
51+
- name: Set up JDK 11
5252
uses: actions/setup-java@v1
5353
with:
54-
java-version: 8
54+
java-version: 11
5555
- run: unset _JAVA_OPTIONS
5656
- name: Run tests
5757
run: ../scripts/testApp.sh

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
@@ -12,8 +12,8 @@
1212
<properties>
1313
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1414
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
15-
<maven.compiler.source>1.8</maven.compiler.source>
16-
<maven.compiler.target>1.8</maven.compiler.target>
15+
<maven.compiler.source>11</maven.compiler.source>
16+
<maven.compiler.target>11</maven.compiler.target>
1717
<!-- Default test properties -->
1818
<system.kube.service>system-service</system.kube.service>
1919
<system.service.root>localhost:31000</system.service.root>
@@ -28,13 +28,13 @@
2828
<dependency>
2929
<groupId>jakarta.platform</groupId>
3030
<artifactId>jakarta.jakartaee-api</artifactId>
31-
<version>9.1.0</version>
31+
<version>10.0.0</version>
3232
<scope>provided</scope>
3333
</dependency>
3434
<dependency>
3535
<groupId>org.eclipse.microprofile</groupId>
3636
<artifactId>microprofile</artifactId>
37-
<version>5.0</version>
37+
<version>6.0</version>
3838
<type>pom</type>
3939
<scope>provided</scope>
4040
</dependency>
@@ -48,19 +48,19 @@
4848
<dependency>
4949
<groupId>org.junit.jupiter</groupId>
5050
<artifactId>junit-jupiter</artifactId>
51-
<version>5.8.2</version>
51+
<version>5.9.2</version>
5252
<scope>test</scope>
5353
</dependency>
5454
<dependency>
5555
<groupId>org.jboss.resteasy</groupId>
5656
<artifactId>resteasy-client</artifactId>
57-
<version>6.0.0.Final</version>
57+
<version>6.2.3.Final</version>
5858
<scope>test</scope>
5959
</dependency>
6060
<dependency>
6161
<groupId>org.jboss.resteasy</groupId>
6262
<artifactId>resteasy-json-binding-provider</artifactId>
63-
<version>6.0.0.Final</version>
63+
<version>6.2.3.Final</version>
6464
<scope>test</scope>
6565
</dependency>
6666
<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.kube.service>${system.kube.service}</system.kube.service>

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;

finish/inventory/src/main/java/io/openliberty/guides/inventory/client/SystemClient.java

Lines changed: 27 additions & 56 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;
@@ -60,69 +59,41 @@ public class SystemClient {
6059

6160
// Wrapper function that gets properties
6261
public Properties getProperties(String hostname) {
63-
String url = buildUrl(PROTOCOL,
64-
hostname,
65-
Integer.valueOf(DEFAULT_PORT),
66-
CONTEXT_ROOT + SYSTEM_PROPERTIES);
67-
Builder clientBuilder = buildClientBuilder(url);
68-
return getPropertiesHelper(clientBuilder);
69-
}
70-
71-
// tag::doc[]
72-
/**
73-
* Builds the URI string to the system service for a particular host.
74-
* @param protocol
75-
* - http or https.
76-
* @param host
77-
* - name of host.
78-
* @param port
79-
* - port number.
80-
* @param path
81-
* - Note that the path needs to start with a slash!!!
82-
* @return String representation of the URI to the system properties service.
83-
*/
84-
// end::doc[]
85-
protected String buildUrl(String protocol, String host, int port, String path) {
62+
Properties properties = null;
63+
Client client = ClientBuilder.newClient();
8664
try {
87-
URI uri = new URI(protocol, null, host, port, path, null, null);
88-
return uri.toString();
65+
Builder builder = getBuilder(hostname, client);
66+
properties = getPropertiesHelper(builder);
8967
} catch (Exception e) {
90-
System.err.println("Exception thrown while building the URL: " + e.getMessage());
91-
return null;
68+
System.err.println(
69+
"Exception thrown while getting properties: " + e.getMessage());
70+
} finally {
71+
client.close();
9272
}
73+
return properties;
9374
}
9475

9576
// Method that creates the client builder
96-
protected Builder buildClientBuilder(String urlString) {
97-
try {
98-
Client client = ClientBuilder.newClient();
99-
Builder builder = client.target(urlString).request();
100-
return builder
101-
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
102-
.header(HttpHeaders.AUTHORIZATION, getAuthHeader());
103-
} catch (Exception e) {
104-
System.err.println("Exception thrown while building the client: "
105-
+ e.getMessage());
106-
return null;
107-
}
77+
private Builder getBuilder(String hostname, Client client) throws Exception {
78+
URI uri = new URI(
79+
PROTOCOL, null, hostname, Integer.valueOf(DEFAULT_PORT),
80+
CONTEXT_ROOT + SYSTEM_PROPERTIES, null, null);
81+
String urlString = uri.toString();
82+
Builder builder = client.target(urlString).request();
83+
builder.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
84+
.header(HttpHeaders.AUTHORIZATION, getAuthHeader());
85+
return builder;
10886
}
10987

11088
// Helper method that processes the request
111-
protected Properties getPropertiesHelper(Builder builder) {
112-
try {
113-
Response response = builder.get();
114-
if (response.getStatus() == Status.OK.getStatusCode()) {
89+
private Properties getPropertiesHelper(Builder builder) throws Exception {
90+
Response response = builder.get();
91+
if (response.getStatus() == Status.OK.getStatusCode()) {
11592
return response.readEntity(Properties.class);
116-
} else {
93+
} else {
11794
System.err.println("Response Status is not OK.");
118-
}
119-
} catch (RuntimeException e) {
120-
System.err.println("Runtime exception: " + e.getMessage());
121-
} catch (Exception e) {
122-
System.err.println("Exception thrown while invoking the request: "
123-
+ e.getMessage());
95+
return null;
12496
}
125-
return null;
12697
}
12798

12899
private String getAuthHeader() {

finish/inventory/src/main/java/io/openliberty/guides/inventory/health/InventoryLivenessCheck.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
/*******************************************************************************
33
* Copyright (c) 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.health;

finish/inventory/src/main/java/io/openliberty/guides/inventory/health/InventoryReadinessCheck.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
/*******************************************************************************
33
* Copyright (c) 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.health;

finish/inventory/src/main/java/io/openliberty/guides/inventory/health/InventoryStartupCheck.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
/*******************************************************************************
33
* Copyright (c) 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.health;

0 commit comments

Comments
 (0)