Search in sources :

Example 11 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.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 12 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.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();
}
Also used : EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType) Message(org.apache.cxf.message.Message) RMMessage(org.apache.cxf.ws.rm.persistence.RMMessage) AttributedURIType(org.apache.cxf.ws.addressing.AttributedURIType) Method(java.lang.reflect.Method) CreateSequenceResponseType(org.apache.cxf.ws.rm.v200702.CreateSequenceResponseType) Exchange(org.apache.cxf.message.Exchange) Identifier(org.apache.cxf.ws.rm.v200702.Identifier) Conduit(org.apache.cxf.transport.Conduit) AddressingProperties(org.apache.cxf.ws.addressing.AddressingProperties) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 13 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Identifier in project cxf by apache.

the class RMManagerTest method setUpRecoverReliableEndpointWithAttachment.

void setUpRecoverReliableEndpointWithAttachment(Endpoint endpoint, Conduit conduit, SourceSequence ss, DestinationSequence ds, RMMessage m, Capture<Message> mc) throws IOException {
    RMStore store = control.createMock(RMStore.class);
    RetransmissionQueue oqueue = control.createMock(RetransmissionQueue.class);
    RedeliveryQueue iqueue = control.createMock(RedeliveryQueue.class);
    manager.setStore(store);
    manager.setRetransmissionQueue(oqueue);
    manager.setRedeliveryQueue(iqueue);
    Collection<SourceSequence> sss = new ArrayList<>();
    if (null != ss) {
        sss.add(ss);
    }
    EasyMock.expect(store.getSourceSequences("{S}s.{P}p@cxf")).andReturn(sss);
    if (null == ss) {
        return;
    }
    Collection<DestinationSequence> dss = new ArrayList<>();
    if (null != ds) {
        dss.add(ds);
    }
    EasyMock.expect(store.getDestinationSequences("{S}s.{P}p@cxf")).andReturn(dss);
    if (null == ds) {
        return;
    }
    Collection<RMMessage> ms = new ArrayList<>();
    if (null != m) {
        ms.add(m);
    }
    Identifier id = new Identifier();
    id.setValue("S1");
    EasyMock.expect(ss.getIdentifier()).andReturn(id).times(null == m ? 1 : 2);
    EasyMock.expect(ss.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408).anyTimes();
    EasyMock.expect(store.getMessages(id, true)).andReturn(ms);
    RMEndpoint rme = control.createMock(RMEndpoint.class);
    EasyMock.expect(manager.createReliableEndpoint(endpoint)).andReturn(rme);
    Source source = control.createMock(Source.class);
    EasyMock.expect(rme.getSource()).andReturn(source).anyTimes();
    Destination destination = control.createMock(Destination.class);
    EasyMock.expect(rme.getDestination()).andReturn(destination);
    destination.addSequence(ds, false);
    EasyMock.expectLastCall();
    Service service = control.createMock(Service.class);
    EasyMock.expect(endpoint.getService()).andReturn(service).anyTimes();
    Binding binding = control.createMock(Binding.class);
    EasyMock.expect(endpoint.getBinding()).andReturn(binding).anyTimes();
    EasyMock.expect(ss.isLastMessage()).andReturn(true).anyTimes();
    EasyMock.expect(ss.getCurrentMessageNr()).andReturn(new Long(10)).anyTimes();
    if (null == m) {
        return;
    }
    oqueue.addUnacknowledged(EasyMock.capture(mc));
    EasyMock.expectLastCall();
    oqueue.start();
    EasyMock.expectLastCall();
    iqueue.start();
    EasyMock.expectLastCall();
}
Also used : Binding(org.apache.cxf.binding.Binding) SoapBinding(org.apache.cxf.binding.soap.SoapBinding) RMMessage(org.apache.cxf.ws.rm.persistence.RMMessage) ArrayList(java.util.ArrayList) Service(org.apache.cxf.service.Service) RMStore(org.apache.cxf.ws.rm.persistence.RMStore) Identifier(org.apache.cxf.ws.rm.v200702.Identifier)

Example 14 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.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);
    assertTrue(!id1.getValue().equals(id2.getValue()));
    control.replay();
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) Test(org.junit.Test)

Example 15 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Identifier in project cxf by apache.

the class RMManagerTest method setUpRecoverReliableEndpoint.

void setUpRecoverReliableEndpoint(Endpoint endpoint, Conduit conduit, SourceSequence ss, DestinationSequence ds, RMMessage m) throws IOException {
    RMStore store = control.createMock(RMStore.class);
    RetransmissionQueue oqueue = control.createMock(RetransmissionQueue.class);
    RedeliveryQueue iqueue = control.createMock(RedeliveryQueue.class);
    manager.setStore(store);
    manager.setRetransmissionQueue(oqueue);
    manager.setRedeliveryQueue(iqueue);
    Collection<SourceSequence> sss = new ArrayList<>();
    if (null != ss) {
        sss.add(ss);
    }
    EasyMock.expect(store.getSourceSequences("{S}s.{P}p@cxf")).andReturn(sss);
    if (null == ss) {
        return;
    }
    Collection<DestinationSequence> dss = new ArrayList<>();
    if (null != ds) {
        dss.add(ds);
    }
    EasyMock.expect(store.getDestinationSequences("{S}s.{P}p@cxf")).andReturn(dss);
    if (null == ds) {
        return;
    }
    Collection<RMMessage> ms = new ArrayList<>();
    if (null != m) {
        ms.add(m);
    }
    Identifier id = new Identifier();
    id.setValue("S1");
    EasyMock.expect(ss.getIdentifier()).andReturn(id).times(null == m ? 1 : 2);
    EasyMock.expect(ss.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408).anyTimes();
    EasyMock.expect(store.getMessages(id, true)).andReturn(ms);
    RMEndpoint rme = control.createMock(RMEndpoint.class);
    EasyMock.expect(manager.createReliableEndpoint(endpoint)).andReturn(rme);
    Source source = control.createMock(Source.class);
    EasyMock.expect(rme.getSource()).andReturn(source).anyTimes();
    Destination destination = control.createMock(Destination.class);
    EasyMock.expect(rme.getDestination()).andReturn(destination);
    destination.addSequence(ds, false);
    EasyMock.expectLastCall();
    Service service = control.createMock(Service.class);
    EasyMock.expect(endpoint.getService()).andReturn(service).anyTimes();
    Binding binding = control.createMock(Binding.class);
    EasyMock.expect(endpoint.getBinding()).andReturn(binding).anyTimes();
    EasyMock.expect(ss.isLastMessage()).andReturn(true).anyTimes();
    EasyMock.expect(ss.getCurrentMessageNr()).andReturn(new Long(10)).anyTimes();
    if (null == m) {
        return;
    }
    EasyMock.expect(m.getMessageNumber()).andReturn(new Long(10)).times(2);
    if (null == conduit) {
        EasyMock.expect(m.getTo()).andReturn("toAddress");
    }
    InputStream is = new ByteArrayInputStream(new byte[0]);
    CachedOutputStream cos = new CachedOutputStream();
    IOUtils.copy(is, cos);
    cos.flush();
    is.close();
    EasyMock.expect(m.getContent()).andReturn(cos).anyTimes();
    oqueue.addUnacknowledged(EasyMock.isA(Message.class));
    EasyMock.expectLastCall();
    oqueue.start();
    EasyMock.expectLastCall();
    iqueue.start();
    EasyMock.expectLastCall();
}
Also used : Binding(org.apache.cxf.binding.Binding) SoapBinding(org.apache.cxf.binding.soap.SoapBinding) Message(org.apache.cxf.message.Message) RMMessage(org.apache.cxf.ws.rm.persistence.RMMessage) RMMessage(org.apache.cxf.ws.rm.persistence.RMMessage) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) ArrayList(java.util.ArrayList) Service(org.apache.cxf.service.Service) RMStore(org.apache.cxf.ws.rm.persistence.RMStore) CachedOutputStream(org.apache.cxf.io.CachedOutputStream) Identifier(org.apache.cxf.ws.rm.v200702.Identifier) ByteArrayInputStream(java.io.ByteArrayInputStream)

Aggregations

Identifier (org.apache.cxf.ws.rm.v200702.Identifier)72 ArrayList (java.util.ArrayList)57 BigInteger (java.math.BigInteger)55 Test (org.junit.Test)52 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)35 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)30 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)29 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)25 NodeRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef)23 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)19 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)19 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)16 Uri (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)14 List (java.util.List)13 VpnInterface (org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.VpnInterface)13 VpnInterfaceOpDataEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntry)13 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)12 L2GatewayDevice (org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)11 Adjacency (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.Adjacency)10 Port (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port)10