Skip to content
Open
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
Expand Up @@ -1362,7 +1362,7 @@ public QueueSession createQueueSession(boolean transacted, int acknowledgeMode)
*/
public void checkClientIDWasManuallySpecified() throws JMSException {
if (!userSpecifiedClientID) {
throw new JMSException("You cannot create a durable subscriber without specifying a unique clientID on a Connection");
throw new IllegalStateException("You cannot create a durable subscriber without specifying a unique clientID on a Connection");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private ActiveMQConnectionMetaData() {
*/
@Override
public String getJMSVersion() {
return "1.1";
return "3.1";
}

/**
Expand All @@ -83,7 +83,7 @@ public String getJMSVersion() {
*/
@Override
public int getJMSMajorVersion() {
return 1;
return 3;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import jakarta.jms.Destination;
import jakarta.jms.ExceptionListener;
import jakarta.jms.IllegalStateRuntimeException;
import jakarta.jms.InvalidDestinationRuntimeException;
import jakarta.jms.JMSConsumer;
import jakarta.jms.JMSContext;
import jakarta.jms.JMSException;
Expand Down Expand Up @@ -442,21 +443,37 @@ public JMSConsumer createDurableConsumer(Topic topic, String name, String messag

@Override
public JMSConsumer createSharedDurableConsumer(Topic topic, String name) {
checkContextState();
if (topic == null) {
throw new InvalidDestinationRuntimeException("Topic cannot be null");
}
throw new UnsupportedOperationException("createSharedDurableConsumer(topic, name) is not supported");
}

@Override
public JMSConsumer createSharedDurableConsumer(Topic topic, String name, String messageSelector) {
throw new UnsupportedOperationException("createDurableConsumer(topic, name, messageSelector) is not supported");
checkContextState();
if (topic == null) {
throw new InvalidDestinationRuntimeException("Topic cannot be null");
}
throw new UnsupportedOperationException("createSharedDurableConsumer(topic, name, messageSelector) is not supported");
}

@Override
public JMSConsumer createSharedConsumer(Topic topic, String sharedSubscriptionName) {
checkContextState();
if (topic == null) {
throw new InvalidDestinationRuntimeException("Topic cannot be null");
}
throw new UnsupportedOperationException("createSharedConsumer(topic, sharedSubscriptionName) is not supported");
}

@Override
public JMSConsumer createSharedConsumer(Topic topic, String sharedSubscriptionName, String messageSelector) {
checkContextState();
if (topic == null) {
throw new InvalidDestinationRuntimeException("Topic cannot be null");
}
throw new UnsupportedOperationException("createSharedConsumer(topic, sharedSubscriptionName, messageSelector) is not supported");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public void send(Destination destination, Message message, int deliveryMode, int
checkClosed();
if (destination == null) {
if (info.getDestination() == null) {
throw new UnsupportedOperationException("A destination must be specified.");
throw new InvalidDestinationException("A destination must be specified.");
}
throw new InvalidDestinationException("Don't understand null destinations");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public class ActiveMQProducer implements JMSProducer {

@Override
public JMSProducer send(Destination destination, Message message) {
if (message == null) {
throw new MessageFormatRuntimeException("Message must not be null");
}
try {
if(this.correlationId != null) {
message.setJMSCorrelationID(this.correlationId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import jakarta.jms.TopicSubscriber;
import jakarta.jms.TransactionRolledBackException;

import org.apache.activemq.selector.SelectorParser;
import org.apache.activemq.blob.BlobDownloader;
import org.apache.activemq.blob.BlobTransferPolicy;
import org.apache.activemq.blob.BlobUploader;
Expand Down Expand Up @@ -1386,11 +1387,22 @@ public Topic createTopic(String topicName) throws JMSException {

@Override
public MessageConsumer createSharedConsumer(Topic topic, String sharedSubscriptionName) throws JMSException {
checkClosed();
if (topic == null) {
throw new InvalidDestinationException("Topic cannot be null");
}
throw new UnsupportedOperationException("createSharedConsumer(Topic, sharedSubscriptionName) is not supported");
}

@Override
public MessageConsumer createSharedConsumer(Topic topic, String sharedSubscriptionName, String messageSelector) throws JMSException {
checkClosed();
if (topic == null) {
throw new InvalidDestinationException("Topic cannot be null");
}
if (messageSelector != null && !messageSelector.trim().isEmpty()) {
SelectorParser.parse(messageSelector);
}
throw new UnsupportedOperationException("createSharedConsumer(Topic, sharedSubscriptionName, messageSelector) is not supported");
}

Expand All @@ -1408,11 +1420,22 @@ public MessageConsumer createDurableConsumer(Topic topic, String name, String me

@Override
public MessageConsumer createSharedDurableConsumer(Topic topic, String name) throws JMSException {
checkClosed();
if (topic == null) {
throw new InvalidDestinationException("Topic cannot be null");
}
throw new UnsupportedOperationException("createSharedDurableConsumer(Topic, name) is not supported");
}

@Override
public MessageConsumer createSharedDurableConsumer(Topic topic, String name, String messageSelector) throws JMSException {
checkClosed();
if (topic == null) {
throw new InvalidDestinationException("Topic cannot be null");
}
if (messageSelector != null && !messageSelector.trim().isEmpty()) {
SelectorParser.parse(messageSelector);
}
throw new UnsupportedOperationException("createSharedDurableConsumer(Topic, name, messageSelector) is not supported");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,7 @@ public boolean propertyExists(String name) throws JMSException {
public Enumeration getPropertyNames() throws JMSException {
try {
Vector<String> result = new Vector<String>(this.getProperties().keySet());
if( getRedeliveryCounter()!=0 ) {
result.add("JMSXDeliveryCount");
}
result.add("JMSXDeliveryCount");
if( getGroupID()!=null ) {
result.add("JMSXGroupID");
}
Expand Down
2 changes: 2 additions & 0 deletions activemq-tooling/activemq-jakarta-messaging-tck/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jakarta-messaging-tck-*.zip
target/
73 changes: 73 additions & 0 deletions activemq-tooling/activemq-jakarta-messaging-tck/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
////
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.
////
= Jakarta Messaging TCK 3.1.0 Runner
:toc:

This module runs the official https://jakarta.ee/specifications/messaging/3.1/[Jakarta Messaging 3.1.0 TCK] against Apache ActiveMQ using an embedded broker.

== Prerequisites

* **JDK 17 or 21** — the TCK harness does not compile on JDK 25 (`javax.rmi` removed)
* **Apache Ant** — must be on `PATH` (e.g. `apt-get install ant`)
* **curl** and **unzip** — for downloading and extracting the TCK

== How It Works

The module builds a shaded (fat) JAR containing the ActiveMQ broker, client, KahaDB store, and a custom `JNDIInitialContextFactory`.
The `run_tck.sh` script then:

1. Downloads the TCK ZIP from `download.eclipse.org` (cached after first download)
2. Verifies the SHA-256 checksum
3. Extracts and patches the TCK source for JDK 17+ compatibility
4. Builds the TCK test classes with Ant
5. Runs all tests via `ant runclient`

Each forked test JVM starts an embedded ActiveMQ broker over `vm://localhost` (non-persistent, no JMX) through the JNDI factory.

== Build

[source,bash]
----
mvn clean package -pl activemq-tooling/activemq-jakarta-messaging-tck -am -DskipTests
----

== Run the TCK

[source,bash]
----
mvn verify -pl activemq-tooling/activemq-jakarta-messaging-tck -Prun-tck
----

If your default JDK is 25, point to a 17 or 21 installation:

[source,bash]
----
JAVA_HOME=/path/to/jdk17 mvn verify -pl activemq-tooling/activemq-jakarta-messaging-tck -Prun-tck
----

Results are written to `target/tck-report/` and `target/tck-work/`.

== Configuration

`ts.jte`::
TCK environment properties — classpaths, JNDI factory, timeout factor, test execution command.
`jms.home` and `jms.classes` are appended automatically by the script.

`ts.jtx`::
Test exclusion list.
Add entries in the format `com/sun/ts/tests/jms/path/Class#method` to skip known-failing tests.

131 changes: 131 additions & 0 deletions activemq-tooling/activemq-jakarta-messaging-tck/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.tooling</groupId>
<artifactId>activemq-tooling</artifactId>
<version>6.3.0-SNAPSHOT</version>
</parent>

<artifactId>activemq-jakarta-messaging-tck</artifactId>
<packaging>jar</packaging>
<name>ActiveMQ :: Tooling :: Jakarta Messaging TCK Runner</name>
<description>Runs the Jakarta Messaging 3.1.0 TCK against ActiveMQ</description>

<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-client</artifactId>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-kahadb-store</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
<projectName>Apache ActiveMQ</projectName>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>run-tck</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>run-tck</id>
<phase>verify</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>bash</executable>
<workingDirectory>${project.basedir}</workingDirectory>
<arguments>
<argument>run_tck.sh</argument>
<argument>ts.jte</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Loading