Skip to content

Commit 066c8ce

Browse files
brusdevgemmellr
authored andcommitted
ARTEMIS-5995 Remove activemq-broker dependency from integration tests
The integration-tests module currently requires a dependency on the activemq-broker artifact solely because JMSXPathSelectorTest needs the default XPathEvaluator class used by the OpenWire JMS client. This dependency is unnecessary since the actual XPath selector evaluation happens server-side, not client-side.
1 parent ceaa881 commit 066c8ce

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

tests/integration-tests/pom.xml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -369,20 +369,6 @@
369369
<scope>test</scope>
370370
</dependency>
371371

372-
<!-- need this for org.apache.activemq.filter.JAXPXPathEvaluator for Xpath selectors with OpenWire JMS clients-->
373-
<dependency>
374-
<groupId>org.apache.activemq</groupId>
375-
<artifactId>activemq-broker</artifactId>
376-
<version>${activemq5-version}</version>
377-
<scope>test</scope>
378-
<exclusions>
379-
<exclusion>
380-
<groupId>com.fasterxml.jackson.core</groupId>
381-
<artifactId>jackson-databind</artifactId>
382-
</exclusion>
383-
</exclusions>
384-
</dependency>
385-
386372
<dependency>
387373
<groupId>org.codehaus.woodstox</groupId>
388374
<artifactId>woodstox-core-asl</artifactId>

tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSXPathSelectorTest.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import javax.jms.Queue;
2929
import javax.jms.Session;
3030
import javax.jms.TextMessage;
31+
import javax.xml.parsers.DocumentBuilder;
3132
import java.net.URI;
3233

3334
import org.apache.activemq.artemis.api.core.QueueConfiguration;
@@ -36,12 +37,26 @@
3637
import org.apache.activemq.artemis.core.server.ActiveMQServer;
3738
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
3839
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
40+
import org.apache.activemq.filter.XPathExpression;
41+
import org.junit.jupiter.api.BeforeEach;
3942
import org.junit.jupiter.api.Test;
4043

4144
public class JMSXPathSelectorTest extends MultiprotocolJMSClientTestSupport {
4245

4346
private static final String NORMAL_QUEUE_NAME = "NORMAL";
4447

48+
@BeforeEach
49+
@Override
50+
public void setUp() throws Exception {
51+
super.setUp();
52+
53+
// Set dummy XPathEvaluator to avoid activemq-broker dependency.
54+
// OpenWire JMS client initializes it to parse XPATH selectors,
55+
// but the actual evaluation happens server-side.
56+
System.setProperty("org.apache.activemq.XPathEvaluatorClassName",
57+
DummyXPathEvaluator.class.getName());
58+
}
59+
4560
@Override
4661
protected URI getBrokerQpidJMSConnectionURI() {
4762
try {
@@ -154,4 +169,15 @@ private void sendMessage(ConnectionSupplier producerConnectionSupplier, String q
154169
p.send(queue1, message2, deliveryMode, priority, timeToLive);
155170
}
156171
}
172+
173+
protected static class DummyXPathEvaluator implements XPathExpression.XPathEvaluator {
174+
public DummyXPathEvaluator(String xpathExpression, DocumentBuilder builder) {
175+
}
176+
177+
@Override
178+
public boolean evaluate(org.apache.activemq.command.Message message) {
179+
assert false : "DummyXPathEvaluator.evaluate() should never be called";
180+
return false;
181+
}
182+
}
157183
}

0 commit comments

Comments
 (0)