Skip to content

Commit a4bbcd8

Browse files
EapBootableJarWithAmqpConnectorTests -> WildflyAmqpConnectorIT
1 parent bead963 commit a4bbcd8

File tree

6 files changed

+484
-5
lines changed

6 files changed

+484
-5
lines changed

pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
<version.slf4j>2.0.17</version.slf4j>
5757
<version.gson>2.13.2</version.gson>
5858
<version.lombok>1.18.36</version.lombok>
59+
<version.org.awaitility>4.2.0</version.org.awaitility>
5960
</properties>
6061

6162
<modules>
@@ -147,6 +148,13 @@
147148
<version>${version.gson}</version>
148149
<scope>test</scope>
149150
</dependency>
151+
152+
<dependency>
153+
<groupId>org.awaitility</groupId>
154+
<artifactId>awaitility</artifactId>
155+
<version>${version.org.awaitility}</version>
156+
<scope>test</scope>
157+
</dependency>
150158
</dependencies>
151159
</dependencyManagement>
152160

testsuite/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@
4848
<groupId>com.google.code.gson</groupId>
4949
<artifactId>gson</artifactId>
5050
</dependency>
51+
52+
<dependency>
53+
<groupId>org.awaitility</groupId>
54+
<artifactId>awaitility</artifactId>
55+
</dependency>
5156
</dependencies>
5257

5358
<build>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
/**
2+
* Copyright (C) 2025 Red Hat, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.jboss.intersmash.tests.wildfly.message.broker.activemq.artemis.connector;
17+
18+
import cz.xtf.core.openshift.OpenShifts;
19+
import io.amq.broker.v1beta1.ActiveMQArtemis;
20+
import io.amq.broker.v1beta1.ActiveMQArtemisAddress;
21+
import io.fabric8.kubernetes.api.model.Secret;
22+
import io.fabric8.kubernetes.api.model.SecretBuilder;
23+
import java.io.IOException;
24+
import java.util.ArrayList;
25+
import java.util.Arrays;
26+
import java.util.Base64;
27+
import java.util.Collections;
28+
import java.util.List;
29+
import java.util.Map;
30+
import org.apache.commons.io.FileUtils;
31+
import org.jboss.intersmash.IntersmashConfig;
32+
import org.jboss.intersmash.application.openshift.OpenShiftApplication;
33+
import org.jboss.intersmash.application.operator.ActiveMQOperatorApplication;
34+
import org.jboss.intersmash.provision.operator.model.activemq.broker.ActiveMQArtemisBuilder;
35+
import org.jboss.intersmash.provision.operator.model.activemq.broker.spec.AcceptorBuilder;
36+
import org.jboss.intersmash.provision.operator.model.activemq.broker.spec.ConnectorBuilder;
37+
import org.jboss.intersmash.provision.operator.model.activemq.broker.spec.ConsoleBuilder;
38+
import org.jboss.intersmash.provision.operator.model.activemq.broker.spec.DeploymentPlanBuilder;
39+
import org.jboss.intersmash.provision.operator.model.activemq.broker.spec.UpgradesBuilder;
40+
import org.jboss.intersmash.tests.wildfly.util.SimpleCommandLineBasedKeystoreGenerator;
41+
42+
/**
43+
* ActiveMQ Artemis broker application configured with SSL/TLS for AMQP connector testing.
44+
* <p>
45+
* This application deploys an ActiveMQ Artemis broker on OpenShift with SSL enabled,
46+
* configured for use with the MicroProfile Reactive Messaging AMQP connector.
47+
* It requires mutual TLS (client certificate authentication).
48+
* </p>
49+
*/
50+
public class ActiveMQArtemisAmqpApplication implements ActiveMQOperatorApplication, OpenShiftApplication {
51+
52+
static final String NAME = "amq-broker";
53+
private static final String ACCEPTOR_NAME = "all";
54+
public static final String ADMIN_USER = "admin";
55+
public static final String ADMIN_PASSWORD = "admin";
56+
protected static final String STOREPASS = "password";
57+
protected static final String KEYALIAS = "server";
58+
public static final String AMQ_ACCEPTOR_SECRET_NAME = String.format("%s-secret", ACCEPTOR_NAME);
59+
60+
private static ActiveMQArtemis activeMQArtemis;
61+
protected final List<Secret> secrets = new ArrayList<>();
62+
63+
public ActiveMQArtemisAmqpApplication() throws IOException {
64+
final SimpleCommandLineBasedKeystoreGenerator.CertificateInfo certificateInfo = SimpleCommandLineBasedKeystoreGenerator
65+
.generateCertificate(
66+
getAcceptorServiceName(),
67+
KEYALIAS,
68+
STOREPASS, null,
69+
Arrays.asList(getWildcardSAN()));
70+
71+
Secret sslAcceptorSecret = new SecretBuilder()
72+
.withNewMetadata()
73+
.withName(AMQ_ACCEPTOR_SECRET_NAME)
74+
.withLabels(Collections.singletonMap("app", NAME))
75+
.endMetadata()
76+
.addToStringData("alias", KEYALIAS)
77+
.addToStringData("keyStorePassword", STOREPASS)
78+
.addToStringData("trustStorePassword", STOREPASS)
79+
.addToData(Map.of("broker.ks",
80+
Base64.getEncoder()
81+
.encodeToString(FileUtils.readFileToByteArray(certificateInfo.keystore.toFile()))))
82+
.addToData(Map.of("client.ts",
83+
Base64.getEncoder()
84+
.encodeToString(FileUtils.readFileToByteArray(certificateInfo.truststore.toFile()))))
85+
.build();
86+
secrets.add(sslAcceptorSecret);
87+
88+
activeMQArtemis = new ActiveMQArtemisBuilder(NAME)
89+
.deploymentPlan(new DeploymentPlanBuilder()
90+
.size(2)
91+
.image(IntersmashConfig.activeMQImageUrl())
92+
.initImage(IntersmashConfig.activeMQInitImageUrl())
93+
.requireLogin(false)
94+
.persistenceEnabled(false)
95+
.journalType("nio")
96+
.messageMigration(false)
97+
.build())
98+
.console(new ConsoleBuilder()
99+
.expose(true)
100+
.build())
101+
.acceptors(new AcceptorBuilder(ACCEPTOR_NAME)
102+
.protocols("all")
103+
.port(61617)
104+
.sslEnabled(true)
105+
.sslSecret(sslAcceptorSecret.getMetadata().getName())
106+
.needClientAuth(true)
107+
.wantClientAuth(true)
108+
.verifyHost(false)
109+
.sslProvider("JDK")
110+
.expose(true)
111+
.connectionsAllowed(10L)
112+
.anycastPrefix("jms.queue.")
113+
.multicastPrefix("jms.topic.")
114+
.build())
115+
.connectors(new ConnectorBuilder("connector0")
116+
.host("localhost")
117+
.port(22222)
118+
.sslEnabled(false)
119+
.enabledCipherSuites("SSL_RSA_WITH_RC4_128_SHA,SSL_DH_anon_WITH_3DES_EDE_CBC_SHA")
120+
.enabledProtocols("TLSv1,TLSv1.1,TLSv1.2")
121+
.needClientAuth(true)
122+
.wantClientAuth(true)
123+
.verifyHost(true)
124+
.sslProvider("JDK")
125+
.expose(true)
126+
.build())
127+
.upgrades(new UpgradesBuilder()
128+
.enabled(false)
129+
.minor(false)
130+
.build())
131+
.build();
132+
}
133+
134+
@Override
135+
public ActiveMQArtemis getActiveMQArtemis() {
136+
return activeMQArtemis;
137+
}
138+
139+
@Override
140+
public List<ActiveMQArtemisAddress> getActiveMQArtemisAddresses() {
141+
return Collections.emptyList();
142+
}
143+
144+
@Override
145+
public String getName() {
146+
return NAME;
147+
}
148+
149+
@Override
150+
public List<Secret> getSecrets() {
151+
return secrets;
152+
}
153+
154+
public static String getAcceptorServiceName() {
155+
return String.format("%s-%s-0-svc", NAME, ACCEPTOR_NAME);
156+
}
157+
158+
/**
159+
* Returns the route to the AMQ Broker acceptor service.
160+
*
161+
* @return route to AMQ Broker acceptor service
162+
*/
163+
public static String getRoute() {
164+
return OpenShifts.master().generateHostname(String.format("%s-%s-0-svc-rte", NAME, ACCEPTOR_NAME));
165+
}
166+
167+
public static String getWildcardSAN() {
168+
return String.format("*.apps.%s", OpenShifts.master().getOpenshiftUrl().getHost().replaceFirst("^api\\.", ""));
169+
}
170+
}

0 commit comments

Comments
 (0)