/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  The ASF licenses this file to You
 * 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.jcr2spi.query;

import org.apache.jackrabbit.test.api.query.AbstractQueryTest;

import javax.jcr.RepositoryException;
import javax.jcr.NodeIterator;
import javax.jcr.Node;
import javax.jcr.NamespaceRegistry;
import java.util.List;
import java.util.ArrayList;

/**
 * <code>QueryTest</code> performs various query tests.
 */
public class QueryTest extends AbstractQueryTest {

    /**
     * Queries the child nodes of the root node.
     */
    public void testQueryChildNodesOfRoot() throws RepositoryException {
        List nodes = new ArrayList();
        for (NodeIterator it = superuser.getRootNode().getNodes(); it.hasNext(); ) {
            nodes.add(it.nextNode());
        }
        Node[] children = (Node[]) nodes.toArray(new Node[nodes.size()]);
        executeXPathQuery(superuser, "/jcr:root/*", children);
    }

    public void testRemappedNamespace() throws RepositoryException {
        String namespaceURI = "http://jackrabbit.apache.org/spi/test";
        String defaultPrefix = "spiTest";

        NamespaceRegistry nsReg = superuser.getWorkspace().getNamespaceRegistry();
        try {
            nsReg.getPrefix(namespaceURI);
        } catch (RepositoryException e) {
            nsReg.registerNamespace(defaultPrefix, namespaceURI);
        }

        Node n = testRootNode.addNode("spiTest:node");
        testRootNode.save();

        long time = System.currentTimeMillis();
        for (int i = 0; i < 10; i++) {
            String prefix = defaultPrefix + i;
            superuser.setNamespacePrefix(prefix, namespaceURI);
            executeXPathQuery(superuser, testPath + "/" + prefix + ":node", new Node[]{n});
        }
        time = System.currentTimeMillis() - time;
        System.out.println("Executed 10 queries in " + time + " ms");
        System.out.println("Time per query: " + (time / 10) + " ms");
    }
}

@@ -2077,56 +2077,8 @@
 );%0A%0A
-        long time = System.currentTimeMillis();%0A
     
@@ -2329,198 +2329,8 @@
   %7D%0A
-        time = System.currentTimeMillis() - time;%0A        System.out.println(%22Executed 10 queries in %22 + time + %22 ms%22);%0A        System.out.println(%22Time per query: %22 + (time / 10) + %22 ms%22);%0A
     

Remove calls to System.out in tests