qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ritch...@apache.org
Subject svn commit: r887950 - in /qpid/trunk/qpid/java: systests/src/main/java/org/apache/qpid/test/client/message/JMSDestinationTest.java test-profiles/cpp.excludes test-profiles/cpp.testprofile
Date Mon, 07 Dec 2009 15:19:03 GMT
Author: ritchiem
Date: Mon Dec  7 15:19:02 2009
New Revision: 887950

URL: http://svn.apache.org/viewvc?rev=887950&view=rev
Log:
QPID-1992 : Exclude message move test from CPP broker as it uses JMX.

Added:
    qpid/trunk/qpid/java/test-profiles/cpp.excludes
Modified:
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/JMSDestinationTest.java
    qpid/trunk/qpid/java/test-profiles/cpp.testprofile

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/JMSDestinationTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/JMSDestinationTest.java?rev=887950&r1=887949&r2=887950&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/JMSDestinationTest.java
(original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/JMSDestinationTest.java
Mon Dec  7 15:19:02 2009
@@ -29,10 +29,10 @@
 import javax.jms.Destination;
 import javax.jms.Message;
 import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
 import javax.jms.Queue;
 import javax.jms.Session;
 import javax.jms.Topic;
-import javax.jms.MessageListener;
 import javax.management.openmbean.CompositeDataSupport;
 import javax.management.openmbean.TabularData;
 import java.util.Iterator;
@@ -50,7 +50,6 @@
 
     private Connection _connection;
     private Session _session;
-    private JMXTestUtils _jmxUtils;
 
     private static final String USER = "admin";
     private CountDownLatch _receiveMessage;
@@ -58,25 +57,13 @@
 
     public void setUp() throws Exception
     {
-        _jmxUtils = new JMXTestUtils(this, USER, USER);
-        _jmxUtils.setUp();
         super.setUp();
 
-        // Open the JMX Connection
-        _jmxUtils.open();
-
         _connection = getConnection();
 
         _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
     }
 
-    public void tearDown() throws Exception
-    {
-        _jmxUtils.close();
-
-        super.tearDown();
-    }
-
     /**
      * Test a message sent to a queue comes back with JMSDestination queue
      *
@@ -145,55 +132,69 @@
      */
     public void testMovedToQueue() throws Exception
     {
+        // Setup JMXUtils
+        JMXTestUtils jmxUtils = new JMXTestUtils(this, USER, USER);
+        jmxUtils.setUp();
+        // Open the JMX Connection
+        jmxUtils.open();
+        try
+        {
 
-        Queue queue = _session.createQueue(getTestQueueName());
+            Queue queue = _session.createQueue(getTestQueueName());
 
-        _session.createConsumer(queue).close();
+            _session.createConsumer(queue).close();
 
-        sendMessage(_session, queue, 1);
+            sendMessage(_session, queue, 1);
 
-        Topic topic = _session.createTopic(getTestQueueName() + "Topic");
+            Topic topic = _session.createTopic(getTestQueueName() + "Topic");
 
-        MessageConsumer consumer = _session.createConsumer(topic);
+            MessageConsumer consumer = _session.createConsumer(topic);
 
-        // Use Management to move message.
+            // Use Management to move message.
 
-        ManagedQueue managedQueue = _jmxUtils.
-                getManagedObject(ManagedQueue.class,
-                                 _jmxUtils.getQueueObjectName(getConnectionFactory().getVirtualPath().substring(1),
-                                                              getTestQueueName()));
+            ManagedQueue managedQueue = jmxUtils.
+                    getManagedObject(ManagedQueue.class,
+                                     jmxUtils.getQueueObjectName(getConnectionFactory().getVirtualPath().substring(1),
+                                                                  getTestQueueName()));
 
-        // Find the first message on the queue
-        TabularData data = managedQueue.viewMessages(1L, 2L);
+            // Find the first message on the queue
+            TabularData data = managedQueue.viewMessages(1L, 2L);
 
-        Iterator values = data.values().iterator();
-        assertTrue("No Messages found via JMX", values.hasNext());
+            Iterator values = data.values().iterator();
+            assertTrue("No Messages found via JMX", values.hasNext());
 
-        // Get its message ID
-        Long msgID = (Long) ((CompositeDataSupport) values.next()).get("AMQ MessageId");
+            // Get its message ID
+            Long msgID = (Long) ((CompositeDataSupport) values.next()).get("AMQ MessageId");
 
-        // Start the connection and consume message that has been moved to the
-        // queue
-        _connection.start();
+            // Start the connection and consume message that has been moved to the
+            // queue
+            _connection.start();
 
-        Message message = consumer.receive(1000);
+            Message message = consumer.receive(1000);
 
-        //Validate we don't have a message on the queue before we start
-        assertNull("Message should be null", message);
+            //Validate we don't have a message on the queue before we start
+            assertNull("Message should be null", message);
 
-        // Move it to from the topic to the queue
-        managedQueue.moveMessages(msgID, msgID, ((AMQTopic) topic).getQueueName());
+            // Move it to from the topic to the queue
+            managedQueue.moveMessages(msgID, msgID, ((AMQTopic) topic).getQueueName());
 
-        // Retrieve the newly moved message
-        message = consumer.receive(1000);
+            // Retrieve the newly moved message
+            message = consumer.receive(1000);
 
-        assertNotNull("Message should not be null", message);
+            assertNotNull("Message should not be null", message);
 
-        Destination destination = message.getJMSDestination();
+            Destination destination = message.getJMSDestination();
 
-        assertNotNull("JMSDestination should not be null", destination);
+            assertNotNull("JMSDestination should not be null", destination);
+
+            assertEquals("Incorrect Destination type", queue.getClass(), destination.getClass());
+
+        }
+        finally
+        {
+            jmxUtils.close();
+        }
 
-        assertEquals("Incorrect Destination type", queue.getClass(), destination.getClass());
     }
 
     /**
@@ -217,8 +218,8 @@
         _receiveMessage = new CountDownLatch(1);
 
         consumer.setMessageListener(this);
-        
-        assertTrue("Timed out waiting for message to be received ",_receiveMessage.await(1,
TimeUnit.SECONDS));
+
+        assertTrue("Timed out waiting for message to be received ", _receiveMessage.await(1,
TimeUnit.SECONDS));
 
         assertNotNull("Message should not be null", _message);
 

Added: qpid/trunk/qpid/java/test-profiles/cpp.excludes
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/test-profiles/cpp.excludes?rev=887950&view=auto
==============================================================================
--- qpid/trunk/qpid/java/test-profiles/cpp.excludes (added)
+++ qpid/trunk/qpid/java/test-profiles/cpp.excludes Mon Dec  7 15:19:02 2009
@@ -0,0 +1,2 @@
+// This test requires JMX interface to move messages
+org.apache.qpid.test.client.message.JMSDestinationTest#testMovedToQueue

Modified: qpid/trunk/qpid/java/test-profiles/cpp.testprofile
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/test-profiles/cpp.testprofile?rev=887950&r1=887949&r2=887950&view=diff
==============================================================================
--- qpid/trunk/qpid/java/test-profiles/cpp.testprofile (original)
+++ qpid/trunk/qpid/java/test-profiles/cpp.testprofile Mon Dec  7 15:19:02 2009
@@ -16,4 +16,4 @@
 broker=${broker.executable} -p @PORT --data-dir ${build.data}/@PORT -t --auth no --no-module-dir
${broker.modules} ${broker.args}
 
 profile.excludes=010PrefetchExcludes 010TransientExcludes
-test.excludes=Excludes 010Excludes ${profile}.excludes ${profile.excludes}
+test.excludes=Excludes 010Excludes ${profile}.excludes ${profile.excludes} cpp.excludes



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message