Skip to content

Commit

Permalink
WFLY-18508 spring-resteasy Quickstart Common Enhancements CY2023Q3 #755
Browse files Browse the repository at this point in the history
  • Loading branch information
liweinan committed Oct 24, 2023
1 parent 0c88976 commit a97c084
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 103 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/quickstart_spring-resteasy_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: WildFly spring-resteasy Quickstart CI

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'spring-resteasy/**'
- '.github/workflows/quickstart_ci.yml'
jobs:
call-quickstart_ci:
uses: ./.github/workflows/quickstart_ci.yml
with:
QUICKSTART_PATH: spring-resteasy
TEST_PROVISIONED_SERVER: true
33 changes: 7 additions & 26 deletions spring-resteasy/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ The `spring-resteasy` quickstart demonstrates how to package and deploy a web ap
// Product Release content only
//*************************************************
ifndef::EAPCDRelease[]
// System Requirements
include::../shared-doc/system-requirements.adoc[leveloffset=+1]
// Use of {jbossHomeName}
Expand Down Expand Up @@ -65,30 +63,13 @@ WARN [org.jboss.as.ee] (MSC service thread 1-5) WFLYEE0007: Not installing opti
WARN [org.jboss.as.ee] (MSC service thread 1-5) WFLYEE0007: Not installing optional component org.springframework.web.context.request.async.StandardServletAsyncWebRequest due to an exception (enable DEBUG log level to see the cause)
----
// 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 Arquillian Tests
include::../shared-doc/run-arquillian-tests.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]
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]
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::[]
include::../shared-doc/build-and-run-the-quickstart-with-openshift.adoc[leveloffset=+1]
6 changes: 6 additions & 0 deletions spring-resteasy/charts/helm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build:
uri: https://github.com/wildfly/quickstart.git
ref: main
contextDir: spring-resteasy
deploy:
replicas: 1
111 changes: 81 additions & 30 deletions spring-resteasy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,16 @@
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>

<!-- The versions for BOMs, Dependencies and Plugins -->
<!-- the version for the Server -->
<version.server>30.0.0.Final</version.server>
<!-- the versions for BOMs, Packs and Plugins -->
<version.bom.ee>${version.server}</version.bom.ee>
<version.pack.cloud>5.0.0.Final</version.pack.cloud>
<version.plugin.wildfly>4.2.0.Final</version.plugin.wildfly>

<!-- The versions for other Dependencies and Plugins -->
<version.spring.framework>6.0.4</version.spring.framework>
<version.server.bom>30.0.0.Final</version.server.bom>
<version.resteasy.spring>3.0.4.Final</version.resteasy.spring>
</properties>

<repositories>
Expand Down Expand Up @@ -114,7 +121,7 @@
<dependency>
<groupId>org.wildfly.bom</groupId>
<artifactId>wildfly-ee-with-tools</artifactId>
<version>${version.server.bom}</version>
<version>${version.bom.ee}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -185,30 +192,79 @@
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>${version.plugin.wildfly}</version>
</plugin>
</plugins>
</pluginManagement>
</build>

<profiles>
<profile>
<!-- An optional Arquillian testing profile that executes tests in your JBoss EAP instance.
This profile will start a new JBoss EAP instance, and execute the test, shutting it down when done.
Run with: mvn clean verify -Parq-managed -->
<id>arq-managed</id>
<dependencies>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<id>provisioned-server</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${version.failsafe.plugin}</version>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<configuration>
<feature-packs>
<feature-pack>
<location>org.wildfly:wildfly-galleon-pack:${version.server}</location>
</feature-pack>
<feature-pack>
<groupId>org.jboss.resteasy.spring</groupId>
<artifactId>galleon-feature-pack</artifactId>
<version>${version.resteasy.spring}</version>
</feature-pack>
</feature-packs>
<!-- deploys the quickstart on root web context -->
<name>ROOT.war</name>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>openshift</id>
<build>
<plugins>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<configuration>
<feature-packs>
<feature-pack>
<location>org.wildfly:wildfly-galleon-pack:${version.server}</location>
</feature-pack>
<feature-pack>
<location>org.wildfly.cloud:wildfly-cloud-galleon-pack:${version.pack.cloud}
</location>
</feature-pack>
<feature-pack>
<groupId>org.jboss.resteasy.spring</groupId>
<artifactId>galleon-feature-pack</artifactId>
<version>${version.resteasy.spring}</version>
</feature-pack>
</feature-packs>
<filename>ROOT.war</filename>
</configuration>
<executions>
<execution>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
Expand All @@ -217,22 +273,17 @@
</build>
</profile>
<profile>
<!-- An optional Arquillian testing profile that executes tests in a remote JBoss EAP instance.
Run with: mvn clean verify -Parq-remote -->
<id>arq-remote</id>
<dependencies>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<id>integration-testing</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${version.failsafe.plugin}</version>
<configuration>
<includes>
<include>**/*IT</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright 2023 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.jboss.as.quickstarts.resteasyspring.test;

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;
import static org.junit.Assert.assertTrue;

/**
* The very basic runtime integration testing.
* @author liweinan
*/
public class BasicRuntimeIT {

private static final String DEFAULT_SERVER_HOST = "http://localhost:8080/spring-resteasy";

@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<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
assertEquals(200, response.statusCode());
assertTrue(response.body().toString().contains("Hello."));

}
}
Loading

0 comments on commit a97c084

Please sign in to comment.