Java Doc for StatefulBeanTxTests.java in  » J2EE » openejb3 » org » apache » openejb » test » stateful » 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 » J2EE » openejb3 » org.apache.openejb.test.stateful 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.openejb.test.NamedTestCase
   org.apache.openejb.test.stateful.StatefulBeanTxTests

StatefulBeanTxTests
public class StatefulBeanTxTests extends org.apache.openejb.test.NamedTestCase (Code)
[1] Should be run as the first test suite of the StatefulTestClients
author:
   David Blevins
author:
   Richard Monson-Haefel


Field Summary
protected  HandleejbHandle
    
protected  BeanTxStatefulHomeejbHome
    
protected  HomeHandleejbHomeHandle
    
protected  EJBMetaDataejbMetaData
    
protected  BeanTxStatefulObjectejbObject
    
protected  IntegerejbPrimaryKey
    
protected  InitialContextinitialContext
    
final public static  StringjndiEJBHomeEntry
    

Constructor Summary
public  StatefulBeanTxTests()
    

Method Summary
public  voidBUG_test06_singleTransactionRollback()
     This test does work for the IntraVM Server, but it fails on the Remote Server.
public  voidTODO_test03_EJBContext_setRollbackOnly()
     11.6.1 Bean-managed transaction demarcation

The Container must throw the java.lang.IllegalStateException if an instance of a bean with bean-managed transaction demarcation attempts to invoke the setRollbackOnly() or getRollbackOnly() method of the javax.ejb.EJBContext interface.

public  voidTODO_test04_EJBContext_getRollbackOnly()
     11.6.1 Bean-managed transaction demarcation

The Container must throw the java.lang.IllegalStateException if an instance of a bean with bean-managed transaction demarcation attempts to invoke the setRollbackOnly() or getRollbackOnly() method of the javax.ejb.EJBContext interface.

public  voidTODO_test07_serialTransactions()
     11.6.1 Bean-managed transaction demarcation

The Container must allow the enterprise bean instance to serially perform several transactions in a method.

public  voidTODO_test08_nestedTransactions()
     11.6.1 Bean-managed transaction demarcation

When an instance attempts to start a transaction using the begin() method of the javax.transaction.UserTransaction interface while the instance has not committed the previous transaction, the Container must throw the javax.transaction.NotSupportedException in the begin() method.

public  voidTODO_test09_methodSpanningTransactions()
     11.6.1 Bean-managed transaction demarcation

In the case of a stateful session bean, it is possible that the business method that started a transaction completes without committing or rolling back the transaction.

public  voidTODO_test10_scenario1_NoneNone()
     11.6.1 Bean-managed transaction demarcation

The actions performed by the Container for an instance with bean-managed transaction are summarized by the following table.

public  voidTODO_test11_scenario2_T1None()
     11.6.1 Bean-managed transaction demarcation

The actions performed by the Container for an instance with bean-managed transaction are summarized by the following table.

public  voidTODO_test12_scenario3_NoneT2()
     11.6.1 Bean-managed transaction demarcation

The actions performed by the Container for an instance with bean-managed transaction are summarized by the following table.

public  voidTODO_test13_scenario4_T1T2()
     11.6.1 Bean-managed transaction demarcation

The actions performed by the Container for an instance with bean-managed transaction are summarized by the following table.

protected  voidsetUp()
     Sets up the fixture, for example, open a network connection.
protected  voidtearDown()
     Tears down the fixture, for example, close a network connection.
public  voidtest01_EJBContext_getUserTransaction()
     11.6.1 Bean-managed transaction demarcation

The Container must make the javax.transaction.UserTransaction interface available to the enterprise bean's business method via the javax.ejb.EJBContext interface and under the environment entry java:comp/UserTransaction.

public  voidtest02_java_comp_UserTransaction()
     11.6.1 Bean-managed transaction demarcation

The Container must make the javax.transaction.UserTransaction interface available to the enterprise bean's business method via the javax.ejb.EJBContext interface and under the environment entry java:comp/UserTransaction.

public  voidtest05_singleTransactionCommit()
    

Field Detail
ejbHandle
protected Handle ejbHandle(Code)



ejbHome
protected BeanTxStatefulHome ejbHome(Code)



ejbHomeHandle
protected HomeHandle ejbHomeHandle(Code)



ejbMetaData
protected EJBMetaData ejbMetaData(Code)



ejbObject
protected BeanTxStatefulObject ejbObject(Code)



ejbPrimaryKey
protected Integer ejbPrimaryKey(Code)



initialContext
protected InitialContext initialContext(Code)



jndiEJBHomeEntry
final public static String jndiEJBHomeEntry(Code)




Constructor Detail
StatefulBeanTxTests
public StatefulBeanTxTests()(Code)




Method Detail
BUG_test06_singleTransactionRollback
public void BUG_test06_singleTransactionRollback()(Code)
This test does work for the IntraVM Server, but it fails on the Remote Server. For some reason, when the RollbackException is sent to the client, the server blocks.



TODO_test03_EJBContext_setRollbackOnly
public void TODO_test03_EJBContext_setRollbackOnly()(Code)
11.6.1 Bean-managed transaction demarcation

The Container must throw the java.lang.IllegalStateException if an instance of a bean with bean-managed transaction demarcation attempts to invoke the setRollbackOnly() or getRollbackOnly() method of the javax.ejb.EJBContext interface.

--------------------------------------------------------

Test that setRollbackOnly() throws a java.lang.IllegalStateException




TODO_test04_EJBContext_getRollbackOnly
public void TODO_test04_EJBContext_getRollbackOnly()(Code)
11.6.1 Bean-managed transaction demarcation

The Container must throw the java.lang.IllegalStateException if an instance of a bean with bean-managed transaction demarcation attempts to invoke the setRollbackOnly() or getRollbackOnly() method of the javax.ejb.EJBContext interface.

--------------------------------------------------------

Test that getRollbackOnly() throws a java.lang.IllegalStateException




TODO_test07_serialTransactions
public void TODO_test07_serialTransactions()(Code)
11.6.1 Bean-managed transaction demarcation

The Container must allow the enterprise bean instance to serially perform several transactions in a method.




TODO_test08_nestedTransactions
public void TODO_test08_nestedTransactions()(Code)
11.6.1 Bean-managed transaction demarcation

When an instance attempts to start a transaction using the begin() method of the javax.transaction.UserTransaction interface while the instance has not committed the previous transaction, the Container must throw the javax.transaction.NotSupportedException in the begin() method.




TODO_test09_methodSpanningTransactions
public void TODO_test09_methodSpanningTransactions()(Code)
11.6.1 Bean-managed transaction demarcation

In the case of a stateful session bean, it is possible that the business method that started a transaction completes without committing or rolling back the transaction. In such a case, the Container must retain the association between the transaction and the instance across multiple client calls until the instance commits or rolls back the transaction. When the client invokes the next business method, the Container must invoke the business method in this transaction context.




TODO_test10_scenario1_NoneNone
public void TODO_test10_scenario1_NoneNone()(Code)
11.6.1 Bean-managed transaction demarcation

The actions performed by the Container for an instance with bean-managed transaction are summarized by the following table. T1 is a transaction associated with a client request, T2 is a transaction that is cur-rently associated with the instance (i.e. a transaction that was started but not completed by a previous business method).

 =========================================================================
 Container's actions for methods of beans with bean-managed transaction
 =========================================================================
 |      IF     |          AND             |          THEN
 scenario  |   Client's  | Transaction currently    | Transaction associated
 | transaction | associated with instance | with the method is
 ___________|_____________|__________________________|________________________
 |             |                          |
 1       |  none       |  none                    |  none
 ___________|_____________|__________________________|________________________
 |             |                          |
 2       |  T1         |  none                    |  none
 ___________|_____________|__________________________|________________________
 |             |                          |
 3       |  none       |  T2                      |  T2
 ___________|_____________|__________________________|________________________
 |             |                          |
 4       |  T1         |  T2                      |  T2
 ___________|_____________|__________________________|________________________
 

If the client request is not associated with a transaction and the instance is not associated with a transaction, the container invokes the instance with an unspecified transaction context.

--------------------------------------------------------

Test scenario 1: none none
If the client's transaction is none and the transaction currently associated with instance none then the transaction associated with the method is none.




TODO_test11_scenario2_T1None
public void TODO_test11_scenario2_T1None()(Code)
11.6.1 Bean-managed transaction demarcation

The actions performed by the Container for an instance with bean-managed transaction are summarized by the following table. T1 is a transaction associated with a client request, T2 is a transaction that is cur-rently associated with the instance (i.e. a transaction that was started but not completed by a previous business method).

 =========================================================================
 Container's actions for methods of beans with bean-managed transaction
 =========================================================================
 |      IF     |          AND             |          THEN
 scenario  |   Client's  | Transaction currently    | Transaction associated
 | transaction | associated with instance | with the method is
 ___________|_____________|__________________________|________________________
 |             |                          |
 1       |  none       |  none                    |  none
 ___________|_____________|__________________________|________________________
 |             |                          |
 2       |  T1         |  none                    |  none
 ___________|_____________|__________________________|________________________
 |             |                          |
 3       |  none       |  T2                      |  T2
 ___________|_____________|__________________________|________________________
 |             |                          |
 4       |  T1         |  T2                      |  T2
 ___________|_____________|__________________________|________________________
 

If the client is associated with a transaction T1, and the instance is not associated with a transaction, the container suspends the client's transaction association and invokes the method with an unspecified transaction context. The container resumes the client's transaction association (T1) when the method completes.

--------------------------------------------------------

Test scenario 2: T1 none




TODO_test12_scenario3_NoneT2
public void TODO_test12_scenario3_NoneT2()(Code)
11.6.1 Bean-managed transaction demarcation

The actions performed by the Container for an instance with bean-managed transaction are summarized by the following table. T1 is a transaction associated with a client request, T2 is a transaction that is cur-rently associated with the instance (i.e. a transaction that was started but not completed by a previous business method).

 =========================================================================
 Container's actions for methods of beans with bean-managed transaction
 =========================================================================
 |      IF     |          AND             |          THEN
 scenario  |   Client's  | Transaction currently    | Transaction associated
 | transaction | associated with instance | with the method is
 ___________|_____________|__________________________|________________________
 |             |                          |
 1       |  none       |  none                    |  none
 ___________|_____________|__________________________|________________________
 |             |                          |
 2       |  T1         |  none                    |  none
 ___________|_____________|__________________________|________________________
 |             |                          |
 3       |  none       |  T2                      |  T2
 ___________|_____________|__________________________|________________________
 |             |                          |
 4       |  T1         |  T2                      |  T2
 ___________|_____________|__________________________|________________________
 

If the client request is not associated with a transaction and the instance is already associated with a transaction T2, the container invokes the instance with the transaction that is associated with the instance (T2). This case can never happen for a stateless Session Bean.

--------------------------------------------------------

Test scenario 3: none T2




TODO_test13_scenario4_T1T2
public void TODO_test13_scenario4_T1T2()(Code)
11.6.1 Bean-managed transaction demarcation

The actions performed by the Container for an instance with bean-managed transaction are summarized by the following table. T1 is a transaction associated with a client request, T2 is a transaction that is cur-rently associated with the instance (i.e. a transaction that was started but not completed by a previous business method).

 =========================================================================
 Container's actions for methods of beans with bean-managed transaction
 =========================================================================
 |      IF     |          AND             |          THEN
 scenario  |   Client's  | Transaction currently    | Transaction associated
 | transaction | associated with instance | with the method is
 ___________|_____________|__________________________|________________________
 |             |                          |
 1       |  none       |  none                    |  none
 ___________|_____________|__________________________|________________________
 |             |                          |
 2       |  T1         |  none                    |  none
 ___________|_____________|__________________________|________________________
 |             |                          |
 3       |  none       |  T2                      |  T2
 ___________|_____________|__________________________|________________________
 |             |                          |
 4       |  T1         |  T2                      |  T2
 ___________|_____________|__________________________|________________________
 

If the client is associated with a transaction T1, and the instance is already associated with a transaction T2, the container suspends the client's transaction association and invokes the method with the transaction context that is associated with the instance (T2). The container resumes the client's transaction association (T1) when the method completes. This case can never happen for a stateless Session Bean.

--------------------------------------------------------

Test scenario 4: T1 T2




setUp
protected void setUp() throws Exception(Code)
Sets up the fixture, for example, open a network connection. This method is called before a test is executed.



tearDown
protected void tearDown() throws Exception(Code)
Tears down the fixture, for example, close a network connection. This method is called after a test is executed.



test01_EJBContext_getUserTransaction
public void test01_EJBContext_getUserTransaction()(Code)
11.6.1 Bean-managed transaction demarcation

The Container must make the javax.transaction.UserTransaction interface available to the enterprise bean's business method via the javax.ejb.EJBContext interface and under the environment entry java:comp/UserTransaction. When an instance uses the javax.trans-action. UserTransaction interface to demarcate a transaction, the Container must enlist all the resource managers used by the instance between the begin() and commit(),or rollback(), methods with the transaction. When the instance attempts to commit the transaction, the Container is responsible for the global coordination of the transaction commit.

--------------------------------------------------------

Check that a javax.transaction.UserTransaction can be obtained from the javax.ejb.EJBContext




test02_java_comp_UserTransaction
public void test02_java_comp_UserTransaction()(Code)
11.6.1 Bean-managed transaction demarcation

The Container must make the javax.transaction.UserTransaction interface available to the enterprise bean's business method via the javax.ejb.EJBContext interface and under the environment entry java:comp/UserTransaction. When an instance uses the javax.trans-action. UserTransaction interface to demarcate a transaction, the Container must enlist all the resource managers used by the instance between the begin() and commit(),or rollback(), methods with the transaction. When the instance attempts to commit the transaction, the Container is responsible for the global coordination of the transaction commit.

--------------------------------------------------------

Check that a javax.transaction.UserTransaction can be obtained from the environment entry java:comp/UserTransaction




test05_singleTransactionCommit
public void test05_singleTransactionCommit()(Code)



Fields inherited from org.apache.openejb.test.NamedTestCase
protected String testName(Code)(Java Doc)

Methods inherited from org.apache.openejb.test.NamedTestCase
public String name()(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.