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

[WFLY-18502]: remote-helloworld-mdb Quickstart Common Enhancements CY2023Q3 #725

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 17 additions & 0 deletions .github/workflows/quickstart_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,23 @@ jobs:
jdk: [11, 17]
os: [ubuntu-20.04, windows-latest]
steps:
- name: Skip Windows
if: runner.os == 'Windows' && ${{ inputs.QUICKSTART_PATH == 'remote-helloworld-mdb' }}
run: |
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
actions: 'write'
########################################################################################################
# Conditional steps to set up needed backend services
- name: Setup Artemis
if: ${{ inputs.QUICKSTART_PATH == 'remote-helloworld-mdb' }}
# This image will be moved to SmallRye at some point
run: docker run -d --name artemis -e AMQ_USER=admin -e AMQ_PASSWORD=admin -p8161:8161 -p61616:61616 -e AMQ_DATA_DIR=/home/jboss/data quay.io/artemiscloud/activemq-artemis-broker-kubernetes:artemis.2.31.0
# Conditional steps - END
########################################################################################################
- uses: actions/checkout@v4
with:
repository: wildfly/wildfly
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/quickstart_remote-helloworld-mdb_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: WildFly remote-helloworld-mdb Quickstart CI

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'remote-helloworld-mdb/**'
- '.github/workflows/quickstart_ci.yml'
jobs:
call-quickstart_ci:
uses: ./.github/workflows/quickstart_ci.yml
with:
QUICKSTART_PATH: remote-helloworld-mdb
MICROPROFILE: false
38 changes: 12 additions & 26 deletions remote-helloworld-mdb/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ $ docker run --rm --name artemis -e AMQ_USER=admin -e AMQ_PASSWORD=admin -p8161:

You can access the console of {BrokerProductName} at the URL: http://localhost:8161/console with *admin/admin* to authenticate.

// Back Up the {productName} Standalone Server Configuration
include::../shared-doc/back-up-server-standalone-configuration.adoc[leveloffset=+2]

// Start the {productName} Standalone Server
include::../shared-doc/start-the-standalone-server.adoc[leveloffset=+2]

[[configure_the_server]]
=== Configure the {productName} Server

Expand Down Expand Up @@ -103,8 +97,8 @@ The following `testQueue` jms-queue was configured in the configuration of the `
<pooled-connection-factory name="RemoteConnectionFactory" entries="java:jboss/RemoteConnectionFactory java:jboss/exported/jms/RemoteConnectionFactory" connectors="artemis" user="admin" password="admin" enable-amq1-prefix="false"/>
----



// Start the {productName} Standalone Server
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=+2]

Expand All @@ -125,12 +119,8 @@ INFO [class org.jboss.as.quickstarts.mdb.HelloWorldQueueMDB] (Thread-5 (ActiveM
INFO [class org.jboss.as.quickstarts.mdb.HelloWorldQueueMDB] (Thread-4 (ActiveMQ-client-global-threads-1189700957)) Received Message from queue: This is message 5
----

// Testing with Arquillian
include::../shared-doc/run-arquillian-integration-tests-with-server-distribution.adoc[leveloffset=+2]
// Undeploy the Quickstart
include::../shared-doc/undeploy-the-quickstart.adoc[leveloffset=+2]
// Restore the {productName} Standalone Server Configuration
include::../shared-doc/restore-standalone-server-configuration.adoc[leveloffset=+2]
// Server Distribution Testing
include::../shared-doc/run-integration-tests-with-server-distribution.adoc[leveloffset=+2]

// Additional information about this script
This script removes the remote broker connection from the `messaging-activemq` subsystem and restore the `default` internal broker. You should see the following result when you run the script:
Expand All @@ -147,18 +137,19 @@ This script removes the remote broker connection from the `messaging-activemq` s
// Restore the {productName} Standalone Server Configuration Manually
include::../shared-doc/restore-standalone-server-configuration-manual.adoc[leveloffset=+3]

// 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]
include::../shared-doc/undeploy-the-quickstart.adoc[leveloffset=+2]

[NOTE]
====
The Arquillian integration tests expect a running {BrokerProductName} broker, so make sure you have started the broker before you begin.
The integration tests expect a running {BrokerProductName} broker, so make sure you have started the broker before you begin.
====
// 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::[]

== Building and running the quickstart application with OpenShift

include::../shared-doc/build-and-run-the-quickstart-with-openshift.adoc[leveloffset=+1]
=== Deploy a {BrokerProductName} instance on OpenShift

[source,options="nowrap",subs="+attributes"]
Expand All @@ -169,12 +160,7 @@ $ oc run artemis --env AMQ_USER=admin --env AMQ_PASSWORD=admin --image={BrokerIm
This will create a broker instance named `artemis` on OpenShift that can be accessed on the port `61616` on the service `artemis` with the account *admin/admin*.
//Prepare Helm for Quickstart Deployment

// Getting Started with Helm
include::../shared-doc/helm-getting-started-overview.adoc[leveloffset=+2]
//Prepare Helm for Quickstart Deployment
include::../shared-doc/helm-deploy-project.adoc[leveloffset=+2]
// Testing on Openshift
include::../shared-doc/run-arquillian-integration-tests-with-openshift.adoc[leveloffset=+2]
include::../shared-doc/build-and-run-the-quickstart-with-openshift.adoc[leveloffset=+1]

==== Clean Up

Expand Down
94 changes: 17 additions & 77 deletions remote-helloworld-mdb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@
</licenses>

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

<repositories>
Expand Down Expand Up @@ -112,10 +114,15 @@
<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>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${version.junit-jupiter-engine}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -150,50 +157,20 @@

<!-- Tests -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-test-spi</artifactId>
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-servlet-jakarta</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-common</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</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 @@ -216,30 +193,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${version.failsafe.plugin}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<environmentVariables>
<JBOSS_HOME>${project.build.directory}/server</JBOSS_HOME>
</environmentVariables>
<includes>
<include>**/ProvisionedManagedMDBServletIT</include>
</includes>
<excludes>
<exclude>**/RemoteMDBServletIT</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand All @@ -250,14 +203,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 @@ -279,16 +231,7 @@
</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>
Expand All @@ -305,11 +248,8 @@
</executions>
<configuration>
<includes>
<include>**/RemoteMDBServletIT</include>
<include>**/BasicRuntimeIT</include>
</includes>
<excludes>
<exclude>**/ProvisionedManagedMDBServletIT</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 JBoss by Red Hat.
* 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.
Expand All @@ -15,25 +15,26 @@
*/
package org.jboss.as.quickstarts.mdb;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

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 java.util.Optional;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
*
* @author Emmanuel Hugonnet (c) 2023 Red Hat, Inc.
*/
public abstract class AbstractMDBServletIT {
public class BasicRuntimeIT {

protected abstract URI getHTTPEndpoint();
private static final String DEFAULT_SERVER_HOST = "http://localhost:8080/remote-helloworld-mdb";

@Test
public void testSendToQueue() throws IOException, InterruptedException {
Expand Down Expand Up @@ -94,4 +95,20 @@ public void testSendToTopic() throws IOException, InterruptedException {
protected String getLineSeparator() {
return "\n";
}

private String getServerHost() {
String host = System.getenv("SERVER_HOST");
if (host == null) {
host = System.getProperty("server.host", DEFAULT_SERVER_HOST);
}
return host;
}

protected URI getHTTPEndpoint() {
try {
return new URI(getServerHost() + "/HelloWorldMDBServletClient");
} catch (URISyntaxException ex) {
throw new RuntimeException(ex);
}
}
}

This file was deleted.

Loading