Skip to content

Commit

Permalink
Merge pull request #62 from OpenLiberty/staging
Browse files Browse the repository at this point in the history
Merge staging to prod: Update to MP6 and JEE10
  • Loading branch information
gkwan-ibm authored May 16, 2023
2 parents 1b5358d + 2294335 commit 73fcb0b
Show file tree
Hide file tree
Showing 73 changed files with 737 additions and 356 deletions.
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Maven generated
target/

# Eclipse generated
.apt_generated/
.settings/
.project
.classpath
.factorypath
.metadata
RemoteSystemsTempFiles
MANIFEST.MF

# MacOS system files
.DS_Store

# Asciidoc rendered
README.html

# Zip files
*.zip
398 changes: 398 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

61 changes: 30 additions & 31 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022 IBM Corporation and others.
// Copyright (c) 2023 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 Down Expand Up @@ -161,8 +161,8 @@ Dockerfiles are already set up for you. Build your Docker images with the follow

[role='command']
----
docker build -t system:1.0-java8-SNAPSHOT --build-arg JAVA_VERSION=java8 system/.
docker build -t system:1.0-java11-SNAPSHOT --build-arg JAVA_VERSION=java11 system/.
docker build -t system:1.0-java17-SNAPSHOT --build-arg JAVA_VERSION=java17 system/.
docker build -t graphql:1.0-SNAPSHOT graphql/.
docker build -t query:1.0-SNAPSHOT query/.
----
Expand Down Expand Up @@ -197,7 +197,7 @@ To access the client service, visit the http://localhost:9084/openapi/ui/[^] URL

=== Try the query operations

From the OpenAPI UI, test the read operation at the `GET /query/system/{hostname}` endpoint. This request retrieves the system properties for the `hostname` specified. The following example shows what happens when the `hostname` is set to `system-java8`, but you can try out the operations using the hostname `system-java11` as well:
From the OpenAPI UI, test the read operation at the `GET /query/system/{hostname}` endpoint. This request retrieves the system properties for the `hostname` specified. The following example shows what happens when the `hostname` is set to `system-java11`, but you can try out the operations using the hostname `system-java17` as well:

endif::[]

Expand All @@ -209,10 +209,10 @@ To access the client service, there are several available REST endpoints that te

First, make a GET request to the ***/query/system/{hostname}*** endpoint by the following command. This request retrieves the system properties for the specified ***hostname***.

The ***hostname*** is set to ***system-java8***. You can try out the operations using the hostname ***system-java11*** as well.
The ***hostname*** is set to ***system-java11***. You can try out the operations using the hostname ***system-java17*** as well.

```bash
curl -s 'http://localhost:9084/query/system/system-java8' | jq
curl -s 'http://localhost:9084/query/system/system-java11' | jq
```
You can expect a response similar to the following example:

Expand All @@ -221,36 +221,36 @@ endif::[]
[role='no_copy']
----
{
"hostname": "system-java8",
"hostname": "system-java11",
"java": {
"vendor": "International Business Machines Corporation",
"version": "1.8.0_312"
"vendor": "IBM Corporation",
"version": "11.0.18"
},
"osArch": "amd64",
"osName": "Linux",
"osVersion": "5.10.25-linuxkit",
"osVersion": "5.15.0-67-generic",
"systemMetrics": {
"heapSize": 2086993920,
"heapSize": 536870912,
"nonHeapSize": -1,
"processors": 8
"processors": 2
},
"username": "default"
}
----

ifndef::cloud-hosted[]

You can retrieve the information about the resource usage of any number of system services at the `GET /query/systemLoad/{hostnames}` endpoint. The following example shows what happens when the `hostnames` are set to `system-java8,system-java11`:
You can retrieve the information about the resource usage of any number of system services at the `GET /query/systemLoad/{hostnames}` endpoint. The following example shows what happens when the `hostnames` are set to `system-java11,system-java17`:

endif::[]

ifdef::cloud-hosted[]

You can retrieve the information about the resource usage of any number of system services by making a GET request at ***/query/systemLoad/{hostnames}*** endpoint.
The ***hostnames*** are set to ***system-java8,system-java11***.
The ***hostnames*** are set to ***system-java11,system-java17***.

```bash
curl -s 'http://localhost:9084/query/systemLoad/system-java8,system-java11' | jq
curl -s 'http://localhost:9084/query/systemLoad/system-java11,system-java17' | jq
```

You can expect the following response is similar to the following example:
Expand All @@ -261,19 +261,19 @@ endif::[]
----
[
{
"hostname": "system-java8",
"hostname": "system-java11",
"loadData": {
"heapUsed": 34251904,
"loadAverage": 0.11,
"nonHeapUsed": 84034688
"heapUsed": 30090920,
"loadAverage": 0.08,
"nonHeapUsed": 87825316
}
},
{
"hostname": "system-java11",
"hostname": "system-java17",
"loadData": {
"heapUsed": 41953280,
"loadAverage": 0.11,
"nonHeapUsed": 112506520
"heapUsed": 39842888,
"loadAverage": 0.08,
"nonHeapUsed": 93098960
}
}
]
Expand All @@ -282,12 +282,12 @@ endif::[]
ifndef::cloud-hosted[]
=== Try the mutation operation

You can also make requests to add a note to a system service at the `POST /query/mutation/system/note` endpoint. To add a note to the system service running on Java 8, specify the following in the request body:
You can also make requests to add a note to a system service at the `POST /query/mutation/system/note` endpoint. To add a note to the system service running on Java 11, specify the following in the request body:

[role='command']
----
{
"hostname": "system-java8",
"hostname": "system-java11",
"text": "I am trying out GraphQL on Open Liberty!"
}
----
Expand All @@ -302,17 +302,16 @@ You can also make POST requests to add a note to a system service at the ***/que
To add a note to the system service running on Java 8, run the following command:

```bash
curl -i -X 'POST' 'http://localhost:9084/query/mutation/system/note' -H 'Content-Type: application/json' -d '{"hostname": "system-java8","text": "I am trying out GraphQL on Open Liberty!"}'
curl -i -X 'POST' 'http://localhost:9084/query/mutation/system/note' -H 'Content-Type: application/json' -d '{"hostname": "system-java11","text": "I am trying out GraphQL on Open Liberty!"}'
```

You will recieve a `200` response code, similar to below, if the request is processed succesfully.

```
HTTP/1.1 200 OK
X-Powered-By: Servlet/4.0
Date: Fri, 20 May 2022 19:11:46 GMT
Content-Length: 0
Content-Language: en-US
Content-Length: 0
Date: Fri, 21 Apr 2023 14:17:47 GMT
```
endif::[]

Expand Down Expand Up @@ -394,13 +393,13 @@ QueryResourceIT.java
include::finish/query/src/test/java/it/io/openliberty/guides/query/QueryResourceIT.java[]
----

Define the [hotspot=systemContainer file=2]`systemContainer` test container to start up the `system-java8` image, the [hotspot=graphqlContainer file=2]`graphqlContainer` test container to start up the `graphql` image, and the [hotspot=libertyContainer file=2]`libertyContainer` test container to start up the `query` image. Make sure that the containers use the same network.
Define the [hotspot=systemContainer file=2]`systemContainer` test container to start up the `system-java11` image, the [hotspot=graphqlContainer file=2]`graphqlContainer` test container to start up the `graphql` image, and the [hotspot=libertyContainer file=2]`libertyContainer` test container to start up the `query` image. Make sure that the containers use the same network.

The [hotspot=testcontainers file=2]`@Testcontainers` annotation finds all fields that are annotated with the [hotspot=container file=2]`@Container` annotation and calls their container lifecycle methods. The `static` function declaration on each container indicates that this container will be started only once before any test method is executed and stopped after the last test method is executed.

The [hotspot=testGetSystem file=2]`testGetSystem()` verifies the `/query/system/{hostname}` endpoint with `hostname` set to `system-java8`.
The [hotspot=testGetSystem file=2]`testGetSystem()` verifies the `/query/system/{hostname}` endpoint with `hostname` set to `system-java11`.

The [hotspot=testGetSystemLoad file=2]`testGetSystemLoad()` verifies the `/query/systemLoad/{hostnames}` endpoint with `hostnames` set to `system-java8`.
The [hotspot=testGetSystemLoad file=2]`testGetSystemLoad()` verifies the `/query/systemLoad/{hostnames}` endpoint with `hostnames` set to `system-java11`.

The [hotspot=testEditNote file=2]`testEditNote()` verifies the mutation operation at the `/query/mutation/system/note` endpoint.

Expand Down
18 changes: 9 additions & 9 deletions finish/graphql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<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 -->
Expand All @@ -24,13 +24,13 @@
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>9.1.0</version>
<version>10.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile</groupId>
<artifactId>microprofile</artifactId>
<version>5.0</version>
<version>6.0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
Expand All @@ -53,19 +53,19 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.2</version>
<version>5.9.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>6.0.0.Final</version>
<version>6.2.3.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-json-binding-provider</artifactId>
<version>6.0.0.Final</version>
<version>6.2.3.Final</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -96,13 +96,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<version>3.0.0</version>
</plugin>
<!-- Plugin to run functional tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
<version>3.0.0</version>
<configuration>
<systemPropertyVariables>
<http.port>${liberty.var.default.http.port}</http.port>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
/*******************************************************************************
* Copyright (c) 2022 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.graphql;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
/*******************************************************************************
* Copyright (c) 2022 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.graphql.client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
/*******************************************************************************
* Copyright (c) 2022 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.graphql.client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
/*******************************************************************************
* Copyright (c) 2022 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.graphql.client;
Expand Down
8 changes: 4 additions & 4 deletions finish/graphql/src/main/liberty/config/server.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<server description="Sample Liberty server">
<featureManager>
<feature>restfulWS-3.0</feature>
<feature>jsonb-2.0</feature>
<feature>jsonp-2.0</feature>
<feature>cdi-3.0</feature>
<feature>restfulWS-3.1</feature>
<feature>jsonb-3.0</feature>
<feature>jsonp-2.1</feature>
<feature>cdi-4.0</feature>
<feature>mpConfig-3.0</feature>
<feature>mpRestClient-3.0</feature>
<feature>mpGraphQL-2.0</feature>
Expand Down
10 changes: 5 additions & 5 deletions finish/graphql/src/main/webapp/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
Copyright (c) 2022 IBM Corp.
Copyright (c) 2022, 2023 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -41,13 +41,13 @@ <h2>Eclipse MicroProfile</h2>
<p>
For more information about the features used in this application, see the Open Liberty documentation:
<ul>
<li><a href="https://openliberty.io/docs/ref/feature/#microProfile-5.0.html" target="_blank" rel="noopener noreferrer">MicroProfile 5.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#microProfile-6.0.html" target="_blank" rel="noopener noreferrer">MicroProfile 6.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/mpGraphQL-1.0.html" target="_blank" rel="noopener noreferrer">GraphQL 1.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#mpConfig-3.0.html" target="_blank" rel="noopener noreferrer">MicroProfile Config 3.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#mpRestClient-3.0.html" target="_blank" rel="noopener noreferrer">MicroProfile Rest Client 3.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#cdi-4.0.html" target="_blank" rel="noopener noreferrer">Contexts and Dependency Injection 4.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#restfulWS-3.0.html" target="_blank" rel="noopener noreferrer">Java RESTful Services 3.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#jsonb-3.0.html" target="_blank" rel="noopener noreferrer">JavaScript Object Notation Binding 3.0</a></li>
<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>
<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>
<li><a href="https://openliberty.io/docs/ref/feature/#jsonb-3.0.html" target="_blank" rel="noopener noreferrer">Jakarta JSON Binding 3.0</a></li>
</ul>
</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
/*******************************************************************************
* Copyright (c) 2022 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 it.io.openliberty.guides.graphql;
Expand Down
Loading

0 comments on commit 73fcb0b

Please sign in to comment.