You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by km...@apache.org on 2013/04/07 19:16:00 UTC

svn commit: r1465428 - in /db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit: BaseTestCase.java Utilities.java

Author: kmarsden
Date: Sun Apr  7 17:16:00 2013
New Revision: 1465428

URL: http://svn.apache.org/r1465428
Log:
DERBY-5300 print test class and mode with junit tests.

merge to 10.8 facilitate 10.8 upgrade and compatibility testing
Contributed by Jayaram Subramanian



Modified:
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/Utilities.java

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java?rev=1465428&r1=1465427&r2=1465428&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java (original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java Sun Apr  7 17:16:00 2013
@@ -93,7 +93,10 @@ public abstract class BaseTestCase
         {
             startTime = System.currentTimeMillis();
             out.println();
-            out.print(getName() + " ");
+            String  junitClassName = this.getClass().getName();
+            junitClassName=Utilities.formatTestClassNames(junitClassName);
+            out.print(traceClientType());
+            out.print(junitClassName+"."+getName() + " ");
         }
 
         // install a default security manager if one has not already been
@@ -830,4 +833,12 @@ public abstract class BaseTestCase
         ae.initCause(t);
         throw ae;
     }
+
+    private static String traceClientType() {
+       if (TestConfiguration.getCurrent().getJDBCClient().isEmbedded()) {
+            return "(emb)";
+        } else {
+            return "(net)";
+        }
+    }
 } // End class BaseTestCase

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/Utilities.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/Utilities.java?rev=1465428&r1=1465427&r2=1465428&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/Utilities.java (original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/Utilities.java Sun Apr  7 17:16:00 2013
@@ -230,4 +230,22 @@ public class Utilities {
             waited = System.currentTimeMillis() - started;
         }
     }
+
+    /**
+     * Function to eliminate known package prefixes given a class full path
+     * 
+     * @param test
+     *            class name prefixed with package
+     */
+    public static String formatTestClassNames(String test) {
+        final String COMMON_FUNCTIONTEST_PREFIX = "org.apache.derbyTesting.functionTests.tests.";
+        final String COMMON_TEST_PREFIX = "org.apache.derbyTesting.";
+        if (test.startsWith(COMMON_FUNCTIONTEST_PREFIX)) {
+            return test.substring(COMMON_FUNCTIONTEST_PREFIX.length());
+        } else if (test.startsWith(COMMON_TEST_PREFIX)) {
+            return test.substring(COMMON_TEST_PREFIX.length());
+        } else {
+            return test;
+        }
+    }
 }