use of org.apache.cxf.ws.rm.v200502.CreateSequenceResponseType in project cxf by apache.
the class ServantTest method verifyCreateSequenceExpiresSetAtDestination.
private void verifyCreateSequenceExpiresSetAtDestination(Servant servant, RMManager manager) throws SequenceFault {
DestinationPolicyType dp = RMMANGER_FACTORY.createDestinationPolicyType();
AcksPolicyType ap = RMMANGER_FACTORY.createAcksPolicyType();
dp.setAcksPolicy(ap);
dp.setSequenceExpiration(DURATION_SHORT);
manager.setDestinationPolicy(dp);
Expires expires = new Expires();
expires.setValue(DURATION_DEFAULT);
Message message = createTestCreateSequenceMessage(expires, null);
CreateSequenceResponseType csr = (CreateSequenceResponseType) servant.createSequence(message);
Expires expires2 = csr.getExpires();
assertNotNull(expires2);
assertEquals(DURATION_SHORT, expires2.getValue());
}
use of org.apache.cxf.ws.rm.v200502.CreateSequenceResponseType in project cxf by apache.
the class Servant method invoke.
public Object invoke(Exchange exchange, Object o) {
LOG.fine("Invoking on RM Endpoint");
final ProtocolVariation protocol = RMContextUtils.getProtocolVariation(exchange.getInMessage());
OperationInfo oi = exchange.getBindingOperationInfo().getOperationInfo();
if (null == oi) {
LOG.fine("No operation info.");
return null;
}
if (RM10Constants.INSTANCE.getCreateSequenceOperationName().equals(oi.getName()) || RM11Constants.INSTANCE.getCreateSequenceOperationName().equals(oi.getName()) || RM10Constants.INSTANCE.getCreateSequenceOnewayOperationName().equals(oi.getName()) || RM11Constants.INSTANCE.getCreateSequenceOnewayOperationName().equals(oi.getName())) {
try {
return Collections.singletonList(createSequence(exchange.getInMessage()));
} catch (RuntimeException ex) {
LOG.log(Level.WARNING, "Sequence creation rejected", ex);
SequenceFault sf = new SequenceFaultFactory(protocol.getConstants()).createCreateSequenceRefusedFault();
Endpoint e = exchange.getEndpoint();
Binding b = null == e ? null : e.getBinding();
if (null != b) {
RMManager m = reliableEndpoint.getManager();
LOG.fine("Manager: " + m);
BindingFaultFactory bff = m.getBindingFaultFactory(b);
Fault f = bff.createFault(sf, exchange.getInMessage());
// log with warning instead sever, as this may happen for some delayed messages
LogUtils.log(LOG, Level.WARNING, "SEQ_FAULT_MSG", bff.toString(f));
throw f;
}
throw new Fault(sf);
}
} else if (RM10Constants.INSTANCE.getCreateSequenceResponseOnewayOperationName().equals(oi.getName()) || RM11Constants.INSTANCE.getCreateSequenceResponseOnewayOperationName().equals(oi.getName())) {
EncoderDecoder codec = protocol.getCodec();
CreateSequenceResponseType createResponse = codec.convertReceivedCreateSequenceResponse(getParameter(exchange.getInMessage()));
createSequenceResponse(createResponse, protocol);
} else if (RM10Constants.INSTANCE.getTerminateSequenceOperationName().equals(oi.getName()) || RM11Constants.INSTANCE.getTerminateSequenceOperationName().equals(oi.getName())) {
Object tsr = terminateSequence(exchange.getInMessage());
if (tsr != null) {
return Collections.singletonList(tsr);
}
} else if (RM11Constants.INSTANCE.getCloseSequenceOperationName().equals(oi.getName())) {
return Collections.singletonList(closeSequence(exchange.getInMessage()));
}
return null;
}
use of org.apache.cxf.ws.rm.v200502.CreateSequenceResponseType in project cxf by apache.
the class VersionTransformer method convert.
/**
* Convert 200502 wsrm:CreateSequenceResponseType with 200508 WS-Addressing namespace to internal form.
*
* @param exposed (may be <code>null</code>)
* @return converted (<code>null</code> if exposed is <code>null</code>)
*/
public static CreateSequenceResponseType convert(org.apache.cxf.ws.rm.v200502wsa15.CreateSequenceResponseType exposed) {
if (exposed == null) {
return null;
}
CreateSequenceResponseType internal = new CreateSequenceResponseType();
internal.setAccept(convert(exposed.getAccept()));
internal.setExpires(convert(exposed.getExpires()));
internal.setIdentifier(convert(exposed.getIdentifier()));
addAll(exposed.getAny(), internal.getAny());
putAll(exposed.getOtherAttributes(), internal.getOtherAttributes());
return internal;
}
use of org.apache.cxf.ws.rm.v200502.CreateSequenceResponseType in project cxf by apache.
the class RMInInterceptorTest method testHandleCreateSequenceOnClient.
@Test
public void testHandleCreateSequenceOnClient() throws SequenceFault, RMException {
interceptor = new RMInInterceptor();
Message message = setupInboundMessage(RM10Constants.CREATE_SEQUENCE_ACTION, false);
rme.receivedControlMessage();
EasyMock.expectLastCall();
Servant servant = control.createMock(Servant.class);
EasyMock.expect(rme.getServant()).andReturn(servant);
CreateSequenceResponseType csr = control.createMock(CreateSequenceResponseType.class);
EasyMock.expect(servant.createSequence(message)).andReturn(csr);
Proxy proxy = control.createMock(Proxy.class);
EasyMock.expect(rme.getProxy()).andReturn(proxy);
proxy.createSequenceResponse(csr, ProtocolVariation.RM10WSA200408);
EasyMock.expectLastCall();
control.replay();
interceptor.handle(message);
}
use of org.apache.cxf.ws.rm.v200502.CreateSequenceResponseType in project cxf by apache.
the class ServantTest method verifyCreateSequenceExpiresSetAtBoth.
private void verifyCreateSequenceExpiresSetAtBoth(Servant servant, RMManager manager) throws SequenceFault {
DestinationPolicyType dp = RMMANGER_FACTORY.createDestinationPolicyType();
AcksPolicyType ap = RMMANGER_FACTORY.createAcksPolicyType();
dp.setAcksPolicy(ap);
dp.setSequenceExpiration(DURATION_SHORT);
manager.setDestinationPolicy(dp);
Expires expires = new Expires();
expires.setValue(DURATION_VERY_SHORT);
Message message = createTestCreateSequenceMessage(expires, null);
CreateSequenceResponseType csr = (CreateSequenceResponseType) servant.createSequence(message);
Expires expires2 = csr.getExpires();
assertNotNull(expires2);
assertEquals(DURATION_VERY_SHORT, expires2.getValue());
}
Aggregations