Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 95736 invoked from network); 26 Jun 2007 07:59:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Jun 2007 07:59:22 -0000 Received: (qmail 2421 invoked by uid 500); 26 Jun 2007 07:59:25 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 2337 invoked by uid 500); 26 Jun 2007 07:59:25 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 2328 invoked by uid 99); 26 Jun 2007 07:59:25 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jun 2007 00:59:25 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jun 2007 00:59:21 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 21BD81A981A; Tue, 26 Jun 2007 00:59:01 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r550724 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ReadVersionsWhileModified.java Date: Tue, 26 Jun 2007 07:59:01 -0000 To: commits@jackrabbit.apache.org From: mreutegg@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070626075901.21BD81A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mreutegg Date: Tue Jun 26 00:59:00 2007 New Revision: 550724 URL: http://svn.apache.org/viewvc?view=rev&rev=550724 Log: JCR-18: Multithreading issue with versioning - test case Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ReadVersionsWhileModified.java (with props) Added: 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?view=auto&rev=550724 ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ReadVersionsWhileModified.java (added) +++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ReadVersionsWhileModified.java Tue Jun 26 00:59:00 2007 @@ -0,0 +1,67 @@ +/* + * 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; + +import javax.jcr.RepositoryException; +import javax.jcr.Session; +import javax.jcr.Node; +import javax.jcr.version.VersionHistory; +import javax.jcr.version.Version; + +/** + * ReadVersionsWhileModified tests if version history can be read + * consistently while it is modified by another thread. + *

+ * This is a test case for: + * JCR-18 + */ +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); + testRootNode.save(); + final Session s = helper.getSuperuserSession(); + Thread t = new Thread(new Runnable() { + public void run() { + long end = System.currentTimeMillis() + RUN_NUM_SECONDS * 1000; + try { + Node vn = (Node) s.getItem(n.getPath()); + while (end > System.currentTimeMillis()) { + vn.checkout(); + vn.checkin(); + } + } catch (RepositoryException e) { + e.printStackTrace(); + } finally { + s.logout(); + } + } + }); + t.start(); + VersionHistory vh = n.getVersionHistory(); + while (t.isAlive()) { + // walk version history + Version v = vh.getRootVersion(); + while (v.getSuccessors().length > 0) { + v = v.getSuccessors()[0]; + } + } + } +} Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ReadVersionsWhileModified.java ------------------------------------------------------------------------------ svn:eol-style = native