activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmacn...@apache.org
Subject svn commit: r787363 - /activemq/sandbox/activemq-flow/activemq-openwire/src/test/java/org/apache/activemq/legacy/openwireprotocol/BrokerTest.java
Date Mon, 22 Jun 2009 19:28:00 GMT
Author: cmacnaug
Date: Mon Jun 22 19:28:00 2009
New Revision: 787363

URL: http://svn.apache.org/viewvc?rev=787363&view=rev
Log:
Fixing broken test case: testGroupedMessagesDeliveredToOnlyOneConsumer. It wasn't properly
testing group enforcement.

Modified:
    activemq/sandbox/activemq-flow/activemq-openwire/src/test/java/org/apache/activemq/legacy/openwireprotocol/BrokerTest.java

Modified: activemq/sandbox/activemq-flow/activemq-openwire/src/test/java/org/apache/activemq/legacy/openwireprotocol/BrokerTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-openwire/src/test/java/org/apache/activemq/legacy/openwireprotocol/BrokerTest.java?rev=787363&r1=787362&r2=787363&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-openwire/src/test/java/org/apache/activemq/legacy/openwireprotocol/BrokerTest.java
(original)
+++ activemq/sandbox/activemq-flow/activemq-openwire/src/test/java/org/apache/activemq/legacy/openwireprotocol/BrokerTest.java
Mon Jun 22 19:28:00 2009
@@ -35,6 +35,8 @@
 import org.apache.activemq.command.ProducerInfo;
 import org.apache.activemq.command.SessionInfo;
 
+import com.sun.org.apache.xml.internal.serializer.utils.Messages;
+
 public class BrokerTest extends BrokerTestSupport {
 
     public ActiveMQDestination destination;
@@ -624,16 +626,19 @@
 
         ConsumerInfo consumerInfo1 = createConsumerInfo(sessionInfo1, destination);
         consumerInfo1.setPrefetchSize(1);
-        connection1.send(consumerInfo1);
+        connection1.request(consumerInfo1);
+        
+        ArrayList<Message> msgs = new ArrayList<Message>(4);
 
         // Send the messages.
-        for (int i = 0; i < 4; i++) {
+        for (int i = 0; i < 1; i++) {
             Message message = createMessage(producerInfo, destination, deliveryMode);
             message.setGroupID("TEST-GROUP");
             message.setGroupSequence(i + 1);
+            msgs.add(i, message);
             connection1.request(message);
         }
-
+        
         // Setup a second connection
         StubConnection connection2 = createConnection();
         ConnectionInfo connectionInfo2 = createConnectionInfo();
@@ -643,13 +648,22 @@
 
         ConsumerInfo consumerInfo2 = createConsumerInfo(sessionInfo2, destination);
         consumerInfo2.setPrefetchSize(1);
-        connection2.send(consumerInfo2);
+        connection2.request(consumerInfo2);
+        
+        // Send the messages.
+        for (int i = 1; i < 4; i++) {
+            Message message = createMessage(producerInfo, destination, deliveryMode);
+            message.setGroupID("TEST-GROUP");
+            message.setGroupSequence(i + 1);
+            msgs.add(i, message);
+            connection1.request(message);
+        }
 
         // All the messages should have been sent down connection 1.. just get
         // the first 3
         for (int i = 0; i < 3; i++) {
             Message m1 = receiveMessage(connection1);
-            assertNotNull("m1 is null for index: " + i, m1);
+            assertEquals("Unexpected Message Receipt: " + m1, m1.getMessageId(), msgs.get(i).getMessageId());
             connection1.send(createAck(consumerInfo1, m1, 1, MessageAck.STANDARD_ACK_TYPE));
         }
 
@@ -657,9 +671,9 @@
         connection1.request(closeConsumerInfo(consumerInfo1));
 
         // The last messages should now go the the second consumer.
-        for (int i = 0; i < 1; i++) {
+        for (int i = 3; i < 4; i++) {
             Message m1 = receiveMessage(connection2);
-            assertNotNull("m1 is null for index: " + i, m1);
+            assertEquals("Unexpected Message Receipt: " + m1, m1.getMessageId(), msgs.get(i).getMessageId());
             connection2.request(createAck(consumerInfo2, m1, 1, MessageAck.STANDARD_ACK_TYPE));
         }
 



Mime
View raw message