|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
org.openejb.test.NumberedTestCase
org.openejb.test.NamedTestCase
org.openejb.test.stateless.StatelessBeanTxTests
public class StatelessBeanTxTests
[1] Should be run as the first test suite of the StatelessTestClients
Field Summary | |
---|---|
protected javax.ejb.Handle |
ejbHandle
|
protected BeanTxStatelessHome |
ejbHome
|
protected javax.ejb.HomeHandle |
ejbHomeHandle
|
protected javax.ejb.EJBMetaData |
ejbMetaData
|
protected BeanTxStatelessObject |
ejbObject
|
protected java.lang.Integer |
ejbPrimaryKey
|
protected javax.naming.InitialContext |
initialContext
|
static java.lang.String |
jndiEJBHomeEntry
|
Fields inherited from class org.openejb.test.NamedTestCase |
---|
testName |
Fields inherited from class org.openejb.test.NumberedTestCase |
---|
standardPrefix |
Constructor Summary | |
---|---|
StatelessBeanTxTests()
|
Method Summary | |
---|---|
void |
BUG_test06_singleTransactionRollback()
This test does work for the IntraVM Server, but it fails on the Remote Server. |
protected void |
setUp()
Sets up the fixture, for example, open a network connection. |
protected void |
tearDown()
Tears down the fixture, for example, close a network connection. |
void |
test01_EJBContext_getUserTransaction()
11.6.1 Bean-managed transaction demarcation |
void |
test02_java_comp_UserTransaction()
11.6.1 Bean-managed transaction demarcation |
void |
test05_singleTransactionCommit()
|
void |
TODO_test03_EJBContext_setRollbackOnly()
11.6.1 Bean-managed transaction demarcation |
void |
TODO_test04_EJBContext_getRollbackOnly()
11.6.1 Bean-managed transaction demarcation |
void |
TODO_test07_serialTransactions()
11.6.1 Bean-managed transaction demarcation |
void |
TODO_test08_nestedTransactions()
11.6.1 Bean-managed transaction demarcation |
void |
TODO_test09_beginWithNoCommit()
11.6.1 Bean-managed transaction demarcation |
void |
TODO_test10_scenario1_NoneNone()
11.6.1 Bean-managed transaction demarcation |
void |
TODO_test11_scenario2_T1None()
11.6.1 Bean-managed transaction demarcation |
Methods inherited from class org.openejb.test.NamedTestCase |
---|
name |
Methods inherited from class org.openejb.test.NumberedTestCase |
---|
countTestCases, createTest, createTestName, removePrefix, removePrefix, run, run, runTestMethod, toString |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String jndiEJBHomeEntry
protected BeanTxStatelessHome ejbHome
protected BeanTxStatelessObject ejbObject
protected javax.ejb.EJBMetaData ejbMetaData
protected javax.ejb.HomeHandle ejbHomeHandle
protected javax.ejb.Handle ejbHandle
protected java.lang.Integer ejbPrimaryKey
protected javax.naming.InitialContext initialContext
Constructor Detail |
---|
public StatelessBeanTxTests()
Method Detail |
---|
protected void setUp() throws java.lang.Exception
setUp
in class NumberedTestCase
java.lang.Exception
protected void tearDown() throws java.lang.Exception
tearDown
in class NumberedTestCase
java.lang.Exception
public void test01_EJBContext_getUserTransaction()
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
public void test02_java_comp_UserTransaction()
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
public void TODO_test03_EJBContext_setRollbackOnly()
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
public void TODO_test04_EJBContext_getRollbackOnly()
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
public void test05_singleTransactionCommit()
public void BUG_test06_singleTransactionRollback()
public void TODO_test07_serialTransactions()
The Container must allow the enterprise bean instance to serially perform several transactions in a method.
public void TODO_test08_nestedTransactions()
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 void TODO_test09_beginWithNoCommit()
If a stateless session bean instance starts a transaction in a business method, it must commit the transaction before the business method returns. The Container must detect the case in which a transaction was started, but not completed, in the business method, and handle it as follows:
public void TODO_test10_scenario1_NoneNone()
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.
public void TODO_test11_scenario2_T1None()
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 ntransaction association (T1) when the method completes.
--------------------------------------------------------
Test scenario 2: T1 none
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |