You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by th...@apache.org on 2013/05/22 11:02:07 UTC
svn commit: r1485124 - in /jackrabbit/oak/trunk/oak-lucene/src:
main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
test/java/org/apache/jackrabbit/oak/jcr/query/MultiSessionQueryTest.java
Author: thomasm
Date: Wed May 22 09:02:06 2013
New Revision: 1485124
URL: http://svn.apache.org/r1485124
Log:
OAK-837 Lucene: colliding concurrency node creation (test case; ignored)
Added:
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/MultiSessionQueryTest.java
Modified:
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
Modified: jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java?rev=1485124&r1=1485123&r2=1485124&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java (original)
+++ jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java Wed May 22 09:02:06 2013
@@ -24,7 +24,7 @@ import org.apache.lucene.store.IOContext
import org.apache.lucene.store.IndexOutput;
/**
- * A red-write implementation of the Lucene {@link Directory} (a flat list of
+ * A read-write implementation of the Lucene {@link Directory} (a flat list of
* files) that allows to store Lucene index content in an Oak repository.
*/
public class ReadWriteOakDirectory extends ReadOnlyOakDirectory {
Added: jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/MultiSessionQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/MultiSessionQueryTest.java?rev=1485124&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/MultiSessionQueryTest.java (added)
+++ jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/MultiSessionQueryTest.java Wed May 22 09:02:06 2013
@@ -0,0 +1,77 @@
+/*
+ * 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.oak.jcr.query;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+
+import org.apache.jackrabbit.core.query.AbstractQueryTest;
+import org.junit.Ignore;
+
+/**
+ * Tests the Lucene index using multiple threads.
+ */
+public class MultiSessionQueryTest extends AbstractQueryTest {
+
+ final static int THREAD_COUNT = 3;
+
+ @Ignore
+ public void testConcurrent() throws Exception {
+ final Exception[] ex = new Exception[1];
+ Thread[] threads = new Thread[THREAD_COUNT];
+ for (int i = 0; i < THREAD_COUNT; i++) {
+ final Session s = superuser.getRepository().login(
+ new SimpleCredentials("admin", "admin".toCharArray()));
+ final String node = "node" + i;
+ Thread t = new Thread() {
+ @Override
+ public void run() {
+ try {
+ doTest(s, node);
+ } catch (Exception e) {
+ ex[0] = e;
+ }
+ }
+ };
+ threads[i] = t;
+ }
+ for (Thread t : threads) {
+ t.start();
+ }
+ Thread.sleep(100);
+ for (Thread t : threads) {
+ t.join();
+ }
+ if (ex[0] != null) {
+ throw ex[0];
+ }
+ }
+
+ void doTest(Session s, String node) throws Exception {
+ Node root = s.getRootNode();
+ if (!root.hasNode(node)) {
+ root.addNode(node);
+ s.save();
+ }
+ for (int i = 0; i < 10; i++) {
+ // Thread.sleep(100);
+ // System.out.println("session " + node + " work");
+ }
+ }
+
+}
Re: svn commit: r1485124 - in /jackrabbit/oak/trunk/oak-lucene/src:
main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
test/java/org/apache/jackrabbit/oak/jcr/query/MultiSessionQueryTest.java
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On Wed, May 22, 2013 at 12:02 PM, <th...@apache.org> wrote:
> + @Ignore
> + public void testConcurrent() throws Exception {
Note that the @Ignore annotation only works for JUnit 4.x tests. The
AbstractQueryTest base class extends TestCase, so it's treated as a
JUnit 3.x test. I changed the ignore mechanism in revision 1485156.
BR,
Jukka Zitting