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 2008/03/19 14:34:29 UTC
svn commit: r638827 - in
/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration:
RandomOperationTest.java daily/ daily/DailyIntegrationTest.java
daily/RandomOperationTest.java
Author: mreutegg
Date: Wed Mar 19 06:34:24 2008
New Revision: 638827
URL: http://svn.apache.org/viewvc?rev=638827&view=rev
Log:
JCR-1485: Introduce daily integration test suite
Added:
jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/
jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/DailyIntegrationTest.java (with props)
jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/RandomOperationTest.java (with props)
Removed:
jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/RandomOperationTest.java
Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/DailyIntegrationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/DailyIntegrationTest.java?rev=638827&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/DailyIntegrationTest.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/DailyIntegrationTest.java Wed Mar 19 06:34:24 2008
@@ -0,0 +1,35 @@
+/*
+ * 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.core.integration.daily;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Contains tests that are run on a daily basis.
+ */
+public class DailyIntegrationTest extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Daily integration tests");
+
+ suite.addTestSuite(RandomOperationTest.class);
+
+ return suite;
+ }
+}
Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/DailyIntegrationTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/RandomOperationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/RandomOperationTest.java?rev=638827&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/RandomOperationTest.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/RandomOperationTest.java Wed Mar 19 06:34:24 2008
@@ -0,0 +1,123 @@
+/*
+ * 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.core.integration.daily;
+
+import org.apache.jackrabbit.core.AbstractConcurrencyTest;
+import org.apache.jackrabbit.core.integration.random.task.VersionOperationsTask;
+import org.apache.jackrabbit.core.integration.random.task.ContentOperationsTask;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * <code>RandomOperationTest</code> executes randomly chosen operations using
+ * multiple threads. Each thread operates on its own subtree to avoid
+ * conflicting changes.
+ */
+public class RandomOperationTest extends AbstractConcurrencyTest {
+
+ /**
+ * Each task is executed with this number of threads.
+ */
+ private static final int NUM_THREADS = 1;
+
+ /**
+ * Tasks are advised to run for this amount of time.
+ */
+ private static final int RUN_NUM_SECONDS = 60;
+
+ /**
+ * Number of seconds to wait at most for the tasks to finish their work.
+ */
+ private static final int MAX_WAIT_SECONDS = 60;
+
+ /**
+ * Number of levels of test data to create per thread
+ */
+ private static final int NUM_LEVELS = 4;
+
+ /**
+ * Number of nodes per level
+ */
+ private static final int NODES_PER_LEVEL = 3;
+
+ /**
+ * While creating nodes, save whenever 1000 nodes have been created.
+ */
+ private static final int SAVE_INTERVAL = 1000;
+
+ private long end;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ end = System.currentTimeMillis() + RUN_NUM_SECONDS * 1000;
+ }
+
+ public void testRandomContentOperations() throws RepositoryException {
+ runTask(new ContentOperationsTask(NUM_LEVELS, NODES_PER_LEVEL, SAVE_INTERVAL, end), NUM_THREADS);
+ }
+
+ public void testRandomContentOperationsXA() throws RepositoryException {
+ ContentOperationsTask task = new ContentOperationsTask(NUM_LEVELS, NODES_PER_LEVEL, SAVE_INTERVAL, end);
+ task.setUseXA(true);
+ runTask(task, NUM_THREADS);
+ }
+
+ public void testRandomVersionOperations() throws RepositoryException {
+ runTask(new VersionOperationsTask(NUM_LEVELS, NODES_PER_LEVEL, SAVE_INTERVAL, end), NUM_THREADS);
+ }
+
+ public void testRandomVersionOperationsXA() throws RepositoryException {
+ VersionOperationsTask task = new VersionOperationsTask(NUM_LEVELS, NODES_PER_LEVEL, SAVE_INTERVAL, end);
+ task.setUseXA(true);
+ runTask(task, NUM_THREADS);
+ }
+
+ public void testContentAndVersionOperations() throws RepositoryException {
+ runTasks(new Task[]{
+ new ContentOperationsTask(NUM_LEVELS, NODES_PER_LEVEL, SAVE_INTERVAL, end),
+ new VersionOperationsTask(NUM_LEVELS, NODES_PER_LEVEL, SAVE_INTERVAL, end)
+ }, NUM_THREADS, end + MAX_WAIT_SECONDS * 1000);
+ }
+
+ public void testContentAndVersionOperationsXA() throws RepositoryException {
+ ContentOperationsTask task1 = new ContentOperationsTask(NUM_LEVELS, NODES_PER_LEVEL, SAVE_INTERVAL, end);
+ task1.setUseXA(true);
+ VersionOperationsTask task2 = new VersionOperationsTask(NUM_LEVELS, NODES_PER_LEVEL, SAVE_INTERVAL, end);
+ task2.setUseXA(true);
+ runTasks(new Task[]{task1, task2}, NUM_THREADS, end + MAX_WAIT_SECONDS * 1000);
+ }
+
+ public void testContentAndVersionOperationsXAMixed() throws RepositoryException {
+ ContentOperationsTask task1 = new ContentOperationsTask(NUM_LEVELS, NODES_PER_LEVEL, SAVE_INTERVAL, end);
+ ContentOperationsTask task2 = new ContentOperationsTask(NUM_LEVELS, NODES_PER_LEVEL, SAVE_INTERVAL, end);
+ task2.setUseXA(true);
+ VersionOperationsTask task3 = new VersionOperationsTask(NUM_LEVELS, NODES_PER_LEVEL, SAVE_INTERVAL, end);
+ VersionOperationsTask task4 = new VersionOperationsTask(NUM_LEVELS, NODES_PER_LEVEL, SAVE_INTERVAL, end);
+ task4.setUseXA(true);
+ runTasks(new Task[]{task1, task2, task3, task4}, NUM_THREADS, end + MAX_WAIT_SECONDS * 1000);
+ }
+
+ public void testContentAndVersionOperationsXAMixedShortSaveInterval() throws RepositoryException {
+ ContentOperationsTask task1 = new ContentOperationsTask(NUM_LEVELS, NODES_PER_LEVEL, 1, end);
+ ContentOperationsTask task2 = new ContentOperationsTask(NUM_LEVELS, NODES_PER_LEVEL, 1, end);
+ task2.setUseXA(true);
+ VersionOperationsTask task3 = new VersionOperationsTask(NUM_LEVELS, NODES_PER_LEVEL, 1, end);
+ VersionOperationsTask task4 = new VersionOperationsTask(NUM_LEVELS, NODES_PER_LEVEL, 1, end);
+ task4.setUseXA(true);
+ runTasks(new Task[]{task1, task2, task3, task4}, NUM_THREADS, end + MAX_WAIT_SECONDS * 1000);
+ }
+}
Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/RandomOperationTest.java
------------------------------------------------------------------------------
svn:eol-style = native