use of org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires in project narayana by jbosstm.
the class ActivationTest method testRequestWithoutExpiresWithCurrentContextWithoutExpires.
@Test
public void testRequestWithoutExpiresWithCurrentContextWithoutExpires() throws Exception {
final String messageId = "testRequestWithoutExpiresWithCurrentContextWithoutExpires";
final String coordinationType = TestUtil.COORDINATION_TYPE;
final Long expires = null;
final CoordinationContext coordinationContext = new CoordinationContext();
coordinationContext.setCoordinationType(coordinationType);
CoordinationContextType.Identifier identifier = new CoordinationContextType.Identifier();
identifier.setValue(TestUtil.PROTOCOL_IDENTIFIER);
coordinationContext.setIdentifier(identifier);
W3CEndpointReference registrationService = TestUtil11.getRegistrationEndpoint(identifier.getValue());
coordinationContext.setRegistrationService(registrationService);
executeRequestTest(messageId, coordinationType, expires, coordinationContext);
}
use of org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires in project narayana by jbosstm.
the class ActivationTest method testRequestWithExpiresWithoutCurrentContext.
@Test
public void testRequestWithExpiresWithoutCurrentContext() throws Exception {
final String messageId = "testRequestWithExpiresWithoutCurrentContext";
final String coordinationType = TestUtil.COORDINATION_TYPE;
final Long expires = new Long(123456L);
final CoordinationContext coordinationContext = null;
executeRequestTest(messageId, coordinationType, expires, coordinationContext);
}
use of org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires in project narayana by jbosstm.
the class TestContextFactory method create.
public CoordinationContext create(final String coordinationTypeURI, final Long expires, final CoordinationContextType currentContext, boolean isSecure) throws InvalidCreateParametersException {
if (coordinationTypeURI.equals(TestUtil.INVALID_CREATE_PARAMETERS_COORDINATION_TYPE)) {
throw new InvalidCreateParametersException();
}
final ServiceRegistry serviceRegistry = ServiceRegistry.getRegistry();
final String registrationURI = serviceRegistry.getServiceURI(CoordinationConstants.REGISTRATION_SERVICE_NAME);
final W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
builder.serviceName(CoordinationConstants.REGISTRATION_SERVICE_QNAME);
builder.endpointName(CoordinationConstants.REGISTRATION_ENDPOINT_QNAME);
builder.address(registrationURI);
W3CEndpointReference registrationService = builder.build();
CoordinationContext testCoordinationContext = new CoordinationContext();
CoordinationContext.Identifier identifier = new CoordinationContext.Identifier();
identifier.setValue(Integer.toString(nextIdentifier()));
testCoordinationContext.setIdentifier(identifier);
if (expires != null && expires.longValue() > 0) {
Expires expiresInstance = new Expires();
expiresInstance.setValue(expires);
testCoordinationContext.setExpires(expiresInstance);
}
testCoordinationContext.setCoordinationType(_coordinationType);
testCoordinationContext.setRegistrationService(registrationService);
try {
SOAPFactory factory = SOAPFactory.newInstance();
SOAPElement element = factory.createElement(TestUtil.TEST_ELEMENT_EXTENSION_VALUE_QNAME);
element.addTextNode(TestUtil.TEST_EXTENSION_VALUE);
testCoordinationContext.getAny().add(element);
} catch (SOAPException e) {
// TODO log error here
}
return testCoordinationContext;
}
use of org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires in project cxf by apache.
the class Proxy method createSequence.
public CreateSequenceResponseType createSequence(EndpointReferenceType defaultAcksTo, RelatesToType relatesTo, boolean isServer, final ProtocolVariation protocol, final Exchange exchange, Map<String, Object> context) throws RMException {
this.sequenceContext = context;
SourcePolicyType sp = reliableEndpoint.getManager().getSourcePolicy();
CreateSequenceType create = new CreateSequenceType();
String address = sp.getAcksTo();
EndpointReferenceType acksTo = null;
if (null != address) {
acksTo = RMUtils.createReference(address);
} else {
acksTo = defaultAcksTo;
}
create.setAcksTo(acksTo);
Duration d = sp.getSequenceExpiration();
if (null != d) {
Expires expires = new Expires();
expires.setValue(d);
create.setExpires(expires);
}
if (sp.isIncludeOffer()) {
OfferType offer = new OfferType();
d = sp.getOfferedSequenceExpiration();
if (null != d) {
Expires expires = new Expires();
expires.setValue(d);
offer.setExpires(expires);
}
offer.setIdentifier(reliableEndpoint.getSource().generateSequenceIdentifier());
offer.setEndpoint(acksTo);
create.setOffer(offer);
setOfferedIdentifier(offer);
}
InterfaceInfo ii = reliableEndpoint.getEndpoint(protocol).getEndpointInfo().getService().getInterface();
EncoderDecoder codec = protocol.getCodec();
RMConstants constants = codec.getConstants();
final OperationInfo oi = isServer ? ii.getOperation(constants.getCreateSequenceOnewayOperationName()) : ii.getOperation(constants.getCreateSequenceOperationName());
final Object send = codec.convertToSend(create);
if (isServer) {
LOG.fine("sending CreateSequenceRequest from server side");
Runnable r = new Runnable() {
public void run() {
try {
invoke(oi, protocol, new Object[] { send }, null, exchange);
} catch (RMException ex) {
// already logged
}
}
};
Executor ex = reliableEndpoint.getApplicationEndpoint().getExecutor();
if (ex == null) {
ex = SynchronousExecutor.getInstance();
}
ex.execute(r);
return null;
}
Object resp = invoke(oi, protocol, new Object[] { send }, context, exchange);
return codec.convertReceivedCreateSequenceResponse(resp);
}
use of org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires in project cxf by apache.
the class ServantTest method verifyCreateSequenceExpiresSetAtSource.
private void verifyCreateSequenceExpiresSetAtSource(Servant servant, RMManager manager) throws SequenceFault {
DestinationPolicyType dp = RMMANGER_FACTORY.createDestinationPolicyType();
AcksPolicyType ap = RMMANGER_FACTORY.createAcksPolicyType();
dp.setAcksPolicy(ap);
manager.setDestinationPolicy(dp);
Expires expires = new Expires();
expires.setValue(DURATION_SHORT);
Message message = createTestCreateSequenceMessage(expires, null);
CreateSequenceResponseType csr = (CreateSequenceResponseType) servant.createSequence(message);
Expires expires2 = csr.getExpires();
assertNotNull(expires2);
assertEquals(DURATION_SHORT, expires2.getValue());
}
Aggregations