Class AggregateTransformer


public class AggregateTransformer extends 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.
  • Field Details

    • FRAMES

      public static final String FRAMES
      name of the frames format.
      See Also:

      public static final String NOFRAMES
      name of the no frames format.
      See Also:
    • dbfactory

      protected static DocumentBuilderFactory dbfactory
      XML Parser factory accessible to subclasses
    • task

      protected Task task
    • document

      protected Document document
      the xml document to process
    • styleDir

      protected File styleDir
      the style directory. XSLs should be read from here if necessary
    • toDir

      protected File toDir
      the destination directory, this is the root from where html should be generated
    • format

      protected String format
      the format to use for the report. Must be FRAMES or NOFRAMES
  • Constructor Details

    • AggregateTransformer

      public AggregateTransformer(Task task)
      constructor creating the transformer from the junitreport task.
      task - task delegating to this class
  • Method Details

    • getDocumentBuilderFactory

      protected static DocumentBuilderFactory getDocumentBuilderFactory()
      Get the Document Builder Factory
      the DocumentBuilderFactory instance in use
    • setFormat

      public void setFormat(AggregateTransformer.Format format)
      sets the format.
      format - Must be FRAMES or NOFRAMES
    • setXmlDocument

      public void setXmlDocument(Document doc)
      sets the input document.
      doc - input dom tree
    • setXmlfile

      protected void setXmlfile(File xmlfile) throws BuildException
      Set the xml file to be processed. This is a helper if you want to set the file directly. Much more for testing purposes.
      xmlfile - xml file to be processed
      BuildException - if the document cannot be parsed.
    • setStyledir

      public void setStyledir(File styledir)
      set the style directory. It is optional and will override the default xsl used.
      styledir - the directory containing the xsl files if the user would like to override with its own style.
    • setTodir

      public void setTodir(File todir)
      set the destination directory.
      todir - the destination directory
    • setExtension

      public void setExtension(String ext)
      set the extension of the output files
      ext - extension.
    • createParam

      public XSLTProcess.Param createParam()
      Create an instance of an XSL parameter for configuration by Ant.
      an instance of the Param class to be configured.
      Ant 1.7
    • createClasspath

      public Path createClasspath()
      Creates a classpath to be used for the internal XSLT task.
      the classpath to be configured
      Ant 1.9.5
    • createFactory

      public XSLTProcess.Factory createFactory()
      Creates a factory configuration to be used for the internal XSLT task.
      the factory description to be configured
      Ant 1.9.5
    • transform

      public void transform() throws BuildException
      BuildException - exception if something goes wrong with the transformation.
    • getStylesheet

      protected Resource getStylesheet()
      access the stylesheet to be used as a resource.
      stylesheet as a resource
    • checkOptions

      protected void checkOptions() throws BuildException
      check for invalid options
      BuildException - if something goes wrong.
    • getStylesheetSystemId

      protected String getStylesheetSystemId() throws IOException
      Get the systemid of the appropriate stylesheet based on its name and styledir. If no styledir is defined it will load it as a java resource in the xsl child package, otherwise it will get it from the given directory.
      system ID of the stylesheet.
      IOException - thrown if the requested stylesheet does not exist.
    • configureForRedirectExtension

      protected void configureForRedirectExtension()
      If we end up using the JDK's own TraX factory on Java 9+, then set the features and attributes necessary to allow redirect extensions to be used.
      Ant 1.9.8