You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by an...@apache.org on 2008/10/15 17:14:45 UTC

svn commit: r704939 - in /jackrabbit/trunk/jackrabbit-jcr-benchmark: ./ src/main/java/org/apache/jackrabbit/benchmark/

Author: angela
Date: Wed Oct 15 08:14:45 2008
New Revision: 704939

URL: http://svn.apache.org/viewvc?rev=704939&view=rev
Log:
JCR-1815: Benchmark: Improve transparency of test results

Added:
    jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/AbstractBenchmarkTest.java   (with props)
    jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/LoginTest.java   (with props)
    jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/RefreshTest.java   (with props)
Modified:
    jackrabbit/trunk/jackrabbit-jcr-benchmark/   (props changed)
    jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BenchmarkSuite.java
    jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BigCollectionTest.java

Propchange: jackrabbit/trunk/jackrabbit-jcr-benchmark/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Oct 15 08:14:45 2008
@@ -2,3 +2,7 @@
 target
 .classpath
 .project
+.*
+*.iml
+*.ipr
+*.iws

Added: jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/AbstractBenchmarkTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/AbstractBenchmarkTest.java?rev=704939&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/AbstractBenchmarkTest.java (added)
+++ jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/AbstractBenchmarkTest.java Wed Oct 15 08:14:45 2008
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.benchmark;
+
+import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import java.io.BufferedInputStream;
+import java.io.InputStream;
+import java.util.Calendar;
+
+/** <code>AbstractBenchmarkTest</code>... */
+abstract class AbstractBenchmarkTest extends AbstractJCRTest {
+
+    private static Logger log = LoggerFactory.getLogger(AbstractBenchmarkTest.class);
+
+    protected static final int MEMBERS = 500;
+    protected static final int MEMBERSIZE = 1024;
+    protected static final String MIMETYPE = "application/octet-stream";
+    protected static final int MINTIME = 1000;
+    protected static final int MINCOUNT = 5;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        Session session = testRootNode.getSession();
+        Node folder = null;
+        try {
+            folder = testRootNode.getNode(getCollectionName());
+        }
+        catch (RepositoryException ex) {
+            // nothing to do
+        }
+
+        // delete when needed
+        if (folder != null) {
+            folder.remove();
+            session.save();
+        }
+
+        folder = testRootNode.addNode(getCollectionName(), "nt:folder");
+        createContent(folder);
+    }
+
+    protected void tearDown() throws Exception {
+        try {
+            Node folder = testRootNode.getNode(getCollectionName());
+            folder.remove();
+            folder.getSession().save();
+        }
+        catch (RepositoryException ex) {
+            // nothing to do
+        }
+        super.tearDown();
+    }
+
+    protected void createContent(Node folder) throws RepositoryException {
+        long cnt = 0;
+        while (cnt < MEMBERS) {
+            InputStream is = new BufferedInputStream(new ContentGenerator(MEMBERSIZE), MEMBERSIZE);
+            Node l_new = folder.addNode("tst" + cnt, "nt:file");
+            Node l_cnew = l_new.addNode("jcr:content", "nt:resource");
+            l_cnew.setProperty("jcr:data", is);
+            l_cnew.setProperty("jcr:mimeType", MIMETYPE);
+            l_cnew.setProperty("jcr:lastModified", Calendar.getInstance());
+            cnt += 1;
+        }
+        folder.getSession().save();
+    }
+
+    protected abstract String getCollectionName();
+
+    /**
+     * Generator for test content of a specific length.
+     */
+    protected static class ContentGenerator extends InputStream {
+
+        private long length;
+        private long position;
+
+        public ContentGenerator(long length) {
+            this.length = length;
+            this.position = 0;
+        }
+
+        public int read() {
+            if (this.position++ < this.length) {
+                return 0;
+            }
+            else {
+                return -1;
+            }
+        }
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/AbstractBenchmarkTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/AbstractBenchmarkTest.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BenchmarkSuite.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BenchmarkSuite.java?rev=704939&r1=704938&r2=704939&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BenchmarkSuite.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BenchmarkSuite.java Wed Oct 15 08:14:45 2008
@@ -24,5 +24,7 @@
     public BenchmarkSuite() {
         super("JCR Benchmarks");
         addTestSuite(BigCollectionTest.class);
+        addTestSuite(RefreshTest.class);
+        addTestSuite(LoginTest.class);
     }
 }

Modified: jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BigCollectionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BigCollectionTest.java?rev=704939&r1=704938&r2=704939&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BigCollectionTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BigCollectionTest.java Wed Oct 15 08:14:45 2008
@@ -14,23 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.jackrabbit.benchmark;
 
-import java.io.BufferedInputStream;
-import java.io.InputStream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
-import java.util.Calendar;
-
-import org.apache.jackrabbit.test.AbstractJCRTest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 /**
  * Several tests for benchmarking the performance when iterating over
  * "big" collections. 
@@ -38,139 +31,162 @@
  * Assumes the store supports nt:folder/nt:file/nt:resource below
  * the test root node.
  */
-public class BigCollectionTest extends AbstractJCRTest {
+public class BigCollectionTest extends AbstractBenchmarkTest {
 
-  private static final Logger LOG = LoggerFactory.getLogger(BigCollectionTest.class);
+    private static final Logger LOG = LoggerFactory.getLogger(BigCollectionTest.class);
 
-  private static int MEMBERS = 500;
-  private static int MEMBERSIZE = 1024;
-  private static String MIMETYPE = "application/octet-stream";
-  private static int MINTIME = 1000;
-  private static int MINCOUNT = 5;
-
-  protected void setUp() throws Exception {
-      super.setUp();
-
-      Session session = testRootNode.getSession();
-      Node folder = null;
-      try {
-          folder = testRootNode.getNode("bigcoll");
-      }
-      catch (RepositoryException ex) {
-        // nothing to do
-      }
-        
-      // delete when needed
-      if (folder != null) {
-          folder.remove();
-          session.save();
-      }
-        
-      folder = testRootNode.addNode("bigcoll", "nt:folder");
-
-      long cnt = 0;
-
-      while (cnt < MEMBERS) {
-          InputStream is = new BufferedInputStream(new ContentGenerator(MEMBERSIZE), MEMBERSIZE);
-          Node l_new = folder.addNode("tst" + cnt, "nt:file");
-          Node l_cnew = l_new.addNode("jcr:content", "nt:resource");
-          l_cnew.setProperty("jcr:data", is);
-          l_cnew.setProperty("jcr:mimeType", MIMETYPE);
-          l_cnew.setProperty("jcr:lastModified", Calendar.getInstance());
-          cnt += 1;
-      }
-      session.save();
-  }
-
-  protected void tearDown() throws Exception {
-      try {
-          Node folder = testRootNode.getNode("bigcoll");
-          folder.remove();
-          folder.getSession().save();
-      }
-      catch (RepositoryException ex) {
-          // nothing to do
-      }
-      super.tearDown();
-  }
-  
-  private void performTest(String testName, boolean getContentNode, boolean getLength) throws RepositoryException {
-      Session session = testRootNode.getSession();
-      
-      long start = System.currentTimeMillis();
-      long cnt = 0;
-  
-      while (System.currentTimeMillis() - start < MINTIME || cnt < MINCOUNT) {
-          Node dir = testRootNode.getNode("bigcoll");
-          int members = 0;
-          for (NodeIterator it = dir.getNodes(); it.hasNext(); ) {
-              Node child = it.nextNode();
-              Node content = getContentNode ? child.getNode("jcr:content") : null;
-              String type = getContentNode ? content.getProperty("jcr:mimeType").getString() : null;
-              long length = getLength ? content.getProperty("jcr:data").getLength() : -1;
-              assertTrue(child.isNode());
-              if (getContentNode) {
-                  assertEquals(MIMETYPE, type);
-              }
-              if (getLength) {
-                  assertEquals(MEMBERSIZE, length);
-              }
-              members += 1;
-          }
-          assertEquals(MEMBERS, members);
-          session.refresh(false);
-          cnt += 1;
-      }
-      
-      long elapsed = System.currentTimeMillis() - start;
-      
-      LOG.info(testName + ": " +  (double)elapsed / cnt + "ms per call (" + cnt + " iterations)");
-  }
-  
-  /**
-   * Get all children, but do not visit jcr:content child nodes
-   */
-  public void testGetChildren() throws RepositoryException {
-      performTest("testGetChildren", false, false);
-  } 
-
-  /**
-   * Get all children and their jcr:content child nodes, but
-   * do not visit jcr:data.
-   */
-  public void testBrowseMinusJcrData() throws RepositoryException {
-      performTest("testBrowseMinusJcrData", true, false);
-  }
-
-  /**
-   * Simulate what a UI usually does on a collection of files:
-   * obtain type and length of the files.
-   */
-  public void testBrowse() throws RepositoryException {
-      performTest("testBrowse", true, true);
-  }
-
-  /**
-   * Generator for test content of a specific length.
-   */
-  private class ContentGenerator extends InputStream {
-
-      private long length;
-      private long position;
-  
-      public ContentGenerator(long length) {
-          this.length = length;
-          this.position = 0;
-      }
-  
-      public int read() {
-          if (this.position++ < this.length) {
-              return 0;
-          }
-          else {
-              return -1;
-          }
-      }
-  }
+    private String bigcollPath;
 
+    protected void setUp() throws Exception {
+        super.setUp();
+        bigcollPath =  testRootNode.getNode(getCollectionName()).getPath();
+    }
+
+    protected String getCollectionName() {
+        return "bigcoll";
+    }
+
+    private void performTest(String testName, boolean getContentNode, boolean getLength) throws RepositoryException {
+        performTest(testName, getContentNode, getLength, false);
+    }
+
+    private void performTest(String testName, boolean getContentNode,
+                             boolean getLength, boolean refresh) throws RepositoryException {
+
+        long start = System.currentTimeMillis();
+        long cnt = 0;
+
+        while (System.currentTimeMillis() - start < MINTIME || cnt < MINCOUNT) {
+            Node dir = testRootNode.getNode(getCollectionName());
+            int members = 0;
+            for (NodeIterator it = dir.getNodes(); it.hasNext(); ) {
+                Node child = it.nextNode();
+                Node content = getContentNode ? child.getNode("jcr:content") : null;
+                String type = getContentNode ? content.getProperty("jcr:mimeType").getString() : null;
+                long length = getLength ? content.getProperty("jcr:data").getLength() : -1;
+                assertTrue(child.isNode());
+                if (getContentNode) {
+                    assertEquals(MIMETYPE, type);
+                }
+                if (getLength) {
+                    assertEquals(MEMBERSIZE, length);
+                }
+                members += 1;
+            }
+            assertEquals(MEMBERS, members);
+            if (refresh) {
+                dir.getSession().refresh(true);
+            }
+            cnt += 1;
+        }
+
+        long elapsed = System.currentTimeMillis() - start;
+
+        LOG.info(testName + ": " +  (double)elapsed / cnt + "ms per call (" + cnt + " iterations)");
+    }
+
+    private void performTestWithNewSession(String testName, boolean getContentNode, boolean getLength) throws RepositoryException {
+
+        long start = System.currentTimeMillis();
+        long cnt = 0;
+
+        while (System.currentTimeMillis() - start < MINTIME || cnt < MINCOUNT) {
+            Session s = helper.getReadOnlySession();
+            try {
+                Node dir = (Node) s.getItem(bigcollPath);
+                int members = 0;
+                for (NodeIterator it = dir.getNodes(); it.hasNext(); ) {
+                    Node child = it.nextNode();
+                    Node content = getContentNode ? child.getNode("jcr:content") : null;
+                    String type = getContentNode ? content.getProperty("jcr:mimeType").getString() : null;
+                    long length = getLength ? content.getProperty("jcr:data").getLength() : -1;
+                    assertTrue(child.isNode());
+                    if (getContentNode) {
+                        assertEquals(MIMETYPE, type);
+                    }
+                    if (getLength) {
+                        assertEquals(MEMBERSIZE, length);
+                    }
+                    members += 1;
+                }
+                assertEquals(MEMBERS, members);
+            } finally {
+                s.logout();
+            }
+            cnt += 1;
+        }
+
+        long elapsed = System.currentTimeMillis() - start;
+
+        LOG.info(testName + ": " +  (double)elapsed / cnt + "ms per call (" + cnt + " iterations)");
+    }
+
+    /**
+     * Get all children, but do not visit jcr:content child nodes
+     */
+    public void testGetChildren() throws RepositoryException {
+        performTest("testGetChildren", false, false);
+    }
+
+    /**
+     * Get all children, but do not visit jcr:content child nodes
+     */
+    public void testGetChildrenAfterRefresh() throws RepositoryException {
+        performTest("testGetChildrenAfterRefresh", false, false, true);
+    }
+
+    /**
+     * Get all children, but do not visit jcr:content child nodes
+     */
+    public void testGetChildrenAfterLogin() throws RepositoryException {
+        performTestWithNewSession("testGetChildrenAfterLogin", false, false);
+    }
+
+    /**
+     * Get all children and their jcr:content child nodes, but
+     * do not visit jcr:data.
+     */
+    public void testBrowseMinusJcrData() throws RepositoryException {
+        performTest("testBrowseMinusJcrData", true, false);
+    }
+
+    /**
+     * Get all children and their jcr:content child nodes, but
+     * do not visit jcr:data.
+     */
+    public void testBrowseMinusJcrDataAfterRefresh() throws RepositoryException {
+        performTest("testBrowseMinusJcrDataAfterRefresh", true, false, true);
+    }
+
+    /**
+     * Get all children and their jcr:content child nodes, but
+     * do not visit jcr:data.
+     */
+    public void testBrowseMinusJcrDataAfterLogin() throws RepositoryException {
+        performTestWithNewSession("testBrowseMinusJcrDataAfterLogin", true, false);
+    }
+
+    /**
+     * Simulate what a UI usually does on a collection of files:
+     * obtain type and length of the files.
+     */
+    public void testBrowse() throws RepositoryException {
+        performTest("testBrowse", true, true);
+    }
+
+    /**
+     * Simulate what a UI usually does on a collection of files:
+     * obtain type and length of the files.
+     */
+    public void testBrowseAfterRefresh() throws RepositoryException {
+        performTest("testBrowseAfterRefresh", true, true, true);
+    }
+
+    /**
+     * Simulate what a UI usually does on a collection of files:
+     * obtain type and length of the files.
+     */
+    public void testBrowseAfterLogin() throws RepositoryException {
+        performTestWithNewSession("testBrowseAfterLogin", true, true);
+    }
 }

Added: jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/LoginTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/LoginTest.java?rev=704939&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/LoginTest.java (added)
+++ jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/LoginTest.java Wed Oct 15 08:14:45 2008
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.benchmark;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.jackrabbit.test.AbstractJCRTest;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.Credentials;
+
+/** <code>LoginTest</code>... */
+public class LoginTest extends AbstractJCRTest {
+
+    private static Logger log = LoggerFactory.getLogger(LoginTest.class);
+
+    private static int MINTIME = 500;
+    private static int MINCOUNT = 5;
+
+    private void performTest(String testName, Credentials creds, boolean accessRoot) throws RepositoryException {
+        long start = System.currentTimeMillis();
+        long cnt = 0;
+
+        while (System.currentTimeMillis() - start < MINTIME || cnt < MINCOUNT) {
+            Session s = helper.getRepository().login(creds);
+            try {
+                if (accessRoot) {
+                    s.getRootNode();
+                }
+            } finally {
+                s.logout();
+            }
+            cnt++;
+        }
+
+        long elapsed = System.currentTimeMillis() - start;
+        log.info(testName + ": " +  (double)elapsed / cnt + "ms per call (" + cnt + " iterations)");
+    }
+
+    public void testLoginReadOnly() throws RepositoryException {
+        performTest("testLoginReadOnly", helper.getReadOnlyCredentials(), false);
+    }
+
+    public void testLoginSuperuser() throws RepositoryException {
+        performTest("testLoginSuperuser", helper.getSuperuserCredentials(), false);
+    }
+
+    public void testLoginReadWrite() throws RepositoryException {
+        performTest("testLoginReadWrite", helper.getReadWriteCredentials(), false);
+    }
+
+    public void testLoginAccessRoot() throws RepositoryException {
+        performTest("testLoginAccessRoot", helper.getReadOnlyCredentials(), true);
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/LoginTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/LoginTest.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/RefreshTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/RefreshTest.java?rev=704939&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/RefreshTest.java (added)
+++ jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/RefreshTest.java Wed Oct 15 08:14:45 2008
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.benchmark;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+/**
+ * Several tests for benchmarking the performance when refreshing the complete
+ * tree (containing "big" collections).
+ * <p>
+ * Assumes the store supports nt:folder/nt:file/nt:resource below
+ * the test root node.
+ */
+public class RefreshTest extends AbstractBenchmarkTest {
+
+    private static final Logger log = LoggerFactory.getLogger(RefreshTest.class);
+
+    protected String getCollectionName() {
+        return "folder";
+    }
+
+    private void performTest(String testName, boolean refreshFlag) throws RepositoryException {
+        Session session = testRootNode.getSession();
+        long start = System.currentTimeMillis();
+        long cnt = 0;
+
+        while (System.currentTimeMillis() - start < RefreshTest.MINTIME || cnt < RefreshTest.MINCOUNT) {
+            Node dir = testRootNode.getNode(getCollectionName());
+            NodeIterator it = dir.getNodes();
+            testRootNode.refresh(refreshFlag);
+            cnt += 1;
+        }
+
+        long elapsed = System.currentTimeMillis() - start;
+        log.info(testName + ": " +  (double)elapsed / cnt + "ms per call (" + cnt + " iterations)");
+    }
+
+    /**
+     * Get all children, but do not visit jcr:content child nodes
+     */
+    public void testRefreshFalse() throws RepositoryException {
+        performTest("testRefreshFalse", false);
+    }
+
+    /**
+     * Get all children, but do not visit jcr:content child nodes
+     */
+    public void testRefreshTrue() throws RepositoryException {
+        performTest("testRefreshTrue", true);
+    }
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/RefreshTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/RefreshTest.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url