Package de.hybris.ant.taskdefs.yunit
Class AggregateTransformer
- java.lang.Object
-
- de.hybris.ant.taskdefs.yunit.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AggregateTransformer.Format
defines acceptable formats.
-
Field Summary
Fields Modifier and Type Field Description protected static javax.xml.parsers.DocumentBuilderFactory
dbfactory
XML Parser factory accessible to subclassesprotected org.w3c.dom.Document
document
the xml document to processprotected java.lang.String
format
the format to use for the report.static java.lang.String
FRAMES
name of the frames format.static java.lang.String
NOFRAMES
name of the no frames format.protected java.io.File
styleDir
the style directory.protected org.apache.tools.ant.Task
task
Taskprotected java.io.File
toDir
the destination directory, this is the root from where html should be generated
-
Constructor Summary
Constructors Constructor Description AggregateTransformer(org.apache.tools.ant.Task task)
constructor creating the transformer from the junitreport task.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkOptions()
check for invalid optionsorg.apache.tools.ant.taskdefs.XSLTProcess.Param
createParam()
Create an instance of an XSL parameter for configuration by Ant.protected static javax.xml.parsers.DocumentBuilderFactory
getDocumentBuilderFactory()
Get the Document Builder Factoryprotected org.apache.tools.ant.types.Resource
getStylesheet()
access the stylesheet to be used as a resource.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 filesvoid
setFormat(AggregateTransformer.Format format)
sets the 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)
sets the input document.protected void
setXmlfile(java.io.File xmlfile)
Set the xml file to be processed.void
transform()
transformation
-
-
-
Field Detail
-
FRAMES
public static final java.lang.String FRAMES
name of the frames format.- See Also:
- Constant Field Values
-
NOFRAMES
public static final java.lang.String NOFRAMES
name of the no frames format.- See Also:
- Constant Field Values
-
task
protected org.apache.tools.ant.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 javax.xml.parsers.DocumentBuilderFactory dbfactory
XML Parser factory accessible to subclasses
-
-
Method Detail
-
getDocumentBuilderFactory
protected static javax.xml.parsers.DocumentBuilderFactory getDocumentBuilderFactory()
Get the Document Builder Factory- Returns:
- the DocumentBuilderFactory instance in use
-
setFormat
public void setFormat(AggregateTransformer.Format format)
sets the format.- Parameters:
format
- Must be FRAMES or NOFRAMES
-
setXmlDocument
public void setXmlDocument(org.w3c.dom.Document doc)
sets the input document.- Parameters:
doc
- input dom tree
-
setXmlfile
protected void setXmlfile(java.io.File xmlfile) throws org.apache.tools.ant.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- Throws:
org.apache.tools.ant.BuildException
- if the document cannot be parsed.
-
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.- Parameters:
todir
- the destination directory
-
setExtension
public void setExtension(java.lang.String ext)
set the extension of the output files- Parameters:
ext
- extension.
-
createParam
public org.apache.tools.ant.taskdefs.XSLTProcess.Param createParam()
Create an instance of an XSL parameter for configuration by Ant.- Returns:
- an instance of the Param class to be configured.
- Since:
- Ant 1.7
-
transform
public void transform() throws org.apache.tools.ant.BuildException
transformation- Throws:
org.apache.tools.ant.BuildException
- exception if something goes wrong with the transformation.
-
getStylesheet
protected org.apache.tools.ant.types.Resource getStylesheet()
access the stylesheet to be used as a resource.- Returns:
- stylesheet as a resource
-
checkOptions
protected void checkOptions() throws org.apache.tools.ant.BuildException
check for invalid options- Throws:
org.apache.tools.ant.BuildException
- if something goes wrong.
-
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.- Returns:
- system ID of the stylesheet.
- Throws:
java.io.IOException
- thrown if the requested stylesheet does not exist.
-
-