Examples of TransactionManagerImple


Examples of com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple

    FileHelper.delete( tempDirectory );
  }

  @Test
  public void testJBossTS() throws Exception {
    TransactionManagerImple tm = new TransactionManagerImple();
    tm.begin();
    EntityManager em = factory.createEntityManager();
    Tweet tweet = new Tweet( "Spice is the essence of life" );
    em.persist( tweet );
    tm.commit();
    em.close();

    tm.begin();
    em = factory.createEntityManager();
    FullTextEntityManager ftem = Search.getFullTextEntityManager( em );
    final QueryBuilder builder = ftem.getSearchFactory().buildQueryBuilder().forEntity( Tweet.class ).get();
    final Query query = builder
        .keyword()
        .onField( "text" )
        .matching( "spice" )
        .createQuery();

    ftem.createFullTextQuery( query, Tweet.class ).getResultList();
    final List resultList = em.createQuery( "from " + Tweet.class.getName() ).getResultList();
    Assert.assertEquals( 1, resultList.size() );
    for ( Object o : resultList ) {
      em.remove( o );
    }
    tm.commit();

    em.close();
  }
View Full Code Here

Examples of com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple

      return new InitialContext(ServerManagement.getJNDIEnvironment(serverid));
   }

   protected TransactionManager getTransactionManager()
   {
      return new TransactionManagerImple();
   }
View Full Code Here

Examples of com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple

   public void testDeliveryCountUpdatedOnCloseXA() throws Exception
   {
      XAConnection xaConn = null;

      Connection conn = null;
      TransactionManager mgr = new TransactionManagerImple();

      Transaction toResume = null;

      Transaction tx = null;

      try
      {
         toResume = mgr.suspend();

         conn = getConnectionFactory().createConnection();

         // Send a message

         Session producerSess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageProducer producer = producerSess.createProducer(HornetQServerTestCase.queue1);

         TextMessage tm = producerSess.createTextMessage("message1");

         producer.send(tm);

         xaConn = ((XAConnectionFactory)getXAConnectionFactory()).createXAConnection();

         XASession consumerSess = xaConn.createXASession();
         MessageConsumer consumer = consumerSess.createConsumer(HornetQServerTestCase.queue1);
         xaConn.start();

         DummyXAResource res = new DummyXAResource();

         mgr.begin();

         tx = mgr.getTransaction();

         tx.enlistResource(res);

         tx.enlistResource(consumerSess.getXAResource());

         TextMessage rm = (TextMessage)consumer.receive(1000);

         ProxyAssertSupport.assertNotNull(rm);

         ProxyAssertSupport.assertEquals(tm.getText(), rm.getText());

         ProxyAssertSupport.assertEquals(1, rm.getIntProperty("JMSXDeliveryCount"));

         ProxyAssertSupport.assertFalse(rm.getJMSRedelivered());

         tx.delistResource(res, XAResource.TMSUCCESS);

         tx.delistResource(consumerSess.getXAResource(), XAResource.TMSUCCESS);

         mgr.rollback();

         mgr.begin();

         tx = mgr.getTransaction();

         tx.enlistResource(res);

         tx.enlistResource(consumerSess.getXAResource());

         rm = (TextMessage)consumer.receive(1000);

         ProxyAssertSupport.assertNotNull(rm);

         ProxyAssertSupport.assertEquals(tm.getText(), rm.getText());

         ProxyAssertSupport.assertEquals(2, rm.getIntProperty("JMSXDeliveryCount"));

         ProxyAssertSupport.assertTrue(rm.getJMSRedelivered());

         tx.delistResource(res, XAResource.TMSUCCESS);

         tx.delistResource(consumerSess.getXAResource(), XAResource.TMSUCCESS);

         mgr.rollback();

         mgr.begin();

         tx = mgr.getTransaction();

         tx.enlistResource(res);

         tx.enlistResource(consumerSess.getXAResource());

         rm = (TextMessage)consumer.receive(1000);

         ProxyAssertSupport.assertNotNull(rm);

         ProxyAssertSupport.assertEquals(tm.getText(), rm.getText());

         ProxyAssertSupport.assertEquals(3, rm.getIntProperty("JMSXDeliveryCount"));

         ProxyAssertSupport.assertTrue(rm.getJMSRedelivered());

         tx.delistResource(res, XAResource.TMSUCCESS);

         tx.delistResource(consumerSess.getXAResource(), XAResource.TMSUCCESS);

         mgr.rollback();

         // Must close consumer first

         consumer.close();

         consumerSess.close();

         consumerSess = xaConn.createXASession();

         consumer = consumerSess.createConsumer(HornetQServerTestCase.queue1);

         mgr.begin();

         tx = mgr.getTransaction();

         tx.enlistResource(res);

         tx.enlistResource(consumerSess.getXAResource());

         rm = (TextMessage)consumer.receive(1000);

         ProxyAssertSupport.assertNotNull(rm);

         ProxyAssertSupport.assertEquals(tm.getText(), rm.getText());

         ProxyAssertSupport.assertEquals(4, rm.getIntProperty("JMSXDeliveryCount"));

         ProxyAssertSupport.assertTrue(rm.getJMSRedelivered());

         tx.delistResource(res, XAResource.TMSUCCESS);

         tx.delistResource(consumerSess.getXAResource(), XAResource.TMSUCCESS);
      }
      finally
      {
         if (conn != null)
         {
            conn.close();
         }

         if (tx != null)
         {
            try
            {
               mgr.commit();
            }
            catch (Exception ignore)
            {
            }
         }
         if (xaConn != null)
         {
            xaConn.close();
         }

         if (toResume != null)
         {
            try
            {
               mgr.resume(toResume);
            }
            catch (Exception ignore)
            {
            }
         }
View Full Code Here

Examples of com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple

      return new InitialContext(ServerManagement.getJNDIEnvironment(serverid));
   }

   protected TransactionManager getTransactionManager()
   {
      return new TransactionManagerImple();
   }
View Full Code Here

Examples of com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple

    {
        final LastOnePhaseResource firstResource = new LastOnePhaseResource() ;
        final LastOnePhaseResource secondResource = new LastOnePhaseResource() ;
        final LastOnePhaseResource thirdResource = new LastOnePhaseResource() ;
       
        final TransactionManager tm = new TransactionManagerImple() ;
        tm.begin() ;
        try
        {
            final Transaction tx = tm.getTransaction() ;
            assertTrue("First resource enlisted", tx.enlistResource(firstResource)) ;
            assertTrue("Second resource enlisted", tx.enlistResource(secondResource)) ;
            assertTrue("Third resource enlisted", tx.enlistResource(thirdResource)) ;
        }
        finally
        {
            tm.rollback() ;
        }
    }
View Full Code Here

Examples of com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple

        throws SystemException, NotSupportedException, RollbackException
    {
        final LastOnePhaseResource firstResource = new LastOnePhaseResource() ;
        final LastOnePhaseResource secondResource = new LastOnePhaseResource() ;
       
        final TransactionManager tm = new TransactionManagerImple() ;
        tm.begin() ;
        try
        {
            final Transaction tx = tm.getTransaction() ;
            assertTrue("First resource enlisted", tx.enlistResource(firstResource)) ;
            assertFalse("Second resource enlisted", tx.enlistResource(secondResource)) ;
        }
        finally
        {
            tm.rollback() ;
        }
    }
View Full Code Here

Examples of com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple

    /**
     * Construct the delegate with the appropriate transaction manager
     */
    public TransactionManagerDelegate()
    {
        super(new TransactionManagerImple());
    }
View Full Code Here

Examples of com.arjuna.mwlabs.wst11.at.remote.TransactionManagerImple

  private final void enlistCompletionParticipants ()
      throws WrongStateException, UnknownTransactionException,
      SystemException
  {
        TransactionManagerImple tm = (TransactionManagerImple) TransactionManager.getTransactionManager();

        final TxContextImple txContext = (TxContextImple) tm.currentTransaction();
        final String id = txContext.identifier();
        final W3CEndpointReference completionCoordinator = tm.enlistForCompletion(getCompletionParticipant(id, txContext.isSecure()));

        _completionCoordinators.put(id, completionCoordinator);
  }
View Full Code Here

Examples of com.arjuna.mwlabs.wst11.at.remote.TransactionManagerImple

      throws WrongStateException, UnknownTransactionException,
      SystemException
  {
    try
    {
      TransactionManagerImple tm = (TransactionManagerImple) TransactionManager.getTransactionManager();

            final TxContextImple txContext = (TxContextImple) tm.currentTransaction();
            final String id = txContext.identifier();
            final W3CEndpointReference completionCoordinator = tm.enlistForCompletion(getCompletionParticipant(id, txContext.isSecure()));

      _completionCoordinators.put(id, completionCoordinator);
    }
    catch (com.arjuna.wsc.AlreadyRegisteredException ex)
    {
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.