diff options
| author | Robert Gemmell <robbie@apache.org> | 2011-10-07 08:55:58 +0000 |
|---|---|---|
| committer | Robert Gemmell <robbie@apache.org> | 2011-10-07 08:55:58 +0000 |
| commit | 4c56f4e31814fac8170a121438ce0b4d752c58e3 (patch) | |
| tree | 89accb85391c37962701023016c82578a083adcd /qpid/java | |
| parent | 3d15749e5d44f9fe539bb2fbeba55192369edf24 (diff) | |
| download | qpid-python-4c56f4e31814fac8170a121438ce0b4d752c58e3.tar.gz | |
QPID-3526: ensure that the session is marked clean after message.acknowledge() is used, add test to verify behaviour
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1179965 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
| -rw-r--r-- | qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java | 1 | ||||
| -rw-r--r-- | qpid/java/systests/src/main/java/org/apache/qpid/client/failover/FailoverBehaviourTest.java | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java index 4f7d344655..44c4e8987a 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java @@ -630,6 +630,7 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic try { acknowledgeImpl(); + markClean(); } catch (TransportException e) { diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/client/failover/FailoverBehaviourTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/client/failover/FailoverBehaviourTest.java index aa62106c46..66f8fe0546 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/client/failover/FailoverBehaviourTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/client/failover/FailoverBehaviourTest.java @@ -463,6 +463,31 @@ public class FailoverBehaviourTest extends FailoverBaseCase implements Connectio } /** + * Test that calling acknowledge before failover leaves the session + * clean for use after failover. + */ + public void testAcknowledgeBeforeFailover() throws Exception + { + init(Session.CLIENT_ACKNOWLEDGE, true); + + produceMessages(); + + // consume messages and acknowledge them + Message lastMessage = consumeMessages(); + lastMessage.acknowledge(); + + causeFailure(); + + assertFailoverException(); + + produceMessages(); + + // tests whether receiving and acknowledgment is working after recover + lastMessage = consumeMessages(); + lastMessage.acknowledge(); + } + + /** * Test that receiving of messages after failover prior to calling * {@link Message#acknowledge()} still results in acknowledge throwing an exception. */ |
