org.objectweb.jonas.jtests.clients.entity
Class A_BasicHomeInterface

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--org.objectweb.jonas.jtests.util.JTestCase
                    |
                    +--org.objectweb.jonas.jtests.clients.entity.A_BasicHomeInterface
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
A_BasicHomeInterfaceEC, F_BasicHomeInterfaceEB, F_BasicHomeSharedEB

public abstract class A_BasicHomeInterface
extends JTestCase

test cases common to both suites CMP and BMP.


Field Summary
protected static SimpleHome home
           
 
Fields inherited from class org.objectweb.jonas.jtests.util.JTestCase
ictx, isInit, jonasName, msgerror, testtorun, utx
 
Constructor Summary
A_BasicHomeInterface(java.lang.String name)
           
 
Method Summary
 void essaiA1()
           
 void essaiA1C()
           
 void essaiA2()
           
 void essaiA2C()
           
 void essaiC1()
           
 void essaiC2()
           
 void essaiF1()
           
 void essaiF2()
           
 void essaiR1()
           
 void essaiR1C()
           
 void essaiR2()
           
 void essaiR2C()
           
abstract  SimpleHome getHome()
          return SimpleHome, that can be either BMP or CMP bean.
protected  void setUp()
          init environment: - load beans - create/init database for entities.
 void testCreateFindUserTx()
          Verify that we can create an entity and retrieve it by a finder method inside the same transaction
 void testCreateNewEntity()
          testCreateNewEntity verify that we can create a new entityBean We create a new entity testCreateNewEntity, 20, 6 the findByTestName("testCreateNewEntity") must pass and the resulting must be equals to 20 pre condition the testCreateNewEntity element must not exist
 void testCreateRolledBack()
           
 void testFindByPK()
          testFindByPK verify that findByPrimaryKey find an existing entityBean pre condition: an element with "pk1" as primary key must exist in the database findByPrimaryKey("testFindByPK") must pass.
 void testFinderCollection()
          testFinderCollection verify a finder method that return a Collection pre condition there are 4 elements with c_numtest =4 (pk4,...,pk7) findInCollection returns all the beans where c_numtest = 4 this test is equivalent to testcase2 in SimpleTest in finder_col
 void testFinderEnum()
          testFinderEnum verify a finder method that return a Enumeration pre condition there are 3 elements with num =4 all of them have a field info equals to 10
 void testFinderEnumObjNotFound()
          testFinderEnumObjNotFound verify that a finder method that can return a Enumeration return an empty enumeration where there is no matching bean pre condition there is no elements with NumTest = 999
 void testFindUnexistingPK()
          testFindUnexistingPK verify that findByPrimaryKey throw Finder Exception when the specified entity beab doesn't exist. pre condition there is no element with "pk999" in the table findByPrimaryKey("testFindUnexistingPK") must throw Finder Exception
 void testHomeRemoveCommitted()
          test remove by PK in transaction
 void testHomeRemoveRolledBack()
          testHomeRemoveRolledBack verify that we can access to a bean after remove has been rolledback it is the same that testRemoveRolledBack but with home.remove(pk); pre condition the testHomeRemoveRolledBack must exist
 void testOtherFinder()
          testOtherFinder verify that we can use finder method other than findByPrimaryKey pre condition an element with "pk2" as primary key must exist in the database findByTestName("testOtherFinder") must pass
 void testRemoveByPKTwice()
          test remove by PK twice. test that a removeByPrimaryKey can be followed by a create of the same entity.
 void testRemoveInsideTransaction()
          testRemoveInsideTransaction Verify that after a remove inside a transaction, the bean cannot be found anymore pre condition the testRemoveInsideTransaction must exist
 void testRemoveInTransaction()
          same test without second tx.
 void testRemoveRolledBack()
          testRemoveRolledBack verify that we can access to a bean after remove has been rolledback pre condition the testRemoveRolledBack must exist
 void testRemoveTwice()
          test remove by EJBObject twice. test that a remove can be followed by a create of the same entity.
 void testRemoveViaEJBHome()
           
 void testRemoveViaEJBObject()
           
 
Methods inherited from class org.objectweb.jonas.jtests.util.JTestCase
debug, getDBEnv, random, sleep, tearDown, testEmpty, unloadBeans, useBeans
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

home

protected static SimpleHome home
Constructor Detail

A_BasicHomeInterface

public A_BasicHomeInterface(java.lang.String name)
Method Detail

setUp

protected void setUp()
init environment: - load beans - create/init database for entities.
Overrides:
setUp in class JTestCase

getHome

public abstract SimpleHome getHome()
return SimpleHome, that can be either BMP or CMP bean.

testFindByPK

public void testFindByPK()
                  throws java.lang.Exception
testFindByPK verify that findByPrimaryKey find an existing entityBean pre condition: an element with "pk1" as primary key must exist in the database findByPrimaryKey("testFindByPK") must pass.

testFindUnexistingPK

public void testFindUnexistingPK()
                          throws java.lang.Exception
testFindUnexistingPK verify that findByPrimaryKey throw Finder Exception when the specified entity beab doesn't exist. pre condition there is no element with "pk999" in the table findByPrimaryKey("testFindUnexistingPK") must throw Finder Exception

testOtherFinder

public void testOtherFinder()
                     throws java.lang.Exception
testOtherFinder verify that we can use finder method other than findByPrimaryKey pre condition an element with "pk2" as primary key must exist in the database findByTestName("testOtherFinder") must pass

testFinderEnumObjNotFound

public void testFinderEnumObjNotFound()
                               throws java.lang.Exception
testFinderEnumObjNotFound verify that a finder method that can return a Enumeration return an empty enumeration where there is no matching bean pre condition there is no elements with NumTest = 999

testCreateNewEntity

public void testCreateNewEntity()
                         throws java.lang.Exception
testCreateNewEntity verify that we can create a new entityBean We create a new entity testCreateNewEntity, 20, 6 the findByTestName("testCreateNewEntity") must pass and the resulting must be equals to 20 pre condition the testCreateNewEntity element must not exist

essaiC1

public void essaiC1()
             throws java.lang.Exception

essaiA1

public void essaiA1()
             throws java.lang.Exception

essaiA1C

public void essaiA1C()
              throws java.lang.Exception

essaiF1

public void essaiF1()
             throws java.lang.Exception

essaiR1

public void essaiR1()
             throws java.lang.Exception

essaiR1C

public void essaiR1C()
              throws java.lang.Exception

essaiC2

public void essaiC2()
             throws java.lang.Exception

essaiA2

public void essaiA2()
             throws java.lang.Exception

essaiA2C

public void essaiA2C()
              throws java.lang.Exception

essaiF2

public void essaiF2()
             throws java.lang.Exception

essaiR2

public void essaiR2()
             throws java.lang.Exception

essaiR2C

public void essaiR2C()
              throws java.lang.Exception

testCreateRolledBack

public void testCreateRolledBack()
                          throws java.lang.Exception

testRemoveViaEJBHome

public void testRemoveViaEJBHome()
                          throws java.lang.Exception

testRemoveByPKTwice

public void testRemoveByPKTwice()
                         throws java.lang.Exception
test remove by PK twice. test that a removeByPrimaryKey can be followed by a create of the same entity.

testRemoveTwice

public void testRemoveTwice()
                     throws java.lang.Exception
test remove by EJBObject twice. test that a remove can be followed by a create of the same entity.

testRemoveViaEJBObject

public void testRemoveViaEJBObject()
                            throws java.lang.Exception

testRemoveInsideTransaction

public void testRemoveInsideTransaction()
                                 throws java.lang.Exception
testRemoveInsideTransaction Verify that after a remove inside a transaction, the bean cannot be found anymore pre condition the testRemoveInsideTransaction must exist

testRemoveInTransaction

public void testRemoveInTransaction()
                             throws java.lang.Exception
same test without second tx.

testHomeRemoveCommitted

public void testHomeRemoveCommitted()
                             throws java.lang.Exception
test remove by PK in transaction

testRemoveRolledBack

public void testRemoveRolledBack()
                          throws java.lang.Exception
testRemoveRolledBack verify that we can access to a bean after remove has been rolledback pre condition the testRemoveRolledBack must exist

testHomeRemoveRolledBack

public void testHomeRemoveRolledBack()
                              throws java.lang.Exception
testHomeRemoveRolledBack verify that we can access to a bean after remove has been rolledback it is the same that testRemoveRolledBack but with home.remove(pk); pre condition the testHomeRemoveRolledBack must exist

testFinderEnum

public void testFinderEnum()
                    throws java.lang.Exception
testFinderEnum verify a finder method that return a Enumeration pre condition there are 3 elements with num =4 all of them have a field info equals to 10

testCreateFindUserTx

public void testCreateFindUserTx()
                          throws java.lang.Exception
Verify that we can create an entity and retrieve it by a finder method inside the same transaction

testFinderCollection

public void testFinderCollection()
                          throws java.lang.Exception
testFinderCollection verify a finder method that return a Collection pre condition there are 4 elements with c_numtest =4 (pk4,...,pk7) findInCollection returns all the beans where c_numtest = 4 this test is equivalent to testcase2 in SimpleTest in finder_col