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-18492] messaging-clustering-singleton Quickstart Common Enhance… #902

Merged
merged 1 commit into from
May 17, 2024
Merged
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
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
204 changes: 145 additions & 59 deletions messaging-clustering-singleton/README-source.adoc

Large diffs are not rendered by default.

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)
8 changes: 0 additions & 8 deletions messaging-clustering-singleton/install-standalone.cli
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,5 @@ 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

# Reload the server
reload
113 changes: 110 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,105 @@
<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>
</configuration>
<executions>
<execution>
<id>server1</id>
<goals>
<goal>package</goal>
</goals>
<configuration>
<provisioningDir>server</provisioningDir>
</configuration>
</execution>
<execution>
<id>server2</id>
<goals>
<goal>package</goal>
</goals>
<configuration>
<provisioningDir>server2</provisioningDir>
</configuration>
</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
3 changes: 0 additions & 3 deletions messaging-clustering-singleton/remove-standalone.cli
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@ batch

# -- Run this batch file
run-batch

# Reload the server
reload
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.