Search in sources :

Example 1 with ActiveMQXAResourceWrapperImpl

use of org.apache.activemq.artemis.service.extensions.xa.ActiveMQXAResourceWrapperImpl in project activemq-artemis by apache.

the class ActiveMQXAResourceWrapperImplTest method testXAResourceWrapper.

@Test
public void testXAResourceWrapper() {
    String jndiName = "java://jmsXA";
    String nodeId = "0";
    XAResource xaResource = new MockXAResource();
    Map<String, Object> xaResourceWrapperProperties = new HashMap<>();
    xaResourceWrapperProperties.put(ActiveMQXAResourceWrapper.ACTIVEMQ_JNDI_NAME, jndiName);
    xaResourceWrapperProperties.put(ActiveMQXAResourceWrapper.ACTIVEMQ_NODE_ID, nodeId);
    xaResourceWrapperProperties.put(ActiveMQXAResourceWrapper.ACTIVEMQ_PRODUCT_VERSION, "6");
    xaResourceWrapperProperties.put(ActiveMQXAResourceWrapper.ACTIVEMQ_PRODUCT_NAME, "ActiveMQ Artemis");
    ActiveMQXAResourceWrapperImpl xaResourceWrapper = new ActiveMQXAResourceWrapperImpl(xaResource, xaResourceWrapperProperties);
    String expectedJndiNodeId = jndiName + " NodeId:" + nodeId;
    assertEquals(xaResource, xaResourceWrapper.getResource());
    assertEquals(expectedJndiNodeId, xaResourceWrapper.getJndiName());
}
Also used : XAResource(javax.transaction.xa.XAResource) HashMap(java.util.HashMap) ActiveMQXAResourceWrapperImpl(org.apache.activemq.artemis.service.extensions.xa.ActiveMQXAResourceWrapperImpl) Test(org.junit.Test)

Example 2 with ActiveMQXAResourceWrapperImpl

use of org.apache.activemq.artemis.service.extensions.xa.ActiveMQXAResourceWrapperImpl in project activemq-artemis by apache.

the class OutgoingConnectionTest method testOutgoingXAResourceWrapper.

@Test
public void testOutgoingXAResourceWrapper() throws Exception {
    XAQueueConnection queueConnection = qraConnectionFactory.createXAQueueConnection();
    XASession s = queueConnection.createXASession();
    XAResource resource = s.getXAResource();
    assertTrue(resource instanceof ActiveMQXAResourceWrapper);
    ActiveMQXAResourceWrapperImpl xaResourceWrapper = (ActiveMQXAResourceWrapperImpl) resource;
    assertTrue(xaResourceWrapper.getJndiName().equals("java://jmsXA NodeId:" + server.getNodeID()));
    assertTrue(xaResourceWrapper.getProductVersion().equals(VersionLoader.getVersion().getFullVersion()));
    assertTrue(xaResourceWrapper.getProductName().equals(ActiveMQResourceAdapter.PRODUCT_NAME));
}
Also used : XAResource(javax.transaction.xa.XAResource) ActiveMQXAResourceWrapper(org.apache.activemq.artemis.service.extensions.xa.ActiveMQXAResourceWrapper) XASession(javax.jms.XASession) XAQueueConnection(javax.jms.XAQueueConnection) ActiveMQXAResourceWrapperImpl(org.apache.activemq.artemis.service.extensions.xa.ActiveMQXAResourceWrapperImpl) Test(org.junit.Test)

Aggregations

XAResource (javax.transaction.xa.XAResource)2 ActiveMQXAResourceWrapperImpl (org.apache.activemq.artemis.service.extensions.xa.ActiveMQXAResourceWrapperImpl)2 Test (org.junit.Test)2 HashMap (java.util.HashMap)1 XAQueueConnection (javax.jms.XAQueueConnection)1 XASession (javax.jms.XASession)1 ActiveMQXAResourceWrapper (org.apache.activemq.artemis.service.extensions.xa.ActiveMQXAResourceWrapper)1