public class MockEjbContext implements SessionContext,MessageDrivenContext,EntityContext,Serializable(Code)
Provides implementation of javax.ejb.SessionContext,
javax.ejb.MessageDrivenContext and javax.ejb.EntityContext
as well as some extra convenience methods.
author: Alexander Ananiev
isRemote() Tests if the business interface for this context's bean is remote interface
meaning that it extends EJBObject.
This is useful for exception handling and in other places where local/remote
interfaces behave differently.
Returns the principal that was logged in using
MockContainer.login. Returns the anonymous principal if
login was not called.
principal of the logged in user or anonymous principal See Also: javax.ejb.EJBContext.getCallerPrincipal
Returns the primary key for entity beans. If the context is assotiated with
Session bean or MDB, returns null.
MockEJB does not automatically handles primary keys for
entity beans. Since "create" returns null, you need to intercept "create" methods
of your entity bean and return the real PK.
See Also: javax.ejb.EntityContext.getPrimaryKey
Calls
TransactionManager to get the
javax.transaction.UserTransaction object.
javax.transaction.UserTransaction object See Also: javax.ejb.EJBContext.getUserTransaction
Tests if the business interface for this context's bean is remote interface
meaning that it extends EJBObject.
This is useful for exception handling and in other places where local/remote
interfaces behave differently.
true if the business interface of this context's EJB implements remote interface. Always returns false for message-driven beans.