jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Whipple (JIRA)" <j...@apache.org>
Subject [jira] Updated: (JCR-1807) Removing peer nodes throws RepositoryException
Date Mon, 13 Oct 2008 19:22:46 GMT

     [ https://issues.apache.org/jira/browse/JCR-1807?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Brian Whipple updated JCR-1807:
-------------------------------

    Attachment: TestAll.java
                RemoveNodeTest.java

This new unit test can be used to reproduce the problem.

> Removing peer nodes throws RepositoryException
> ----------------------------------------------
>
>                 Key: JCR-1807
>                 URL: https://issues.apache.org/jira/browse/JCR-1807
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: core 1.4.6
>            Reporter: Brian Whipple
>         Attachments: RemoveNodeTest.java, TestAll.java
>
>
> The following UnitTest will reproduce the error.  Note that 3 peer nodes must be removed
to produce the exception.  Additional testing shows that the paths are corrupted after the
second remove.
> Also note that Node.getPath (per the comment in the test) must be invoked to produce
the path corruption.
> This unit test is based on the jackrabbit-jcr-tests test framework. I will attach the
java file too.  Here is the test:
> package org.apache.jackrabbit.test.api;
> import javax.jcr.Node;
> import javax.jcr.NodeIterator;
> import javax.jcr.RepositoryException;
> import org.apache.jackrabbit.test.AbstractJCRTest;
> /**
>  * <code>RemoveNodeTest</code> contains the test cases for the method
>  * <code>Node.remove()</code>.
>  *
>  * @test
>  * @sources RemoveNodeTest.java
>  * @executeClass org.apache.jackrabbit.test.api.RemoveNodeTest
>  * @keywords level2
>  */
> public class RemoveNodeTest extends AbstractJCRTest
> {
>     private static final String CHILD_NAME = "child";
>     public void testAddThenRemovePeerNodes() throws Exception
>     {
>         // Must remove at least three peers so need to add three peer nodes
>         long NUM_SIB_NODES = 3;
>         for (long i = 0; i < NUM_SIB_NODES; i++)
>         {
>             testRootNode.addNode(CHILD_NAME);
>         }
>         // If this method is not invoked the test will pass
>         // Getting the child node paths contributes to the error
>         getPaths();
>         // Remove all nodes
>         removeNodes();
>         testRootNode.save();
>         // Validate that all nodes have been removed.
>         long numChildren = testRootNode.getNodes(CHILD_NAME).getSize();
>         assertEquals("Invalid number of child nodes", 0, numChildren);
>     }
>     private void getPaths() throws RepositoryException
>     {
>         NodeIterator childNodes = testRootNode.getNodes(CHILD_NAME);
>         while (childNodes.hasNext())
>         {
>             Node child = childNodes.nextNode();
>             child.getPath();
>         }
>     }
>     private void removeNodes() throws RepositoryException
>     {
>         NodeIterator childNodes = testRootNode.getNodes(CHILD_NAME);
>         while (childNodes.hasNext())
>         {
>             Node child = childNodes.nextNode();
>             child.remove();
>         }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message