Search in sources :

Example 21 with SequenceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.SequenceType in project cxf by apache.

the class RetransmissionQueueImplTest method setUpSequenceType.

private SequenceType setUpSequenceType(Message message, String sid, Long messageNumber) {
    RMProperties rmps = createMock(RMProperties.class);
    if (message != null) {
        message.get(RMMessageConstants.RM_PROPERTIES_OUTBOUND);
        EasyMock.expectLastCall().andReturn(rmps);
    }
    properties.add(rmps);
    SequenceType sequence = createMock(SequenceType.class);
    if (message != null) {
        rmps.getSequence();
        EasyMock.expectLastCall().andReturn(sequence);
    }
    if (messageNumber != null) {
        EasyMock.expect(sequence.getMessageNumber()).andReturn(messageNumber).anyTimes();
    }
    Identifier id = createMock(Identifier.class);
    EasyMock.expect(sequence.getIdentifier()).andReturn(id).anyTimes();
    EasyMock.expect(id.getValue()).andReturn(sid).anyTimes();
    identifiers.add(id);
    sequences.add(sequence);
    return sequence;
}
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 22 with SequenceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.SequenceType in project cxf by apache.

the class RMSoapInInterceptorTest method testDecodeAcksRequested.

@Test
public void testDecodeAcksRequested() throws XMLStreamException {
    SoapMessage message = setUpInboundMessage("resources/Retransmission.xml");
    RMSoapInInterceptor codec = new RMSoapInInterceptor();
    codec.handleMessage(message);
    RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false);
    Collection<AckRequestedType> requested = rmps.getAcksRequested();
    assertNotNull(requested);
    assertEquals(1, requested.size());
    AckRequestedType ar = requested.iterator().next();
    assertNotNull(ar);
    assertEquals(ar.getIdentifier().getValue(), SEQ_IDENTIFIER);
    SequenceType s = rmps.getSequence();
    assertNotNull(s);
    assertEquals(s.getIdentifier().getValue(), SEQ_IDENTIFIER);
    assertEquals(s.getMessageNumber(), MSG2_MESSAGE_NUMBER);
    assertNull(rmps.getAcks());
}
Also used : AckRequestedType(org.apache.cxf.ws.rm.v200702.AckRequestedType) SequenceType(org.apache.cxf.ws.rm.v200702.SequenceType) RMProperties(org.apache.cxf.ws.rm.RMProperties) SoapMessage(org.apache.cxf.binding.soap.SoapMessage) Test(org.junit.Test)

Example 23 with SequenceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.SequenceType in project cxf by apache.

the class RMSoapInInterceptorTest method testDecodeSequence.

@Test
public void testDecodeSequence() throws XMLStreamException {
    SoapMessage message = setUpInboundMessage("resources/Message1.xml");
    RMSoapInInterceptor codec = new RMSoapInInterceptor();
    codec.handleMessage(message);
    RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false);
    SequenceType st = rmps.getSequence();
    assertNotNull(st);
    assertEquals(st.getIdentifier().getValue(), SEQ_IDENTIFIER);
    assertEquals(st.getMessageNumber(), MSG1_MESSAGE_NUMBER);
    assertNull(rmps.getAcks());
    assertNull(rmps.getAcksRequested());
}
Also used : SequenceType(org.apache.cxf.ws.rm.v200702.SequenceType) RMProperties(org.apache.cxf.ws.rm.RMProperties) SoapMessage(org.apache.cxf.binding.soap.SoapMessage) Test(org.junit.Test)

Example 24 with SequenceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.SequenceType in project cxf by apache.

the class Destination method processingComplete.

void processingComplete(Message message) {
    SequenceType sequenceType = RMContextUtils.retrieveRMProperties(message, false).getSequence();
    if (null == sequenceType) {
        return;
    }
    DestinationSequence seq = getSequence(sequenceType.getIdentifier());
    if (null != seq) {
        long mn = sequenceType.getMessageNumber().longValue();
        seq.processingComplete(mn);
        seq.purgeAcknowledged(mn);
        // remove acknowledged undelivered message
        seq.removeDeliveringMessageNumber(mn);
        if (seq.isTerminated() && seq.allAcknowledgedMessagesDelivered()) {
            removeSequence(seq);
        }
    }
    CachedOutputStream saved = (CachedOutputStream) message.remove(RMMessageConstants.SAVED_CONTENT);
    if (saved != null) {
        saved.releaseTempFileHold();
        try {
            saved.close();
        } catch (IOException e) {
        // ignore
        }
    }
}
Also used : SequenceType(org.apache.cxf.ws.rm.v200702.SequenceType) IOException(java.io.IOException) CachedOutputStream(org.apache.cxf.io.CachedOutputStream)

Example 25 with SequenceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.SequenceType in project cxf by apache.

the class EncoderDecoder method buildHeaders.

/**
 * Builds an element containing WS-RM headers. This adds the appropriate WS-RM namespace declaration to the element,
 * and then adds any WS-RM headers set in the supplied properties as child elements.
 *
 * @param rmps
 * @param qname constructed element name
 * @return element (<code>null</code> if none)
 */
public void buildHeaders(RMProperties rmps, List<Header> headers) throws JAXBException {
    // check if there's anything to insert
    SequenceType seq = rmps.getSequence();
    Collection<SequenceAcknowledgement> acks = rmps.getAcks();
    Collection<AckRequestedType> reqs = rmps.getAcksRequested();
    if (seq == null && acks == null && reqs == null) {
        return;
    }
    buildHeaders(seq, acks, reqs, rmps.isLastMessage(), headers);
}
Also used : AckRequestedType(org.apache.cxf.ws.rm.v200702.AckRequestedType) CreateSequenceType(org.apache.cxf.ws.rm.v200702.CreateSequenceType) CloseSequenceType(org.apache.cxf.ws.rm.v200702.CloseSequenceType) TerminateSequenceType(org.apache.cxf.ws.rm.v200702.TerminateSequenceType) SequenceType(org.apache.cxf.ws.rm.v200702.SequenceType) SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)

Aggregations

SequenceType (org.apache.cxf.ws.rm.v200702.SequenceType)33 CloseSequenceType (org.apache.cxf.ws.rm.v200702.CloseSequenceType)12 RMProperties (org.apache.cxf.ws.rm.RMProperties)11 CreateSequenceType (org.apache.cxf.ws.rm.v200702.CreateSequenceType)11 TerminateSequenceType (org.apache.cxf.ws.rm.v200702.TerminateSequenceType)11 Message (org.apache.cxf.message.Message)8 Identifier (org.apache.cxf.ws.rm.v200702.Identifier)7 SequenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.SequenceType)6 IOException (java.io.IOException)6 Unmarshaller (javax.xml.bind.Unmarshaller)5 AckRequestedType (org.apache.cxf.ws.rm.v200702.AckRequestedType)5 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)4 Endpoint (org.apache.cxf.endpoint.Endpoint)4 Exchange (org.apache.cxf.message.Exchange)4 AddressingProperties (org.apache.cxf.ws.addressing.AddressingProperties)4 SequenceAcknowledgement (org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)4 Test (org.junit.Test)4 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)3 SystemException (com.evolveum.midpoint.util.exception.SystemException)3 File (java.io.File)3