Author: bharath
Date: Fri Feb 6 11:01:00 2009
New Revision: 741529
URL: http://svn.apache.org/viewvc?rev=741529&view=rev
Log:
Added a new test to verify if after purging acknowledged messages, if there are
no more unacknowledged messsages for the given sequence, whether we completely
remove the map entry for the sequence from the ResendCandidates map. Modifed
the createSequence method accordingly as there are new getters on the mock
objects.
Modified:
cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImplTest.java
Modified:
cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImplTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImplTest.java?rev=741529&r1=741528&r2=741529&view=diff
==============================================================================
---
cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImplTest.java
(original)
+++
cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImplTest.java
Fri Feb 6 11:01:00 2009
@@ -240,6 +240,34 @@
2,
sequenceList.size());
}
+
+ @Test
+ public void testPurgeAcknowledgedAll() {
+ BigInteger[] messageNumbers = {BigInteger.TEN, BigInteger.ONE};
+ SourceSequence sequence = setUpSequence("sequence1",
+ messageNumbers,
+ new boolean[] {true, true});
+ List<RetransmissionQueueImpl.ResendCandidate> sequenceList =
+ new ArrayList<RetransmissionQueueImpl.ResendCandidate>();
+ queue.getUnacknowledged().put("sequence1", sequenceList);
+ Message message1 =
+ setUpMessage("sequence1", messageNumbers[0]);
+ setupMessagePolicies(message1);
+ Message message2 =
+ setUpMessage("sequence1", messageNumbers[1]);
+ setupMessagePolicies(message2);
+ ready(false);
+
+ sequenceList.add(queue.createResendCandidate(message1));
+ sequenceList.add(queue.createResendCandidate(message2));
+ queue.purgeAcknowledged(sequence);
+ assertEquals("unexpected unacked map size",
+ 0,
+ queue.getUnacknowledged().size());
+ assertEquals("unexpected unacked list size",
+ 0,
+ sequenceList.size());
+ }
@Test
public void testIsEmpty() {
@@ -382,8 +410,16 @@
}
}
if (includesAcked) {
+ // Will be called once or twice depending on whether any more
+ // unacknowledged messages are left for this sequence
sequence.getIdentifier();
- EasyMock.expectLastCall().andReturn(id);
+ EasyMock.expectLastCall().andReturn(id).times(1, 2);
+
+ // Would be called only when there are no more
+ // unacknowledged messages left for this sequence
+ id.getValue();
+ EasyMock.expectLastCall().andReturn(sid).times(0, 1);
+
RMStore store = createMock(RMStore.class);
manager.getStore();
EasyMock.expectLastCall().andReturn(store);