fri.util.database.jpa.tree.nestedsets
Class NestedSetsTreeTest

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<NestedSetsTreeDao,NestedSetsTreeNode>
                  extended by fri.util.database.jpa.tree.nestedsets.NestedSetsTreeTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
NestedSetsTreeEclipselinkTest, NestedSetsTreeHibernateSessionTest, NestedSetsTreeHibernateTest

public class NestedSetsTreeTest
extends AbstractTreeTest<NestedSetsTreeDao,NestedSetsTreeNode>

Unit test for NestedSetsTreeDao and NestedSetsTreeNode.

Author:
Fritz Ritzberger, 08.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
NestedSetsTreeTest()
           
 
Method Summary
protected  void checkTreeIntegrity(DbSession session, NestedSetsTreeNode root)
          Checks the left and right indexes for continuity.
protected  java.util.List<NestedSetsTreeNode> getFullTreeForIntegrityCheck(NestedSetsTreeNode root)
           
protected  java.lang.String getName(NestedSetsTreeNode node)
          For a concrete POJO we must return properties from it.
protected  NestedSetsTreeDao newDao(DbSession session)
          Overridden to allocate a new NestedSetsTreeDao for this test case.
protected  NestedSetsTreeNode newTreePojo(java.lang.String name)
          Factory method for new NestedSetsTreePojos.
protected  UniqueTreeConstraint<NestedSetsTreeNode> newUniqueChildrenTreeConstraintImpl()
           
protected  UniqueTreeConstraint<NestedSetsTreeNode> newUniqueChildrenTreeConstraintImplWithoutRoots()
           
protected  UniqueTreeConstraint<NestedSetsTreeNode> newUniqueWholeTreeConstraintImpl()
           
protected  UniqueTreeConstraint<NestedSetsTreeNode> newUniqueWholeTreeConstraintImplWithoutRoots()
           
protected  void renameBeforeCopy(NestedSetsTreeNode node)
           
protected  void setNameNotConstraintChecking(NestedSetsTreeNode entity, java.lang.String name)
           
 
Methods inherited from class fri.util.database.jpa.tree.AbstractTreeTest
assertTreeCacheable, beginDbTransaction, commitDbTransaction, createTree, createTree, createTree, findByName, getDao, isTestCopy, newDbSession, outputTree, outputTree, rollbackDbTransaction, setName, setValid, tearDown, testAddToTree, testBigTree, testCopiedNodeRenamer, testCopyRootToBeRoot, testCopyToOtherRoot, testCopyToSelf, testCopyTree, testCopyTreeBelowItselfFails, testCopyTreeFailsWithUniqueConstraint, testCopyTreeToAlteredName, testCopyTreeToAlteredNameWithUniqueConstraint, testCopyTreeToBeRoot, testCopyTreeWithPrecedingDelete, testCreateAndRemoveRoot, testCreateTree, testDatabaseToBeCaseSensitive, 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

NestedSetsTreeTest

public NestedSetsTreeTest()
Method Detail

newDao

protected NestedSetsTreeDao newDao(DbSession session)
Overridden to allocate a new NestedSetsTreeDao for this test case.

Specified by:
newDao in class AbstractTreeTest<NestedSetsTreeDao,NestedSetsTreeNode>
Returns:
a new DAO for passed session. To be overridden by subclasses.

newTreePojo

protected NestedSetsTreeNode newTreePojo(java.lang.String name)
Factory method for new NestedSetsTreePojos. To be overridden by subclasses.

Specified by:
newTreePojo in class AbstractTreeTest<NestedSetsTreeDao,NestedSetsTreeNode>

getName

protected java.lang.String getName(NestedSetsTreeNode node)
For a concrete POJO we must return properties from it. Here the cast to NestedSetsTreePojo is done.

Specified by:
getName in class AbstractTreeTest<NestedSetsTreeDao,NestedSetsTreeNode>

setNameNotConstraintChecking

protected void setNameNotConstraintChecking(NestedSetsTreeNode entity,
                                            java.lang.String name)
Specified by:
setNameNotConstraintChecking in class AbstractTreeTest<NestedSetsTreeDao,NestedSetsTreeNode>

renameBeforeCopy

protected void renameBeforeCopy(NestedSetsTreeNode node)
Specified by:
renameBeforeCopy in class AbstractTreeTest<NestedSetsTreeDao,NestedSetsTreeNode>

newUniqueWholeTreeConstraintImpl

protected UniqueTreeConstraint<NestedSetsTreeNode> newUniqueWholeTreeConstraintImpl()
Specified by:
newUniqueWholeTreeConstraintImpl in class AbstractTreeTest<NestedSetsTreeDao,NestedSetsTreeNode>
Returns:
an UniqueTreeConstraint implementation that checks for uniqueness per tree.

newUniqueWholeTreeConstraintImplWithoutRoots

protected UniqueTreeConstraint<NestedSetsTreeNode> newUniqueWholeTreeConstraintImplWithoutRoots()
Specified by:
newUniqueWholeTreeConstraintImplWithoutRoots in class AbstractTreeTest<NestedSetsTreeDao,NestedSetsTreeNode>
Returns:
an UniqueTreeConstraint implementation that checks for uniqueness per tree.

newUniqueChildrenTreeConstraintImpl

protected UniqueTreeConstraint<NestedSetsTreeNode> newUniqueChildrenTreeConstraintImpl()
Specified by:
newUniqueChildrenTreeConstraintImpl in class AbstractTreeTest<NestedSetsTreeDao,NestedSetsTreeNode>
Returns:
an UniqueTreeConstraint implementation that checks for uniqueness on child level only.

newUniqueChildrenTreeConstraintImplWithoutRoots

protected UniqueTreeConstraint<NestedSetsTreeNode> newUniqueChildrenTreeConstraintImplWithoutRoots()
Specified by:
newUniqueChildrenTreeConstraintImplWithoutRoots in class AbstractTreeTest<NestedSetsTreeDao,NestedSetsTreeNode>
Returns:
an UniqueTreeConstraint implementation that checks for uniqueness on child level only, ignoring uniqueness among roots.

getFullTreeForIntegrityCheck

protected java.util.List<NestedSetsTreeNode> getFullTreeForIntegrityCheck(NestedSetsTreeNode root)
Overrides:
getFullTreeForIntegrityCheck in class AbstractTreeTest<NestedSetsTreeDao,NestedSetsTreeNode>

checkTreeIntegrity

protected final void checkTreeIntegrity(DbSession session,
                                        NestedSetsTreeNode root)
Checks the left and right indexes for continuity.

Specified by:
checkTreeIntegrity in class AbstractTreeTest<NestedSetsTreeDao,NestedSetsTreeNode>