[AMQ-9239] jakarta.jms - activemq-client-jakarta relocation and removal

This commit is contained in:
Matt Pavlovich 2023-08-24 09:29:06 -05:00
parent f022aeac58
commit 39feb6b5c4
2 changed files with 9 additions and 270 deletions

View File

@ -23,193 +23,18 @@
<version>5.19.0-SNAPSHOT</version> <version>5.19.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>activemq-client-jakarta</artifactId> <artifactId>activemq-client-jakarta</artifactId>
<packaging>bundle</packaging> <packaging>pom</packaging>
<name>ActiveMQ :: Client Jakarta</name> <name>ActiveMQ :: Client Jakarta</name>
<description>Jakarta transition module for ActiveMQ Client implementation</description> <description>Jakarta transition module for ActiveMQ Client implementation</description>
<properties> <properties>
<maven.javadoc.skip>true</maven.javadoc.skip> <maven.javadoc.skip>true</maven.javadoc.skip>
</properties> </properties>
<dependencies> <distributionManagement>
<dependency> <relocation>
<groupId>org.apache.activemq</groupId> <groupId>org.apache.activemq</groupId>
<artifactId>activemq-client</artifactId> <artifactId>activemq-client</artifactId>
<scope>provided</scope> <version>${project.version}</version>
<exclusions> <message>ActiveMQ Jakarta transition client no longer needed. Use activemq-client going forward.</message>
<exclusion> </relocation>
<groupId>jakarta.jms</groupId> </distributionManagement>
<artifactId>jakarta.jms-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>jakarta.jms</groupId>
<artifactId>jakarta.jms-api</artifactId>
<version>${jakarta-jms-api-v3-version}</version>
</dependency>
<dependency>
<groupId>org.fusesource.hawtbuf</groupId>
<artifactId>hawtbuf</artifactId>
<version>${hawtbuf-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.jmdns</groupId>
<artifactId>jmdns</artifactId>
<optional>true</optional>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-source</id>
<phase>initialize</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-client</artifactId>
<classifier>sources</classifier>
<type>jar</type>
<outputDirectory>${project.build.directory}/copied-sources/activemq-client</outputDirectory>
<excludes>**/META-INF/*,**/META-INF/maven/**,**/zeroconf/**</excludes>
<includes>**/**</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>${project.build.directory}/copied-sources/activemq-client/**/*.java</include>
</includes>
<token>javax.jms</token>
<value>jakarta.jms</value>
<regexFlags>
<regexFlag>MULTILINE</regexFlag>
</regexFlags>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-java-source</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}/copied-sources/activemq-client/org</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-resources</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-resources/META-INF</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}/copied-sources/activemq-client/META-INF</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-resource</id>
<phase>generate-resources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${project.build.directory}/generated-resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<inherited>true</inherited>
<configuration>
<instructions>
<Import-Package>
!java.*,
!com.google.errorprone.annotations,
!com.google.errorprone.annotations.concurrent,
com.thoughtworks.xstream.*;resolution:="optional",
*
</Import-Package>
<Private-Package>
com.google.errorprone.annotations,
com.google.errorprone.annotations.concurrent
</Private-Package>
<_noee>true</_noee>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -1,86 +0,0 @@
/**
* 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.jakarta;
import static org.junit.Assert.*;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.junit.Ignore;
import org.junit.Test;
import jakarta.jms.Connection;
import jakarta.jms.Destination;
import jakarta.jms.JMSException;
import jakarta.jms.Message;
import jakarta.jms.MessageConsumer;
import jakarta.jms.MessageProducer;
import jakarta.jms.Session;
import jakarta.jms.TextMessage;
public class JakartaTest {
@Ignore // NOTE: Remove @Ignore to test manually with local running ActiveMQ broker until we have a Jakarta-supported broker
@Test
public void testJakartaConnection() throws JMSException {
ActiveMQConnectionFactory activemqConnectionFactory = new ActiveMQConnectionFactory("admin", "admin", "tcp://localhost:61616");
Connection connection = activemqConnectionFactory.createConnection();
assertTrue(jakarta.jms.Connection.class.isAssignableFrom(connection.getClass()));
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
assertTrue(jakarta.jms.Session.class.isAssignableFrom(session.getClass()));
Destination queue = session.createQueue("JAKARTA.TEST");
assertTrue(jakarta.jms.Destination.class.isAssignableFrom(queue.getClass()));
MessageProducer messageProducer = session.createProducer(queue);
assertTrue(jakarta.jms.MessageProducer.class.isAssignableFrom(messageProducer.getClass()));
String messageText = "Test Jakarta API";
TextMessage sendMessage = session.createTextMessage(messageText);
assertTrue(jakarta.jms.Message.class.isAssignableFrom(sendMessage.getClass()));
assertTrue(jakarta.jms.TextMessage.class.isAssignableFrom(sendMessage.getClass()));
messageProducer.send(sendMessage);
MessageConsumer messageConsumer = session.createConsumer(queue);
assertTrue(jakarta.jms.MessageConsumer.class.isAssignableFrom(messageConsumer.getClass()));
Message recvMessage = messageConsumer.receive(5000l);
assertNotNull(recvMessage);
assertTrue(jakarta.jms.Message.class.isAssignableFrom(sendMessage.getClass()));
assertTrue(jakarta.jms.TextMessage.class.isAssignableFrom(sendMessage.getClass()));
assertEquals(messageText, TextMessage.class.cast(recvMessage).getText());
if(messageConsumer != null) {
try { messageConsumer.close(); } catch (JMSException e) { }
}
if(messageProducer != null) {
try { messageProducer.close(); } catch (JMSException e) { }
}
if(session != null) {
try { session.close(); } catch (JMSException e) { }
}
if(connection != null) {
try { connection.close(); } catch (JMSException e) { }
}
}
}