From commits-return-2619-apmail-jackrabbit-commits-archive=jackrabbit.apache.org@jackrabbit.apache.org Sat Jul 29 17:53:09 2006 Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 57736 invoked from network); 29 Jul 2006 17:53:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 29 Jul 2006 17:53:08 -0000 Received: (qmail 87301 invoked by uid 500); 29 Jul 2006 17:53:08 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 87276 invoked by uid 500); 29 Jul 2006 17:53:08 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 87267 invoked by uid 99); 29 Jul 2006 17:53:08 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Jul 2006 10:53:08 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Jul 2006 10:53:07 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 594861A981A; Sat, 29 Jul 2006 10:52:47 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r426828 - in /jackrabbit/trunk/jackrabbit: project.properties src/test/java/org/apache/jackrabbit/test/JCRTestResult.java Date: Sat, 29 Jul 2006 17:52:46 -0000 To: commits@jackrabbit.apache.org From: jukka@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060729175247.594861A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: jukka Date: Sat Jul 29 10:52:46 2006 New Revision: 426828 URL: http://svn.apache.org/viewvc?rev=426828&view=rev Log: JCRTestResult: Enhanced support for known issue handling. Modified: jackrabbit/trunk/jackrabbit/project.properties jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/JCRTestResult.java Modified: jackrabbit/trunk/jackrabbit/project.properties URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/project.properties?rev=426828&r1=426827&r2=426828&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit/project.properties (original) +++ jackrabbit/trunk/jackrabbit/project.properties Sat Jul 29 10:52:46 2006 @@ -27,7 +27,7 @@ maven.test.failure = false maven.junit.fork=true maven.junit.jvmargs=-Xmx128m -enableassertions -maven.junit.sysproperties=derby.system.durability known.issues +maven.junit.sysproperties=derby.system.durability known.issues known.issues.override derby.system.durability=test # space separated list of test cases that are known issues and will # not yield failures in a test run Modified: jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/JCRTestResult.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/JCRTestResult.java?rev=426828&r1=426827&r2=426828&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/JCRTestResult.java (original) +++ jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/JCRTestResult.java Sat Jul 29 10:52:46 2006 @@ -43,7 +43,13 @@ * Set of Strings that identify the test methods that currently fails but * are recognized as known issues. Those will not be reported as errors. */ - private final Set knownIssues = new HashSet(); + private final Set knownIssues; + + /** + * Set of Strings that identify the test methods that are listed as known + * issues but whose test failures should still be reported. + */ + private final Set knownIssuesOverride; /** * Creates a new JCRTestResult that delegates to orig. @@ -53,13 +59,8 @@ public JCRTestResult(TestResult orig, LogPrintWriter log) { this.orig = orig; this.log = log; - String propValue = System.getProperty("known.issues"); - if (propValue != null) { - StringTokenizer tok = new StringTokenizer(propValue); - while (tok.hasMoreTokens()) { - knownIssues.add(tok.nextToken()); - } - } + this.knownIssues = JCRTestResult.tokenize("known.issues"); + this.knownIssuesOverride = JCRTestResult.tokenize("known.issues.override"); } /** @@ -145,16 +146,75 @@ //------------------------------< internal >-------------------------------- /** - * Returns true if test is a known issue; - * false otherwise. + * Takes the named system property and returns the set of string tokens + * in the property value. Returns an empty set if the named property does + * not exist. + * + * @param name name of the system property + * @return set of string tokens + */ + private static Set tokenize(String name) { + Set tokens = new HashSet(); + StringTokenizer tokenizer = + new StringTokenizer(System.getProperty(name, "")); + while (tokenizer.hasMoreTokens()) { + tokens.add(tokenizer.nextToken()); + } + return tokens; + } + + /** + * Checks if a variation of the name of the given test case is included + * in the given set of token. The tested variations are: + *
    + *
  • package name
  • + *
  • non-qualified class name
  • + *
  • fully qualified class name
  • + *
  • non-qualified method name
  • + *
  • class-qualified method name
  • + *
  • fully-qualified method name
  • + *
+ * + * @param tokens set of string tokens + * @param test test case + * @return true if the test case name is included, + * false otherwise + */ + private static boolean contains(Set tokens, TestCase test) { + String className = test.getClass().getName(); + String methodName = test.getName(); + + int i = className.lastIndexOf('.'); + if (i >= 0) { + String packageName = className.substring(0, i); + String shortName = className.substring(i + 1); + return tokens.contains(packageName) + || tokens.contains(shortName) + || tokens.contains(className) + || tokens.contains(methodName) + || tokens.contains(shortName + "#" + methodName) + || tokens.contains(className + "#" + methodName); + } else { + return tokens.contains(className) + || tokens.contains(methodName) + || tokens.contains(className + "#" + methodName); + } + } + + /** + * Returns true if test is a known issue + * whose test result should be ignored; false otherwise. + * * @param test the test case to check. - * @return true if test is a known issue. + * @return true if test result should be ignored */ private boolean isKnownIssue(Test test) { - String testName = "-"; if (test instanceof TestCase) { - testName = test.getClass().getName() + "#" + ((TestCase) test).getName(); + return contains(knownIssues, (TestCase) test) + && !contains(knownIssuesOverride, (TestCase) test); + } else { + return false; } - return knownIssues.contains(testName); } + }