Search in sources :

Example 11 with ArjunaContext

use of com.arjuna.webservices11.wsarj.ArjunaContext 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 12 with ArjunaContext

use of com.arjuna.webservices11.wsarj.ArjunaContext in project narayana by jbosstm.

the class CompletionParticipantTest method checkDetails.

private void checkDetails(CompletionCoordinatorDetails details, boolean hasFrom, boolean hasFaultTo, String messageId, InstanceIdentifier instanceIdentifier) {
    MAP inMAP = details.getMAP();
    ArjunaContext inArjunaContext = details.getArjunaContext();
    assertEquals(inMAP.getTo(), TestUtil.completionCoordinatorServiceURI);
    assertNotNull(inMAP.getReplyTo());
    assertTrue(AddressingHelper.isNoneReplyTo(inMAP));
    if (hasFrom) {
        assertNotNull(inMAP.getFrom());
        assertEquals(inMAP.getFrom().getAddress(), TestUtil.completionInitiatorServiceURI);
    } else {
        assertNull(inMAP.getFrom());
    }
    if (hasFaultTo) {
        assertNotNull(inMAP.getFaultTo());
        assertEquals(inMAP.getFaultTo().getAddress(), TestUtil.completionInitiatorServiceURI);
    } else {
        assertNull(inMAP.getFrom());
    }
    assertNotNull(inMAP.getMessageID());
    assertEquals(inMAP.getMessageID(), messageId);
    if (instanceIdentifier == null) {
        assertNull(inArjunaContext);
    } else {
        assertNotNull(inArjunaContext);
        assertEquals(instanceIdentifier.getInstanceIdentifier(), inArjunaContext.getInstanceIdentifier().getInstanceIdentifier());
    }
}
Also used : ArjunaContext(com.arjuna.webservices11.wsarj.ArjunaContext) MAP(org.jboss.ws.api.addressing.MAP)

Example 13 with ArjunaContext

use of com.arjuna.webservices11.wsarj.ArjunaContext in project narayana by jbosstm.

the class TwoPCParticipantTest method checkDetails.

/**
 * check the message details to see that they have the correct to, from and faultto address and message id, a
 * none reply to address and an arjuna context containing the correct instannce identifier
 * @param details
 * @param hasFrom
 * @param hasFaultTo
 * @param messageId
 * @param instanceIdentifier
 */
private void checkDetails(CoordinatorDetails details, boolean hasFrom, boolean hasFaultTo, String messageId, InstanceIdentifier instanceIdentifier) {
    MAP inMAP = details.getMAP();
    ArjunaContext inArjunaContext = details.getArjunaContext();
    assertEquals(inMAP.getTo(), TestUtil.coordinatorServiceURI);
    assertNotNull(inMAP.getReplyTo());
    assertTrue(AddressingHelper.isNoneReplyTo(inMAP));
    if (hasFrom) {
        assertNotNull(inMAP.getFrom());
        assertEquals(inMAP.getFrom().getAddress(), TestUtil.participantServiceURI);
    } else {
        assertNull(inMAP.getFrom());
    }
    if (hasFaultTo) {
        assertNotNull(inMAP.getFaultTo());
        assertEquals(inMAP.getFaultTo().getAddress(), TestUtil.participantServiceURI);
    } else {
        assertNull(inMAP.getFrom());
    }
    assertNotNull(inMAP.getMessageID());
    assertEquals(inMAP.getMessageID(), messageId);
    if (instanceIdentifier == null) {
        assertNull(inArjunaContext);
    } else {
        assertNotNull(inArjunaContext);
        assertEquals(instanceIdentifier.getInstanceIdentifier(), inArjunaContext.getInstanceIdentifier().getInstanceIdentifier());
    }
}
Also used : ArjunaContext(com.arjuna.webservices11.wsarj.ArjunaContext) MAP(org.jboss.ws.api.addressing.MAP)

Example 14 with ArjunaContext

use of com.arjuna.webservices11.wsarj.ArjunaContext in project narayana by jbosstm.

the class CompletionCoordinatorPortTypeImpl method commitOperation.

/**
 * @param parameters
 */
@WebMethod(operationName = "CommitOperation", action = "http://docs.oasis-open.org/ws-tx/wsat/2006/06/Commit")
@Oneway
@Action(input = "http://docs.oasis-open.org/ws-tx/wsat/2006/06/Commit")
public void commitOperation(@WebParam(name = "Commit", targetNamespace = "http://docs.oasis-open.org/ws-tx/wsat/2006/06", partName = "parameters") Notification parameters) {
    MessageContext ctx = webServiceCtx.getMessageContext();
    final Notification commit = parameters;
    final MAP inboundMap = AddressingHelper.inboundMap(ctx);
    final ArjunaContext arjunaContext = ArjunaContext.getCurrentContext(ctx);
    TaskManager.getManager().queueTask(new Task() {

        public void executeTask() {
            CompletionCoordinatorProcessor.getProcessor().commit(commit, inboundMap, arjunaContext);
        }
    });
}
Also used : Task(com.arjuna.services.framework.task.Task) MessageContext(javax.xml.ws.handler.MessageContext) ArjunaContext(com.arjuna.webservices11.wsarj.ArjunaContext) MAP(org.jboss.ws.api.addressing.MAP) Notification(org.oasis_open.docs.ws_tx.wsat._2006._06.Notification) Action(javax.xml.ws.Action)

Example 15 with ArjunaContext

use of com.arjuna.webservices11.wsarj.ArjunaContext in project narayana by jbosstm.

the class TerminationCoordinatorRPCPortTypeImpl method completeOperation.

@WebResult(name = "Completed", targetNamespace = "http://schemas.arjuna.com/ws/2005/10/wsarjtx", partName = "parameters")
@WebMethod(operationName = "CompleteOperation", action = "http://schemas.arjuna.com/ws/2005/10/wsarjtx/Complete")
public NotificationType completeOperation(@WebParam(partName = "parameters", name = "Complete", targetNamespace = "http://schemas.arjuna.com/ws/2005/10/wsarjtx") NotificationType parameters) {
    MessageContext ctx = webServiceCtx.getMessageContext();
    final NotificationType complete = parameters;
    final MAP inboundMap = AddressingHelper.inboundMap(ctx);
    final ArjunaContext arjunaContext = ArjunaContext.getCurrentContext(ctx);
    TerminationCoordinatorRPCProcessor.getProcessor().complete(complete, inboundMap, arjunaContext);
    ;
    return new NotificationType();
}
Also used : NotificationType(com.arjuna.schemas.ws._2005._10.wsarjtx.NotificationType) MessageContext(javax.xml.ws.handler.MessageContext) ArjunaContext(com.arjuna.webservices11.wsarj.ArjunaContext) MAP(org.jboss.ws.api.addressing.MAP)

Aggregations

MAP (org.jboss.ws.api.addressing.MAP)95 ArjunaContext (com.arjuna.webservices11.wsarj.ArjunaContext)83 InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)74 MessageContext (javax.xml.ws.handler.MessageContext)68 Task (com.arjuna.services.framework.task.Task)62 Action (javax.xml.ws.Action)54 NotificationType (org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType)29 SoapFault (com.arjuna.webservices.SoapFault)17 Notification (org.oasis_open.docs.ws_tx.wsat._2006._06.Notification)15 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)13 SoapFault11 (com.arjuna.webservices11.SoapFault11)12 NotificationType (com.arjuna.schemas.ws._2005._10.wsarjtx.NotificationType)10 CoordinatorCompletionCoordinatorInboundEvents (com.arjuna.webservices11.wsba.CoordinatorCompletionCoordinatorInboundEvents)10 CoordinatorCompletionParticipantInboundEvents (com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents)10 ParticipantCompletionCoordinatorInboundEvents (com.arjuna.webservices11.wsba.ParticipantCompletionCoordinatorInboundEvents)10 ParticipantCompletionParticipantInboundEvents (com.arjuna.webservices11.wsba.ParticipantCompletionParticipantInboundEvents)9 State (com.arjuna.webservices11.wsba.State)9 ProtocolException (javax.xml.ws.ProtocolException)9 SystemException (com.arjuna.wst.SystemException)8 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)8