Skip to content

Commit

Permalink
Merge pull request #764 from emmartins/websocket-hello-enhancements
Browse files Browse the repository at this point in the history
[WFLY-18514] websocket-hello quickstart enhancement CY2023Q3
  • Loading branch information
emmartins authored Oct 24, 2023
2 parents 3e7cf92 + 05f5212 commit 9e97917
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 152 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/quickstart_websocket-hello_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: WildFly websocket-hello Quickstart CI

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'websocket-hello/**'
- '.github/workflows/quickstart_ci.yml'
jobs:
call-quickstart_ci:
uses: ./.github/workflows/quickstart_ci.yml
with:
QUICKSTART_PATH: websocket-hello
TEST_PROVISIONED_SERVER: true
4 changes: 2 additions & 2 deletions websocket-hello/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ The application will be running at the following URL: http://localhost:8080/{art
WebSocket connection is not established. Please click the Open Connection button.
----

// Testing with Arquillian
include::../shared-doc/run-arquillian-integration-tests-with-server-distribution.adoc[leveloffset=+2]
// 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=+2]

Expand Down
80 changes: 10 additions & 70 deletions websocket-hello/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@
</licenses>

<properties>
<!-- The versions for BOMs, Dependencies and Plugins -->
<version.server.bom>30.0.0.Final</version.server.bom>
<!-- the version for the Server -->
<version.server>30.0.0.Final</version.server>
<version.wildfly.maven.plugin>4.2.0.Final</version.wildfly.maven.plugin>
<version.cloud.fp>5.0.0.Final</version.cloud.fp>
<!-- 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>
</properties>

<repositories>
Expand Down Expand Up @@ -112,7 +113,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 All @@ -130,54 +131,22 @@
<artifactId>jakarta.websocket-client-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.9.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.junit5</groupId>
<artifactId>arquillian-junit5-container</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-servlet-jakarta</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>provisioned-server</id>
<dependencies>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>${version.wildfly.maven.plugin}</version>
<configuration>
<feature-packs>
<feature-pack>
Expand All @@ -187,7 +156,7 @@
<layers>
<layer>cloud-server</layer>
</layers>
<runtimeName>ROOT.war</runtimeName>
<name>ROOT.war</name>
</configuration>
<executions>
<execution>
Expand All @@ -197,30 +166,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${version.failsafe.plugin}</version>
<configuration>
<environmentVariables>
<JBOSS_HOME>${project.build.directory}/server</JBOSS_HOME>
</environmentVariables>
<includes>
<include>**/ProvisionedManagedWebsocketIT</include>
</includes>
<excludes>
<exclude>**/RemoteWebSocketIT</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand All @@ -231,14 +176,13 @@
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>${version.wildfly.maven.plugin}</version>
<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.cloud.fp}</location>
<location>org.wildfly.cloud:wildfly-cloud-galleon-pack:${version.pack.cloud}</location>
</feature-pack>
</feature-packs>
<layers>
Expand All @@ -258,20 +202,16 @@
</build>
</profile>
<profile>
<id>arq-remote</id>
<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>**/RemoteWebSocketIT</include>
<include>**/*IT</include>
</includes>
<excludes>
<exclude>**/ProvisionedManagedWebsocketIT</exclude>
</excludes>
</configuration>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* 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.jboss.as.quickstarts.websocket_hello;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.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;

/**
* The very basic runtime integration testing.
* @author Emmanuel Hugonnet
* @author emartins
*/
public class BasicRuntimeIT {

private static final String DEFAULT_SERVER_HOST = "http://localhost:8080/websocket-hello";

@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());
Assertions.assertEquals(200, response.statusCode());
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*
* @author Emmanuel Hugonnet (c) 2022 Red Hat, Inc.
*/
public class RemoteWebSocketIT {
public class WebSocketHelloIT {

protected URI getWebSocketEndpoint() {
String host = getServerHost();
Expand All @@ -52,7 +52,7 @@ protected static String getServerHost() {
if (host == null) {
host = System.getProperty("server.host");
}
if(host != null) {
if (host != null) {
host= host.replaceFirst("http", "ws");
}
return host;
Expand Down
23 changes: 0 additions & 23 deletions websocket-hello/src/test/resources/arquillian.xml

This file was deleted.

0 comments on commit 9e97917

Please sign in to comment.