You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2015/03/02 12:49:55 UTC
[2/4] qpid-jms git commit: add test of producer behaviour on link
which is remotely closed
add test of producer behaviour on link which is remotely closed
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/f7868684
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/f7868684
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/f7868684
Branch: refs/heads/master
Commit: f78686848eee4bcd3f61c82c72ccfc623663416f
Parents: b82f427
Author: Robert Gemmell <ro...@apache.org>
Authored: Mon Mar 2 11:06:43 2015 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Mon Mar 2 11:06:43 2015 +0000
----------------------------------------------------------------------
.../jms/integration/SenderIntegrationTest.java | 37 ++++++++++++++++++++
1 file changed, 37 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f7868684/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SenderIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SenderIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SenderIntegrationTest.java
index dff1a6d..e6738d1 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SenderIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SenderIntegrationTest.java
@@ -33,6 +33,7 @@ import java.util.Date;
import javax.jms.Connection;
import javax.jms.DeliveryMode;
+import javax.jms.IllegalStateException;
import javax.jms.Message;
import javax.jms.MessageProducer;
import javax.jms.Queue;
@@ -40,6 +41,7 @@ import javax.jms.Session;
import org.apache.qpid.jms.provider.amqp.message.AmqpMessageSupport;
import org.apache.qpid.jms.test.QpidJmsTestCase;
+import org.apache.qpid.jms.test.Wait;
import org.apache.qpid.jms.test.testpeer.TestAmqpPeer;
import org.apache.qpid.jms.test.testpeer.matchers.sections.MessageAnnotationsSectionMatcher;
import org.apache.qpid.jms.test.testpeer.matchers.sections.MessageHeaderSectionMatcher;
@@ -516,4 +518,39 @@ public class SenderIntegrationTest extends QpidJmsTestCase {
assertNull("JMSMessageID should still not yet be set", message.getJMSMessageID());
}
}
+
+ @Test(timeout = 5000)
+ public void testRemotelyCloseProducer() throws Exception {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
+ Connection connection = testFixture.establishConnecton(testPeer);
+
+ testPeer.expectBegin(true);
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ // Create a producer, then remotely end it afterwards.
+ testPeer.expectSenderAttach();
+ testPeer.remotelyDetachLastOpenedLinkOnLastOpenedSession(true, true);
+
+ Queue queue = session.createQueue("myQueue");
+ final MessageProducer producer = session.createProducer(queue);
+
+ // Verify the producer gets marked closed
+ testPeer.waitForAllHandlersToComplete(1000);
+ assertTrue("producer never closed.", Wait.waitFor(new Wait.Condition() {
+ @Override
+ public boolean isSatisified() throws Exception {
+ try {
+ producer.getDestination();
+ } catch (IllegalStateException jmsise) {
+ return true;
+ }
+ return false;
+ }
+ }, 2000, 10));
+
+ // Try closing it explicitly, should effectively no-op in client.
+ // The test peer will throw during close if it sends anything.
+ producer.close();
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org