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.

Author:
Stephane Bailliez

Inner Class Summary
static class AggregateTransformer.Format
           
 
Field Summary
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 format
          the format to use for the report.
static java.lang.String FRAMES
           
static java.lang.String NOFRAMES
           
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  void checkOptions()
          check for invalid options
protected  java.lang.String getStylesheetSystemId()
          Get the systemid of the appropriate stylesheet based on its name and styledir.
 void setExtension(java.lang.String ext)
          set the extension of the output files
 void setFormat(AggregateTransformer.Format 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)
           
protected  void setXmlfile(java.io.File xmlfile)
          Set the xml file to be processed.
 void transform()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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

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(AggregateTransformer.Format format)

setXmlDocument

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

setXmlfile

protected void setXmlfile(java.io.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.
Parameters:
xmlfile - xml file to be processed

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

transform

public void transform()
               throws BuildException

checkOptions

protected void checkOptions()
                     throws BuildException
check for invalid options

getStylesheetSystemId

protected java.lang.String getStylesheetSystemId()
                                          throws java.io.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.
Throws:
java.io.IOException - thrown if the requested stylesheet does not exist.


Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.