You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by mr...@apache.org on 2004/10/08 14:08:48 UTC

svn commit: rev 54068 - in incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test: . api api/access api/lock api/nodetype api/observation api/query api/util api/version api/xa observation search

Author: mreutegg
Date: Fri Oct  8 05:08:47 2004
New Revision: 54068

Added:
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/AbstractJCRTest.java   (contents, props changed)
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/LogPrintWriter.java   (contents, props changed)
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/AddNodeTest.java   (contents, props changed)
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/GetAncestorTest.java   (contents, props changed)
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/RootNodeTest.java   (contents, props changed)
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/TestAll.java   (contents, props changed)
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/access/
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/lock/
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/observation/
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/util/
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/xa/
Removed:
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/AbstractTest.java
Modified:
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/JUnitTest.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/RepositoryHelper.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/RepositoryStub.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/AbstractObservationTest.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/EventResult.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/NodeAddedTest.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/NodeRemovedTest.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyAddedTest.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyChangedTest.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyRemovedTest.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/AbstractQueryTest.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/FulltextQueryTest.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/SelectClauseTest.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/SimpleQueryTest.java
Log:
- Prepared package structure for tck tests under org.apache.jackrabbit.test.api
- Restructured test base classes for easier integration into javatest
- Test classes under test.api package are considered as sample tck tests. in contrast to tests in e.g. test/observation; those must be considered implementation specific sample test. not all repos will support nt:unstructured.

Added: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/AbstractJCRTest.java
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/AbstractJCRTest.java	Fri Oct  8 05:08:47 2004
@@ -0,0 +1,161 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+import javax.jcr.NodeIterator;
+import javax.jcr.RepositoryException;
+import java.util.StringTokenizer;
+
+/**
+ * Abstract base class for all JCR test classes.
+ */
+public abstract class AbstractJCRTest extends JUnitTest {
+
+    /**
+     * Helper object to access repository transparently
+     */
+    public static final RepositoryHelper helper = new RepositoryHelper();
+
+    protected static final String JCR_PRIMARY_TYPE = "jcr:primaryType";
+
+    protected static final String NT_UNSTRUCTURED = "nt:unstructured";
+
+    protected static final String MIX_REFERENCABLE = "mix:referencable";
+
+    protected static final String NT_BASE = "nt:base";
+
+    /**
+     * Relative path to the test root node.
+     */
+    protected String testPath;
+
+    /**
+     * Absolute path to the test root node.
+     */
+    protected String testRoot;
+
+    /**
+     * The node type name for newly created nodes.
+     */
+    protected String testNodeType;
+
+    /**
+     * Name of a node that will be created during a test case.
+     */
+    protected String nodeName1;
+
+    /**
+     * Name of a node that will be created during a test case.
+     */
+    protected String nodeName2;
+
+    /**
+     * Name of a node that will be created during a test case.
+     */
+    protected String nodeName3;
+
+    /**
+     * The superuser session
+     */
+    protected Session superuser;
+
+    /**
+     * The root <code>Node</code> for testing
+     */
+    protected Node testRootNode;
+
+    protected void setUp() throws Exception {
+        testRoot = getProperty(RepositoryStub.PROP_TESTROOT);
+        if (testRoot == null) {
+            fail("Property '" + RepositoryStub.PROP_TESTROOT + "' is not defined.");
+        }
+
+        // cut off '/' to build testPath
+        testPath = testRoot.substring(1);
+        testNodeType = getProperty(RepositoryStub.PROP_NODETYPE);
+        // setup node names
+        nodeName1 = getProperty(RepositoryStub.PROP_NODE_NAME1);
+        if (nodeName1 == null) {
+            fail("Property '" + RepositoryStub.PROP_NODE_NAME1 + "' is not defined.");
+        }
+        nodeName2 = getProperty(RepositoryStub.PROP_NODE_NAME2);
+        if (nodeName2 == null) {
+            fail("Property '" + RepositoryStub.PROP_NODE_NAME2 + "' is not defined.");
+        }
+        nodeName3 = getProperty(RepositoryStub.PROP_NODE_NAME3);
+        if (nodeName3 == null) {
+            fail("Property '" + RepositoryStub.PROP_NODE_NAME3 + "' is not defined.");
+        }
+
+        superuser = helper.getSuperuserSession();
+        Node root = superuser.getRootNode();
+        if (root.hasNode(testPath)) {
+            // clean test root
+            testRootNode = root.getNode(testPath);
+            for (NodeIterator children = testRootNode.getNodes(); children.hasNext();) {
+                testRootNode.remove(children.nextNode().getName());
+            }
+        } else {
+            // create nodes to testPath
+            StringTokenizer names = new StringTokenizer(testPath, "/");
+            Node currentNode = root;
+            while (names.hasMoreTokens()) {
+                currentNode.addNode(names.nextToken(), testNodeType);
+            }
+            testRootNode = currentNode;
+        }
+        root.save();
+    }
+
+    protected void tearDown() throws Exception {
+        if (superuser != null) {
+            // do a 'rollback'
+            superuser.refresh(false);
+            Node root = superuser.getRootNode();
+            if (root.hasNode(testPath)) {
+                // clean test root
+                testRootNode = root.getNode(testPath);
+                for (NodeIterator children = testRootNode.getNodes(); children.hasNext();) {
+                    testRootNode.remove(children.nextNode().getName());
+                }
+                root.save();
+            }
+            superuser.logout();
+        }
+    }
+
+    protected String getProperty(String name) throws RepositoryException {
+        String testCaseName = getName();
+        String testClassName = getClass().getName();
+        int idx;
+        if ((idx = testClassName.lastIndexOf('.')) > -1) {
+            testClassName = testClassName.substring(idx + 1);
+        }
+        log.println("getProperty: testClassName=" + testClassName
+                + "; testCaseName=" + testCaseName);
+
+        // check test case specific property first
+        String value = helper.getProperty(RepositoryStub.PROP_PREFIX + "."
+                + testClassName + "." + testCaseName + "." + name);
+        if (value != null) {
+            return value;
+        }
+        return helper.getProperty(RepositoryStub.PROP_PREFIX + "." + name);
+    }
+
+}

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/JUnitTest.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/JUnitTest.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/JUnitTest.java	Fri Oct  8 05:08:47 2004
@@ -19,18 +19,23 @@
 import org.apache.log4j.Logger;
 
 /**
- *
+ * Abstract base class for any JUnit test case.
  */
-public class JUnitTest extends TestCase {
+public abstract class JUnitTest extends TestCase {
 
     /**
-     * Helper object to access repository transparently
+     * Logger instance for test cases
      */
-    public static final RepositoryHelper helper = new RepositoryHelper();
+    private static final Logger logger = Logger.getLogger(JUnitTest.class);
 
     /**
-     * Logger instance for test cases
+     * Output stream for general messages from tests.
+     */
+    protected LogPrintWriter log = new LogPrintWriter(logger);
+
+    /**
+     * Output stream for reference output from tests.
      */
-    protected static final Logger log = Logger.getLogger(JUnitTest.class);
+    protected LogPrintWriter ref = new LogPrintWriter(logger);
 
 }

Added: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/LogPrintWriter.java
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/LogPrintWriter.java	Fri Oct  8 05:08:47 2004
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+
+import java.io.Writer;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * Implements a PrintWriter which allows to alternatively plug in a
+ * <code>Writer</code> or a <code>Logger</code>.
+ */
+public class LogPrintWriter extends PrintWriter {
+
+    /**
+     * Internal buffer.
+     */
+    private StringBuffer buffer = new StringBuffer();
+
+    /**
+     * Logger for message output.
+     */
+    private Logger log;
+
+    /**
+     * Default Level is debug.
+     */
+    private Level level = Level.DEBUG;
+
+    /**
+     * Creates a new <code>LogPrintWriter</code> which is based on a
+     * <code>Writer</code>.
+     *
+     * @param out the base <code>Writer</code>.
+     */
+    public LogPrintWriter(Writer out) {
+        super(out);
+    }
+
+    /**
+     * Creates a new <code>LogPrintWriter</code> which is based on a
+     * <code>Logger</code>.
+     *
+     * @param log the base <code>Logger</code>.
+     */
+    public LogPrintWriter(Logger log) {
+        super(new NullWriter());
+        this.log = log;
+    }
+
+    /**
+     * Sets a new output <code>Writer</code>. Calling this method will flush
+     * this <code>LogPrintWriter</code> before the new <code>Writer</code>
+     * <code>out</code> is set.
+     *
+     * @param out the <code>Writer</code> to use for output.
+     */
+    public void setWriter(Writer out) {
+        flushBuffer();
+        this.out = out;
+        this.log = null;
+    }
+
+    /**
+     * Sets a new <code>Logger</code>. Calling this method will flush this
+     * <code>LogPrintWriter</code> before the new <code>Logger</code> is set.
+     *
+     * @param log the new <code>Logger</code> to use for output.
+     */
+    public void setLogger(Logger log) {
+        flushBuffer();
+        out = new NullWriter();
+        this.log = log;
+    }
+
+    /**
+     * Sets the log level for messages written to the <code>Logger</code>
+     * instance currently set in this <code>LogPrintWriter</code>.
+     *
+     * @param level the log level to set.
+     */
+    public void setMsgLevel(Level level) {
+        this.level = level;
+    }
+
+    //------------------< overrides from PrintWriter >-------------------------
+
+    public void close() {
+        flushBuffer();
+        super.close();
+    }
+
+    public void flush() {
+        flushBuffer();
+        super.flush();
+    }
+
+    public void write(int c) {
+        buffer.append(c);
+    }
+
+    public void write(char cbuf[], int off, int len) {
+        buffer.append(cbuf, off, len);
+    }
+
+    public void write(String str, int off, int len) {
+        buffer.append(str.substring(off, off + len));
+    }
+
+    public void println() {
+        if (log == null) {
+            // only add newline when operating on a writer
+            buffer.append('\n');
+        }
+        flushBuffer();
+    }
+
+    //-----------------------< private methods >--------------------------------
+
+    private void flushBuffer() {
+        if (log != null) {
+            log.log(level, buffer);
+        } else {
+            try {
+                out.write(buffer.toString());
+            } catch (IOException e) {
+                this.setError();
+            }
+        }
+        // reset buffer
+        buffer.setLength(0);
+    }
+
+    //------------------------< inter classes >---------------------------------
+
+    /**
+     * Implements a Writer that simply ignores all calls.
+     */
+    private static class NullWriter extends Writer {
+
+        public void close() throws IOException {
+            // ignore
+        }
+
+        public void flush() throws IOException {
+            // ignore
+        }
+
+        public void write(char cbuf[], int off, int len) throws IOException {
+            // ignore
+        }
+    }
+}

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/RepositoryHelper.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/RepositoryHelper.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/RepositoryHelper.java	Fri Oct  8 05:08:47 2004
@@ -60,4 +60,11 @@
         }
     }
 
+    public String getProperty(String name) throws RepositoryException {
+        try {
+            return RepositoryStub.getInstance().getProperty(name);
+        } catch (RepositoryStubException e) {
+            throw new RepositoryException("Failed to obtain Repository instance.", e);
+        }
+    }
 }

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/RepositoryStub.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/RepositoryStub.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/RepositoryStub.java	Fri Oct  8 05:08:47 2004
@@ -37,21 +37,33 @@
 
     public static final String STUB_IMPL_PROPS = "repositoryStubImpl.properties";
 
-    public static final String STUB_IMPL_SYS_PROPS = "javax.jcr.tck.properties";
+    public static final String PROP_PREFIX = "javax.jcr.tck";
 
-    public static final String PROP_STUB_IMPL_CLASS = "javax.jcr.tck.repository_stub_impl";
+    public static final String STUB_IMPL_SYS_PROPS = PROP_PREFIX + ".properties";
 
-    public static final String PROP_SUPERUSER_PWD = "javax.jcr.tck.superuser.pwd";
+    public static final String PROP_STUB_IMPL_CLASS = PROP_PREFIX + ".repository_stub_impl";
 
-    public static final String PROP_SUPERUSER_NAME = "javax.jcr.tck.superuser.name";
+    public static final String PROP_SUPERUSER_PWD = "superuser.pwd";
 
-    public static final String PROP_READONLY_PWD = "javax.jcr.tck.readonly.pwd";
+    public static final String PROP_SUPERUSER_NAME = "superuser.name";
 
-    public static final String PROP_READONLY_NAME = "javax.jcr.tck.readonly.name";
+    public static final String PROP_READONLY_PWD = "readonly.pwd";
 
-    public static final String PROP_READWRITE_PWD = "javax.jcr.tck.readwrite.pwd";
+    public static final String PROP_READONLY_NAME = "readonly.name";
 
-    public static final String PROP_READWRITE_NAME = "javax.jcr.tck.readwrite.name";
+    public static final String PROP_READWRITE_PWD = "readwrite.pwd";
+
+    public static final String PROP_READWRITE_NAME = "readwrite.name";
+
+    public static final String PROP_NODETYPE = "nodetype";
+
+    public static final String PROP_TESTROOT = "testroot";
+
+    public static final String PROP_NODE_NAME1 = "nodename1";
+
+    public static final String PROP_NODE_NAME2 = "nodename2";
+
+    public static final String PROP_NODE_NAME3 = "nodename3";
 
     protected static RepositoryStub instance;
 
@@ -213,5 +225,17 @@
      */
     public Credentials getReadOnlyCredentials() {
         return readonly;
+    }
+
+    /**
+     * Returns the property with the specified <code>name</code>. If a
+     * property with the given name does not exist, <code>null</code> is
+     * returned.
+     * @param name the name of the property.
+     * @return the property, or <code>null</code> if the property does not
+     * exist.
+     */
+    public String getProperty(String name) {
+        return environment.getProperty(name);
     }
 }

Added: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/AddNodeTest.java
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/AddNodeTest.java	Fri Oct  8 05:08:47 2004
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.api;
+
+import org.apache.jackrabbit.test.AbstractJCRTest;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.nodetype.ConstraintViolationException;
+
+/**
+ * <code>AddNodeTest</code> contains the test cases for the method
+ * <code>Node.addNode(String, String)</code>.
+ *
+ * @test
+ * @sources AddNodeTest.java
+ * @executeClass org.apache.jackrabbit.test.api.AddNodeTest
+ * @keywords level1
+ */
+public class AddNodeTest extends AbstractJCRTest {
+
+    /**
+     * Tests if the name of the created node is correct.
+     */
+    public void testName() throws RepositoryException {
+        Node n1 = testRootNode.addNode(nodeName1, testNodeType);
+        testRootNode.save();
+        assertEquals("Wrong node name.", n1.getName(), nodeName1);
+    }
+
+    /**
+     * Tests if the node type of the created node is correct.
+     */
+    public void testNodeType() throws RepositoryException {
+        Node n1 = testRootNode.addNode(nodeName1, testNodeType);
+        testRootNode.save();
+        String ntName = n1.getPrimaryNodeType().getName();
+        assertEquals("Wrong node NodeType name.", testNodeType, ntName);
+    }
+
+    /**
+     * Tests if same name siblings have equal names or if same name
+     * siblings are not supported a ItemExistsException is thrown.
+     */
+    public void testSameNameSiblings() throws RepositoryException {
+        if (testRootNode.getDefinition().allowSameNameSibs()) {
+            Node n1 = testRootNode.addNode(nodeName1, testNodeType);
+            Node n2 = testRootNode.addNode(nodeName1, testNodeType);
+            testRootNode.save();
+            assertEquals("Names of same name siblings are not equal.",
+                    n1.getName(), n2.getName());
+        } else {
+            testRootNode.addNode(nodeName1, testNodeType);
+            try {
+                testRootNode.addNode(nodeName1, testNodeType);
+                fail("Expected ItemExistsException.");
+            } catch (ItemExistsException e) {
+                // correct
+            }
+        }
+    }
+
+    /**
+     * Tests if addNode() throws a NoSuchNodeTypeException in case
+     * of an unknown node type.
+     */
+    public void testUnknownNodeType() throws RepositoryException {
+        try {
+            testRootNode.addNode(nodeName1, testNodeType + "unknownSuffix");
+            fail("Expected NoSuchNodeTypeException.");
+        } catch (NoSuchNodeTypeException e) {
+            // correct.
+        }
+    }
+
+    /**
+     * Tests if the path of the created node is correct.
+     */
+    public void testPath() throws RepositoryException {
+        Node n1 = testRootNode.addNode(nodeName1, testNodeType);
+        testRootNode.save();
+        String expected = testRootNode.getPath() + "/" + nodeName1;
+        assertEquals("Wrong path for created node.", expected, n1.getPath());
+    }
+
+    /**
+     * Tests if addNode() throws a PathNotFoundException in case
+     * intermediary nodes do not exist.
+     */
+    public void testPathNotFound() throws RepositoryException {
+        try {
+            testRootNode.addNode(nodeName1 + "/" + nodeName1, testNodeType);
+            fail("Expected PathNotFoundException.");
+        } catch (PathNotFoundException e) {
+            // correct.
+        }
+    }
+
+    /**
+     * Tests if a ConstraintViolationException is thrown when one attempts
+     * to add a node at a path that references a property.
+     */
+    public void testConstraintViolation() throws RepositoryException {
+        try {
+            Node rootNode = superuser.getRootNode();
+            String propPath = testPath + "/" + JCR_PRIMARY_TYPE;
+            rootNode.addNode(propPath + "/" + nodeName1, testNodeType);
+            fail("Expected ConstraintViolationException.");
+        } catch (ConstraintViolationException e) {
+            // correct.
+        }
+    }
+
+    /**
+     * Tests if a RepositoryException is thrown in case the path
+     * for the new node contains an index.
+     */
+    public void testRepositoryException() {
+        try {
+            testRootNode.addNode(nodeName1 + "[1]");
+            fail("Expected RepositoryException.");
+        } catch (RepositoryException e) {
+            // correct.
+        }
+    }
+}
\ No newline at end of file

Added: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/GetAncestorTest.java
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/GetAncestorTest.java	Fri Oct  8 05:08:47 2004
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.api;
+
+import org.apache.jackrabbit.test.AbstractJCRTest;
+
+import javax.jcr.*;
+
+/**
+ * Test cases for <code>Item</code>.
+ *
+ * @test
+ * @sources GetAncestorTest.java
+ * @executeClass org.apache.jackrabbit.test.api.GetAncestorTest
+ * @keywords level1
+ */
+public class GetAncestorTest extends AbstractJCRTest {
+
+    protected Item item;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        item = helper.getReadOnlySession().getRootNode();
+    }
+
+    /**
+     * Test if the ancestor at depth = n, where n is the depth of this <code>Item</code>,
+     * returns this <code>Item</code> itself.
+     *
+     * @throws RepositoryException
+     */
+    public void testGetAncestorOfItemDepth() throws RepositoryException {
+        Item itemAtDepth = item.getAncestor(item.getDepth());
+        assertSame("The ancestor of depth = n, where n is the depth of this " +
+                "Item must be the item itself.", item, itemAtDepth);
+    }
+
+    /**
+     * Test if getting the ancestor of depth = n, where n is greater than depth
+     * of this <code>Item</code>, throws an <code>ItemNotFoundException</code>.
+     *
+     * @throws RepositoryException
+     */
+    public void testGetAncestorOfGreaterDepth() throws RepositoryException {
+        try {
+            int greaterDepth = item.getDepth()+1;
+            item.getAncestor(greaterDepth);
+            fail("Getting ancestor of depth n, where n is greater than depth of" +
+                    "this Item must throw an ItemNotFoundException");
+        } catch (ItemNotFoundException e) {
+            // success
+        }
+    }
+
+    /**
+     * Test if getting the ancestor of negative depth throws an
+     * <code>ItemNotFoundException</code>.
+     *
+     * @throws RepositoryException
+     */
+    public void testGetAncestorOfNegativeDepth() throws RepositoryException {
+        try {
+            item.getAncestor(-1);
+            fail("Getting ancestor of depth < 0 must throw an ItemNotFoundException.");
+        } catch (ItemNotFoundException e) {
+            // success
+        }
+    }
+}
\ No newline at end of file

Added: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/RootNodeTest.java
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/RootNodeTest.java	Fri Oct  8 05:08:47 2004
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.api;
+
+import org.apache.jackrabbit.test.AbstractJCRTest;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.ItemNotFoundException;
+
+/**
+ * Test cases for the root node.
+ *
+ * @test
+ * @sources RootNodeTest.java
+ * @executeClass org.apache.jackrabbit.test.api.RootNodeTest
+ * @keywords level1
+ */
+public class RootNodeTest extends AbstractJCRTest {
+
+    Node rootNode;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        rootNode = helper.getReadOnlySession().getRootNode();
+    }
+
+    /**
+     * Test if name of root node is empty string.
+     */
+    public void testGetName() throws RepositoryException {
+        assertEquals("The name of the root node must be an empty string.", "", rootNode.getName());
+    }
+
+    /**
+     * Test if depth of root node is 0.
+     */
+    public void testGetDepth() throws RepositoryException {
+        assertEquals("The depth of the root node must be equal to 0.", 0, rootNode.getDepth());
+    }
+
+    /**
+     * Test if root node has no parent and throws ItemNotFoundException.
+     */
+    public void testGetParent() throws RepositoryException {
+        try {
+            rootNode.getParent();
+            fail("The root node may not have a parent.");
+        } catch (ItemNotFoundException e) {
+            // success: ItemNotFoundException as required by the specification.
+        }
+    }
+}
\ No newline at end of file

Added: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/TestAll.java
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/TestAll.java	Fri Oct  8 05:08:47 2004
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.api;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Test suite that includes all testcases for the package
+ * <code>javax.jcr</code>.
+ */
+public class TestAll extends TestCase {
+
+    /**
+     * Returns a <code>Test</code> suite that executes all tests inside this
+     * package.
+     *
+     * @return a <code>Test</code> suite that executes all tests inside this
+     *         package.
+     */
+    public static Test suite() {
+        TestSuite suite = new TestSuite("Search tests");
+
+        suite.addTestSuite(AddNodeTest.class);
+        suite.addTestSuite(GetAncestorTest.class);
+        suite.addTestSuite(RootNodeTest.class);
+
+        return suite;
+    }
+}
\ No newline at end of file

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/AbstractObservationTest.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/AbstractObservationTest.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/AbstractObservationTest.java	Fri Oct  8 05:08:47 2004
@@ -15,7 +15,7 @@
  */
 package org.apache.jackrabbit.test.observation;
 
-import org.apache.jackrabbit.test.AbstractTest;
+import org.apache.jackrabbit.test.AbstractJCRTest;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.observation.Event;
@@ -29,7 +29,7 @@
  * This class implements the basic {@link #setUp} and {@link #tearDown()}
  * methods for the observation test cases.
  */
-public abstract class AbstractObservationTest extends AbstractTest {
+public abstract class AbstractObservationTest extends AbstractJCRTest {
 
     /**
      * Default wait timeout for events: 5000 ms
@@ -98,11 +98,11 @@
 
     /**
      * Checks <code>Events</code> for paths. All <code>relPaths</code> are
-     * relative to {@link #TEST_ROOT}.
+     * relative to {@link #testRoot}.
      *
      * @param events   the <code>Event</code>s.
      * @param relPaths paths to child nodes added relative to {@link
-     *                 #TEST_ROOT}.
+     *                 #testRoot}.
      * @throws RepositoryException if an error occurs while retrieving the nodes
      *                             from event instances.
      */
@@ -113,11 +113,11 @@
 
     /**
      * Checks <code>Events</code> for paths. All <code>relPaths</code> are
-     * relative to {@link #TEST_ROOT}.
+     * relative to {@link #testRoot}.
      *
      * @param events   the <code>Event</code>s.
      * @param relPaths paths to child nodes added relative to {@link
-     *                 #TEST_ROOT}.
+     *                 #testRoot}.
      * @throws RepositoryException if an error occurs while retrieving the nodes
      *                             from event instances.
      */
@@ -128,11 +128,11 @@
 
     /**
      * Checks <code>Events</code> for paths. All <code>relPaths</code> are
-     * relative to {@link #TEST_ROOT}.
+     * relative to {@link #testRoot}.
      *
      * @param events   the <code>Event</code>s.
      * @param relPaths paths to added properties relative to {@link
-     *                 #TEST_ROOT}.
+     *                 #testRoot}.
      * @throws RepositoryException if an error occurs while retrieving the nodes
      *                             from event instances.
      */
@@ -143,11 +143,11 @@
 
     /**
      * Checks <code>Events</code> for paths. All <code>relPaths</code> are
-     * relative to {@link #TEST_ROOT}.
+     * relative to {@link #testRoot}.
      *
      * @param events   the <code>Event</code>s.
      * @param relPaths paths to changed properties relative to {@link
-     *                 #TEST_ROOT}.
+     *                 #testRoot}.
      * @throws RepositoryException if an error occurs while retrieving the nodes
      *                             from event instances.
      */
@@ -158,11 +158,11 @@
 
     /**
      * Checks <code>Events</code> for paths. All <code>relPaths</code> are
-     * relative to {@link #TEST_ROOT}.
+     * relative to {@link #testRoot}.
      *
      * @param events   the <code>Event</code>s.
      * @param relPaths paths to removed properties relative to {@link
-     *                 #TEST_ROOT}.
+     *                 #testRoot}.
      * @throws RepositoryException if an error occurs while retrieving the nodes
      *                             from event instances.
      */
@@ -173,10 +173,10 @@
 
     /**
      * Checks <code>Events</code> for paths. All <code>relPaths</code> are
-     * relative to {@link #TEST_ROOT}.
+     * relative to {@link #testRoot}.
      *
      * @param events    the <code>Event</code>s.
-     * @param relPaths  paths to item events relative to {@link #TEST_ROOT}.
+     * @param relPaths  paths to item events relative to {@link #testRoot}.
      * @param eventType the type of event to check.
      * @throws RepositoryException if an error occurs while retrieving the nodes
      *                             from event instances.
@@ -192,7 +192,7 @@
             paths.add(path);
         }
         for (int i = 0; i < relPaths.length; i++) {
-            String expected = TEST_ROOT + "/" + relPaths[i];
+            String expected = testRoot + "/" + relPaths[i];
             assertTrue("Path " + expected + " not found in events.",
                     paths.contains(expected));
         }

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/EventResult.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/EventResult.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/EventResult.java	Fri Oct  8 05:08:47 2004
@@ -17,13 +17,13 @@
 
 import EDU.oswego.cs.dl.util.concurrent.Mutex;
 import EDU.oswego.cs.dl.util.concurrent.Sync;
-import org.apache.log4j.Logger;
 
 import javax.jcr.observation.Event;
 import javax.jcr.observation.EventIterator;
 import javax.jcr.observation.EventListener;
 import java.util.ArrayList;
 import java.util.List;
+import java.io.PrintWriter;
 
 /**
  * Utility class for <code>Event</code> retrieval with an
@@ -42,21 +42,21 @@
     private Sync sync = new Mutex();
 
     /**
-     * <code>Logger</code> where log message are written.
+     * <code>PrintWriter</code> where log messages are written.
      */
-    private final Logger log;
+    private final PrintWriter log;
 
     /**
      * Creates a new <code>EventResult</code>.
      *
      * @param log log messages are written to this <code>Logger</code>.
      */
-    EventResult(Logger log) {
+    EventResult(PrintWriter log) {
         this.log = log;
         try {
             sync.acquire();
         } catch (InterruptedException e) {
-            log.error("Could not aquire sync.");
+            log.println("Could not aquire sync.");
             throw new RuntimeException("EventResult: Interrupted while aquiring sync.");
         }
     }
@@ -80,10 +80,10 @@
                 sync.release();
                 return events;
             } else {
-                log.error("Events not delivered within " + wait + " ms.");
+                log.println("Events not delivered within " + wait + " ms.");
             }
         } catch (InterruptedException e) {
-            log.warn("Interrupted while waiting for EventIterator.");
+            log.println("Interrupted while waiting for EventIterator.");
         }
         return new Event[0];
     }

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/NodeAddedTest.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/NodeAddedTest.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/NodeAddedTest.java	Fri Oct  8 05:08:47 2004
@@ -29,45 +29,45 @@
     public void testSingleNodeAdded() throws RepositoryException {
         EventResult result = new EventResult(log);
         addEventListener(result, EventType.CHILD_NODE_ADDED);
-        testRoot.addNode("foo", NT_UNSTRUCTURED);
-        testRoot.save();
+        testRootNode.addNode(nodeName1, testNodeType);
+        testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
-        checkNodeAdded(events, new String[]{"foo"});
+        checkNodeAdded(events, new String[]{nodeName1});
     }
 
     public void testMultipleNodeAdded1() throws RepositoryException {
         EventResult result = new EventResult(log);
         addEventListener(result, EventType.CHILD_NODE_ADDED);
-        testRoot.addNode("foo", NT_UNSTRUCTURED);
-        testRoot.addNode("bar", NT_UNSTRUCTURED);
-        testRoot.save();
+        testRootNode.addNode(nodeName1, testNodeType);
+        testRootNode.addNode(nodeName2, testNodeType);
+        testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
-        checkNodeAdded(events, new String[]{"foo", "bar"});
+        checkNodeAdded(events, new String[]{nodeName1, nodeName2});
     }
 
     public void testMultipleNodeAdded2() throws RepositoryException {
         EventResult result = new EventResult(log);
         addEventListener(result, EventType.CHILD_NODE_ADDED);
-        Node foo = testRoot.addNode("foo", NT_UNSTRUCTURED);
-        foo.addNode("bar", NT_UNSTRUCTURED);
-        testRoot.save();
+        Node n1 = testRootNode.addNode(nodeName1, testNodeType);
+        n1.addNode(nodeName2, testNodeType);
+        testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
-        checkNodeAdded(events, new String[]{"foo", "foo/bar"});
+        checkNodeAdded(events, new String[]{nodeName1, nodeName1 + "/" + nodeName2});
     }
 
     public void testTransientNodeAddedRemoved() throws RepositoryException {
         EventResult result = new EventResult(log);
         addEventListener(result, EventType.CHILD_NODE_ADDED);
-        Node foo = testRoot.addNode("foo", NT_UNSTRUCTURED);
-        foo.addNode("bar", NT_UNSTRUCTURED);
-        foo.remove("bar");
-        testRoot.save();
+        Node n1 = testRootNode.addNode(nodeName1, testNodeType);
+        n1.addNode(nodeName2, testNodeType);
+        n1.remove(nodeName2);
+        testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
-        checkNodeAdded(events, new String[]{"foo"});
+        checkNodeAdded(events, new String[]{nodeName1});
     }
 
     /*
@@ -76,12 +76,12 @@
     public void testMultiPathSameNameAdded() throws RepositoryException {
         EventResult result = new EventResult(log);
         addEventListener(result, EventType.CHILD_NODE_ADDED);
-        Node foo = testRoot.addNode("foo", NT_UNSTRUCTURED);
-        Node bar = testRoot.addNode("bar", NT_UNSTRUCTURED);
+        Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
+        Node bar = testRootNode.addNode("bar", NT_UNSTRUCTURED);
         Node bla = foo.addNode("bla", NT_UNSTRUCTURED);
         bla.addMixin(MIX_REFERENCABLE);
         bar.addNode(bla, "bla");
-        testRoot.save();
+        testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
         checkNodeAdded(events, new String[] { "foo", "bar", "foo/bla", "bar/bla"});

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/NodeRemovedTest.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/NodeRemovedTest.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/NodeRemovedTest.java	Fri Oct  8 05:08:47 2004
@@ -29,10 +29,10 @@
     public void testSingleNodeRemoved() throws RepositoryException {
         EventResult result = new EventResult(log);
         addEventListener(result, EventType.CHILD_NODE_REMOVED);
-        testRoot.addNode("foo", NT_UNSTRUCTURED);
-        testRoot.save();
-        testRoot.remove("foo");
-        testRoot.save();
+        testRootNode.addNode("foo", NT_UNSTRUCTURED);
+        testRootNode.save();
+        testRootNode.remove("foo");
+        testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
         checkNodeRemoved(events, new String[]{"foo"});
@@ -41,11 +41,11 @@
     public void testMultiNodesRemoved() throws RepositoryException {
         EventResult result = new EventResult(log);
         addEventListener(result, EventType.CHILD_NODE_REMOVED);
-        Node foo = testRoot.addNode("foo", NT_UNSTRUCTURED);
+        Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.addNode("bar", NT_UNSTRUCTURED);
-        testRoot.save();
-        testRoot.remove("foo");
-        testRoot.save();
+        testRootNode.save();
+        testRootNode.remove("foo");
+        testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
         checkNodeRemoved(events, new String[]{"foo", "foo/bar"});
@@ -54,12 +54,12 @@
     public void testMultiNodesRemovedWithRemaining() throws RepositoryException {
         EventResult result = new EventResult(log);
         addEventListener(result, EventType.CHILD_NODE_REMOVED);
-        Node foo = testRoot.addNode("foo", NT_UNSTRUCTURED);
-        testRoot.addNode("foobar", NT_UNSTRUCTURED);
+        Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
+        testRootNode.addNode("foobar", NT_UNSTRUCTURED);
         foo.addNode("bar", NT_UNSTRUCTURED);
-        testRoot.save();
-        testRoot.remove("foo");
-        testRoot.save();
+        testRootNode.save();
+        testRootNode.remove("foo");
+        testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
         checkNodeRemoved(events, new String[]{"foo", "foo/bar"});

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyAddedTest.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyAddedTest.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyAddedTest.java	Fri Oct  8 05:08:47 2004
@@ -29,9 +29,9 @@
     public void testSinglePropertyAdded() throws RepositoryException {
         EventResult result = new EventResult(log);
         addEventListener(result, EventType.PROPERTY_ADDED);
-        Node foo = testRoot.addNode("foo", NT_UNSTRUCTURED);
+        Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.setProperty("prop1", new String[]{"foo"});
-        testRoot.save();
+        testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
         checkPropertyAdded(events, new String[]{"foo/prop1",
@@ -41,10 +41,10 @@
     public void testMultiPropertyAdded() throws RepositoryException {
         EventResult result = new EventResult(log);
         addEventListener(result, EventType.PROPERTY_ADDED);
-        Node foo = testRoot.addNode("foo", NT_UNSTRUCTURED);
+        Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.setProperty("prop1", new String[]{"foo"});
         foo.setProperty("prop2", new String[]{"bar"});
-        testRoot.save();
+        testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
         checkPropertyAdded(events, new String[]{"foo/prop1",

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyChangedTest.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyChangedTest.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyChangedTest.java	Fri Oct  8 05:08:47 2004
@@ -28,12 +28,12 @@
 
     public void testSinglePropertyChanged() throws RepositoryException {
         EventResult result = new EventResult(log);
-        Node foo = testRoot.addNode("foo", NT_UNSTRUCTURED);
+        Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.setProperty("bar", new String[]{"foo"});
-        testRoot.save();
+        testRootNode.save();
         addEventListener(result, EventType.PROPERTY_CHANGED);
         foo.getProperty("bar").setValue(new String[]{"foobar"});
-        testRoot.save();
+        testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
         checkPropertyChanged(events, new String[]{"foo/bar"});
@@ -41,14 +41,14 @@
 
     public void testMultiPropertyChanged() throws RepositoryException {
         EventResult result = new EventResult(log);
-        Node foo = testRoot.addNode("foo", NT_UNSTRUCTURED);
+        Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.setProperty("prop1", new String[]{"foo"});
         foo.setProperty("prop2", new String[]{"bar"});
-        testRoot.save();
+        testRootNode.save();
         addEventListener(result, EventType.PROPERTY_CHANGED);
         foo.getProperty("prop1").setValue(new String[]{"foobar"});
         foo.getProperty("prop2").setValue(new String[]{"foobar"});
-        testRoot.save();
+        testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
         checkPropertyChanged(events, new String[]{"foo/prop1", "foo/prop2"});
@@ -56,13 +56,13 @@
 
     public void testSinglePropertyChangedWithAdded() throws RepositoryException {
         EventResult result = new EventResult(log);
-        Node foo = testRoot.addNode("foo", NT_UNSTRUCTURED);
+        Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.setProperty("bar", new String[]{"foo"});
-        testRoot.save();
+        testRootNode.save();
         addEventListener(result, EventType.PROPERTY_CHANGED);
         foo.getProperty("bar").setValue(new String[]{"foobar"});
         foo.setProperty("foo", new String[]{"bar"});    // will not fire prop changed event
-        testRoot.save();
+        testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
         checkPropertyChanged(events, new String[]{"foo/bar"});
@@ -70,15 +70,15 @@
 
     public void testMultiPropertyChangedWithAdded() throws RepositoryException {
         EventResult result = new EventResult(log);
-        Node foo = testRoot.addNode("foo", NT_UNSTRUCTURED);
+        Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.setProperty("prop1", new String[]{"foo"});
         foo.setProperty("prop2", new String[]{"bar"});
-        testRoot.save();
+        testRootNode.save();
         addEventListener(result, EventType.PROPERTY_CHANGED);
         foo.getProperty("prop1").setValue(new String[]{"foobar"});
         foo.getProperty("prop2").setValue(new String[]{"foobar"});
         foo.setProperty("prop3", new String[]{"foo"}); // will not fire prop changed event
-        testRoot.save();
+        testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
         checkPropertyChanged(events, new String[]{"foo/prop1", "foo/prop2"});

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyRemovedTest.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyRemovedTest.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/observation/PropertyRemovedTest.java	Fri Oct  8 05:08:47 2004
@@ -29,12 +29,12 @@
     public void testSinglePropertyRemoved() throws RepositoryException {
         EventResult result = new EventResult(log);
         addEventListener(result, EventType.PROPERTY_REMOVED);
-        Node foo = testRoot.addNode("foo", NT_UNSTRUCTURED);
+        Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.setProperty("prop1", new String[]{"foo"});
         foo.setProperty("prop2", new String[]{"bar"});
-        testRoot.save();
+        testRootNode.save();
         foo.remove("prop1");
-        testRoot.save();
+        testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
         checkPropertyRemoved(events, new String[]{"foo/prop1"});
@@ -43,13 +43,13 @@
     public void testMultiPropertyRemoved() throws RepositoryException {
         EventResult result = new EventResult(log);
         addEventListener(result, EventType.PROPERTY_REMOVED);
-        Node foo = testRoot.addNode("foo", NT_UNSTRUCTURED);
+        Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.setProperty("prop1", new String[]{"foo"});
         foo.setProperty("prop2", new String[]{"bar"});
-        testRoot.save();
+        testRootNode.save();
         foo.remove("prop1");
         foo.remove("prop2");
-        testRoot.save();
+        testRootNode.save();
         removeEventListener(result);
         Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
         checkPropertyRemoved(events, new String[]{"foo/prop1", "foo/prop2"});

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/AbstractQueryTest.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/AbstractQueryTest.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/AbstractQueryTest.java	Fri Oct  8 05:08:47 2004
@@ -15,7 +15,7 @@
  */
 package org.apache.jackrabbit.test.search;
 
-import org.apache.jackrabbit.test.AbstractTest;
+import org.apache.jackrabbit.test.AbstractJCRTest;
 
 import javax.jcr.*;
 import javax.jcr.query.QueryResult;
@@ -23,7 +23,7 @@
 /**
  * Abstract base class for query test cases.
  */
-public class AbstractQueryTest extends AbstractTest {
+public class AbstractQueryTest extends AbstractJCRTest {
 
     /**
      * Checks if the <code>result</code> contains a number of <code>hits</code>.
@@ -36,13 +36,13 @@
     protected void checkResult(QueryResult result, int hits)
             throws RepositoryException {
         int count = 0;
-        log.info("Nodes:");
+        log.println("Nodes:");
         for (NodeIterator nodes = result.getNodes(); nodes.hasNext(); count++) {
             Node n = nodes.nextNode();
-            log.info(" " + n.getPath());
+            log.println(" " + n.getPath());
         }
         if (count == 0) {
-            log.info(" NONE");
+            log.println(" NONE");
         }
         assertEquals("Wrong hit count.", hits, count);
     }
@@ -62,7 +62,7 @@
         checkResult(result, hits);
         // now check property count
         int count = 0;
-        log.info("Properties:");
+        log.println("Properties:");
         for (PropertyIterator it = result.getProperties(); it.hasNext(); count++) {
             StringBuffer msg = new StringBuffer();
             Property p = it.nextProperty();
@@ -79,10 +79,10 @@
                 msg.append(values[i].getString());
                 sep = " | ";
             }
-            log.info(msg);
+            log.println(msg);
         }
         if (count == 0) {
-            log.info("  NONE");
+            log.println("  NONE");
         }
         assertEquals("Wrong property count.", properties, count);
     }

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/FulltextQueryTest.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/FulltextQueryTest.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/FulltextQueryTest.java	Fri Oct  8 05:08:47 2004
@@ -25,97 +25,97 @@
 public class FulltextQueryTest extends AbstractQueryTest {
 
     public void testFulltextSimple() throws Exception {
-        Node foo = testRoot.addNode("foo", NT_UNSTRUCTURED);
+        Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.setProperty("mytext", new String[]{"the quick brown fox jumps over the lazy dog."});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// TEXTSEARCH \"fox\"";
+        String jcrql = "SELECT * FROM * LOCATION " + testRoot + "// TEXTSEARCH \"fox\"";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 1);
     }
 
     public void testFulltextMultiWord() throws Exception {
-        Node n = testRoot.addNode("node1", NT_UNSTRUCTURED);
+        Node n = testRootNode.addNode("node1", NT_UNSTRUCTURED);
         n.setProperty("title", new String[]{"test text"});
         n.setProperty("mytext", new String[]{"the quick brown fox jumps over the lazy dog."});
 
-        n = testRoot.addNode("node2", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node2", NT_UNSTRUCTURED);
         n.setProperty("title", new String[]{"other text"});
         n.setProperty("mytext", new String[]{"the quick brown fox jumps over the lazy dog."});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// TEXTSEARCH \"fox test\"";
+        String jcrql = "SELECT * FROM * LOCATION " + testRoot + "// TEXTSEARCH \"fox test\"";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 1);
     }
 
     public void testFulltextPhrase() throws Exception {
-        Node n = testRoot.addNode("node1", NT_UNSTRUCTURED);
+        Node n = testRootNode.addNode("node1", NT_UNSTRUCTURED);
         n.setProperty("title", new String[]{"test text"});
         n.setProperty("mytext", new String[]{"the quick brown jumps fox over the lazy dog."});
 
-        n = testRoot.addNode("node2", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node2", NT_UNSTRUCTURED);
         n.setProperty("title", new String[]{"other text"});
         n.setProperty("mytext", new String[]{"the quick brown fox jumps over the lazy dog."});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// TEXTSEARCH \"text 'fox jumps'\"";
+        String jcrql = "SELECT * FROM * LOCATION " + testRoot + "// TEXTSEARCH \"text 'fox jumps'\"";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 1);
     }
 
     public void testFulltextExclude() throws Exception {
-        Node n = testRoot.addNode("node1", NT_UNSTRUCTURED);
+        Node n = testRootNode.addNode("node1", NT_UNSTRUCTURED);
         n.setProperty("title", new String[]{"test text"});
         n.setProperty("mytext", new String[]{"the quick brown fox jumps over the lazy dog."});
 
-        n = testRoot.addNode("node2", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node2", NT_UNSTRUCTURED);
         n.setProperty("title", new String[]{"other text"});
         n.setProperty("mytext", new String[]{"the quick brown fox jumps over the lazy dog."});
 
         superuser.getRootNode().save();
 
-        String jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// TEXTSEARCH \"text 'fox jumps' -other\"";
+        String jcrql = "SELECT * FROM * LOCATION " + testRoot + "// TEXTSEARCH \"text 'fox jumps' -other\"";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 1);
     }
 
     public void testFulltextOr() throws Exception {
-        Node n = testRoot.addNode("node1", NT_UNSTRUCTURED);
+        Node n = testRootNode.addNode("node1", NT_UNSTRUCTURED);
         n.setProperty("title", new String[]{"test text"});
         n.setProperty("mytext", new String[]{"the quick brown fox jumps over the lazy dog."});
 
-        n = testRoot.addNode("node2", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node2", NT_UNSTRUCTURED);
         n.setProperty("title", new String[]{"other text"});
         n.setProperty("mytext", new String[]{"the quick brown fox jumps over the lazy dog."});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// TEXTSEARCH \"'fox jumps' test OR other\"";
+        String jcrql = "SELECT * FROM * LOCATION " + testRoot + "// TEXTSEARCH \"'fox jumps' test OR other\"";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 2);
     }
 
     public void testFulltextIntercap() throws Exception {
-        Node n = testRoot.addNode("node1", NT_UNSTRUCTURED);
+        Node n = testRootNode.addNode("node1", NT_UNSTRUCTURED);
         n.setProperty("title", new String[]{"tEst text"});
         n.setProperty("mytext", new String[]{"The quick brown Fox jumps over the lazy dog."});
 
-        n = testRoot.addNode("node2", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node2", NT_UNSTRUCTURED);
         n.setProperty("title", new String[]{"Other text"});
         n.setProperty("mytext", new String[]{"the quick brown FOX jumPs over the lazy dog."});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// TEXTSEARCH \"'fox juMps' Test OR otheR\"";
+        String jcrql = "SELECT * FROM * LOCATION " + testRoot + "// TEXTSEARCH \"'fox juMps' Test OR otheR\"";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 2);

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/SelectClauseTest.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/SelectClauseTest.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/SelectClauseTest.java	Fri Oct  8 05:08:47 2004
@@ -26,21 +26,21 @@
 public class SelectClauseTest extends AbstractQueryTest {
 
     public void testSelect() throws RepositoryException {
-        Node n = testRoot.addNode("node1", NT_UNSTRUCTURED);
+        Node n = testRootNode.addNode("node1", NT_UNSTRUCTURED);
         n.setProperty("myvalue", new String[]{"foo"});
-        n = testRoot.addNode("node2", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node2", NT_UNSTRUCTURED);
         n.setProperty("myvalue", new String[]{"bar"});
-        n = testRoot.addNode("node3", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node3", NT_UNSTRUCTURED);
         n.setProperty("yourvalue", new String[]{"foo"});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT myvalue FROM * LOCATION " + TEST_ROOT + "//";
+        String jcrql = "SELECT myvalue FROM * LOCATION " + testRoot + "//";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 2);
 
-        jcrql = "SELECT myvalue FROM * LOCATION " + TEST_ROOT + "// WHERE yourvalue = \"foo\"";
+        jcrql = "SELECT myvalue FROM * LOCATION " + testRoot + "// WHERE yourvalue = \"foo\"";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 0);
@@ -53,21 +53,21 @@
     }
 
     public void testPropertyCount() throws RepositoryException {
-        Node n = testRoot.addNode("node1", NT_UNSTRUCTURED);
+        Node n = testRootNode.addNode("node1", NT_UNSTRUCTURED);
         n.setProperty("myvalue", new String[]{"foo"});
-        n = testRoot.addNode("node2", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node2", NT_UNSTRUCTURED);
         n.setProperty("myvalue", new String[]{"bar"});
-        n = testRoot.addNode("node3", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node3", NT_UNSTRUCTURED);
         n.setProperty("yourvalue", new String[]{"foo"});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT myvalue FROM * LOCATION " + TEST_ROOT + "//";
+        String jcrql = "SELECT myvalue FROM * LOCATION " + testRoot + "//";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 2, 2);
 
-        jcrql = "SELECT myvalue FROM * LOCATION " + TEST_ROOT + "// WHERE yourvalue = \"foo\"";
+        jcrql = "SELECT myvalue FROM * LOCATION " + testRoot + "// WHERE yourvalue = \"foo\"";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 0, 0);
@@ -77,23 +77,23 @@
         result = q.execute();
         checkResult(result, 2, 2);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE myvalue LIKE \"*\"";
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE myvalue LIKE \"*\"";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 2, 4);
     }
 
     public void testSameNameSibling() throws RepositoryException {
-        Node n = testRoot.addNode("node", NT_UNSTRUCTURED);
+        Node n = testRootNode.addNode("node", NT_UNSTRUCTURED);
         n.setProperty("myvalue", new String[]{"foo"});
-        n = testRoot.addNode("node", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node", NT_UNSTRUCTURED);
         n.setProperty("myvalue", new String[]{"bar"});
-        n = testRoot.addNode("node", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node", NT_UNSTRUCTURED);
         n.setProperty("yourvalue", new String[]{"foo"});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT myvalue FROM * LOCATION " + TEST_ROOT + "/node";
+        String jcrql = "SELECT myvalue FROM * LOCATION " + testRoot + "/node";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 2, 2);

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/SimpleQueryTest.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/SimpleQueryTest.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/search/SimpleQueryTest.java	Fri Oct  8 05:08:47 2004
@@ -27,271 +27,271 @@
 
 
     public void testSimpleQuery1() throws Exception {
-        Node foo = testRoot.addNode("foo", NT_UNSTRUCTURED);
+        Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.setProperty("bla", new String[]{"bla"});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "/foo WHERE bla=\"bla\"";
+        String jcrql = "SELECT * FROM * LOCATION " + testRoot + "/foo WHERE bla=\"bla\"";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 1);
     }
 
     public void testSimpleQuery2() throws Exception {
-        Node foo = testRoot.addNode("foo", NT_UNSTRUCTURED);
+        Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.setProperty("bla", new String[]{"bla"});
         Node bla = superuser.getRootNode().addNode("bla", NT_UNSTRUCTURED);
         bla.setProperty("bla", new String[]{"bla"});
 
         superuser.getRootNode().save();
 
-        String jcrql = "SELECT * FROM nt:bla LOCATION " + TEST_ROOT + "// WHERE bla=\"bla\"";
+        String jcrql = "SELECT * FROM nt:file LOCATION " + testRoot + "// WHERE bla=\"bla\"";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 0);
     }
 
     public void testSimpleQuery3() throws Exception {
-        Node foo = testRoot.addNode("foo", NT_UNSTRUCTURED);
+        Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.setProperty("bla", new String[]{"bla"});
-        Node bla = testRoot.addNode("bla", NT_UNSTRUCTURED);
+        Node bla = testRootNode.addNode("bla", NT_UNSTRUCTURED);
         bla.setProperty("bla", new String[]{"bla"});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT * FROM nt:unstructured LOCATION " + TEST_ROOT + "// WHERE bla=\"bla\"";
+        String jcrql = "SELECT * FROM nt:unstructured LOCATION " + testRoot + "// WHERE bla=\"bla\"";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 2);
     }
 
     public void testSimpleQuery4() throws Exception {
-        Node foo = testRoot.addNode("foo", NT_UNSTRUCTURED);
+        Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
         foo.setProperty("bla", new String[]{"bla"});
-        Node bla = testRoot.addNode("bla", NT_UNSTRUCTURED);
+        Node bla = testRootNode.addNode("bla", NT_UNSTRUCTURED);
         bla.setProperty("bla", new String[]{"bla"});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT * FROM nt:unstructured LOCATION " + TEST_ROOT + "/*";
+        String jcrql = "SELECT * FROM nt:unstructured LOCATION " + testRoot + "/*";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 2);
     }
 
     public void testDateField1() throws Exception {
-        Node n = testRoot.addNode("marcel", NT_UNSTRUCTURED);
+        Node n = testRootNode.addNode("marcel", NT_UNSTRUCTURED);
         Calendar marcel = Calendar.getInstance();
         marcel.set(1976, 4, 20, 15, 40);
         n.setProperty("birth", new Value[]{new DateValue(marcel)});
 
-        n = testRoot.addNode("vanessa", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("vanessa", NT_UNSTRUCTURED);
         Calendar vanessa = Calendar.getInstance();
         vanessa.set(1975, 4, 10, 13, 30);
         n.setProperty("birth", new Value[]{new DateValue(vanessa)});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE birth > 1976-01-01T00:00:00.000+01:00";
+        String jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE birth > 1976-01-01T00:00:00.000+01:00";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 1);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE birth > 1975-01-01T00:00:00.000+01:00";
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE birth > 1975-01-01T00:00:00.000+01:00";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 2);
     }
 
     public void testDoubleField() throws Exception {
-        Node n = testRoot.addNode("node1", NT_UNSTRUCTURED);
+        Node n = testRootNode.addNode("node1", NT_UNSTRUCTURED);
         n.setProperty("value", new Value[]{new DoubleValue(1.9928375d)});
-        n = testRoot.addNode("node2", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node2", NT_UNSTRUCTURED);
         n.setProperty("value", new Value[]{new DoubleValue(0.0d)});
-        n = testRoot.addNode("node3", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node3", NT_UNSTRUCTURED);
         n.setProperty("value", new Value[]{new DoubleValue(-1.42982475d)});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value > 0.1e-0";
+        String jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value > 0.1e-0";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 1);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value > -0.1";
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value > -0.1";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 2);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value > -1.5";
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value > -1.5";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 3);
     }
 
     public void testLongField() throws Exception {
-        Node n = testRoot.addNode("node1", NT_UNSTRUCTURED);
+        Node n = testRootNode.addNode("node1", NT_UNSTRUCTURED);
         n.setProperty("value", new Value[]{new LongValue(1)});
-        n = testRoot.addNode("node2", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node2", NT_UNSTRUCTURED);
         n.setProperty("value", new Value[]{new LongValue(0)});
-        n = testRoot.addNode("node3", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node3", NT_UNSTRUCTURED);
         n.setProperty("value", new Value[]{new LongValue(-1)});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value > 0";
+        String jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value > 0";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 1);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value > -1";
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value > -1";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 2);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value > -2";
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value > -2";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 3);
     }
 
     public void testLikePattern() throws Exception {
-        Node n = testRoot.addNode("node1", NT_UNSTRUCTURED);
+        Node n = testRootNode.addNode("node1", NT_UNSTRUCTURED);
         n.setProperty("value", new String[]{"king"});
-        n = testRoot.addNode("node2", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node2", NT_UNSTRUCTURED);
         n.setProperty("value", new String[]{"ping"});
-        n = testRoot.addNode("node3", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node3", NT_UNSTRUCTURED);
         n.setProperty("value", new String[]{"ching"});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"ping\"";
+        String jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"ping\"";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 1);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"?ing\"";
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"?ing\"";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 2);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"*ing\"";
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"*ing\"";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 3);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"_ing\"";
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"_ing\"";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 2);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"%ing\"";
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"%ing\"";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 3);
     }
 
     public void testLikePatternBetween() throws Exception {
-        Node n = testRoot.addNode("node1", NT_UNSTRUCTURED);
+        Node n = testRootNode.addNode("node1", NT_UNSTRUCTURED);
         n.setProperty("value", new String[]{"ping"});
-        n = testRoot.addNode("node2", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node2", NT_UNSTRUCTURED);
         n.setProperty("value", new String[]{"pong"});
-        n = testRoot.addNode("node3", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node3", NT_UNSTRUCTURED);
         n.setProperty("value", new String[]{"puung"});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"ping\"";
+        String jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"ping\"";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 1);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"p?ng\"";
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"p?ng\"";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 2);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"p*ng\"";
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"p*ng\"";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 3);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"p_ng\"";
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"p_ng\"";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 2);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"p%ng\"";
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"p%ng\"";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 3);
     }
 
     public void testLikePatternEnd() throws Exception {
-        Node n = testRoot.addNode("node1", NT_UNSTRUCTURED);
+        Node n = testRootNode.addNode("node1", NT_UNSTRUCTURED);
         n.setProperty("value", new String[]{"bli"});
-        n = testRoot.addNode("node2", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node2", NT_UNSTRUCTURED);
         n.setProperty("value", new String[]{"bla"});
-        n = testRoot.addNode("node3", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node3", NT_UNSTRUCTURED);
         n.setProperty("value", new String[]{"blub"});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"bli\"";
+        String jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"bli\"";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 1);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"bl?\"";
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"bl?\"";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 2);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"bl*\"";
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"bl*\"";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 3);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"bl_\"";
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"bl_\"";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 2);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"bl%\"";
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"bl%\"";
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 3);
     }
 
     public void testLikePatternEscaped() throws Exception {
-        Node n = testRoot.addNode("node1", NT_UNSTRUCTURED);
+        Node n = testRootNode.addNode("node1", NT_UNSTRUCTURED);
         n.setProperty("value", new String[]{"foo\\?bar"});
-        n = testRoot.addNode("node2", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node2", NT_UNSTRUCTURED);
         n.setProperty("value", new String[]{"foobar"});
-        n = testRoot.addNode("node3", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node3", NT_UNSTRUCTURED);
         n.setProperty("value", new String[]{"foo?bar"});
-        n = testRoot.addNode("node4", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node4", NT_UNSTRUCTURED);
         n.setProperty("value", new String[]{"foolbar"});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"foo\\?bar\""; // matches node3
+        String jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"foo\\?bar\""; // matches node3
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 1);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"foo?bar\"";    // matches node3 and node4
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"foo?bar\"";    // matches node3 and node4
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 2);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"foo*bar\"";  // matches all nodes
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"foo*bar\"";  // matches all nodes
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 4);
 
-        jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value LIKE \"foo\\\\\\?bar\"";  // matches node1
+        jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value LIKE \"foo\\\\\\?bar\"";  // matches node1
         q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         result = q.execute();
         checkResult(result, 1);
@@ -299,16 +299,16 @@
     }
 
     public void testNotEqual() throws Exception {
-        Node n = testRoot.addNode("node1", NT_UNSTRUCTURED);
+        Node n = testRootNode.addNode("node1", NT_UNSTRUCTURED);
         n.setProperty("value", new String[]{"foo"});
-        n = testRoot.addNode("node2", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node2", NT_UNSTRUCTURED);
         n.setProperty("value", new String[]{"bar"});
-        n = testRoot.addNode("node3", NT_UNSTRUCTURED);
+        n = testRootNode.addNode("node3", NT_UNSTRUCTURED);
         n.setProperty("value", new String[]{"foobar"});
 
-        testRoot.save();
+        testRootNode.save();
 
-        String jcrql = "SELECT * FROM * LOCATION " + TEST_ROOT + "// WHERE value <> \"bar\"";
+        String jcrql = "SELECT * FROM * LOCATION " + testRoot + "// WHERE value <> \"bar\"";
         Query q = superuser.getWorkspace().getQueryManager().createQuery(jcrql, Query.JCRQL);
         QueryResult result = q.execute();
         checkResult(result, 2);