diff options
| author | Keith Wall <kwall@apache.org> | 2011-11-07 11:04:22 +0000 |
|---|---|---|
| committer | Keith Wall <kwall@apache.org> | 2011-11-07 11:04:22 +0000 |
| commit | 557ff0f8c88210ed6d18e2a13c3336f0bc62c7e8 (patch) | |
| tree | a6b11c0c5c4fe3048afd633b6dd172047d52fa3e /java/systests/src | |
| parent | 68a3db2e1f58d1bacffbe62885519fe0a123060f (diff) | |
| download | qpid-python-557ff0f8c88210ed6d18e2a13c3336f0bc62c7e8.tar.gz | |
QPID-3536: 0-10 overrides JMS AcceptMode with a defaulted (not explicitly set) Link Reliability of UNRELIABLE
Applied patch from Andrew MacBean <andymacbean@gmail.com> and myself.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1198701 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/systests/src')
| -rw-r--r-- | java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java | 61 |
1 files changed, 48 insertions, 13 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java b/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java index b70b2f90e4..feae7c9573 100644 --- a/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java +++ b/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java @@ -1070,19 +1070,6 @@ public class AddressBasedDestinationTest extends QpidBrokerTestCase { assertTrue(e.getCause().getMessage().contains("The reliability mode 'exactly-once' is not yet supported")); } - - String addr4 = "ADDR:amq.topic/test;{link : {reliability : at-least-once}}"; - try - { - AMQAnyDestination dest = new AMQAnyDestination(addr4); - Session ssn = _connection.createSession(false,Session.CLIENT_ACKNOWLEDGE); - MessageConsumer cons = ssn.createConsumer(dest); - fail("An exception should be thrown indicating it's an unsupported combination"); - } - catch(Exception e) - { - assertTrue(e.getCause().getMessage().contains("AT-LEAST-ONCE is not yet supported for Topics")); - } } private void acceptModeTest(String address, int expectedQueueDepth) throws Exception @@ -1286,4 +1273,52 @@ public class AddressBasedDestinationTest extends QpidBrokerTestCase Message m = consumer.receive(RECEIVE_TIMEOUT); assertNull("Unexpected message received", m); } + + /** + * Tests that a client using a session in {@link Session#CLIENT_ACKNOWLEDGE} can correctly + * recover a session and re-receive the same message. + */ + public void testTopicRereceiveAfterRecover() throws Exception + { + final Session jmsSession = _connection.createSession(false,Session.CLIENT_ACKNOWLEDGE); + final Destination topic = jmsSession.createTopic("ADDR:amq.topic/topic1; {link:{name: queue1}}"); + + final MessageProducer prod = jmsSession.createProducer(topic); + final MessageConsumer consForTopic1 = jmsSession.createConsumer(topic); + final Message sentMessage = jmsSession.createTextMessage("Hello"); + + prod.send(sentMessage); + Message receivedMessage = consForTopic1.receive(1000); + assertNotNull("message should be received by consumer", receivedMessage); + + jmsSession.recover(); + receivedMessage = consForTopic1.receive(1000); + assertNotNull("message should be re-received by consumer after recover", receivedMessage); + receivedMessage.acknowledge(); + } + + /** + * Tests that a client using a session in {@link Session#SESSION_TRANSACTED} can correctly + * rollback a session and re-receive the same message. + */ + public void testTopicRereceiveAfterRollback() throws Exception + { + final Session jmsSession = _connection.createSession(true,Session.SESSION_TRANSACTED); + final Destination topic = jmsSession.createTopic("ADDR:amq.topic/topic1; {link:{name: queue1}}"); + + final MessageProducer prod = jmsSession.createProducer(topic); + final MessageConsumer consForTopic1 = jmsSession.createConsumer(topic); + final Message sentMessage = jmsSession.createTextMessage("Hello"); + + prod.send(sentMessage); + jmsSession.commit(); + + Message receivedMessage = consForTopic1.receive(1000); + assertNotNull("message should be received by consumer", receivedMessage); + + jmsSession.rollback(); + receivedMessage = consForTopic1.receive(1000); + assertNotNull("message should be re-received by consumer after rollback", receivedMessage); + jmsSession.commit(); + } } |
