net.sourceforge.junitejb
Class EJBTestCase

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended bynet.sourceforge.junitejb.EJBTestCase
All Implemented Interfaces:
junit.framework.Test

public class EJBTestCase
extends junit.framework.TestCase

An ejb test case is an extension to test case where the test is executed in the ejb server's virtual machine. Two new methods setUpEJB and tearDownEJB have been added. These methods work just like setUp and tearDown except they run in a sepperate transaction. The execution order is as follows:

 	1. setUpEJB (TX 1)
 	2. run (TX 2)
 		2.1. runBare
 			2.1.1 setUp
 			2.1.2 
 			2.1.3 tearDown
 	3. ejbTearDown (TX 2)
 
For an ejb test case to run successfully, the following must be setup:
 	1. The ejb test case class must be availabe to the client vm.
 	2. The ejb test case class must be availabe to the EJBTestRunner bean
 			on the server.
 	3. The EJBTestRunnerHome must be bound to "ejb/EJBTestRunner" in the
 			jndi context obtained from new InitialContext();
 	4. The EJBTestRunner bean must be configured as specified in the 
 			EJBTestRunner javadoc.
 

Version:
$Revision: 1.3 $
Author:
Dain Sundstrom
See Also:
EJBTestRunner, TestCase

Constructor Summary
EJBTestCase(java.lang.String methodName)
          Constructs a test case that will run the method with the specified name.
 
Method Summary
 boolean isServerSide()
          Is this class running on the server side?
 void run(junit.framework.TestResult result)
           
 void runBare()
           
 void setServerSide(boolean serverSide)
          Sets the flag that is used to determine if the class is running on the server side.
 void setUpEJB()
          Sets up the ejb test case.
 void tearDownEJB()
          Tears down the ejb test case.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EJBTestCase

public EJBTestCase(java.lang.String methodName)
Constructs a test case that will run the method with the specified name.

Parameters:
methodName - the name of the method that will executed when this test is run
Method Detail

setServerSide

public void setServerSide(boolean serverSide)
Sets the flag that is used to determine if the class is running on the server side.

Parameters:
serverSide - boolean flag that this class uses to determine if it's running on the server side.

isServerSide

public boolean isServerSide()
Is this class running on the server side?

Returns:
true if this class is running on the server side

run

public void run(junit.framework.TestResult result)

runBare

public void runBare()
             throws java.lang.Throwable
Throws:
java.lang.Throwable

setUpEJB

public void setUpEJB()
              throws java.lang.Exception
Sets up the ejb test case. This method is called before each test is executed and is run in a private transaction.

Throws:
java.lang.Exception - if a problem occures

tearDownEJB

public void tearDownEJB()
                 throws java.lang.Exception
Tears down the ejb test case. This method is called after each test is executed and is run in a private transaction.

Throws:
java.lang.Exception - if a problem occures


Distributable under LGPL license. See terms of license at gnu.org