Examples of DummyXid


Examples of org.hornetq.common.example.DummyXid

         // Step 11. Create two Text Messages
         TextMessage helloMessage = session.createTextMessage("hello");
         TextMessage worldMessage = session.createTextMessage("world");

         // Step 12. create a transaction
         Xid xid1 = new DummyXid("xa-example1".getBytes(), 1, UUIDGenerator.getInstance()
                                                                           .generateStringUUID()
                                                                           .getBytes());

         // Step 13. Get the JMS XAResource
         XAResource xaRes = xaSession.getXAResource();

         // Step 14. Begin the Transaction work
         xaRes.start(xid1, XAResource.TMNOFLAGS);

         // Step 15. do work, sending hello message.
         producer.send(helloMessage);

         System.out.println("Sent message " + helloMessage.getText());

         // Step 16. Stop the work for xid1
         xaRes.end(xid1, XAResource.TMSUCCESS);

         // Step 17. Prepare xid1
         xaRes.prepare(xid1);

         // Step 18. Check none should be received
         checkNoMessageReceived();

         // Step 19. Create another transaction.
         Xid xid2 = new DummyXid("xa-example2".getBytes(), 1, UUIDGenerator.getInstance()
                                                                           .generateStringUUID()
                                                                           .getBytes());

         // Step 20. Begin the transaction work
         xaRes.start(xid2, XAResource.TMNOFLAGS);
View Full Code Here

Examples of org.hornetq.common.example.DummyXid

         // Step 11. Create two Text Messages
         TextMessage helloMessage = session.createTextMessage("hello");
         TextMessage worldMessage = session.createTextMessage("world");

         // Step 12. create a transaction
         Xid xid1 = new DummyXid("xa-example1".getBytes(), 1, UUIDGenerator.getInstance()
                                                                           .generateStringUUID()
                                                                           .getBytes());

         // Step 13. Get the JMS XAResource
         XAResource xaRes = xaSession.getXAResource();

         // Step 14. Begin the Transaction work
         xaRes.start(xid1, XAResource.TMNOFLAGS);

         // Step 15. Send two messages.
         normalProducer.send(helloMessage);
         normalProducer.send(worldMessage);

         // Step 16. Receive the message
         TextMessage rm1 = (TextMessage)xaConsumer.receive();
         System.out.println("Message received: " + rm1.getText());
         TextMessage rm2 = (TextMessage)xaConsumer.receive();
         System.out.println("Message received: " + rm2.getText());

         // Step 17. Stop the work
         xaRes.end(xid1, XAResource.TMSUCCESS);

         // Step 18. Prepare
         xaRes.prepare(xid1);

         // Step 19. Roll back the transaction
         xaRes.rollback(xid1);

         // Step 20. Create another transaction
         Xid xid2 = new DummyXid("xa-example2".getBytes(), 1, UUIDGenerator.getInstance()
                                                                           .generateStringUUID()
                                                                           .getBytes());

         // Step 21. Start the transaction
         xaRes.start(xid2, XAResource.TMNOFLAGS);
View Full Code Here

Examples of org.hornetq.common.example.DummyXid

         // Step 11. Create two Text Messages
         TextMessage helloMessage = session.createTextMessage("hello");
         TextMessage worldMessage = session.createTextMessage("world");

         // Step 12. create a transaction
         Xid xid1 = new DummyXid("xa-example1".getBytes(), 1, UUIDGenerator.getInstance()
                                                                           .generateStringUUID()
                                                                           .getBytes());

         // Step 13. Get the JMS XAResource
         XAResource xaRes = xaSession.getXAResource();

         // Step 14. Begin the Transaction work
         xaRes.start(xid1, XAResource.TMNOFLAGS);

         // Step 15. do work, sending two messages.
         producer.send(helloMessage);
         producer.send(worldMessage);

         Thread.sleep(2000);

         // Step 16. Check the result, it should receive none!
         checkNoMessageReceived();

         // Step 17. Stop the work
         xaRes.end(xid1, XAResource.TMSUCCESS);

         // Step 18. Prepare
         xaRes.prepare(xid1);

         // Step 19. Roll back the transaction
         xaRes.rollback(xid1);

         // Step 20. No messages should be received!
         checkNoMessageReceived();

         // Step 21. Create another transaction
         Xid xid2 = new DummyXid("xa-example2".getBytes(), 1, UUIDGenerator.getInstance()
                                                                           .generateStringUUID()
                                                                           .getBytes());

         // Step 22. Start the transaction
         xaRes.start(xid2, XAResource.TMNOFLAGS);
View Full Code Here

Examples of org.infinispan.transaction.tm.DummyXid

      txTable = new XaTransactionTable();
      TransactionFactory gtf = new TransactionFactory();
      gtf.init(false, false, true, false);
      globalTransaction = gtf.newGlobalTransaction(null, false);
      localTx = new LocalXaTransaction(new DummyTransaction(null), globalTransaction, false, 1);
      xid = new DummyXid(uuid);
      localTx.setXid(xid);
      txTable.addLocalTransactionMapping(localTx);     

      configuration = new ConfigurationBuilder().build();
      txCoordinator = new TransactionCoordinator();
View Full Code Here

Examples of org.infinispan.transaction.tm.DummyXid

      xaAdapter = new TransactionXaAdapter(localTx, txTable, null, txCoordinator, null, null,
                                           new ClusteringDependentLogic.InvalidationLogic(), configuration, "");
   }

   public void testPrepareOnNonexistentXid() {
      DummyXid xid = new DummyXid(uuid);
      try {
         xaAdapter.prepare(xid);
         assert false;
      } catch (XAException e) {
         assert e.errorCode == XAException.XAER_NOTA;
View Full Code Here

Examples of org.infinispan.transaction.tm.DummyXid

         assert e.errorCode == XAException.XAER_NOTA;
      }
   }

   public void testCommitOnNonexistentXid() {
      DummyXid xid = new DummyXid(uuid);
      try {
         xaAdapter.commit(xid, false);
         assert false;
      } catch (XAException e) {
         assert e.errorCode == XAException.XAER_NOTA;
View Full Code Here

Examples of org.infinispan.transaction.tm.DummyXid

         assert e.errorCode == XAException.XAER_NOTA;
      }
   }

   public void testRollabckOnNonexistentXid() {
      DummyXid xid = new DummyXid(uuid);
      try {
         xaAdapter.rollback(xid);
         assert false;
      } catch (XAException e) {
         assert e.errorCode == XAException.XAER_NOTA;
View Full Code Here

Examples of org.infinispan.transaction.tm.DummyXid

   public void test1PcAndNonExistentXid() {
      Configuration configuration = new ConfigurationBuilder().clustering().cacheMode(CacheMode.INVALIDATION_ASYNC).build();
      txCoordinator.init(null, null, null, null, configuration);
      try {
         DummyXid doesNotExists = new DummyXid(uuid);
         xaAdapter.commit(doesNotExists, false);
         assert false;
      } catch (XAException e) {
         assert e.errorCode == XAException.XAER_NOTA;
      }
View Full Code Here

Examples of org.infinispan.transaction.tm.DummyXid

   public void test1PcAndNonExistentXid2() {
      Configuration configuration = new ConfigurationBuilder().clustering().cacheMode(CacheMode.DIST_SYNC).build();
      txCoordinator.init(null, null, null, null, configuration);
      try {
         DummyXid doesNotExists = new DummyXid(uuid);
         xaAdapter.commit(doesNotExists, true);
         assert false;
      } catch (XAException e) {
         assert e.errorCode == XAException.XAER_NOTA;
      }
View Full Code Here

Examples of org.infinispan.transaction.tm.DummyXid

      txTable = new XaTransactionTable();
      TransactionFactory gtf = new TransactionFactory();
      gtf.init(false, false, true, false);
      globalTransaction = gtf.newGlobalTransaction(null, false);
      localTx = new LocalXaTransaction(new DummyTransaction(null), globalTransaction, false, 1, AnyEquivalence.getInstance());
      xid = new DummyXid(uuid);
      localTx.setXid(xid);
      txTable.addLocalTransactionMapping(localTx);     

      configuration = new ConfigurationBuilder().build();
      txCoordinator = new TransactionCoordinator();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.