Package org.hornetq.core.transaction.impl

Examples of org.hornetq.core.transaction.impl.XidImpl


      super.tearDown();
   }

   public void testSimpleTimeoutOnSendOnCommit() throws Exception
   {
      Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());

      ClientMessage m1 = createTextMessage("m1", clientSession);
      ClientMessage m2 = createTextMessage("m2", clientSession);
      ClientMessage m3 = createTextMessage("m3", clientSession);
      ClientMessage m4 = createTextMessage("m4", clientSession);
View Full Code Here


      Assert.assertNull(m);
   }

   public void testSimpleTimeoutOnReceive() throws Exception
   {
      Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());

      ClientMessage m1 = createTextMessage("m1", clientSession);
      ClientMessage m2 = createTextMessage("m2", clientSession);
      ClientMessage m3 = createTextMessage("m3", clientSession);
      ClientMessage m4 = createTextMessage("m4", clientSession);
View Full Code Here

      clientSession2.close();
   }

   public void testSimpleTimeoutOnSendAndReceive() throws Exception
   {
      Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());

      ClientMessage m1 = createTextMessage("m1", clientSession);
      ClientMessage m2 = createTextMessage("m2", clientSession);
      ClientMessage m3 = createTextMessage("m3", clientSession);
      ClientMessage m4 = createTextMessage("m4", clientSession);
View Full Code Here

      clientSession2.close();
   }

   public void testPreparedTransactionNotTimedOut() throws Exception
   {
      Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());

      ClientMessage m1 = createTextMessage("m1", clientSession);
      ClientMessage m2 = createTextMessage("m2", clientSession);
      ClientMessage m3 = createTextMessage("m3", clientSession);
      ClientMessage m4 = createTextMessage("m4", clientSession);
View Full Code Here

      clientSession2.close();
   }

   public void testChangingTimeoutGetsPickedUp() throws Exception
   {
      Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());

      ClientMessage m1 = createTextMessage("m1", clientSession);
      ClientMessage m2 = createTextMessage("m2", clientSession);
      ClientMessage m3 = createTextMessage("m3", clientSession);
      ClientMessage m4 = createTextMessage("m4", clientSession);
View Full Code Here

   public void testMultipleTransactionsTimedOut() throws Exception
   {
      Xid[] xids = new XidImpl[100];
      for (int i = 0; i < xids.length; i++)
      {
         xids[i] = new XidImpl(("xa" + i).getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
      }
      ClientSession[] clientSessions = new ClientSession[xids.length];
      for (int i = 0; i < clientSessions.length; i++)
      {
         clientSessions[i] = sessionFactory.createSession(true, false, false);
View Full Code Here

      testPaging(false);
   }

   public void testPaging(final boolean restartServer) throws Exception
   {
      Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());

      SimpleString pageQueue = new SimpleString("pagequeue");

      AddressSettings pageAddressSettings = new AddressSettings();
      pageAddressSettings.setMaxSizeBytes(100 * 1024);
      pageAddressSettings.setPageSizeBytes(10 * 1024);

      addressSettings.put(pageQueue.toString(), pageAddressSettings);

      addSettings();

      clientSession.createQueue(pageQueue, pageQueue, null, true);

      clientSession.start(xid, XAResource.TMNOFLAGS);

      ClientProducer pageProducer = clientSession.createProducer(pageQueue);

      for (int i = 0; i < 1000; i++)
      {
         ClientMessage m = createBytesMessage(new byte[512], true);
         pageProducer.send(m);
      }

      pageProducer.close();

      clientSession.end(xid, XAResource.TMSUCCESS);
      clientSession.prepare(xid);

      BasicXaRecoveryTest.log.info("*** stopping and restarting");

      if (restartServer)
      {
         stopAndRestartServer();
      }
      else
      {
         recreateClients();
      }

      Xid[] xids = clientSession.recover(XAResource.TMSTARTRSCAN);
      Assert.assertEquals(xids.length, 1);
      Assert.assertEquals(xids[0].getFormatId(), xid.getFormatId());
      UnitTestCase.assertEqualsByteArrays(xids[0].getBranchQualifier(), xid.getBranchQualifier());
      UnitTestCase.assertEqualsByteArrays(xids[0].getGlobalTransactionId(), xid.getGlobalTransactionId());

      clientSession.commit(xid, false);

      clientSession.close();

View Full Code Here

      testRollbackPaging(true);
   }

   public void testRollbackPaging(final boolean restartServer) throws Exception
   {
      Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());

      SimpleString pageQueue = new SimpleString("pagequeue");

      AddressSettings pageAddressSettings = new AddressSettings();
      pageAddressSettings.setMaxSizeBytes(100 * 1024);
      pageAddressSettings.setPageSizeBytes(10 * 1024);

      addressSettings.put(pageQueue.toString(), pageAddressSettings);

      addSettings();

      clientSession.createQueue(pageQueue, pageQueue, null, true);

      clientSession.start(xid, XAResource.TMNOFLAGS);

      ClientProducer pageProducer = clientSession.createProducer(pageQueue);

      for (int i = 0; i < 1000; i++)
      {
         ClientMessage m = createBytesMessage(new byte[512], true);
         pageProducer.send(m);
      }

      clientSession.end(xid, XAResource.TMSUCCESS);
      clientSession.prepare(xid);

      if (restartServer)
      {
         stopAndRestartServer();
      }
      else
      {
         recreateClients();
      }

      Xid[] xids = clientSession.recover(XAResource.TMSTARTRSCAN);
      Assert.assertEquals(1, xids.length);
      Assert.assertEquals(xids[0].getFormatId(), xid.getFormatId());
      UnitTestCase.assertEqualsByteArrays(xids[0].getBranchQualifier(), xid.getBranchQualifier());
      UnitTestCase.assertEqualsByteArrays(xids[0].getGlobalTransactionId(), xid.getGlobalTransactionId());

      clientSession.rollback(xid);

      clientSession.start();

View Full Code Here

      testNonPersistent(false);
   }

   public void testNonPersistent(final boolean commit) throws Exception
   {
      Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());

      ClientMessage m1 = createTextMessage("m1", false);
      ClientMessage m2 = createTextMessage("m2", false);
      ClientMessage m3 = createTextMessage("m3", false);
      ClientMessage m4 = createTextMessage("m4", false);

      clientSession.start(xid, XAResource.TMNOFLAGS);
      clientProducer.send(m1);
      clientProducer.send(m2);
      clientProducer.send(m3);
      clientProducer.send(m4);
      clientSession.end(xid, XAResource.TMSUCCESS);
      clientSession.prepare(xid);

      stopAndRestartServer();

      Xid[] xids = clientSession.recover(XAResource.TMSTARTRSCAN);

      Assert.assertEquals(xids.length, 1);
      Assert.assertEquals(xids[0].getFormatId(), xid.getFormatId());
      UnitTestCase.assertEqualsByteArrays(xids[0].getBranchQualifier(), xid.getBranchQualifier());
      UnitTestCase.assertEqualsByteArrays(xids[0].getGlobalTransactionId(), xid.getGlobalTransactionId());
      xids = clientSession.recover(XAResource.TMENDRSCAN);
      Assert.assertEquals(xids.length, 0);
      if (commit)
      {
         clientSession.commit(xid, false);
View Full Code Here

   public void testNonPersistentMultipleIDs() throws Exception
   {
      for (int i = 0; i < 10; i++)
      {
         Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());

         ClientMessage m1 = createTextMessage("m1", false);
         ClientMessage m2 = createTextMessage("m2", false);
         ClientMessage m3 = createTextMessage("m3", false);
         ClientMessage m4 = createTextMessage("m4", false);
View Full Code Here

TOP

Related Classes of org.hornetq.core.transaction.impl.XidImpl

Copyright © 2018 www.massapicom. 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.