jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r633471 - in /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core: ./ integration/ query/
Date Tue, 04 Mar 2008 13:31:27 GMT
Author: mreutegg
Date: Tue Mar  4 05:31:23 2008
New Revision: 633471

URL: http://svn.apache.org/viewvc?rev=633471&view=rev
Log:
JCR-1452: Make use of jackrabbit.test.scale in test cases

Added:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/MassiveRangeTest.java
  (with props)
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/MassiveWildcardTest.java
  (with props)
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/MultiThreadingTest.java
  (with props)
Removed:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/MultiThreadingTests.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/MassiveRangeTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/MassiveWildcardTest.java
Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/AbstractConcurrencyTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrencyTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentCheckinMixedTransactionTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentNodeModificationTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentReadWriteTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentSaveTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentVersioningTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentVersioningWithTransactionsTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/LockTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ReadVersionsWhileModified.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ReadWhileSaveTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AbstractQueryTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AxisQueryTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/ConcurrentQueryTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/TestAll.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/TextExtractorTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/UpperLowerCaseQueryTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/AbstractConcurrencyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/AbstractConcurrencyTest.java?rev=633471&r1=633470&r2=633471&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/AbstractConcurrencyTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/AbstractConcurrencyTest.java
Tue Mar  4 05:31:23 2008
@@ -29,6 +29,11 @@
 public abstract class AbstractConcurrencyTest extends AbstractJCRTest {
 
     /**
+     * Execute random queries for this amount of time.
+     */
+    protected static final int RUN_NUM_SECONDS = getTestScale();
+
+    /**
      * Runs a task with the given concurrency and creates an individual test
      * node for each thread.
      *
@@ -51,7 +56,6 @@
             try {
                 threads[i].join();
             } catch (InterruptedException e) {
-                e.printStackTrace();
             }
         }
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrencyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrencyTest.java?rev=633471&r1=633470&r2=633471&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrencyTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrencyTest.java
Tue Mar  4 05:31:23 2008
@@ -28,8 +28,8 @@
 public class ConcurrencyTest extends AbstractJCRTest {
 
     private static final int NUM_ITERATIONS = 2;
-    private static final int NUM_SESSIONS = 100;
-    private static final int NUM_NODES = 100;
+    private static final int NUM_SESSIONS = getTestScale();
+    private static final int NUM_NODES = getTestScale();
 
     final ArrayList exceptions = new ArrayList();
 
@@ -93,7 +93,7 @@
         }
 
         private void randomSleep() {
-            long l = r.nextInt(900) + 200;
+            long l = r.nextInt(90) + 20;
             try {
                 Thread.sleep(l);
             } catch (InterruptedException ie) {

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentCheckinMixedTransactionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentCheckinMixedTransactionTest.java?rev=633471&r1=633470&r2=633471&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentCheckinMixedTransactionTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentCheckinMixedTransactionTest.java
Tue Mar  4 05:31:23 2008
@@ -16,14 +16,20 @@
  */
 package org.apache.jackrabbit.core;
 
+import org.apache.jackrabbit.core.state.StaleItemStateException;
+
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.Node;
+import javax.jcr.InvalidItemStateException;
 import javax.transaction.NotSupportedException;
 import javax.transaction.SystemException;
 import javax.transaction.HeuristicMixedException;
 import javax.transaction.HeuristicRollbackException;
 import javax.transaction.RollbackException;
+import java.util.Collections;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * <code>ConcurrentCheckinMixedTransactionTest</code> performs concurrent
@@ -34,9 +40,8 @@
 
     private static final int NUM_THREADS = 10;
 
-    private static final int RUN_NUM_SECONDS = 20;
-
     public void testCheckInOut() throws RepositoryException {
+        final List exceptions = Collections.synchronizedList(new ArrayList());
         final long end = System.currentTimeMillis() + RUN_NUM_SECONDS * 1000;
         // tasks with even ids run within transactions
         final int[] taskId = new int[1];
@@ -75,13 +80,24 @@
                                 } catch (HeuristicRollbackException e) {
                                     throw new RepositoryException(e);
                                 } catch (RollbackException e) {
-                                    throw new RepositoryException(e);
+                                    Throwable t = e;
+                                    do {
+                                        t = t.getCause();
+                                        if (t instanceof StaleItemStateException) {
+                                            break;
+                                        }
+                                    } while (t != null);
+                                    if (t == null) {
+                                        throw new RepositoryException(e);
+                                    }
+                                } catch (InvalidItemStateException e) {
+                                    // try again
                                 }
                             }
                         }
                     }, NUM_THREADS);
                 } catch (RepositoryException e) {
-                    e.printStackTrace();
+                    exceptions.add(e);
                 }
             }
         });
@@ -90,6 +106,9 @@
             t.join();
         } catch (InterruptedException e) {
             // ignore
+        }
+        if (!exceptions.isEmpty()) {
+            fail(((RepositoryException) exceptions.get(0)).getMessage());
         }
     }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentNodeModificationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentNodeModificationTest.java?rev=633471&r1=633470&r2=633471&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentNodeModificationTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentNodeModificationTest.java
Tue Mar  4 05:31:23 2008
@@ -87,7 +87,7 @@
         }
 
         private void randomSleep() {
-            long l = r.nextInt(900) + 200;
+            long l = r.nextInt(90) + 20;
             try {
                 Thread.sleep(l);
             } catch (InterruptedException ie) {

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentReadWriteTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentReadWriteTest.java?rev=633471&r1=633470&r2=633471&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentReadWriteTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentReadWriteTest.java
Tue Mar  4 05:31:23 2008
@@ -25,6 +25,7 @@
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Random;
+import java.util.Collections;
 
 /**
  * <code>ConcurrentReadWriteTest</code> performs a test with a number of
@@ -36,8 +37,6 @@
 
     private static final int NUM_THREADS = 5;
 
-    private static final int RUN_NUM_SECONDS = 20;
-
     public void testReadWrite() throws RepositoryException {
         final List uuids = new ArrayList();
         for (int i = 0; i < NUM_NODES; i++) {
@@ -45,6 +44,7 @@
             n.addMixin(mixReferenceable);
             uuids.add(n.getUUID());
         }
+        final List exceptions = Collections.synchronizedList(new ArrayList());
         final long[] numReads = new long[]{0};
         testRootNode.save();
         Thread t = new Thread(new Runnable() {
@@ -70,8 +70,6 @@
                                     }
                                 } catch (InvalidItemStateException e) {
                                     // ignore
-                                } catch (RepositoryException e) {
-                                    System.out.println(e);
                                 }
                                 reads++;
                             }
@@ -81,7 +79,7 @@
                         }
                     }, NUM_THREADS, testRoot);
                 } catch (RepositoryException e) {
-                    e.printStackTrace();
+                    exceptions.add(e);
                 }
             }
         });
@@ -99,7 +97,10 @@
             n.save();
             numWrites++;
         }
-        System.out.println("#writes performed: " + numWrites);
-        System.out.println("#reads performed: " + numReads[0]);
+        log.println("#writes performed: " + numWrites);
+        log.println("#reads performed: " + numReads[0]);
+        if (!exceptions.isEmpty()) {
+            fail(((RepositoryException) exceptions.get(0)).getMessage());
+        }
     }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentSaveTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentSaveTest.java?rev=633471&r1=633470&r2=633471&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentSaveTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentSaveTest.java
Tue Mar  4 05:31:23 2008
@@ -36,7 +36,7 @@
     /** logger instance */
     private static final Logger log = LoggerFactory.getLogger(ConcurrentSaveTest.class);
 
-    private final int NUM_NODES = 1000;
+    private final int NUM_NODES = 10 * getTestScale();
     private Session addNodeSession;
     private Session removePropertySession;
 

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentVersioningTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentVersioningTest.java?rev=633471&r1=633470&r2=633471&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentVersioningTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentVersioningTest.java
Tue Mar  4 05:31:23 2008
@@ -39,7 +39,7 @@
      * The total number of operations to execute. E.g. number of checkins
      * performed by the threads.
      */
-    private static final int NUM_OPERATIONS = 200;
+    private static final int NUM_OPERATIONS = 10 * getTestScale();
 
     public void testConcurrentAddVersionable() throws RepositoryException {
         runTask(new Task() {

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentVersioningWithTransactionsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentVersioningWithTransactionsTest.java?rev=633471&r1=633470&r2=633471&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentVersioningWithTransactionsTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentVersioningWithTransactionsTest.java
Tue Mar  4 05:31:23 2008
@@ -37,13 +37,13 @@
     /**
      * The number of threads.
      */
-    private static final int CONCURRENCY = 100;
+    private static final int CONCURRENCY = 10;
 
     /**
      * The total number of operations to execute. E.g. number of checkins
      * performed by the threads.
      */
-    private static final int NUM_OPERATIONS = 100;
+    private static final int NUM_OPERATIONS = 10 * getTestScale();
 
     public void testConcurrentAddVersionableInTransaction()
             throws RepositoryException {

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/LockTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/LockTest.java?rev=633471&r1=633470&r2=633471&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/LockTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/LockTest.java
Tue Mar  4 05:31:23 2008
@@ -33,11 +33,11 @@
  */
 public class LockTest extends AbstractJCRTest {
 
-    private static final int NUM_THREADS = 100;
+    private static final int NUM_THREADS = 10;
 
-    private static final int NUM_CHANGES = 10;
+    private static final int NUM_CHANGES = 10 * getTestScale();
 
-    private static final int NUM_VALUE_GETS = 10;
+    private static final int NUM_VALUE_GETS = 10 * getTestScale();
 
     /**
      * Tests the utility {@link org.apache.jackrabbit.util.Locked} by
@@ -74,7 +74,7 @@
                                         n.addNode(nodeName);
                                     }
                                     n.save();
-                                    System.out.println("Thread" + threadNumber + ": saved
modification");
+                                    log.println("Thread" + threadNumber + ": saved modification");
 
                                     return null;
                                 }
@@ -83,9 +83,9 @@
                             Thread.sleep(new Random().nextInt(100));
                         }
                     } catch (RepositoryException e) {
-                        System.out.println("exception while running code with lock:" + e.getMessage());
+                        log.println("exception while running code with lock:" + e.getMessage());
                     } catch (InterruptedException e) {
-                        System.out.println(Thread.currentThread() + " interrupted while waiting
for lock");
+                        log.println(Thread.currentThread() + " interrupted while waiting
for lock");
                     } finally {
                         s.logout();
                     }
@@ -141,14 +141,14 @@
                                     return new Long(value);
                                 }
                             }.with(n, false)).longValue();
-                            System.out.println("Thread" + threadNumber + ": got sequence
number: " + currentValue);
+                            log.println("Thread" + threadNumber + ": got sequence number:
" + currentValue);
                             // do a random wait
                             Thread.sleep(new Random().nextInt(100));
                         }
                     } catch (RepositoryException e) {
-                        System.out.println("exception while running code with lock:" + e.getMessage());
+                        log.println("exception while running code with lock:" + e.getMessage());
                     } catch (InterruptedException e) {
-                        System.out.println(Thread.currentThread() + " interrupted while waiting
for lock");
+                        log.println(Thread.currentThread() + " interrupted while waiting
for lock");
                     } finally {
                         s.logout();
                     }
@@ -208,18 +208,18 @@
                                 }
                             }.with(n, false, 10 * 1000); // expect a value after ten seconds
                             if (ret == Locked.TIMED_OUT) {
-                                System.out.println("Thread" + threadNumber + ": could not
get a sequence number within 10 seconds");
+                                log.println("Thread" + threadNumber + ": could not get a
sequence number within 10 seconds");
                             } else {
                                 long currentValue = ((Long) ret).longValue();
-                                System.out.println("Thread" + threadNumber + ": got sequence
number: " + currentValue);
+                                log.println("Thread" + threadNumber + ": got sequence number:
" + currentValue);
                             }
                             // do a random wait
                             Thread.sleep(new Random().nextInt(100));
                         }
                     } catch (RepositoryException e) {
-                        System.out.println("exception while running code with lock:" + e.getMessage());
+                        log.println("exception while running code with lock:" + e.getMessage());
                     } catch (InterruptedException e) {
-                        System.out.println(Thread.currentThread() + " interrupted while waiting
for lock");
+                        log.println(Thread.currentThread() + " interrupted while waiting
for lock");
                     } finally {
                         s.logout();
                     }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ReadVersionsWhileModified.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ReadVersionsWhileModified.java?rev=633471&r1=633470&r2=633471&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ReadVersionsWhileModified.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ReadVersionsWhileModified.java
Tue Mar  4 05:31:23 2008
@@ -31,8 +31,6 @@
  */
 public class ReadVersionsWhileModified extends AbstractConcurrencyTest {
 
-    private static final int RUN_NUM_SECONDS = 20;
-
     public void testVersionHistory() throws RepositoryException {
         final Node n = testRootNode.addNode(nodeName1);
         n.addMixin(mixVersionable);
@@ -40,7 +38,7 @@
         final Session s = helper.getSuperuserSession();
         Thread t = new Thread(new Runnable() {
             public void run() {
-                long end = System.currentTimeMillis() + RUN_NUM_SECONDS * 1000;
+                long end = System.currentTimeMillis() + 1000 * getTestScale();
                 try {
                     Node vn = (Node) s.getItem(n.getPath());
                     while (end > System.currentTimeMillis()) {

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ReadWhileSaveTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ReadWhileSaveTest.java?rev=633471&r1=633470&r2=633471&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ReadWhileSaveTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ReadWhileSaveTest.java
Tue Mar  4 05:31:23 2008
@@ -57,7 +57,7 @@
                 // ignore
             }
         }
-        System.out.println("numReads: " + numReads);
+        log.println("numReads: " + numReads);
     }
 
     private Thread runExpensiveSave() throws RepositoryException, IOException {

Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/MassiveRangeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/MassiveRangeTest.java?rev=633471&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/MassiveRangeTest.java
(added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/MassiveRangeTest.java
Tue Mar  4 05:31:23 2008
@@ -0,0 +1,52 @@
+/*
+ * 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;
+
+import org.apache.jackrabbit.core.query.AbstractQueryTest;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Node;
+import javax.jcr.query.QueryManager;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryResult;
+
+/**
+ * Tests if a range query with a lot of results does not throw an error.
+ */
+public class MassiveRangeTest extends AbstractQueryTest {
+
+    /**
+     * Executes a range query covering 2'000 different property values.
+     */
+    public void testRangeQuery() throws RepositoryException {
+        int count = 0;
+        for (int i = 0; i < 20; i++) {
+            Node child = testRootNode.addNode("node" + i);
+            for (int j = 0; j < 100; j++) {
+                Node n = child.addNode("node" + j);
+                n.setProperty("foo", count++);
+            }
+            // save every 100 nodes
+            testRootNode.save();
+        }
+
+        QueryManager qm = superuser.getWorkspace().getQueryManager();
+        String stmt = testPath + "//*[@foo >= 0]";
+        QueryResult res = qm.createQuery(stmt, Query.XPATH).execute();
+        checkResult(res, 2000);
+    }
+}

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/MassiveRangeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/MassiveWildcardTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/MassiveWildcardTest.java?rev=633471&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/MassiveWildcardTest.java
(added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/MassiveWildcardTest.java
Tue Mar  4 05:31:23 2008
@@ -0,0 +1,57 @@
+/*
+ * 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;
+
+import org.apache.jackrabbit.core.query.AbstractQueryTest;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Node;
+import javax.jcr.query.QueryManager;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryResult;
+
+/**
+ * Tests if a wildcard query with a lot of results does not throw an error.
+ */
+public class MassiveWildcardTest extends AbstractQueryTest {
+
+    /**
+     * Executes a wildcard query covering 2'000 different property values.
+     */
+    public void testWildcardQuery() throws RepositoryException {
+        int count = 0;
+        for (int i = 0; i < 20; i++) {
+            Node child = testRootNode.addNode("node" + i);
+            for (int j = 0; j < 100; j++) {
+                Node n = child.addNode("node" + j);
+                n.setProperty("foo", "" + count + "foo");
+                n.setProperty("bar", "bar" + count++);
+            }
+            // save every 100 nodes
+            testRootNode.save();
+        }
+
+        QueryManager qm = superuser.getWorkspace().getQueryManager();
+        String stmt = testPath + "//*[jcr:contains(., '*foo')]";
+        QueryResult res = qm.createQuery(stmt, Query.XPATH).execute();
+        checkResult(res, 2000);
+
+        stmt = testPath + "//*[jcr:contains(., 'bar*')]";
+        res = qm.createQuery(stmt, Query.XPATH).execute();
+        checkResult(res, 2000);
+    }
+}

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/MassiveWildcardTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/MultiThreadingTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/MultiThreadingTest.java?rev=633471&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/MultiThreadingTest.java
(added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/MultiThreadingTest.java
Tue Mar  4 05:31:23 2008
@@ -0,0 +1,55 @@
+/*
+ * 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;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.framework.Test;
+import org.apache.jackrabbit.core.ConcurrencyTest;
+import org.apache.jackrabbit.core.ConcurrentLoginTest;
+import org.apache.jackrabbit.core.ConcurrentNodeModificationTest;
+import org.apache.jackrabbit.core.ConcurrentReadWriteTest;
+import org.apache.jackrabbit.core.ConcurrentSaveTest;
+import org.apache.jackrabbit.core.ConcurrentVersioningTest;
+import org.apache.jackrabbit.core.ConcurrentVersioningWithTransactionsTest;
+import org.apache.jackrabbit.core.ConcurrentCheckinMixedTransactionTest;
+import org.apache.jackrabbit.core.LockTest;
+import org.apache.jackrabbit.core.ReadVersionsWhileModified;
+
+/**
+ * <code>MultiThreadingTest</code> is a test suite that includes all
+ * multi-threading related tests.
+ */
+public class MultiThreadingTest extends TestCase {
+
+    public static Test suite() {
+        TestSuite suite = new TestSuite("Multi-threading tests");
+
+        suite.addTestSuite(ConcurrencyTest.class);
+        suite.addTestSuite(ConcurrentLoginTest.class);
+        //suite.addTestSuite(ConcurrentNodeModificationTest.class);
+        suite.addTestSuite(ConcurrentReadWriteTest.class);
+        suite.addTestSuite(ConcurrentSaveTest.class);
+        suite.addTestSuite(ConcurrentVersioningTest.class);
+        suite.addTestSuite(ConcurrentVersioningWithTransactionsTest.class);
+        suite.addTestSuite(ConcurrentCheckinMixedTransactionTest.class);
+        suite.addTestSuite(LockTest.class);
+        suite.addTestSuite(ReadVersionsWhileModified.class);
+
+        return suite;
+    }
+}

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/MultiThreadingTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AbstractQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AbstractQueryTest.java?rev=633471&r1=633470&r2=633471&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AbstractQueryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AbstractQueryTest.java
Tue Mar  4 05:31:23 2008
@@ -37,6 +37,11 @@
  */
 public class AbstractQueryTest extends AbstractJCRTest {
 
+    /**
+     * Execute random queries for this amount of time.
+     */
+    protected static final int RUN_NUM_SECONDS = getTestScale();
+
     protected QueryManager qm;
 
     protected void setUp() throws Exception {

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AxisQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AxisQueryTest.java?rev=633471&r1=633470&r2=633471&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AxisQueryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AxisQueryTest.java
Tue Mar  4 05:31:23 2008
@@ -43,11 +43,6 @@
     private static final int NODES_PER_LEVEL = 3;
 
     /**
-     * Execute random queries for this amount of time.
-     */
-    private static final int RUN_NUM_SECONDS = 10;
-
-    /**
      * Controls if query results are checked for their correctness. When the
      * number of test nodes increases this becomes expensive and should be
      * disabled.

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/ConcurrentQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/ConcurrentQueryTest.java?rev=633471&r1=633470&r2=633471&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/ConcurrentQueryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/ConcurrentQueryTest.java
Tue Mar  4 05:31:23 2008
@@ -67,13 +67,14 @@
     }
 
     /**
-     * Writes 1000 nodes in transactions of 5 nodes to the workspace while
-     * other threads query the workspace. Query results must always return
-     * a consistent view of the workspace, that is:<br/>
+     * Writes 100 * {@link #getTestScale()} nodes in transactions of 5 nodes to
+     * the workspace while other threads query the workspace. Query results must
+     * always return a consistent view of the workspace, that is:<br/>
      * <code>result.numNodes % 5 == 0</code>
      */
     public void testConcurrentQueryWithWrite() throws Exception {
 
+        final int testScale = getTestScale();
         final List exceptions = Collections.synchronizedList(new ArrayList());
         List readers = new ArrayList();
         String query = "/jcr:root" + testRoot + "//*[@testprop = 'foo']";
@@ -87,7 +88,7 @@
                 try {
                     for (int i = 0; i < 20; i++) {
                         Node n = testRootNode.addNode("node" + i);
-                        for (int j = 0; j < 10; j++) {
+                        for (int j = 0; j < testScale; j++) {
                             Node n1 = n.addNode("node" + j);
                             for (int k = 0; k < 5; k++) {
                                 n1.addNode("node" + k).setProperty("testprop", "foo");
@@ -124,17 +125,17 @@
     }
 
     /**
-     * Deletes 1000 nodes in transactions of 5 nodes while
-     * other threads query the workspace. Query results must always return
+     * Deletes 100 * {@link #getTestScale()} nodes in transactions of 5 nodes
+     * while other threads query the workspace. Query results must always return
      * a consistent view of the workspace, that is:<br/>
      * <code>result.numNodes % 5 == 0</code>
      */
     public void testConcurrentQueryWithDeletes() throws Exception {
-
-        // create 1000 nodes
+        final int testScale = getTestScale();
+        // create 100 * getTestScale() nodes
         for (int i = 0; i < 20; i++) {
             Node n = testRootNode.addNode("node" + i);
-            for (int j = 0; j < 10; j++) {
+            for (int j = 0; j < testScale; j++) {
                 Node n1 = n.addNode("node" + j);
                 for (int k = 0; k < 5; k++) {
                     n1.addNode("node" + k).setProperty("testprop", "foo");
@@ -156,7 +157,7 @@
                 try {
                     for (int i = 0; i < 20; i++) {
                         Node n = testRootNode.getNode("node" + i);
-                        for (int j = 0; j < 10; j++) {
+                        for (int j = 0; j < testScale; j++) {
                             Node n1 = n.getNode("node" + j);
                             for (int k = 0; k < 5; k++) {
                                 n1.getNode("node" + k).remove();
@@ -187,7 +188,7 @@
         }
 
         // fail in case of exceptions
-        if (exceptions.size() > 0) {
+        if (!exceptions.isEmpty()) {
             fail(exceptions.get(0).toString());
         }
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/TestAll.java?rev=633471&r1=633470&r2=633471&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/TestAll.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/TestAll.java
Tue Mar  4 05:31:23 2008
@@ -57,11 +57,7 @@
         suite.addTestSuite(ExcerptTest.class);
         suite.addTestSuite(IndexingAggregateTest.class);
         suite.addTestSuite(AxisQueryTest.class);
-
-        // exclude long running tests per default
-        //suite.addTestSuite(MassiveRangeTest.class);
-        //suite.addTestSuite(ConcurrentQueryTest.class);
-        //suite.addTestSuite(MassiveWildcardTest.class);
+        suite.addTestSuite(ConcurrentQueryTest.class);
 
         return suite;
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/TextExtractorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/TextExtractorTest.java?rev=633471&r1=633470&r2=633471&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/TextExtractorTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/TextExtractorTest.java
Tue Mar  4 05:31:23 2008
@@ -45,7 +45,7 @@
                 testRootNode.addNode(sourceFolder.getName(), "nt:folder"));
         superuser.save();
         time = System.currentTimeMillis() - time;
-        System.out.println("Imported " + fileCount + " files in " + time + " ms.");
+        log.println("Imported " + fileCount + " files in " + time + " ms.");
     }
 
     /**
@@ -57,11 +57,11 @@
             File f = new File(folder, names[i]);
             if (f.canRead()) {
                 if (f.isDirectory()) {
-                    System.out.println("Added folder: " + f.getAbsolutePath());
+                    log.println("Added folder: " + f.getAbsolutePath());
                     addContents(f, n.addNode(names[i], "nt:folder"));
                 } else {
                     addFile(n, f);
-                    System.out.println("Added file: " + f.getAbsolutePath());
+                    log.println("Added file: " + f.getAbsolutePath());
                     // save after 100 files
                     if (++fileCount % 100 == 0) {
                         n.getSession().save();
@@ -91,7 +91,7 @@
             } finally {
                 in.close();
             }
-            System.out.println("updating resource...");
+            log.println("updating resource...");
             superuser.save();
         }
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/UpperLowerCaseQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/UpperLowerCaseQueryTest.java?rev=633471&r1=633470&r2=633471&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/UpperLowerCaseQueryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/UpperLowerCaseQueryTest.java
Tue Mar  4 05:31:23 2008
@@ -146,7 +146,8 @@
     public void testLikeComparisonRandom() throws RepositoryException {
         String abcd = "abcd";
         Random random = new Random();
-        for (int i = 0; i < 50; i++) {
+        long end = System.currentTimeMillis() + 1000 * RUN_NUM_SECONDS;
+        while (end > System.currentTimeMillis()) {
             String pattern = "";
             pattern += getRandomChar(abcd, random);
             pattern += getRandomChar(abcd, random);
@@ -236,8 +237,7 @@
             }
             logMsg.append(values[i]);
         }
-        log.write(logMsg.toString());
-        log.flush();
+        log.println(logMsg.toString());
         for (NodeIterator it = testRootNode.getNodes(); it.hasNext();) {
             it.nextNode().remove();
         }



Mime
View raw message