You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2011/02/04 12:07:38 UTC
svn commit: r1067148 -
/sling/whiteboard/bdelacretaz/junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/TestAllPaths.java
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