org.apache.jackrabbit.test.api.nodetype
Class NodeTypeTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.jackrabbit.test.JUnitTest
              extended by org.apache.jackrabbit.test.AbstractJCRTest
                  extended by org.apache.jackrabbit.test.api.nodetype.NodeTypeTest
All Implemented Interfaces:
junit.framework.Test

public class NodeTypeTest
extends AbstractJCRTest

Tests if the node type hierarchy is correctly mapped to the methods defined in NodeType.


Field Summary
 
Fields inherited from class org.apache.jackrabbit.test.AbstractJCRTest
isReadOnly, jcrBaseVersion, jcrCopiedFrom, jcrCreated, jcrFrozenNode, jcrFrozenUuid, jcrIsCheckedOut, jcrlockIsDeep, jcrLockOwner, jcrMergeFailed, jcrMixinTypes, jcrPredecessors, jcrPrimaryType, jcrRootVersion, jcrSuccessors, jcrSystem, jcrUUID, jcrVersionHistory, mixLockable, mixReferenceable, mixShareable, mixSimpleVersionable, mixVersionable, nodeName1, nodeName2, nodeName3, nodeName4, NS_JCR_URI, NS_MIX_URI, NS_NT_URI, NS_SV_URI, ntBase, ntFrozenNode, ntQuery, ntUnstructured, ntVersion, ntVersionHistory, ntVersionLabels, propertyName1, propertyName2, superuser, testNodeType, testNodeTypeNoChildren, testPath, testRoot, testRootNode, vf, workspaceName
 
Fields inherited from class org.apache.jackrabbit.test.JUnitTest
log, logger
 
Constructor Summary
NodeTypeTest()
           
 
Method Summary
protected  void setUp()
          Sets up the fixture for the test cases.
protected  void tearDown()
          Releases the session aquired in setUp().
 void testGetDeclaredChildNodeDefs()
          Test if all node defs returned by getDeclaredChildNodeDefs() are also returned by getChildNodeDefs().
 void testGetDeclaredPropertyDefs()
          Test if all property defs returned by getDeclatedPropertyDefs() are also returned by getPropertyDefs().
 void testGetDeclaredSubtypes()
          Test if all node types returned by getDeclaredSubtypes() are also returned by getSubtypes(), and that the information is consistent with getSuperTypes/getDeclaredSuperTypes.
 void testGetDeclaredSupertypes()
          Test if all node types returned by getDeclaredSupertypes() are also returned by getSupertypes().
 void testGetName()
          Test if getNode() returns the name of a node type.
 void testGetPrimaryItemName()
          Test if node.getPrimaryItemName() returns the same name as node.getPrimaryItem().getName()
 void testGetPrimaryItemNameNotExisting()
          Test if node.getPrimaryItemName() returns null if no primary item is defined
 void testGetPropertyDefs()
          Test if getPropertyDefs() of a primary node returns also "jcr:primaryType" which is inherited from "nt:base".
 void testGetSupertypes()
          Test if getSupertypes() of a primary node that is not "nt:base" returns at least "nt:base".
 void testIsMixin()
          Test if isMixin() returns false if applied on a primary node type and true on a mixin node type.
 void testIsNodeType()
          Test if isNodeType(String nodeTypeName) returns true if nodeTypeName is the name of the node itself.
 
Methods inherited from class org.apache.jackrabbit.test.AbstractJCRTest
checkSupportedOption, cleanUp, cleanUpTestRoot, createRandomString, ensureCanSetProperty, ensureCanSetProperty, ensureCanSetProperty, ensureKnowsNodeType, ensureMixinType, ensureMultipleWorkspacesSupported, getHelper, getJcrValue, getLocalName, getNonExistingWorkspaceName, getProperty, getProperty, getSize, isSupported, needsMixin, run
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NodeTypeTest

public NodeTypeTest()
Method Detail

setUp

protected void setUp()
              throws Exception
Sets up the fixture for the test cases.

Overrides:
setUp in class AbstractJCRTest
Throws:
Exception

tearDown

protected void tearDown()
                 throws Exception
Releases the session aquired in setUp().

Overrides:
tearDown in class AbstractJCRTest
Throws:
Exception

testGetName

public void testGetName()
                 throws RepositoryException
Test if getNode() returns the name of a node type.

Throws:
RepositoryException

testIsMixin

public void testIsMixin()
                 throws RepositoryException
Test if isMixin() returns false if applied on a primary node type and true on a mixin node type.

Throws:
RepositoryException

testGetPrimaryItemName

public void testGetPrimaryItemName()
                            throws NotExecutableException,
                                   RepositoryException
Test if node.getPrimaryItemName() returns the same name as node.getPrimaryItem().getName()

Throws:
NotExecutableException
RepositoryException

testGetPrimaryItemNameNotExisting

public void testGetPrimaryItemNameNotExisting()
                                       throws NotExecutableException,
                                              RepositoryException
Test if node.getPrimaryItemName() returns null if no primary item is defined

Throws:
NotExecutableException
RepositoryException

testGetSupertypes

public void testGetSupertypes()
                       throws NotExecutableException,
                              RepositoryException
Test if getSupertypes() of a primary node that is not "nt:base" returns at least "nt:base". NotExecutableException is thrown if no primary node type apart from "nt:base".

Throws:
NotExecutableException
RepositoryException

testGetDeclaredSupertypes

public void testGetDeclaredSupertypes()
                               throws RepositoryException
Test if all node types returned by getDeclaredSupertypes() are also returned by getSupertypes(). All existing node types are tested.

Throws:
RepositoryException

testGetDeclaredSubtypes

public void testGetDeclaredSubtypes()
                             throws RepositoryException
Test if all node types returned by getDeclaredSubtypes() are also returned by getSubtypes(), and that the information is consistent with getSuperTypes/getDeclaredSuperTypes. All existing node types are tested.

Throws:
RepositoryException
Since:
JCR 2.0

testIsNodeType

public void testIsNodeType()
                    throws RepositoryException
Test if isNodeType(String nodeTypeName) returns true if nodeTypeName is the name of the node itself. Also, primary node types must return true if nodeTypeName is "nt:base", and mixin node types must return false in that case.

Throws:
RepositoryException

testGetDeclaredPropertyDefs

public void testGetDeclaredPropertyDefs()
                                 throws RepositoryException
Test if all property defs returned by getDeclatedPropertyDefs() are also returned by getPropertyDefs(). All existing node types are tested.

Throws:
RepositoryException

testGetPropertyDefs

public void testGetPropertyDefs()
                         throws NotExecutableException,
                                RepositoryException
Test if getPropertyDefs() of a primary node returns also "jcr:primaryType" which is inherited from "nt:base".

Throws:
NotExecutableException
RepositoryException

testGetDeclaredChildNodeDefs

public void testGetDeclaredChildNodeDefs()
                                  throws RepositoryException
Test if all node defs returned by getDeclaredChildNodeDefs() are also returned by getChildNodeDefs(). All existing node types are tested.

Throws:
RepositoryException


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.