use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class RMManagerTest method testGetExistingSequence.
@Test
public void testGetExistingSequence() throws NoSuchMethodException, SequenceFault, RMException {
Method m = RMManager.class.getDeclaredMethod("getSource", new Class[] { Message.class });
manager = control.createMock(RMManager.class, new Method[] { m });
Message message = control.createMock(Message.class);
Identifier inSid = control.createMock(Identifier.class);
Source source = control.createMock(Source.class);
EasyMock.expect(manager.getSource(message)).andReturn(source);
SourceSequence sseq = control.createMock(SourceSequence.class);
EasyMock.expect(source.getCurrent(inSid)).andReturn(sseq);
control.replay();
assertSame(sseq, manager.getSequence(inSid, message, null));
control.verify();
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class AbstractEndpointTest method testGenerateSequenceIdentifier.
@Test
public void testGenerateSequenceIdentifier() {
RMManager mgr = control.createMock(RMManager.class);
EasyMock.expect(rme.getManager()).andReturn(mgr);
SequenceIdentifierGenerator generator = control.createMock(SequenceIdentifierGenerator.class);
EasyMock.expect(mgr.getIdGenerator()).andReturn(generator);
Identifier id = control.createMock(Identifier.class);
EasyMock.expect(generator.generateSequenceIdentifier()).andReturn(id);
control.replay();
AbstractEndpoint tested = new AbstractEndpoint(rme);
assertSame(id, tested.generateSequenceIdentifier());
control.verify();
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class AbstractSequenceTest method testIdentifierEquals.
@Test
public void testIdentifierEquals() {
Identifier id1 = null;
Identifier id2 = null;
assertTrue(AbstractSequence.identifierEquals(id1, id2));
ObjectFactory factory = new ObjectFactory();
id1 = factory.createIdentifier();
id1.setValue("seq1");
assertFalse(AbstractSequence.identifierEquals(id1, id2));
id2 = factory.createIdentifier();
id2.setValue("seq2");
assertFalse(AbstractSequence.identifierEquals(id1, id2));
id2.setValue("seq1");
assertTrue(AbstractSequence.identifierEquals(id1, id2));
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class ServantTest method verifyTerminateSequenceDefault.
private void verifyTerminateSequenceDefault(Servant servant, RMManager manager, String sidstr, ProtocolVariation protocol) throws SequenceFault {
DestinationPolicyType dp = RMMANGER_FACTORY.createDestinationPolicyType();
AcksPolicyType ap = RMMANGER_FACTORY.createAcksPolicyType();
dp.setAcksPolicy(ap);
manager.setDestinationPolicy(dp);
Message message = createTestTerminateSequenceMessage(sidstr, protocol);
Object tsr = servant.terminateSequence(message);
if (ProtocolVariation.RM10WSA200408.getWSRMNamespace().equals(protocol.getWSRMNamespace())) {
// rm 1.0
assertNull(tsr);
} else {
// rm 1.1
assertTrue(tsr instanceof TerminateSequenceResponseType);
org.apache.cxf.ws.rm.v200702.Identifier sid = ((TerminateSequenceResponseType) tsr).getIdentifier();
assertNotNull(sid);
assertEquals(sidstr, sid.getValue());
}
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class RetransmissionQueueImplTest method setUpSequence.
private SourceSequence setUpSequence(String sid, Long[] messageNumbers, boolean[] isAcked) {
SourceSequence sequence = createMock(SourceSequence.class);
Identifier id = createMock(Identifier.class);
sequence.getIdentifier();
EasyMock.expectLastCall().andReturn(id).anyTimes();
id.getValue();
EasyMock.expectLastCall().andReturn(sid).anyTimes();
identifiers.add(id);
Source source = createMock(Source.class);
sequence.getSource();
EasyMock.expectLastCall().andReturn(source).anyTimes();
source.getReliableEndpoint();
EasyMock.expectLastCall().andReturn(endpoint).anyTimes();
boolean includesAcked = false;
for (int i = 0; isAcked != null && i < isAcked.length; i++) {
sequence.isAcknowledged(messageNumbers[i]);
EasyMock.expectLastCall().andReturn(isAcked[i]);
if (isAcked[i]) {
includesAcked = true;
}
}
if (includesAcked) {
RMStore store = createMock(RMStore.class);
manager.getStore();
EasyMock.expectLastCall().andReturn(store);
}
return sequence;
}
Aggregations