qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject qpid-jms git commit: QPIDJMS-51 Tweak test case to enable deterministic test scenario.
Date Wed, 02 Sep 2015 15:43:29 GMT
Repository: qpid-jms
Updated Branches:
  refs/heads/master 0f8e7fe73 -> c41cb35c6


QPIDJMS-51 Tweak test case to enable deterministic test scenario.  

Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/c41cb35c
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/c41cb35c
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/c41cb35c

Branch: refs/heads/master
Commit: c41cb35c603b7693da245db942a5294fd7977657
Parents: 0f8e7fe
Author: Timothy Bish <tabish121@gmail.com>
Authored: Wed Sep 2 11:43:04 2015 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Wed Sep 2 11:43:04 2015 -0400

----------------------------------------------------------------------
 .../QueueBrowserIntegrationTest.java            | 56 ++++++++++----------
 1 file changed, 29 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/c41cb35c/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/QueueBrowserIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/QueueBrowserIntegrationTest.java
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/QueueBrowserIntegrationTest.java
index d29c083..343b020 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/QueueBrowserIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/QueueBrowserIntegrationTest.java
@@ -189,8 +189,9 @@ public class QueueBrowserIntegrationTest extends QpidJmsTestCase {
             // Auto acknowledge mode with a drain from the browser.
             testPeer.expectQueueBrowserAttach();
             testPeer.expectLinkFlow();
+            // TODO - End of Drain flow omitted for now to avoid spurious client flows.
             testPeer.expectLinkFlowRespondWithTransfer(null, null, null, null, amqpValueNullContent,
-                1, true, true, Matchers.greaterThan(UnsignedInteger.ZERO), 1, true, false);
+                1, true, false, Matchers.greaterThan(UnsignedInteger.ZERO), 1, true, false);
             testPeer.expectDetach(true, true, true);
 
             QueueBrowser browser = session.createBrowser(queue);
@@ -205,36 +206,26 @@ public class QueueBrowserIntegrationTest extends QpidJmsTestCase {
     }
 
     @Test(timeout=30000)
-    public void testCreateQueueBrowseTransactedSession() throws IOException, Exception {
+    public void testCreateQueueBrowseClientAckSession() throws IOException, Exception {
         try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
             Connection connection = testFixture.establishConnecton(testPeer);
             connection.start();
 
             testPeer.expectBegin();
-            CoordinatorMatcher txCoordinatorMatcher = new CoordinatorMatcher();
-            testPeer.expectSenderAttach(txCoordinatorMatcher, false, false);
 
-            Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
+            Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
             Queue queue = session.createQueue("myQueue");
 
             DescribedType amqpValueNullContent = new AmqpValueDescribedType(null);
 
+            // Expected the browser to create a consumer and send credit, once hasMoreElements
+            // is called a message that is received should be accepted when the session is
in
+            // Auto acknowledge mode.
             testPeer.expectQueueBrowserAttach();
             testPeer.expectLinkFlow();
+            // TODO - End of Drain flow omitted for now to avoid spurious client flows.
             testPeer.expectLinkFlowRespondWithTransfer(null, null, null, null, amqpValueNullContent,
-                1, true, true, Matchers.greaterThan(UnsignedInteger.ZERO), 1, true, false);
-
-            // First expect an unsettled 'declare' transfer to the txn coordinator, and
-            // reply with a declared disposition state containing the txnId.
-            Binary txnId = new Binary(new byte[]{ (byte) 1, (byte) 2, (byte) 3, (byte) 4});
-            TransferPayloadCompositeMatcher declareMatcher = new TransferPayloadCompositeMatcher();
-            declareMatcher.setMessageContentMatcher(new EncodedAmqpValueMatcher(new Declare()));
-            testPeer.expectTransfer(declareMatcher, nullValue(), false, new Declared().setTxnId(txnId),
true);
-
-            // Expected the browser to create a consumer and send credit, once hasMoreElements
-            // is called a message that is received should be delivered when the session
is in
-            // a transacted session, the browser should not participate and close when asked.
-            testPeer.expectLinkFlow();
+                1, true, false, Matchers.greaterThan(UnsignedInteger.ZERO), 1, true, false);
             testPeer.expectDetach(true, true, true);
 
             QueueBrowser browser = session.createBrowser(queue);
@@ -242,33 +233,46 @@ public class QueueBrowserIntegrationTest extends QpidJmsTestCase {
             assertNotNull(queueView);
             assertTrue(queueView.hasMoreElements());
 
-            // Browser should close without delay as it does not participate in the TX
             browser.close();
 
+            testPeer.expectEnd();
+            session.close();
+
             testPeer.waitForAllHandlersToComplete(3000);
         }
     }
 
     @Test(timeout=30000)
-    public void testCreateQueueBrowseClientAckSession() throws IOException, Exception {
+    public void testCreateQueueBrowseTransactedSession() throws IOException, Exception {
         try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
             Connection connection = testFixture.establishConnecton(testPeer);
             connection.start();
 
             testPeer.expectBegin();
+            CoordinatorMatcher txCoordinatorMatcher = new CoordinatorMatcher();
+            testPeer.expectSenderAttach(txCoordinatorMatcher, false, false);
 
-            Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+            Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
             Queue queue = session.createQueue("myQueue");
 
             DescribedType amqpValueNullContent = new AmqpValueDescribedType(null);
 
-            // Expected the browser to create a consumer and send credit, once hasMoreElements
-            // is called a message that is received should be accepted when the session is
in
-            // Auto acknowledge mode.
             testPeer.expectQueueBrowserAttach();
             testPeer.expectLinkFlow();
             testPeer.expectLinkFlowRespondWithTransfer(null, null, null, null, amqpValueNullContent,
                 1, true, true, Matchers.greaterThan(UnsignedInteger.ZERO), 1, true, false);
+
+            // First expect an unsettled 'declare' transfer to the txn coordinator, and
+            // reply with a declared disposition state containing the txnId.
+            Binary txnId = new Binary(new byte[]{ (byte) 1, (byte) 2, (byte) 3, (byte) 4});
+            TransferPayloadCompositeMatcher declareMatcher = new TransferPayloadCompositeMatcher();
+            declareMatcher.setMessageContentMatcher(new EncodedAmqpValueMatcher(new Declare()));
+            testPeer.expectTransfer(declareMatcher, nullValue(), false, new Declared().setTxnId(txnId),
true);
+
+            // Expected the browser to create a consumer and send credit, once hasMoreElements
+            // is called a message that is received should be delivered when the session
is in
+            // a transacted session, the browser should not participate and close when asked.
+            testPeer.expectLinkFlow();
             testPeer.expectDetach(true, true, true);
 
             QueueBrowser browser = session.createBrowser(queue);
@@ -276,11 +280,9 @@ public class QueueBrowserIntegrationTest extends QpidJmsTestCase {
             assertNotNull(queueView);
             assertTrue(queueView.hasMoreElements());
 
+            // Browser should close without delay as it does not participate in the TX
             browser.close();
 
-            testPeer.expectEnd();
-            session.close();
-
             testPeer.waitForAllHandlersToComplete(3000);
         }
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message