fri.util.database.jpa.tree
Class AbstractTemporalTreeTest<D extends TemporalTreeDao<N>,N extends TreeNode>

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by fri.util.database.jpa.commons.AbstractJpaTest
              extended by fri.util.database.jpa.tree.AbstractTreeTest<D,N>
                  extended by fri.util.database.jpa.tree.AbstractTemporalTreeTest<D,N>
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
TemporalClosureTableTreeTest, TemporalNestedSetsTreeTest

public abstract class AbstractTemporalTreeTest<D extends TemporalTreeDao<N>,N extends TreeNode>
extends AbstractTreeTest<D,N>

Tests additional public methods of TemporalTreeDao.

Author:
Fritz Ritzberger, 12.10.2011

Field Summary
 
Fields inherited from class fri.util.database.jpa.tree.AbstractTreeTest
COPIED_NAME_PREFIX, UNIQUE_PROPERTY_NAMES
 
Fields inherited from class fri.util.database.jpa.commons.AbstractJpaTest
ECLIPSELINK_PERSISTENCE_UNIT_NAME, HIBERNATE_PERSISTENCE_UNIT_NAME
 
Constructor Summary
AbstractTemporalTreeTest()
           
 
Method Summary
protected  TemporalTreeDao<N> getTemporalDao()
           
protected  void tearDown()
          Overridden to perform a different cleanup, else data would remain in database.
 void testDatabaseToBeCaseSensitive()
          Ensure this test is the first one, this avoids pitfalls when database is not case-sensitive.
 void testFindChildrenInFullTree()
          Demonstrates how to retrieve the tree structure from a list of all nodes under a root, optionally also containing removed nodes.
 void testFindRemoved()
          Tests housekeeping on one removed sub-tree.
 void testRemoveHistoricizedTreesPhysically()
          Tests housekeeping on several removed sub-trees.
 void testRemoveRootPhysically()
          Tests housekeeping on removed roots.
 void testRemoveSubTreePhysically()
          Tests housekeeping on one removed sub-tree.
 void testUniquenessWithNullValidFrom()
          Checks that it is possible to leave out validFromPropertyName.
 void testUnremove()
          Tests recovery of nodes.
 void testUnremoveAllRoots()
          Tests deletion and recovery of all trees.
protected  boolean testValidFromIsNull()
           
 
Methods inherited from class fri.util.database.jpa.tree.AbstractTreeTest
assertTreeCacheable, beginDbTransaction, checkTreeIntegrity, commitDbTransaction, createTree, createTree, createTree, findByName, getDao, getFullTreeForIntegrityCheck, getName, isTestCopy, newDao, newDbSession, newTreePojo, newUniqueChildrenTreeConstraintImpl, newUniqueChildrenTreeConstraintImplWithoutRoots, newUniqueWholeTreeConstraintImpl, newUniqueWholeTreeConstraintImplWithoutRoots, outputTree, outputTree, renameBeforeCopy, rollbackDbTransaction, setName, setNameNotConstraintChecking, setValid, testAddToTree, testBigTree, testCopiedNodeRenamer, testCopyRootToBeRoot, testCopyToOtherRoot, testCopyToSelf, testCopyTree, testCopyTreeBelowItselfFails, testCopyTreeFailsWithUniqueConstraint, testCopyTreeToAlteredName, testCopyTreeToAlteredNameWithUniqueConstraint, testCopyTreeToBeRoot, testCopyTreeWithPrecedingDelete, testCreateAndRemoveRoot, testCreateTree, testFindChildrenInCachedTree, testGetRoots, testIsBelow, testIsRoot, testLevel, testMoveRootToOtherTree, testMoveToOtherTree, testMoveTree, testMoveTreeBelowItselfFails, testMoveTreeToBeRoot, testNonUniqueRootsButUniqueChildren, testNonUniqueRootsButWholeTreeUniqueNodes, testParent, testPath, testRemoveAllTrees, testRemoveFromTree, testRemoveTree, testUniqueChildrenConstraint, testUniqueness, testUniquenessWithDeletion, testUniqueWholeTreeConstraintOnMove, testUpdateNode, testUpdateRootWithWholeTreeUniqueConstraint, testUpdateToSameNameWithUniqueConstraint
 
Methods inherited from class fri.util.database.jpa.commons.AbstractJpaTest
beginTransaction, commitTransaction, getPersistenceUnitName, log, logAfterEnd, logBeforeEnd, logStart, rollbackTransaction, setUp
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
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, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractTemporalTreeTest

public AbstractTemporalTreeTest()
Method Detail

tearDown

protected void tearDown()
                 throws java.lang.Exception
Overridden to perform a different cleanup, else data would remain in database.

Overrides:
tearDown in class AbstractTreeTest<D extends TemporalTreeDao<N>,N extends TreeNode>
Throws:
java.lang.Exception

testDatabaseToBeCaseSensitive

public void testDatabaseToBeCaseSensitive()
                                   throws java.lang.Exception
Ensure this test is the first one, this avoids pitfalls when database is not case-sensitive.

Overrides:
testDatabaseToBeCaseSensitive in class AbstractTreeTest<D extends TemporalTreeDao<N>,N extends TreeNode>
Throws:
java.lang.Exception

testFindRemoved

public void testFindRemoved()
                     throws java.lang.Exception
Tests housekeeping on one removed sub-tree.

Throws:
java.lang.Exception

testRemoveSubTreePhysically

public void testRemoveSubTreePhysically()
                                 throws java.lang.Exception
Tests housekeeping on one removed sub-tree.

Throws:
java.lang.Exception

testRemoveHistoricizedTreesPhysically

public void testRemoveHistoricizedTreesPhysically()
                                           throws java.lang.Exception
Tests housekeeping on several removed sub-trees.

Throws:
java.lang.Exception

testRemoveRootPhysically

public void testRemoveRootPhysically()
                              throws java.lang.Exception
Tests housekeeping on removed roots.

Throws:
java.lang.Exception

testUnremove

public void testUnremove()
                  throws java.lang.Exception
Tests recovery of nodes.

Throws:
java.lang.Exception

testUnremoveAllRoots

public void testUnremoveAllRoots()
                          throws java.lang.Exception
Tests deletion and recovery of all trees.

Throws:
java.lang.Exception

testUniquenessWithNullValidFrom

public void testUniquenessWithNullValidFrom()
                                     throws java.lang.Exception
Checks that it is possible to leave out validFromPropertyName.

Throws:
java.lang.Exception

testFindChildrenInFullTree

public void testFindChildrenInFullTree()
                                throws java.lang.Exception
Demonstrates how to retrieve the tree structure from a list of all nodes under a root, optionally also containing removed nodes.

Throws:
java.lang.Exception

testValidFromIsNull

protected final boolean testValidFromIsNull()
Returns:
true when a null validFromPropertyName should be tested.

getTemporalDao

protected final TemporalTreeDao<N> getTemporalDao()
Returns:
the casted temporal DAO for convenience.