Search in sources :

Example 31 with Identifier

use of org.orcid.jaxb.model.record.summary_rc1.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 32 with Identifier

use of org.orcid.jaxb.model.record.summary_rc1.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 33 with Identifier

use of org.orcid.jaxb.model.record.summary_rc1.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)

Example 34 with Identifier

use of org.orcid.jaxb.model.record.summary_rc1.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 35 with Identifier

use of org.orcid.jaxb.model.record.summary_rc1.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)

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