Package org.apache.ofbiz.entity.test
Class EntityTestSuite
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.apache.ofbiz.entity.testtools.EntityTestCase
org.apache.ofbiz.entity.test.EntityTestSuite
- All Implemented Interfaces:
junit.framework.Test
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
createNodeMembers
(String typeId, String typeDescription, String descriptionPrefix) Create node members.protected long
flushAndRecreateTree
(String descriptionPrefix) Flush and recreate tree long.protected void
purgeTestingByTypeId
(String likeTypeId) Purge testing by type id.void
More tests of storing data with .storeAll.void
Tests findByCondition and tests searching on a view-entityvoid
This test will create a large number of unique items and add them to the delegator at oncevoid
This test will create a large number of unique items and add them to the delegator at oncevoid
Tests storing data with the delegator's .create method.void
Tests the entity cachevoid
This test will use the large number of unique items from above and test the EntityListIterator looping through the listvoid
Test entity sax reader create skip.void
Tests EntitySaxReader, verification loading data with tag create, create-update, create-replace, deletevoid
Test entity sax reader delete.void
Test entity sax reader replace.void
Test entity sax reader update.void
Tests field types.void
Tests findByCondition and a find by distinctvoid
Tests foreign key integrity by trying to remove an entity which has foreign-key dependencies.void
Tests foreign key integrity by trying to remove an entity which has foreign-key dependencies.void
Tests storing values with the delegator's .create, .makeValue, and .storeAll methodsvoid
Test models.void
Tests a findByCondition using not likevoid
This test is useful to confirm that the default setting of use-transaction="true" for screen definitions is the best one for performance.void
Tests the .removeByCondition method for removing entities directlyvoid
Test the .removeByPrimaryKey by using findByCondition and then retrieving the GenericPk from a GenericValuevoid
Tests the .getRelatedOne method and removeAll for removing entitiesvoid
Tests the .removeAll method only.void
Test remove value.void
Test sequence value item.void
Test sequence value item with concurrent threads.void
Tests the storeByCondition operationvoid
This test will verify that the same transaction transaction which takes less time than timeout will be committed.void
This test will verify that a transaction which takes longer than the pre-set timeout are rolled back.void
This test will verify transaction rollbacks using TransactionUtil.void
Tests updating entities by doing a GenericValue .put(key, value) and .store()void
Test xml serialization.Methods inherited from class org.apache.ofbiz.entity.testtools.EntityTestCase
getDelegator, setDelegator
Methods inherited from class junit.framework.TestCase
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
-
Field Details
-
TEST_COUNT
public static final long TEST_COUNT- See Also:
-
-
Constructor Details
-
EntityTestSuite
-
-
Method Details
-
testModels
Test models.- Throws:
Exception
- the exception
-
testMakeValue
Tests storing values with the delegator's .create, .makeValue, and .storeAll methods- Throws:
Exception
-
testUpdateValue
Tests updating entities by doing a GenericValue .put(key, value) and .store()- Throws:
Exception
-
testRemoveValue
Test remove value.- Throws:
Exception
- the exception
-
testEntityCache
Tests the entity cache- Throws:
Exception
- the exception
-
testXmlSerialization
Test xml serialization.- Throws:
Exception
- the exception
-
flushAndRecreateTree
Flush and recreate tree long.- Parameters:
descriptionPrefix
- the description prefix- Returns:
- the long
- Throws:
Exception
- the exception
-
testCreateTree
Tests storing data with the delegator's .create method. Also tests .findCountByCondition and .getNextSeqId- Throws:
Exception
-
testAddMembersToTree
More tests of storing data with .storeAll. Also prepares data for testing view-entities (see below.)- Throws:
Exception
-
purgeTestingByTypeId
Purge testing by type id.- Parameters:
likeTypeId
- the like type id- Throws:
GenericEntityException
- the generic entity exception
-
createNodeMembers
protected void createNodeMembers(String typeId, String typeDescription, String descriptionPrefix) throws GenericEntityException Create node members.- Parameters:
typeId
- the type idtypeDescription
- the type descriptiondescriptionPrefix
- the description prefix- Throws:
GenericEntityException
- the generic entity exception
-
testCountViews
Tests findByCondition and tests searching on a view-entity- Throws:
Exception
-
testFindDistinct
Tests findByCondition and a find by distinct- Throws:
Exception
-
testNotLike
Tests a findByCondition using not like- Throws:
Exception
-
testForeignKeyCreate
public void testForeignKeyCreate()Tests foreign key integrity by trying to remove an entity which has foreign-key dependencies. Should cause an exception. -
testForeignKeyRemove
Tests foreign key integrity by trying to remove an entity which has foreign-key dependencies. Should cause an exception.- Throws:
Exception
-
testRemoveNodeMemberAndTesting
Tests the .getRelatedOne method and removeAll for removing entities- Throws:
Exception
-
testStoreByCondition
Tests the storeByCondition operation- Throws:
Exception
-
testRemoveByCondition
Tests the .removeByCondition method for removing entities directly- Throws:
Exception
-
testRemoveByPK
Test the .removeByPrimaryKey by using findByCondition and then retrieving the GenericPk from a GenericValue- Throws:
Exception
-
testRemoveType
Tests the .removeAll method only.- Throws:
Exception
-
testCreateManyAndStoreAtOnce
This test will create a large number of unique items and add them to the delegator at once- Throws:
Exception
-
testCreateManyAndStoreOneAtATime
This test will create a large number of unique items and add them to the delegator at once- Throws:
Exception
-
testEntityListIterator
This test will use the large number of unique items from above and test the EntityListIterator looping through the list- Throws:
Exception
-
testTransactionUtilRollback
This test will verify transaction rollbacks using TransactionUtil.- Throws:
Exception
-
testTransactionUtilMoreThanTimeout
This test will verify that a transaction which takes longer than the pre-set timeout are rolled back.- Throws:
Exception
-
testTransactionUtilLessThanTimeout
This test will verify that the same transaction transaction which takes less time than timeout will be committed.- Throws:
Exception
-
testFieldTypes
Tests field types.- Throws:
Exception
-
testEntitySaxReaderCreation
Tests EntitySaxReader, verification loading data with tag create, create-update, create-replace, delete- Throws:
Exception
-
testEntitySaxReaderCreateSkip
Test entity sax reader create skip.- Throws:
Exception
- the exception
-
testEntitySaxReaderUpdate
Test entity sax reader update.- Throws:
Exception
- the exception
-
testEntitySaxReaderReplace
Test entity sax reader replace.- Throws:
Exception
- the exception
-
testEntitySaxReaderDelete
Test entity sax reader delete.- Throws:
Exception
- the exception
-
testSequenceValueItem
public void testSequenceValueItem()Test sequence value item. -
testSequenceValueItemWithConcurrentThreads
public void testSequenceValueItemWithConcurrentThreads()Test sequence value item with concurrent threads. -
testOneBigTransactionIsFasterThanSeveralSmallOnes
public void testOneBigTransactionIsFasterThanSeveralSmallOnes()This test is useful to confirm that the default setting of use-transaction="true" for screen definitions is the best one for performance. With this setting one database transaction is started by the framework before rendering the screen. Most screens usually have multiple Delegator calls to find records. In most of the GenericDelegator's find methods, a transaction is created if one does not already exist, the statement is performed, and the transaction is committed. So, by making that attribute "false" - a screen will have many individual transactions instead of just one. This test assess that running the same number of sql statements withing one transaction is faster than running them with individual transactions.
-