Search in sources :

Example 11 with RMProperties

use of org.apache.cxf.ws.rm.RMProperties in project cxf by apache.

the class SoapFaultFactoryTest method createInboundMessage.

private Message createInboundMessage() {
    Message message = new MessageImpl();
    RMProperties rmps = new RMProperties();
    rmps.exposeAs(RM10Constants.NAMESPACE_URI);
    RMContextUtils.storeRMProperties(message, rmps, false);
    AddressingProperties maps = new AddressingProperties();
    RMContextUtils.storeMAPs(maps, message, false, false);
    return message;
}
Also used : Message(org.apache.cxf.message.Message) AddressingProperties(org.apache.cxf.ws.addressing.AddressingProperties) MessageImpl(org.apache.cxf.message.MessageImpl) RMProperties(org.apache.cxf.ws.rm.RMProperties)

Example 12 with RMProperties

use of org.apache.cxf.ws.rm.RMProperties in project cxf by apache.

the class RMSoapInInterceptorTest method testDecodeAcknowledgements2.

@Test
public void testDecodeAcknowledgements2() throws XMLStreamException {
    SoapMessage message = setUpInboundMessage("resources/Acknowledgment2.xml");
    RMSoapInInterceptor codec = new RMSoapInInterceptor();
    codec.handleMessage(message);
    RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false);
    Collection<SequenceAcknowledgement> acks = rmps.getAcks();
    assertNotNull(acks);
    assertEquals(1, acks.size());
    SequenceAcknowledgement ack = acks.iterator().next();
    assertNotNull(ack);
    assertEquals(1, ack.getAcknowledgementRange().size());
    AcknowledgementRange r1 = ack.getAcknowledgementRange().get(0);
    verifyRange(r1, 1, 3);
    assertNull(rmps.getSequence());
    assertNull(rmps.getAcksRequested());
}
Also used : SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement) AcknowledgementRange(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement.AcknowledgementRange) RMProperties(org.apache.cxf.ws.rm.RMProperties) SoapMessage(org.apache.cxf.binding.soap.SoapMessage) Test(org.junit.Test)

Example 13 with RMProperties

use of org.apache.cxf.ws.rm.RMProperties in project cxf by apache.

the class RMSoapInInterceptorTest method testDecodeAcknowledgements.

@Test
public void testDecodeAcknowledgements() throws XMLStreamException {
    SoapMessage message = setUpInboundMessage("resources/Acknowledgment.xml");
    RMSoapInInterceptor codec = new RMSoapInInterceptor();
    codec.handleMessage(message);
    RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false);
    Collection<SequenceAcknowledgement> acks = rmps.getAcks();
    assertNotNull(acks);
    assertEquals(1, acks.size());
    SequenceAcknowledgement ack = acks.iterator().next();
    assertNotNull(ack);
    assertEquals(ack.getIdentifier().getValue(), SEQ_IDENTIFIER);
    assertEquals(2, ack.getAcknowledgementRange().size());
    AcknowledgementRange r1 = ack.getAcknowledgementRange().get(0);
    AcknowledgementRange r2 = ack.getAcknowledgementRange().get(1);
    verifyRange(r1, 1, 1);
    verifyRange(r2, 3, 3);
    assertNull(rmps.getSequence());
    assertNull(rmps.getAcksRequested());
}
Also used : SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement) AcknowledgementRange(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement.AcknowledgementRange) RMProperties(org.apache.cxf.ws.rm.RMProperties) SoapMessage(org.apache.cxf.binding.soap.SoapMessage) Test(org.junit.Test)

Example 14 with RMProperties

use of org.apache.cxf.ws.rm.RMProperties in project cxf by apache.

the class RMSoapInInterceptorTest method setUpInboundMessage.

private SoapMessage setUpInboundMessage(String resource) throws XMLStreamException {
    Message message = new MessageImpl();
    SoapMessage soapMessage = new SoapMessage(message);
    RMProperties rmps = new RMProperties();
    rmps.exposeAs(RM10Constants.NAMESPACE_URI);
    RMContextUtils.storeRMProperties(soapMessage, rmps, false);
    AddressingProperties maps = new AddressingProperties();
    RMContextUtils.storeMAPs(maps, soapMessage, false, false);
    message.put(Message.SCHEMA_VALIDATION_ENABLED, false);
    InputStream is = RMSoapInInterceptorTest.class.getResourceAsStream(resource);
    assertNotNull(is);
    XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(is);
    soapMessage.setContent(XMLStreamReader.class, reader);
    ReadHeadersInterceptor rji = new ReadHeadersInterceptor(BusFactory.getDefaultBus());
    rji.handleMessage(soapMessage);
    StartBodyInterceptor sbi = new StartBodyInterceptor();
    sbi.handleMessage(soapMessage);
    return soapMessage;
}
Also used : ReadHeadersInterceptor(org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor) XMLStreamReader(javax.xml.stream.XMLStreamReader) Message(org.apache.cxf.message.Message) SoapMessage(org.apache.cxf.binding.soap.SoapMessage) InputStream(java.io.InputStream) AddressingProperties(org.apache.cxf.ws.addressing.AddressingProperties) StartBodyInterceptor(org.apache.cxf.binding.soap.interceptor.StartBodyInterceptor) MessageImpl(org.apache.cxf.message.MessageImpl) RMProperties(org.apache.cxf.ws.rm.RMProperties) SoapMessage(org.apache.cxf.binding.soap.SoapMessage)

Example 15 with RMProperties

use of org.apache.cxf.ws.rm.RMProperties 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)

Aggregations

RMProperties (org.apache.cxf.ws.rm.RMProperties)25 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)12 SequenceType (org.apache.cxf.ws.rm.v200702.SequenceType)11 Message (org.apache.cxf.message.Message)10 AddressingProperties (org.apache.cxf.ws.addressing.AddressingProperties)8 Test (org.junit.Test)6 Endpoint (org.apache.cxf.endpoint.Endpoint)5 MessageImpl (org.apache.cxf.message.MessageImpl)4 Identifier (org.apache.cxf.ws.rm.v200702.Identifier)4 SoapFault (org.apache.cxf.binding.soap.SoapFault)3 Exchange (org.apache.cxf.message.Exchange)3 ProtocolVariation (org.apache.cxf.ws.rm.ProtocolVariation)3 RMEndpoint (org.apache.cxf.ws.rm.RMEndpoint)3 RMException (org.apache.cxf.ws.rm.RMException)3 SequenceAcknowledgement (org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)3 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 ArrayList (java.util.ArrayList)2 MessageFactory (javax.xml.soap.MessageFactory)2 SOAPMessage (javax.xml.soap.SOAPMessage)2