jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Pitfield (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-505) TCK: AbstractJCRTest fails if setUp/tearDown cannot remove children of test node
Date Fri, 04 Aug 2006 19:42:14 GMT
    [ http://issues.apache.org/jira/browse/JCR-505?page=comments#action_12425834 ] 
            
David Pitfield commented on JCR-505:
------------------------------------

Thank you for the change to test whether the nodedef is mandatory or protected.

There are a couple of other scenarios which prevent the node from being removed:

1) the parent node is protected
2) implementation-specific constraints (per 7.1.6)

An example of the latter is a node that is conditionally mandatory based on a property's value.

Therefore I propose consuming any ConstraintViolationException thrown by remove in cleanUpTestRoot
of AbstractJCRTest.

> TCK: AbstractJCRTest fails if setUp/tearDown cannot remove children of test node
> --------------------------------------------------------------------------------
>
>                 Key: JCR-505
>                 URL: http://issues.apache.org/jira/browse/JCR-505
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: test
>            Reporter: David Pitfield
>             Fix For: 1.1
>
>
> If the test node exists, the setUp and tearDown methods remove all its child nodes. 
In some repositories these child nodes may be mandatory or protected, causing test setup/teardown
to fail.
> Proposal: tolerate exceptions thrown in removing a child node in test setup/teardown.
> --- ../AbstractJCRTest.java     (revision 422074)
> +++ ../AbstractJCRTest.java     (working copy)
> @@ -344,7 +344,11 @@
>                  // clean test root
>                  testRootNode = root.getNode(testPath);
>                  for (NodeIterator children = testRootNode.getNodes(); children.hasNext();)
{
> -                    children.nextNode().remove();
> +                    try {
> +                      children.nextNode().remove();
> +                    } catch (RepositoryException e) {
> +                      // consume
> +                    }
>                  }
>              } else {
>                  // create nodes to testPath
> @@ -375,7 +379,11 @@
>                          // clean test root
>                          testRootNode = root.getNode(testPath);
>                          for (NodeIterator children = testRootNode.getNodes(); children.hasNext();)
{
> -                            children.nextNode().remove();
> +                            try {
> +                              children.nextNode().remove();
> +                            } catch (RepositoryException e) {
> +                              // consume
> +                            }
>                          }
>                          root.save();
>                      }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message