Investigation XA Test
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/a8b375e2 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/a8b375e2 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/a8b375e2 Branch: refs/heads/refactor-openwire Commit: a8b375e2215ec0d2232bf1838f94856be5a736e6 Parents: 5c7b309 Author: Clebert Suconic <[email protected]> Authored: Fri Mar 4 16:45:37 2016 -0500 Committer: Clebert Suconic <[email protected]> Committed: Sat Mar 19 01:07:37 2016 -0400 ---------------------------------------------------------------------- .../InvestigationOpenwireTest.java | 28 ++++++++++++++++++++ 1 file changed, 28 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a8b375e2/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/investigations/InvestigationOpenwireTest.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/investigations/InvestigationOpenwireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/investigations/InvestigationOpenwireTest.java index 1599a2c..da4ecb3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/investigations/InvestigationOpenwireTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/investigations/InvestigationOpenwireTest.java @@ -26,6 +26,7 @@ import javax.jms.TextMessage; import javax.jms.XAConnection; import javax.jms.XASession; import javax.transaction.xa.XAResource; +import javax.transaction.xa.Xid; import java.util.Collection; import java.util.LinkedList; @@ -215,4 +216,31 @@ public class InvestigationOpenwireTest extends BasicOpenWireTest { e.printStackTrace(); } } + + @Test + public void testXAPrepare() throws Exception { + try { + + XAConnection connection = xaFactory.createXAConnection(); + // Thread.sleep(5000); + + + XASession session = connection.createXASession(); + + Xid xid = newXID(); + session.getXAResource().start(xid, XAResource.TMNOFLAGS); + Queue queue = session.createQueue(queueName); + MessageProducer producer = session.createProducer(queue); + producer.send(session.createTextMessage("hello")); + session.getXAResource().end(xid, XAResource.TMSUCCESS); + session.getXAResource().prepare(xid); + + connection.close(); + + System.err.println("Done!!!"); + } + catch (Exception e) { + e.printStackTrace(); + } + } }
