Search in sources :

Example 61 with Identifier

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());
    }
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) ArrayList(java.util.ArrayList) SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement) Test(org.junit.Test)

Example 62 with Identifier

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();
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) Test(org.junit.Test)

Example 63 with Identifier

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);
}
Also used : InterceptorChain(org.apache.cxf.interceptor.InterceptorChain) Identifier(org.apache.cxf.ws.rm.v200702.Identifier) Message(org.apache.cxf.message.Message) Method(java.lang.reflect.Method) SequenceType(org.apache.cxf.ws.rm.v200702.SequenceType) Test(org.junit.Test)

Example 64 with Identifier

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());
    }
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) Message(org.apache.cxf.message.Message) SequenceType(org.apache.cxf.ws.rm.v200702.SequenceType) Test(org.junit.Test)

Example 65 with Identifier

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));
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) Test(org.junit.Test)

Aggregations

Identifier (org.apache.cxf.ws.rm.v200702.Identifier)72 ArrayList (java.util.ArrayList)71 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)59 Test (org.junit.Test)52 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)50 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)50 ExecutionException (java.util.concurrent.ExecutionException)38 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)37 Logger (org.slf4j.Logger)35 LoggerFactory (org.slf4j.LoggerFactory)35 Inject (javax.inject.Inject)32 Singleton (javax.inject.Singleton)32 DataBroker (org.opendaylight.mdsal.binding.api.DataBroker)32 LogicalDatastoreType (org.opendaylight.mdsal.common.api.LogicalDatastoreType)32 PreDestroy (javax.annotation.PreDestroy)30 ManagedNewTransactionRunner (org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner)30 ManagedNewTransactionRunnerImpl (org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl)30 Executors (org.opendaylight.infrautils.utils.concurrent.Executors)28 CONFIGURATION (org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION)27 AbstractAsyncDataTreeChangeListener (org.opendaylight.serviceutils.tools.listener.AbstractAsyncDataTreeChangeListener)26