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());
}
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());
}
}
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());
}
}
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);
}
});
}
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();
}
Aggregations