use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class DestinationTest method testGetSequence.
@Test
public void testGetSequence() {
Identifier id = control.createMock(Identifier.class);
String sid = "s1";
EasyMock.expect(id.getValue()).andReturn(sid);
control.replay();
assertNull(destination.getSequence(id));
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class ManagedRMManagerTest method createTestSourceSequence.
private SourceSequence createTestSourceSequence(Source source, String sid, EndpointReferenceType to, ProtocolVariation protocol, long[] acked) {
Identifier identifier = RMUtils.getWSRMFactory().createIdentifier();
identifier.setValue(sid);
SourceSequence ss = new SourceSequence(identifier, protocol);
ss.setSource(source);
ss.setTarget(to);
List<SequenceAcknowledgement.AcknowledgementRange> ranges = ss.getAcknowledgement().getAcknowledgementRange();
for (int i = 0; i < acked.length; i += 2) {
ranges.add(createAcknowledgementRange(acked[i], acked[i + 1]));
}
return ss;
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class RMEndpointTest method testShutdown.
@Test
public void testShutdown() {
DestinationSequence ds = control.createMock(DestinationSequence.class);
Identifier did = control.createMock(Identifier.class);
EasyMock.expect(ds.getIdentifier()).andReturn(did).anyTimes();
EasyMock.expect(ds.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408).anyTimes();
String d = "d";
EasyMock.expect(did.getValue()).andReturn(d).anyTimes();
SourceSequence ss = control.createMock(SourceSequence.class);
Identifier sid = control.createMock(Identifier.class);
EasyMock.expect(ss.getIdentifier()).andReturn(sid).anyTimes();
EasyMock.expect(ss.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408).anyTimes();
String s = "s";
EasyMock.expect(sid.getValue()).andReturn(s).anyTimes();
ds.cancelDeferredAcknowledgments();
EasyMock.expectLastCall().anyTimes();
ds.cancelTermination();
EasyMock.expectLastCall().anyTimes();
RetransmissionQueue queue = control.createMock(RetransmissionQueue.class);
EasyMock.expect(manager.getRetransmissionQueue()).andReturn(queue).anyTimes();
queue.stop(ss);
EasyMock.expectLastCall().anyTimes();
RedeliveryQueue dqueue = control.createMock(RedeliveryQueue.class);
EasyMock.expect(manager.getRedeliveryQueue()).andReturn(dqueue).anyTimes();
dqueue.stop(ds);
EasyMock.expectLastCall().anyTimes();
control.replay();
rme.getDestination().addSequence(ds, false);
rme.getSource().addSequence(ss, false);
rme.shutdown();
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class RMInInterceptorTest method testProcessAcknowledgments.
@Test
public void testProcessAcknowledgments() throws RMException {
interceptor = new RMInInterceptor();
manager = control.createMock(RMManager.class);
Source source = control.createMock(Source.class);
rme = control.createMock(RMEndpoint.class);
EasyMock.expect(rme.getSource()).andReturn(source).anyTimes();
interceptor.setManager(manager);
SequenceAcknowledgement ack1 = control.createMock(SequenceAcknowledgement.class);
SequenceAcknowledgement ack2 = control.createMock(SequenceAcknowledgement.class);
Collection<SequenceAcknowledgement> acks = new ArrayList<>();
acks.add(ack1);
acks.add(ack2);
EasyMock.expect(rmps.getAcks()).andReturn(acks);
Identifier id1 = control.createMock(Identifier.class);
EasyMock.expect(ack1.getIdentifier()).andReturn(id1);
SourceSequence ss1 = control.createMock(SourceSequence.class);
EasyMock.expect(source.getSequence(id1)).andReturn(ss1);
ss1.setAcknowledged(ack1);
EasyMock.expectLastCall();
Identifier id2 = control.createMock(Identifier.class);
EasyMock.expect(ack2.getIdentifier()).andReturn(id2);
EasyMock.expect(source.getSequence(id2)).andReturn(null);
control.replay();
try {
interceptor.processAcknowledgments(rme, rmps, ProtocolVariation.RM10WSA200408);
fail("Expected SequenceFault not thrown");
} catch (SequenceFault sf) {
assertEquals(RM10Constants.UNKNOWN_SEQUENCE_FAULT_QNAME, sf.getFaultCode());
}
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class RMManagerTest method testGetNewSequence.
@Test
public void testGetNewSequence() 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);
Exchange exchange = control.createMock(Exchange.class);
EasyMock.expect(message.getContextualPropertyKeys()).andReturn(new HashSet<>()).anyTimes();
EasyMock.expect(message.getExchange()).andReturn(exchange).anyTimes();
EasyMock.expect(exchange.getOutMessage()).andReturn(message).anyTimes();
EasyMock.expect(exchange.getInMessage()).andReturn(null).anyTimes();
EasyMock.expect(exchange.getOutFaultMessage()).andReturn(null).anyTimes();
Conduit conduit = control.createMock(Conduit.class);
EasyMock.expect(exchange.getConduit(message)).andReturn(conduit).anyTimes();
Identifier inSid = control.createMock(Identifier.class);
AddressingProperties maps = control.createMock(AddressingProperties.class);
Source source = control.createMock(Source.class);
EasyMock.expect(manager.getSource(message)).andReturn(source);
EasyMock.expect(source.getCurrent(inSid)).andReturn(null);
AttributedURIType uri = control.createMock(AttributedURIType.class);
EasyMock.expect(maps.getTo()).andReturn(uri);
EasyMock.expect(uri.getValue()).andReturn("http://localhost:9001/TestPort");
EndpointReferenceType epr = RMUtils.createNoneReference();
EasyMock.expect(maps.getReplyTo()).andReturn(epr);
RMEndpoint rme = control.createMock(RMEndpoint.class);
EasyMock.expect(source.getReliableEndpoint()).andReturn(rme).times(2);
Proxy proxy = control.createMock(Proxy.class);
EasyMock.expect(rme.getProxy()).andReturn(proxy);
CreateSequenceResponseType createResponse = control.createMock(CreateSequenceResponseType.class);
proxy.createSequence(EasyMock.isA(EndpointReferenceType.class), (RelatesToType) EasyMock.isNull(), EasyMock.eq(false), EasyMock.isA(ProtocolVariation.class), EasyMock.isA(Exchange.class), CastUtils.cast(EasyMock.isA(HashMap.class), String.class, Object.class));
EasyMock.expectLastCall().andReturn(createResponse);
Servant servant = control.createMock(Servant.class);
EasyMock.expect(rme.getServant()).andReturn(servant);
servant.createSequenceResponse(createResponse, ProtocolVariation.RM10WSA200408);
EasyMock.expectLastCall();
SourceSequence sseq = control.createMock(SourceSequence.class);
EasyMock.expect(source.awaitCurrent(inSid)).andReturn(sseq);
sseq.setTarget(EasyMock.isA(EndpointReferenceType.class));
EasyMock.expectLastCall();
control.replay();
assertSame(sseq, manager.getSequence(inSid, message, maps));
control.verify();
}
Aggregations