diff options
| author | Robert Gemmell <robbie@apache.org> | 2012-02-01 15:19:32 +0000 |
|---|---|---|
| committer | Robert Gemmell <robbie@apache.org> | 2012-02-01 15:19:32 +0000 |
| commit | 8e9d33062f5f9f8169e62bdce3245ec281a1a3e6 (patch) | |
| tree | 386322789f62e0b593795eb109c24b25836a0140 /java/client/src/test | |
| parent | 9d3aace945fe0f21dc73b028a64240148f2587fd (diff) | |
| download | qpid-python-8e9d33062f5f9f8169e62bdce3245ec281a1a3e6.tar.gz | |
QPID-3790: Add a method AMQSession.getQueueDepth(AMQDestionation, boolean) to sync session (if specified) before sending QueueQuery command
Applied patch from Andrew MacBean <andymacbean@gmail.com> and Oleksandr Rudyy<orudyy@gmail.com>.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1239166 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src/test')
| -rw-r--r-- | java/client/src/test/java/org/apache/qpid/client/AMQSession_0_10Test.java | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/java/client/src/test/java/org/apache/qpid/client/AMQSession_0_10Test.java b/java/client/src/test/java/org/apache/qpid/client/AMQSession_0_10Test.java index 6c8ccb139e..4bfbd3c726 100644 --- a/java/client/src/test/java/org/apache/qpid/client/AMQSession_0_10Test.java +++ b/java/client/src/test/java/org/apache/qpid/client/AMQSession_0_10Test.java @@ -18,9 +18,8 @@ */ package org.apache.qpid.client; -import junit.framework.TestCase; - import org.apache.qpid.framing.AMQShortString; +import org.apache.qpid.test.utils.QpidTestCase; import org.apache.qpid.transport.*; import org.apache.qpid.transport.Connection.SessionFactory; import org.apache.qpid.transport.Connection.State; @@ -39,7 +38,7 @@ import java.util.List; * {@link SessionException} is not thrown from methods of * {@link AMQSession_0_10}. */ -public class AMQSession_0_10Test extends TestCase +public class AMQSession_0_10Test extends QpidTestCase { public void testExceptionOnCommit() @@ -460,6 +459,28 @@ public class AMQSession_0_10Test extends TestCase assertNotNull("ExchangeDeclare event was not sent", event); } + public void testGetQueueDepthWithSync() + { + // slow down a flush thread + setTestSystemProperty("qpid.session.max_ack_delay", "10000"); + AMQSession_0_10 session = createAMQSession_0_10(false, javax.jms.Session.DUPS_OK_ACKNOWLEDGE); + try + { + session.acknowledgeMessage(-1, false); + session.getQueueDepth(createDestination(), true); + } + catch (Exception e) + { + fail("Unexpected exception is cought:" + e.getMessage()); + } + ProtocolEvent command = findSentProtocolEventOfClass(session, MessageAccept.class, false); + assertNotNull("MessageAccept command was not sent", command); + command = findSentProtocolEventOfClass(session, ExecutionSync.class, false); + assertNotNull("ExecutionSync command was not sent", command); + command = findSentProtocolEventOfClass(session, QueueQuery.class, false); + assertNotNull("QueueQuery command was not sent", command); + } + private AMQAnyDestination createDestination() { AMQAnyDestination destination = null; |
