View | Details | Raw Unified | Return to bug 32975
Collapse All | Expand All

(-)BriefJUnitResultFormatter.java (+14 lines)
Lines 69-74 Link Here
69
     */
69
     */
70
    private String systemError = null;
70
    private String systemError = null;
71
71
72
    private boolean verbose = true;
73
    
72
    /**
74
    /**
73
     * Constructor for BriefJUnitResultFormatter.
75
     * Constructor for BriefJUnitResultFormatter.
74
     */
76
     */
Lines 246-249 Link Here
246
        resultWriter.println(strace);
248
        resultWriter.println(strace);
247
        resultWriter.println();
249
        resultWriter.println();
248
    }
250
    }
251
	/**
252
	 * @return Returns the verbose.
253
	 */
254
	public boolean isVerbose() {
255
		return verbose;
256
	}
257
	/**
258
	 * @param verbose The verbose to set.
259
	 */
260
	public void setVerbose(boolean verbose) {
261
		this.verbose = verbose;
262
	}
249
}
263
}
(-)FormatterElement.java (-1 / +15 lines)
Lines 55-60 Link Here
55
    private boolean useFile = true;
55
    private boolean useFile = true;
56
    private String ifProperty;
56
    private String ifProperty;
57
    private String unlessProperty;
57
    private String unlessProperty;
58
    private boolean verbose;
58
59
59
    public static final String XML_FORMATTER_CLASS_NAME =
60
    public static final String XML_FORMATTER_CLASS_NAME =
60
        "org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter";
61
        "org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter";
Lines 120-126 Link Here
120
    }
121
    }
121
122
122
    /**
123
    /**
123
     * <p> Set the file which the formatte should log to.
124
     * <p> Set the file which the formatter should log to.
124
     *
125
     *
125
     * <p> Note that logging to file must be enabled .
126
     * <p> Note that logging to file must be enabled .
126
     */
127
     */
Lines 237-242 Link Here
237
            }
238
            }
238
        }
239
        }
239
        r.setOutput(out);
240
        r.setOutput(out);
241
        r.setVerbose(this.verbose);
240
        return r;
242
        return r;
241
    }
243
    }
242
244
Lines 250-253 Link Here
250
            return new String[] {"plain", "xml", "brief"};
252
            return new String[] {"plain", "xml", "brief"};
251
        }
253
        }
252
    }
254
    }
255
	/**
256
	 * @return Returns the verbose.
257
	 */
258
	public boolean getVerbose() {
259
		return verbose;
260
	}
261
	/**
262
	 * @param verbose The verbose to set.
263
	 */
264
	public void setVerbose(final boolean verbose) {
265
		this.verbose = verbose;
266
	}
253
}
267
}
(-)JUnitResultFormatter.java (+7 lines)
Lines 51-54 Link Here
51
     * This is what the test has written to System.err
51
     * This is what the test has written to System.err
52
     */
52
     */
53
    void setSystemError(String err);
53
    void setSystemError(String err);
54
    
55
    /**
56
     * Set to write out all property info within Formatter
57
     * Currently useful for XMLJUnitFormatter
58
     * @param verbose
59
     */
60
    void setVerbose(boolean verbose);
54
}
61
}
(-)JUnitTask.java (-2 / +4 lines)
Lines 59-65 Link Here
59
/**
59
/**
60
 * Runs JUnit tests.
60
 * Runs JUnit tests.
61
 *
61
 *
62
 * <p> JUnit is a framework to create unit test. It has been initially
62
 * <p> JUnit is a framework to create unit test. It was initially
63
 * created by Erich Gamma and Kent Beck.  JUnit can be found at <a
63
 * created by Erich Gamma and Kent Beck.  JUnit can be found at <a
64
 * href="http://www.junit.org">http://www.junit.org</a>.
64
 * href="http://www.junit.org">http://www.junit.org</a>.
65
 *
65
 *
Lines 152-158 Link Here
152
    private static final int STRING_BUFFER_SIZE = 128;
152
    private static final int STRING_BUFFER_SIZE = 128;
153
153
154
    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
154
    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
155
155
   
156
    /**
156
    /**
157
     * If true, force ant to re-classload all classes for each JUnit TestCase
157
     * If true, force ant to re-classload all classes for each JUnit TestCase
158
     *
158
     *
Lines 838-843 Link Here
838
            if (fe.shouldUse(this)) {
838
            if (fe.shouldUse(this)) {
839
                formatterArg.append("formatter=");
839
                formatterArg.append("formatter=");
840
                formatterArg.append(fe.getClassname());
840
                formatterArg.append(fe.getClassname());
841
                formatterArg.append(",");
842
                formatterArg.append("verbose="+String.valueOf(fe.getVerbose()));
841
                File outFile = getOutput(fe, test);
843
                File outFile = getOutput(fe, test);
842
                if (outFile != null) {
844
                if (outFile != null) {
843
                    formatterArg.append(",");
845
                    formatterArg.append(",");
(-)JUnitTestRunner.java (-9 / +21 lines)
Lines 33-43 Link Here
33
import java.util.Properties;
33
import java.util.Properties;
34
import java.util.StringTokenizer;
34
import java.util.StringTokenizer;
35
import java.util.Vector;
35
import java.util.Vector;
36
36
import junit.framework.AssertionFailedError;
37
import junit.framework.AssertionFailedError;
37
import junit.framework.Test;
38
import junit.framework.Test;
38
import junit.framework.TestListener;
39
import junit.framework.TestListener;
39
import junit.framework.TestResult;
40
import junit.framework.TestResult;
40
import junit.framework.TestSuite;
41
import junit.framework.TestSuite;
42
41
import org.apache.tools.ant.BuildException;
43
import org.apache.tools.ant.BuildException;
42
import org.apache.tools.ant.Project;
44
import org.apache.tools.ant.Project;
43
import org.apache.tools.ant.types.Permissions;
45
import org.apache.tools.ant.types.Permissions;
Lines 589-604 Link Here
589
    private static void createAndStoreFormatter(String line)
591
    private static void createAndStoreFormatter(String line)
590
        throws BuildException {
592
        throws BuildException {
591
        FormatterElement fe = new FormatterElement();
593
        FormatterElement fe = new FormatterElement();
592
        int pos = line.indexOf(',');
594
        
593
        if (pos == -1) {
595
        StringTokenizer st = new StringTokenizer(line, ",");
594
            fe.setClassname(line);
596
        if (st.countTokens()==1) {
597
        	fe.setClassname(line);
595
            fe.setUseFile(false);
598
            fe.setUseFile(false);
596
        } else {
599
        } else if (st.countTokens()==2) {
597
            fe.setClassname(line.substring(0, pos));
600
        	fe.setClassname(st.nextToken());
598
            fe.setUseFile(true);
601
        	String param = st.nextToken();
599
            if (!multipleTests) {
602
        	if (param.contains("verbose")) {
600
                fe.setOutfile(new File(line.substring(pos + 1)));
603
        		fe.setVerbose(Boolean.valueOf(param.substring(8,param.length())).booleanValue());
601
            }
604
        	} else { //file param
605
        		fe.setUseFile(true);
606
        		fe.setOutfile(new File(param));
607
        	}
608
        } else if (st.countTokens()==3) {
609
        	fe.setClassname(st.nextToken());
610
        	String param = st.nextToken();
611
        	fe.setVerbose(Boolean.valueOf(param.substring(8,param.length())).booleanValue());
612
        	fe.setUseFile(true);
613
        	fe.setOutfile(new File(st.nextToken()));
602
        }
614
        }
603
        fromCmdLine.addElement(fe);
615
        fromCmdLine.addElement(fe);
604
    }
616
    }
(-)PlainJUnitResultFormatter.java (+14 lines)
Lines 59-64 Link Here
59
     * Suppress endTest if testcase failed.
59
     * Suppress endTest if testcase failed.
60
     */
60
     */
61
    private Hashtable failed = new Hashtable();
61
    private Hashtable failed = new Hashtable();
62
    
63
    private boolean verbose = true;
62
64
63
    private String systemOutput = null;
65
    private String systemOutput = null;
64
    private String systemError = null;
66
    private String systemError = null;
Lines 234-237 Link Here
234
        }
236
        }
235
    }
237
    }
236
238
239
	/**
240
	 * @return Returns the verbose.
241
	 */
242
	public boolean isVerbose() {
243
		return verbose;
244
	}
245
	/**
246
	 * @param verbose The verbose to set.
247
	 */
248
	public void setVerbose(boolean verbose) {
249
		this.verbose = verbose;
250
	}
237
} // PlainJUnitResultFormatter
251
} // PlainJUnitResultFormatter
(-)SummaryJUnitResultFormatter.java (+13 lines)
Lines 43-48 Link Here
43
    private boolean withOutAndErr = false;
43
    private boolean withOutAndErr = false;
44
    private String systemOutput = null;
44
    private String systemOutput = null;
45
    private String systemError = null;
45
    private String systemError = null;
46
    private boolean verbose = true;
46
47
47
    /**
48
    /**
48
     * Empty
49
     * Empty
Lines 146-149 Link Here
146
            }
147
            }
147
        }
148
        }
148
    }
149
    }
150
	/**
151
	 * @return Returns the verbose.
152
	 */
153
	public boolean isVerbose() {
154
		return verbose;
155
	}
156
	/**
157
	 * @param verbose The verbose to set.
158
	 */
159
	public void setVerbose(boolean verbose) {
160
		this.verbose = verbose;
161
	}
149
}
162
}
(-)XMLJUnitResultFormatter.java (-11 / +28 lines)
Lines 82-87 Link Here
82
     */
82
     */
83
    private OutputStream out;
83
    private OutputStream out;
84
84
85
    private boolean verbose;
86
    
85
    public XMLJUnitResultFormatter() {
87
    public XMLJUnitResultFormatter() {
86
    }
88
    }
87
89
Lines 115-130 Link Here
115
        // Output properties
117
        // Output properties
116
        Element propsElement = doc.createElement(PROPERTIES);
118
        Element propsElement = doc.createElement(PROPERTIES);
117
        rootElement.appendChild(propsElement);
119
        rootElement.appendChild(propsElement);
118
        Properties props = suite.getProperties();
120
        System.out.println("XML verbose: "+ this.verbose);
119
        if (props != null) {
121
        if (verbose) {
120
            Enumeration e = props.propertyNames();
122
        	Properties props = suite.getProperties();
121
            while (e.hasMoreElements()) {
123
        	if (props != null) { //only output properties when verbose is set
122
                String name = (String) e.nextElement();
124
        		Enumeration e = props.propertyNames();
123
                Element propElement = doc.createElement(PROPERTY);
125
        		while (e.hasMoreElements()) {
124
                propElement.setAttribute(ATTR_NAME, name);
126
        			String name = (String) e.nextElement();
125
                propElement.setAttribute(ATTR_VALUE, props.getProperty(name));
127
        			Element propElement = doc.createElement(PROPERTY);
126
                propsElement.appendChild(propElement);
128
        			propElement.setAttribute(ATTR_NAME, name);
127
            }
129
        			propElement.setAttribute(ATTR_VALUE, props.getProperty(name));
130
        			propsElement.appendChild(propElement);
131
        		}
132
        	}
128
        }
133
        }
129
    }
134
    }
130
135
Lines 267-270 Link Here
267
        nested.appendChild(doc.createCDATASection(output));
272
        nested.appendChild(doc.createCDATASection(output));
268
    }
273
    }
269
274
270
} // XMLJUnitResultFormatter
275
	/**
276
	 * @return Returns the verbose.
277
	 */
278
	public boolean getVerbose() {
279
		return verbose;
280
	}
281
	/**
282
	 * @param verbose The verbose to set.
283
	 */
284
	public void setVerbose(final boolean verbose) {
285
		this.verbose = verbose;
286
	}
287
} // XMLJUnitResultFormatter

Return to bug 32975