Class XSLXMLReportConsumer

  • All Implemented Interfaces:
    XMLTestReportProcessor.XMLReportConsumer

    public class XSLXMLReportConsumer
    extends java.lang.Object
    implements XMLTestReportProcessor.XMLReportConsumer
    This implementation of the XMLTestReportProcessor.XMLReportConsumer interface simply applies an XSL transformation to the input XML file and stores the result in a configurable directory.
    Version:
    $Id: XSLXMLReportConsumer.java 1803263 2017-07-28 10:51:01Z ssteiner $
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ERROR_OUTPUT_DIRECTORY_UNUSABLE
      Error code used when the output directory cannot be used
      private java.lang.String outputDirectory
      Output directory, i.e., the directory where the result of the XSL transformation will be stored.
      private java.lang.String outputFileName
      Output file name
      private java.lang.String stylesheet
      Stylesheet URI
    • Constructor Summary

      Constructors 
      Constructor Description
      XSLXMLReportConsumer​(java.lang.String stylesheet, java.lang.String outputDirectory, java.lang.String outputFileName)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void checkDirectory​(java.io.File dir)
      Checks that the input File represents a directory that can be used.
      java.io.File createNewReportOutput​(java.io.File reportDirectory)
      Returns a new file in the outputDirectory, with the requested report name.
      void onNewReport​(java.io.File xmlReport, java.io.File reportDirectory)
      When a new report has been generated, this consumer applies the same stylesheet to the input XML document
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ERROR_OUTPUT_DIRECTORY_UNUSABLE

        public static final java.lang.String ERROR_OUTPUT_DIRECTORY_UNUSABLE
        Error code used when the output directory cannot be used
        See Also:
        Constant Field Values
      • stylesheet

        private java.lang.String stylesheet
        Stylesheet URI
      • outputDirectory

        private java.lang.String outputDirectory
        Output directory, i.e., the directory where the result of the XSL transformation will be stored.
      • outputFileName

        private java.lang.String outputFileName
        Output file name
    • Constructor Detail

      • XSLXMLReportConsumer

        public XSLXMLReportConsumer​(java.lang.String stylesheet,
                                    java.lang.String outputDirectory,
                                    java.lang.String outputFileName)
        Constructor
        Parameters:
        stylesheet - URI for the stylesheet to apply to the XML report
        outputDirectory - directory where the result of the XSL transformation should be written
        outputFileName - name of the output report.
    • Method Detail

      • onNewReport

        public void onNewReport​(java.io.File xmlReport,
                                java.io.File reportDirectory)
                         throws java.lang.Exception
        When a new report has been generated, this consumer applies the same stylesheet to the input XML document
        Specified by:
        onNewReport in interface XMLTestReportProcessor.XMLReportConsumer
        Parameters:
        xmlReport - file containing the xml report
        reportDirectory - base directory where any resource relative to the report processing should be stored.
        Throws:
        java.lang.Exception
      • createNewReportOutput

        public java.io.File createNewReportOutput​(java.io.File reportDirectory)
                                           throws java.lang.Exception
        Returns a new file in the outputDirectory, with the requested report name.
        Throws:
        java.lang.Exception
      • checkDirectory

        public void checkDirectory​(java.io.File dir)
                            throws TestException
        Checks that the input File represents a directory that can be used. If the directory does not exist, this method will attempt to create it.
        Throws:
        TestException