Search in sources :

Example 16 with CoordinationContextType

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

the class EnduranceTest method doRegisterError.

public void doRegisterError(final String messageId, int count) throws Exception {
    final String protocolIdentifier;
    final W3CEndpointReference participantProtocolService = TestUtil11.getProtocolParticipantEndpoint("participant");
    final CoordinationContextType coordinationContext = new CoordinationContextType();
    CoordinationContextType.Identifier identifierInstance = new CoordinationContextType.Identifier();
    coordinationContext.setCoordinationType(TestUtil.COORDINATION_TYPE);
    coordinationContext.setIdentifier(identifierInstance);
    identifierInstance.setValue("identifier");
    coordinationContext.setRegistrationService(TestUtil11.getRegistrationEndpoint(identifierInstance.getValue()));
    W3CEndpointReference coordinator = null;
    switch(count) {
        case 0:
            protocolIdentifier = TestUtil.INVALID_PROTOCOL_PROTOCOL_IDENTIFIER;
            try {
                coordinator = RegistrationCoordinator.register(coordinationContext, messageId, participantProtocolService, protocolIdentifier);
            } catch (InvalidProtocolException ipe) {
            }
            if (coordinator != null) {
                fail("expected invalid protocol exception");
            }
            break;
        case 1:
            protocolIdentifier = TestUtil.INVALID_STATE_PROTOCOL_IDENTIFIER;
            try {
                coordinator = RegistrationCoordinator.register(coordinationContext, messageId, participantProtocolService, protocolIdentifier);
            } catch (InvalidStateException ise) {
            }
            if (coordinator != null) {
                fail("expected invalid state exception");
            }
            break;
        case 3:
            protocolIdentifier = TestUtil.NO_ACTIVITY_PROTOCOL_IDENTIFIER;
            try {
                coordinator = RegistrationCoordinator.register(coordinationContext, messageId, participantProtocolService, protocolIdentifier);
            } catch (CannotRegisterException cre) {
            }
            if (coordinator != null) {
                fail("expected cannot register exception");
            }
            break;
        default:
            protocolIdentifier = TestUtil.ALREADY_REGISTERED_PROTOCOL_IDENTIFIER;
            try {
                coordinator = RegistrationCoordinator.register(coordinationContext, messageId, participantProtocolService, protocolIdentifier);
            } catch (CannotRegisterException cre) {
            }
            if (coordinator != null) {
                fail("expected cannot register exception");
            }
            break;
    }
    final RegisterDetails details = testRegistrationCoordinatorProcessor.getRegisterDetails(messageId, 10000);
    final RegisterType requestRegister = details.getRegister();
    final MAP requestMap = details.getMAP();
    final ArjunaContext requestArjunaContext = details.getArjunaContext();
    assertEquals(requestMap.getTo(), TestUtil11.registrationCoordinatorService);
    assertEquals(requestMap.getMessageID(), messageId);
    assertNotNull(requestArjunaContext);
    assertEquals(requestArjunaContext.getInstanceIdentifier().getInstanceIdentifier(), identifierInstance.getValue());
    ;
    assertEquals(protocolIdentifier, requestRegister.getProtocolIdentifier());
    assertNotNull(protocolIdentifier, requestRegister.getParticipantProtocolService());
}
Also used : W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) InvalidProtocolException(com.arjuna.wsc.InvalidProtocolException) RegisterDetails(com.arjuna.wsc.tests.arq.TestRegistrationCoordinatorProcessor.RegisterDetails) InvalidStateException(com.arjuna.wsc.InvalidStateException) CreateCoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CreateCoordinationContextType) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) RegisterType(org.oasis_open.docs.ws_tx.wscoor._2006._06.RegisterType) ArjunaContext(com.arjuna.webservices11.wsarj.ArjunaContext) MAP(org.jboss.ws.api.addressing.MAP) CannotRegisterException(com.arjuna.wsc.CannotRegisterException)

Example 17 with CoordinationContextType

use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType 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 18 with CoordinationContextType

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

the class ParticipantPortTypeImpl method commit.

/**
 */
@WebMethod(operationName = "Commit", action = "http://fabrikam123.com/Commit")
@Oneway
@Action(input = "http://fabrikam123.com/Commit")
@RequestWrapper(localName = "Commit", targetNamespace = "http://fabrikam123.com", className = "com.jboss.transaction.txinterop.webservices.atinterop.generated.TestMessageType")
public void commit() {
    MessageContext ctx = webServiceCtx.getMessageContext();
    MAP inboundMap = AddressingHelper.inboundMap(ctx);
    CoordinationContextType coordinationContext = CoordinationContextManager.getContext(ctx);
    try {
        ATParticipantProcessor.getParticipant().commit(coordinationContext, inboundMap);
    } catch (SoapFault11 sf) {
        sendSoapFault(inboundMap, sf);
        return;
    }
    sendResponse(inboundMap);
}
Also used : SoapFault11(com.arjuna.webservices11.SoapFault11) MessageContext(javax.xml.ws.handler.MessageContext) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) MAP(org.jboss.ws.api.addressing.MAP) Action(javax.xml.ws.Action) RequestWrapper(javax.xml.ws.RequestWrapper)

Example 19 with CoordinationContextType

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

the class ParticipantPortTypeImpl method earlyReadonly.

/**
 */
@WebMethod(operationName = "EarlyReadonly", action = "http://fabrikam123.com/EarlyReadonly")
@Oneway
@Action(input = "http://fabrikam123.com/EarlyReadonly")
@RequestWrapper(localName = "EarlyReadonly", targetNamespace = "http://fabrikam123.com", className = "com.jboss.transaction.txinterop.webservices.atinterop.generated.TestMessageType")
public void earlyReadonly() {
    MessageContext ctx = webServiceCtx.getMessageContext();
    MAP inboundMap = AddressingHelper.inboundMap(ctx);
    CoordinationContextType coordinationContext = CoordinationContextManager.getContext(ctx);
    try {
        ATParticipantProcessor.getParticipant().earlyReadonly(coordinationContext, inboundMap);
    } catch (SoapFault11 sf) {
        sendSoapFault(inboundMap, sf);
        return;
    }
    sendResponse(inboundMap);
}
Also used : SoapFault11(com.arjuna.webservices11.SoapFault11) MessageContext(javax.xml.ws.handler.MessageContext) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) MAP(org.jboss.ws.api.addressing.MAP) Action(javax.xml.ws.Action) RequestWrapper(javax.xml.ws.RequestWrapper)

Example 20 with CoordinationContextType

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

the class ParticipantPortTypeImpl method phase2Rollback.

/**
 */
@WebMethod(operationName = "Phase2Rollback", action = "http://fabrikam123.com/Phase2Rollback")
@Oneway
@Action(input = "http://fabrikam123.com/Phase2Rollback")
@RequestWrapper(localName = "Phase2Rollback", targetNamespace = "http://fabrikam123.com", className = "com.jboss.transaction.txinterop.webservices.atinterop.generated.TestMessageType")
public void phase2Rollback() {
    MessageContext ctx = webServiceCtx.getMessageContext();
    MAP inboundMap = AddressingHelper.inboundMap(ctx);
    CoordinationContextType coordinationContext = CoordinationContextManager.getContext(ctx);
    try {
        ATParticipantProcessor.getParticipant().phase2Rollback(coordinationContext, inboundMap);
    } catch (SoapFault11 sf) {
        sendSoapFault(inboundMap, sf);
        return;
    }
    sendResponse(inboundMap);
}
Also used : SoapFault11(com.arjuna.webservices11.SoapFault11) MessageContext(javax.xml.ws.handler.MessageContext) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) MAP(org.jboss.ws.api.addressing.MAP) Action(javax.xml.ws.Action) RequestWrapper(javax.xml.ws.RequestWrapper)

Aggregations

CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)107 SoapFault11 (com.arjuna.webservices11.SoapFault11)43 MAP (org.jboss.ws.api.addressing.MAP)41 Action (javax.xml.ws.Action)38 RequestWrapper (javax.xml.ws.RequestWrapper)38 MessageContext (javax.xml.ws.handler.MessageContext)38 CompletionCoordinatorParticipant (com.arjuna.wst.CompletionCoordinatorParticipant)30 InteropWaitState (com.jboss.transaction.txinterop.interop.states.InteropWaitState)16 CoordinationContext (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)13 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)12 InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)10 BusinessActivityTerminator (com.arjuna.wst.BusinessActivityTerminator)10 InteropWaitState (com.jboss.transaction.wstf.interop.states.InteropWaitState)10 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)10 TxContextImple (com.arjuna.mwlabs.wst11.at.context.TxContextImple)7 SoapFault (com.arjuna.webservices.SoapFault)6 SystemException (com.arjuna.wst.SystemException)6 SOAPEnvelope (javax.xml.soap.SOAPEnvelope)6 SOAPHeaderElement (javax.xml.soap.SOAPHeaderElement)6 TxContext (com.arjuna.mw.wst.TxContext)5