Package org.jboss.test.jca.adapter

Examples of org.jboss.test.jca.adapter.TestConnectionFactory


      }
      mcf.setSleepInStart(200);
      mcf.setSleepInEnd(200);
      cm.setLocalTransactions(false);
      poolingStrategy.setConnectionListenerFactory(cm);
      cf = new TestConnectionFactory(new ConnectionManagerProxy(), mcf);
   }
View Full Code Here


    */
   public boolean testUserTxJndi()
   {
      try
      {
         TestConnectionFactory tcf = (TestConnectionFactory)new InitialContext().lookup("java:/JBossTestCF");
         TestConnection tc = (TestConnection)tcf.getConnection();
         UserTransaction ut = (UserTransaction)new InitialContext().lookup("UserTransaction");
         ut.begin();
         boolean result = tc.isInTx();
         log.info("Jndi test, inTx: " + result);
         ut.commit();
View Full Code Here

    */
   public boolean testUserTxSessionCtx()
   {
      try
      {
         TestConnectionFactory tcf = (TestConnectionFactory)new InitialContext().lookup("java:/JBossTestCF");
         TestConnection tc = (TestConnection)tcf.getConnection();
         UserTransaction ut = ctx.getUserTransaction();
         ut.begin();
         boolean result = tc.isInTx();
         log.info("ctx test, inTx: " + result);
         ut.commit();
View Full Code Here

   /**
    * @ejb:interface-method
    */
   public void testUnclosedError() throws Exception
   {
      TestConnectionFactory tcf = (TestConnectionFactory)new InitialContext().lookup("java:/JBossTestCF");
      tcf.getConnection(); // DONT CLOSE
   }
View Full Code Here

      log.info(failure + " teststart");
      try
      {
         long available = getAvailableConnections();
         InitialContext ctx = new InitialContext();
         TestConnectionFactory cf = (TestConnectionFactory) ctx.lookup("java:/JBossTestCF");
         for (int i = 0; i < count; ++i)
         {
            try
            {
               TestConnection c = (TestConnection) cf.getConnection(failure);
               c.close();
            }
            catch (ResourceException expected)
            {
            }
View Full Code Here

    * @ejb.interface-method
    */
   public void simulateFactoryError(String failure, int count)
   {
      log.info(failure + " start");
      TestConnectionFactory cf = null;
      try
      {
         long available = getAvailableConnections();
         InitialContext ctx = new InitialContext();
         cf = (TestConnectionFactory) ctx.lookup("java:/JBossTestCF");
         cf.setFailure(failure);
         for (int i = 0; i < count; ++i)
         {
            try
            {
               TestConnection c = (TestConnection) cf.getConnection(failure);
               c.close();
            }
            catch (ResourceException expected)
            {
            }
         }
         if (available != getAvailableConnections())
            throw new EJBException("Expected " + available + " got " + getAvailableConnections() + " connections");
      }
      catch (Exception e)
      {
         log.warn("Unexpected: ", e);
         throw new EJBException(e.getMessage());
      }
      finally
      {
         sessionContext.setRollbackOnly();
         if (cf != null)
            cf.setFailure(null);
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.test.jca.adapter.TestConnectionFactory

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.