Class RunTest

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class RunTest
    extends org.apache.tools.ant.Task
    Testing ant task. This task is used to test FOP as a build target. This uses the TestConverter (with weak code dependency) to run the tests and check the results.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String basedir  
      private java.lang.String referenceJar  
      private java.lang.String refVersion  
      private java.lang.String testsuite  
      • Fields inherited from class org.apache.tools.ant.Task

        target, taskName, taskType, wrapper
      • Fields inherited from class org.apache.tools.ant.ProjectComponent

        description, location, project
    • Constructor Summary

      Constructors 
      Constructor Description
      RunTest()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.net.URL[] createUrls​(java.lang.String mainJar)
      Return a list of URL's with the specified URL first and followed by all the jar files from lib/.
      void execute()
      This creates the reference output, if required, then tests the current build.
      protected java.util.Map runConverter​(java.lang.ClassLoader loader, java.lang.String dest, java.lang.String compDir)
      Run the Converter.
      protected void runReference()
      Run the tests for the reference jar file.
      void setBasedir​(java.lang.String str)
      Sets the base directory.
      void setReference​(java.lang.String str)
      Sets the reference directory.
      void setRefVersion​(java.lang.String str)
      Sets the reference version.
      void setTestSuite​(java.lang.String str)
      Sets the test suite name.
      protected void testNewBuild()
      Test the current build.
      • Methods inherited from class org.apache.tools.ant.Task

        bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
      • Methods inherited from class org.apache.tools.ant.ProjectComponent

        clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
      • Methods inherited from class java.lang.Object

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

      • basedir

        private java.lang.String basedir
      • testsuite

        private java.lang.String testsuite
      • referenceJar

        private java.lang.String referenceJar
      • refVersion

        private java.lang.String refVersion
    • Constructor Detail

      • RunTest

        public RunTest()
    • Method Detail

      • setTestSuite

        public void setTestSuite​(java.lang.String str)
        Sets the test suite name.
        Parameters:
        str - name of the test suite
      • setBasedir

        public void setBasedir​(java.lang.String str)
        Sets the base directory.
        Parameters:
        str - base directory
      • setReference

        public void setReference​(java.lang.String str)
        Sets the reference directory.
        Parameters:
        str - reference directory
      • setRefVersion

        public void setRefVersion​(java.lang.String str)
        Sets the reference version.
        Parameters:
        str - reference version
      • execute

        public void execute()
                     throws org.apache.tools.ant.BuildException
        This creates the reference output, if required, then tests the current build.
        Overrides:
        execute in class org.apache.tools.ant.Task
        Throws:
        org.apache.tools.ant.BuildException
      • testNewBuild

        protected void testNewBuild()
        Test the current build. This uses the current jar file (in build/fop.jar) to run the tests with. The output is then compared with the reference output.
      • runReference

        protected void runReference()
                             throws org.apache.tools.ant.BuildException
        Run the tests for the reference jar file. This checks that the reference output has not already been run and then checks the version of the reference jar against the version required. The reference output is then created.
        Throws:
        org.apache.tools.ant.BuildException - if an error occurs
      • runConverter

        protected java.util.Map runConverter​(java.lang.ClassLoader loader,
                                             java.lang.String dest,
                                             java.lang.String compDir)
        Run the Converter. Runs the test converter using the specified class loader. This loads the TestConverter using the class loader and then runs the test suite for the current test suite file in the base directory. (Note class loader option provided to allow for different fop.jar and other libraries to be activated.)
        Parameters:
        loader - the class loader to use to run the tests with
        dest - destination directory
        compDir - comparison directory
        Returns:
        A Map with differences
      • createUrls

        private java.net.URL[] createUrls​(java.lang.String mainJar)
                                   throws java.net.MalformedURLException
        Return a list of URL's with the specified URL first and followed by all the jar files from lib/.
        Returns:
        a list of urls to the runtime jar files.
        Throws:
        java.net.MalformedURLException