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

public class EntityTestSuite extends EntityTestCase
  • Field Details

  • Constructor Details

    • EntityTestSuite

      public EntityTestSuite(String name)
  • Method Details

    • testModels

      public void testModels() throws Exception
      Test models.
      Throws:
      Exception - the exception
    • testMakeValue

      public void testMakeValue() throws Exception
      Tests storing values with the delegator's .create, .makeValue, and .storeAll methods
      Throws:
      Exception
    • testUpdateValue

      public void testUpdateValue() throws Exception
      Tests updating entities by doing a GenericValue .put(key, value) and .store()
      Throws:
      Exception
    • testRemoveValue

      public void testRemoveValue() throws Exception
      Test remove value.
      Throws:
      Exception - the exception
    • testEntityCache

      public void testEntityCache() throws Exception
      Tests the entity cache
      Throws:
      Exception - the exception
    • testXmlSerialization

      public void testXmlSerialization() throws Exception
      Test xml serialization.
      Throws:
      Exception - the exception
    • flushAndRecreateTree

      protected long flushAndRecreateTree(String descriptionPrefix) throws Exception
      Flush and recreate tree long.
      Parameters:
      descriptionPrefix - the description prefix
      Returns:
      the long
      Throws:
      Exception - the exception
    • testCreateTree

      public void testCreateTree() throws Exception
      Tests storing data with the delegator's .create method. Also tests .findCountByCondition and .getNextSeqId
      Throws:
      Exception
    • testAddMembersToTree

      public void testAddMembersToTree() throws Exception
      More tests of storing data with .storeAll. Also prepares data for testing view-entities (see below.)
      Throws:
      Exception
    • purgeTestingByTypeId

      protected void purgeTestingByTypeId(String likeTypeId) throws GenericEntityException
      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 id
      typeDescription - the type description
      descriptionPrefix - the description prefix
      Throws:
      GenericEntityException - the generic entity exception
    • testCountViews

      public void testCountViews() throws Exception
      Tests findByCondition and tests searching on a view-entity
      Throws:
      Exception
    • testFindDistinct

      public void testFindDistinct() throws Exception
      Tests findByCondition and a find by distinct
      Throws:
      Exception
    • testNotLike

      public void testNotLike() throws Exception
      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

      public void testForeignKeyRemove() throws Exception
      Tests foreign key integrity by trying to remove an entity which has foreign-key dependencies. Should cause an exception.
      Throws:
      Exception
    • testRemoveNodeMemberAndTesting

      public void testRemoveNodeMemberAndTesting() throws Exception
      Tests the .getRelatedOne method and removeAll for removing entities
      Throws:
      Exception
    • testStoreByCondition

      public void testStoreByCondition() throws Exception
      Tests the storeByCondition operation
      Throws:
      Exception
    • testRemoveByCondition

      public void testRemoveByCondition() throws Exception
      Tests the .removeByCondition method for removing entities directly
      Throws:
      Exception
    • testRemoveByPK

      public void testRemoveByPK() throws Exception
      Test the .removeByPrimaryKey by using findByCondition and then retrieving the GenericPk from a GenericValue
      Throws:
      Exception
    • testRemoveType

      public void testRemoveType() throws Exception
      Tests the .removeAll method only.
      Throws:
      Exception
    • testCreateManyAndStoreAtOnce

      public void testCreateManyAndStoreAtOnce() throws Exception
      This test will create a large number of unique items and add them to the delegator at once
      Throws:
      Exception
    • testCreateManyAndStoreOneAtATime

      public void testCreateManyAndStoreOneAtATime() throws Exception
      This test will create a large number of unique items and add them to the delegator at once
      Throws:
      Exception
    • testEntityListIterator

      public void testEntityListIterator() throws Exception
      This test will use the large number of unique items from above and test the EntityListIterator looping through the list
      Throws:
      Exception
    • testTransactionUtilRollback

      public void testTransactionUtilRollback() throws Exception
      This test will verify transaction rollbacks using TransactionUtil.
      Throws:
      Exception
    • testTransactionUtilMoreThanTimeout

      public void testTransactionUtilMoreThanTimeout() throws Exception
      This test will verify that a transaction which takes longer than the pre-set timeout are rolled back.
      Throws:
      Exception
    • testTransactionUtilLessThanTimeout

      public void testTransactionUtilLessThanTimeout() throws Exception
      This test will verify that the same transaction transaction which takes less time than timeout will be committed.
      Throws:
      Exception
    • testFieldTypes

      public void testFieldTypes() throws Exception
      Tests field types.
      Throws:
      Exception
    • testEntitySaxReaderCreation

      public void testEntitySaxReaderCreation() throws Exception
      Tests EntitySaxReader, verification loading data with tag create, create-update, create-replace, delete
      Throws:
      Exception
    • testEntitySaxReaderCreateSkip

      public void testEntitySaxReaderCreateSkip() throws Exception
      Test entity sax reader create skip.
      Throws:
      Exception - the exception
    • testEntitySaxReaderUpdate

      public void testEntitySaxReaderUpdate() throws Exception
      Test entity sax reader update.
      Throws:
      Exception - the exception
    • testEntitySaxReaderReplace

      public void testEntitySaxReaderReplace() throws Exception
      Test entity sax reader replace.
      Throws:
      Exception - the exception
    • testEntitySaxReaderDelete

      public void testEntitySaxReaderDelete() throws Exception
      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.