Package com.arjuna.wst11.messaging

Examples of com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl


        final String messageId = "123456" ;
        final String instanceIdentifier = "testSendAborted" ;
        final W3CEndpointReference completionInitiatorEndpoint = TestUtil.getCompletionInitiatorEndpoint(instanceIdentifier);
        final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.completionInitiatorServiceURI, messageId) ;

        final TestCompletionInitiatorCallback callback = new TestCompletionInitiatorCallback() {
            public void aborted(final Notification aborted, final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
            {
                assertEquals(addressingProperties.getTo().getURI().toString(), TestUtil.completionInitiatorServiceURI);
                assertNull(addressingProperties.getFrom());
                assertNotNull(addressingProperties.getFaultTo());
                assertEquals(addressingProperties.getFaultTo().getAddress().getURI().toString(), TestUtil.completionCoordinatorServiceURI);
                assertNotNull(addressingProperties.getReplyTo());
                assertTrue(AddressingHelper.isNoneReplyTo(addressingProperties));
                assertNotNull(addressingProperties.getMessageID());
                assertEquals(addressingProperties.getMessageID().getURI().toString(), messageId);

                assertNotNull(arjunaContext) ;
                assertEquals(instanceIdentifier, arjunaContext.getInstanceIdentifier().getInstanceIdentifier()) ;
            }
        };
        final CompletionInitiatorProcessor initiator = CompletionInitiatorProcessor.getProcessor() ;
        initiator.registerCallback(instanceIdentifier, callback) ;

        try
        {
            CompletionInitiatorClient.getClient().sendAborted(completionInitiatorEndpoint, addressingProperties, new InstanceIdentifier("sender")) ;
            callback.waitUntilTriggered() ;
        }
        finally
        {
            initiator.removeCallback(instanceIdentifier) ;
        }

        assertTrue(callback.hasTriggered()) ;
        assertFalse(callback.hasFailed()) ;
    }
View Full Code Here


        final SoapFaultType soapFaultType = SoapFaultType.FAULT_SENDER ;
        final QName subcode = ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME ;
        final SoapFault soapFault = new SoapFault11(soapFaultType, subcode, reason) ;

        final TestCompletionInitiatorCallback callback = new TestCompletionInitiatorCallback() {
            public void soapFault(final SoapFault soapFault, final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
            {
                assertEquals(addressingProperties.getTo().getURI().toString(), TestUtil.completionInitiatorServiceURI);
                assertNull(addressingProperties.getFrom());
                assertNull(addressingProperties.getFaultTo());
                assertNotNull(addressingProperties.getReplyTo());
                assertTrue(AddressingHelper.isNoneReplyTo(addressingProperties));
                assertNotNull(addressingProperties.getMessageID());
                assertEquals(addressingProperties.getMessageID().getURI().toString(), messageId);

                assertNotNull(arjunaContext) ;
                assertEquals(instanceIdentifier, arjunaContext.getInstanceIdentifier().getInstanceIdentifier()) ;

                assertNotNull(soapFault) ;
                assertEquals(soapFaultType, soapFault.getSoapFaultType()) ;
                assertEquals(subcode, soapFault.getSubcode()) ;
                assertEquals(reason, soapFault.getReason()) ;
            }
        };
        final CompletionInitiatorProcessor initiator = CompletionInitiatorProcessor.getProcessor() ;
        initiator.registerCallback(instanceIdentifier, callback) ;

        try
        {
            CompletionInitiatorClient.getClient().sendSoapFault(completionInitiatorEndpoint, addressingProperties, soapFault, new InstanceIdentifier("sender")) ;
            callback.waitUntilTriggered() ;
        }
        finally
        {
            initiator.removeCallback(instanceIdentifier) ;
        }

        assertTrue(callback.hasTriggered()) ;
        assertFalse(callback.hasFailed()) ;
    }
View Full Code Here

        W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
        final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionCoordinatorServiceURI, messageId) ;

        CoordinatorCompletionCoordinatorClient.getClient().sendClosed(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;

        CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000) ;

        assertTrue(details.hasClosed());

        checkDetails(details, false, true, messageId, instanceIdentifier);
    }
View Full Code Here

        W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
        final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionCoordinatorServiceURI, messageId) ;

        CoordinatorCompletionCoordinatorClient.getClient().sendCancelled(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;

        CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000) ;

        assertTrue(details.hasCancelled());

        checkDetails(details, false, true, messageId, instanceIdentifier);
    }
View Full Code Here

        W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
        final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionCoordinatorServiceURI, messageId) ;

        CoordinatorCompletionCoordinatorClient.getClient().sendCompensated(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;

        CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000) ;

        assertTrue(details.hasCompensated());

        checkDetails(details, false, true, messageId, instanceIdentifier);
    }
View Full Code Here

        final State state = State.STATE_FAILING_COMPENSATING ;

        CoordinatorCompletionCoordinatorClient.getClient().sendFail(endpoint, addressingProperties, new InstanceIdentifier("sender"), state.getValue()) ;

        CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000) ;

        assertNotNull(details.hasFail());
        assertEquals(details.hasFail().getExceptionIdentifier(), state.getValue());

        checkDetails(details, true, true, messageId, instanceIdentifier);
    }
View Full Code Here

        W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
        final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionCoordinatorServiceURI, messageId) ;

        CoordinatorCompletionCoordinatorClient.getClient().sendCompleted(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;

        CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000) ;

        assertTrue(details.hasCompleted());

        checkDetails(details, true, true, messageId, instanceIdentifier);
    }
View Full Code Here

        final State state = State.STATE_COMPENSATING;

        CoordinatorCompletionCoordinatorClient.getClient().sendStatus(endpoint, addressingProperties, new InstanceIdentifier("sender"), state.getValue()) ;

        CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000) ;

        assertNotNull(details.hasStatus());
        assertEquals(details.hasStatus().getState(), state.getValue());

        checkDetails(details, true, true, messageId, instanceIdentifier);
    }
View Full Code Here

        // this would be a better test if we could set the identifier as a reference parameter here
        AddressingHelper.installNoneReplyTo(addressingProperties);
        SoapFaultClient.sendSoapFault(soapFault, addressingProperties, TestUtil.getBusinessActivityFaultAction()) ;

        final CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000) ;

        assertNotNull(details.hasSoapFault()) ;
        assertEquals(details.hasSoapFault().getSoapFaultType(), soapFaultType) ;
        assertEquals(details.hasSoapFault().getReason(), reason) ;
        assertEquals(details.hasSoapFault().getSubcode(), subcode) ;

        checkDetails(details, false, false, messageId, null);
    }
View Full Code Here

        W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
        final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionCoordinatorServiceURI, messageId) ;

        CoordinatorCompletionCoordinatorClient.getClient().sendExit(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;

        final CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000) ;

        assertTrue(details.hasExit()) ;

        checkDetails(details, true, true, messageId, instanceIdentifier);
    }
View Full Code Here

TOP

Related Classes of com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.