Java Doc for MockContainer.java in  » Testing » MockEJB » org » mockejb » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » MockEJB » org.mockejb 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.mockejb.MockContainer

MockContainer
public class MockContainer (Code)
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.
author:
   Alexander Ananiev



Constructor Summary
public  MockContainer(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. Clears the EntityDatabase as well. Creates a default (anonymous) user which is used for all EJB operations unless "login" is called explicitly.

Method Summary
public  MessageListenercreateMessageBean(MockEjbObject ejbObject)
     Creates message-driven bean.
public  voiddeploy(SessionBeanDescriptor descriptor)
     Deploys session bean specified by the given descriptor. MockContainer creates the proxy implementing session bean home interface and binds it to the JNDI context using rebind() method.
public  voiddeploy(EntityBeanDescriptor descriptor)
     Deploys entity bean specified by the given descriptor.
public  voiddeploy(MDBDescriptor descriptor)
     If "isAlreadyBound" is "false" in deployment descriptor, creates mock connection factory and destination and bind them to JNDI. Otherwise, assumes that the connection factory and destination were created previously and available from JNDI.
public  EntityDatabasegetEntityDatabase()
     Returns an instance of the EntityDatabase that will be used by the system interceptors (Finder Handlers) used by this instance of the container.
public static  MockUsergetUser()
     Returns the user that was passed to the MockContainer.login method.
public static  booleanisSystemException(Throwable throwable)
     Tests if the given throwable is the system exception in terms of the container.
protected  voidloadEntityDatabase()
    
public  voidlogin(MockUser user)
     Simulates the login operation of the container.
protected  voidsetupDefaultInterceptors()
     Add the interceptors that should always be present to the AspectSystem.


Constructor Detail
MockContainer
public MockContainer(Context context)(Code)
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. Clears the EntityDatabase as well. Creates a default (anonymous) user which is used for all EJB operations unless "login" is called explicitly.
Parameters:
  context - JNDI context to use for all "bind" operations




Method Detail
createMessageBean
public MessageListener createMessageBean(MockEjbObject ejbObject)(Code)
Creates message-driven bean. This method emulates create() method of the Session bean home interface. Since MDBs don't have home interface, MockContainer provides this service for MDB clients.
Parameters:
  ejbObject - MockEjbObject of the message bean created by deployMessageBean() implementation of the MessageListener interface. The interface is implemented by a proxy provided by MockEjbObject.



deploy
public void deploy(SessionBeanDescriptor descriptor) throws NamingException(Code)
Deploys session bean specified by the given descriptor. 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().
Parameters:
  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.



deploy
public void deploy(EntityBeanDescriptor descriptor) throws NamingException(Code)
Deploys entity bean specified by the given descriptor.



deploy
public void deploy(MDBDescriptor descriptor) throws NamingException, JMSException(Code)
If "isAlreadyBound" is "false" in deployment descriptor, creates mock connection factory and destination and bind them to JNDI. Otherwise, assumes that the connection factory and destination were created previously and available from JNDI. The default is "false". Creates MDB and sets it to listen on the destination. Handles both queues and topics, depending on "isTopic" setting of the deployment descriptor. Note that mock JMS implementation is synchronous, in other words the message sent to the destination is delivered to MDB right away.
Parameters:
  descriptor - deployment descriptor of the MDB specifying JNDI names ofconnection factory and destinations as well as the bean implementation object.
throws:
  NamingException - in case of problems binding to JNDI or retrieving objects from JNDI
throws:
  JMSException - in case of problems with mock connection factory or destination.



getEntityDatabase
public EntityDatabase getEntityDatabase()(Code)
Returns an instance of the EntityDatabase that will be used by the system interceptors (Finder Handlers) used by this instance of the container. an instance of the entity database



getUser
public static MockUser getUser()(Code)
Returns the user that was passed to the MockContainer.login method. Note that the user is stored as a ThreadLocal variable, so it is available to all classes. Returns the anonymous user if login was not called. the current user of the MockContainer



isSystemException
public static boolean isSystemException(Throwable throwable)(Code)
Tests if the given throwable is the system exception in terms of the container. Currently we consider all runtime exceptions and transaction-related exceptions system exceptions.
Note that the spec is vague on what is system and non-system exception, so this method might change in the future.
Parameters:
  throwable - exception in question true if the given throwable is "system" exception



loadEntityDatabase
protected void loadEntityDatabase()(Code)



login
public void login(MockUser user)(Code)
Simulates the login operation of the container. This method does not perform any security checks. It simply stores the given MockUser object for further use by EJBContext's security-related methods.
Parameters:
  user - user of the MockContainer



setupDefaultInterceptors
protected void setupDefaultInterceptors()(Code)
Add the interceptors that should always be present to the AspectSystem.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.