finish test of anonymous producer behaviour when the anonmous-relay node is not supported, observe link attach and detach/close for repeated sends
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/7537ee85 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/7537ee85 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/7537ee85 Branch: refs/heads/master Commit: 7537ee85864a97814ea5af420663dadf1f3e7f41 Parents: 840d3f7 Author: Robert Gemmell <[email protected]> Authored: Wed Nov 12 10:14:36 2014 +0000 Committer: Robert Gemmell <[email protected]> Committed: Wed Nov 12 10:16:11 2014 +0000 ---------------------------------------------------------------------- .../jms/integration/SessionIntegrationTest.java | 22 ++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/7537ee85/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 ebd81b0..7cfaf01 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,7 +44,6 @@ import org.apache.qpid.jms.test.testpeer.matchers.TargetMatcher; import org.apache.qpid.jms.test.testpeer.matchers.sections.MessageAnnotationsSectionMatcher; import org.apache.qpid.jms.test.testpeer.matchers.sections.MessageHeaderSectionMatcher; import org.apache.qpid.jms.test.testpeer.matchers.sections.TransferPayloadCompositeMatcher; -import org.junit.Ignore; import org.junit.Test; public class SessionIntegrationTest extends QpidJmsTestCase { @@ -229,7 +228,6 @@ public class SessionIntegrationTest extends QpidJmsTestCase { } @Test(timeout = 5000) - @Ignore //TODO: enable once completed. Expect additional sender attaches and detaches for each message public void testCreateAnonymousProducerWhenAnonymousRelayNodeIsNotSupported() throws Exception { try (TestAmqpPeer testPeer = new TestAmqpPeer(IntegrationTestFixture.PORT);) { Connection connection = testFixture.establishConnecton(testPeer); @@ -241,7 +239,7 @@ public class SessionIntegrationTest extends QpidJmsTestCase { String topicName = "myTopic"; Topic dest = session.createTopic(topicName); - //Expect and accept a link to the anonymous relay node + //Expect and refuse a link to the anonymous relay node TargetMatcher targetMatcher = new TargetMatcher(); targetMatcher.withAddress(nullValue()); targetMatcher.withDynamic(nullValue());//default = false @@ -253,17 +251,33 @@ public class SessionIntegrationTest extends QpidJmsTestCase { MessageProducer producer = session.createProducer(null); assertNotNull("Producer object was null", producer); - //Expect a new message sent on the above link to the anonymous relay + //Expect a new message sent by the above producer to cause creation of a new + //sender link to the given destination, then closing the link after the message is sent. + TargetMatcher targetMatcher2 = new TargetMatcher(); + targetMatcher.withAddress(equalTo("topic://" + topicName)); //TODO: remove prefix + targetMatcher.withDynamic(nullValue());//default = false + targetMatcher.withDurable(nullValue());//default = none/0 + MessageHeaderSectionMatcher headersMatcher = new MessageHeaderSectionMatcher(true); MessageAnnotationsSectionMatcher msgAnnotationsMatcher = new MessageAnnotationsSectionMatcher(true); TransferPayloadCompositeMatcher messageMatcher = new TransferPayloadCompositeMatcher(); messageMatcher.setHeadersMatcher(headersMatcher); messageMatcher.setMessageAnnotationsMatcher(msgAnnotationsMatcher); + + testPeer.expectSenderAttach(targetMatcher2, false, false); testPeer.expectTransfer(messageMatcher); + testPeer.expectDetach(true, true); Message message = session.createMessage(); producer.send(dest, message); + //Repeat the send and observe another attach->transfer->detach. + testPeer.expectSenderAttach(targetMatcher2, false, false); + testPeer.expectTransfer(messageMatcher); + testPeer.expectDetach(true, true); + + producer.send(dest, message); + testPeer.waitForAllHandlersToComplete(1000); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
