use of org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement in project cxf by apache.
the class RMTxStoreTestBase method verifyDestinationSequence.
private void verifyDestinationSequence(String s, DestinationSequence seq) {
Identifier sid = seq.getIdentifier();
assertNotNull(sid);
assertEquals(s, sid.getValue());
if ("sequence1".equals(s)) {
assertEquals(0, seq.getLastMessageNumber());
SequenceAcknowledgement sa = seq.getAcknowledgment();
assertNotNull(sa);
verifyAcknowledgementRanges(sa.getAcknowledgementRange(), new long[] { 1, 1 });
assertEquals(ProtocolVariation.RM10WSA200408, seq.getProtocol());
} else if ("sequence2".equals(s)) {
assertEquals(10, seq.getLastMessageNumber());
SequenceAcknowledgement sa = seq.getAcknowledgment();
assertNotNull(sa);
verifyAcknowledgementRanges(sa.getAcknowledgementRange(), new long[] { 1, 1, 3, 10 });
assertEquals(ProtocolVariation.RM11WSA200508, seq.getProtocol());
}
}
use of org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement 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());
}
use of org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement 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());
}
use of org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement 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.v200702.SequenceAcknowledgement in project cxf by apache.
the class SoapFaultFactoryTest method createSoap12FaultWithAcknowledgementDetail.
@Test
public void createSoap12FaultWithAcknowledgementDetail() {
SoapBinding sb = control.createMock(SoapBinding.class);
EasyMock.expect(sb.getSoapVersion()).andReturn(Soap12.getInstance());
SequenceAcknowledgement ack = new SequenceAcknowledgement();
Identifier id = new Identifier();
id.setValue("sid");
ack.setIdentifier(id);
SequenceAcknowledgement.AcknowledgementRange range = new SequenceAcknowledgement.AcknowledgementRange();
range.setLower(new Long(1));
range.setUpper(new Long(10));
ack.getAcknowledgementRange().add(range);
setupSequenceFault(true, RM10Constants.INVALID_ACKNOWLEDGMENT_FAULT_QNAME, ack);
control.replay();
SoapFaultFactory factory = new SoapFaultFactory(sb);
SoapFault fault = (SoapFault) factory.createFault(sf, createInboundMessage());
assertEquals("reason", fault.getReason());
assertEquals(Soap12.getInstance().getSender(), fault.getFaultCode());
assertEquals(RM10Constants.INVALID_ACKNOWLEDGMENT_FAULT_QNAME, fault.getSubCode());
Element elem = fault.getDetail();
assertEquals(RM10Constants.NAMESPACE_URI, elem.getNamespaceURI());
assertEquals("SequenceAcknowledgement", elem.getLocalName());
control.verify();
}
Aggregations