use of org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement in project cxf by apache.
the class VersionTransformer method convert.
/**
* Convert 200502 wsrm:SequenceAcknowledgement with 200508 WS-Addressing namespace to internal form.
*
* @param exposed (non-<code>null</code>)
* @return converted
*/
public static SequenceAcknowledgement convert(org.apache.cxf.ws.rm.v200502wsa15.SequenceAcknowledgement exposed) {
SequenceAcknowledgement internal = new SequenceAcknowledgement();
internal.setIdentifier(convert(exposed.getIdentifier()));
List<SequenceAcknowledgement.AcknowledgementRange> internalRanges = internal.getAcknowledgementRange();
for (org.apache.cxf.ws.rm.v200502wsa15.SequenceAcknowledgement.AcknowledgementRange range : exposed.getAcknowledgementRange()) {
SequenceAcknowledgement.AcknowledgementRange internalRange = new SequenceAcknowledgement.AcknowledgementRange();
internalRange.setLower(range.getLower());
internalRange.setUpper(range.getUpper());
internalRanges.add(internalRange);
putAll(range.getOtherAttributes(), internalRange.getOtherAttributes());
}
addAll(exposed.getAny(), internal.getAny());
putAll(exposed.getOtherAttributes(), internal.getOtherAttributes());
return internal;
}
use of org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement in project cxf by apache.
the class PersistenceUtils method deserialiseAcknowledgment.
public SequenceAcknowledgement deserialiseAcknowledgment(InputStream is) {
Object obj = null;
XMLStreamReader reader = StaxUtils.createXMLStreamReader(is);
try {
obj = getContext().createUnmarshaller().unmarshal(reader);
if (obj instanceof JAXBElement<?>) {
JAXBElement<?> el = (JAXBElement<?>) obj;
obj = el.getValue();
}
} catch (JAXBException ex) {
throw new RMStoreException(ex);
} finally {
try {
StaxUtils.close(reader);
is.close();
} catch (Throwable t) {
// ignore, just cleaning up
}
}
return (SequenceAcknowledgement) obj;
}
use of org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement in project cxf by apache.
the class PersistenceUtilsTest method testSerialiseDeserialiseAcknowledgement.
@Test
public void testSerialiseDeserialiseAcknowledgement() {
SequenceAcknowledgement ack = new SequenceAcknowledgement();
AcknowledgementRange range = new AcknowledgementRange();
range.setLower(new Long(1));
range.setUpper(new Long(10));
ack.getAcknowledgementRange().add(range);
PersistenceUtils utils = PersistenceUtils.getInstance();
InputStream is = utils.serialiseAcknowledgment(ack);
SequenceAcknowledgement refAck = utils.deserialiseAcknowledgment(is);
assertEquals(refAck.getAcknowledgementRange().size(), refAck.getAcknowledgementRange().size());
AcknowledgementRange refRange = refAck.getAcknowledgementRange().get(0);
assertEquals(range.getLower(), refRange.getLower());
assertEquals(range.getUpper(), refRange.getUpper());
}
use of org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement in project cxf by apache.
the class RMTxStoreTestBase method setUpOnce.
public static void setUpOnce() {
ack1 = new SequenceAcknowledgement();
SequenceAcknowledgement.AcknowledgementRange range = new SequenceAcknowledgement.AcknowledgementRange();
range.setLower(ONE);
range.setUpper(ONE);
ack1.getAcknowledgementRange().add(range);
ack2 = new SequenceAcknowledgement();
range = new SequenceAcknowledgement.AcknowledgementRange();
range.setLower(ONE);
range.setUpper(ONE);
ack2.getAcknowledgementRange().add(range);
range = new SequenceAcknowledgement.AcknowledgementRange();
range.setLower(new Long(3));
range.setUpper(TEN);
ack2.getAcknowledgementRange().add(range);
}
use of org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement in project cxf by apache.
the class RMTxStoreTestBase method setupDestinationSequence.
private Identifier setupDestinationSequence(String s) throws IOException, SQLException {
DestinationSequence seq = control.createMock(DestinationSequence.class);
Identifier sid = new Identifier();
sid.setValue(s);
EndpointReferenceType epr = RMUtils.createAnonymousReference();
SequenceAcknowledgement ack = ack1;
Long lmn = ZERO;
ProtocolVariation pv = ProtocolVariation.RM10WSA200408;
if ("sequence2".equals(s)) {
ack = ack2;
lmn = TEN;
pv = ProtocolVariation.RM11WSA200508;
}
EasyMock.expect(seq.getIdentifier()).andReturn(sid);
EasyMock.expect(seq.getAcksTo()).andReturn(epr);
EasyMock.expect(seq.getEndpointIdentifier()).andReturn(SERVER_ENDPOINT_ID);
EasyMock.expect(seq.getLastMessageNumber()).andReturn(lmn);
EasyMock.expect(seq.getAcknowledgment()).andReturn(ack);
EasyMock.expect(seq.getIdentifier()).andReturn(sid);
EasyMock.expect(seq.getProtocol()).andReturn(pv);
control.replay();
store.createDestinationSequence(seq);
Connection con = getConnection();
try {
store.beginTransaction();
store.updateDestinationSequence(con, seq);
store.commit(con);
} finally {
releaseConnection(con);
}
control.reset();
return sid;
}
Aggregations