public class XMLResultAggregator extends Task implements XMLConstants
The main problem is due to the fact that a JVM can be forked for a testcase thus making it impossible to aggregate all testcases since the listener is (obviously) in the forked JVM. A solution could be to write a TestListener that will receive events from the TestRunner via sockets. This is IMHO the simplest way to do it to avoid this file hacking thing.
| Modifier and Type | Field and Description | 
|---|---|
| static java.lang.String | DEFAULT_DIRThe default directory: .. | 
| static java.lang.String | DEFAULT_FILENAMEthe default file name: TESTS-TestSuites.xml | 
| protected java.util.Vector | filesetsthe list of all filesets, that should contains the xml to aggregate | 
| protected int | generatedIdthe current generated id | 
| protected java.io.File | toDirthe directory to write the file to | 
| protected java.lang.String | toFilethe name of the result file | 
| protected java.util.Vector | transformers | 
description, location, projectATTR_CLASSNAME, ATTR_ERRORS, ATTR_FAILURES, ATTR_ID, ATTR_MESSAGE, ATTR_NAME, ATTR_PACKAGE, ATTR_SKIPPED, ATTR_TESTS, ATTR_TIME, ATTR_TYPE, ATTR_VALUE, ERROR, FAILURE, HOSTNAME, PROPERTIES, PROPERTY, SYSTEM_ERR, SYSTEM_OUT, TESTCASE, TESTSUITE, TESTSUITES, TIMESTAMP| Constructor and Description | 
|---|
| XMLResultAggregator() | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addFileSet(FileSet fs)Add a new fileset containing the XML results to aggregate | 
| protected void | addTestSuite(org.w3c.dom.Element root,
            org.w3c.dom.Element testsuite)Add a new testsuite node to the document. | 
| protected org.w3c.dom.Element | createDocument()Create a DOM tree. | 
| AggregateTransformer | createReport()Generate a report based on the document created by the merge. | 
| void | execute()Aggregate all testsuites into a single document and write it to the
 specified directory and file. | 
| java.io.File | getDestinationFile()Get the full destination file where to write the result. | 
| protected java.io.File[] | getFiles()Get all  .xmlfiles in the fileset. | 
| void | setTodir(java.io.File value)Set the destination directory where the results should be written. | 
| void | setTofile(java.lang.String value)Set the name of the aggregated results file. | 
| protected void | writeDOMTree(org.w3c.dom.Document doc,
            java.io.File file)Write the DOM tree to a file. | 
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypeclone, getDescription, getLocation, getProject, setDescription, setLocation, setProjectprotected java.util.Vector filesets
protected java.lang.String toFile
protected java.io.File toDir
protected java.util.Vector transformers
public static final java.lang.String DEFAULT_DIR
public static final java.lang.String DEFAULT_FILENAME
protected int generatedId
public AggregateTransformer createReport()
public void setTofile(java.lang.String value)
DEFAULT_FILENAMEvalue - the name of the file.setTodir(File)public void setTodir(java.io.File value)
DEFAULT_DIR. When given a relative directory
 it will resolve it from the project directory.value - the directory where to write the results, absolute or
 relative.public void addFileSet(FileSet fs)
fs - the new fileset of xml results.public void execute()
             throws BuildException
execute in class TaskBuildException - thrown if there is a serious error while writing
          the document.public java.io.File getDestinationFile()
protected java.io.File[] getFiles()
.xml files in the fileset.protected void writeDOMTree(org.w3c.dom.Document doc,
                            java.io.File file)
                     throws java.io.IOException
doc - the XML document to dump to disk.file - the filename to write the document to. Should obviously be a .xml file.java.io.IOException - thrown if there is an error while writing the content.protected org.w3c.dom.Element createDocument()
protected void addTestSuite(org.w3c.dom.Element root,
                            org.w3c.dom.Element testsuite)
Add a new testsuite node to the document. The main difference is that it split the previous fully qualified name into a package and a name.
For example: org.apache.Whatever will be split into org.apache and Whatever.
root - the root element to which the testsuite node should
        be appended.testsuite - the element to append to the given root. It will slightly
        modify the original node to change the name attribute and add
        a package one.