diff --git a/artemis-jakarta-client/pom.xml b/artemis-jakarta-client/pom.xml new file mode 100644 index 0000000000..fb753a9d57 --- /dev/null +++ b/artemis-jakarta-client/pom.xml @@ -0,0 +1,94 @@ + + + 4.0.0 + + + org.apache.activemq + artemis-pom + 2.17.0-SNAPSHOT + + + artemis-jakarta-client + jar + ActiveMQ Artemis Jakarta Messaging Client + + + ${project.basedir}/.. + + + + + org.apache.activemq + artemis-jms-client + ${project.version} + provided + + + + org.apache.activemq + artemis-core-client + ${project.version} + runtime + + + org.apache.activemq + artemis-commons + ${project.version} + runtime + + + org.apache.activemq + artemis-selector + ${project.version} + runtime + + + jakarta.jms + jakarta.jms-api + + + + + + + org.wildfly.extras.batavia + transformer-tools-mvn + + + transform + process-classes + + transform-classes + + + ${project.basedir}/../artemis-jms-client/target/classes/ + ${project.build.outputDirectory} + + + + + + org.wildfly.extras.batavia + transformer-impl-eclipse + ${version.batavia} + + + + + + diff --git a/artemis-jakarta-client/src/main/resources/jms-version.properties b/artemis-jakarta-client/src/main/resources/jms-version.properties new file mode 100644 index 0000000000..1d60a49181 --- /dev/null +++ b/artemis-jakarta-client/src/main/resources/jms-version.properties @@ -0,0 +1,19 @@ +# 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. +# + +activemq.version.implementation.versionName=3.0 +activemq.version.implementation.majorVersion=3 +activemq.version.implementation.minorVersion=0 \ No newline at end of file diff --git a/artemis-jakarta-ra/pom.xml b/artemis-jakarta-ra/pom.xml new file mode 100644 index 0000000000..df06b82da3 --- /dev/null +++ b/artemis-jakarta-ra/pom.xml @@ -0,0 +1,72 @@ + + + ActiveMQ Artemis Jakarta RAR + 4.0.0 + + + org.apache.activemq + artemis-pom + 2.17.0-SNAPSHOT + + + artemis-jakarta-ra + jar + + + ${project.basedir}/.. + + + + + + org.apache.activemq + artemis-ra + ${project.version} + provided + + + + + + + org.wildfly.extras.batavia + transformer-tools-mvn + + + transform + process-classes + + transform-classes + + + ${project.basedir}/../artemis-ra/target/classes/ + ${project.build.outputDirectory} + + + + + + org.wildfly.extras.batavia + transformer-impl-eclipse + ${version.batavia} + + + + + + diff --git a/artemis-jakarta-ra/src/main/resources/jms-version.properties b/artemis-jakarta-ra/src/main/resources/jms-version.properties new file mode 100644 index 0000000000..1d60a49181 --- /dev/null +++ b/artemis-jakarta-ra/src/main/resources/jms-version.properties @@ -0,0 +1,19 @@ +# 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. +# + +activemq.version.implementation.versionName=3.0 +activemq.version.implementation.majorVersion=3 +activemq.version.implementation.minorVersion=0 \ No newline at end of file diff --git a/artemis-jakarta-server/pom.xml b/artemis-jakarta-server/pom.xml new file mode 100644 index 0000000000..014d9ad7ac --- /dev/null +++ b/artemis-jakarta-server/pom.xml @@ -0,0 +1,71 @@ + + + 4.0.0 + + + org.apache.activemq + artemis-pom + 2.17.0-SNAPSHOT + + + artemis-jakarta-server + jar + ActiveMQ Artemis Jakarta Messaging Server + + + ${project.basedir}/.. + + + + + org.apache.activemq + artemis-jms-server + ${project.version} + provided + + + + + + + org.wildfly.extras.batavia + transformer-tools-mvn + + + transform + process-classes + + transform-classes + + + ${project.basedir}/../artemis-jms-server/target/classes/ + ${project.build.outputDirectory} + + + + + + org.wildfly.extras.batavia + transformer-impl-eclipse + ${version.batavia} + + + + + + diff --git a/artemis-jakarta-service-extensions/pom.xml b/artemis-jakarta-service-extensions/pom.xml new file mode 100644 index 0000000000..b64c47db10 --- /dev/null +++ b/artemis-jakarta-service-extensions/pom.xml @@ -0,0 +1,71 @@ + + + 4.0.0 + + + org.apache.activemq + artemis-pom + 2.17.0-SNAPSHOT + + + artemis-jakarta-service-extensions + jar + ActiveMQ Artemis Jakarta Service Extensions + + + ${project.basedir}/.. + + + + + org.apache.activemq + artemis-service-extensions + ${project.version} + provided + + + + + + + org.wildfly.extras.batavia + transformer-tools-mvn + + + transform + process-classes + + transform-classes + + + ${project.basedir}/../artemis-service-extensions/target/classes/ + ${project.build.outputDirectory} + + + + + + org.wildfly.extras.batavia + transformer-impl-eclipse + ${version.batavia} + + + + + + diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionMetaData.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionMetaData.java index c72c4d4bc7..4d69b711c9 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionMetaData.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionMetaData.java @@ -16,9 +16,13 @@ */ package org.apache.activemq.artemis.jms.client; + +import java.io.IOException; +import java.io.InputStream; import javax.jms.ConnectionMetaData; import javax.jms.JMSException; import java.util.Enumeration; +import java.util.Properties; import java.util.Vector; import org.apache.activemq.artemis.core.version.Version; @@ -27,6 +31,24 @@ import org.apache.activemq.artemis.core.version.Version; * ActiveMQ Artemis implementation of a JMS ConnectionMetaData. */ public class ActiveMQConnectionMetaData implements ConnectionMetaData { + public static final String DEFAULT_PROP_FILE_NAME = "jms-version.properties"; + + private static final String JMS_VERSION_NAME; + private static final int JMS_MAJOR_VERSION; + private static final int JMS_MINOR_VERSION; + static { + Properties versionProps = new Properties(); + try (InputStream in = ActiveMQConnectionMetaData.class.getClassLoader().getResourceAsStream(DEFAULT_PROP_FILE_NAME)) { + if (in != null) { + versionProps.load(in); + } + } catch (IOException e) { + } + JMS_VERSION_NAME = versionProps.getProperty("activemq.version.implementation.versionName", "2.0"); + JMS_MAJOR_VERSION = Integer.valueOf(versionProps.getProperty("activemq.version.implementation.majorVersion", "2")); + JMS_MINOR_VERSION = Integer.valueOf(versionProps.getProperty("activemq.version.implementation.minorVersion", "0")); + } + // Constants ----------------------------------------------------- private static final String ACTIVEMQ = "ActiveMQ"; @@ -50,17 +72,17 @@ public class ActiveMQConnectionMetaData implements ConnectionMetaData { @Override public String getJMSVersion() throws JMSException { - return "2.0"; + return JMS_VERSION_NAME; } @Override public int getJMSMajorVersion() throws JMSException { - return 2; + return JMS_MAJOR_VERSION; } @Override public int getJMSMinorVersion() throws JMSException { - return 0; + return JMS_MINOR_VERSION; } @Override diff --git a/artemis-jms-client/src/main/resources/jms-version.properties b/artemis-jms-client/src/main/resources/jms-version.properties new file mode 100644 index 0000000000..bc97a63a2d --- /dev/null +++ b/artemis-jms-client/src/main/resources/jms-version.properties @@ -0,0 +1,19 @@ +# 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. +# + +activemq.version.implementation.versionName=2.0 +activemq.version.implementation.majorVersion=2 +activemq.version.implementation.minorVersion=0 \ No newline at end of file diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionMetaData.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionMetaData.java index 901ecf4d8c..5c8abb7c40 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionMetaData.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionMetaData.java @@ -16,8 +16,11 @@ */ package org.apache.activemq.artemis.ra; +import java.io.IOException; +import java.io.InputStream; import javax.jms.ConnectionMetaData; import java.util.Enumeration; +import java.util.Properties; import java.util.Vector; /** @@ -25,6 +28,24 @@ import java.util.Vector; */ public class ActiveMQRAConnectionMetaData implements ConnectionMetaData { + public static final String DEFAULT_PROP_FILE_NAME = "jms-version.properties"; + + private static final String JMS_VERSION_NAME; + private static final int JMS_MAJOR_VERSION; + private static final int JMS_MINOR_VERSION; + static { + Properties versionProps = new Properties(); + try (InputStream in = ActiveMQRAConnectionMetaData.class.getClassLoader().getResourceAsStream(DEFAULT_PROP_FILE_NAME)) { + if (in != null) { + versionProps.load(in); + } + } catch (IOException e) { + } + JMS_VERSION_NAME = versionProps.getProperty("activemq.version.implementation.versionName", "2.0"); + JMS_MAJOR_VERSION = Integer.valueOf(versionProps.getProperty("activemq.version.implementation.majorVersion", "2")); + JMS_MINOR_VERSION = Integer.valueOf(versionProps.getProperty("activemq.version.implementation.minorVersion", "0")); + } + /** * Constructor */ @@ -44,8 +65,7 @@ public class ActiveMQRAConnectionMetaData implements ConnectionMetaData { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getJMSVersion()"); } - - return "2.0"; + return JMS_VERSION_NAME; } /** @@ -58,8 +78,7 @@ public class ActiveMQRAConnectionMetaData implements ConnectionMetaData { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getJMSMajorVersion()"); } - - return 2; + return JMS_MAJOR_VERSION; } /** @@ -72,8 +91,7 @@ public class ActiveMQRAConnectionMetaData implements ConnectionMetaData { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getJMSMinorVersion()"); } - - return 0; + return JMS_MINOR_VERSION; } /** diff --git a/artemis-ra/src/main/resources/jms-version.properties b/artemis-ra/src/main/resources/jms-version.properties new file mode 100644 index 0000000000..dd6a10f4ee --- /dev/null +++ b/artemis-ra/src/main/resources/jms-version.properties @@ -0,0 +1,19 @@ +# 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. +# + +activemq.version.implementation.versionName=2.0 +activemq.version.implementation.majorVersion=2 +activemq.version.implementation.minorVersion=0 diff --git a/pom.xml b/pom.xml index 2644a3d9c5..76e8700e78 100644 --- a/pom.xml +++ b/pom.xml @@ -47,11 +47,15 @@ artemis-jms-client artemis-jms-client-all artemis-jms-client-osgi + artemis-jakarta-client artemis-jms-server + artemis-jakarta-server artemis-journal artemis-ra + artemis-jakarta-ra artemis-rest artemis-service-extensions + artemis-jakarta-service-extensions artemis-jdbc-store artemis-maven-plugin artemis-server-osgi @@ -119,6 +123,12 @@ 1.0.1 1.1.1 1.0-alpha-2 + 2.0.0 + 2.0.0 + 4.0.0 + 2.0.0 + 2.0.0 + 3.0.0 2.4.0.Final 2.0.0.Beta3 1.7.0 @@ -130,12 +140,14 @@ 1.6.1 2.1 2.22.2 + + 1.0.5.Final 2.5.10 3.9.4 - 1.4.3 + 6.1.0 5.1.7.RELEASE ${project.version} @@ -442,7 +454,42 @@ ${geronimo.jms.2.spec.version} - + + jakarta.jms + jakarta.jms-api + ${jakarta.jms-api.version} + + + + jakarta.transaction + jakarta.transaction-api + ${jakarta.transaction-api.version} + + + + jakarta.json + jakarta.json-api + ${jakarta.json-api.version} + + + + jakarta.ejb + jakarta.ejb-api + ${jakarta.ejb-api.version} + + + + jakarta.annotation + jakarta.annotation-api + ${jakarta.annotation-api.version} + + + + jakarta.resource + jakarta.resource-api + ${jakarta.resource-api.version} + + commons-collections commons-collections @@ -1503,6 +1550,11 @@ maven-deploy-plugin 2.7 + + org.wildfly.extras.batavia + transformer-tools-mvn + ${version.batavia} + true @@ -1815,8 +1867,6 @@ - - diff --git a/tests/compatibility-tests/pom.xml b/tests/compatibility-tests/pom.xml index e3fb14460c..813e0a225e 100644 --- a/tests/compatibility-tests/pom.xml +++ b/tests/compatibility-tests/pom.xml @@ -334,6 +334,34 @@ ARTEMIS-SNAPSHOT + + + jakartaee + compile + + dependency-scan + + + + org.apache.activemq:artemis-core-client:${project.version} + org.apache.activemq:artemis-commons:${project.version} + org.apache.activemq:artemis-selector:${project.version} + org.apache.activemq:artemis-server:${project.version} + org.apache.activemq:artemis-journal:${project.version} + org.apache.activemq:artemis-hornetq-protocol:${project.version} + org.codehaus.groovy:groovy-all:pom:${groovy.version} + + + jakarta.json:jakarta.json-api:${jakarta.json-api.version} + jakarta.transaction:jakarta.transaction-api:${jakarta.transaction-api.version} + org.apache.activemq:artemis-jakarta-server:${project.version} + org.apache.activemq:artemis-jakarta-client:${project.version} + org.apache.activemq:artemis-jakarta-service-extensions:${project.version} + jakarta.jms:jakarta.jms-api:${jakarta.jms-api.version} + org.apache.activemq.tests:compatibility-tests:${project.version} + + ARTEMIS-JAKARTAEE + compile @@ -639,6 +667,10 @@ ARTEMIS-270 ${ARTEMIS-270} + + ARTEMIS-JAKARTAEE + ${ARTEMIS-JAKARTAEE} + ${skipCompatibilityTests} ${modular.jdk.surefire.arg} -Djgroups.bind_addr=::1 ${activemq-surefire-argline} diff --git a/tests/compatibility-tests/src/main/java/org/apache/activemq/artemis/tests/compatibility/GroovyRun.java b/tests/compatibility-tests/src/main/java/org/apache/activemq/artemis/tests/compatibility/GroovyRun.java index 345f85a6f0..2ccfa5f263 100644 --- a/tests/compatibility-tests/src/main/java/org/apache/activemq/artemis/tests/compatibility/GroovyRun.java +++ b/tests/compatibility-tests/src/main/java/org/apache/activemq/artemis/tests/compatibility/GroovyRun.java @@ -28,6 +28,7 @@ import groovy.lang.GroovyShell; public class GroovyRun { public static final String SNAPSHOT = "ARTEMIS-SNAPSHOT"; + public static final String JAKARTAEE = "ARTEMIS-JAKARTAEE"; public static final String ONE_FIVE = "ARTEMIS-155"; public static final String ONE_FOUR = "ARTEMIS-140"; public static final String TWO_ZERO = "ARTEMIS-200"; diff --git a/tests/compatibility-tests/src/main/resources/jakartaReplyToQueue/receiveMessages.groovy b/tests/compatibility-tests/src/main/resources/jakartaReplyToQueue/receiveMessages.groovy new file mode 100644 index 0000000000..122f462acb --- /dev/null +++ b/tests/compatibility-tests/src/main/resources/jakartaReplyToQueue/receiveMessages.groovy @@ -0,0 +1,53 @@ +package jmsReplyToQueue + +import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory +import org.apache.activemq.artemis.tests.compatibility.GroovyRun + +import jakarta.jms.* + +/* + * 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. + */ + +ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616"); +try { + cf.setEnable1xPrefixes(true); +} catch (Throwable totallyIgnored) { + // older versions will not have this method, dont even bother about seeing the stack trace or exception +} +Connection connection = cf.createConnection(); +Session session = connection.createSession(true, Session.SESSION_TRANSACTED); +Queue myQueue = session.createQueue("myQueue"); +MessageConsumer queueConsumer = session.createConsumer(myQueue); +consumerCreated.countDown(); +connection.start() + +Message message = queueConsumer.receive(5000); +GroovyRun.assertNotNull(message) +session.commit(); +queueConsumer.close(); + +MessageProducer producer = session.createProducer(message.getJMSReplyTo()); +message = session.createMessage(); +producer.send(message); +session.commit(); + +connection.close(); + +latch.countDown(); + + + diff --git a/tests/compatibility-tests/src/main/resources/jakartaReplyToQueue/sendMessagesAddress.groovy b/tests/compatibility-tests/src/main/resources/jakartaReplyToQueue/sendMessagesAddress.groovy new file mode 100644 index 0000000000..5e69b16c48 --- /dev/null +++ b/tests/compatibility-tests/src/main/resources/jakartaReplyToQueue/sendMessagesAddress.groovy @@ -0,0 +1,52 @@ +package jmsReplyToQueue + +import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory +import org.apache.activemq.artemis.tests.compatibility.GroovyRun + +import jakarta.jms.* + +/* + * 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. + */ + +ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616"); +try { + cf.setEnable1xPrefixes(true); +} catch (Throwable totallyIgnored) { + // older versions will not have this method, dont even bother about seeing the stack trace or exception +} +Connection connection = cf.createConnection(); +Session session = connection.createSession(true, Session.SESSION_TRANSACTED); +connection.start(); + +Queue myQueue = session.createQueue("myQueue"); +Queue temporaryQueue = session.createQueue("myTemporaryQueue"); +MessageConsumer consumer = session.createConsumer(temporaryQueue); + +MessageProducer queueProducer = session.createProducer(myQueue) + +queueProducer.setDeliveryMode(DeliveryMode.PERSISTENT); +Message message = session.createMessage(); +message.setJMSReplyTo(temporaryQueue); +queueProducer.send(message); +session.commit(); + +message = consumer.receive(10000); +GroovyRun.assertNotNull(message); +session.commit(); + +connection.close(); +senderLatch.countDown(); \ No newline at end of file diff --git a/tests/compatibility-tests/src/main/resources/jakartaReplyToTempQueue/receiveMessages.groovy b/tests/compatibility-tests/src/main/resources/jakartaReplyToTempQueue/receiveMessages.groovy new file mode 100644 index 0000000000..ee08470e07 --- /dev/null +++ b/tests/compatibility-tests/src/main/resources/jakartaReplyToTempQueue/receiveMessages.groovy @@ -0,0 +1,53 @@ +package jmsReplyToTempQueue + +import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory +import org.apache.activemq.artemis.tests.compatibility.GroovyRun + +import jakarta.jms.* + +/* + * 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. + */ + +ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616"); +try { + cf.setEnable1xPrefixes(true); +} catch (Throwable totallyIgnored) { + // older versions will not have this method, dont even bother about seeing the stack trace or exception +} +Connection connection = cf.createConnection(); +Session session = connection.createSession(true, Session.SESSION_TRANSACTED); +Queue myQueue = session.createQueue("myQueue"); +MessageConsumer queueConsumer = session.createConsumer(myQueue); +consumerCreated.countDown(); +connection.start() + +Message message = queueConsumer.receive(5000); +GroovyRun.assertNotNull(message) +session.commit(); +queueConsumer.close(); + +MessageProducer producer = session.createProducer(message.getJMSReplyTo()); +message = session.createMessage(); +producer.send(message); +session.commit(); + +connection.close(); + +latch.countDown(); + + + diff --git a/tests/compatibility-tests/src/main/resources/jakartaReplyToTempQueue/sendMessagesAddress.groovy b/tests/compatibility-tests/src/main/resources/jakartaReplyToTempQueue/sendMessagesAddress.groovy new file mode 100644 index 0000000000..3c8f4a13f1 --- /dev/null +++ b/tests/compatibility-tests/src/main/resources/jakartaReplyToTempQueue/sendMessagesAddress.groovy @@ -0,0 +1,52 @@ +package jmsReplyToTempQueue + +import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory +import org.apache.activemq.artemis.tests.compatibility.GroovyRun + +import jakarta.jms.* + +/* + * 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. + */ + +ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616"); +try { + cf.setEnable1xPrefixes(true); +} catch (Throwable totallyIgnored) { + // older versions will not have this method, dont even bother about seeing the stack trace or exception +} +Connection connection = cf.createConnection(); +Session session = connection.createSession(true, Session.SESSION_TRANSACTED); +connection.start(); + +Queue myQueue = session.createQueue("myQueue"); +Queue temporaryQueue = session.createTemporaryQueue(); +MessageConsumer consumer = session.createConsumer(temporaryQueue); + +MessageProducer queueProducer = session.createProducer(myQueue) + +queueProducer.setDeliveryMode(DeliveryMode.PERSISTENT); +Message message = session.createMessage(); +message.setJMSReplyTo(temporaryQueue); +queueProducer.send(message); +session.commit(); + +message = consumer.receive(10000); +GroovyRun.assertNotNull(message); +session.commit(); + +connection.close(); +senderLatch.countDown(); \ No newline at end of file diff --git a/tests/compatibility-tests/src/main/resources/jakartaReplyToTempTopic/receiveMessages.groovy b/tests/compatibility-tests/src/main/resources/jakartaReplyToTempTopic/receiveMessages.groovy new file mode 100644 index 0000000000..0fb72d9f86 --- /dev/null +++ b/tests/compatibility-tests/src/main/resources/jakartaReplyToTempTopic/receiveMessages.groovy @@ -0,0 +1,59 @@ +package jmsReplyToTempTopic + +import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory +import org.apache.activemq.artemis.tests.compatibility.GroovyRun + +import jakarta.jms.* + +/* + * 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. + */ + +ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616"); +try { + cf.setEnable1xPrefixes(true); +} catch (Throwable totallyIgnored) { + // older versions will not have this method, dont even bother about seeing the stack trace or exception +} +Connection connection = cf.createConnection(); +Session session = connection.createSession(true, Session.SESSION_TRANSACTED); +Queue myQueue = session.createQueue("myQueue"); + +GroovyRun.assertEquals("myQueue", myQueue.getQueueName()); + +MessageConsumer queueConsumer = session.createConsumer(myQueue); +consumerCreated.countDown(); +connection.start() + +for (int i = 0; i < 5; i++) { + Message message = queueConsumer.receive(5000); + GroovyRun.assertNotNull(message) + + GroovyRun.assertEquals("myQueue", ((Queue)message.getJMSDestination()).getQueueName()); + + MessageProducer producer = session.createProducer(message.getJMSReplyTo()); + message = session.createMessage(); + producer.send(message); +} +queueConsumer.close(); +session.commit(); + +connection.close(); + +latch.countDown(); + + + diff --git a/tests/compatibility-tests/src/main/resources/jakartaReplyToTempTopic/sendMessagesAddress.groovy b/tests/compatibility-tests/src/main/resources/jakartaReplyToTempTopic/sendMessagesAddress.groovy new file mode 100644 index 0000000000..0eb5ba1320 --- /dev/null +++ b/tests/compatibility-tests/src/main/resources/jakartaReplyToTempTopic/sendMessagesAddress.groovy @@ -0,0 +1,68 @@ +package jmsReplyToTempTopic + +import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory +import org.apache.activemq.artemis.tests.compatibility.GroovyRun + +import jakarta.jms.* + +/* + * 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. + */ + +ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616"); +try { + cf.setEnable1xPrefixes(true); +} catch (Throwable totallyIgnored) { + // older versions will not have this method, dont even bother about seeing the stack trace or exception +} +Connection connection = cf.createConnection(); +Session session = connection.createSession(true, Session.SESSION_TRANSACTED); +connection.start(); + +Queue myQueue = session.createQueue("myQueue"); + +GroovyRun.assertEquals("myQueue", myQueue.getQueueName()); + +TemporaryTopic replyTopic = session.createTemporaryTopic(); +MessageConsumer consumer = session.createConsumer(replyTopic); + + +MessageProducer queueProducer = session.createProducer(myQueue) + +queueProducer.setDeliveryMode(DeliveryMode.PERSISTENT); +sendMessage(session.createTextMessage("hello"), replyTopic, myQueue, queueProducer); +sendMessage(session.createMapMessage(), replyTopic, myQueue, queueProducer); +sendMessage(session.createObjectMessage(), replyTopic, myQueue, queueProducer); +sendMessage(session.createStreamMessage(), replyTopic, myQueue, queueProducer); +sendMessage(session.createMessage(), replyTopic, myQueue, queueProducer); +session.commit(); + + +for (int i = 0; i < 5; i++) { + message = consumer.receive(10000); + GroovyRun.assertNotNull(message); +} +GroovyRun.assertNull(consumer.receiveNoWait()); +session.commit(); + +connection.close(); +senderLatch.countDown(); + + +void sendMessage(Message message, TemporaryTopic replyTopic, Queue myQueue, MessageProducer queueProducer) { + message.setJMSReplyTo(replyTopic); + queueProducer.send(message); +} \ No newline at end of file diff --git a/tests/compatibility-tests/src/main/resources/jakartaReplyToTopic/receiveMessages.groovy b/tests/compatibility-tests/src/main/resources/jakartaReplyToTopic/receiveMessages.groovy new file mode 100644 index 0000000000..8c77f2742a --- /dev/null +++ b/tests/compatibility-tests/src/main/resources/jakartaReplyToTopic/receiveMessages.groovy @@ -0,0 +1,53 @@ +package jmsReplyToTopic + +import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory +import org.apache.activemq.artemis.tests.compatibility.GroovyRun + +import jakarta.jms.* + +/* + * 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. + */ + +ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616"); +try { + cf.setEnable1xPrefixes(true); +} catch (Throwable totallyIgnored) { + // older versions will not have this method, dont even bother about seeing the stack trace or exception +} +Connection connection = cf.createConnection(); +Session session = connection.createSession(true, Session.SESSION_TRANSACTED); +Queue myQueue = session.createQueue("myQueue"); +MessageConsumer queueConsumer = session.createConsumer(myQueue); +consumerCreated.countDown(); +connection.start() + +Message message = queueConsumer.receive(5000); +GroovyRun.assertNotNull(message) +session.commit(); +queueConsumer.close(); + +MessageProducer producer = session.createProducer(message.getJMSReplyTo()); +message = session.createMessage(); +producer.send(message); +session.commit(); + +connection.close(); + +latch.countDown(); + + + diff --git a/tests/compatibility-tests/src/main/resources/jakartaReplyToTopic/sendMessagesAddress.groovy b/tests/compatibility-tests/src/main/resources/jakartaReplyToTopic/sendMessagesAddress.groovy new file mode 100644 index 0000000000..f65a883c60 --- /dev/null +++ b/tests/compatibility-tests/src/main/resources/jakartaReplyToTopic/sendMessagesAddress.groovy @@ -0,0 +1,52 @@ +package jmsReplyToTopic + +import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory +import org.apache.activemq.artemis.tests.compatibility.GroovyRun + +import jakarta.jms.* + +/* + * 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. + */ + +ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616"); +try { + cf.setEnable1xPrefixes(true); +} catch (Throwable totallyIgnored) { + // older versions will not have this method, dont even bother about seeing the stack trace or exception +} +Connection connection = cf.createConnection(); +Session session = connection.createSession(true, Session.SESSION_TRANSACTED); +connection.start(); + +Queue myQueue = session.createQueue("myQueue"); +Topic replyTopic = session.createTopic("myReplyTopic"); +MessageConsumer consumer = session.createConsumer(replyTopic); + +MessageProducer queueProducer = session.createProducer(myQueue) + +queueProducer.setDeliveryMode(DeliveryMode.PERSISTENT); +Message message = session.createMessage(); +message.setJMSReplyTo(replyTopic); +queueProducer.send(message); +session.commit(); + +message = consumer.receive(10000); +GroovyRun.assertNotNull(message); +session.commit(); + +connection.close(); +senderLatch.countDown(); \ No newline at end of file diff --git a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/JmsReplyToQueueTest.java b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/JmsReplyToQueueTest.java index 393054490c..7b6047ecd7 100644 --- a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/JmsReplyToQueueTest.java +++ b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/JmsReplyToQueueTest.java @@ -16,6 +16,8 @@ */ package org.apache.activemq.artemis.tests.compatibility; +import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.JAKARTAEE; + import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -44,6 +46,12 @@ public class JmsReplyToQueueTest extends VersionedBase { combinations.add(new Object[]{SNAPSHOT, ONE_FIVE, SNAPSHOT}); combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, ONE_FIVE}); combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, SNAPSHOT}); + combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, JAKARTAEE}); + combinations.add(new Object[]{JAKARTAEE, SNAPSHOT, SNAPSHOT}); + combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, SNAPSHOT}); + combinations.add(new Object[]{JAKARTAEE, SNAPSHOT, JAKARTAEE}); + combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, ONE_FIVE}); + combinations.add(new Object[]{JAKARTAEE, ONE_FIVE, JAKARTAEE}); return combinations; } @@ -78,7 +86,11 @@ public class JmsReplyToQueueTest extends VersionedBase { @Override public void run() { try { - evaluate(receiverClassloader, "jmsReplyToQueue/receiveMessages.groovy", receiver); + if (JAKARTAEE.equals(receiver)) { + evaluate(receiverClassloader, "jakartaReplyToQueue/receiveMessages.groovy", receiver); + } else { + evaluate(receiverClassloader, "jmsReplyToQueue/receiveMessages.groovy", receiver); + } } catch (Throwable e) { e.printStackTrace(); errors.incrementAndGet(); @@ -94,7 +106,11 @@ public class JmsReplyToQueueTest extends VersionedBase { @Override public void run() { try { - evaluate(senderClassloader, "jmsReplyToQueue/sendMessagesAddress.groovy", sender); + if (JAKARTAEE.equals(sender)) { + evaluate(senderClassloader, "jakartaReplyToQueue/sendMessagesAddress.groovy", sender); + } else { + evaluate(senderClassloader, "jmsReplyToQueue/sendMessagesAddress.groovy", sender); + } } catch (Throwable e) { e.printStackTrace(); errors.incrementAndGet(); diff --git a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/JmsReplyToTempQueueTest.java b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/JmsReplyToTempQueueTest.java index 3bb5cc0a1c..93b8ca1cab 100644 --- a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/JmsReplyToTempQueueTest.java +++ b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/JmsReplyToTempQueueTest.java @@ -16,6 +16,8 @@ */ package org.apache.activemq.artemis.tests.compatibility; +import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.JAKARTAEE; + import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -44,6 +46,11 @@ public class JmsReplyToTempQueueTest extends VersionedBase { combinations.add(new Object[]{SNAPSHOT, ONE_FIVE, SNAPSHOT}); combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, ONE_FIVE}); combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, SNAPSHOT}); + combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, JAKARTAEE}); + combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, SNAPSHOT}); + combinations.add(new Object[]{JAKARTAEE, SNAPSHOT, JAKARTAEE}); + combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, ONE_FIVE}); + combinations.add(new Object[]{JAKARTAEE, ONE_FIVE, JAKARTAEE}); return combinations; } @@ -78,7 +85,11 @@ public class JmsReplyToTempQueueTest extends VersionedBase { @Override public void run() { try { - evaluate(receiverClassloader, "jmsReplyToTempQueue/receiveMessages.groovy", receiver); + if (JAKARTAEE.equals(receiver)) { + evaluate(receiverClassloader, "jakartaReplyToTempQueue/receiveMessages.groovy", receiver); + } else { + evaluate(receiverClassloader, "jmsReplyToTempQueue/receiveMessages.groovy", receiver); + } } catch (Throwable e) { e.printStackTrace(); errors.incrementAndGet(); @@ -94,7 +105,11 @@ public class JmsReplyToTempQueueTest extends VersionedBase { @Override public void run() { try { - evaluate(senderClassloader, "jmsReplyToTempQueue/sendMessagesAddress.groovy", sender); + if (JAKARTAEE.equals(sender)) { + evaluate(senderClassloader, "jakartaReplyToTempQueue/sendMessagesAddress.groovy", sender); + } else { + evaluate(senderClassloader, "jmsReplyToTempQueue/sendMessagesAddress.groovy", sender); + } } catch (Throwable e) { e.printStackTrace(); errors.incrementAndGet(); diff --git a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/JmsReplyToTempTopicTest.java b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/JmsReplyToTempTopicTest.java index 1efa3de5d9..7cbec8db0a 100644 --- a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/JmsReplyToTempTopicTest.java +++ b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/JmsReplyToTempTopicTest.java @@ -16,6 +16,8 @@ */ package org.apache.activemq.artemis.tests.compatibility; +import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.JAKARTAEE; + import org.apache.activemq.artemis.tests.compatibility.base.VersionedBase; import org.apache.activemq.artemis.utils.FileUtil; import org.junit.After; @@ -44,6 +46,11 @@ public class JmsReplyToTempTopicTest extends VersionedBase { combinations.add(new Object[]{SNAPSHOT, ONE_FIVE, SNAPSHOT}); combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, ONE_FIVE}); combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, SNAPSHOT}); + combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, JAKARTAEE}); + combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, SNAPSHOT}); + combinations.add(new Object[]{JAKARTAEE, SNAPSHOT, JAKARTAEE}); + combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, ONE_FIVE}); + combinations.add(new Object[]{JAKARTAEE, ONE_FIVE, JAKARTAEE}); return combinations; } @@ -78,7 +85,11 @@ public class JmsReplyToTempTopicTest extends VersionedBase { @Override public void run() { try { - evaluate(receiverClassloader, "jmsReplyToTempTopic/receiveMessages.groovy", receiver); + if (JAKARTAEE.equals(receiver)) { + evaluate(receiverClassloader, "jakartaReplyToTempTopic/receiveMessages.groovy", receiver); + } else { + evaluate(receiverClassloader, "jmsReplyToTempTopic/receiveMessages.groovy", receiver); + } } catch (Throwable e) { e.printStackTrace(); errors.incrementAndGet(); @@ -94,7 +105,11 @@ public class JmsReplyToTempTopicTest extends VersionedBase { @Override public void run() { try { - evaluate(senderClassloader, "jmsReplyToTempTopic/sendMessagesAddress.groovy", sender); + if (JAKARTAEE.equals(sender)) { + evaluate(senderClassloader, "jakartaReplyToTempTopic/sendMessagesAddress.groovy", sender); + } else { + evaluate(senderClassloader, "jmsReplyToTempTopic/sendMessagesAddress.groovy", sender); + } } catch (Throwable e) { e.printStackTrace(); errors.incrementAndGet(); diff --git a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/JmsReplyToTopicTest.java b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/JmsReplyToTopicTest.java index 3d2406b7ae..a20bc06a9e 100644 --- a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/JmsReplyToTopicTest.java +++ b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/JmsReplyToTopicTest.java @@ -16,6 +16,8 @@ */ package org.apache.activemq.artemis.tests.compatibility; +import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.JAKARTAEE; + import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -44,6 +46,11 @@ public class JmsReplyToTopicTest extends VersionedBase { combinations.add(new Object[]{SNAPSHOT, ONE_FIVE, SNAPSHOT}); combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, ONE_FIVE}); combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, SNAPSHOT}); + combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, JAKARTAEE}); + combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, SNAPSHOT}); + combinations.add(new Object[]{JAKARTAEE, SNAPSHOT, JAKARTAEE}); + combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, ONE_FIVE}); + combinations.add(new Object[]{JAKARTAEE, ONE_FIVE, JAKARTAEE}); return combinations; } @@ -78,7 +85,11 @@ public class JmsReplyToTopicTest extends VersionedBase { @Override public void run() { try { - evaluate(receiverClassloader, "jmsReplyToTopic/receiveMessages.groovy", receiver); + if (JAKARTAEE.equals(receiver)) { + evaluate(receiverClassloader, "jakartaReplyToTopic/receiveMessages.groovy", receiver); + } else { + evaluate(receiverClassloader, "jmsReplyToTopic/receiveMessages.groovy", receiver); + } } catch (Throwable e) { e.printStackTrace(); errors.incrementAndGet(); @@ -94,7 +105,11 @@ public class JmsReplyToTopicTest extends VersionedBase { @Override public void run() { try { - evaluate(senderClassloader, "jmsReplyToTopic/sendMessagesAddress.groovy", sender); + if (JAKARTAEE.equals(sender)) { + evaluate(senderClassloader, "jakartaReplyToTopic/sendMessagesAddress.groovy", sender); + } else { + evaluate(senderClassloader, "jmsReplyToTopic/sendMessagesAddress.groovy", sender); + } } catch (Throwable e) { e.printStackTrace(); errors.incrementAndGet();