This is an automated email from the ASF dual-hosted git repository.

jbertram pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit 39dd595d02144a100b5e89bce5e269d840dc2e74
Author: Robbie Gemmell <[email protected]>
AuthorDate: Wed Nov 19 11:45:48 2025 +0000

    ARTEMIS-5756: add integration test for new artemis-jakarta-client karaf 
feature
---
 .../karaf-jakarta-client-integration-tests/pom.xml | 219 +++++++++++++++++++++
 .../client/ArtemisJakartaClientFeatureIT.java      |  84 ++++++++
 .../integration/karaf/client/PaxExamOptions.java   |  74 +++++++
 tests/pom.xml                                      |   1 +
 4 files changed, 378 insertions(+)

diff --git a/tests/karaf-jakarta-client-integration-tests/pom.xml 
b/tests/karaf-jakarta-client-integration-tests/pom.xml
new file mode 100644
index 0000000000..0c1495dc20
--- /dev/null
+++ b/tests/karaf-jakarta-client-integration-tests/pom.xml
@@ -0,0 +1,219 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+   <modelVersion>4.0.0</modelVersion>
+
+   <parent>
+      <groupId>org.apache.activemq.tests</groupId>
+      <artifactId>artemis-tests-pom</artifactId>
+      <version>2.45.0-SNAPSHOT</version>
+   </parent>
+
+   <artifactId>karaf-jakarta-client-integration-tests</artifactId>
+   <packaging>jar</packaging>
+   <name>ActiveMQ Artemis Karaf Jakarta Client Int Tests</name>
+
+   <description>
+      Integration tests for the artemis client features using Apache Karaf
+   </description>
+
+   <properties>
+      <activemq.basedir>${project.basedir}/../..</activemq.basedir>
+      
<jakarta.jms-api.version>${jakarta.jms-api.version.alt}</jakarta.jms-api.version>
+   </properties>
+
+   <dependencies>
+      <dependency>
+         <groupId>jakarta.jms</groupId>
+         <artifactId>jakarta.jms-api</artifactId>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-jakarta-client</artifactId>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.junit.vintage</groupId>
+         <artifactId>junit-vintage-engine</artifactId>
+         <scope>test</scope>
+      </dependency>
+      <!-- logging -->
+      <dependency>
+         <groupId>org.slf4j</groupId>
+         <artifactId>slf4j-api</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.logging.log4j</groupId>
+         <artifactId>log4j-slf4j2-impl</artifactId>
+         <scope>test</scope>
+      </dependency>
+
+      <!-- karaf test -->
+
+      <dependency>
+         <groupId>org.ops4j.pax.exam</groupId>
+         <artifactId>pax-exam-container-karaf</artifactId>
+         <version>${pax.exam.version}</version>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.ops4j.pax.exam</groupId>
+         <artifactId>pax-exam-junit4</artifactId>
+         <version>${pax.exam.version}</version>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.karaf</groupId>
+         <artifactId>apache-karaf</artifactId>
+         <version>${karaf.version}</version>
+         <scope>test</scope>
+         <type>tar.gz</type>
+         <exclusions>
+            <exclusion>
+               <groupId>org.apache.karaf.features</groupId>
+               <artifactId>spring</artifactId>
+            </exclusion>
+         </exclusions>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.karaf.shell</groupId>
+         <artifactId>org.apache.karaf.shell.console</artifactId>
+         <version>${karaf.version}</version>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-features</artifactId>
+         <classifier>features</classifier>
+         <type>xml</type>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-unit-test-support</artifactId>
+         <version>${project.version}</version>
+         <scope>test</scope>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.servicemix.tooling</groupId>
+            <artifactId>depends-maven-plugin</artifactId>
+            <version>1.5.0</version>
+            <executions>
+               <execution>
+                  <id>generate-depends-file</id>
+                  <goals>
+                     <goal>generate-depends-file</goal>
+                  </goals>
+               </execution>
+            </executions>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>artemis-maven-plugin</artifactId>
+            <executions>
+               <execution>
+                  <id>create</id>
+                  <phase>pre-integration-test</phase>
+                  <goals>
+                     <goal>create</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${skipIntegrationTests}</ignore>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>start</id>
+                  <phase>pre-integration-test</phase>
+                  <goals>
+                     <goal>cli</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${skipIntegrationTests}</ignore>
+                     <spawn>true</spawn>
+                     <testURI>tcp://localhost:61616</testURI>
+                     <args>
+                        <param>run</param>
+                     </args>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>stop</id>
+                  <phase>post-integration-test</phase>
+                  <goals>
+                     <goal>stop</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${skipIntegrationTests}</ignore>
+                  </configuration>
+               </execution>
+            </executions>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-failsafe-plugin</artifactId>
+            <executions>
+               <execution>
+                  <goals>
+                     <goal>integration-test</goal>
+                     <goal>verify</goal>
+                  </goals>
+               </execution>
+            </executions>
+            <configuration>
+               <skipITs>${skipIntegrationTests}</skipITs>
+               <argLine>${activemq-surefire-argline}</argLine>
+            </configuration>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+               <skipTests>true</skipTests>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+   <profiles>
+      <profile>
+         <!-- TODO: Changes so these tests can work -->
+         <id>jdk23on</id>
+         <activation>
+            <jdk>[23,)</jdk>
+         </activation>
+         <properties>
+            <skipIntegrationTests>true</skipIntegrationTests>
+         </properties>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.apache.maven.plugins</groupId>
+                  <artifactId>maven-failsafe-plugin</artifactId>
+                  <configuration>
+                     <skip>true</skip>
+                  </configuration>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+   </profiles>
+</project>
diff --git 
a/tests/karaf-jakarta-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisJakartaClientFeatureIT.java
 
b/tests/karaf-jakarta-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisJakartaClientFeatureIT.java
new file mode 100644
index 0000000000..6e6136597e
--- /dev/null
+++ 
b/tests/karaf-jakarta-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisJakartaClientFeatureIT.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.activemq.artemis.tests.integration.karaf.client;
+
+import java.io.IOException;
+
+import jakarta.jms.Connection;
+import jakarta.jms.ConnectionFactory;
+import jakarta.jms.MessageConsumer;
+import jakarta.jms.MessageProducer;
+import jakarta.jms.Queue;
+import jakarta.jms.Session;
+import jakarta.jms.TextMessage;
+
+import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+
+import static 
org.apache.activemq.artemis.tests.integration.karaf.client.PaxExamOptions.ARTEMIS_JAKARTA_CLIENT;
+import static 
org.apache.activemq.artemis.tests.integration.karaf.client.PaxExamOptions.KARAF;
+import static org.junit.Assert.assertEquals;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.when;
+import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.debugConfiguration;
+
+/**
+ * Useful docs about this test: 
https://ops4j1.jira.com/wiki/display/paxexam/FAQ
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class ArtemisJakartaClientFeatureIT {
+
+   @Configuration
+   public Option[] config() throws IOException {
+      return options(
+              KARAF.option(),
+              ARTEMIS_JAKARTA_CLIENT.option(),
+              when(false)
+                      .useOptions(
+                              debugConfiguration("5005", true))
+      );
+   }
+
+   @Test
+   public void testArtemisJakartaClient() throws Exception {
+      // setup connection
+      ConnectionFactory cf = new 
ActiveMQJMSConnectionFactory("tcp://localhost:61616");
+      try (Connection connection = cf.createConnection()) {
+         Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
+         connection.start();
+         Queue queue = 
ActiveMQJMSClient.createQueue("artemisJMSClientFeatureITQueue");
+         MessageProducer producer = session.createProducer(queue);
+         // send message
+         String textMessage = "This is a text message";
+         TextMessage message = session.createTextMessage(textMessage);
+         producer.send(message);
+
+         // receive message and assert
+         MessageConsumer messageConsumer = session.createConsumer(queue);
+         TextMessage messageReceived = (TextMessage) 
messageConsumer.receive(100);
+         assertEquals(textMessage, messageReceived.getText());
+      }
+   }
+}
diff --git 
a/tests/karaf-jakarta-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/PaxExamOptions.java
 
b/tests/karaf-jakarta-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/PaxExamOptions.java
new file mode 100644
index 0000000000..aefd0a48ba
--- /dev/null
+++ 
b/tests/karaf-jakarta-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/PaxExamOptions.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.activemq.artemis.tests.integration.karaf.client;
+
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption;
+import org.ops4j.pax.exam.options.DefaultCompositeOption;
+
+import java.io.File;
+
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.CoreOptions.when;
+import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
+import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
+import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
+import static 
org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+
+public enum PaxExamOptions {
+   KARAF(
+           karafDistributionConfiguration()
+                   .frameworkUrl(
+                           maven()
+                                   .groupId("org.apache.karaf")
+                                   .artifactId("apache-karaf")
+                                   .versionAsInProject()
+                                   .type("zip"))
+                   .name("Apache Karaf")
+                   .useDeployFolder(false)
+                   .unpackDirectory(new File("target/paxexam/unpack/")),
+           keepRuntimeFolder(),
+           configureConsole().ignoreLocalConsole(),
+           when(System.getProperty("maven.repo.local") != null).useOptions(
+              editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg",
+                                       "org.ops4j.pax.url.mvn.localRepository",
+                                       
System.getProperty("maven.repo.local"))),
+           logLevel(LogLevelOption.LogLevel.INFO)
+   ),
+   ARTEMIS_JAKARTA_CLIENT(
+           features(
+                   maven()
+                           .groupId("org.apache.activemq")
+                           .artifactId("artemis-features")
+                           .type("xml")
+                           .classifier("features")
+                           .versionAsInProject(),
+                   "artemis-jakarta-client")
+   );
+
+   private final Option[] options;
+
+   PaxExamOptions(Option... options) {
+      this.options = options;
+   }
+
+   public Option option() {
+      return new DefaultCompositeOption(options);
+   }
+}
diff --git a/tests/pom.xml b/tests/pom.xml
index b18da89941..c5dbb6fb5d 100644
--- a/tests/pom.xml
+++ b/tests/pom.xml
@@ -126,6 +126,7 @@
       <module>integration-tests</module>
       <module>integration-tests-isolated</module>
       <module>karaf-client-integration-tests</module>
+      <module>karaf-jakarta-client-integration-tests</module>
       <module>karaf-server-integration-tests</module>
       <module>compatibility-tests</module>
       <module>soak-tests</module>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to