Return-Path: Delivered-To: apmail-ant-notifications-archive@minotaur.apache.org Received: (qmail 65413 invoked from network); 11 Feb 2009 05:03:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Feb 2009 05:03:11 -0000 Received: (qmail 9183 invoked by uid 500); 11 Feb 2009 05:03:11 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 9121 invoked by uid 500); 11 Feb 2009 05:03:11 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 9112 invoked by uid 99); 11 Feb 2009 05:03:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Feb 2009 21:03:11 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Wed, 11 Feb 2009 05:02:59 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 352632388A9A; Wed, 11 Feb 2009 05:02:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r743227 [2/2] - in /ant/core/trunk/src: main/org/apache/tools/ant/ main/org/apache/tools/ant/input/ main/org/apache/tools/ant/listener/ main/org/apache/tools/ant/taskdefs/ main/org/apache/tools/ant/taskdefs/condition/ main/org/apache/tools/... Date: Wed, 11 Feb 2009 05:02:36 -0000 To: notifications@ant.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090211050238.352632388A9A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java?rev=743227&r1=743226&r2=743227&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java Wed Feb 11 05:02:33 2009 @@ -1,425 +1,425 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package org.apache.tools.ant.taskdefs.optional.junit; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Iterator; -import java.util.SortedSet; -import java.util.TreeSet; -import java.util.Vector; - -import junit.framework.AssertionFailedError; -import junit.framework.Test; - -import org.apache.tools.ant.BuildEvent; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.BuildListener; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.ProjectComponent; -import org.apache.tools.ant.util.FileUtils; - -/** - *

Collects all failing test cases and creates a new JUnit test class containing - * a suite() method which calls these failed tests.

- *

Having classes A ... D with each several testcases you could earn a new - * test class like - *

- * // generated on: 2007.08.06 09:42:34,555
- * import junit.framework.*;
- * public class FailedTests extends TestCase {
- *     public FailedTests(String testname) {
- *         super(testname);
- *     }
- *     public static Test suite() {
- *         TestSuite suite = new TestSuite();
- *         suite.addTest( new B("test04") );
- *         suite.addTest( new org.D("test10") );
- *         return suite;
- *     }
- * }
- * 
- * - * Because each running test case gets its own formatter, we collect - * the failing test cases in a static list. Because we dont have a finalizer - * method in the formatters "lifecycle", we register this formatter as - * BuildListener and generate the new java source on taskFinished event. - * - * @since Ant 1.8.0 - */ -public class FailureRecorder extends ProjectComponent implements JUnitResultFormatter, BuildListener { - - /** - * This is the name of a magic System property ({@value}). The value of this - * System property should point to the location where to store the - * generated class (without suffix). - * Default location and name is defined in DEFAULT_CLASS_LOCATION. - * @see #DEFAULT_CLASS_LOCATION - */ - public static final String MAGIC_PROPERTY_CLASS_LOCATION - = "ant.junit.failureCollector"; - - /** Default location and name for the generated JUnit class file. {@value} */ - public static final String DEFAULT_CLASS_LOCATION - = System.getProperty("java.io.tmpdir") + "FailedTests"; - - /** Prefix for logging. {@value} */ - private static final String LOG_PREFIX = " [junit]"; - - /** Class names of failed tests without duplicates. */ - private static SortedSet/**/ failedTests = new TreeSet(); - - /** A writer for writing the generated source to. */ - private PrintWriter writer; - - /** - * Location and name of the generated JUnit class. - * Lazy instantiated via getLocationName(). - */ - private static String locationName; - - /** - * Returns the (lazy evaluated) location for the collector class. - * Order for evaluation: System property > Ant property > default value - * @return location for the collector class - * @see #MAGIC_PROPERTY_CLASS_LOCATION - * @see #DEFAULT_CLASS_LOCATION - */ - private String getLocationName() { - if (locationName == null) { - String syspropValue = System.getProperty(MAGIC_PROPERTY_CLASS_LOCATION); - String antpropValue = getProject().getProperty(MAGIC_PROPERTY_CLASS_LOCATION); - - if (syspropValue != null) { - locationName = syspropValue; - verbose("System property '" + MAGIC_PROPERTY_CLASS_LOCATION + "' set, so use " - + "its value '" + syspropValue + "' as location for collector class."); - } else if (antpropValue != null) { - locationName = antpropValue; - verbose("Ant property '" + MAGIC_PROPERTY_CLASS_LOCATION + "' set, so use " - + "its value '" + antpropValue + "' as location for collector class."); - } else { - locationName = DEFAULT_CLASS_LOCATION; - verbose("System property '" + MAGIC_PROPERTY_CLASS_LOCATION + "' not set, so use " - + "value as location for collector class: '" - + DEFAULT_CLASS_LOCATION + "'"); - } - - File locationFile = new File(locationName); - if (!locationFile.isAbsolute()) { - File f = new File(getProject().getBaseDir(), locationName); - locationName = f.getAbsolutePath(); - verbose("Location file is relative (" + locationFile + ")" - + " use absolute path instead (" + locationName + ")"); - } - } - - return locationName; - } - - /** - * This method is called by the Ant runtime by reflection. We use the project reference for - * registration of this class as BuildListener. - * - * @param project - * project reference - */ - public void setProject(Project project) { - // store project reference for logging - super.setProject(project); - // check if already registered - boolean alreadyRegistered = false; - Vector allListeners = project.getBuildListeners(); - for (int i = 0; i < allListeners.size(); i++) { - Object listener = allListeners.get(i); - if (listener instanceof FailureRecorder) { - alreadyRegistered = true; - continue; - } - } - // register if needed - if (!alreadyRegistered) { - verbose("Register FailureRecorder (@" + this.hashCode() + ") as BuildListener"); - project.addBuildListener(this); - } - } - - // ===== JUnitResultFormatter ===== - - /** - * Not used - * {@inheritDoc} - */ - public void endTestSuite(JUnitTest suite) throws BuildException { - } - - /** - * Add the failed test to the list. - * @param test the test that errored. - * @param throwable the reason it errored. - * @see junit.framework.TestListener#addError(junit.framework.Test, java.lang.Throwable) - */ - public void addError(Test test, Throwable throwable) { - failedTests.add(new TestInfos(test)); - } - - // CheckStyle:LineLengthCheck OFF - @see is long - /** - * Add the failed test to the list. - * @param test the test that failed. - * @param error the assertion that failed. - * @see junit.framework.TestListener#addFailure(junit.framework.Test, junit.framework.AssertionFailedError) - */ - // CheckStyle:LineLengthCheck ON - public void addFailure(Test test, AssertionFailedError error) { - failedTests.add(new TestInfos(test)); - } - - /** - * Not used - * {@inheritDoc} - */ - public void setOutput(OutputStream out) { - // unused, close output file so it can be deleted before the VM exits - if (out != System.out) { - FileUtils.close(out); - } - } - - /** - * Not used - * {@inheritDoc} - */ - public void setSystemError(String err) { - } - - /** - * Not used - * {@inheritDoc} - */ - public void setSystemOutput(String out) { - } - - /** - * Not used - * {@inheritDoc} - */ - public void startTestSuite(JUnitTest suite) throws BuildException { - } - - /** - * Not used - * {@inheritDoc} - */ - public void endTest(Test test) { - } - - /** - * Not used - * {@inheritDoc} - */ - public void startTest(Test test) { - } - - // ===== "Templates" for generating the JUnit class ===== - - private void writeJavaClass() { - try { - File sourceFile = new File((getLocationName() + ".java")); - verbose("Write collector class to '" + sourceFile.getAbsolutePath() + "'"); - - sourceFile.delete(); - writer = new PrintWriter(new FileOutputStream(sourceFile)); - - createClassHeader(); - createSuiteMethod(); - createClassFooter(); - - FileUtils.close(writer); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - } - - private void createClassHeader() { - String className = getLocationName().replace('\\', '/'); - if (className.indexOf('/') > -1) { - className = className.substring(className.lastIndexOf('/') + 1); - } - SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss,SSS"); - writer.print("// generated on: "); - writer.println(sdf.format(new Date())); - writer.println("import junit.framework.*;"); - writer.print("public class "); - writer.print(className); - // If this class does not extend TC, Ant doesnt run these - writer.println(" extends TestCase {"); - // standard String-constructor - writer.print(" public "); - writer.print(className); - writer.println("(String testname) {"); - writer.println(" super(testname);"); - writer.println(" }"); - } - - private void createSuiteMethod() { - writer.println(" public static Test suite() {"); - writer.println(" TestSuite suite = new TestSuite();"); - for (Iterator iter = failedTests.iterator(); iter.hasNext();) { - TestInfos testInfos = (TestInfos) iter.next(); - writer.print(" suite.addTest("); - writer.print(testInfos); - writer.println(");"); - } - writer.println(" return suite;"); - writer.println(" }"); - } - - private void createClassFooter() { - writer.println("}"); - } - - // ===== Helper classes and methods ===== - - /** - * Logging facade in INFO-mode. - * @param message Log-message - */ - public void log(String message) { - getProject().log(LOG_PREFIX + " " + message, Project.MSG_INFO); - } - - /** - * Logging facade in VERBOSE-mode. - * @param message Log-message - */ - public void verbose(String message) { - getProject().log(LOG_PREFIX + " " + message, Project.MSG_VERBOSE); - } - - /** - * TestInfos holds information about a given test for later use. - */ - public class TestInfos implements Comparable { - - /** The class name of the test. */ - private String className; - - /** The method name of the testcase. */ - private String methodName; - - /** - * This constructor extracts the needed information from the given test. - * @param test Test to analyze - */ - public TestInfos(Test test) { - className = test.getClass().getName(); - methodName = test.toString(); - methodName = methodName.substring(0, methodName.indexOf('(')); - } - - /** - * This String-Representation can directly be used for instantiation of - * the JUnit testcase. - * @return the string representation. - * @see java.lang.Object#toString() - * @see FailureRecorder#createSuiteMethod() - */ - public String toString() { - return "new " + className + "(\"" + methodName + "\")"; - } - - /** - * The SortedMap needs comparable elements. - * @param other the object to compare to. - * @return the result of the comparison. - * @see java.lang.Comparable#compareTo(T) - * @see SortedSet#comparator() - */ - public int compareTo(Object other) { - if (other instanceof TestInfos) { - TestInfos otherInfos = (TestInfos) other; - return toString().compareTo(otherInfos.toString()); - } else { - return -1; - } - } - } - - // ===== BuildListener ===== - - /** - * Not used - * {@inheritDoc} - */ - public void buildFinished(BuildEvent event) { - } - - /** - * Not used - * {@inheritDoc} - */ - public void buildStarted(BuildEvent event) { - } - - /** - * Not used - * {@inheritDoc} - */ - public void messageLogged(BuildEvent event) { - } - - /** - * Not used - * {@inheritDoc} - */ - public void targetFinished(BuildEvent event) { - } - - /** - * Not used - * {@inheritDoc} - */ - public void targetStarted(BuildEvent event) { - } - - /** - * The task outside of this JUnitResultFormatter is the task. So all tests passed - * and we could create the new java class. - * @param event not used - * @see org.apache.tools.ant.BuildListener#taskFinished(org.apache.tools.ant.BuildEvent) - */ - public void taskFinished(BuildEvent event) { - if (!failedTests.isEmpty()) { - writeJavaClass(); - } - } - - /** - * Not used - * {@inheritDoc} - */ - public void taskStarted(BuildEvent event) { - } - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.tools.ant.taskdefs.optional.junit; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Iterator; +import java.util.SortedSet; +import java.util.TreeSet; +import java.util.Vector; + +import junit.framework.AssertionFailedError; +import junit.framework.Test; + +import org.apache.tools.ant.BuildEvent; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.BuildListener; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.ProjectComponent; +import org.apache.tools.ant.util.FileUtils; + +/** + *

Collects all failing test cases and creates a new JUnit test class containing + * a suite() method which calls these failed tests.

+ *

Having classes A ... D with each several testcases you could earn a new + * test class like + *

+ * // generated on: 2007.08.06 09:42:34,555
+ * import junit.framework.*;
+ * public class FailedTests extends TestCase {
+ *     public FailedTests(String testname) {
+ *         super(testname);
+ *     }
+ *     public static Test suite() {
+ *         TestSuite suite = new TestSuite();
+ *         suite.addTest( new B("test04") );
+ *         suite.addTest( new org.D("test10") );
+ *         return suite;
+ *     }
+ * }
+ * 
+ * + * Because each running test case gets its own formatter, we collect + * the failing test cases in a static list. Because we dont have a finalizer + * method in the formatters "lifecycle", we register this formatter as + * BuildListener and generate the new java source on taskFinished event. + * + * @since Ant 1.8.0 + */ +public class FailureRecorder extends ProjectComponent implements JUnitResultFormatter, BuildListener { + + /** + * This is the name of a magic System property ({@value}). The value of this + * System property should point to the location where to store the + * generated class (without suffix). + * Default location and name is defined in DEFAULT_CLASS_LOCATION. + * @see #DEFAULT_CLASS_LOCATION + */ + public static final String MAGIC_PROPERTY_CLASS_LOCATION + = "ant.junit.failureCollector"; + + /** Default location and name for the generated JUnit class file. {@value} */ + public static final String DEFAULT_CLASS_LOCATION + = System.getProperty("java.io.tmpdir") + "FailedTests"; + + /** Prefix for logging. {@value} */ + private static final String LOG_PREFIX = " [junit]"; + + /** Class names of failed tests without duplicates. */ + private static SortedSet/**/ failedTests = new TreeSet(); + + /** A writer for writing the generated source to. */ + private PrintWriter writer; + + /** + * Location and name of the generated JUnit class. + * Lazy instantiated via getLocationName(). + */ + private static String locationName; + + /** + * Returns the (lazy evaluated) location for the collector class. + * Order for evaluation: System property > Ant property > default value + * @return location for the collector class + * @see #MAGIC_PROPERTY_CLASS_LOCATION + * @see #DEFAULT_CLASS_LOCATION + */ + private String getLocationName() { + if (locationName == null) { + String syspropValue = System.getProperty(MAGIC_PROPERTY_CLASS_LOCATION); + String antpropValue = getProject().getProperty(MAGIC_PROPERTY_CLASS_LOCATION); + + if (syspropValue != null) { + locationName = syspropValue; + verbose("System property '" + MAGIC_PROPERTY_CLASS_LOCATION + "' set, so use " + + "its value '" + syspropValue + "' as location for collector class."); + } else if (antpropValue != null) { + locationName = antpropValue; + verbose("Ant property '" + MAGIC_PROPERTY_CLASS_LOCATION + "' set, so use " + + "its value '" + antpropValue + "' as location for collector class."); + } else { + locationName = DEFAULT_CLASS_LOCATION; + verbose("System property '" + MAGIC_PROPERTY_CLASS_LOCATION + "' not set, so use " + + "value as location for collector class: '" + + DEFAULT_CLASS_LOCATION + "'"); + } + + File locationFile = new File(locationName); + if (!locationFile.isAbsolute()) { + File f = new File(getProject().getBaseDir(), locationName); + locationName = f.getAbsolutePath(); + verbose("Location file is relative (" + locationFile + ")" + + " use absolute path instead (" + locationName + ")"); + } + } + + return locationName; + } + + /** + * This method is called by the Ant runtime by reflection. We use the project reference for + * registration of this class as BuildListener. + * + * @param project + * project reference + */ + public void setProject(Project project) { + // store project reference for logging + super.setProject(project); + // check if already registered + boolean alreadyRegistered = false; + Vector allListeners = project.getBuildListeners(); + for (int i = 0; i < allListeners.size(); i++) { + Object listener = allListeners.get(i); + if (listener instanceof FailureRecorder) { + alreadyRegistered = true; + continue; + } + } + // register if needed + if (!alreadyRegistered) { + verbose("Register FailureRecorder (@" + this.hashCode() + ") as BuildListener"); + project.addBuildListener(this); + } + } + + // ===== JUnitResultFormatter ===== + + /** + * Not used + * {@inheritDoc} + */ + public void endTestSuite(JUnitTest suite) throws BuildException { + } + + /** + * Add the failed test to the list. + * @param test the test that errored. + * @param throwable the reason it errored. + * @see junit.framework.TestListener#addError(junit.framework.Test, java.lang.Throwable) + */ + public void addError(Test test, Throwable throwable) { + failedTests.add(new TestInfos(test)); + } + + // CheckStyle:LineLengthCheck OFF - @see is long + /** + * Add the failed test to the list. + * @param test the test that failed. + * @param error the assertion that failed. + * @see junit.framework.TestListener#addFailure(junit.framework.Test, junit.framework.AssertionFailedError) + */ + // CheckStyle:LineLengthCheck ON + public void addFailure(Test test, AssertionFailedError error) { + failedTests.add(new TestInfos(test)); + } + + /** + * Not used + * {@inheritDoc} + */ + public void setOutput(OutputStream out) { + // unused, close output file so it can be deleted before the VM exits + if (out != System.out) { + FileUtils.close(out); + } + } + + /** + * Not used + * {@inheritDoc} + */ + public void setSystemError(String err) { + } + + /** + * Not used + * {@inheritDoc} + */ + public void setSystemOutput(String out) { + } + + /** + * Not used + * {@inheritDoc} + */ + public void startTestSuite(JUnitTest suite) throws BuildException { + } + + /** + * Not used + * {@inheritDoc} + */ + public void endTest(Test test) { + } + + /** + * Not used + * {@inheritDoc} + */ + public void startTest(Test test) { + } + + // ===== "Templates" for generating the JUnit class ===== + + private void writeJavaClass() { + try { + File sourceFile = new File((getLocationName() + ".java")); + verbose("Write collector class to '" + sourceFile.getAbsolutePath() + "'"); + + sourceFile.delete(); + writer = new PrintWriter(new FileOutputStream(sourceFile)); + + createClassHeader(); + createSuiteMethod(); + createClassFooter(); + + FileUtils.close(writer); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + + private void createClassHeader() { + String className = getLocationName().replace('\\', '/'); + if (className.indexOf('/') > -1) { + className = className.substring(className.lastIndexOf('/') + 1); + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss,SSS"); + writer.print("// generated on: "); + writer.println(sdf.format(new Date())); + writer.println("import junit.framework.*;"); + writer.print("public class "); + writer.print(className); + // If this class does not extend TC, Ant doesnt run these + writer.println(" extends TestCase {"); + // standard String-constructor + writer.print(" public "); + writer.print(className); + writer.println("(String testname) {"); + writer.println(" super(testname);"); + writer.println(" }"); + } + + private void createSuiteMethod() { + writer.println(" public static Test suite() {"); + writer.println(" TestSuite suite = new TestSuite();"); + for (Iterator iter = failedTests.iterator(); iter.hasNext();) { + TestInfos testInfos = (TestInfos) iter.next(); + writer.print(" suite.addTest("); + writer.print(testInfos); + writer.println(");"); + } + writer.println(" return suite;"); + writer.println(" }"); + } + + private void createClassFooter() { + writer.println("}"); + } + + // ===== Helper classes and methods ===== + + /** + * Logging facade in INFO-mode. + * @param message Log-message + */ + public void log(String message) { + getProject().log(LOG_PREFIX + " " + message, Project.MSG_INFO); + } + + /** + * Logging facade in VERBOSE-mode. + * @param message Log-message + */ + public void verbose(String message) { + getProject().log(LOG_PREFIX + " " + message, Project.MSG_VERBOSE); + } + + /** + * TestInfos holds information about a given test for later use. + */ + public class TestInfos implements Comparable { + + /** The class name of the test. */ + private String className; + + /** The method name of the testcase. */ + private String methodName; + + /** + * This constructor extracts the needed information from the given test. + * @param test Test to analyze + */ + public TestInfos(Test test) { + className = test.getClass().getName(); + methodName = test.toString(); + methodName = methodName.substring(0, methodName.indexOf('(')); + } + + /** + * This String-Representation can directly be used for instantiation of + * the JUnit testcase. + * @return the string representation. + * @see java.lang.Object#toString() + * @see FailureRecorder#createSuiteMethod() + */ + public String toString() { + return "new " + className + "(\"" + methodName + "\")"; + } + + /** + * The SortedMap needs comparable elements. + * @param other the object to compare to. + * @return the result of the comparison. + * @see java.lang.Comparable#compareTo(T) + * @see SortedSet#comparator() + */ + public int compareTo(Object other) { + if (other instanceof TestInfos) { + TestInfos otherInfos = (TestInfos) other; + return toString().compareTo(otherInfos.toString()); + } else { + return -1; + } + } + } + + // ===== BuildListener ===== + + /** + * Not used + * {@inheritDoc} + */ + public void buildFinished(BuildEvent event) { + } + + /** + * Not used + * {@inheritDoc} + */ + public void buildStarted(BuildEvent event) { + } + + /** + * Not used + * {@inheritDoc} + */ + public void messageLogged(BuildEvent event) { + } + + /** + * Not used + * {@inheritDoc} + */ + public void targetFinished(BuildEvent event) { + } + + /** + * Not used + * {@inheritDoc} + */ + public void targetStarted(BuildEvent event) { + } + + /** + * The task outside of this JUnitResultFormatter is the task. So all tests passed + * and we could create the new java class. + * @param event not used + * @see org.apache.tools.ant.BuildListener#taskFinished(org.apache.tools.ant.BuildEvent) + */ + public void taskFinished(BuildEvent event) { + if (!failedTests.isEmpty()) { + writeJavaClass(); + } + } + + /** + * Not used + * {@inheritDoc} + */ + public void taskStarted(BuildEvent event) { + } + +} Propchange: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FileProvider.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FileProvider.java?rev=743227&r1=743226&r2=743227&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FileProvider.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FileProvider.java Wed Feb 11 05:02:33 2009 @@ -1,36 +1,36 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.tools.ant.types.resources; - -import java.io.File; - -/** - * This is an interface that resources that can provide a file should implement. - * This is a refactoring of {@link FileResource}, to allow other resources - * to act as sources of files (and to make components that only support - * file-based resources from only support FileResource resources. - * @since Ant 1.8 - */ -public interface FileProvider { - /** - * Get the file represented by this Resource. - * @return the file. - */ - File getFile(); -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.tools.ant.types.resources; + +import java.io.File; + +/** + * This is an interface that resources that can provide a file should implement. + * This is a refactoring of {@link FileResource}, to allow other resources + * to act as sources of files (and to make components that only support + * file-based resources from only support FileResource resources. + * @since Ant 1.8 + */ +public interface FileProvider { + /** + * Get the file represented by this Resource. + * @return the file. + */ + File getFile(); +} Propchange: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FileProvider.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: ant/core/trunk/src/tests/antunit/core/location/location.xml URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/core/location/location.xml?rev=743227&r1=743226&r2=743227&view=diff ============================================================================== --- ant/core/trunk/src/tests/antunit/core/location/location.xml (original) +++ ant/core/trunk/src/tests/antunit/core/location/location.xml Wed Feb 11 05:02:33 2009 @@ -1,4 +1,4 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Hello - - - - - - - - - - - - - Hello - - - - - - Hello - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hello + + + + + + + + + + + + + Hello + + + + + + Hello + + + + + Propchange: ant/core/trunk/src/tests/antunit/core/location/location.xml ------------------------------------------------------------------------------ svn:eol-style = native Modified: ant/core/trunk/src/tests/antunit/core/location/src/task/EchoLocation.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/core/location/src/task/EchoLocation.java?rev=743227&r1=743226&r2=743227&view=diff ============================================================================== --- ant/core/trunk/src/tests/antunit/core/location/src/task/EchoLocation.java (original) +++ ant/core/trunk/src/tests/antunit/core/location/src/task/EchoLocation.java Wed Feb 11 05:02:33 2009 @@ -1,26 +1,26 @@ -/* -Licensed to the Apache Software Foundation (ASF) under one or more -contributor license agreements. See the NOTICE file distributed with -this work for additional information regarding copyright ownership. -The ASF licenses this file to You under the Apache License, Version 2.0 -(the "License"); you may not use this file except in compliance with -the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -package task; - -import org.apache.tools.ant.Project; -import org.apache.tools.ant.Task; - -public class EchoLocation extends Task { - public void execute() { - log("Line: " + getLocation().getLineNumber(), Project.MSG_INFO); - } +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +package task; + +import org.apache.tools.ant.Project; +import org.apache.tools.ant.Task; + +public class EchoLocation extends Task { + public void execute() { + log("Line: " + getLocation().getLineNumber(), Project.MSG_INFO); + } } \ No newline at end of file Propchange: ant/core/trunk/src/tests/antunit/core/location/src/task/EchoLocation.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: ant/core/trunk/src/tests/antunit/taskdefs/condition/antversion-test.xml URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/condition/antversion-test.xml?rev=743227&r1=743226&r2=743227&view=diff ============================================================================== --- ant/core/trunk/src/tests/antunit/taskdefs/condition/antversion-test.xml (original) +++ ant/core/trunk/src/tests/antunit/taskdefs/condition/antversion-test.xml Wed Feb 11 05:02:33 2009 @@ -1,4 +1,4 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - AntVersion=${antversion} - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + AntVersion=${antversion} + + + + + + + + + + + + + + + + + + + + + + + + + + Propchange: ant/core/trunk/src/tests/antunit/taskdefs/condition/antversion-test.xml ------------------------------------------------------------------------------ svn:eol-style = native Modified: ant/core/trunk/src/tests/antunit/taskdefs/condition/hasfreespace-test.xml URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/condition/hasfreespace-test.xml?rev=743227&r1=743226&r2=743227&view=diff ============================================================================== --- ant/core/trunk/src/tests/antunit/taskdefs/condition/hasfreespace-test.xml (original) +++ ant/core/trunk/src/tests/antunit/taskdefs/condition/hasfreespace-test.xml Wed Feb 11 05:02:33 2009 @@ -1,4 +1,4 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Propchange: ant/core/trunk/src/tests/antunit/taskdefs/condition/hasfreespace-test.xml ------------------------------------------------------------------------------ svn:eol-style = native Modified: ant/core/trunk/src/tests/antunit/taskdefs/echoxml-test.xml URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/echoxml-test.xml?rev=743227&r1=743226&r2=743227&view=diff ============================================================================== --- ant/core/trunk/src/tests/antunit/taskdefs/echoxml-test.xml (original) +++ ant/core/trunk/src/tests/antunit/taskdefs/echoxml-test.xml Wed Feb 11 05:02:33 2009 @@ -1,87 +1,87 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Propchange: ant/core/trunk/src/tests/antunit/taskdefs/echoxml-test.xml ------------------------------------------------------------------------------ svn:eol-style = native Modified: ant/core/trunk/src/tests/antunit/taskdefs/gzip-test.xml URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/gzip-test.xml?rev=743227&r1=743226&r2=743227&view=diff ============================================================================== --- ant/core/trunk/src/tests/antunit/taskdefs/gzip-test.xml (original) +++ ant/core/trunk/src/tests/antunit/taskdefs/gzip-test.xml Wed Feb 11 05:02:33 2009 @@ -1,46 +1,46 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Propchange: ant/core/trunk/src/tests/antunit/taskdefs/gzip-test.xml ------------------------------------------------------------------------------ svn:eol-style = native Modified: ant/core/trunk/src/tests/antunit/taskdefs/hostinfo-test.xml URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/hostinfo-test.xml?rev=743227&r1=743226&r2=743227&view=diff ============================================================================== --- ant/core/trunk/src/tests/antunit/taskdefs/hostinfo-test.xml (original) +++ ant/core/trunk/src/tests/antunit/taskdefs/hostinfo-test.xml Wed Feb 11 05:02:33 2009 @@ -1,94 +1,94 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Propchange: ant/core/trunk/src/tests/antunit/taskdefs/hostinfo-test.xml ------------------------------------------------------------------------------ svn:eol-style = native Modified: ant/core/trunk/src/tests/antunit/taskdefs/loadresource-test.xml URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/loadresource-test.xml?rev=743227&r1=743226&r2=743227&view=diff ============================================================================== --- ant/core/trunk/src/tests/antunit/taskdefs/loadresource-test.xml (original) +++ ant/core/trunk/src/tests/antunit/taskdefs/loadresource-test.xml Wed Feb 11 05:02:33 2009 @@ -1,41 +1,41 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + Propchange: ant/core/trunk/src/tests/antunit/taskdefs/loadresource-test.xml ------------------------------------------------------------------------------ svn:eol-style = native Modified: ant/core/trunk/src/tests/antunit/types/resources/files-test.xml URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/types/resources/files-test.xml?rev=743227&r1=743226&r2=743227&view=diff ============================================================================== --- ant/core/trunk/src/tests/antunit/types/resources/files-test.xml (original) +++ ant/core/trunk/src/tests/antunit/types/resources/files-test.xml Wed Feb 11 05:02:33 2009 @@ -1,53 +1,53 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Propchange: ant/core/trunk/src/tests/antunit/types/resources/files-test.xml ------------------------------------------------------------------------------ svn:eol-style = native