com.anasoft.os.daofusion.test
Class AbstractHibernateEntityDaoTest

java.lang.Object
  extended by com.anasoft.os.daofusion.test.BaseHibernateIntegrationTest
      extended by com.anasoft.os.daofusion.test.BaseHibernateCoreIntegrationTest
          extended by com.anasoft.os.daofusion.test.AbstractHibernateEntityDaoTest

public abstract class AbstractHibernateEntityDaoTest
extends BaseHibernateCoreIntegrationTest

Core integration test for AbstractHibernateEntityDao.

Author:
vojtech.szocs
See Also:
BaseHibernateCoreIntegrationTest

Field Summary
 
Fields inherited from class com.anasoft.os.daofusion.test.BaseHibernateCoreIntegrationTest
CONTEXT_LOCATION, COUNTRY_JAPAN, COUNTRY_SLOVAKIA, countryDao, CUSTOMER_EMAIL_SUFFIX, CUSTOMER_ONE_EMAIL_PREFIX, CUSTOMER_ONE_FIRST_NAME, CUSTOMER_TWO_EMAIL_PREFIX, CUSTOMER_TWO_FIRST_NAME, CUSTOMER_TWO_LAST_NAME_PREFIX, customerDao, customerOneEmail, customerOneId, customerTwoId, ORDER_ITEM_PER_ORDER_COUNT, ORDER_PER_CUSTOMER_COUNT, orderDao, orderItemDao, orderOneShippingAddress, paymentTypeDao, STOCK_ITEM_CATEGORY_COMPUTERS, STOCK_ITEM_CATEGORY_COMPUTERS_DESC, STOCK_ITEM_CATEGORY_FOOD, STOCK_ITEM_CATEGORY_FOOD_DESC, stockItemCategoryDao, stockItemDao, TOTAL_COUNTRY_COUNT, TOTAL_CUSTOMER_COUNT, TOTAL_ORDER_COUNT, TOTAL_ORDER_ITEM_COUNT, TOTAL_STOCK_ITEM_CATEGORY_COUNT
 
Fields inherited from class com.anasoft.os.daofusion.test.BaseHibernateIntegrationTest
PROFILE_DBTYPE_NAME, PROFILE_DBTYPE_VALUE_ALL, PROFILE_DBTYPE_VALUE_LOCAL, PROFILE_DBTYPE_VALUE_REMOTE
 
Constructor Summary
AbstractHibernateEntityDaoTest()
           
 
Method Summary
 void testCount_emptyResultSet()
          Test for PersistentEntityDao.count(PersistentEntityCriteria, Class): performing instance count on an empty result set.
 void testCount_multiInstanceResultSet_filterCriteria()
          Test for PersistentEntityDao.count(PersistentEntityCriteria, Class): performing instance count on a result set with multiple instances, which is shaped by FilterCriterion instances.
 void testCount_multiInstanceResultSet()
          Test for PersistentEntityDao.count(PersistentEntityCriteria, Class): performing instance count on a result set with multiple instances.
 void testCountAll()
          Test for PersistentEntityDao.countAll(Class): performing total instance count.
 void testDeleteAll_deletingPersistentInstances()
          Test for PersistentEntityDao.deleteAll(Class): deleting multiple persistent instances.
 void testDeleteById_deletingPersistentInstance()
          Test for PersistentEntityDao.delete(Serializable, Class): deleting a persistent instance.
 void testDeleteByInstance_deletingPersistentInstance()
          Test for PersistentEntityDao.delete(Persistable): deleting a persistent instance.
 void testDuplicateAssociationPathElements()
          Test for duplicate association path elements, which should be handled properly (without any Hibernate exceptions) by NestedPropertyCriteria.
 void testDuplicateAssociationPaths()
          Test for duplicate association paths, which should be handled properly (without any Hibernate exceptions) by NestedPropertyCriteria.
 void testDuplicatePropertyPaths()
          Test for duplicate property paths (association path and target property name), which should be handled properly (without any Hibernate exceptions) by NestedPropertyCriteria.
 void testGet_retrievingNonExistingPersistentInstance()
          Test for PersistentEntityDao.get(Serializable, Class): trying to retrieve a non-existing persistent instance.
 void testGet_retrievingPersistentInstance()
          Test for PersistentEntityDao.get(Serializable, Class): retrieving a persistent instance.
 void testGetAll_retrievingPersistentInstances()
          Test for PersistentEntityDao.getAll(Class): retrieving multiple persistent instances.
 void testGetEntityClass()
          Test for PersistentEntityDao.getEntityClass().
 void testQuery_emptyCriteria()
          Test for PersistentEntityDao.query(PersistentEntityCriteria, Class): retrieving persistent entities using empty NestedPropertyCriteria.
 void testQuery_filterCriteria_directProperties()
          Test for PersistentEntityDao.query(PersistentEntityCriteria, Class): retrieving persistent entities using FilterCriterion.
 void testQuery_filterCriteria_nestedProperties()
          Test for PersistentEntityDao.query(PersistentEntityCriteria, Class): retrieving persistent entities using FilterCriterion.
 void testQuery_filterSortPaging()
          Test for PersistentEntityDao.query(PersistentEntityCriteria, Class): retrieving persistent entities using a composition of FilterCriterion and SortCriterion instances along with the implicit paging functionality.
 void testQuery_paging_allElements()
          Test for PersistentEntityDao.query(PersistentEntityCriteria, Class): retrieving persistent entities using the implicit paging functionality.
 void testQuery_paging_firstResultOutOfBounds()
          Test for PersistentEntityDao.query(PersistentEntityCriteria, Class): retrieving persistent entities using the implicit paging functionality.
 void testQuery_paging_secondElement()
          Test for PersistentEntityDao.query(PersistentEntityCriteria, Class): retrieving persistent entities using the implicit paging functionality.
 void testQuery_sortCriteria_directProperties()
          Test for PersistentEntityDao.query(PersistentEntityCriteria, Class): retrieving persistent entities using SortCriterion.
 void testQuery_sortCriteria_nestedProperties()
          Test for PersistentEntityDao.query(PersistentEntityCriteria, Class): retrieving persistent entities using SortCriterion.
 void testRefresh_refreshingDetachedInstance()
          Test for PersistentEntityDao.refresh(Persistable): refreshing a detached instance.
 void testRefresh_refreshingPersistentInstance()
          Test for PersistentEntityDao.refresh(Persistable): refreshing a persistent instance.
 void testSaveOrUpdate_persistingConstraintViolatingTransientInstance()
          Test for PersistentEntityDao.saveOrUpdate(Persistable): trying to persist a transient instance which violates database constraints.
 void testSaveOrUpdate_persistingTransientInstance()
          Test for PersistentEntityDao.saveOrUpdate(Persistable): persisting a transient instance.
 void testSaveOrUpdate_updatingDetachedInstance()
          Test for PersistentEntityDao.saveOrUpdate(Persistable): updating a detached instance.
 void testUniqueResult_emptyResultSet()
          Test for PersistentEntityDao.uniqueResult(PersistentEntityCriteria, boolean, Class): trying to retrieve unique result from an empty result set.
 void testUniqueResult_multiInstanceResultSet_dontEnforceSingleResult()
          Test for PersistentEntityDao.uniqueResult(PersistentEntityCriteria, boolean, Class): retrieving unique result from a result set with multiple instances.
 void testUniqueResult_multiInstanceResultSet_enforceSingleResult()
          Test for PersistentEntityDao.uniqueResult(PersistentEntityCriteria, boolean, Class): retrieving unique result from a result set with multiple instances.
 void testUniqueResult_singleInstanceResultSet()
          Test for PersistentEntityDao.uniqueResult(PersistentEntityCriteria, boolean, Class): retrieving unique result from a result set with single instance.
 void verifyTestData()
          Verify the test data shared by all test case methods.
 
Methods inherited from class com.anasoft.os.daofusion.test.BaseHibernateCoreIntegrationTest
setupTestData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractHibernateEntityDaoTest

public AbstractHibernateEntityDaoTest()
Method Detail

verifyTestData

public void verifyTestData()
Verify the test data shared by all test case methods.


testGetEntityClass

public void testGetEntityClass()
Test for PersistentEntityDao.getEntityClass().


testSaveOrUpdate_persistingTransientInstance

public void testSaveOrUpdate_persistingTransientInstance()
Test for PersistentEntityDao.saveOrUpdate(Persistable): persisting a transient instance.


testSaveOrUpdate_updatingDetachedInstance

public void testSaveOrUpdate_updatingDetachedInstance()
Test for PersistentEntityDao.saveOrUpdate(Persistable): updating a detached instance.


testSaveOrUpdate_persistingConstraintViolatingTransientInstance

@ExpectedException(value=org.hibernate.HibernateException.class)
public void testSaveOrUpdate_persistingConstraintViolatingTransientInstance()
Test for PersistentEntityDao.saveOrUpdate(Persistable): trying to persist a transient instance which violates database constraints.


testDeleteByInstance_deletingPersistentInstance

public void testDeleteByInstance_deletingPersistentInstance()
Test for PersistentEntityDao.delete(Persistable): deleting a persistent instance.


testDeleteById_deletingPersistentInstance

public void testDeleteById_deletingPersistentInstance()
Test for PersistentEntityDao.delete(Serializable, Class): deleting a persistent instance.


testDeleteAll_deletingPersistentInstances

public void testDeleteAll_deletingPersistentInstances()
Test for PersistentEntityDao.deleteAll(Class): deleting multiple persistent instances.


testRefresh_refreshingPersistentInstance

public void testRefresh_refreshingPersistentInstance()
Test for PersistentEntityDao.refresh(Persistable): refreshing a persistent instance.


testRefresh_refreshingDetachedInstance

public void testRefresh_refreshingDetachedInstance()
Test for PersistentEntityDao.refresh(Persistable): refreshing a detached instance.


testGet_retrievingPersistentInstance

public void testGet_retrievingPersistentInstance()
Test for PersistentEntityDao.get(Serializable, Class): retrieving a persistent instance.


testGet_retrievingNonExistingPersistentInstance

public void testGet_retrievingNonExistingPersistentInstance()
Test for PersistentEntityDao.get(Serializable, Class): trying to retrieve a non-existing persistent instance.


testGetAll_retrievingPersistentInstances

public void testGetAll_retrievingPersistentInstances()
Test for PersistentEntityDao.getAll(Class): retrieving multiple persistent instances.


testQuery_emptyCriteria

public void testQuery_emptyCriteria()
Test for PersistentEntityDao.query(PersistentEntityCriteria, Class): retrieving persistent entities using empty NestedPropertyCriteria.


testQuery_filterCriteria_directProperties

public void testQuery_filterCriteria_directProperties()
Test for PersistentEntityDao.query(PersistentEntityCriteria, Class): retrieving persistent entities using FilterCriterion.

Filtering by direct persistent entity properties (excluding associated objects).


testQuery_filterCriteria_nestedProperties

public void testQuery_filterCriteria_nestedProperties()
Test for PersistentEntityDao.query(PersistentEntityCriteria, Class): retrieving persistent entities using FilterCriterion.

Filtering by nested persistent entity properties (including associated objects).


testQuery_sortCriteria_directProperties

public void testQuery_sortCriteria_directProperties()
Test for PersistentEntityDao.query(PersistentEntityCriteria, Class): retrieving persistent entities using SortCriterion.

Sorting by direct persistent entity properties (excluding associated objects).


testQuery_sortCriteria_nestedProperties

public void testQuery_sortCriteria_nestedProperties()
Test for PersistentEntityDao.query(PersistentEntityCriteria, Class): retrieving persistent entities using SortCriterion.

Sorting by nested persistent entity properties (including associated objects).


testQuery_paging_allElements

public void testQuery_paging_allElements()
Test for PersistentEntityDao.query(PersistentEntityCriteria, Class): retrieving persistent entities using the implicit paging functionality.

Requesting all elements.


testQuery_paging_secondElement

public void testQuery_paging_secondElement()
Test for PersistentEntityDao.query(PersistentEntityCriteria, Class): retrieving persistent entities using the implicit paging functionality.

Requesting second element.


testQuery_paging_firstResultOutOfBounds

public void testQuery_paging_firstResultOutOfBounds()
Test for PersistentEntityDao.query(PersistentEntityCriteria, Class): retrieving persistent entities using the implicit paging functionality.

Trying to retrieve entities by exceeding the firstResult parameter.


testQuery_filterSortPaging

public void testQuery_filterSortPaging()
Test for PersistentEntityDao.query(PersistentEntityCriteria, Class): retrieving persistent entities using a composition of FilterCriterion and SortCriterion instances along with the implicit paging functionality.


testUniqueResult_emptyResultSet

public void testUniqueResult_emptyResultSet()
Test for PersistentEntityDao.uniqueResult(PersistentEntityCriteria, boolean, Class): trying to retrieve unique result from an empty result set.


testUniqueResult_singleInstanceResultSet

public void testUniqueResult_singleInstanceResultSet()
Test for PersistentEntityDao.uniqueResult(PersistentEntityCriteria, boolean, Class): retrieving unique result from a result set with single instance.


testUniqueResult_multiInstanceResultSet_dontEnforceSingleResult

public void testUniqueResult_multiInstanceResultSet_dontEnforceSingleResult()
Test for PersistentEntityDao.uniqueResult(PersistentEntityCriteria, boolean, Class): retrieving unique result from a result set with multiple instances.

Setting returnNullOnMultipleResults to false.


testUniqueResult_multiInstanceResultSet_enforceSingleResult

public void testUniqueResult_multiInstanceResultSet_enforceSingleResult()
Test for PersistentEntityDao.uniqueResult(PersistentEntityCriteria, boolean, Class): retrieving unique result from a result set with multiple instances.

Setting returnNullOnMultipleResults to true.


testCount_emptyResultSet

public void testCount_emptyResultSet()
Test for PersistentEntityDao.count(PersistentEntityCriteria, Class): performing instance count on an empty result set.


testCount_multiInstanceResultSet

public void testCount_multiInstanceResultSet()
Test for PersistentEntityDao.count(PersistentEntityCriteria, Class): performing instance count on a result set with multiple instances.


testCount_multiInstanceResultSet_filterCriteria

public void testCount_multiInstanceResultSet_filterCriteria()
Test for PersistentEntityDao.count(PersistentEntityCriteria, Class): performing instance count on a result set with multiple instances, which is shaped by FilterCriterion instances.


testCountAll

public void testCountAll()
Test for PersistentEntityDao.countAll(Class): performing total instance count.


testDuplicateAssociationPaths

public void testDuplicateAssociationPaths()
Test for duplicate association paths, which should be handled properly (without any Hibernate exceptions) by NestedPropertyCriteria.


testDuplicatePropertyPaths

public void testDuplicatePropertyPaths()
Test for duplicate property paths (association path and target property name), which should be handled properly (without any Hibernate exceptions) by NestedPropertyCriteria.


testDuplicateAssociationPathElements

public void testDuplicateAssociationPathElements()
Test for duplicate association path elements, which should be handled properly (without any Hibernate exceptions) by NestedPropertyCriteria.



Copyright © 2008-2009 ANASOFT and contributors. All Rights Reserved.