com.mockrunner.mock.ejb
Class EJBMockObjectFactory

java.lang.Object
  extended bycom.mockrunner.mock.ejb.EJBMockObjectFactory

public class EJBMockObjectFactory
extends java.lang.Object

Used to create all types of EJB mock objects. Maintains the necessary dependencies between the mock objects. If you use the mock objects returned by this factory in your tests you can be sure, they are all up to date. This factory takes the UserTransaction from the MockEJB mock context. If there's no transaction bound to the mock context, the factory will create and bind a MockUserTransaction. If the bound transaction is no MockUserTransaction, the method getMockUserTransaction() returns null. Use getUserTransaction() instead in this case. You can configure the JNDI name of the UserTransaction with the class Configuration.


Constructor Summary
EJBMockObjectFactory()
          Creates a new set of mock objects.
EJBMockObjectFactory(Configuration configuration)
          Creates a new set of mock objects based on the specified configuration.
 
Method Summary
 org.mockejb.MockContainer getMockContainer()
          Returns the MockEJB MockContainer.
 MockUserTransaction getMockUserTransaction()
          Returns the MockUserTransaction.
 javax.transaction.UserTransaction getUserTransaction()
          Returns the UserTransaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EJBMockObjectFactory

public EJBMockObjectFactory()
Creates a new set of mock objects.


EJBMockObjectFactory

public EJBMockObjectFactory(Configuration configuration)
Creates a new set of mock objects based on the specified configuration.

Method Detail

getMockUserTransaction

public MockUserTransaction getMockUserTransaction()
Returns the MockUserTransaction. If the bound transaction is no MockUserTransaction, this method returns null.

Returns:
the MockUserTransaction

getUserTransaction

public javax.transaction.UserTransaction getUserTransaction()
Returns the UserTransaction.

Returns:
the UserTransaction

getMockContainer

public org.mockejb.MockContainer getMockContainer()
Returns the MockEJB MockContainer.

Returns:
the MockContainer