org.apache.jackrabbit.test.api
Class AddNodeTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.apache.jackrabbit.test.JUnitTest
              extended byorg.apache.jackrabbit.test.AbstractJCRTest
                  extended byorg.apache.jackrabbit.test.api.AddNodeTest
All Implemented Interfaces:
junit.framework.Test

public class AddNodeTest
extends AbstractJCRTest

AddNodeTest contains the test cases for the method Node.addNode(String, String).


Field Summary
 
Fields inherited from class org.apache.jackrabbit.test.AbstractJCRTest
helper, isReadOnly, jcrBaseVersion, jcrCreated, jcrFrozenNode, jcrlockIsDeep, jcrLockOwner, jcrMergeFailed, jcrMixinTypes, jcrPredecessors, jcrPrimaryType, jcrRootVersion, jcrSuccessors, jcrSystem, jcrUUID, jcrVersionHistory, mixLockable, mixReferenceable, mixVersionable, nodeName1, nodeName2, nodeName3, nodeName4, NS_JCR_URI, NS_MIX_URI, NS_NT_URI, NS_SV_URI, ntBase, ntFrozenNode, ntQuery, ntVersion, ntVersionHistory, ntVersionLabels, propertyName1, propertyName2, superuser, testNodeType, testPath, testRoot, testRootNode, workspaceName
 
Fields inherited from class org.apache.jackrabbit.test.JUnitTest
log
 
Constructor Summary
AddNodeTest()
           
 
Method Summary
 void testAddNodeParentSave()
          Creates two new nodes using Node.addNode(String) and Node.addNode(String,String), saves using Item.save() on parent node.
 void testAddNodeRepositoryExceptionSaveOnNewNode()
          Creates new nodes using Node.addNode(String) and Node.addNode(String, String), then tries to call Item.save() on the new nodes.
 void testAddNodeSessionSave()
          Creates new nodes using Node.addNode(String) and Node.addNode(String, String), saves using Session.save().
 void testConstraintViolation()
          Tests if a ConstraintViolationException is thrown when one attempts to add a node at a path that references a property.
 void testName()
          Tests if the name of the created node is correct.
 void testNodeType()
          Tests if the node type of the created node is correct.
 void testPath()
          Tests if the path of the created node is correct.
 void testPathNotFound()
          Tests if addNode() throws a PathNotFoundException in case intermediary nodes do not exist.
 void testRepositoryException()
          Tests if a RepositoryException is thrown in case the path for the new node contains an index.
 void testSameNameSiblings()
          Tests if same name siblings have equal names or if same name siblings are not supported a ItemExistsException is thrown.
 void testUnknownNodeType()
          Tests if addNode() throws a NoSuchNodeTypeException in case of an unknown node type.
 
Methods inherited from class org.apache.jackrabbit.test.AbstractJCRTest
createRandomString, getNonExistingWorkspaceName, getProperty, getSize, run, setUp, tearDown
 
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

AddNodeTest

public AddNodeTest()
Method Detail

testName

public void testName()
              throws javax.jcr.RepositoryException
Tests if the name of the created node is correct.

Throws:
javax.jcr.RepositoryException

testNodeType

public void testNodeType()
                  throws javax.jcr.RepositoryException
Tests if the node type of the created node is correct.

Throws:
javax.jcr.RepositoryException

testSameNameSiblings

public void testSameNameSiblings()
                          throws javax.jcr.RepositoryException
Tests if same name siblings have equal names or if same name siblings are not supported a ItemExistsException is thrown.

Throws:
javax.jcr.RepositoryException

testUnknownNodeType

public void testUnknownNodeType()
                         throws javax.jcr.RepositoryException
Tests if addNode() throws a NoSuchNodeTypeException in case of an unknown node type.

Throws:
javax.jcr.RepositoryException

testPath

public void testPath()
              throws javax.jcr.RepositoryException
Tests if the path of the created node is correct.

Throws:
javax.jcr.RepositoryException

testPathNotFound

public void testPathNotFound()
                      throws javax.jcr.RepositoryException
Tests if addNode() throws a PathNotFoundException in case intermediary nodes do not exist.

Throws:
javax.jcr.RepositoryException

testConstraintViolation

public void testConstraintViolation()
                             throws javax.jcr.RepositoryException
Tests if a ConstraintViolationException is thrown when one attempts to add a node at a path that references a property.

Throws:
javax.jcr.RepositoryException

testRepositoryException

public void testRepositoryException()
Tests if a RepositoryException is thrown in case the path for the new node contains an index.


testAddNodeParentSave

public void testAddNodeParentSave()
                           throws javax.jcr.RepositoryException
Creates two new nodes using Node.addNode(String) and Node.addNode(String,String), saves using Item.save() on parent node. Uses a second session to verify if the nodes have been saved.

Throws:
javax.jcr.RepositoryException

testAddNodeSessionSave

public void testAddNodeSessionSave()
                            throws javax.jcr.RepositoryException
Creates new nodes using Node.addNode(String) and Node.addNode(String, String), saves using Session.save(). Uses a second session to verify if the node has been safed.

Throws:
javax.jcr.RepositoryException

testAddNodeRepositoryExceptionSaveOnNewNode

public void testAddNodeRepositoryExceptionSaveOnNewNode()
                                                 throws javax.jcr.RepositoryException
Creates new nodes using Node.addNode(String) and Node.addNode(String, String), then tries to call Item.save() on the new nodes.

This should throw an RepositoryException.

Throws:
javax.jcr.RepositoryException


Copyright © -2005 . All Rights Reserved.