use of org.apache.cxf.ws.rm.v200702.Identifier 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(Long.valueOf(1));
range.setUpper(Long.valueOf(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();
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class SoapFaultFactoryTest method createSoap12FaultWithIdentifierDetail.
@Test
public void createSoap12FaultWithIdentifierDetail() {
SoapBinding sb = control.createMock(SoapBinding.class);
EasyMock.expect(sb.getSoapVersion()).andReturn(Soap12.getInstance());
Identifier id = new Identifier();
id.setValue("sid");
setupSequenceFault(true, RM10Constants.UNKNOWN_SEQUENCE_FAULT_QNAME, id);
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.UNKNOWN_SEQUENCE_FAULT_QNAME, fault.getSubCode());
Element elem = fault.getDetail();
assertEquals(RM10Constants.NAMESPACE_URI, elem.getNamespaceURI());
assertEquals("Identifier", elem.getLocalName());
control.verify();
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class RMTxStoreTest method testReconnect.
@Test
public void testReconnect() throws Exception {
// set the initial reconnect delay to 100 msec for testing
long ird = store.getInitialReconnectDelay();
store.setInitialReconnectDelay(100);
SourceSequence seq = control.createMock(SourceSequence.class);
Identifier sid1 = RMUtils.getWSRMFactory().createIdentifier();
sid1.setValue("sequence1");
EasyMock.expect(seq.getIdentifier()).andReturn(sid1);
EasyMock.expect(seq.getExpires()).andReturn(null);
EasyMock.expect(seq.getOfferingSequenceIdentifier()).andReturn(null);
EasyMock.expect(seq.getEndpointIdentifier()).andReturn(CLIENT_ENDPOINT_ID);
EasyMock.expect(seq.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408);
// intentionally invalidate the connection
try {
store.getConnection().close();
} catch (SQLException ex) {
// ignore
}
control.replay();
try {
store.createSourceSequence(seq);
fail("Expected RMStoreException was not thrown.");
} catch (RMStoreException ex) {
SQLException se = (SQLException) ex.getCause();
// expects a transient or non-transient connection exception
assertTrue(se.getSQLState().startsWith("08"));
}
// wait 200 msecs to make sure an reconnect is attempted
Thread.sleep(200);
control.reset();
EasyMock.expect(seq.getIdentifier()).andReturn(sid1);
EasyMock.expect(seq.getExpires()).andReturn(null);
EasyMock.expect(seq.getOfferingSequenceIdentifier()).andReturn(null);
EasyMock.expect(seq.getEndpointIdentifier()).andReturn(CLIENT_ENDPOINT_ID);
EasyMock.expect(seq.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408);
control.replay();
store.createSourceSequence(seq);
control.verify();
// revert to the old initial reconnect delay
store.setInitialReconnectDelay(ird);
store.removeSourceSequence(sid1);
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class RMSoapOutInterceptorTest method setUpOutbound.
private void setUpOutbound() {
ObjectFactory factory = new ObjectFactory();
s1 = factory.createSequenceType();
Identifier sid = factory.createIdentifier();
sid.setValue("sequence1");
s1.setIdentifier(sid);
s1.setMessageNumber(ONE);
s2 = factory.createSequenceType();
sid = factory.createIdentifier();
sid.setValue("sequence2");
s2.setIdentifier(sid);
s2.setMessageNumber(TEN);
ack1 = factory.createSequenceAcknowledgement();
SequenceAcknowledgement.AcknowledgementRange r = factory.createSequenceAcknowledgementAcknowledgementRange();
r.setLower(ONE);
r.setUpper(ONE);
ack1.getAcknowledgementRange().add(r);
ack1.setIdentifier(s1.getIdentifier());
ack2 = factory.createSequenceAcknowledgement();
r = factory.createSequenceAcknowledgementAcknowledgementRange();
r.setLower(ONE);
r.setUpper(TEN);
ack2.getAcknowledgementRange().add(r);
ack2.setIdentifier(s2.getIdentifier());
ar1 = factory.createAckRequestedType();
ar1.setIdentifier(s1.getIdentifier());
ar2 = factory.createAckRequestedType();
ar2.setIdentifier(s2.getIdentifier());
}
Aggregations