Author: kwall
Date: Tue Jan 17 11:12:36 2017
New Revision: 1779170
URL: http://svn.apache.org/viewvc?rev=1779170&view=rev
Log:
QPID-7609: [System Tests/Integration Tests] Refactor the POMs to avoid the
addition of the JMS 1.1 dependency if testing the Qpid JMS Client
This works against both the released Qpid JMS Client (which has transitive
dependency on JMS 1.1) and the current SNAPSHOT (which has transitive
dependency on JMS 2.0).
Also:
* factored out a foreign message test from JMSPropertiesTest, removing the
compile time JMS 1.1 dependency by using a proxy
Added:
qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/message/ForeignMessageTest.java
Removed:
qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/message/NonQpidObjectMessage.java
Modified:
qpid/java/trunk/joramtests/pom.xml
qpid/java/trunk/perftests/pom.xml
qpid/java/trunk/perftests/src/main/assembly/qpid-perftests-bin.xml
qpid/java/trunk/qpid-perftests-systests/pom.xml
qpid/java/trunk/qpid-systests-parent/pom.xml
qpid/java/trunk/systests/pom.xml
qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java
qpid/java/trunk/tck/pom.xml
Modified: qpid/java/trunk/joramtests/pom.xml
URL:
http://svn.apache.org/viewvc/qpid/java/trunk/joramtests/pom.xml?rev=1779170&r1=1779169&r2=1779170&view=diff
==============================================================================
--- qpid/java/trunk/joramtests/pom.xml (original)
+++ qpid/java/trunk/joramtests/pom.xml Tue Jan 17 11:12:36 2017
@@ -60,12 +60,6 @@
<version>${slf4j-version}</version>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <version>${geronimo-jms-1-1-version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
<groupId>org.fusesource.joram-jms-tests</groupId>
<artifactId>joram-jms-tests</artifactId>
<version>${joram-jms-tests-version}</version>
@@ -170,6 +164,22 @@
</build>
<profiles>
<profile>
+ <id>addJms11IfNecessary</id>
+ <activation>
+ <property>
+ <name>joramtests</name>
+ <value>!qpid-jms-client</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>${geronimo-jms-1-1-version}</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
<id>joram</id>
<activation>
<property>
Modified: qpid/java/trunk/perftests/pom.xml
URL:
http://svn.apache.org/viewvc/qpid/java/trunk/perftests/pom.xml?rev=1779170&r1=1779169&r2=1779170&view=diff
==============================================================================
--- qpid/java/trunk/perftests/pom.xml (original)
+++ qpid/java/trunk/perftests/pom.xml Tue Jan 17 11:12:36 2017
@@ -67,16 +67,6 @@
</properties>
<dependencies>
- <!-- client deps -->
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <version>${geronimo-jms-1-1-version}</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- other deps -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
@@ -206,6 +196,22 @@
</build>
<profiles>
<profile>
+ <id>addJms11IfNecessary</id>
+ <activation>
+ <property>
+ <name>perftests</name>
+ <value>!qpid-jms-client</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>${geronimo-jms-1-1-version}</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
<id>perftests</id>
<activation>
<property>
Modified: qpid/java/trunk/perftests/src/main/assembly/qpid-perftests-bin.xml
URL:
http://svn.apache.org/viewvc/qpid/java/trunk/perftests/src/main/assembly/qpid-perftests-bin.xml?rev=1779170&r1=1779169&r2=1779170&view=diff
==============================================================================
--- qpid/java/trunk/perftests/src/main/assembly/qpid-perftests-bin.xml
(original)
+++ qpid/java/trunk/perftests/src/main/assembly/qpid-perftests-bin.xml Tue Jan
17 11:12:36 2017
@@ -57,7 +57,6 @@
<useProjectArtifact>false</useProjectArtifact>
<scope>provided</scope>
<includes>
- <include>org.apache.geronimo.specs:geronimo-jms_1.1_spec</include>
<include>org.apache.derby:derby</include>
</includes>
</dependencySet>
Modified: qpid/java/trunk/qpid-perftests-systests/pom.xml
URL:
http://svn.apache.org/viewvc/qpid/java/trunk/qpid-perftests-systests/pom.xml?rev=1779170&r1=1779169&r2=1779170&view=diff
==============================================================================
--- qpid/java/trunk/qpid-perftests-systests/pom.xml (original)
+++ qpid/java/trunk/qpid-perftests-systests/pom.xml Tue Jan 17 11:12:36 2017
@@ -53,13 +53,6 @@
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <version>${geronimo-jms-1-1-version}</version>
- <scope>provided</scope>
- </dependency>
-
<!-- other deps -->
<dependency>
Modified: qpid/java/trunk/qpid-systests-parent/pom.xml
URL:
http://svn.apache.org/viewvc/qpid/java/trunk/qpid-systests-parent/pom.xml?rev=1779170&r1=1779169&r2=1779170&view=diff
==============================================================================
--- qpid/java/trunk/qpid-systests-parent/pom.xml (original)
+++ qpid/java/trunk/qpid-systests-parent/pom.xml Tue Jan 17 11:12:36 2017
@@ -234,4 +234,39 @@
</plugins>
</reporting>
+ <profiles>
+ <profile>
+ <id>java-mms.1-0</id>
+ <activation>
+ <property>
+ <name>profile</name>
+ <value>java-mms.1-0</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-jms-client</artifactId>
+ <version>${qpid-jms-client-version}</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <!-- The 0-x client does not have a dependency on the JMS 1.1 spec. Add
it now. -->
+ <id>addJms11IfNecessary</id>
+ <activation>
+ <property>
+ <name>profile</name>
+ <value>!java-mms.1-0</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>${geronimo-jms-1-1-version}</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
</project>
Modified: qpid/java/trunk/systests/pom.xml
URL:
http://svn.apache.org/viewvc/qpid/java/trunk/systests/pom.xml?rev=1779170&r1=1779169&r2=1779170&view=diff
==============================================================================
--- qpid/java/trunk/systests/pom.xml (original)
+++ qpid/java/trunk/systests/pom.xml Tue Jan 17 11:12:36 2017
@@ -37,26 +37,13 @@
<version>${project.version}</version>
</dependency>
- <!-- client deps -->
+ <!-- Many systests have a compile/runtime dependency on qpid-client -->
<dependency>
<groupId>org.apache.qpid</groupId>
<artifactId>qpid-client</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <version>${geronimo-jms-1-1-version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.qpid</groupId>
- <artifactId>qpid-jms-client</artifactId>
- <version>${qpid-jms-client-version}</version>
- </dependency>
-
<!-- jca deps -->
<dependency>
<groupId>org.apache.qpid</groupId>
Added:
qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/message/ForeignMessageTest.java
URL:
http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/message/ForeignMessageTest.java?rev=1779170&view=auto
==============================================================================
---
qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/message/ForeignMessageTest.java
(added)
+++
qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/message/ForeignMessageTest.java
Tue Jan 17 11:12:36 2017
@@ -0,0 +1,118 @@
+/*
+ * 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.qpid.test.unit.message;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.Session;
+
+import com.google.common.reflect.AbstractInvocationHandler;
+import com.google.common.reflect.Reflection;
+
+import org.apache.qpid.test.utils.QpidBrokerTestCase;
+
+
+public class ForeignMessageTest extends QpidBrokerTestCase
+{
+
+ private static final String JMS_CORR_ID = "QPIDID_01";
+ private static final String JMS_TYPE = "test.jms.type";
+ private static final String GROUP = "group";
+ private static final int JMSX_GROUP_SEQ_VALUE = 1;
+
+ /**
+ * Tests that a non-Qpid JMS message (in this case a proxy) can be sent
and received.
+ */
+ public void testSendForeignMessage() throws Exception
+ {
+ final Connection con = getConnection();
+ final Session session = con.createSession(true,
Session.SESSION_TRANSACTED);
+ Queue queue = createTestQueue(session);
+ Destination replyTo = createTestQueue(session, "my.replyto");
+
+ MessageConsumer consumer = session.createConsumer(queue);
+
+ final MessageProducer producer = session.createProducer(queue);
+
+ // create a 'foreign' JMS message using proxy
+ ObjectMessage sentMsg =
getForeignObjectMessage(session.createObjectMessage());
+
+ sentMsg.setJMSCorrelationID(JMS_CORR_ID);
+ sentMsg.setJMSType(JMS_TYPE);
+ sentMsg.setStringProperty("JMSXGroupID", GROUP);
+ sentMsg.setIntProperty("JMSXGroupSeq", JMSX_GROUP_SEQ_VALUE);
+ sentMsg.setJMSReplyTo(replyTo);
+ Serializable payload = UUID.randomUUID();
+ sentMsg.setObject(payload);
+
+ // send it
+ producer.send(sentMsg);
+ String sentMessageId = sentMsg.getJMSMessageID();
+ session.commit();
+
+ con.start();
+
+ // get message and check JMS properties
+ ObjectMessage rm = (ObjectMessage)
consumer.receive(getReceiveTimeout());
+ assertNotNull(rm);
+
+ assertEquals("JMS Correlation ID mismatch",
sentMsg.getJMSCorrelationID(), rm.getJMSCorrelationID());
+ assertEquals("JMS Type mismatch", sentMsg.getJMSType(),
rm.getJMSType());
+ assertEquals("JMS Reply To mismatch", sentMsg.getJMSReplyTo(),
rm.getJMSReplyTo());
+ assertEquals("JMSMessageID mismatch:", sentMessageId,
rm.getJMSMessageID());
+ assertEquals("JMS Default priority should be
4",Message.DEFAULT_PRIORITY,rm.getJMSPriority());
+
+ //Validate that the JMSX values are correct
+ assertEquals("JMSXGroupID is not as expected:", GROUP,
rm.getStringProperty("JMSXGroupID"));
+ assertEquals("JMSXGroupSeq is not as expected:", JMSX_GROUP_SEQ_VALUE,
rm.getIntProperty("JMSXGroupSeq"));
+
+ assertEquals("Message payload not as expected", payload,
rm.getObject());
+
+ session.commit();
+ }
+
+ private ObjectMessage getForeignObjectMessage(final ObjectMessage message)
+ {
+ return Reflection.newProxy(ObjectMessage.class, new
AbstractInvocationHandler()
+ {
+ @Override
+ protected Object handleInvocation(final Object proxy, final Method
method, final Object[] args)
+ throws Throwable
+ {
+ return method.invoke(message, args);
+ }
+ });
+ }
+}
Modified:
qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java
URL:
http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java?rev=1779170&r1=1779169&r2=1779170&view=diff
==============================================================================
---
qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java
(original)
+++
qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java
Tue Jan 17 11:12:36 2017
@@ -35,26 +35,14 @@ import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.Topic;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.qpid.client.message.NonQpidObjectMessage;
import org.apache.qpid.client.message.QpidMessageProperties;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
-/**
- * @author Apache Software Foundation
- */
public class JMSPropertiesTest extends QpidBrokerTestCase
{
-
- private static final Logger _logger =
LoggerFactory.getLogger(JMSPropertiesTest.class);
-
- public static final String JMS_CORR_ID = "QPIDID_01";
- public static final int JMS_DELIV_MODE = 1;
- public static final String JMS_TYPE = "test.jms.type";
- protected static final String NULL_OBJECT_PROPERTY = "NullObject";
- protected static final String INVALID_OBJECT_PROPERTY = "InvalidObject";
+ private static final String JMS_CORR_ID = "QPIDID_01";
+ private static final String JMS_TYPE = "test.jms.type";
+ private static final String INVALID_OBJECT_PROPERTY = "InvalidObject";
public void testJMSProperties() throws Exception
{
@@ -65,15 +53,15 @@ public class JMSPropertiesTest extends Q
MessageConsumer consumer = consumerSession.createConsumer(queue);
Connection con2 = getConnection();
- Session producerSession = con2.createSession(false,
Session.CLIENT_ACKNOWLEDGE);
- MessageProducer producer = producerSession.createProducer(queue);
- Destination JMS_REPLY_TO = createTestQueue(producerSession,
"my.replyto");
+ final Session producerSession = con2.createSession(false,
Session.CLIENT_ACKNOWLEDGE);
+ final MessageProducer producer = producerSession.createProducer(queue);
+ Destination replyTo = createTestQueue(producerSession, "my.replyto");
+
// create a test message to send
- ObjectMessage sentMsg = new NonQpidObjectMessage(producerSession);
+ ObjectMessage sentMsg = producerSession.createObjectMessage();
sentMsg.setJMSCorrelationID(JMS_CORR_ID);
- sentMsg.setJMSDeliveryMode(JMS_DELIV_MODE);
sentMsg.setJMSType(JMS_TYPE);
- sentMsg.setJMSReplyTo(JMS_REPLY_TO);
+ sentMsg.setJMSReplyTo(replyTo);
String JMSXGroupID_VALUE = "group";
sentMsg.setStringProperty("JMSXGroupID", JMSXGroupID_VALUE);
@@ -84,7 +72,7 @@ public class JMSPropertiesTest extends Q
try
{
sentMsg.setObjectProperty(INVALID_OBJECT_PROPERTY, new
Exception());
- fail("Non primitive Object Property value set");
+ fail("Non serializable Object Property value set");
}
catch (MessageFormatException mfe)
{
@@ -100,17 +88,15 @@ public class JMSPropertiesTest extends Q
con.start();
// get message and check JMS properties
- ObjectMessage rm = (ObjectMessage) consumer.receive(2000);
+ ObjectMessage rm = (ObjectMessage)
consumer.receive(getReceiveTimeout());
assertNotNull(rm);
assertEquals("JMS Correlation ID mismatch",
sentMsg.getJMSCorrelationID(), rm.getJMSCorrelationID());
- // TODO: Commented out as always overwritten by send delivery mode
value - prob should not set in conversion
- // assertEquals("JMS Delivery Mode
mismatch",sentMsg.getJMSDeliveryMode(),rm.getJMSDeliveryMode());
assertEquals("JMS Type mismatch", sentMsg.getJMSType(),
rm.getJMSType());
assertEquals("JMS Reply To mismatch", sentMsg.getJMSReplyTo(),
rm.getJMSReplyTo());
assertTrue("JMSMessageID Does not start ID:",
rm.getJMSMessageID().startsWith("ID:"));
- assertEquals("JMS Default priority should be
4",Message.DEFAULT_PRIORITY,rm.getJMSPriority());
-
+ assertEquals("JMS Default priority should be
4",Message.DEFAULT_PRIORITY,rm.getJMSPriority());
+
//Validate that the JMSX values are correct
assertEquals("JMSXGroupID is not as expected:", JMSXGroupID_VALUE,
rm.getStringProperty("JMSXGroupID"));
assertEquals("JMSXGroupSeq is not as expected:", JMSXGroupSeq_VALUE,
rm.getIntProperty("JMSXGroupSeq"));
@@ -134,8 +120,8 @@ public class JMSPropertiesTest extends Q
assertTrue("JMSXGroupID not available.",JMSXGroupID_Available);
assertTrue("JMSXGroupSeq not available.",JMSXGroupSeq_Available);
- // Check that the NULL_OBJECT_PROPERTY was not set or transmitted.
- assertFalse(NULL_OBJECT_PROPERTY + " was not set.",
rm.propertyExists(NULL_OBJECT_PROPERTY));
+ // Check that the INVALID_OBJECT_PROPERTY was not set or transmitted.
+ assertFalse(INVALID_OBJECT_PROPERTY + " was not set.",
rm.propertyExists(INVALID_OBJECT_PROPERTY));
con.close();
}
@@ -158,7 +144,7 @@ public class JMSPropertiesTest extends Q
m.setObjectProperty(QpidMessageProperties.AMQP_0_10_APP_ID,
"my-app-id");
prod.send(m);
- Message msg = consumer.receive(1000);
+ Message msg = consumer.receive(getReceiveTimeout());
assertNotNull(msg);
Enumeration<String> enu = msg.getPropertyNames();
Modified: qpid/java/trunk/tck/pom.xml
URL:
http://svn.apache.org/viewvc/qpid/java/trunk/tck/pom.xml?rev=1779170&r1=1779169&r2=1779170&view=diff
==============================================================================
--- qpid/java/trunk/tck/pom.xml (original)
+++ qpid/java/trunk/tck/pom.xml Tue Jan 17 11:12:36 2017
@@ -62,11 +62,6 @@
<version>${slf4j-version}</version>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <version>${geronimo-jms-1-1-version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient-version}</version>
@@ -284,7 +279,22 @@
</build>
</profile>
-
+ <profile>
+ <id>addJms11IfNecessary</id>
+ <activation>
+ <property>
+ <name>tck</name>
+ <value>!qpid-jms-client</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>${geronimo-jms-1-1-version}</version>
+ </dependency>
+ </dependencies>
+ </profile>
<profile>
<!-- Profile used to execute TCK against the Qpid JMS client -->
<id>qpid-jms-client</id>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]