use of org.apache.cxf.ws.rm.RMProperties 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());
}
use of org.apache.cxf.ws.rm.RMProperties in project cxf by apache.
the class RMSoapOutInterceptorTest method testEncode.
@Test
public void testEncode() throws Exception {
RMSoapOutInterceptor codec = new RMSoapOutInterceptor();
setUpOutbound();
SoapMessage message = setupOutboundMessage();
// no RM headers
codec.handleMessage(message);
verifyHeaders(message, new String[] {});
// one sequence header
message = setupOutboundMessage();
RMProperties rmps = RMContextUtils.retrieveRMProperties(message, true);
rmps.setSequence(s1);
codec.encode(message);
verifyHeaders(message, new String[] { RMConstants.SEQUENCE_NAME });
// one acknowledgment header
message = setupOutboundMessage();
rmps = RMContextUtils.retrieveRMProperties(message, true);
Collection<SequenceAcknowledgement> acks = new ArrayList<>();
acks.add(ack1);
rmps.setAcks(acks);
codec.encode(message);
verifyHeaders(message, new String[] { RMConstants.SEQUENCE_ACK_NAME });
// two acknowledgment headers
message = setupOutboundMessage();
rmps = RMContextUtils.retrieveRMProperties(message, true);
acks.add(ack2);
rmps.setAcks(acks);
codec.encode(message);
verifyHeaders(message, new String[] { RMConstants.SEQUENCE_ACK_NAME, RMConstants.SEQUENCE_ACK_NAME });
// one ack requested header
message = setupOutboundMessage();
rmps = RMContextUtils.retrieveRMProperties(message, true);
Collection<AckRequestedType> requested = new ArrayList<>();
requested.add(ar1);
rmps.setAcksRequested(requested);
codec.encode(message);
verifyHeaders(message, new String[] { RMConstants.ACK_REQUESTED_NAME });
// two ack requested headers
message = setupOutboundMessage();
rmps = RMContextUtils.retrieveRMProperties(message, true);
requested.add(ar2);
rmps.setAcksRequested(requested);
codec.encode(message);
verifyHeaders(message, new String[] { RMConstants.ACK_REQUESTED_NAME, RMConstants.ACK_REQUESTED_NAME });
}
use of org.apache.cxf.ws.rm.RMProperties in project cxf by apache.
the class RMSoapOutInterceptorTest method setupOutboundFaultMessage.
private SoapMessage setupOutboundFaultMessage() throws Exception {
Exchange ex = new ExchangeImpl();
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);
ex.setInMessage(message);
message = new MessageImpl();
SoapMessage soapMessage = new SoapMessage(message);
ex.setOutFaultMessage(soapMessage);
soapMessage.setExchange(ex);
MessageFactory factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPMessage soap = factory.createMessage();
soap.getSOAPBody().addFault();
soapMessage.setContent(SOAPMessage.class, soap);
return soapMessage;
}
use of org.apache.cxf.ws.rm.RMProperties in project cxf by apache.
the class RMSoapInInterceptor method decode.
/**
* Decode the RM properties from protocol-specific headers
* and store them in the message.
*
* @param message the SOAP mesage
*/
void decode(SoapMessage message) {
RMProperties rmps = unmarshalRMProperties(message);
RMContextUtils.storeRMProperties(message, rmps, false);
// TODO: decode SequenceFault ?
}
use of org.apache.cxf.ws.rm.RMProperties in project cxf by apache.
the class RedeliveryQueueImpl method getRedeliveryStatus.
public RetryStatus getRedeliveryStatus(DestinationSequence seq, long num) {
List<RedeliverCandidate> sequenceCandidates = getSequenceCandidates(seq);
if (null != sequenceCandidates) {
for (int i = 0; i < sequenceCandidates.size(); i++) {
RedeliverCandidate candidate = sequenceCandidates.get(i);
RMProperties properties = RMContextUtils.retrieveRMProperties(candidate.getMessage(), false);
SequenceType st = properties.getSequence();
if (num == st.getMessageNumber()) {
return candidate;
}
}
}
return null;
}
Aggregations