| java.lang.Object org.ow2.easybeans.tests.persistence.lifetime.TestPersistenceLifetimeCMTransaction01
TestPersistenceLifetimeCMTransaction01 | public class TestPersistenceLifetimeCMTransaction01 (Code) | | Tests container-managed transaction-scoped persistence context. It uses this test class as client and a
Stateless with transaction-scoped persistence context.
In this scope, the lifecycle of a persistence context ends when the associated transaction ends.
author: Eduardo Studzinski Estima de Castro author: Gisele Pinheiro Souza |
Method Summary | |
public void | startUp() Gets bean instances used in the tests. | public void | tearDown() Cleans the test results. | public void | test00() This test begins a transaction, creates an entity and rolls back the transaction. | public void | test01() This test begins a transaction, creates an entity and commits the transaction. | public void | test02() This test begins a transaction and creates an entity. | public void | test03() This test creates an entity and verifies if it remains managed. | public void | test04() This test creates an entity, persists the entity and verifies if it becomes detached. |
startUp | public void startUp() throws Exception(Code) | | Gets bean instances used in the tests.
throws: Exception - if there is a problem with the bean initialization. |
test00 | public void test00() throws Exception(Code) | | This test begins a transaction, creates an entity and rolls back the transaction.
The entity must not exists after the rollback and the entity instance must become detached.
A rollback in a transaction, which is used with the persistence context,
always turns detached all entities associated with the persistence context.
throws: Exception - if a problem occurs. |
test01 | public void test01() throws Exception(Code) | | This test begins a transaction, creates an entity and commits the transaction. The entity must
exists after the commit and it must become detached, because it is an transaction persistence context.
throws: Exception - if a problem occurs. |
test02 | public void test02() throws Exception(Code) | | This test begins a transaction and creates an entity. As it uses an transaction
persistence context and the transaction is still open,
the entity remains managed after its creation. After this step,
the test rolls back the transaction and the entity must be removed.
throws: Exception - if a problem occurs. |
test03 | public void test03() throws Exception(Code) | | This test creates an entity and verifies if it remains managed.
In this test, the transaction is created by the container for each bean method invocation,
as it is a transaction persistence context, it becomes detached.
throws: Exception - if a problem occurs. |
test04 | public void test04() throws Exception(Code) | | This test creates an entity, persists the entity and verifies if it becomes detached.
In this test, the transaction is created by the container for each bean method invocation,
as it is a transaction persistence context, it must becomes detached.
throws: Exception - if a problem occurs. |
|
|