use of org.apache.cxf.ws.rm.v200502.Identifier in project cxf by apache.
the class SourceSequenceTest method testCheckOfferingSequenceClosed.
@Test
public void testCheckOfferingSequenceClosed() {
SourceSequence seq = null;
setUpSource();
RMEndpoint rme = control.createMock(RMEndpoint.class);
EasyMock.expect(source.getReliableEndpoint()).andReturn(rme).anyTimes();
Destination destination = control.createMock(Destination.class);
EasyMock.expect(rme.getDestination()).andReturn(destination).anyTimes();
DestinationSequence dseq = control.createMock(DestinationSequence.class);
Identifier did = control.createMock(Identifier.class);
EasyMock.expect(destination.getSequence(did)).andReturn(dseq).anyTimes();
EasyMock.expect(dseq.getLastMessageNumber()).andReturn(new Long(1)).anyTimes();
EasyMock.expect(did.getValue()).andReturn("dseq").anyTimes();
control.replay();
seq = new SourceSequence(id, null, did, ProtocolVariation.RM10WSA200408);
seq.setSource(source);
seq.nextMessageNumber(did, 1, false);
assertTrue(seq.isLastMessage());
control.verify();
}
use of org.apache.cxf.ws.rm.v200502.Identifier in project cxf by apache.
the class SourceSequenceTest method testConstructors.
@Test
public void testConstructors() {
Identifier otherId = factory.createIdentifier();
otherId.setValue("otherSeq");
SourceSequence seq = null;
seq = new SourceSequence(id, ProtocolVariation.RM10WSA200408);
assertEquals(id, seq.getIdentifier());
assertTrue(!seq.isLastMessage());
assertTrue(!seq.isExpired());
assertEquals(0, seq.getCurrentMessageNr());
assertNotNull(seq.getAcknowledgement());
assertEquals(0, seq.getAcknowledgement().getAcknowledgementRange().size());
assertTrue(!seq.allAcknowledged());
assertFalse(seq.offeredBy(otherId));
Date expiry = new Date(System.currentTimeMillis() + 3600 * 1000);
seq = new SourceSequence(id, expiry, null, ProtocolVariation.RM10WSA200408);
assertEquals(id, seq.getIdentifier());
assertTrue(!seq.isLastMessage());
assertTrue(!seq.isExpired());
assertEquals(0, seq.getCurrentMessageNr());
assertNotNull(seq.getAcknowledgement());
assertEquals(0, seq.getAcknowledgement().getAcknowledgementRange().size());
assertTrue(!seq.allAcknowledged());
assertFalse(seq.offeredBy(otherId));
seq = new SourceSequence(id, expiry, otherId, ProtocolVariation.RM10WSA200408);
assertTrue(seq.offeredBy(otherId));
assertFalse(seq.offeredBy(id));
}
Aggregations