Search in sources :

Example 56 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 RetransmissionQueueImpl method cacheUnacknowledged.

/**
 * Accepts a new resend candidate.
 *
 * @param message the message object.
 * @return ResendCandidate
 */
protected ResendCandidate cacheUnacknowledged(Message message) {
    RMProperties rmps = RMContextUtils.retrieveRMProperties(message, true);
    SequenceType st = rmps.getSequence();
    Identifier sid = st.getIdentifier();
    String key = sid.getValue();
    final ResendCandidate candidate;
    synchronized (this) {
        List<ResendCandidate> sequenceCandidates = getSequenceCandidates(key);
        if (null == sequenceCandidates) {
            sequenceCandidates = new ArrayList<>();
            candidates.put(key, sequenceCandidates);
        }
        candidate = createResendCandidate(message);
        if (isSequenceSuspended(key)) {
            candidate.suspend();
        }
        sequenceCandidates.add(candidate);
        unacknowledgedCount++;
    }
    LOG.fine("Cached unacknowledged message.");
    try {
        RMEndpoint rme = manager.getReliableEndpoint(message);
        rme.handleAccept(key, st.getMessageNumber(), message);
    } catch (RMException e) {
        LOG.log(Level.WARNING, "Could not find reliable endpoint for message");
    }
    return candidate;
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) SequenceType(org.apache.cxf.ws.rm.v200702.SequenceType) RMEndpoint(org.apache.cxf.ws.rm.RMEndpoint) RMProperties(org.apache.cxf.ws.rm.RMProperties) RMException(org.apache.cxf.ws.rm.RMException)

Example 57 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 RedeliveryQueueImpl method cacheUndelivered.

/**
 * Accepts a new resend candidate.
 *
 * @param message the message.
 * @return ResendCandidate
 */
protected RedeliverCandidate cacheUndelivered(Message message) {
    RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false);
    SequenceType st = rmps.getSequence();
    Identifier sid = st.getIdentifier();
    String key = sid.getValue();
    RedeliverCandidate candidate;
    synchronized (this) {
        List<RedeliverCandidate> sequenceCandidates = getSequenceCandidates(key);
        if (null == sequenceCandidates) {
            sequenceCandidates = new ArrayList<>();
            candidates.put(key, sequenceCandidates);
        }
        candidate = getRedeliverCandidate(st, sequenceCandidates);
        if (candidate == null) {
            candidate = new RedeliverCandidate(message);
            if (isSequenceSuspended(key)) {
                candidate.suspend();
            }
            sequenceCandidates.add(candidate);
            undeliveredCount++;
        }
    }
    LOG.fine("Cached undelivered message.");
    return candidate;
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) SequenceType(org.apache.cxf.ws.rm.v200702.SequenceType) RMProperties(org.apache.cxf.ws.rm.RMProperties)

Example 58 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 RedeliveryQueueImpl method purgeDelivered.

protected void purgeDelivered(RedeliverCandidate candidate) {
    RMProperties rmps = RMContextUtils.retrieveRMProperties(candidate.getMessage(), false);
    SequenceType st = rmps.getSequence();
    Identifier sid = st.getIdentifier();
    String key = sid.getValue();
    synchronized (this) {
        List<RedeliverCandidate> sequenceCandidates = getSequenceCandidates(key);
        if (null != sequenceCandidates) {
            // TODO use a constant op instead of this inefficient linear op
            sequenceCandidates.remove(candidate);
            undeliveredCount--;
        }
        if (sequenceCandidates.isEmpty()) {
            candidates.remove(sid.getValue());
        }
    }
    LOG.fine("Purged delivered message.");
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) SequenceType(org.apache.cxf.ws.rm.v200702.SequenceType) RMProperties(org.apache.cxf.ws.rm.RMProperties)

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

Example 60 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 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(Long.valueOf(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(Long.valueOf(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)

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