Java Doc for FundamentalsTest.java in  » Testing » MockEJB » org » mockejb » test » 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.test 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.mockejb.OptionalCactusTestCase
   org.mockejb.test.FundamentalsTest

FundamentalsTest
public class FundamentalsTest extends OptionalCactusTestCase implements Interceptor(Code)
Main MockEjb test case. Demonstrates the basic scenarios of MockEjb usage. This test runs in two modes. When Cactus mode is turned on (using "mockejb.cactus.mode" system property), it will run as the Cactus test (on the server). In this case, the test class will use EJBs deployed by the app server. Otherwise it will run outside of the app server under MockContainer. Cactus mode is supported by OptionalCactusTestCase superclass.
author:
   Alexander Ananiev

Inner Class :public static class ExternalServiceMockBean


Constructor Summary
public  FundamentalsTest(String name)
    

Method Summary
public  voidintercept(InvocationContext invocationContext)
     Implementation of the Interceptor interface that can be used for testing various preconditions/postconditions of the EJB call.
public  voidsetUp()
     Deploys and creates EJBs needed for our tests.
public  voidtearDown()
     Performs the necessary cleanup by restoring the system properties that were modified by MockContextFactory.setAsInitial(). This is needed in case if the test runs inside the container, so it would not affect the tests that run after it.
public  voidtestCustomInterceptor()
     Demonstrates the use of custom interceptors.
public  voidtestExceptionHandling()
     Test MockEJB exception handling.
public  voidtestHome()
     Tests standard Home and EJBMetaData methods.
public  voidtestInvocationRecorder()
     InvocationRecorder interceptor provides an easy way to inspect the data about the calls. If it added to the interceptor list, it will record the information about all calls to the bean. We'll use it to check that SampleBean called HelperBean and passed non-null parameter. We can only run this test if it is being executed outside of the container.
public  voidtestSecurity()
     This method demonstrates how to test beans that makes the use of use of the security-related methods of EJBContext (getCallerPrincipal, isCallerInRole).
public  voidtestSimpleCalls()
    


Constructor Detail
FundamentalsTest
public FundamentalsTest(String name)(Code)




Method Detail
intercept
public void intercept(InvocationContext invocationContext) throws Exception(Code)
Implementation of the Interceptor interface that can be used for testing various preconditions/postconditions of the EJB call. Here we use it for very simple check to make sure that non-null parameter is passed to the HelperBean.



setUp
public void setUp() throws Exception(Code)
Deploys and creates EJBs needed for our tests. Note that JUnit runs this method for every test method, but since MockEjb deployment is purely an in-memory operation, it does not have any performance penalty. During deployment, MockEjb simply re-binds EJBs to the same keys in the JNDI tree.



tearDown
public void tearDown()(Code)
Performs the necessary cleanup by restoring the system properties that were modified by MockContextFactory.setAsInitial(). This is needed in case if the test runs inside the container, so it would not affect the tests that run after it.



testCustomInterceptor
public void testCustomInterceptor() throws Exception(Code)
Demonstrates the use of custom interceptors. This test class implements Interceptor interface. It will verify that not-null parameter is passed to HelperBean. The same thing can be done using InvocationRecorder (see testInvocationRecorder). We can only run this test if it is being executed outside of the container.



testExceptionHandling
public void testExceptionHandling() throws Exception(Code)
Test MockEJB exception handling. According to the EJB spec, system exception must be wrapped in RemoteException. The exception from the local interface must be wrapped in EJBException. MockEjb treats all runtime and transaction-related exceptions as system exceptions.



testHome
public void testHome() throws Exception(Code)
Tests standard Home and EJBMetaData methods.



testInvocationRecorder
public void testInvocationRecorder() throws Exception(Code)
InvocationRecorder interceptor provides an easy way to inspect the data about the calls. If it added to the interceptor list, it will record the information about all calls to the bean. We'll use it to check that SampleBean called HelperBean and passed non-null parameter. We can only run this test if it is being executed outside of the container.



testSecurity
public void testSecurity() throws Exception(Code)
This method demonstrates how to test beans that makes the use of use of the security-related methods of EJBContext (getCallerPrincipal, isCallerInRole).



testSimpleCalls
public void testSimpleCalls() throws Exception(Code)
Tests simple EJB invocations



Methods inherited from org.mockejb.OptionalCactusTestCase
protected boolean isCactusMode()(Code)(Java Doc)
public boolean isRunningOnServer()(Code)(Java Doc)
public void runBare() throws Throwable(Code)(Java Doc)
protected void runBareLocally() throws Throwable(Code)(Java Doc)
protected void runTestLocally() throws Throwable(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.