From c5d78d18fcf56b198de9bc750a3f02f6f7562cef Mon Sep 17 00:00:00 2001 From: Eduardo Martins Date: Mon, 16 Oct 2023 19:16:32 +0100 Subject: [PATCH] [WFLY-18486] jsonp Quickstart CY2023Q3 enhancements --- .github/workflows/quickstart_jsonp_ci.yml | 14 ++ README.adoc | 2 +- jsonp/README.adoc | 48 ++----- jsonp/charts/helm.yaml | 6 + jsonp/pom.xml | 120 +++++++++++++++++- .../quickstarts/jsonp/BasicRuntimeIT.java | 59 +++++++++ ...he-quickstart-with-provisioned-server.adoc | 2 +- 7 files changed, 210 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/quickstart_jsonp_ci.yml create mode 100644 jsonp/charts/helm.yaml create mode 100644 jsonp/src/test/java/org/wildfly/quickstarts/jsonp/BasicRuntimeIT.java diff --git a/.github/workflows/quickstart_jsonp_ci.yml b/.github/workflows/quickstart_jsonp_ci.yml new file mode 100644 index 0000000000..9385668e46 --- /dev/null +++ b/.github/workflows/quickstart_jsonp_ci.yml @@ -0,0 +1,14 @@ +name: WildFly jsonp Quickstart CI + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + paths: + - 'jsonp/**' + - '.github/workflows/quickstart_ci.yml' +jobs: + call-quickstart_ci: + uses: ./.github/workflows/quickstart_ci.yml + with: + QUICKSTART_PATH: jsonp + TEST_PROVISIONED_SERVER: true diff --git a/README.adoc b/README.adoc index 0881723a24..b155446a49 100644 --- a/README.adoc +++ b/README.adoc @@ -173,7 +173,7 @@ NOTE: Some of these quickstarts use the H2 database included with {productNameFu | link:jsonp/README{outfilesuffix}[jsonp]|CDI, JSF, JSON-P | The `jsonp` quickstart demonstrates how to use the JSON-P API to produce object-based structures and then parse and consume them as stream-based JSON strings. | Beginner | _none_ | link:jta-crash-rec/README{outfilesuffix}[jta-crash-rec]|JTA, Crash Recovery | The `jta-crash-rec` quickstart uses JTA and Byteman to show how to code distributed (XA) transactions in order to preserve ACID properties on server crash. | Advanced | _none_ | link:jts/README{outfilesuffix}[jts]|JTS, EJB, JMS | The `jts` quickstart shows how to use JTS to perform distributed transactions across multiple containers, fulfilling the properties of an ACID transaction. | Intermediate | link:cmt/README.html[cmt] -| link:kitchensink/README{outfilesuffix}[kitchensink]|CDI, JSF, JPA, EJB, JAX-RS, BV | The `kitchensink` quickstart demonstrates a {javaVersion} web-enabled database application using JSF, CDI, EJB, JPA, and Bean Validation. | Intermediate | _none_ +| link:kitchensink/README{outfilesuffix}[kitchensink]|CDI, JSF, JPA, EJB, JAX-RS, BV | The `kitchensink` quickstart demonstrates a localized {javaVersion} web-enabled database application using JSF, CDI, EJB, JPA, and Bean Validation. | Intermediate | _none_ | link:logging/README{outfilesuffix}[logging]|Logging | The `logging` quickstart demonstrates how to configure different logging levels in {productName}. It also includes an asynchronous logging example. | Intermediate | _none_ | link:mail/README{outfilesuffix}[mail]|JavaMail, CDI, JSF | The `mail` quickstart demonstrates how to send email using CDI and JSF and the default Mail provider that ships with {productName}. | Beginner | _none_ | link:messaging-clustering-singleton/README{outfilesuffix}[messaging-clustering-singleton]|JMS, MDB, Clustering | The `messaging-clustering-singleton` quickstart uses a JMS topic and a queue to demonstrate clustering using {productName} messaging with MDB singleton configuration where only one node in the cluster will be active. | Advanced | _none_ diff --git a/jsonp/README.adoc b/jsonp/README.adoc index 90ace6fba1..3b0730e5ca 100644 --- a/jsonp/README.adoc +++ b/jsonp/README.adoc @@ -18,20 +18,13 @@ The `jsonp` quickstart creates a JSON string through object-based JSON generatio It shows how to use the JSON-P API to generate, parse, and consume JSON files. -//************************************************* -// Product Release content only -//************************************************* - -ifndef::EAPCDRelease[] - -// System Requirements -include::../shared-doc/system-requirements.adoc[leveloffset=+1] -// Use of {jbossHomeName} -include::../shared-doc/use-of-jboss-home-name.adoc[leveloffset=+1] +// build and run with standard server distribution +[[build_and_run_the_quickstart_with_server_dist]] +== Building and running the quickstart application with a {productName} server distribution // Start the {productName} Standalone Server -include::../shared-doc/start-the-standalone-server.adoc[leveloffset=+1] +include::../shared-doc/start-the-standalone-server.adoc[leveloffset=+2] // Build and Deploy the Quickstart -include::../shared-doc/build-and-deploy-the-quickstart.adoc[leveloffset=+1] +include::../shared-doc/build-and-deploy-the-quickstart.adoc[leveloffset=+2] == Access the Application @@ -45,30 +38,13 @@ Note that the JSON string contains String, number, boolean and array values. . Now, click on the *Parse JSON String using Stream* button. The text area below the button shows the events generated from the parsed JSON string. +// Server Distribution Testing +include::../shared-doc/run-integration-tests-with-server-distribution.adoc[leveloffset=+2] // Undeploy the Quickstart -include::../shared-doc/undeploy-the-quickstart.adoc[leveloffset=+1] -// Run the Quickstart in Red Hat CodeReady Studio or Eclipse -include::../shared-doc/run-the-quickstart-in-jboss-developer-studio.adoc[leveloffset=+1] -// Debug the Application -include::../shared-doc/debug-the-application.adoc[leveloffset=+1] +include::../shared-doc/undeploy-the-quickstart.adoc[leveloffset=+2] +// Build and run sections for other environments/builds +ifndef::ProductRelease,EAPXPRelease[] +include::../shared-doc/build-and-run-the-quickstart-with-provisioned-server.adoc[leveloffset=+1] endif::[] - -//************************************************* -// Product Release content only -//************************************************* -ifdef::ProductRelease[] - -// Getting Started with OpenShift -include::../shared-doc/openshift-getting-started.adoc[leveloffset=+1] -//Prepare OpenShift for Quickstart Deployment -include::../shared-doc/openshift-create-project.adoc[leveloffset=+1] -// Import the Latest {xpaasproduct-shortname} Image Streams and Templates -include::../shared-doc/openshift-import-imagestreams-templates.adoc[leveloffset=+1] -// Deploy the {ProductShortName} Source-to-Image (S2I) Quickstart to OpenShift -include::../shared-doc/openshift-deploy-project.adoc[leveloffset=+1] -// Openshift post deployment tasks -include::../shared-doc/openshift-post-deployment-tasks.adoc[leveloffset=+1] - - -endif::[] \ No newline at end of file +include::../shared-doc/build-and-run-the-quickstart-with-openshift.adoc[leveloffset=+1] \ No newline at end of file diff --git a/jsonp/charts/helm.yaml b/jsonp/charts/helm.yaml new file mode 100644 index 0000000000..ff181f49c8 --- /dev/null +++ b/jsonp/charts/helm.yaml @@ -0,0 +1,6 @@ +build: + uri: https://github.com/wildfly/quickstart.git + ref: main + contextDir: jsonp +deploy: + replicas: 1 \ No newline at end of file diff --git a/jsonp/pom.xml b/jsonp/pom.xml index fcee0fdbbb..79c6bb4d1e 100644 --- a/jsonp/pom.xml +++ b/jsonp/pom.xml @@ -43,8 +43,12 @@ - - 30.0.0.Beta1 + + 30.0.0.Beta1 + + ${version.server} + 5.0.0.Beta1 + 4.2.0.Final @@ -108,7 +112,7 @@ org.wildfly.bom wildfly-ee-with-tools - ${version.server.bom} + ${version.bom.ee} pom import @@ -175,6 +179,116 @@ provided + + + junit + junit + test + + + + + + org.wildfly.plugins + wildfly-maven-plugin + ${version.plugin.wildfly} + + + + + + + + provisioned-server + + + + org.wildfly.plugins + wildfly-maven-plugin + + + + org.wildfly:wildfly-galleon-pack:${version.server} + + + + + jsf + cloud-server + + + ROOT.war + + + + + package + + + + + + + + + openshift + + + + org.wildfly.plugins + wildfly-maven-plugin + + + + org.wildfly:wildfly-galleon-pack:${version.server} + + + org.wildfly.cloud:wildfly-cloud-galleon-pack:${version.pack.cloud} + + + + jsf + cloud-server + + ROOT.war + + + + + package + + + + + + + + + integration-testing + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + **/*IT + + + + + + integration-test + verify + + + + + + + + + diff --git a/jsonp/src/test/java/org/wildfly/quickstarts/jsonp/BasicRuntimeIT.java b/jsonp/src/test/java/org/wildfly/quickstarts/jsonp/BasicRuntimeIT.java new file mode 100644 index 0000000000..dc146c0294 --- /dev/null +++ b/jsonp/src/test/java/org/wildfly/quickstarts/jsonp/BasicRuntimeIT.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 JBoss by Red Hat. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wildfly.quickstarts.jsonp; + +import org.junit.Test; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import static org.junit.Assert.assertEquals; + +/** + * The very basic runtime integration testing. + * @author Emmanuel Hugonnet + * @author emartins + */ +public class BasicRuntimeIT { + + private static final String DEFAULT_SERVER_HOST = "http://localhost:8080/jsonp"; + + @Test + public void testHTTPEndpointIsAvailable() throws IOException, InterruptedException, URISyntaxException { + String serverHost = System.getenv("SERVER_HOST"); + if (serverHost == null) { + serverHost = System.getProperty("server.host"); + } + if (serverHost == null) { + serverHost = DEFAULT_SERVER_HOST; + } + final HttpRequest request = HttpRequest.newBuilder() + .uri(new URI(serverHost+"/")) + .GET() + .build(); + final HttpClient client = HttpClient.newBuilder() + .followRedirects(HttpClient.Redirect.ALWAYS) + .connectTimeout(Duration.ofMinutes(1)) + .build(); + final HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); + assertEquals(200, response.statusCode()); + } +} diff --git a/shared-doc/build-and-run-the-quickstart-with-provisioned-server.adoc b/shared-doc/build-and-run-the-quickstart-with-provisioned-server.adoc index 4fe146a22a..ffa7f03a1f 100644 --- a/shared-doc/build-and-run-the-quickstart-with-provisioned-server.adoc +++ b/shared-doc/build-and-run-the-quickstart-with-provisioned-server.adoc @@ -45,7 +45,7 @@ The server provisioning functionality is provided by the WildFly Maven Plugin, a cloud-server - ROOT.war + ROOT.war