Search in sources :

Example 16 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 RMOutInterceptorTest method testHandleApplicationMessage.

@Test
public void testHandleApplicationMessage() throws NoSuchMethodException, SequenceFault, RMException {
    AddressingProperties maps = createMAPs("greetMe", "localhost:9000/GreeterPort", org.apache.cxf.ws.addressing.Names.WSA_NONE_ADDRESS);
    Method[] mocked = new Method[] { AbstractRMInterceptor.class.getDeclaredMethod("getManager", new Class[] {}), RMOutInterceptor.class.getDeclaredMethod("isRuntimeFault", new Class[] { Message.class }), RMOutInterceptor.class.getDeclaredMethod("addAcknowledgements", new Class[] { Destination.class, RMProperties.class, Identifier.class, AttributedURIType.class }) };
    RMOutInterceptor interceptor = EasyMock.createMockBuilder(RMOutInterceptor.class).addMockedMethods(mocked).createMock(control);
    RMManager manager = control.createMock(RMManager.class);
    EasyMock.expect(interceptor.getManager()).andReturn(manager).anyTimes();
    Message message = control.createMock(Message.class);
    EasyMock.expect(interceptor.isRuntimeFault(message)).andReturn(false).anyTimes();
    Exchange ex = control.createMock(Exchange.class);
    EasyMock.expect(message.getExchange()).andReturn(ex).anyTimes();
    EasyMock.expect(ex.getOutMessage()).andReturn(message).anyTimes();
    EasyMock.expect(ex.put("defer.uncorrelated.message.abort", Boolean.TRUE)).andReturn(null).anyTimes();
    EasyMock.expect(message.get(Message.REQUESTOR_ROLE)).andReturn(Boolean.TRUE).anyTimes();
    EasyMock.expect(message.get(JAXWSAConstants.ADDRESSING_PROPERTIES_OUTBOUND)).andReturn(maps).anyTimes();
    RMProperties rmpsOut = new RMProperties();
    EasyMock.expect(message.get(RMMessageConstants.RM_PROPERTIES_OUTBOUND)).andReturn(rmpsOut).anyTimes();
    InterceptorChain chain = control.createMock(InterceptorChain.class);
    EasyMock.expect(message.getInterceptorChain()).andReturn(chain).anyTimes();
    EasyMock.expectLastCall();
    RMEndpoint rme = control.createMock(RMEndpoint.class);
    RMConfiguration config = new RMConfiguration();
    config.setRMNamespace(RM10Constants.NAMESPACE_URI);
    config.setRM10AddressingNamespace(Names200408.WSA_NAMESPACE_NAME);
    EasyMock.expect(rme.getConfiguration()).andReturn(config).anyTimes();
    EasyMock.expect(manager.getEffectiveConfiguration(message)).andReturn(config).anyTimes();
    Source source = control.createMock(Source.class);
    EasyMock.expect(source.getReliableEndpoint()).andReturn(rme).anyTimes();
    EasyMock.expect(manager.getSource(message)).andReturn(source).anyTimes();
    Destination destination = control.createMock(Destination.class);
    EasyMock.expect(manager.getDestination(message)).andReturn(destination).anyTimes();
    SourceSequence sseq = control.createMock(SourceSequence.class);
    EasyMock.expect(sseq.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408).anyTimes();
    EasyMock.expect(manager.getSequence((Identifier) EasyMock.isNull(), EasyMock.same(message), EasyMock.same(maps))).andReturn(sseq).anyTimes();
    EasyMock.expect(sseq.nextMessageNumber((Identifier) EasyMock.isNull(), (Long) EasyMock.eq(0L), EasyMock.eq(false))).andReturn(new Long(10)).anyTimes();
    EasyMock.expect(sseq.isLastMessage()).andReturn(false).anyTimes();
    interceptor.addAcknowledgements(EasyMock.same(destination), EasyMock.same(rmpsOut), (Identifier) EasyMock.isNull(), EasyMock.isA(AttributedURIType.class));
    EasyMock.expectLastCall();
    Identifier sid = control.createMock(Identifier.class);
    EasyMock.expect(sseq.getIdentifier()).andReturn(sid).anyTimes();
    EasyMock.expect(sseq.getCurrentMessageNr()).andReturn(new Long(10)).anyTimes();
    control.replay();
    interceptor.handle(message);
    control.verify();
}
Also used : Message(org.apache.cxf.message.Message) AttributedURIType(org.apache.cxf.ws.addressing.AttributedURIType) Method(java.lang.reflect.Method) Exchange(org.apache.cxf.message.Exchange) InterceptorChain(org.apache.cxf.interceptor.InterceptorChain) Identifier(org.apache.cxf.ws.rm.v200702.Identifier) AddressingProperties(org.apache.cxf.ws.addressing.AddressingProperties) Test(org.junit.Test)

Example 17 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 ServantTest method createTestTerminateSequenceMessage.

private static Message createTestTerminateSequenceMessage(String sidstr, ProtocolVariation protocol) {
    Message message = new MessageImpl();
    Exchange exchange = new ExchangeImpl();
    exchange.setInMessage(message);
    message.put(Message.REQUESTOR_ROLE, Boolean.FALSE);
    AddressingProperties maps = new AddressingProperties();
    String msgId = "urn:uuid:12345-" + Math.random();
    AttributedURIType id = ContextUtils.getAttributedURI(msgId);
    maps.setMessageID(id);
    maps.setAction(ContextUtils.getAttributedURI(RM10Constants.INSTANCE.getTerminateSequenceAction()));
    maps.setTo(ContextUtils.getAttributedURI(SERVICE_URL));
    maps.setReplyTo(RMUtils.createReference(DECOUPLED_URL));
    message.put(JAXWSAConstants.ADDRESSING_PROPERTIES_INBOUND, maps);
    TerminateSequenceType ts = new TerminateSequenceType();
    Identifier sid = new Identifier();
    sid.setValue(sidstr);
    ts.setIdentifier(sid);
    Object tst = ProtocolVariation.RM10WSA200408.getWSRMNamespace().equals(protocol.getWSRMNamespace()) ? ts : ProtocolVariation.RM10WSA200408.getCodec().convertReceivedTerminateSequence(ts);
    MessageContentsList contents = new MessageContentsList();
    contents.add(tst);
    message.setContent(List.class, contents);
    RMContextUtils.setProtocolVariation(message, protocol);
    return message;
}
Also used : Exchange(org.apache.cxf.message.Exchange) Identifier(org.apache.cxf.ws.rm.v200502.Identifier) Message(org.apache.cxf.message.Message) MessageContentsList(org.apache.cxf.message.MessageContentsList) AttributedURIType(org.apache.cxf.ws.addressing.AttributedURIType) TerminateSequenceType(org.apache.cxf.ws.rm.v200502.TerminateSequenceType) AddressingProperties(org.apache.cxf.ws.addressing.AddressingProperties) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl)

Example 18 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 ServantTest method createTestCloseSequenceMessage.

private static Message createTestCloseSequenceMessage(String sidstr) {
    Message message = new MessageImpl();
    Exchange exchange = new ExchangeImpl();
    exchange.setInMessage(message);
    message.put(Message.REQUESTOR_ROLE, Boolean.FALSE);
    AddressingProperties maps = new AddressingProperties();
    String msgId = "urn:uuid:12345-" + Math.random();
    AttributedURIType id = ContextUtils.getAttributedURI(msgId);
    maps.setMessageID(id);
    maps.setAction(ContextUtils.getAttributedURI(RM10Constants.INSTANCE.getTerminateSequenceAction()));
    maps.setTo(ContextUtils.getAttributedURI(SERVICE_URL));
    maps.setReplyTo(RMUtils.createReference(DECOUPLED_URL));
    message.put(JAXWSAConstants.ADDRESSING_PROPERTIES_INBOUND, maps);
    CloseSequenceType cs = new CloseSequenceType();
    org.apache.cxf.ws.rm.v200702.Identifier sid = new org.apache.cxf.ws.rm.v200702.Identifier();
    sid.setValue(sidstr);
    cs.setIdentifier(sid);
    MessageContentsList contents = new MessageContentsList();
    contents.add(cs);
    message.setContent(List.class, contents);
    RMContextUtils.setProtocolVariation(message, ProtocolVariation.RM11WSA200508);
    return message;
}
Also used : Message(org.apache.cxf.message.Message) MessageContentsList(org.apache.cxf.message.MessageContentsList) AttributedURIType(org.apache.cxf.ws.addressing.AttributedURIType) Exchange(org.apache.cxf.message.Exchange) Identifier(org.apache.cxf.ws.rm.v200502.Identifier) CloseSequenceType(org.apache.cxf.ws.rm.v200702.CloseSequenceType) AddressingProperties(org.apache.cxf.ws.addressing.AddressingProperties) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl)

Example 19 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 RMOutInterceptor method addAckRequest.

/**
 * Add AcknowledgementRequested to message if needed. The AckRequest mode set either in the message
 * properties or in the source policy is used to determine whether AcknowledgementRequested is always
 * added, never added, or added only when we're waiting for the acknowledgement to a previously-sent
 * message.
 *
 * @param msg
 * @param rmpsIn
 * @param seq
 * @param sequence
 */
protected void addAckRequest(Message msg, RMProperties rmpsIn, SourceSequence seq, SequenceType sequence) {
    AckRequestModeType mode = (AckRequestModeType) msg.get(RMMessageConstants.ACK_REQUEST_MODE);
    if (mode == null) {
        mode = AckRequestModeType.PENDING;
        SourcePolicyType policy = getManager().getSourcePolicy();
        if (policy.isSetAckRequestMode()) {
            mode = policy.getAckRequestMode();
        }
    }
    if (AckRequestModeType.ALWAYS == mode || (mode == AckRequestModeType.PENDING && seq.needAcknowledge(rmpsIn.getMessageNumber()))) {
        Collection<AckRequestedType> reqs = rmpsIn.getAcksRequested();
        if (reqs == null) {
            reqs = new ArrayList<>();
        }
        Identifier identifier = new Identifier();
        identifier.setValue(sequence.getIdentifier().getValue());
        AckRequestedType ackRequest = new AckRequestedType();
        ackRequest.setIdentifier(identifier);
        reqs.add(ackRequest);
        rmpsIn.setAcksRequested(reqs);
    }
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) AckRequestModeType(org.apache.cxf.ws.rm.manager.AckRequestModeType) SourcePolicyType(org.apache.cxf.ws.rm.manager.SourcePolicyType) AckRequestedType(org.apache.cxf.ws.rm.v200702.AckRequestedType)

Example 20 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 Servant method clearUnattachedIdentifier.

Identifier clearUnattachedIdentifier() {
    Identifier ret = unattachedIdentifier;
    unattachedIdentifier = null;
    return ret;
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier)

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