db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r1185330 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit: BaseTestCase.java Utilities.java
Date Mon, 17 Oct 2011 19:09:04 GMT
Author: kristwaa
Date: Mon Oct 17 19:09:04 2011
New Revision: 1185330

URL: http://svn.apache.org/viewvc?rev=1185330&view=rev
Log:
DERBY-5300: Change derby.tests.trace to print the class as well as fixture name

Introduces the following changes to the output controlled by derby.tests.trace:
 a) Print '(emb)' or '(net)' to show which driver/framework is being used.
 b) Test class names are shortened if possible. The following prefixes are
    stripped off:
    o 'org.apache.derbyTesting.functionTests.tests.'
    o 'org.apache.derbyTesting.'

Patch contributed by Jayaram Subramanian (rsjay1976 at gmail dot com).

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

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java?rev=1185330&r1=1185329&r2=1185330&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java Mon Oct
17 19:09:04 2011
@@ -96,7 +96,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
@@ -850,4 +853,12 @@ public abstract class BaseTestCase
         testLaunchMethod };
         assertExecJavaCmdAsExpected(new String[] { "OK (1 test)" }, cmd, 0);
     }
+
+    private static String traceClientType() {
+       if (TestConfiguration.getCurrent().getJDBCClient().isEmbedded()) {
+            return "(emb)";
+        } else {
+            return "(net)";
+        }
+    }
 } // End class BaseTestCase

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/Utilities.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/Utilities.java?rev=1185330&r1=1185329&r2=1185330&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/Utilities.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/Utilities.java Mon Oct
17 19:09:04 2011
@@ -231,4 +231,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 mainString) {
+        final String COMMON_FUNCTIONTEST_PREFIX = "org.apache.derbyTesting.functionTests.tests.";
+        final String COMMON_TEST_PREFIX = "org.apache.derbyTesting.";
+        if (mainString.startsWith(COMMON_FUNCTIONTEST_PREFIX)) {
+            return mainString.substring(COMMON_FUNCTIONTEST_PREFIX.length());
+        } else if (mainString.startsWith(COMMON_TEST_PREFIX)) {
+            return mainString.substring(COMMON_TEST_PREFIX.length());
+        } else {
+            return mainString;
+        }
+    }
 }



Mime
View raw message