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 the guide to use JakartaEE 9 with javax-annotations-api #43

Merged
merged 29 commits into from
Jan 27, 2023
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
99a4000
change to use JakartaEE 9
gkwan-ibm Nov 29, 2022
fe0ce5f
change to use JakartaEE 9
gkwan-ibm Nov 29, 2022
be68d54
change to use JakartaEE 9
gkwan-ibm Nov 29, 2022
c44b448
change to use JakartaEE 9
gkwan-ibm Nov 29, 2022
a09fa3f
change to use JakartaEE 9
gkwan-ibm Nov 29, 2022
f0b71df
use JakartaEE 9
gkwan-ibm Nov 29, 2022
b4df781
use JakartaEE 9
gkwan-ibm Nov 29, 2022
96653e8
use JakartaEE 9
gkwan-ibm Nov 29, 2022
d47d6bc
use JakartaEE 9
gkwan-ibm Nov 29, 2022
b46c91c
use JakartaEE 9
gkwan-ibm Nov 30, 2022
743a699
Merge branch 'draft' into gkwan-ibm-ee9
gkwan-ibm Dec 2, 2022
af9f682
Merge branch 'draft' into gkwan-ibm-ee9
gkwan-ibm Dec 2, 2022
0e3f8a2
Merge branch 'draft' into gkwan-ibm-ee9
gkwan-ibm Dec 5, 2022
81f0f73
Merge branch 'draft' into gkwan-ibm-ee9
gkwan-ibm Dec 7, 2022
fb0387d
Merge branch 'draft' into gkwan-ibm-ee9
gkwan-ibm Dec 7, 2022
7331fcb
Merge branch 'draft' into gkwan-ibm-ee9
gkwan-ibm Dec 7, 2022
5f341e6
Merge branch 'draft' into gkwan-ibm-ee9
gkwan-ibm Dec 8, 2022
49a4be7
Merge branch 'staging' into gkwan-ibm-ee9
gkwan-ibm Dec 8, 2022
d7abe79
Merge branch 'staging' into gkwan-ibm-ee9
gkwan-ibm Dec 12, 2022
e0a5394
Merge branch 'staging' into gkwan-ibm-ee9
gkwan-ibm Dec 13, 2022
40cabf8
sync
gkwan-ibm Dec 22, 2022
6203071
Update testApp.sh
gkwan-ibm Dec 22, 2022
dc6cfbd
sync
gkwan-ibm Dec 22, 2022
cd1738e
Merge branch 'staging' into gkwan-ibm-ee9
gkwan-ibm Dec 22, 2022
02d6be0
add execute mode
gkwan-ibm Dec 22, 2022
2540ab1
remove the manual steps
gkwan-ibm Jan 11, 2023
d522802
update test
gkwan-ibm Jan 11, 2023
1be21f3
replace tomcat to javax annotation api
gkwan-ibm Jan 25, 2023
1db125f
update license header
gkwan-ibm Jan 25, 2023
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
4 changes: 2 additions & 2 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) 2022, 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 @@ -173,7 +173,7 @@ The [hotspot=getClientStreamingProperties file=0]`getClientStreamingProperties`
The [hotspot=getBidirectionalProperties file=0]`getBidirectionalProperties` RPC defines the bidirectional streaming call. In this service, the client service streams `SystemPropertyName` messages to the server service. The server service returns a stream of [hotspot=SystemProperty file=0]`SystemProperty` messages.


To compile the `.proto` file, the `pom.xml` Maven configuration file needs the [hotspot=grpc file=1]`grpc-protobuf` and [hotspot=grpc-stub file=1]`grpc-stub` dependencies, and the [hotspot=protobufmavenplugin file=1]`protobuf-maven-plugin` plugin. To install the correct version of the Protobuf compiler automatically, the [hotspot=osmavenplugin file=1]`os-maven-plugin` extension is required in the `build` configuration.
To compile the `.proto` file, the `pom.xml` Maven configuration file needs the [hotspot=grpc file=1]`grpc-protobuf`, [hotspot=grpc-stub file=1]`grpc-stub`, [hotspot=javax file=1]`javax.annotation-api` dependencies, and the [hotspot=protobufmavenplugin file=1]`protobuf-maven-plugin` plugin. To install the correct version of the Protobuf compiler automatically, the [hotspot=osmavenplugin file=1]`os-maven-plugin` extension is required in the `build` configuration.

Run the following command to generate the gRPC classes.
// run mvn install to generate abstract classes
Expand Down
33 changes: 11 additions & 22 deletions finish/query/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>8.0.0</version>
<version>9.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile</groupId>
<artifactId>microprofile</artifactId>
<version>4.1</version>
<version>5.0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
Expand All @@ -57,39 +57,28 @@
</dependency>

<!-- For tests -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.7.2</version>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
<version>3.4.4</version>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>6.0.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-extension-providers</artifactId>
<version>3.4.4</version>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-json-binding-provider</artifactId>
<version>6.0.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.1.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>yasson</artifactId>
<version>1.0.9</version>
<artifactId>jakarta.json</artifactId>
<version>2.0.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2022 IBM Corporation and others.
* Copyright (c) 2022, 2023 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.query;
Expand All @@ -19,13 +18,13 @@
import java.util.stream.Collectors;
import java.util.logging.Logger;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;

import org.eclipse.microprofile.config.inject.ConfigProperty;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2022 IBM Corporation and others.
* Copyright (c) 2022, 2023 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.query;

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

@ApplicationPath("query")
public class QueryApplication extends Application {
Expand Down
10 changes: 6 additions & 4 deletions finish/query/src/main/liberty/config/server.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<server description="new server">
<server description="query service">

<featureManager>
<feature>jaxrs-2.1</feature>
<feature>cdi-2.0</feature>
<feature>mpConfig-2.0</feature>
<feature>restfulWS-3.0</feature>
<feature>jsonp-2.0</feature>
<feature>jsonb-2.0</feature>
<feature>cdi-3.0</feature>
<feature>mpConfig-3.0</feature>
<!-- tag::grpc[] -->
<feature>grpc-1.0</feature>
<!-- end::grpc[] -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2022 IBM Corporation and others.
* Copyright (c) 2022, 2023 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.query;
Expand All @@ -17,13 +16,12 @@

import java.net.MalformedURLException;

import javax.json.JsonObject;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Response;
import jakarta.json.JsonObject;
import jakarta.ws.rs.client.Client;
import jakarta.ws.rs.client.ClientBuilder;
import jakarta.ws.rs.client.WebTarget;
import jakarta.ws.rs.core.Response;

import org.apache.cxf.jaxrs.provider.jsrjsonp.JsrJsonpProvider;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
Expand All @@ -37,7 +35,6 @@ public class QueryIT {
@BeforeAll
private static void setup() {
client = ClientBuilder.newClient();
client.register(JsrJsonpProvider.class);
}

@AfterAll
Expand Down Expand Up @@ -67,7 +64,7 @@ public void testGetOSProperties() throws MalformedURLException {
"Incorrect response code from " + target.getUri().getPath());
JsonObject obj = response.readEntity(JsonObject.class);
assertFalse(obj.getString("os.name").isEmpty(),
"os.name should not be empty.");
"os.name should not be empty.");
response.close();
}
// end::getOSProperties[]
Expand Down Expand Up @@ -99,4 +96,4 @@ public void testGetJavaProperties() throws MalformedURLException {
response.close();
}
// end::getJavaProperties[]
}
}
6 changes: 3 additions & 3 deletions finish/system/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>8.0.0</version>
<version>9.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile</groupId>
<artifactId>microprofile</artifactId>
<version>4.1</version>
<version>5.0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
Expand Down Expand Up @@ -74,4 +74,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2022 IBM Corporation and others.
* Copyright (c) 2022, 2023 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.system;

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

@ApplicationPath("system")
public class SystemApplication extends Application {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2022 IBM Corporation and others.
* Copyright (c) 2022, 2023 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.system;
Expand Down
2 changes: 1 addition & 1 deletion finish/system/src/main/liberty/config/server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<server description="system service">

<featureManager>
<feature>jaxrs-2.1</feature>
<feature>restfulWS-3.0</feature>
<!-- tag::grpc[] -->
<feature>grpc-1.0</feature>
<!-- end::grpc[] -->
Expand Down
13 changes: 11 additions & 2 deletions finish/systemproto/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<!-- Provided dependencies -->
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>8.0.0</version>
<version>9.1.0</version>
<scope>provided</scope>
</dependency>
<!-- grpc compile dependencies; provided by Liberty at runtime -->
<!-- grpc compile dependencies -->
<!-- tag::grpc[] -->
<dependency>
<groupId>io.grpc</groupId>
Expand All @@ -36,6 +37,14 @@
<scope>provided</scope>
</dependency>
<!-- end::grpc-stub[] -->
<!-- tag::javax[] -->
<dependency>
<groupId>javax.annotation</groupId>
hutchig marked this conversation as resolved.
Show resolved Hide resolved
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
<scope>provided</scope>
</dependency>
<!-- end::javax[] -->
</dependencies>

<build>
Expand Down
9 changes: 4 additions & 5 deletions finish/systemproto/src/main/proto/SystemService.proto
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2022 IBM Corporation and others.
* Copyright (c) 2022, 2023 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[]

Expand Down
Loading