Search in sources :

Example 11 with Expires

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);
}
Also used : W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) CreateCoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CreateCoordinationContextType) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) CoordinationContext(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext) Test(org.junit.Test)

Example 12 with Expires

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);
}
Also used : CoordinationContext(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext) Test(org.junit.Test)

Example 13 with Expires

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;
}
Also used : W3CEndpointReferenceBuilder(javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) SOAPException(javax.xml.soap.SOAPException) SOAPElement(javax.xml.soap.SOAPElement) ServiceRegistry(com.arjuna.webservices11.ServiceRegistry) Expires(org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires) InvalidCreateParametersException(com.arjuna.wsc.InvalidCreateParametersException) SOAPFactory(javax.xml.soap.SOAPFactory) CoordinationContext(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)

Example 14 with Expires

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);
}
Also used : BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) OperationInfo(org.apache.cxf.service.model.OperationInfo) EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType) Duration(javax.xml.datatype.Duration) OfferType(org.apache.cxf.ws.rm.v200702.OfferType) Executor(java.util.concurrent.Executor) SynchronousExecutor(org.apache.cxf.workqueue.SynchronousExecutor) CreateSequenceType(org.apache.cxf.ws.rm.v200702.CreateSequenceType) SourcePolicyType(org.apache.cxf.ws.rm.manager.SourcePolicyType) Expires(org.apache.cxf.ws.rm.v200702.Expires) InterfaceInfo(org.apache.cxf.service.model.InterfaceInfo)

Example 15 with Expires

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());
}
Also used : AcksPolicyType(org.apache.cxf.ws.rm.manager.AcksPolicyType) Message(org.apache.cxf.message.Message) DestinationPolicyType(org.apache.cxf.ws.rm.manager.DestinationPolicyType) Expires(org.apache.cxf.ws.rm.v200502.Expires) CreateSequenceResponseType(org.apache.cxf.ws.rm.v200502.CreateSequenceResponseType)

Aggregations

CoordinationContext (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)16 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)12 InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)10 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)9 Expires (org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires)9 Test (org.junit.Test)7 ServiceRegistry (com.arjuna.webservices11.ServiceRegistry)5 InvalidProtocolException (com.arjuna.wsc.InvalidProtocolException)5 Message (org.apache.cxf.message.Message)5 DestinationPolicyType (org.apache.cxf.ws.rm.manager.DestinationPolicyType)5 Expires (org.apache.cxf.ws.rm.v200702.Expires)5 CreateCoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CreateCoordinationContextType)5 NoActivityException (com.arjuna.mw.wsas.exceptions.NoActivityException)4 SystemException (com.arjuna.mw.wsas.exceptions.SystemException)4 SoapFault (com.arjuna.webservices.SoapFault)4 InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)4 SystemException (com.arjuna.wst.SystemException)4 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)4 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)4 WrongStateException (com.arjuna.wst.WrongStateException)4