|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mockejb.MockContainer
Provides methods to "deploy" EJBs. Most deploy methods simply create Home proxy and bind it to the JNDI. Since MockEjb is not a container in a true sense, the purpose of this class is to provide an abstraction that emulates EJB deployment.
Constructor Summary | |
MockContainer(javax.naming.Context context)
Creates a new instance of the MockContainer for the given context, deletes all aspects from the AspectSystem and adds the system interceptors, such as ExceptionHandler. |
Method Summary | |
javax.jms.MessageListener |
createMessageBean(MockEjbObject ejbObject)
Deprecated. use deploy instead |
void |
deploy(EntityBeanDescriptor descriptor)
Deploys entity bean specified by the given descriptor. |
void |
deploy(MDBDescriptor descriptor)
If "isAlreadyBound" is "false" in deployment descriptor, creates mock connection factory and destination and bind them to JNDI. |
void |
deploy(SessionBeanDescriptor descriptor)
Deploys session bean specified by the given descriptor. |
EntityDatabase |
getEntityDatabase()
Returns an instance of the EntityDatabase that will be used by the system interceptors (Finder Handlers) used by this instance of the container. |
static MockUser |
getUser()
Returns the user that was passed to the MockContainer.login method. |
static boolean |
isSystemException(java.lang.Throwable throwable)
Tests if the given throwable is the system exception in terms of the container. |
protected void |
loadEntityDatabase()
|
void |
login(MockUser user)
Simulates the login operation of the container. |
protected void |
setupDefaultInterceptors()
Add the interceptors that should always be present to the AspectSystem. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MockContainer(javax.naming.Context context)
context
- JNDI context to use for all "bind" operationsMethod Detail |
public static MockUser getUser()
public void login(MockUser user)
user
- user of the MockContainerprotected void setupDefaultInterceptors()
public void deploy(SessionBeanDescriptor descriptor) throws javax.naming.NamingException
MockContainer
creates the proxy implementing
session bean home interface and binds it to the JNDI context
using rebind()
method.
Clients can subsequently lookup the home and invoke create()
.
descriptor
- descriptor of the session bean to deploy
As of MockEJB 0.6, this method does not return MockEjbObject since
the direct use of MockEjbObject is deprecated. AspectSystem should be used instead.
javax.naming.NamingException
public void deploy(EntityBeanDescriptor descriptor) throws javax.naming.NamingException
javax.naming.NamingException
public void deploy(MDBDescriptor descriptor) throws javax.naming.NamingException, javax.jms.JMSException
descriptor
- deployment descriptor of the MDB specifying JNDI names of
connection factory and destinations as well as the bean implementation object.
javax.naming.NamingException
- in case of problems binding to JNDI or retrieving objects from JNDI
javax.jms.JMSException
- in case of problems with mock connection factory or destination.public EntityDatabase getEntityDatabase()
public javax.jms.MessageListener createMessageBean(MockEjbObject ejbObject)
create()
method of the Session bean home interface.
Since MDBs don't have home interface, MockContainer
provides this
service for MDB clients.
ejbObject
- MockEjbObject of the message bean created by deployMessageBean()
public static boolean isSystemException(java.lang.Throwable throwable)
throwable
- exception in question
protected void loadEntityDatabase()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |