Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to MP61 and JEE10 #150

Merged
merged 29 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
74e98ea
mp6-ee10-update drafted
Sep 25, 2023
71b673d
update query/server.xml to adapt ee10
Sep 27, 2023
1540f71
Update integration tests
Oct 30, 2023
c133d2b
lint correction
Oct 30, 2023
855857f
integration test updated for /start
Oct 30, 2023
ba04a7a
Lint correction
Oct 30, 2023
6703b86
lint correction
Oct 31, 2023
7a1ec4c
update server.xml in start/
Nov 1, 2023
6f473aa
lint correction
Nov 1, 2023
60a1e7f
reset system added
Nov 3, 2023
58bf74f
Merge branch 'prod' into mp6-ee10-update
gkwan-ibm Nov 22, 2023
109614d
Merge pull request #156 from OpenLiberty/staging
gkwan-ibm Nov 24, 2023
159389e
dependencies version update & year label correction & update default.…
Ruilin-Ma Dec 1, 2023
70ebbfa
dependencies & index.html updated
Ruilin-Ma Dec 6, 2023
2d41473
removed redundant line of code
Ruilin-Ma Jan 19, 2024
bcfae47
update system and inventory service to support devc
Ruilin-Ma Jan 22, 2024
81c6995
Merge pull request #157 from OpenLiberty/devc-update
Ruilin-Ma Jan 22, 2024
7ca8f9c
Merge branch 'prod' into mp6-ee10-update
Ruilin-Ma Jan 22, 2024
2c7778c
added hotspot tag
Ruilin-Ma Jan 22, 2024
939d8e4
fixed typo
Ruilin-Ma Jan 22, 2024
1ee2cbf
Merge pull request #158 from OpenLiberty/devc-update
Ruilin-Ma Jan 22, 2024
a53b4e4
revert incorrect change
Ruilin-Ma Jan 22, 2024
791b9b5
update versions
gkwan-ibm Mar 21, 2024
66f7081
update versions
gkwan-ibm Mar 21, 2024
e3e3de6
start kafka container first
gkwan-ibm Mar 22, 2024
b80d729
disable RYUK
gkwan-ibm Mar 22, 2024
b8f4cd7
update resteasy
gkwan-ibm Mar 25, 2024
cc5c11b
Remove references to zookeeper
shin19991207 Mar 25, 2024
0fcbac8
Update README.adoc
gkwan-ibm Apr 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: maven
directory: "/finish"
schedule:
interval: monthly
open-pull-requests-limit: 50
- package-ecosystem: maven
directory: "/start"
schedule:
interval: monthly
open-pull-requests-limit: 50
39 changes: 33 additions & 6 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019, 2023 IBM Corporation and others.
// Copyright (c) 2019, 2024 IBM Corporation and others.
// Licensed under Creative Commons Attribution-NoDerivatives
// 4.0 International (CC BY-ND 4.0)
// https://creativecommons.org/licenses/by-nd/4.0/
Expand All @@ -9,13 +9,14 @@
:page-layout: guide-multipane
:page-duration: 15 minutes
:page-releasedate: 2019-09-13
:page-majorupdateddate: 2024-04-04
:page-guide-category: microprofile
:page-essential: false
:page-description: Learn how to use MicroProfile Rest Client to invoke RESTful microservices asynchronously over HTTP.
:page-seo-title: Consuming RESTful Java microservices asynchronously using Eclipse MicroProfile Rest Client
:page-seo-description: A getting started tutorial and an example on how to consume RESTful Java microservices with asynchronous method calls using the CompletionStage interface and MicroProfile Rest Client.
:guide-author: Open Liberty
:page-tags: ['MicroProfile']
:page-tags: ['microprofile']
:page-permalink: /guides/{projectid}
:page-related-guides: ['microprofile-reactive-messaging', 'reactive-rest-client']
:common-includes: https://raw.githubusercontent.com/OpenLiberty/guides-common/prod
Expand Down Expand Up @@ -149,7 +150,7 @@ docker build -t inventory:1.0-SNAPSHOT inventory/.
docker build -t query:1.0-SNAPSHOT query/.
```

Next, use the provided `startContainers` script to start the application in Docker containers. The script creates containers for Kafka, Zookeeper, and all of the microservices in the project, in addition to a network for the containers to communicate with each other. The script also creates three instances of the `system` microservice.
Next, use the provided `startContainers` script to start the application in Docker containers. The script creates containers for Kafka and all of the microservices in the project, in addition to a network for the containers to communicate with each other. The script also creates three instances of the `system` microservice.

include::{common-includes}/os-tabs.adoc[]

Expand All @@ -171,12 +172,19 @@ include::{common-includes}/os-tabs.adoc[]

// static guide instructions:
ifndef::cloud-hosted[]
The services take some time to become available. You can access the application by making requests to the `query/systemLoad` endpoint by going to the http://localhost:9080/query/systemLoad[http://localhost:9080/query/systemLoad^] URL.
The services take some time to become available. Visit the http://localhost:9085/health[^] URL to confirm that the `inventory` microservice is up and running.

You can access the application by making requests to the `query/systemLoad` endpoint by going to the http://localhost:9080/query/systemLoad[http://localhost:9080/query/systemLoad^] URL.
endif::[]

// cloud-hosted guide instructions:
ifdef::cloud-hosted[]
The services might take several minutes to become available. You can access the application by making requests to the ***query/systemLoad*** endpoint by running the following curl command:
The services might take several minutes to become available. Run the following curl command to confirm that the ***inventory*** microservice is up and running.
```bash
curl -s http://localhost:9085/health | jq
```

You can access the application by making requests to the ***query/systemLoad*** endpoint by running the following curl command:
```bash
curl -s http://localhost:9080/query/systemLoad | jq
```
Expand Down Expand Up @@ -252,10 +260,26 @@ include::finish/query/src/test/java/it/io/openliberty/guides/query/QueryServiceI
ifndef::cloud-hosted[]
Navigate to the `query` directory, then verify that the tests pass by using the Maven `verify` goal:

include::{common-includes}/os-tabs.adoc[]

[.tab_content.windows_section]
--
[role='command']
```bash
```
mvn verify
```
--

[.tab_content.mac_section.linux_section]
--
[role='command']
```
export TESTCONTAINERS_RYUK_DISABLED=true
mvn verify
```

For more information about disabling Ryuk, see the https://java.testcontainers.org/features/configuration/#disabling-ryuk[Testcontainers custom configuration^] document.
--

When the tests succeed, you see output similar to the following example:
endif::[]
Expand All @@ -264,10 +288,13 @@ endif::[]
ifdef::cloud-hosted[]
Run the following commands to navigate to the ***query*** directory and verify that the tests pass by using the Maven ***verify*** goal:
```bash
export TESTCONTAINERS_RYUK_DISABLED=true
cd /home/project/guide-microprofile-rest-client-async/start/query
mvn verify
```

For more information about disabling Ryuk, see the [Testcontainers custom configuratio](https://java.testcontainers.org/features/configuration/#disabling-ryuk) document.

The tests might take a few minutes to complete. When the tests succeed, you see output similar to the following example:
endif::[]

Expand Down
76 changes: 53 additions & 23 deletions finish/inventory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,41 @@
<packaging>war</packaging>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Liberty configuration -->
<liberty.var.default.http.port>9085</liberty.var.default.http.port>
<liberty.var.default.https.port>9448</liberty.var.default.https.port>
<liberty.var.http.port>9085</liberty.var.http.port>
<liberty.var.https.port>9448</liberty.var.https.port>
</properties>

<dependencies>
<!-- Provided dependencies -->
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>8.0.0</version>
<version>10.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.enterprise.concurrent</groupId>
<artifactId>javax.enterprise.concurrent-api</artifactId>
<version>1.1</version>
<groupId>jakarta.enterprise.concurrent</groupId>
<artifactId>jakarta.enterprise.concurrent-api</artifactId>
<version>3.0.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile</groupId>
<artifactId>microprofile</artifactId>
<version>3.3</version>
<version>6.1</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<!-- tag::reactiveMessaging[] -->
<dependency>
<groupId>org.eclipse.microprofile.reactive.messaging</groupId>
<artifactId>microprofile-reactive-messaging-api</artifactId>
<version>1.0</version>
<version>3.0</version>
<scope>provided</scope>
</dependency>
<!-- end::reactiveMessaging[] -->
Expand All @@ -57,33 +57,55 @@
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>2.8.1</version>
<version>3.7.0</version>
</dependency>
<!-- end::kafka[] -->
<!-- tag::rxjava[] -->
<dependency>
<groupId>io.reactivex.rxjava3</groupId>
<artifactId>rxjava</artifactId>
<version>3.1.2</version>
<version>3.1.8</version>
</dependency>
<!-- end::rxjava[] -->
<!-- For tests -->
<dependency>
<groupId>org.microshed</groupId>
<artifactId>microshed-testing-liberty</artifactId>
<version>0.9.1</version>
<scope>test</scope>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.12</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.12</version>
</dependency>
<!-- For tests -->
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>kafka</artifactId>
<version>1.16.2</version>
<version>1.19.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.7.0</version>
<version>5.10.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>1.19.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>6.2.8.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-json-binding-provider</artifactId>
<version>6.2.8.Final</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -94,7 +116,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.0</version>
<version>3.4.0</version>
<configuration>
<packagingExcludes>pom.xml</packagingExcludes>
</configuration>
Expand All @@ -104,21 +126,29 @@
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.8.2</version>
<version>3.10.2</version>
<configuration>
<!-- devc config -->
<containerRunOpts>
-e WLP_LOGGING_CONSOLE_LOGLEVEL=info
-p 9085:9085
--network=reactive-app
</containerRunOpts>
</configuration>
</plugin>

<!-- Plugin to run unit tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<version>3.2.5</version>
</plugin>

<!-- Plugin to run integration tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
<version>3.2.5</version>
<executions>
<execution>
<goals>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2020 IBM Corporation and others.
* Copyright (c) 2020, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* http://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* IBM Corporation - Initial implementation
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
// end::copyright[]
package io.openliberty.guides.inventory;

import javax.ws.rs.core.Application;
import javax.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.ApplicationPath;

@ApplicationPath("/")
public class InventoryApplication extends Application {

}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2020 IBM Corporation and others.
* Copyright (c) 2020, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* http://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* IBM Corporation - Initial implementation
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
// end::copyright[]
package io.openliberty.guides.inventory;
Expand All @@ -20,12 +19,13 @@
import java.util.Properties;
import java.util.TreeMap;

import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;

@ApplicationScoped
public class InventoryManager {

private Map<String, Properties> systems = Collections.synchronizedMap(new TreeMap<String, Properties>());

private Map<String, Properties> systems = Collections.synchronizedMap(
new TreeMap<String, Properties>());

public void addSystem(String hostname, Double systemLoad) {
if (!systems.containsKey(hostname)) {
Expand All @@ -39,8 +39,9 @@ public void addSystem(String hostname, Double systemLoad) {
public void updateCpuStatus(String hostname, Double systemLoad) {
Optional<Properties> p = getSystem(hostname);
if (p.isPresent()) {
if (p.get().getProperty(hostname) == null && hostname != null)
if (p.get().getProperty(hostname) == null && hostname != null) {
p.get().put("systemLoad", systemLoad);
}
}
}

Expand All @@ -56,4 +57,4 @@ public List<String> getSystems() {
public void resetSystems() {
systems.clear();
}
}
}
Loading
Loading