Search in sources :

Example 21 with Expires

use of org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires in project narayana by jbosstm.

the class UserTransactionImple method startTransaction.

protected final Context startTransaction(int timeout, TxContextImple current) throws com.arjuna.wsc.InvalidCreateParametersException, SystemException {
    try {
        // TODO: tricks for per app _activationCoordinatorService config, perhaps:
        // InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("/foo.properties");
        final Long expires = (timeout > 0 ? new Long(timeout) : null);
        final String messageId = MessageId.getMessageId();
        final CoordinationContext currentContext = (current != null ? getContext(current) : null);
        final CoordinationContextType coordinationContext = ActivationCoordinator.createCoordinationContext(_activationCoordinatorService, messageId, AtomicTransactionConstants.WSAT_PROTOCOL, expires, currentContext);
        if (coordinationContext == null) {
            throw new SystemException(wstxLogger.i18NLogger.get_mwlabs_wst_at_remote_UserTransaction11Imple__2());
        }
        return new ContextImple(coordinationContext);
    } catch (final InvalidCreateParametersException icpe) {
        throw icpe;
    } catch (final SoapFault sf) {
        throw new SystemException(sf.getMessage());
    } catch (final Exception ex) {
        throw new SystemException(ex.toString());
    }
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) ContextImple(com.arjuna.mwlabs.wst11.at.ContextImple) TxContextImple(com.arjuna.mwlabs.wst11.at.context.TxContextImple) SystemException(com.arjuna.wst.SystemException) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) InvalidCreateParametersException(com.arjuna.wsc.InvalidCreateParametersException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) WrongStateException(com.arjuna.wst.WrongStateException) SystemException(com.arjuna.wst.SystemException) InvalidCreateParametersException(com.arjuna.wsc.InvalidCreateParametersException) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) CoordinationContext(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)

Example 22 with Expires

use of org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires in project narayana by jbosstm.

the class UserBusinessActivityImple method startTransaction.

private final Context startTransaction(int timeout, TxContextImple current) throws InvalidCreateParametersException, SystemException {
    try {
        final Long expires = (timeout > 0 ? new Long(timeout) : null);
        final String messageId = MessageId.getMessageId();
        final CoordinationContext currentContext = (current != null ? getContext(current) : null);
        final CoordinationContextType coordinationContext = ActivationCoordinator.createCoordinationContext(_activationCoordinatorService, messageId, BusinessActivityConstants.WSBA_PROTOCOL_ATOMIC_OUTCOME, expires, currentContext);
        if (coordinationContext == null) {
            throw new SystemException(wstxLogger.i18NLogger.get_mwlabs_wst11_ba_remote_UserBusinessActivityImple_2());
        }
        return new ContextImple(coordinationContext);
    } catch (final InvalidCreateParametersException icpe) {
        throw icpe;
    } catch (final SoapFault sf) {
        throw new SystemException(sf.getMessage());
    } catch (final Exception ex) {
        throw new SystemException(ex.toString());
    }
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) TxContextImple(com.arjuna.mwlabs.wst11.ba.context.TxContextImple) ContextImple(com.arjuna.mwlabs.wst11.ba.ContextImple) SystemException(com.arjuna.wst.SystemException) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) InvalidCreateParametersException(com.arjuna.wsc.InvalidCreateParametersException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) WrongStateException(com.arjuna.wst.WrongStateException) SystemException(com.arjuna.wst.SystemException) InvalidCreateParametersException(com.arjuna.wsc.InvalidCreateParametersException) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) CoordinationContext(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)

Example 23 with Expires

use of org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires in project narayana by jbosstm.

the class ActivationTest method checkResponse.

public void checkResponse(final String coordinationType, final Expires expiresInstance, final CreateCoordinationContextResponseType createCoordinationContextResponseType) throws Exception {
    CoordinationContext outContext = createCoordinationContextResponseType.getCoordinationContext();
    assertNotNull(outContext);
    assertEquals(coordinationType, outContext.getCoordinationType());
    if (expiresInstance != null) {
        assertNotNull(outContext.getExpires());
        assertEquals(expiresInstance.getValue(), outContext.getExpires().getValue());
    } else {
        assertNull(outContext.getExpires());
    }
    assertNotNull(outContext.getRegistrationService());
}
Also used : CoordinationContext(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)

Example 24 with Expires

use of org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires in project narayana by jbosstm.

the class ActivationTest method testRequestWithoutExpiresWithoutCurrentContext.

@Test
public void testRequestWithoutExpiresWithoutCurrentContext() throws Exception {
    final String messageId = "testRequestWithoutExpiresWithoutCurrentContext";
    final String coordinationType = TestUtil.COORDINATION_TYPE;
    final Long expires = null;
    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 25 with Expires

use of org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires in project narayana by jbosstm.

the class ActivationTest method testRequestWithExpiresWithCurrentContextWithoutExpires.

@Test
public void testRequestWithExpiresWithCurrentContextWithoutExpires() throws Exception {
    final String messageId = "testRequestWithExpiresWithCurrentContextWithoutExpires";
    final String coordinationType = TestUtil.COORDINATION_TYPE;
    final Long expires = new Long(123456L);
    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)

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