You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ma...@apache.org on 2021/02/26 22:14:17 UTC

svn commit: r1886962 - in /poi/trunk: build.gradle src/integrationtest/org/apache/poi/stress/TestAllFiles.java

Author: mariusvolkhart
Date: Fri Feb 26 22:14:17 2021
New Revision: 1886962

URL: http://svn.apache.org/viewvc?rev=1886962&view=rev
Log:
Enable running more integration tests from Gradle.

This is particularly relevant for developers who import the Gradle project into their IDE and run tests using the Gradle test runner. Those developers were previously unable to debug integration tests.

Modified:
    poi/trunk/build.gradle
    poi/trunk/src/integrationtest/org/apache/poi/stress/TestAllFiles.java

Modified: poi/trunk/build.gradle
URL: http://svn.apache.org/viewvc/poi/trunk/build.gradle?rev=1886962&r1=1886961&r2=1886962&view=diff
==============================================================================
--- poi/trunk/build.gradle (original)
+++ poi/trunk/build.gradle Fri Feb 26 22:14:17 2021
@@ -421,7 +421,6 @@ project('integrationtest') {
 
     test {
         // exclude these from the normal test-run
-        exclude '**/TestAllFiles.class'
         exclude '**/*FileHandler.class'
     }
 

Modified: poi/trunk/src/integrationtest/org/apache/poi/stress/TestAllFiles.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/integrationtest/org/apache/poi/stress/TestAllFiles.java?rev=1886962&r1=1886961&r2=1886962&view=diff
==============================================================================
--- poi/trunk/src/integrationtest/org/apache/poi/stress/TestAllFiles.java (original)
+++ poi/trunk/src/integrationtest/org/apache/poi/stress/TestAllFiles.java Fri Feb 26 22:14:17 2021
@@ -70,7 +70,8 @@ import org.opentest4j.AssertionFailedErr
 // also need to set JVM parameter: -Djunit.jupiter.execution.parallel.enabled=true
 @Execution(ExecutionMode.CONCURRENT)
 public class TestAllFiles {
-    public static final File ROOT_DIR = new File("test-data");
+    private static final String DEFAULT_TEST_DATA_PATH = "test-data";
+    public static final File ROOT_DIR = new File(System.getProperty("POI.testdata.path", DEFAULT_TEST_DATA_PATH));
 
     public static final String[] SCAN_EXCLUDES = {
         "**/.svn/**",
@@ -183,7 +184,18 @@ public class TestAllFiles {
     }
 
     private static String pathReplace(String msg) {
+        if (msg == null) return null;
+
         // Windows path replacement
-        return msg == null ? null : msg.replace('\\', '/');
+        msg = msg.replace('\\', '/');
+
+        // Adjust file paths to remove unwanted file path info.
+        int filePathIndex = msg.indexOf(ROOT_DIR.toString());
+        if (filePathIndex > 0) {
+            int testDataDirectoryIndex = msg.indexOf(DEFAULT_TEST_DATA_PATH);
+            msg = msg.substring(0, filePathIndex) + msg.substring(testDataDirectoryIndex);
+        }
+
+        return msg;
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org