ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sbaill...@apache.org
Subject cvs commit: jakarta-ant/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/junit ServerElement.java ClientElement.java FormatterElement.java TestElement.java
Date Sun, 27 Jan 2002 14:06:39 GMT
sbailliez    02/01/27 06:06:39

  Modified:    proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/junit
                        ServerElement.java ClientElement.java
                        FormatterElement.java TestElement.java
  Log:
  Fix early initialization problems.
  I was using elements before they were configured.
  
  Revision  Changes    Path
  1.3       +6 -5      jakarta-ant/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/junit/ServerElement.java
  
  Index: ServerElement.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/junit/ServerElement.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServerElement.java	27 Jan 2002 11:39:52 -0000	1.2
  +++ ServerElement.java	27 Jan 2002 14:06:39 -0000	1.3
  @@ -76,7 +76,7 @@
   public final class ServerElement extends ProjectComponent {
   
       /** formatters that write the tests results */
  -    private Vector formatters = new Vector();
  +    private Vector formatterElements = new Vector();
   
       /** port to run the server on. Default to 6666 */
       private int port = 6666;
  @@ -99,9 +99,11 @@
       public void execute() throws BuildException {
           // configure the server...
           Server server = new Server(port);
  -        Enumeration listeners = formatters.elements();
  +        Enumeration listeners = formatterElements.elements();
           while (listeners.hasMoreElements()) {
  -            server.addListener((TestRunListener) listeners.nextElement());
  +            FormatterElement fe = (FormatterElement)listeners.nextElement();
  +            Formatter formatter = fe.createFormatter();
  +            server.addListener( formatter );
           }
           // and run it. It will stop once a client has finished.
           server.start();
  @@ -125,7 +127,6 @@
   
       /** add a new formatter element */
       public void addFormatter(FormatterElement fe) {
  -        Formatter f = fe.createFormatter();
  -        formatters.addElement(f);
  +        formatterElements.addElement(fe);
       }
   }
  
  
  
  1.3       +2 -2      jakarta-ant/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/junit/ClientElement.java
  
  Index: ClientElement.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/junit/ClientElement.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ClientElement.java	27 Jan 2002 11:39:52 -0000	1.2
  +++ ClientElement.java	27 Jan 2002 14:06:39 -0000	1.3
  @@ -127,7 +127,7 @@
           // must appended to classpath to avoid conflicts.
           JUnitHelper.addClasspathEntry(createClasspath(), "/junit/framework/TestCase.class");
           JUnitHelper.addClasspathEntry(createClasspath(), "/org/apache/tools/ant/Task.class");
  -        JUnitHelper.addClasspathEntry(createClasspath(), "/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.class");
  +        JUnitHelper.addClasspathEntry(createClasspath(), "/org/apache/tools/ant/taskdefs/optional/junit/remote/TestRunner.class");
       }
   
       protected void doExecute() throws BuildException {
  @@ -161,7 +161,7 @@
               TestCollector te = (TestCollector) testCollectors.elementAt(i);
               tests[i] = te.collectTests();
           }
  -        return Enumerations.fromCompound(tests);
  +        return new CompoundEnumeration(tests);
       }
   
       /**
  
  
  
  1.8       +17 -4     jakarta-ant/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java
  
  Index: FormatterElement.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FormatterElement.java	27 Jan 2002 11:39:52 -0000	1.7
  +++ FormatterElement.java	27 Jan 2002 14:06:39 -0000	1.8
  @@ -54,6 +54,7 @@
   package org.apache.tools.ant.taskdefs.optional.junit;
   
   import java.io.OutputStream;
  +import java.io.File;
   import java.util.Properties;
   import java.util.StringTokenizer;
   import java.util.Vector;
  @@ -62,6 +63,7 @@
   import org.apache.tools.ant.taskdefs.optional.junit.formatter.BriefFormatter;
   import org.apache.tools.ant.taskdefs.optional.junit.formatter.Formatter;
   import org.apache.tools.ant.taskdefs.optional.junit.formatter.XMLFormatter;
  +import org.apache.tools.ant.taskdefs.optional.junit.formatter.PlainFormatter;
   import org.apache.tools.ant.types.EnumeratedAttribute;
   
   /**
  @@ -92,7 +94,7 @@
       private Vector filters = new Vector();
   
       /** the parameters set for configuration purposes */
  -    private Properties params = new Properties();
  +    private Vector params = new Vector();
   
       /**
        * set an existing type of formatter.
  @@ -139,7 +141,7 @@
        * Add a parameter that can be used for configuration.
        */
       public void addParam(Parameter param) {
  -        params.setProperty(param.getName(), param.getValue());
  +        params.addElement(param);
       }
   
       /**
  @@ -174,9 +176,16 @@
               FilterElement fe = (FilterElement) filters.elementAt(i);
               f = fe.createFilterFormatter(f);
           }
  +
  +        // create properties from parameters
  +        Properties props = new Properties();
  +        for (int i = 0; i < params.size(); i++){
  +            Parameter param = (Parameter)params.elementAt(i);
  +            props.put(param.getName(), param.getValue());
  +        }
           // it is assumed here that the filters are chaining til the
           // wrapped formatter.
  -        f.init(params);
  +        f.init(props);
           return f;
       }
   
  @@ -186,7 +195,7 @@
        */
       public final static class TypeAttribute extends EnumeratedAttribute {
           private final static String[] VALUES = {"plain", "xml", "brief"};
  -        private final static String[] CLASSNAMES = {"xxx", XMLFormatter.class.getName(),
BriefFormatter.class.getName()};
  +        private final static String[] CLASSNAMES = {PlainFormatter.class.getName(), XMLFormatter.class.getName(),
BriefFormatter.class.getName()};
   
           public String[] getValues() {
               return VALUES;
  @@ -204,6 +213,10 @@
   
           public void setName(String name) {
               this.name = name;
  +        }
  +
  +        public void setLocation(File file) {
  +            setValue(file.getAbsolutePath());
           }
   
           public void setValue(String value) {
  
  
  
  1.4       +1 -1      jakarta-ant/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/junit/TestElement.java
  
  Index: TestElement.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/junit/TestElement.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestElement.java	13 Jan 2002 23:40:11 -0000	1.3
  +++ TestElement.java	27 Jan 2002 14:06:39 -0000	1.4
  @@ -70,7 +70,7 @@
   //@fixme, a path is needed for a test.
   
       public Enumeration collectTests() {
  -        return Enumerations.fromArray(new String[]{name});
  +        return new ArrayEnumeration(new String[]{name});
       }
   
   // Ant bean setters
  
  
  

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


Mime
View raw message