Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tools.ant.taskdefs.optional.junit
Class AggregateTransformer

    java.lang.Object
      |
      +--org.apache.tools.ant.taskdefs.optional.junit.AggregateTransformer

public class AggregateTransformer
extends java.lang.Object

Transform a JUnit xml report. The default transformation generates an html report in either framed or non-framed style. The non-framed style is convenient to have a concise report via mail, the framed report is much more convenient if you want to browse into different packages or testcases since it is a Javadoc like report. In the framed report, there are 3 frames:

- packageListFrame - list of all packages.
- classListFrame - summary of all testsuites belonging to a package or tests list.
- classFrame - details of all tests made for a package or for a testsuite.

As a default, the transformer will use its default stylesheets, they may not be be appropriate for users who wants to customize their reports, so you can indicates your own stylesheets by using `setStyleDir()`. Stylesheets must be as follows:

- all-packages.xsl create the package list. It creates all-packages.html file in the html folder and it is load in the packageListFrame
- all-classes.xsl creates the class list. It creates the all-classes.html file in the html folder is loaded by the 'classListFrame' frame
- overview-packages.xsl allows to get summary on all tests made for each packages and each class that not include in a package. The filename is overview-packages.html
- class-detail.xsl is the style for the detail of the tests made on a class. the Html resulting page in write in the directory of the package and the name of this page is the name of the class with "-detail" element. For instance, the style is applied on the MyClass testsuite, the resulting filename is MyClass-detail.html. This file is load in the "classFrame" frame.
- package-summary.xsl allows to create a summary on the package. The resulting html file is write in the package directory. The name of this file is package-summary.html This file is load in the "classFrame" frame.
- classes-list.xsl create the list of the class in this package. The resulting html file is write in the package directory and it is load in the 'classListFrame' frame. The name of the resulting file is class-list.html

- Author:
    Stephane Bailliez, Nicolas Delahaye

  Inner Class Summary
  `protected static class` | `AggregateTransformer.PackageFilter` allow us to check if the node is a object of a specific package.

  Field Summary
  `static java.lang.String` | `ALLCLASSES`
  `static java.lang.String` | `ALLPACKAGES`
  `static java.lang.String` | `CLASS_DETAILS`
  `static java.lang.String` | `CLASSES_LIST`
  `protected static javax.xml.parsers.DocumentBuilderFactory` | `dbfactory` XML Parser factory
  `protected org.w3c.dom.Document` | `document` the xml document to process
  `protected java.lang.String` | `extension` the file extension of the generated files.
  `protected java.lang.String` | `format` the format to use for the report.
  `static java.lang.String` | `FRAMES`
  `static java.lang.String` | `NOFRAMES`
  `static java.lang.String` | `OVERVIEW_PACKAGES`
  `static java.lang.String` | `OVERVIEW_SUMMARY`
  `static java.lang.String` | `PACKAGE_SUMMARY`
  `protected java.io.File` | `styleDir` the style directory.
  `protected Task` | `task` Task
  `protected java.io.File` | `toDir` the destination directory, this is the root from where html should be generated

  Constructor Summary
  `AggregateTransformer(Task task)`

  Method Summary
  `protected org.w3c.dom.Element` | `buildDocument(org.w3c.dom.NodeList list)` Create an element root ("testsuites") and import all nodes as children of this element.
  `protected void` | `checkOptions()` check for invalid options
  `protected void` | `createAllPackageDetails(org.w3c.dom.Element root)` create the html resulting page of the summary of each package of the root element.
  `protected void` | `createAllTestSuiteDetails(org.w3c.dom.Element root)` create all resulting html pages for all testsuites.
  `protected void` | `createCascadingStyleSheet()`
  `protected void` | `createClassList(org.w3c.dom.Node root)` Create the list of all classes.
  `protected void` | `createFrameStructure()`
  `protected void` | `createPackageDetails(org.w3c.dom.Node root, java.lang.String pkgname)` create the html resulting page of the summary of a package .
  `protected void` | `createPackageList(org.w3c.dom.Node root)` Create the list of all packages.
  `protected void` | `createPackageOverview(org.w3c.dom.Node root)` Create the summary used in the overview.
  `protected void` | `createSinglePageSummary(org.w3c.dom.Element root)` create a single page summary
  `protected void` | `createTestSuiteDetails(org.w3c.dom.Element testsuite)` create the html resulting page of one testsuite.
  `protected java.lang.String` | `getExtension()` get the extension, if it is null, it will use .html as the default
  `protected java.util.Enumeration` | `getPackages(org.w3c.dom.Element root)`
  `protected org.apache.xalan.xslt.XSLTInputSource` | `getXSLStreamSource(java.lang.String name)` default xsls are embedded in the distribution jar.
  `protected java.lang.String` | `packageToPath(java.lang.String pkgname)`
  `protected org.w3c.dom.Document` | `readDocument(java.io.File file)` read the xml file that should be the resuiting file of the testcase.
  `void` | `setExtension(java.lang.String ext)` set the extension of the output files
  `void` | `setFormat(java.lang.String format)`
  `void` | `setStyledir(java.io.File styledir)` set the style directory.
  `void` | `setTodir(java.io.File todir)` set the destination directory
  `void` | `setXmlDocument(org.w3c.dom.Document doc)`
  `void` | `transform()`
  `protected void` | `transform(org.w3c.dom.Node root, java.lang.String xslname, java.lang.String htmlname)` Apply a template on a part of the xml document.

  Methods inherited from class java.lang.Object
  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  Field Detail

  ### ALLPACKAGES

      public static final java.lang.String ALLPACKAGES

  ### ALLCLASSES

      public static final java.lang.String ALLCLASSES

  ### OVERVIEW_PACKAGES

      public static final java.lang.String OVERVIEW_PACKAGES

  ### CLASS_DETAILS

      public static final java.lang.String CLASS_DETAILS

  ### CLASSES_LIST

      public static final java.lang.String CLASSES_LIST

  ### PACKAGE_SUMMARY

      public static final java.lang.String PACKAGE_SUMMARY

  ### OVERVIEW_SUMMARY

      public static final java.lang.String OVERVIEW_SUMMARY

  ### FRAMES

      public static final java.lang.String FRAMES

  ### NOFRAMES

      public static final java.lang.String NOFRAMES

  ### task

      protected Task task

    Task

  ### document

      protected org.w3c.dom.Document document

    the xml document to process

  ### styleDir

      protected java.io.File styleDir

    the style directory. XSLs should be read from here if necessary

  ### toDir

      protected java.io.File toDir

    the destination directory, this is the root from where html should be generated

  ### format

      protected java.lang.String format

    the format to use for the report. Must be `FRAMES` or `NOFRAMES`

  ### extension

      protected java.lang.String extension

    the file extension of the generated files. As a default it will be `.html`

  ### dbfactory

      protected static final javax.xml.parsers.DocumentBuilderFactory dbfactory

    XML Parser factory

  Constructor Detail

  ### AggregateTransformer

      public AggregateTransformer(Task task)

  Method Detail

  ### setFormat

      public void setFormat(java.lang.String format)

  ### setXmlDocument

      public void setXmlDocument(org.w3c.dom.Document doc)

  ### setStyledir

      public void setStyledir(java.io.File styledir)

    set the style directory. It is optional and will override the default xsl used.
    Parameters:
      `styledir` - the directory containing the xsl files if the user would like to override with its own style.

  ### setTodir

      public void setTodir(java.io.File todir)

    set the destination directory

  ### setExtension

      public void setExtension(java.lang.String ext)

    set the extension of the output files

  ### getExtension

      protected java.lang.String getExtension()

    get the extension, if it is null, it will use .html as the default

  ### transform

      public void transform()
                     throws BuildException

  ### checkOptions

      protected void checkOptions()
                           throws BuildException

    check for invalid options

  ### createSinglePageSummary

      protected void createSinglePageSummary(org.w3c.dom.Element root)
                                      throws java.io.IOException,
                                             org.xml.sax.SAXException

    create a single page summary

  ### readDocument

      protected org.w3c.dom.Document readDocument(java.io.File file)
                                           throws java.io.IOException,
                                                  org.xml.sax.SAXException,
                                                  javax.xml.parsers.ParserConfigurationException

    read the xml file that should be the resuiting file of the testcase.
    Parameters:
      `filename` - name of the xml resulting file of the testcase.

  ### createCascadingStyleSheet

      protected void createCascadingStyleSheet()
                                        throws java.io.IOException,
                                               org.xml.sax.SAXException

  ### createFrameStructure

      protected void createFrameStructure()
                                   throws java.io.IOException,
                                          org.xml.sax.SAXException

  ### createPackageList

      protected void createPackageList(org.w3c.dom.Node root)
                                throws org.xml.sax.SAXException

    Create the list of all packages.
    Parameters:
      `root` - root of the xml document.

  ### createClassList

      protected void createClassList(org.w3c.dom.Node root)
                              throws org.xml.sax.SAXException

    Create the list of all classes.
    Parameters:
      `root` - root of the xml document.

  ### createPackageOverview

      protected void createPackageOverview(org.w3c.dom.Node root)
                                    throws org.xml.sax.SAXException

    Create the summary used in the overview.
    Parameters:
      `root` - root of the xml document.

  ### getPackages

      protected java.util.Enumeration getPackages(org.w3c.dom.Element root)

    Returns:
      the list of all packages that exists defined in testsuite nodes

  ### createAllTestSuiteDetails

      protected void createAllTestSuiteDetails(org.w3c.dom.Element root)
                                        throws org.xml.sax.SAXException

    create all resulting html pages for all testsuites.
    Parameters:
      `root` - should be 'testsuites' node.

  ### createTestSuiteDetails

      protected void createTestSuiteDetails(org.w3c.dom.Element testsuite)
                                     throws org.xml.sax.SAXException

    create the html resulting page of one testsuite.
    Parameters:
      `root` - should be 'testsuite' node.

  ### createAllPackageDetails

      protected void createAllPackageDetails(org.w3c.dom.Element root)
                                      throws org.xml.sax.SAXException,
                                             javax.xml.parsers.ParserConfigurationException

    create the html resulting page of the summary of each package of the root element.
    Parameters:
      `root` - should be 'testsuites' node.

  ### packageToPath

      protected java.lang.String packageToPath(java.lang.String pkgname)

  ### createPackageDetails

      protected void createPackageDetails(org.w3c.dom.Node root,
                                          java.lang.String pkgname)
                                   throws org.xml.sax.SAXException

    create the html resulting page of the summary of a package .
    Parameters:
      `root` - should be 'testsuites' node.
      `pkgname` - Name of the package that we want a summary.

  ### buildDocument

      protected org.w3c.dom.Element buildDocument(org.w3c.dom.NodeList list)
                                           throws javax.xml.parsers.ParserConfigurationException

    Create an element root ("testsuites") and import all nodes as children of this element.

  ### transform

      protected void transform(org.w3c.dom.Node root,
                               java.lang.String xslname,
                               java.lang.String htmlname)
                        throws org.xml.sax.SAXException

    Apply a template on a part of the xml document.
    Parameters:
      `root` - root of the document fragment
      `xslfile` - style file
      `outfilename` - filename of the result of the style applied on the Node
    Throws:
      `org.xml.sax.SAXException` - SAX Parsing Error on the style Sheet.

  ### getXSLStreamSource

      protected org.apache.xalan.xslt.XSLTInputSource getXSLStreamSource(java.lang.String name)
                                                                  throws java.io.IOException

    default xsls are embedded in the distribution jar. As a default we will use them, otherwise we will get the one supplied by the client in a given directory. It must have the same name.

  Overview | Package | Class | Tree | Deprecated | Index | Help
  PREV CLASS NEXT CLASS | FRAMES NO FRAMES
  SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

  Copyright © 2000 Apache Software Foundation. All Rights Reserved.