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.
diff --git a/tests/integration-tests/pom.xml b/tests/integration-tests/pom.xml index 03042a5..79873e2 100644 --- a/tests/integration-tests/pom.xml +++ b/tests/integration-tests/pom.xml
@@ -369,20 +369,6 @@ <scope>test</scope> </dependency> - <!-- need this for org.apache.activemq.filter.JAXPXPathEvaluator for Xpath selectors with OpenWire JMS clients--> - <dependency> - <groupId>org.apache.activemq</groupId> - <artifactId>activemq-broker</artifactId> - <version>${activemq5-version}</version> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> <groupId>org.codehaus.woodstox</groupId> <artifactId>woodstox-core-asl</artifactId>
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSXPathSelectorTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSXPathSelectorTest.java index 943d199..0366753 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSXPathSelectorTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSXPathSelectorTest.java
@@ -28,6 +28,7 @@ import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; +import javax.xml.parsers.DocumentBuilder; import java.net.URI; import org.apache.activemq.artemis.api.core.QueueConfiguration; @@ -36,12 +37,26 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; +import org.apache.activemq.filter.XPathExpression; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; public class JMSXPathSelectorTest extends MultiprotocolJMSClientTestSupport { private static final String NORMAL_QUEUE_NAME = "NORMAL"; + @BeforeEach + @Override + public void setUp() throws Exception { + super.setUp(); + + // Set dummy XPathEvaluator to avoid activemq-broker dependency. + // OpenWire JMS client initializes it to parse XPATH selectors, + // but the actual evaluation happens server-side. + System.setProperty("org.apache.activemq.XPathEvaluatorClassName", + DummyXPathEvaluator.class.getName()); + } + @Override protected URI getBrokerQpidJMSConnectionURI() { try { @@ -154,4 +169,15 @@ p.send(queue1, message2, deliveryMode, priority, timeToLive); } } + + protected static class DummyXPathEvaluator implements XPathExpression.XPathEvaluator { + public DummyXPathEvaluator(String xpathExpression, DocumentBuilder builder) { + } + + @Override + public boolean evaluate(org.apache.activemq.command.Message message) { + assert false : "DummyXPathEvaluator.evaluate() should never be called"; + return false; + } + } } \ No newline at end of file