Search in sources :

Example 1 with CreateCoordinationContextDetails

use of com.arjuna.wsc.tests.arq.TestActivationCoordinatorProcessor.CreateCoordinationContextDetails in project narayana by jbosstm.

the class ActivationTest method executeRequestTest.

private void executeRequestTest(final String messageId, final String coordinationType, final Long expires, final CoordinationContext coordinationContext) throws Exception {
    final MAP map = AddressingHelper.createRequestContext(TestUtil11.activationCoordinatorService, messageId);
    Expires expiresInstance;
    if (expires == null) {
        expiresInstance = null;
    } else {
        expiresInstance = new Expires();
        expiresInstance.setValue(expires.longValue());
    }
    CreateCoordinationContextResponseType createCoordinationContextResponseType;
    createCoordinationContextResponseType = ActivationCoordinatorClient.getClient().sendCreateCoordination(map, coordinationType, expiresInstance, coordinationContext);
    final CreateCoordinationContextDetails details = testActivationCoordinatorProcessor.getCreateCoordinationContextDetails(messageId, 10000);
    final CreateCoordinationContextType requestCreateCoordinationContext = details.getCreateCoordinationContext();
    final MAP requestMAP = details.getMAP();
    assertNotNull(requestMAP.getTo());
    assertEquals(requestMAP.getTo(), TestUtil11.activationCoordinatorService);
    // we don't care about the reply to field --  this is an RPC style message
    // assertNotNull(requestMAP.getReplyTo());
    // assertTrue(AddressingHelper.isNoneReplyTo(requestMAP));
    assertNotNull(requestMAP.getMessageID());
    assertEquals(requestMAP.getMessageID(), messageId);
    if (expires == null) {
        assertNull(requestCreateCoordinationContext.getExpires());
    } else {
        assertNotNull(requestCreateCoordinationContext.getExpires());
        assertEquals(expires.longValue(), requestCreateCoordinationContext.getExpires().getValue());
    }
    if (coordinationContext == null) {
        assertNull(requestCreateCoordinationContext.getCurrentContext());
    } else {
        assertNotNull(requestCreateCoordinationContext.getCurrentContext());
        assertEquals(requestCreateCoordinationContext.getCurrentContext().getIdentifier().getValue(), coordinationContext.getIdentifier().getValue());
        if (coordinationContext.getExpires() == null) {
            assertNull(requestCreateCoordinationContext.getCurrentContext().getExpires());
        } else {
            assertNotNull(requestCreateCoordinationContext.getCurrentContext().getExpires());
            assertEquals(requestCreateCoordinationContext.getCurrentContext().getExpires().getValue(), coordinationContext.getExpires().getValue());
        }
        assertNotNull(requestCreateCoordinationContext.getCurrentContext().getIdentifier());
        assertEquals(requestCreateCoordinationContext.getCurrentContext().getIdentifier().getValue(), coordinationContext.getIdentifier().getValue());
    }
    assertNotNull(requestCreateCoordinationContext.getCoordinationType());
    assertEquals(requestCreateCoordinationContext.getCoordinationType(), coordinationType);
    // make sure we got a sensible response
    checkResponse(coordinationType, expiresInstance, createCoordinationContextResponseType);
}
Also used : CreateCoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CreateCoordinationContextType) CreateCoordinationContextDetails(com.arjuna.wsc.tests.arq.TestActivationCoordinatorProcessor.CreateCoordinationContextDetails) Expires(org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires) MAP(org.jboss.ws.api.addressing.MAP) CreateCoordinationContextResponseType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CreateCoordinationContextResponseType)

Example 2 with CreateCoordinationContextDetails

use of com.arjuna.wsc.tests.arq.TestActivationCoordinatorProcessor.CreateCoordinationContextDetails in project narayana by jbosstm.

the class EnduranceTest method doCreateCoordinationContextRequest.

public void doCreateCoordinationContextRequest(final String messageId) throws Exception {
    final String coordinationType = TestUtil.COORDINATION_TYPE;
    final MAP map = AddressingHelper.createRequestContext(TestUtil11.activationCoordinatorService, messageId);
    CreateCoordinationContextResponseType response = ActivationCoordinatorClient.getClient().sendCreateCoordination(map, coordinationType, null, null);
    final CreateCoordinationContextDetails details = testActivationCoordinatorProcessor.getCreateCoordinationContextDetails(messageId, 10000);
    final CreateCoordinationContextType requestCreateCoordinationContext = details.getCreateCoordinationContext();
    final MAP requestMap = details.getMAP();
    assertEquals(requestMap.getTo(), TestUtil11.activationCoordinatorService);
    assertEquals(requestMap.getMessageID(), messageId);
    assertNull(requestCreateCoordinationContext.getExpires());
    assertNull(requestCreateCoordinationContext.getCurrentContext());
    assertEquals(requestCreateCoordinationContext.getCoordinationType(), coordinationType);
    CoordinationContext context = response.getCoordinationContext();
    assertNotNull(context);
    assertNull(context.getExpires());
    assertEquals(context.getCoordinationType(), coordinationType);
    assertNotNull(context.getIdentifier());
}
Also used : CreateCoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CreateCoordinationContextType) CreateCoordinationContextDetails(com.arjuna.wsc.tests.arq.TestActivationCoordinatorProcessor.CreateCoordinationContextDetails) MAP(org.jboss.ws.api.addressing.MAP) CreateCoordinationContextResponseType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CreateCoordinationContextResponseType) CoordinationContext(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)

Aggregations

CreateCoordinationContextDetails (com.arjuna.wsc.tests.arq.TestActivationCoordinatorProcessor.CreateCoordinationContextDetails)2 MAP (org.jboss.ws.api.addressing.MAP)2 CreateCoordinationContextResponseType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CreateCoordinationContextResponseType)2 CreateCoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CreateCoordinationContextType)2 CoordinationContext (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)1 Expires (org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires)1