Property changes on: . ___________________________________________________________________ Name: svn:ignore + .settings target .classpath .project Index: pom.xml =================================================================== --- pom.xml (revision 0) +++ pom.xml (revision 0) @@ -0,0 +1,71 @@ + + + + + + 4.0.0 + + + + + + org.apache.jackrabbit + jackrabbit + 1.5-SNAPSHOT + + jackrabbit-jcr-benchmarks + Jackrabbit JCR Benchmarks + JCR Benchmarks + + + + scm:svn:http://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-jcr-benchmark + + + scm:svn:https://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-jcr-benchmark + + http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-benchmark + + + + + javax.jcr + jcr + + + junit + junit + + + org.slf4j + slf4j-api + + + concurrent + concurrent + + + org.apache.jackrabbit + jackrabbit-jcr-tests + + + + Property changes on: pom.xml ___________________________________________________________________ Name: svn:eol-style + native Index: pom.xml =================================================================== --- pom.xml (revision 0) +++ pom.xml (revision 0) @@ -0,0 +1,71 @@ + + + + + + 4.0.0 + + + + + + org.apache.jackrabbit + jackrabbit + 1.5-SNAPSHOT + + jackrabbit-jcr-benchmarks + Jackrabbit JCR Benchmarks + JCR Benchmarks + + + + scm:svn:http://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-jcr-benchmark + + + scm:svn:https://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-jcr-benchmark + + http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-benchmark + + + + + javax.jcr + jcr + + + junit + junit + + + org.slf4j + slf4j-api + + + concurrent + concurrent + + + org.apache.jackrabbit + jackrabbit-jcr-tests + + + + Property changes on: pom.xml ___________________________________________________________________ Name: svn:eol-style + native Index: src/main/java/org/apache/jackrabbit/benchmark/BenchmarkSuite.java =================================================================== --- src/main/java/org/apache/jackrabbit/benchmark/BenchmarkSuite.java (revision 0) +++ src/main/java/org/apache/jackrabbit/benchmark/BenchmarkSuite.java (revision 0) @@ -0,0 +1,28 @@ +/* + * 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 junit.framework.TestSuite; + +public class BenchmarkSuite extends TestSuite { + + public BenchmarkSuite() { + super("JCR Benchmarks"); + addTest(TestAll.suite()); + } +} Property changes on: src\main\java\org\apache\jackrabbit\benchmark\BenchmarkSuite.java ___________________________________________________________________ Name: svn:eol-style + native Index: src/main/java/org/apache/jackrabbit/benchmark/TestAll.java =================================================================== --- src/main/java/org/apache/jackrabbit/benchmark/TestAll.java (revision 0) +++ src/main/java/org/apache/jackrabbit/benchmark/TestAll.java (revision 0) @@ -0,0 +1,42 @@ +/* + * 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 junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Test suite covering various performance aspects. + */ +public class TestAll extends TestCase { + + /** + * Returns a Test suite that executes all tests inside this + * package. + * + * @return a Test suite that executes all tests inside this + * package. + */ + public static Test suite() { + TestSuite suite = new TestSuite("performance tests"); + + suite.addTestSuite(BigCollectionTest.class); + + return suite; + } +} Property changes on: src\main\java\org\apache\jackrabbit\benchmark\TestAll.java ___________________________________________________________________ Name: svn:eol-style + native Index: src/main/java/org/apache/jackrabbit/benchmark/BigCollectionTest.java =================================================================== --- src/main/java/org/apache/jackrabbit/benchmark/BigCollectionTest.java (revision 0) +++ src/main/java/org/apache/jackrabbit/benchmark/BigCollectionTest.java (revision 0) @@ -0,0 +1,139 @@ +/* + * 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 java.io.BufferedInputStream; +import java.io.InputStream; + +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; + +public class BigCollectionTest extends AbstractJCRTest { + + 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(); + } + + public void testBrowse() 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 = child.getNode("jcr:content"); + String type = content.getProperty("jcr:mimeType").getString(); + long length = content.getProperty("jcr:data").getLength(); + assertTrue(child.isNode()); + assertEquals(MIMETYPE, type); + assertEquals(MEMBERSIZE, length); + members += 1; + } + assertEquals(MEMBERS, members); + session.refresh(false); + cnt += 1; + } + + long elapsed = System.currentTimeMillis() - start; + + LOG.info("testBrowse: " + (double)elapsed / cnt + "ms per call (" + cnt + " iterations)"); + } + + 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; + } + } + } + +} Property changes on: src\main\java\org\apache\jackrabbit\benchmark\BigCollectionTest.java ___________________________________________________________________ Name: svn:eol-style + native Index: src/main/java/org/apache/jackrabbit/benchmark/BenchmarkSuite.java =================================================================== --- src/main/java/org/apache/jackrabbit/benchmark/BenchmarkSuite.java (revision 0) +++ src/main/java/org/apache/jackrabbit/benchmark/BenchmarkSuite.java (revision 0) @@ -0,0 +1,28 @@ +/* + * 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 junit.framework.TestSuite; + +public class BenchmarkSuite extends TestSuite { + + public BenchmarkSuite() { + super("JCR Benchmarks"); + addTest(TestAll.suite()); + } +} Property changes on: src\main\java\org\apache\jackrabbit\benchmark\BenchmarkSuite.java ___________________________________________________________________ Name: svn:eol-style + native Index: src/main/java/org/apache/jackrabbit/benchmark/BigCollectionTest.java =================================================================== --- src/main/java/org/apache/jackrabbit/benchmark/BigCollectionTest.java (revision 0) +++ src/main/java/org/apache/jackrabbit/benchmark/BigCollectionTest.java (revision 0) @@ -0,0 +1,139 @@ +/* + * 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 java.io.BufferedInputStream; +import java.io.InputStream; + +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; + +public class BigCollectionTest extends AbstractJCRTest { + + 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(); + } + + public void testBrowse() 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 = child.getNode("jcr:content"); + String type = content.getProperty("jcr:mimeType").getString(); + long length = content.getProperty("jcr:data").getLength(); + assertTrue(child.isNode()); + assertEquals(MIMETYPE, type); + assertEquals(MEMBERSIZE, length); + members += 1; + } + assertEquals(MEMBERS, members); + session.refresh(false); + cnt += 1; + } + + long elapsed = System.currentTimeMillis() - start; + + LOG.info("testBrowse: " + (double)elapsed / cnt + "ms per call (" + cnt + " iterations)"); + } + + 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; + } + } + } + +} Property changes on: src\main\java\org\apache\jackrabbit\benchmark\BigCollectionTest.java ___________________________________________________________________ Name: svn:eol-style + native Index: src/main/java/org/apache/jackrabbit/benchmark/TestAll.java =================================================================== --- src/main/java/org/apache/jackrabbit/benchmark/TestAll.java (revision 0) +++ src/main/java/org/apache/jackrabbit/benchmark/TestAll.java (revision 0) @@ -0,0 +1,42 @@ +/* + * 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 junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Test suite covering various performance aspects. + */ +public class TestAll extends TestCase { + + /** + * Returns a Test suite that executes all tests inside this + * package. + * + * @return a Test suite that executes all tests inside this + * package. + */ + public static Test suite() { + TestSuite suite = new TestSuite("performance tests"); + + suite.addTestSuite(BigCollectionTest.class); + + return suite; + } +} Property changes on: src\main\java\org\apache\jackrabbit\benchmark\TestAll.java ___________________________________________________________________ Name: svn:eol-style + native