|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.mockrunner.mock.ejb.EJBMockObjectFactory
public class EJBMockObjectFactory
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 that they are all up to date.
This factory takes the UserTransaction
from the JNDI context.
If there's no transaction bound to the context, the factory will create a
MockUserTransaction
and bind it to the context.
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
and
the JNDI Context
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 | |
---|---|
MockUserTransaction |
createMockUserTransaction()
Creates the MockUserTransaction using new . |
javax.naming.Context |
getContext()
Returns the JNDI context that is used by this factory. |
org.mockejb.MockContainer |
getMockContainer()
Returns the MockEJB MockContainer . |
MockUserTransaction |
getMockUserTransaction()
Returns the MockUserTransaction . |
javax.transaction.UserTransaction |
getUserTransaction()
Returns the UserTransaction . |
void |
initMockContextFactory()
Calls MockContextFactory.setAsInitial() , if
MockContextFactory is not already the current
context factory. |
void |
resetMockContextFactory()
Calls MockContextFactory.revertSetAsInitial() , if
MockContextFactory is the current context factory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EJBMockObjectFactory()
public EJBMockObjectFactory(Configuration configuration)
Method Detail |
---|
public MockUserTransaction createMockUserTransaction()
MockUserTransaction
using new
.
This method can be overridden to return a subclass of MockUserTransaction
.
MockUserTransaction
public void initMockContextFactory() throws javax.naming.NamingException
MockContextFactory.setAsInitial()
, if
MockContextFactory
is not already the current
context factory.
javax.naming.NamingException
public void resetMockContextFactory()
MockContextFactory.revertSetAsInitial()
, if
MockContextFactory
is the current context factory.
public MockUserTransaction getMockUserTransaction()
MockUserTransaction
.
If the bound transaction is no MockUserTransaction
,
this method returns null
.
MockUserTransaction
public javax.transaction.UserTransaction getUserTransaction()
UserTransaction
.
UserTransaction
public org.mockejb.MockContainer getMockContainer()
MockContainer
.
MockContainer
public javax.naming.Context getContext()
Context
using Configuration.setContext(javax.naming.Context)
},
the JNDI implementation of MockEJB is used.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |