use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.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.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project cxf by apache.
the class RMManagerTest method testDefaultSequenceIdentifierGenerator.
@Test
public void testDefaultSequenceIdentifierGenerator() {
manager = new RMManager();
assertNull(manager.getIdGenerator());
SequenceIdentifierGenerator generator = manager.new DefaultSequenceIdentifierGenerator();
manager.setIdGenerator(generator);
assertSame(generator, manager.getIdGenerator());
Identifier id1 = generator.generateSequenceIdentifier();
assertNotNull(id1);
assertNotNull(id1.getValue());
Identifier id2 = generator.generateSequenceIdentifier();
assertTrue(id1 != id2);
assertFalse(id1.getValue().equals(id2.getValue()));
control.replay();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.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.rev200120.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.rev200120.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));
}
Aggregations