sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1689874 - in /sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test: LogRecordCollector.java TestSuite.java
Date Wed, 08 Jul 2015 13:41:26 GMT
Author: desruisseaux
Date: Wed Jul  8 13:41:26 2015
New Revision: 1689874

URL: http://svn.apache.org/r1689874
Log:
Allow integration tests to shutdown only after all TestSuites.

Modified:
    sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/LogRecordCollector.java
    sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java

Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/LogRecordCollector.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/LogRecordCollector.java?rev=1689874&r1=1689873&r2=1689874&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/LogRecordCollector.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/LogRecordCollector.java
[UTF-8] Wed Jul  8 13:41:26 2015
@@ -96,7 +96,7 @@ final class LogRecordCollector extends H
                 method = "<unknown>";
                 for (final StackTraceElement t : Thread.currentThread().getStackTrace())
{
                     final String c = t.getClassName();
-                    if (c.startsWith("org.apache.sis.") && c.endsWith("Test")) {
+                    if (c.startsWith("org.apache.sis.") && c.endsWith(TestSuite.CLASSNAME_SUFFIX))
{
                         cname  = c;
                         method = t.getMethodName();
                         break;

Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java?rev=1689874&r1=1689873&r2=1689874&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java [UTF-8]
(original)
+++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java [UTF-8]
Wed Jul  8 13:41:26 2015
@@ -59,7 +59,7 @@ public abstract strictfp class TestSuite
     /**
      * Expected suffix in name of test classes.
      */
-    private static final String CLASSNAME_SUFFIX = "Test";
+    static final String CLASSNAME_SUFFIX = "Test";
 
     /**
      * {@code true} for disabling the search for missing tests. This is necessary
@@ -69,6 +69,12 @@ public abstract strictfp class TestSuite
     static boolean skipCheckForMissingTests;
 
     /**
+     * {@code true} for disabling {@link #shutdown()}. This is necessary when the test suites
+     * are executed from an external project (same need than {@link #skipCheckForMissingTests}).
+     */
+    static boolean skipShutdown;
+
+    /**
      * Creates a new test suite.
      */
     protected TestSuite() {
@@ -245,14 +251,17 @@ public abstract strictfp class TestSuite
      */
     @AfterClass
     public static void shutdown() throws JMException {
-        SystemListener.fireClasspathChanged();
-        Shutdown.stop(TestSuite.class);
-        TestCase.LOGGER.removeHandler(LogRecordCollector.INSTANCE);
-        System.err.flush();   // For flushing log messages sent by ConsoleHandler.
-        try {
-            LogRecordCollector.INSTANCE.report(System.out);
-        } catch (IOException e) {   // Should never happen.
-            throw new AssertionError(e);
+        if (!skipShutdown) {
+            skipShutdown = true;
+            TestCase.LOGGER.removeHandler(LogRecordCollector.INSTANCE);
+            System.err.flush();   // Flushs log messages sent by ConsoleHandler.
+            try {
+                LogRecordCollector.INSTANCE.report(System.out);
+            } catch (IOException e) {   // Should never happen.
+                throw new AssertionError(e);
+            }
+            SystemListener.fireClasspathChanged();
+            Shutdown.stop(TestSuite.class);
         }
     }
 }



Mime
View raw message