FileDocCategorySizeDatePackage
DeploymentDescriptorTesterBean.javaAPI DocJBoss 4.2.14373Fri Jul 13 20:53:30 BST 2007org.jboss.ejb3.test.bmt

DeploymentDescriptorTesterBean

public class DeploymentDescriptorTesterBean extends Object implements DeploymentDescriptorTesterRemote
version
$Revision: 60233 $
author
William DeCoste

Fields Summary
DeploymentDescriptorStatelessLocal
stateless
TransactionManager
tm
protected static Logger
log
Constructors Summary
Methods Summary
DeploymentDescriptorStatefulLocalgetStateful()

      InitialContext ctx = new InitialContext();
      return (DeploymentDescriptorStatefulLocal)ctx.lookup("DeploymentDescriptorStateful/local");
   
public voidtestStatefulWithTx()

      DeploymentDescriptorStatefulLocal stateful = getStateful();
      Transaction tx = stateful.beginNoEnd();
      stateful.endCommit(tx);
      tx = stateful.beginNoEnd();
      stateful.endRollback(tx);

      stateful.beginCommitEnd();
      stateful.beginRollbackEnd();

   
public voidtestStatefulWithoutTx()

      DeploymentDescriptorStatefulLocal stateful = getStateful();
      Transaction tx = stateful.beginNoEnd();
      if (tm.getTransaction() != null) throw new RuntimeException("tx is associated");
      stateful.endCommit(tx);
      if (tm.getTransaction() != null) throw new RuntimeException("tx is associated");
      tx = stateful.beginNoEnd();
      if (tm.getTransaction() != null) throw new RuntimeException("tx is associated");
      stateful.endRollback(tx);
      if (tm.getTransaction() != null) throw new RuntimeException("tx is associated");

      stateful.beginCommitEnd();
      if (tm.getTransaction() != null) throw new RuntimeException("tx is associated");
      stateful.beginRollbackEnd();
      if (tm.getTransaction() != null) throw new RuntimeException("tx is associated");

   
public voidtestStatelessWithTx()


       
   
      stateless.beginCommitEnd();
      stateless.beginRollbackEnd();

      try
      {
         stateless.beginNoEnd();
      }
      catch (Exception e)
      {
         if (e instanceof TestException) throw e;
         log.info("should be EJBException thrown that begin and no end was called: ", e);
      }
   
public voidtestStatelessWithoutTx()

      stateless.beginCommitEnd();
      if (tm.getTransaction() != null) throw new RuntimeException("tx is associated");
      stateless.beginRollbackEnd();
      if (tm.getTransaction() != null) throw new RuntimeException("tx is associated");

      try
      {
         stateless.beginNoEnd();
      }
      catch (Exception e)
      {
         if (e instanceof TestException) throw e;
         log.info("should be EJBException thrown that begin and no end was called: ", e);
      }
      if (tm.getTransaction() != null) throw new RuntimeException("tx is associated");