add incomplete test of anonymous producer behaviour when the anonymous-relay node is not supported
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/85a310a3 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/85a310a3 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/85a310a3 Branch: refs/heads/master Commit: 85a310a3f3a251fe1c9aa5c02dd27c0f87ec44b5 Parents: 923bbc7 Author: Robert Gemmell <[email protected]> Authored: Mon Nov 10 15:25:36 2014 +0000 Committer: Robert Gemmell <[email protected]> Committed: Mon Nov 10 17:48:37 2014 +0000 ---------------------------------------------------------------------- .../jms/integration/SessionIntegrationTest.java | 40 ++++++++++++++++++++ 1 file changed, 40 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/85a310a3/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 b469bdc..9181af9 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 @@ -210,4 +210,44 @@ public class SessionIntegrationTest extends QpidJmsTestCase { testPeer.waitForAllHandlersToComplete(1000); } } + + @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); + connection.start(); + + testPeer.expectBegin(true); + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + + String topicName = "myTopic"; + Topic dest = session.createTopic(topicName); + + //Expect and accept a link to the anonymous relay node + TargetMatcher targetMatcher = new TargetMatcher(); + targetMatcher.withAddress(nullValue()); + targetMatcher.withDynamic(nullValue());//default = false + targetMatcher.withDurable(nullValue());//default = none/0 + + testPeer.expectSenderAttach(targetMatcher, true); + + //Create an anonymous producer + MessageProducer producer = session.createProducer(null); + assertNotNull("Producer object was null", producer); + + //Expect a new message sent on the above link to the anonymous relay + MessageHeaderSectionMatcher headersMatcher = new MessageHeaderSectionMatcher(true); + MessageAnnotationsSectionMatcher msgAnnotationsMatcher = new MessageAnnotationsSectionMatcher(true); + TransferPayloadCompositeMatcher messageMatcher = new TransferPayloadCompositeMatcher(); + messageMatcher.setHeadersMatcher(headersMatcher); + messageMatcher.setMessageAnnotationsMatcher(msgAnnotationsMatcher); + testPeer.expectTransfer(messageMatcher); + + Message message = session.createMessage(); + producer.send(dest, message); + + testPeer.waitForAllHandlersToComplete(1000); + } + } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
