Return-Path: Delivered-To: apmail-sling-commits-archive@www.apache.org Received: (qmail 48098 invoked from network); 4 Feb 2011 11:08:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Feb 2011 11:08:03 -0000 Received: (qmail 77840 invoked by uid 500); 4 Feb 2011 11:08:03 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 77782 invoked by uid 500); 4 Feb 2011 11:08:02 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 77775 invoked by uid 99); 4 Feb 2011 11:08:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Feb 2011 11:08:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Feb 2011 11:07:59 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 449E72388A6B; Fri, 4 Feb 2011 11:07:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1067148 - /sling/whiteboard/bdelacretaz/junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/TestAllPaths.java Date: Fri, 04 Feb 2011 11:07:38 -0000 To: commits@sling.apache.org From: bdelacretaz@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110204110738.449E72388A6B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bdelacretaz Date: Fri Feb 4 11:07:37 2011 New Revision: 1067148 URL: http://svn.apache.org/viewvc?rev=1067148&view=rev Log: SLING-1963 - prevent concurrent execution Modified: sling/whiteboard/bdelacretaz/junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/TestAllPaths.java Modified: sling/whiteboard/bdelacretaz/junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/TestAllPaths.java URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/TestAllPaths.java?rev=1067148&r1=1067147&r2=1067148&view=diff ============================================================================== --- sling/whiteboard/bdelacretaz/junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/TestAllPaths.java (original) +++ sling/whiteboard/bdelacretaz/junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/TestAllPaths.java Fri Feb 4 11:07:37 2011 @@ -27,6 +27,8 @@ import java.util.List; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.engine.SlingRequestProcessor; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -37,6 +39,7 @@ import org.junit.runners.Parameterized.P public class TestAllPaths { private String path; + private static boolean executing = false; public static final String TEST_URL_SUFFIX = ".test.txt"; public static final String PASSED = "TEST_PASSED"; @@ -48,6 +51,21 @@ public class TestAllPaths { public TestAllPaths(String path) { this.path = path; } + + // Due to our use of static context, only one instance of this test can + // execute at any given time. + @BeforeClass + public static void checkConcurrency() { + if(executing) { + fail("Concurrent execution detected, not supported by this class"); + } + executing = true; + } + + @AfterClass + public static void cleanup() { + executing = false; + } /** Let JUnit run this all on our paths */ @Parameters