Search in sources :

Example 56 with Identifier

use of org.orcid.jaxb.model.record.summary_rc1.Identifier in project cxf by apache.

the class RMInInterceptor method processAcknowledgments.

void processAcknowledgments(RMEndpoint rme, RMProperties rmps, ProtocolVariation protocol) throws SequenceFault, RMException {
    Collection<SequenceAcknowledgement> acks = rmps.getAcks();
    Source source = rme.getSource();
    if (null != acks) {
        for (SequenceAcknowledgement ack : acks) {
            Identifier id = ack.getIdentifier();
            SourceSequence ss = source.getSequence(id);
            if (null != ss) {
                ss.setAcknowledged(ack);
            } else {
                RMConstants consts = protocol.getConstants();
                SequenceFaultFactory sff = new SequenceFaultFactory(consts);
                throw sff.createUnknownSequenceFault(id);
            }
        }
    }
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)

Example 57 with Identifier

use of org.orcid.jaxb.model.record.summary_rc1.Identifier in project cxf by apache.

the class RetransmissionQueueImpl method purgeCandidates.

private void purgeCandidates(SourceSequence seq, boolean any) {
    Collection<Long> purged = new ArrayList<>();
    Collection<ResendCandidate> resends = new ArrayList<>();
    Identifier sid = seq.getIdentifier();
    synchronized (this) {
        LOG.fine("Start purging resend candidates.");
        List<ResendCandidate> sequenceCandidates = getSequenceCandidates(seq);
        if (null != sequenceCandidates) {
            for (int i = sequenceCandidates.size() - 1; i >= 0; i--) {
                ResendCandidate candidate = sequenceCandidates.get(i);
                long m = candidate.getNumber();
                if (any || seq.isAcknowledged(m)) {
                    sequenceCandidates.remove(i);
                    candidate.resolved();
                    unacknowledgedCount--;
                    purged.add(m);
                    resends.add(candidate);
                }
            }
            if (sequenceCandidates.isEmpty()) {
                candidates.remove(sid.getValue());
            }
        }
        LOG.fine("Completed purging resend candidates.");
    }
    if (!purged.isEmpty()) {
        RMStore store = manager.getStore();
        if (null != store) {
            store.removeMessages(sid, purged, true);
        }
        RMEndpoint rmEndpoint = seq.getSource().getReliableEndpoint();
        for (ResendCandidate resend : resends) {
            rmEndpoint.handleAcknowledgment(sid.getValue(), resend.getNumber(), resend.getMessage());
        }
    }
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) ArrayList(java.util.ArrayList) RMStore(org.apache.cxf.ws.rm.persistence.RMStore) RMEndpoint(org.apache.cxf.ws.rm.RMEndpoint) RMEndpoint(org.apache.cxf.ws.rm.RMEndpoint) Endpoint(org.apache.cxf.endpoint.Endpoint)

Example 58 with Identifier

use of org.orcid.jaxb.model.record.summary_rc1.Identifier in project cxf by apache.

the class DestinationSequenceTest method testConstructors.

@Test
public void testConstructors() {
    Identifier otherId = factory.createIdentifier();
    otherId.setValue("otherSeq");
    DestinationSequence seq = new DestinationSequence(id, ref, destination, ProtocolVariation.RM10WSA200408);
    assertEquals(id, seq.getIdentifier());
    assertEquals(0L, seq.getLastMessageNumber());
    assertSame(ref, seq.getAcksTo());
    assertNotNull(seq.getAcknowledgment());
    assertNotNull(seq.getMonitor());
    SequenceAcknowledgement ack = new SequenceAcknowledgement();
    seq = new DestinationSequence(id, ref, 10L, ack, ProtocolVariation.RM10WSA200408);
    assertEquals(id, seq.getIdentifier());
    assertEquals(10L, seq.getLastMessageNumber());
    assertSame(ref, seq.getAcksTo());
    assertSame(ack, seq.getAcknowledgment());
    assertNotNull(seq.getMonitor());
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement) Test(org.junit.Test)

Example 59 with Identifier

use of org.orcid.jaxb.model.record.summary_rc1.Identifier in project cxf by apache.

the class ManagedRMManagerTest method createTestDestinationSequence.

private DestinationSequence createTestDestinationSequence(Destination destination, String sid, EndpointReferenceType to, ProtocolVariation protocol, long[] acked) {
    Identifier identifier = RMUtils.getWSRMFactory().createIdentifier();
    identifier.setValue(sid);
    DestinationSequence ds = new DestinationSequence(identifier, to, null, protocol);
    ds.setDestination(destination);
    List<SequenceAcknowledgement.AcknowledgementRange> ranges = ds.getAcknowledgment().getAcknowledgementRange();
    for (int i = 0; i < acked.length; i += 2) {
        ranges.add(createAcknowledgementRange(acked[i], acked[i + 1]));
    }
    return ds;
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) Endpoint(org.apache.cxf.endpoint.Endpoint)

Example 60 with Identifier

use of org.orcid.jaxb.model.record.summary_rc1.Identifier in project cxf by apache.

the class RMTxStoreTestBase method testGetSourceSequence.

@Test
public void testGetSourceSequence() throws SQLException, IOException {
    Identifier sid1 = null;
    Identifier sid2 = null;
    SourceSequence seq = store.getSourceSequence(new Identifier());
    assertNull(seq);
    try {
        sid1 = setupSourceSequence("sequence1");
        seq = store.getSourceSequence(sid1);
        assertNotNull(seq);
        verifySourceSequence("sequence1", seq);
        sid2 = setupSourceSequence("sequence2");
        seq = store.getSourceSequence(sid2);
        assertNotNull(seq);
        verifySourceSequence("sequence2", seq);
    } finally {
        if (null != sid1) {
            store.removeSourceSequence(sid1);
        }
        if (null != sid2) {
            store.removeSourceSequence(sid2);
        }
    }
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) SourceSequence(org.apache.cxf.ws.rm.SourceSequence) Test(org.junit.Test)

Aggregations

Identifier (org.apache.cxf.ws.rm.v200702.Identifier)72 Test (org.junit.Test)43 Message (org.apache.cxf.message.Message)11 SourceSequence (org.apache.cxf.ws.rm.SourceSequence)11 RMMessage (org.apache.cxf.ws.rm.persistence.RMMessage)11 SequenceAcknowledgement (org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)11 Connection (java.sql.Connection)9 AddressingProperties (org.apache.cxf.ws.addressing.AddressingProperties)8 SQLException (java.sql.SQLException)7 ArrayList (java.util.ArrayList)7 Date (java.util.Date)7 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)7 DestinationSequence (org.apache.cxf.ws.rm.DestinationSequence)7 Method (java.lang.reflect.Method)6 AttributedURIType (org.apache.cxf.ws.addressing.AttributedURIType)6 RMStore (org.apache.cxf.ws.rm.persistence.RMStore)6 SequenceType (org.apache.cxf.ws.rm.v200702.SequenceType)6 SoapBinding (org.apache.cxf.binding.soap.SoapBinding)5 ProtocolVariation (org.apache.cxf.ws.rm.ProtocolVariation)5 Identifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Identifier)5