From derby-commits-return-14978-apmail-db-derby-commits-archive=db.apache.org@db.apache.org Mon Oct 17 19:09:29 2011 Return-Path: X-Original-To: apmail-db-derby-commits-archive@www.apache.org Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BC73F963C for ; Mon, 17 Oct 2011 19:09:29 +0000 (UTC) Received: (qmail 37904 invoked by uid 500); 17 Oct 2011 19:09:28 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 37883 invoked by uid 500); 17 Oct 2011 19:09:28 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 37876 invoked by uid 99); 17 Oct 2011 19:09:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Oct 2011 19:09:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Oct 2011 19:09:25 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 957532388847; Mon, 17 Oct 2011 19:09:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: derby-commits@db.apache.org From: kristwaa@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111017190904.957532388847@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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; + } + } }