ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject svn commit: r473108 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/
Date Thu, 09 Nov 2006 22:39:15 GMT
Author: peterreilly
Date: Thu Nov  9 14:39:14 2006
New Revision: 473108

URL: http://svn.apache.org/viewvc?view=rev&rev=473108
Log:
checkstyle - mostly javadoc

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitResultFormatter.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskMirror.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java?view=diff&rev=473108&r1=473107&r2=473108
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java
Thu Nov  9 14:39:14 2006
@@ -79,6 +79,7 @@
         }
     }
 
+    // CheckStyle:VisibilityModifier OFF - bc
     /** Task */
     protected Task task;
 
@@ -123,6 +124,7 @@
        privateDBFactory = DocumentBuilderFactory.newInstance();
        dbfactory = privateDBFactory;
     }
+    // CheckStyle:VisibilityModifier ON
 
     /**
      * constructor creating the transformer from the junitreport task.

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java?view=diff&rev=473108&r1=473107&r2=473108
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java Thu
Nov  9 14:39:14 2006
@@ -26,6 +26,7 @@
  *
  */
 public abstract class BaseTest {
+    // CheckStyle:VisibilityModifier OFF - bc
     protected boolean haltOnError = false;
     protected boolean haltOnFail = false;
     protected boolean filtertrace = true;
@@ -38,59 +39,110 @@
 
     protected String failureProperty;
     protected String errorProperty;
+    // CheckStyle:VisibilityModifier ON
 
+    /**
+     * Set the filtertrace attribute.
+     * @param value a <code>boolean</code> value.
+     */
     public void setFiltertrace(boolean value) {
         filtertrace = value;
     }
 
+    /**
+     * Get the filtertrace attribute.
+     * @return the attribute.
+     */
     public boolean getFiltertrace() {
         return filtertrace;
     }
 
+    /**
+     * Set the fork attribute.
+     * @param value a <code>boolean</code> value.
+     */
     public void setFork(boolean value) {
         fork = value;
     }
 
+    /**
+     * Get the fork attribute.
+     * @return the attribute.
+     */
     public boolean getFork() {
         return fork;
     }
 
+    /**
+     * Set the haltonerror attribute.
+     * @param value a <code>boolean</code> value.
+     */
     public void setHaltonerror(boolean value) {
         haltOnError = value;
     }
 
+    /**
+     * Set the haltonfailure attribute.
+     * @param value a <code>boolean</code> value.
+     */
     public void setHaltonfailure(boolean value) {
         haltOnFail = value;
     }
 
+    /**
+     * Get the haltonerror attribute.
+     * @return the attribute.
+     */
     public boolean getHaltonerror() {
         return haltOnError;
     }
 
+    /**
+     * Get the haltonfailure attribute.
+     * @return the attribute.
+     */
     public boolean getHaltonfailure() {
         return haltOnFail;
     }
 
+    /**
+     * Set the if attribute.
+     * If this property is present in project,
+     * the test will be run.
+     * @param propertyName the name of the property to look for.
+     */
     public void setIf(String propertyName) {
         ifProperty = propertyName;
     }
 
+    /**
+     * Set the unless attribute.
+     * If this property is present in project,
+     * the test will *not* be run.
+     * @param propertyName the name of the property to look for.
+     */
     public void setUnless(String propertyName) {
         unlessProperty = propertyName;
     }
 
+    /**
+     * Allow a formatter nested element.
+     * @param elem a formatter nested element.
+     */
     public void addFormatter(FormatterElement elem) {
         formatters.addElement(elem);
     }
 
     /**
      * Sets the destination directory.
+     * @param destDir the destination directory.
      */
     public void setTodir(File destDir) {
         this.destDir = destDir;
     }
 
     /**
+     * Get the destination directory.
      * @return the destination directory as an absolute path if it exists
      *         otherwise return <tt>null</tt>
      */
@@ -101,18 +153,36 @@
         return null;
     }
 
-    public java.lang.String getFailureProperty() {
+    /**
+     * Get the failure property name.
+     * @return the name of the property to set on failure.
+     */
+    public String getFailureProperty() {
         return failureProperty;
     }
 
+    /**
+     * Set the name of the failure property.
+     * @param failureProperty the name of the property to set if
+     *                        the test fails.
+     */
     public void setFailureProperty(String failureProperty) {
         this.failureProperty = failureProperty;
     }
 
-    public java.lang.String getErrorProperty() {
+    /**
+     * Get the failure property name.
+     * @return the name of the property to set on failure.
+     */
+    public String getErrorProperty() {
         return errorProperty;
     }
 
+    /**
+     * Set the name of the error property.
+     * @param errorProperty the name of the property to set if
+     *                      the test has an error.
+     */
     public void setErrorProperty(String errorProperty) {
         this.errorProperty = errorProperty;
     }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java?view=diff&rev=473108&r1=473107&r2=473108
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java Thu
Nov  9 14:39:14 2006
@@ -97,7 +97,7 @@
      * @return  an enumeration of all elements of this batchtest that are
      * a <tt>JUnitTest</tt> instance.
      */
-    public final Enumeration elements() {
+    public Enumeration elements() {
         JUnitTest[] tests = createAllJUnitTest();
         return Enumerations.fromArray(tests);
     }
@@ -108,7 +108,7 @@
      * @param v the vector to which should be added all individual tests of this
      * batch test.
      */
-    final void addTestsTo(Vector v) {
+    void addTestsTo(Vector v) {
         JUnitTest[] tests = createAllJUnitTest();
         v.ensureCapacity(v.size() + tests.length);
         for (int i = 0; i < tests.length; i++) {
@@ -168,7 +168,7 @@
      * @param filename the filename to "convert" to a classname.
      * @return the classname matching the filename.
      */
-    public static final String javaToClass(String filename) {
+    public static String javaToClass(String filename) {
         return filename.replace(File.separatorChar, '.').replace('/', '.')
             .replace('\\', '.');
     }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java?view=diff&rev=473108&r1=473107&r2=473108
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
Thu Nov  9 14:39:14 2006
@@ -93,6 +93,7 @@
     /**
      * @see JUnitResultFormatter#setSystemOutput(String)
      */
+    /** {@inheritDoc}. */
     public void setSystemOutput(String out) {
         systemOutput = out;
     }
@@ -100,6 +101,7 @@
     /**
      * @see JUnitResultFormatter#setSystemError(String)
      */
+    /** {@inheritDoc}. */
     public void setSystemError(String err) {
         systemError = err;
     }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java?view=diff&rev=473108&r1=473107&r2=473108
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java Thu
Nov  9 14:39:14 2006
@@ -60,6 +60,7 @@
      * @param   filter  the filter that children should match.
      * @param   recurse <tt>true</tt> if you want the list to be made recursively
      *                  otherwise <tt>false</tt>.
+     * @return the node list that matches the filter.
      */
     public static NodeList listChildNodes(Node parent, NodeFilter filter, boolean recurse)
{
         NodeListImpl matches = new NodeListImpl();
@@ -85,9 +86,18 @@
 
     /** custom implementation of a nodelist */
     public static class NodeListImpl extends Vector implements NodeList {
+        /**
+         * Get the number of nodes in the list.
+         * @return the length of the list.
+         */
         public int getLength() {
             return size();
         }
+        /**
+         * Get a particular node.
+         * @param i the index of the node to get.
+         * @return the node if the index is in bounds, null otherwise.
+         */
         public Node item(int i) {
             try {
                 return (Node) elementAt(i);
@@ -205,6 +215,7 @@
                 }
             }
         } catch (DOMException ignored) {
+            // Ignore
         }
 
         // bingo append it. (this should normally not be done here)

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java?view=diff&rev=473108&r1=473107&r2=473108
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java
Thu Nov  9 14:39:14 2006
@@ -59,10 +59,13 @@
     private String ifProperty;
     private String unlessProperty;
 
+    /** xml formatter class */
     public static final String XML_FORMATTER_CLASS_NAME =
         "org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter";
+    /** brief formatter class */
     public static final String BRIEF_FORMATTER_CLASS_NAME =
         "org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter";
+    /** plain formatter class */
     public static final String PLAIN_FORMATTER_CLASS_NAME =
         "org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter";
 
@@ -78,6 +81,7 @@
      *
      * <p> Sets <code>classname</code> attribute - so you can't use that
      * attribute if you use this one.
+     * @param type the enumerated value to use.
      */
     public void setType(TypeAttribute type) {
         if ("xml".equals(type.getValue())) {
@@ -95,6 +99,7 @@
      * <p> Set name of class to be used as the formatter.
      *
      * <p> This class must implement <code>JUnitResultFormatter</code>
+     * @param classname the name of the formatter class.
      */
     public void setClassname(String classname) {
         this.classname = classname;
@@ -109,15 +114,24 @@
 
     /**
      * Get name of class to be used as the formatter.
+     * @return the name of the class.
      */
     public String getClassname() {
         return classname;
     }
 
+    /**
+     * Set the extension to use for the report file.
+     * @param ext the extension to use.
+     */
     public void setExtension(String ext) {
         this.extension = ext;
     }
 
+    /**
+     * Get the extension used for the report file.
+     * @return the extension.
+     */
     public String getExtension() {
         return extension;
     }
@@ -135,6 +149,7 @@
      * <p> Set output stream for formatter to use.
      *
      * <p> Defaults to standard out.
+     * @param out the output stream to use.
      */
     public void setOutput(OutputStream out) {
         this.out = out;
@@ -142,6 +157,8 @@
 
     /**
      * Set whether the formatter should log to file.
+     * @param useFile if true use a file, if false send
+     *                to standard out.
      */
     public void setUseFile(boolean useFile) {
         this.useFile = useFile;
@@ -176,6 +193,8 @@
     /**
      * Ensures that the selector passes the conditions placed
      * on it with <code>if</code> and <code>unless</code> properties.
+     * @param t the task the this formatter is used in.
+     * @return true if the formatter should be used.
      */
     public boolean shouldUse(Task t) {
         if (ifProperty != null && t.getProject().getProperty(ifProperty) == null)
{
@@ -215,9 +234,13 @@
                 f = Class.forName(classname, true, loader);
             }
         } catch (ClassNotFoundException e) {
-            throw new BuildException("Using loader " + loader + " on class " + classname
+ ": " + e, e);
+            throw new BuildException(
+                "Using loader " + loader + " on class " + classname
+                + ": " + e, e);
         } catch (NoClassDefFoundError e) {
-            throw new BuildException("Using loader " + loader + " on class " + classname
+ ": " + e, e);
+            throw new BuildException(
+                "Using loader " + loader + " on class " + classname
+                + ": " + e, e);
         }
 
         Object o = null;
@@ -233,7 +256,8 @@
             throw new BuildException(classname
                 + " is not a JUnitResultFormatter");
         }
-        JUnitTaskMirror.JUnitResultFormatterMirror r = (JUnitTaskMirror.JUnitResultFormatterMirror)
o;
+        JUnitTaskMirror.JUnitResultFormatterMirror r =
+            (JUnitTaskMirror.JUnitResultFormatterMirror) o;
         if (useFile && outFile != null) {
             try {
                 out = new BufferedOutputStream(new FileOutputStream(outFile));
@@ -251,6 +275,7 @@
      * <p> Use to enumerate options for <code>type</code> attribute.
      */
     public static class TypeAttribute extends EnumeratedAttribute {
+        /** {@inheritDoc}. */
         public String[] getValues() {
             return new String[] {"plain", "xml", "brief"};
         }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitResultFormatter.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitResultFormatter.java?view=diff&rev=473108&r1=473107&r2=473108
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitResultFormatter.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitResultFormatter.java
Thu Nov  9 14:39:14 2006
@@ -27,29 +27,37 @@
  * testrun.
  *
  */
-public interface JUnitResultFormatter extends TestListener, JUnitTaskMirror.JUnitResultFormatterMirror
{
+public interface JUnitResultFormatter
+    extends TestListener, JUnitTaskMirror.JUnitResultFormatterMirror {
     /**
      * The whole testsuite started.
+     * @param suite the suite.
+     * @throws BuildException on error.
      */
     void startTestSuite(JUnitTest suite) throws BuildException;
 
     /**
      * The whole testsuite ended.
+     * @param suite the suite.
+     * @throws BuildException on error.
      */
     void endTestSuite(JUnitTest suite) throws BuildException;
 
     /**
      * Sets the stream the formatter is supposed to write its results to.
+     * @param out the output stream to use.
      */
     void setOutput(OutputStream out);
 
     /**
      * This is what the test has written to System.out
+     * @param out the string to write.
      */
     void setSystemOutput(String out);
 
     /**
      * This is what the test has written to System.err
+     * @param err the string to write.
      */
     void setSystemError(String err);
 }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java?view=diff&rev=473108&r1=473107&r2=473108
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java Thu
Nov  9 14:39:14 2006
@@ -293,7 +293,7 @@
      * haltonfailure, errorproperty, failureproperty and filtertrace
      * can share a forked Java VM, so even if you set the value to
      * "once", Ant may need to fork mutliple VMs.</p>
-     *
+     * @param mode the mode to use.
      * @since Ant 1.6.2
      */
     public void setForkMode(ForkMode mode) {
@@ -618,7 +618,7 @@
      * a bootclaspath.
      *
      * <p>Doesn't have any effect unless fork is true.</p>
-     *
+     * @param cloneVm a <code>boolean</code> value.
      * @since Ant 1.7
      */
     public void setCloneVm(boolean cloneVm) {
@@ -822,6 +822,8 @@
 
     /**
      * Execute a list of tests in a single forked Java VM.
+     * @param tests the list of tests to execute.
+     * @throws BuildException on error.
      */
     protected void execute(List tests) throws BuildException {
         JUnitTest test = null;
@@ -1088,7 +1090,16 @@
     }
 
     /**
+     * Handle an input request by this task.
      * @see Task#handleInput(byte[], int, int)
+     * This implementation delegates to a runner if it
+     * present.
+     * @param buffer the buffer into which data is to be read.
+     * @param offset the offset into the buffer at which data is stored.
+     * @param length the amount of data to read.
+     *
+     * @return the number of bytes read.
+     * @exception IOException if the data cannot be read.
      *
      * @since Ant 1.6
      */
@@ -1380,7 +1391,11 @@
      */
 
     private void logTimeout(FormatterElement[] feArray, JUnitTest test, String testCase)
{
-        logVmExit(feArray, test, "Timeout occurred. Please note the time in the report does
not reflect the time until the timeout.", testCase);
+        logVmExit(
+            feArray, test,
+            "Timeout occurred. Please note the time in the report does"
+            + " not reflect the time until the timeout.",
+            testCase);
     }
 
     /**
@@ -1391,7 +1406,11 @@
      * @since Ant 1.7
      */
     private void logVmCrash(FormatterElement[] feArray, JUnitTest test, String testCase)
{
-        logVmExit(feArray, test, "Forked Java VM exited abnormally. Please note the time
in the report does not reflect the time until the VM exit.", testCase);
+        logVmExit(
+            feArray, test,
+            "Forked Java VM exited abnormally. Please note the time in the report"
+            + " does not reflect the time until the VM exit.",
+            testCase);
     }
 
     /**
@@ -1491,6 +1510,8 @@
     }
 
     /**
+     * Get the command line used to run the tests.
+     * @return the command line.
      * @since Ant 1.6.2
      */
     protected CommandlineJava getCommandline() {
@@ -1596,15 +1617,21 @@
          */
         public static final String PER_BATCH = "perBatch";
 
+        /** No arg constructor. */
         public ForkMode() {
             super();
         }
 
+        /**
+         * Constructor using a value.
+         * @param value the value to use - once, perTest or perBatch.
+         */
         public ForkMode(String value) {
             super();
             setValue(value);
         }
 
+        /** {@inheritDoc}. */
         public String[] getValues() {
             return new String[] {ONCE, PER_TEST, PER_BATCH};
         }
@@ -1615,7 +1642,9 @@
      * if the runIndividual argument is true.  Returns a collection of
      * lists of tests that share the same VM configuration and haven't
      * been executed yet.
-     *
+     * @param testList the list of tests to be executed or queued.
+     * @param runIndividual if true execute each test individually.
+     * @return a list of tasks to be executed.
      * @since 1.6.2
      */
     protected Collection executeOrQueue(Enumeration testList,
@@ -1645,7 +1674,10 @@
      * Logs information about failed tests, potentially stops
      * processing (by throwing a BuildException) if a failure/error
      * occurred or sets a property.
-     *
+     * @param exitValue the exitValue of the test.
+     * @param wasKilled if true, the test had been killed.
+     * @param test      the test in question.
+     * @param name      the name of the test.
      * @since Ant 1.6.2
      */
     protected void actOnTestResult(int exitValue, boolean wasKilled,
@@ -1660,7 +1692,9 @@
      * Logs information about failed tests, potentially stops
      * processing (by throwing a BuildException) if a failure/error
      * occurred or sets a property.
-     *
+     * @param result    the result of the test.
+     * @param test      the test in question.
+     * @param name      the name of the test.
      * @since Ant 1.7
      */
     protected void actOnTestResult(TestResultHolder result, JUnitTest test,
@@ -1692,23 +1726,44 @@
         }
     }
 
+    /**
+     * A value class that contains thee result of a test.
+     */
     protected class TestResultHolder {
+        // CheckStyle:VisibilityModifier OFF - bc
+        /** the exit code of the test. */
         public int exitCode = JUnitTaskMirror.JUnitTestRunnerMirror.ERRORS;
+        /** true if the test timed out */
         public boolean timedOut = false;
+        /** true if the test crashed */
         public boolean crashed = false;
+        // CheckStyle:VisibilityModifier ON
     }
 
     /**
+     * A stream handler for handling the junit task.
      * @since Ant 1.7
      */
     protected static class JUnitLogOutputStream extends LogOutputStream {
         private Task task; // local copy since LogOutputStream.task is private
 
+        /**
+         * Constructor.
+         * @param task the task being logged.
+         * @param level the log level used to log data written to this stream.
+         */
         public JUnitLogOutputStream(Task task, int level) {
             super(task, level);
             this.task = task;
         }
 
+        /**
+         * Logs a line.
+         * If the line starts with junit.framework.TestListener: set the level
+         * to MSG_VERBOSE.
+         * @param line the line to log.
+         * @param level the logging level to use.
+         */
         protected void processLine(String line, int level) {
             if (line.startsWith(TESTLISTENER_PREFIX)) {
                 task.log(line, Project.MSG_VERBOSE);
@@ -1719,9 +1774,16 @@
     }
 
     /**
+     * A log stream handler for junit.
      * @since Ant 1.7
      */
     protected static class JUnitLogStreamHandler extends PumpStreamHandler {
+        /**
+         * Constructor.
+         * @param task the task to log.
+         * @param outlevel the level to use for standard output.
+         * @param errlevel the level to use for error output.
+         */
         public JUnitLogStreamHandler(Task task, int outlevel, int errlevel) {
             super(new JUnitLogOutputStream(task, outlevel),
                   new LogOutputStream(task, errlevel));

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskMirror.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskMirror.java?view=diff&rev=473108&r1=473107&r2=473108
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskMirror.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskMirror.java
Thu Nov  9 14:39:14 2006
@@ -40,27 +40,61 @@
  */
 public interface JUnitTaskMirror {
 
+    /**
+     * Add the formatter to be called when the jvm exits before
+     * the test suite finishs.
+     * @param test the test.
+     * @param formatter the fomatter to use.
+     * @param out the output stream to use.
+     * @param message the message to write out.
+     * @param testCase the name of the test.
+     */
     void addVmExit(JUnitTest test, JUnitResultFormatterMirror formatter,
             OutputStream out, String message, String testCase);
 
+    /**
+     * Create a new test runner for a test.
+     * @param test the test to run.
+     * @param haltOnError if true halt the tests if an error occurs.
+     * @param filterTrace if true filter the stack traces.
+     * @param haltOnFailure if true halt the test if a failure occurs.
+     * @param showOutput    if true show output.
+     * @param logTestListenerEvents if true log test listener events.
+     * @param classLoader      the classloader to use to create the runner.
+     * @return the test runner.
+     */
     JUnitTestRunnerMirror newJUnitTestRunner(JUnitTest test, boolean haltOnError,
             boolean filterTrace, boolean haltOnFailure, boolean showOutput,
             boolean logTestListenerEvents, AntClassLoader classLoader);
 
+    /**
+     * Create a summary result formatter.
+     * @return the created formatter.
+     */
     SummaryJUnitResultFormatterMirror newSummaryJUnitResultFormatter();
 
-    public interface JUnitResultFormatterMirror {
 
+    /** The interface that JUnitResultFormatter extends. */
+    public interface JUnitResultFormatterMirror {
+        /**
+         * Set the output stream.
+         * @param outputStream the stream to use.
+         */
         void setOutput(OutputStream outputStream);
-
     }
 
-    public interface SummaryJUnitResultFormatterMirror extends JUnitResultFormatterMirror
{
+    /** The interface that SummaryJUnitResultFormatter extends. */
+    public interface SummaryJUnitResultFormatterMirror
+        extends JUnitResultFormatterMirror {
 
+        /**
+         * Set where standard out and standard error should be included.
+         * @param value if true include the outputs in the summary.
+         */
         void setWithOutAndErr(boolean value);
-
     }
 
+    /** Interface that test runners implement. */
     public interface JUnitTestRunnerMirror {
 
         /**
@@ -87,12 +121,26 @@
          */
         int ERRORS = 2;
 
+        /**
+         * Permissions for the test run.
+         * @param perm the permissions to use.
+         */
         void setPermissions(Permissions perm);
 
+        /** Run the test. */
         void run();
 
+        /**
+         * Add a formatter to the test.
+         * @param formatter the formatter to use.
+         */
         void addFormatter(JUnitResultFormatterMirror formatter);
 
+        /**
+         * Returns what System.exit() would return in the standalone version.
+         *
+         * @return 2 if errors occurred, 1 if tests failed else 0.
+         */
         int getRetCode();
 
         void handleErrorFlush(String output);

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java?view=diff&rev=473108&r1=473107&r2=473108
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
Thu Nov  9 14:39:14 2006
@@ -543,7 +543,7 @@
     /**
      * Permissions for the test run.
      * @since Ant 1.6
-     * @param permissions
+     * @param permissions the permissions to use.
      */
     public void setPermissions(Permissions permissions) {
         perm = permissions;
@@ -689,7 +689,8 @@
             } else if (args[i].startsWith(Constants.SHOWOUTPUT)) {
                 showOut = Project.toBoolean(args[i].substring(Constants.SHOWOUTPUT.length()));
             } else if (args[i].startsWith(Constants.LOGTESTLISTENEREVENTS)) {
-                logTestListenerEvents = Project.toBoolean(args[i].substring(Constants.LOGTESTLISTENEREVENTS.length()));
+                logTestListenerEvents = Project.toBoolean(
+                    args[i].substring(Constants.LOGTESTLISTENEREVENTS.length()));
             } else if (args[i].startsWith(Constants.OUTPUT_TO_FORMATTERS)) {
                 outputToFormat = Project.toBoolean(
                     args[i].substring(Constants.OUTPUT_TO_FORMATTERS.length()));
@@ -828,6 +829,8 @@
     /**
      * Returns a filtered stack trace.
      * This is ripped out of junit.runner.BaseTestRunner.
+     * @param t the exception to filter.
+     * @return the filtered stack trace.
      */
     public static String getFilteredTrace(Throwable t) {
         String trace = StringUtils.getStackTrace(t);
@@ -836,6 +839,7 @@
 
     /**
      * Filters stack frames from internal JUnit and Ant classes
+     * @param stack the stack trace to filter.
      */
     public static String filterStack(String stack) {
         if (!filtertrace) {
@@ -936,7 +940,8 @@
         return new TestListener() {
             public void addError(Test test, Throwable t) {
                 if (junit4 && t instanceof AssertionFailedError) {
-                    // JUnit 4 does not distinguish between errors and failures even in the
JUnit 3 adapter.
+                    // JUnit 4 does not distinguish between errors and failures
+                    // even in the JUnit 3 adapter.
                     // So we need to help it a bit to retain compatibility for JUnit 3 tests.
                     testListener.addFailure(test, (AssertionFailedError) t);
                 } else if (junit4 && t.getClass().getName().equals("java.lang.AssertionError"))
{
@@ -949,7 +954,8 @@
                         AssertionFailedError failure = msg != null
                             ? new AssertionFailedError(msg) : new AssertionFailedError();
                         // To compile on pre-JDK 4 (even though this should always succeed):
-                        Method initCause = Throwable.class.getMethod("initCause", new Class[]
{Throwable.class});
+                        Method initCause = Throwable.class.getMethod(
+                            "initCause", new Class[] {Throwable.class});
                         initCause.invoke(failure, new Object[] {t});
                         testListener.addFailure(test, failure);
                     } catch (Exception e) {
@@ -996,7 +1002,8 @@
         e = res.errors();
         while (e.hasMoreElements()) {
             Throwable t = ((TestFailure) e.nextElement()).thrownException();
-            if (t instanceof AssertionFailedError || t.getClass().getName().equals("java.lang.AssertionError"))
{
+            if (t instanceof AssertionFailedError
+                || t.getClass().getName().equals("java.lang.AssertionError")) {
                 failures++;
             } else {
                 errors++;

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java?view=diff&rev=473108&r1=473107&r2=473108
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java
Thu Nov  9 14:39:14 2006
@@ -54,6 +54,8 @@
      *
      * <p>Since Ant 1.7 also checks for JUnit4TestCaseFacade explicitly.
      * This is used by junit.framework.JUnit4TestAdapter.</p>
+     * @param t the test.
+     * @return the name of the test.
      */
     public static String getTestCaseName(Test t) {
         if (t != null && t.getClass().getName().equals("junit.framework.JUnit4TestCaseFacade"))
{

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java?view=diff&rev=473108&r1=473107&r2=473108
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java
Thu Nov  9 14:39:14 2006
@@ -68,19 +68,23 @@
     private String systemOutput = null;
     private String systemError = null;
 
+    /** No arg constructor */
     public PlainJUnitResultFormatter() {
         inner = new StringWriter();
         wri = new PrintWriter(inner);
     }
 
+    /** {@inheritDoc}. */
     public void setOutput(OutputStream out) {
         this.out = out;
     }
 
+    /** {@inheritDoc}. */
     public void setSystemOutput(String out) {
         systemOutput = out;
     }
 
+    /** {@inheritDoc}. */
     public void setSystemError(String err) {
         systemError = err;
     }
@@ -161,6 +165,7 @@
      * Interface TestListener.
      *
      * <p>A new Test is started.
+     * @param t the test.
      */
     public void startTest(Test t) {
         testStarts.put(t, new Long(System.currentTimeMillis()));
@@ -171,6 +176,7 @@
      * Interface TestListener.
      *
      * <p>A Test is finished.
+     * @param t the test.
      */
     public void endTest(Test test) {
         if (Boolean.TRUE.equals(failed.get(test))) {
@@ -195,6 +201,8 @@
      * Interface TestListener for JUnit &lt;= 3.4.
      *
      * <p>A Test failed.
+     * @param test the test.
+     * @param t the exception.
      */
     public void addFailure(Test test, Throwable t) {
         formatError("\tFAILED", test, t);
@@ -204,6 +212,8 @@
      * Interface TestListener for JUnit &gt; 3.4.
      *
      * <p>A Test failed.
+     * @param test the test.
+     * @param t  the assertion that failed.
      */
     public void addFailure(Test test, AssertionFailedError t) {
         addFailure(test, (Throwable) t);
@@ -213,6 +223,8 @@
      * Interface TestListener.
      *
      * <p>An error occurred while running the test.
+     * @param test the test.
+     * @param t    the exception.
      */
     public void addError(Test test, Throwable t) {
         formatError("\tCaused an ERROR", test, t);

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java?view=diff&rev=473108&r1=473107&r2=473108
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
Thu Nov  9 14:39:14 2006
@@ -30,7 +30,9 @@
  *
  */
 
-public class SummaryJUnitResultFormatter implements JUnitResultFormatter, JUnitTaskMirror.SummaryJUnitResultFormatterMirror
{
+public class SummaryJUnitResultFormatter
+    implements JUnitResultFormatter
+    ,JUnitTaskMirror.SummaryJUnitResultFormatterMirror {
 
     /**
      * Formatter for timings.

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java?view=diff&rev=473108&r1=473107&r2=473108
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java
Thu Nov  9 14:39:14 2006
@@ -57,6 +57,7 @@
  */
 public class XMLResultAggregator extends Task implements XMLConstants {
 
+    // CheckStyle:VisibilityModifier OFF - bc
     /** the list of all filesets, that should contains the xml to aggregate */
     protected Vector filesets = new Vector();
 
@@ -80,15 +81,19 @@
     /**
      * text checked for in tests, {@value}
      */
-    static final String WARNING_IS_POSSIBLY_CORRUPTED = " is not a valid XML document. It
is possibly corrupted.";
+    static final String WARNING_IS_POSSIBLY_CORRUPTED
+        = " is not a valid XML document. It is possibly corrupted.";
     /**
      * text checked for in tests, {@value}
      */
-    static final String WARNING_INVALID_ROOT_ELEMENT = " is not a valid testsuite XML document";
+    static final String WARNING_INVALID_ROOT_ELEMENT
+        = " is not a valid testsuite XML document";
     /**
      * text checked for in tests, {@value}
      */
-    static final String WARNING_EMPTY_FILE = " is empty.\nThis can be caused by the test
JVM exiting unexpectedly";
+    static final String WARNING_EMPTY_FILE
+        = " is empty.\nThis can be caused by the test JVM exiting unexpectedly";
+    // CheckStyle:VisibilityModifier ON
 
     /**
      * Generate a report based on the document created by the merge.

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java?view=diff&rev=473108&r1=473107&r2=473108
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java
Thu Nov  9 14:39:14 2006
@@ -38,33 +38,35 @@
  */
 public class Xalan2Executor extends XalanExecutor {
 
-    private static final String aPack = "org.apache.xalan.";
-    private static final String sPack = "com.sun.org.apache.xalan.";
+    private static final String APAC = "org.apache.xalan.";
+    private static final String SPAC = "com.sun.org.apache.xalan.";
 
     private TransformerFactory tfactory = TransformerFactory.newInstance();
 
+    /** {@inheritDoc}. */
     protected String getImplementation() throws BuildException {
         return tfactory.getClass().getName();
     }
 
+    /** {@inheritDoc}. */
     protected String getProcVersion(String classNameImpl)
         throws BuildException {
         try {
             // xalan 2
-            if (classNameImpl.equals(aPack + "processor.TransformerFactoryImpl")
+            if (classNameImpl.equals(APAC + "processor.TransformerFactoryImpl")
                 ||
-                classNameImpl.equals(aPack + "xslt.XSLTProcessorFactory")) {
-                return getXalanVersion(aPack + "processor.XSLProcessorVersion");
+                classNameImpl.equals(APAC + "xslt.XSLTProcessorFactory")) {
+                return getXalanVersion(APAC + "processor.XSLProcessorVersion");
             }
             // xalan xsltc
-            if (classNameImpl.equals(aPack
+            if (classNameImpl.equals(APAC
                                      + "xsltc.trax.TransformerFactoryImpl")) {
-                return getXSLTCVersion(aPack + "xsltc.ProcessorVersion");
+                return getXSLTCVersion(APAC + "xsltc.ProcessorVersion");
             }
             // jdk 1.5 xsltc
             if (classNameImpl
-                .equals(sPack + "internal.xsltc.trax.TransformerFactoryImpl")) {
-                return getXSLTCVersion(sPack
+                .equals(SPAC + "internal.xsltc.trax.TransformerFactoryImpl")) {
+                return getXSLTCVersion(SPAC
                                        + "internal.xsltc.ProcessorVersion");
             }
             throw new BuildException("Could not find a valid processor version"
@@ -76,16 +78,17 @@
         }
     }
 
+    /** {@inheritDoc}. */
     void execute() throws Exception {
-        String system_id = caller.getStylesheetSystemId();
-        Source xsl_src = new StreamSource(system_id);
-        Transformer tformer = tfactory.newTransformer(xsl_src);
-        Source xml_src = new DOMSource(caller.document);
+        String systemId = caller.getStylesheetSystemId();
+        Source xslSrc = new StreamSource(systemId);
+        Transformer tformer = tfactory.newTransformer(xslSrc);
+        Source xmlSrc = new DOMSource(caller.document);
         OutputStream os = getOutputStream();
         try {
             tformer.setParameter("output.dir", caller.toDir.getAbsolutePath());
             Result result = new StreamResult(os);
-            tformer.transform(xml_src, result);
+            tformer.transform(xmlSrc, result);
         } finally {
             os.close();
         }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java?view=diff&rev=473108&r1=473107&r2=473108
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java
Thu Nov  9 14:39:14 2006
@@ -37,8 +37,10 @@
     private static final String PACKAGE =
         "org.apache.tools.ant.taskdefs.optional.junit.";
 
+    // CheckStyle:VisibilityModifier OFF - bc
     /** the transformer caller */
     protected AggregateTransformer caller;
+    // CheckStyle:VisibilityModifier ON
 
     /** set the caller for this object. */
     private void setCaller(AggregateTransformer caller) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message