Search in sources :

Example 16 with Notification

use of org.oasis_open.docs.ws_tx.wsat._2006._06.Notification in project narayana by jbosstm.

the class CompletionCoordinatorTest method testSendCommitted.

@Test
public void testSendCommitted() throws Exception {
    final String messageId = "123456";
    final String instanceIdentifier = "testSendCommitted";
    final W3CEndpointReference completionInitiatorEndpoint = TestUtil.getCompletionInitiatorEndpoint(instanceIdentifier);
    final MAP map = AddressingHelper.createRequestContext(TestUtil.completionInitiatorServiceURI, messageId);
    final TestCompletionInitiatorCallback callback = new TestCompletionInitiatorCallback() {

        public void committed(final Notification committed, final MAP map, final ArjunaContext arjunaContext) {
            assertEquals(map.getTo(), TestUtil.completionInitiatorServiceURI);
            assertNull(map.getFrom());
            assertNotNull(map.getFaultTo());
            assertEquals(map.getFaultTo().getAddress(), TestUtil.completionCoordinatorServiceURI);
            assertNotNull(map.getReplyTo());
            assertTrue(AddressingHelper.isNoneReplyTo(map));
            assertEquals(map.getMessageID(), messageId);
            assertNotNull(arjunaContext);
            assertEquals(instanceIdentifier, arjunaContext.getInstanceIdentifier().getInstanceIdentifier());
        }
    };
    final CompletionInitiatorProcessor initiator = CompletionInitiatorProcessor.getProcessor();
    initiator.registerCallback(instanceIdentifier, callback);
    try {
        CompletionInitiatorClient.getClient().sendCommitted(completionInitiatorEndpoint, map, new InstanceIdentifier("sender"));
        callback.waitUntilTriggered();
    } finally {
        initiator.removeCallback(instanceIdentifier);
    }
    assertTrue(callback.hasTriggered());
    assertFalse(callback.hasFailed());
}
Also used : W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) CompletionInitiatorProcessor(com.arjuna.webservices11.wsat.processors.CompletionInitiatorProcessor) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) ArjunaContext(com.arjuna.webservices11.wsarj.ArjunaContext) MAP(org.jboss.ws.api.addressing.MAP) Notification(org.oasis_open.docs.ws_tx.wsat._2006._06.Notification) Test(org.junit.Test)

Example 17 with Notification

use of org.oasis_open.docs.ws_tx.wsat._2006._06.Notification in project narayana by jbosstm.

the class CompletionCoordinatorRPCClient method sendCommit.

/**
 * Send a commit request.
 * @param map addressing context initialised with to and message ID.
 * @param identifier The identifier of the initiator.
 * @throws com.arjuna.webservices.SoapFault For any errors.
 * @throws java.io.IOException for any transport errors.
 */
public boolean sendCommit(final W3CEndpointReference endpoint, final MAP map) throws SoapFault, IOException {
    CompletionCoordinatorRPCPortType port = getPort(endpoint, map, commitAction);
    Notification commit = new Notification();
    try {
        return port.commitOperation(commit);
    } catch (SOAPFaultException sfe) {
        throw SoapFault11.create(sfe);
    }
}
Also used : CompletionCoordinatorRPCPortType(org.oasis_open.docs.ws_tx.wsat._2006._06.CompletionCoordinatorRPCPortType) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) Notification(org.oasis_open.docs.ws_tx.wsat._2006._06.Notification)

Example 18 with Notification

use of org.oasis_open.docs.ws_tx.wsat._2006._06.Notification in project narayana by jbosstm.

the class CoordinatorClient method sendPrepared.

/**
 * Send a prepared request.
 * @param map addressing context initialised with to and message ID.
 * @param identifier The identifier of the initiator.
 * @throws com.arjuna.webservices.SoapFault For any SOAP errors.
 * @throws java.io.IOException for any transport errors.
 */
public void sendPrepared(final W3CEndpointReference endpoint, final MAP map, final InstanceIdentifier identifier) throws SoapFault, IOException {
    MAPEndpoint participant = getParticipant(endpoint, map);
    AddressingHelper.installFromFaultTo(map, participant, identifier);
    CoordinatorPortType port = getPort(endpoint, map, preparedAction);
    Notification prepared = new Notification();
    port.preparedOperation(prepared);
}
Also used : MAPEndpoint(org.jboss.ws.api.addressing.MAPEndpoint) CoordinatorPortType(org.oasis_open.docs.ws_tx.wsat._2006._06.CoordinatorPortType) Notification(org.oasis_open.docs.ws_tx.wsat._2006._06.Notification)

Example 19 with Notification

use of org.oasis_open.docs.ws_tx.wsat._2006._06.Notification in project narayana by jbosstm.

the class CoordinatorClient method sendAborted.

/**
 * Send an aborted request.
 * @param map addressing context initialised with to and message ID.
 * @param identifier The identifier of the initiator.
 * @throws com.arjuna.webservices.SoapFault For any SOAP errors.
 * @throws java.io.IOException for any transport errors.
 */
public void sendAborted(final W3CEndpointReference endpoint, final MAP map, final InstanceIdentifier identifier) throws SoapFault, IOException {
    MAPEndpoint participant = getParticipant(endpoint, map);
    AddressingHelper.installFaultTo(map, participant, identifier);
    CoordinatorPortType port = getPort(endpoint, map, abortedAction);
    Notification aborted = new Notification();
    port.abortedOperation(aborted);
}
Also used : MAPEndpoint(org.jboss.ws.api.addressing.MAPEndpoint) CoordinatorPortType(org.oasis_open.docs.ws_tx.wsat._2006._06.CoordinatorPortType) Notification(org.oasis_open.docs.ws_tx.wsat._2006._06.Notification)

Example 20 with Notification

use of org.oasis_open.docs.ws_tx.wsat._2006._06.Notification in project narayana by jbosstm.

the class CoordinatorClient method sendCommitted.

/**
 * Send a committed request.
 * @param map addressing context initialised with to and message ID.
 * @param identifier The identifier of the initiator.
 * @throws com.arjuna.webservices.SoapFault For any SOAP errors.
 * @throws java.io.IOException for any transport errors.
 */
public void sendCommitted(final W3CEndpointReference endpoint, final MAP map, final InstanceIdentifier identifier) throws SoapFault, IOException {
    MAPEndpoint participant = getParticipant(endpoint, map);
    AddressingHelper.installFaultTo(map, participant, identifier);
    CoordinatorPortType port = getPort(endpoint, map, committedAction);
    Notification committed = new Notification();
    port.committedOperation(committed);
}
Also used : MAPEndpoint(org.jboss.ws.api.addressing.MAPEndpoint) CoordinatorPortType(org.oasis_open.docs.ws_tx.wsat._2006._06.CoordinatorPortType) Notification(org.oasis_open.docs.ws_tx.wsat._2006._06.Notification)

Aggregations

Notification (org.oasis_open.docs.ws_tx.wsat._2006._06.Notification)28 Notification (org.orcid.jaxb.model.notification_v2.Notification)18 ArjunaContext (com.arjuna.webservices11.wsarj.ArjunaContext)15 MAP (org.jboss.ws.api.addressing.MAP)15 MessageContext (javax.xml.ws.handler.MessageContext)13 Task (com.arjuna.services.framework.task.Task)11 Action (javax.xml.ws.Action)11 MAPEndpoint (org.jboss.ws.api.addressing.MAPEndpoint)11 HashMap (java.util.HashMap)8 Test (org.junit.Test)8 AccessControl (org.orcid.core.security.visibility.aop.AccessControl)6 NotificationAmended (org.orcid.jaxb.model.notification.amended_v2.NotificationAmended)5 NotificationPermission (org.orcid.jaxb.model.notification.permission_v2.NotificationPermission)5 NotificationInstitutionalConnection (org.orcid.model.notification.institutional_sign_in_v2.NotificationInstitutionalConnection)5 ArrayList (java.util.ArrayList)4 NotificationCustom (org.orcid.jaxb.model.notification.custom_v2.NotificationCustom)4 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)4 DBUnitTest (org.orcid.test.DBUnitTest)4 URISyntaxException (java.net.URISyntaxException)3 HashSet (java.util.HashSet)3