add test that the prefetch policy influences the link credit issued for 
consumers


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

Branch: refs/heads/master
Commit: 07c3e9916251c34f32acdb6218a4c69faf8f484f
Parents: 7daeb80
Author: Robert Gemmell <[email protected]>
Authored: Tue Dec 9 10:33:32 2014 +0000
Committer: Robert Gemmell <[email protected]>
Committed: Tue Dec 9 10:33:32 2014 +0000

----------------------------------------------------------------------
 .../jms/integration/SessionIntegrationTest.java | 23 ++++++++++++++++++++
 1 file changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/07c3e991/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
index 3ae8ad5..67949dd 100644
--- 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
+++ 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
@@ -44,6 +44,7 @@ import javax.jms.TextMessage;
 import javax.jms.Topic;
 import javax.jms.TopicSubscriber;
 
+import org.apache.qpid.jms.JmsConnection;
 import org.apache.qpid.jms.provider.amqp.AmqpConnectionProperties;
 import org.apache.qpid.jms.test.QpidJmsTestCase;
 import org.apache.qpid.jms.test.testpeer.TestAmqpPeer;
@@ -575,4 +576,26 @@ public class SessionIntegrationTest extends 
QpidJmsTestCase {
             testPeer.waitForAllHandlersToComplete(1000);
         }
     }
+
+    @Test(timeout=5000)
+    public void testPrefetchPolicyInfluencesCreditFlow() throws Exception {
+        try (TestAmqpPeer testPeer = new 
TestAmqpPeer(IntegrationTestFixture.PORT);) {
+            Connection connection = testFixture.establishConnecton(testPeer);
+            int newPrefetch = 263;
+            ((JmsConnection) 
connection).getPrefetchPolicy().setAll(newPrefetch);
+            connection.start();
+
+            testPeer.expectBegin(true);
+
+            Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
+            Queue queue = session.createQueue("myQueue");
+
+            testPeer.expectReceiverAttach();
+            testPeer.expectLinkFlow(false, 
equalTo(UnsignedInteger.valueOf(newPrefetch)));
+
+            session.createConsumer(queue);
+
+            testPeer.waitForAllHandlersToComplete(1000);
+        }
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to