Skip to content

Commit

Permalink
[WFLY-18492] messaging-clustering-singleton Quickstart Common Enhance…
Browse files Browse the repository at this point in the history
…ments CY2023Q3
  • Loading branch information
istudens committed Apr 30, 2024
1 parent aaed434 commit 290752a
Show file tree
Hide file tree
Showing 11 changed files with 366 additions and 80 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/quickstart_messaging-clustering-singleton_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: WildFly messaging-clustering-singleton Quickstart CI

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'messaging-clustering-singleton/**'
- '.github/workflows/quickstart_ci.yml'
jobs:
call-quickstart_ci:
uses: ./.github/workflows/quickstart_ci.yml
with:
QUICKSTART_PATH: messaging-clustering-singleton
TEST_PROVISIONED_SERVER: true
208 changes: 149 additions & 59 deletions messaging-clustering-singleton/README-source.adoc

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions messaging-clustering-singleton/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: messaging-clustering-singleton
deploy:
replicas: 1
8 changes: 4 additions & 4 deletions messaging-clustering-singleton/install-domain.cli
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ batch
/server-group=quickstart-messaging-clustering-singleton-group:add(profile=full-ha, socket-binding-group=full-ha-sockets)

# -- Add two servers to the new quickstart-messaging-clustering-singleton-group
/host=master/server-config=quickstart-messagingcluster-node1:add(group=quickstart-messaging-clustering-singleton-group, auto-start=true, socket-binding-port-offset=1000)
/host=master/server-config=quickstart-messagingcluster-node2:add(group=quickstart-messaging-clustering-singleton-group, auto-start=true, socket-binding-port-offset=1100)
/host=primary/server-config=quickstart-messagingcluster-node1:add(group=quickstart-messaging-clustering-singleton-group, auto-start=true, socket-binding-port-offset=1000)
/host=primary/server-config=quickstart-messagingcluster-node2:add(group=quickstart-messaging-clustering-singleton-group, auto-start=true, socket-binding-port-offset=1100)

# -- Enable the console to allow us to view the quickstart output.
/profile=full-ha/subsystem=logging/console-handler=CONSOLE:add(level=INFO,formatter="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n")
Expand All @@ -33,5 +33,5 @@ deploy --server-groups=quickstart-messaging-clustering-singleton-group target/me
run-batch

# -- Start the newly defined servers
/host=master/server-config=quickstart-messagingcluster-node1:start(blocking=true)
/host=master/server-config=quickstart-messagingcluster-node2:start(blocking=true)
/host=primary/server=quickstart-messagingcluster-node1:start(blocking=true)
/host=primary/server=quickstart-messagingcluster-node2:start(blocking=true)
5 changes: 0 additions & 5 deletions messaging-clustering-singleton/install-standalone.cli
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ batch
# -- Add mdb-delivery-group named "my-mdb-delivery-group"
/subsystem=ejb3/mdb-delivery-group=my-mdb-delivery-group:add(active=true)

# -- Deploy the messaging-clustering-singleton.war file
# NOTE: The following command assumes the quickstart is built
# If that is not the case, run mvn clean install before this script
deploy target/messaging-clustering-singleton.war

# -- Run this batch file
run-batch

Expand Down
101 changes: 98 additions & 3 deletions messaging-clustering-singleton/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@
</licenses>

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

<repositories>
Expand Down Expand Up @@ -108,10 +112,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 @@ -143,7 +152,93 @@
<artifactId>jakarta.annotation-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</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>
<id>provisioned-server</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-packs>
<layers>
<layer>cloud-server</layer>
<layer>ejb</layer>
<layer>singleton-ha</layer>
<layer>embedded-activemq</layer>
</layers>
<!-- use cli script(s) to configure the server -->
<packaging-scripts>
<packaging-script>
<scripts>
<script>${basedir}/install-standalone.cli</script>
</scripts>
<!-- Expressions resolved during server execution -->
<resolve-expressions>false</resolve-expressions>
</packaging-script>
</packaging-scripts>
<name>ROOT.war</name>
<layersConfigurationFileName>standalone-full-ha.xml</layersConfigurationFileName>
</configuration>
<executions>
<execution>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>integration-testing</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<includes>
<include>**/BasicRuntimeIT</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
8 changes: 4 additions & 4 deletions messaging-clustering-singleton/remove-domain.cli
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
## Batch file to remove the domain configuration for the messaging-clustering-singleton quickstart.

# - Stop the servers
/host=master/server-config=quickstart-messagingcluster-node1:stop(blocking=true)
/host=master/server-config=quickstart-messagingcluster-node2:stop(blocking=true)
/host=primary/server=quickstart-messagingcluster-node1:stop(blocking=true)
/host=primary/server=quickstart-messagingcluster-node2:stop(blocking=true)

batch

# -- Remove the two servers from the quickstart-messaging-clustering-singleton-group
/host=master/server-config=quickstart-messagingcluster-node1:remove
/host=master/server-config=quickstart-messagingcluster-node2:remove
/host=primary/server-config=quickstart-messagingcluster-node1:remove
/host=primary/server-config=quickstart-messagingcluster-node2:remove

# -- Remove the quickstart-messaging-clustering-singleton-group
/server-group=quickstart-messaging-clustering-singleton-group:remove
Expand Down
2 changes: 1 addition & 1 deletion messaging-clustering-singleton/restart-node1-domain.cli
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# -- Restart the node1 server
/host=master/server-config=quickstart-messagingcluster-node1:restart(blocking=true)
/host=primary/server=quickstart-messagingcluster-node1:restart(blocking=true)
2 changes: 1 addition & 1 deletion messaging-clustering-singleton/restart-node2-domain.cli
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# -- Restart the node2 server
/host=master/server-config=quickstart-messagingcluster-node2:restart(blocking=true)
/host=primary/server=quickstart-messagingcluster-node2:restart(blocking=true)
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* Copyright 2024 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.mdb;

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;

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


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

private static final String DEFAULT_SERVER_HOST = "http://localhost:8080/messaging-clustering-singleton";

@Test
public void testHTTPQueueEndpointIsAvailable() 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 + "/HelloWorldMDBServletClient"))
.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());
for (int i = 0; i < 5; i++) {
String messageLine = "Message (" + i + "): This is message " + (i + 1);
assertTrue(response.body().contains(messageLine), response.body() + " doesn't contain " + messageLine);
}
}
@Test
public void testHTTPTopicEndpointIsAvailable() 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 + "/HelloWorldMDBServletClient?topic=true"))
.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());
for (int i = 0; i < 5; i++) {
String messageLine = "Message (" + i + "): This is message " + (i + 1);
assertTrue(response.body().contains(messageLine), response.body() + " doesn't contain " + messageLine);
}
}
}
3 changes: 0 additions & 3 deletions messaging-clustering-singleton/undeploy-standalone.cli

This file was deleted.

0 comments on commit 290752a

Please sign in to comment.