use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Identifier in project cxf by apache.
the class DestinationTest method testAcknowledgeAlreadyAcknowledgedMessage.
@Test
public void testAcknowledgeAlreadyAcknowledgedMessage() throws SequenceFault, RMException, NoSuchMethodException, IOException {
Method m1 = Destination.class.getDeclaredMethod("getSequence", new Class[] { Identifier.class });
destination = EasyMock.createMockBuilder(Destination.class).addMockedMethod(m1).createMock(control);
Message message = setupMessage();
RMProperties rmps = control.createMock(RMProperties.class);
EasyMock.expect(message.get(RMMessageConstants.RM_PROPERTIES_INBOUND)).andReturn(rmps);
SequenceType st = control.createMock(SequenceType.class);
EasyMock.expect(rmps.getSequence()).andReturn(st);
Identifier id = control.createMock(Identifier.class);
EasyMock.expect(st.getIdentifier()).andReturn(id);
DestinationSequence ds = control.createMock(DestinationSequence.class);
EasyMock.expect(destination.getSequence(id)).andReturn(ds);
long nr = 10;
EasyMock.expect(st.getMessageNumber()).andReturn(nr);
ds.applyDeliveryAssurance(nr, message);
EasyMock.expectLastCall().andReturn(false);
InterceptorChain ic = control.createMock(InterceptorChain.class);
EasyMock.expect(message.getInterceptorChain()).andReturn(ic);
control.replay();
destination.acknowledge(message);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Identifier in project cxf by apache.
the class DestinationTest method testAcknowledgeUnknownSequence.
@Test
public void testAcknowledgeUnknownSequence() throws RMException, IOException {
Message message = setupMessage();
RMProperties rmps = control.createMock(RMProperties.class);
EasyMock.expect(message.get(RMMessageConstants.RM_PROPERTIES_INBOUND)).andReturn(rmps);
EasyMock.expect(RMContextUtils.getProtocolVariation(message)).andReturn(ProtocolVariation.RM10WSA200408);
SequenceType st = control.createMock(SequenceType.class);
EasyMock.expect(rmps.getSequence()).andReturn(st);
Identifier id = control.createMock(Identifier.class);
EasyMock.expect(st.getIdentifier()).andReturn(id).times(2);
String sid = "sid";
EasyMock.expect(id.getValue()).andReturn(sid);
control.replay();
try {
destination.acknowledge(message);
fail("Expected SequenceFault not thrown.");
} catch (SequenceFault ex) {
assertEquals(RM10Constants.UNKNOWN_SEQUENCE_FAULT_QNAME, ex.getFaultCode());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.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.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.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.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.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();
}
Aggregations