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/1596659f
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/1596659f
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/1596659f

Branch: refs/heads/refactor-openwire
Commit: 1596659f4371be79308cffd4c42981a20b4f5da9
Parents: 489f7e5
Author: Clebert Suconic <[email protected]>
Authored: Fri Mar 4 16:45:37 2016 -0500
Committer: Clebert Suconic <[email protected]>
Committed: Wed Mar 9 14:41:41 2016 -0500

----------------------------------------------------------------------
 .../InvestigationOpenwireTest.java              | 28 ++++++++++++++++++++
 1 file changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1596659f/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();
+      }
+   }
 }

Reply via email to