You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Mathieu Malaterre <ma...@gmail.com> on 2011/09/16 14:47:56 UTC

running fop tests (Re: Building fop from source using qdox 1.11)

Hi Simon,

On Mon, Aug 29, 2011 at 1:37 PM, Simon Pepping <sp...@leverkruid.eu> wrote:
> It would be good if alternative builds of fop would run a number of
> our junit tests. The fop team should look into this to formulate a
> recommendation.

AFAIK running fop tests simply involved running the 'junit' ant target
? Right ? In this case the code does not compile for me:

    [javac]
/home/mathieu/debian/pkg-java/trunk/fop/fop-1.0/src/java/org/apache/fop/util/text/LocatorFormatter.java
    [javac] /home/mathieu/debian/pkg-java/trunk/fop/fop-1.0/src/java/org/apache/fop/fonts/type1/AFMFile.java:64:
generics are not supported in -source 1.4
    [javac] (use -source 5 or higher to enable generics)
    [javac]     private List<AFMCharMetrics> charMetrics = new
java.util.ArrayList<AFMCharMetrics>();
    [javac]                 ^
    [javac] /home/mathieu/debian/pkg-java/trunk/fop/fop-1.0/src/java/org/apache/fop/fonts/type1/AFMFile.java:418:
for-each loops are not supported in -source 1.4
    [javac] (use -source 5 or higher to enable for-each loops)
    [javac]         for (Map.Entry<String, Map<String, Dimension2D>>
entryFrom : this.kerningMap.entrySet()) {
    [javac]                                                                    ^
    [javac] /home/mathieu/debian/pkg-java/trunk/fop/fop-1.0/src/java/org/apache/fop/fonts/type1/AFMFile.java:500:
annotations are not supported in -source 1.4
    [javac] (use -source 5 or higher to enable annotations)
    [javac]     @Override
    [javac]      ^
    [javac] 3 errors


Can I switch the target version ?

Thanks
-- 
Mathieu

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: running fop tests (Re: Building fop from source using qdox 1.11)

Posted by mehdi houshmand <me...@gmail.com>.
Hi Mathieu,

It looks as if you're attempting to compile java with the Java 1.4
compiler. FOP no longer supports Java 1.4, but requires Java1.5+.

Hope that helps

Mehdi

On 16 September 2011 13:47, Mathieu Malaterre
<ma...@gmail.com> wrote:
> Hi Simon,
>
> On Mon, Aug 29, 2011 at 1:37 PM, Simon Pepping <sp...@leverkruid.eu> wrote:
>> It would be good if alternative builds of fop would run a number of
>> our junit tests. The fop team should look into this to formulate a
>> recommendation.
>
> AFAIK running fop tests simply involved running the 'junit' ant target
> ? Right ? In this case the code does not compile for me:
>
>    [javac]
> /home/mathieu/debian/pkg-java/trunk/fop/fop-1.0/src/java/org/apache/fop/util/text/LocatorFormatter.java
>    [javac] /home/mathieu/debian/pkg-java/trunk/fop/fop-1.0/src/java/org/apache/fop/fonts/type1/AFMFile.java:64:
> generics are not supported in -source 1.4
>    [javac] (use -source 5 or higher to enable generics)
>    [javac]     private List<AFMCharMetrics> charMetrics = new
> java.util.ArrayList<AFMCharMetrics>();
>    [javac]                 ^
>    [javac] /home/mathieu/debian/pkg-java/trunk/fop/fop-1.0/src/java/org/apache/fop/fonts/type1/AFMFile.java:418:
> for-each loops are not supported in -source 1.4
>    [javac] (use -source 5 or higher to enable for-each loops)
>    [javac]         for (Map.Entry<String, Map<String, Dimension2D>>
> entryFrom : this.kerningMap.entrySet()) {
>    [javac]                                                                    ^
>    [javac] /home/mathieu/debian/pkg-java/trunk/fop/fop-1.0/src/java/org/apache/fop/fonts/type1/AFMFile.java:500:
> annotations are not supported in -source 1.4
>    [javac] (use -source 5 or higher to enable annotations)
>    [javac]     @Override
>    [javac]      ^
>    [javac] 3 errors
>
>
> Can I switch the target version ?
>
> Thanks
> --
> Mathieu
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: running fop tests

Posted by Simon Pepping <sp...@leverkruid.eu>.
I constructed an ant target junit-jar-main, which depends on a
selection of junit tests which are relevant for fop.jar. I made the
following modifications to the build file:

Index: build.xml
===================================================================
--- build.xml	(revision 963413)
+++ build.xml	(working copy)
@@ -116,24 +116,36 @@
     <include name="fop.js"/>
     <include name="fop"/>
   </fileset>
+  <property name="java-share" value="/usr/share/java"/>
   <path id="libs-build-classpath">
-    <fileset dir="${basedir}/lib">
-      <include name="*.jar"/>
-    </fileset>
+	<pathelement location="${java-share}/avalon-framework.jar"/>
+	<pathelement location="${java-share}/batik-all.jar"/>
+	<pathelement location="${java-share}/commons-io.jar"/>
+	<pathelement location="${java-share}/commons-logging.jar"/>
+	<pathelement location="${java-share}/serializer.jar"/>
+	<pathelement location="${java-share}/servlet-api.jar"/>
+	<pathelement location="${java-share}/xalan2.jar"/>
+	<pathelement location="${java-share}/xercesImpl.jar"/>
+	<pathelement location="${java-share}/xml-apis.jar"/>
+	<pathelement location="${java-share}/xml-apis-ext.jar"/>
+	<pathelement location="${java-share}/xmlgraphics-commons.jar"/>
   </path>
   <property name="lib-tools" value="${basedir}/lib/build"/>
   <path id="libs-tools-build-classpath">
     <path refid="libs-build-classpath"/>
-    <fileset dir="${lib-tools}">
-      <include name="*.jar"/>
-    </fileset>
+	<!-- <pathelement location="${lib-tools}/asm-3.1.jar.jar"/> -->
+	<!-- <pathelement location="${lib-tools}/asm-commons-3.1.jar"/> -->
+	<!-- <pathelement location="${lib-tools}/backport-util-concurrent-3.1.jar"/> -->
+	<!-- <pathelement location="${lib-tools}/jaxen-1.1.1.jar"/> -->
+	<!-- <pathelement location="${lib-tools}/pmd-4.2.5.jar"/> -->
+	<pathelement location="${java-share}/qdox.jar"/>
+	<!-- <pathelement location="${lib-tools}/retroweaver-2.0.6-patched.jar"/> -->
+	<!-- <pathelement location="${lib-tools}/retroweaver-rt-2.0.6-patched.jar"/> -->
+	<pathelement location="${java-share}/xmlunit.jar"/>
   </path>
   <path id="libs-run-classpath">
     <path refid="libs-build-classpath"/>
-    <fileset dir="${basedir}/build">
-      <include name="fop.jar"/>
-      <include name="fop-hyph.jar"/>
-    </fileset>
+	<pathelement location="${java-share}/fop.jar"/>
   </path>
   <patternset id="exclude-jai">
     <exclude name="org/apache/fop/util/bitmap/JAIMonochromeBitmapConverter.java" unless="jai.present"/>
@@ -985,6 +997,18 @@
     <echo>All Junit tests passed!</echo>
     <echo>Use the "junit-reports" target to generate HTML test reports</echo>
   </target>
+  <target name="junit-jar-main" depends="junit-userconfig, junit-basic, junit-text-linebreak, junit-layout-standard, junit-area-tree-xml-format, junit-intermediate-format" description="Runs FOP's JUnit tests for the main jar file" if="junit.present">
+    <fail><condition><or><isset property="fop.junit.error"/><isset property="fop.junit.failure"/></or></condition>
+NOTE:
+**************************************************************************
+* One or more of the Junit tests had Failures or Errors or were skipped! *
+*         Please check the output above for relevant messages.           *
+*    Or use the "junit-reports" target to generate HTML test reports.    *
+**************************************************************************
+    </fail>
+    <echo>All Junit tests for the main jar file passed!</echo>
+    <echo>Use the "junit-reports" target to generate HTML test reports</echo>
+  </target>
 <!-- haven't made this dependent on "junit" as that would rerun all tests -->
   <target name="junit-reports" description="Generates HTML test reports">
     <mkdir dir="${junit.html.reports.dir}"/>

In the first part I modify the class paths, as described on the wiki
page. In the second part I define a target junit-jar-main.

I built fop.jar and ran the tests successfully in a fop source directory.

Best, Simon

On Sat, Sep 17, 2011 at 12:28:52PM +0200, Simon Pepping wrote:
> Re junit tests: ant junit runs many tests which are not related to
> fop.jar. Other jar files such as sandbox and transcoder are built, and
> irrelevant tests are run.
> 
> The following tests are relevant to the functioning of fop.jar:
> 
> junit-basic                 Runs FOP's JUnit basic tests
> junit-intermediate-format   Runs FOP's intermediate format JUnit tests
> junit-layout-standard       Runs FOP's standard JUnit layout tests
> junit-text-linebreak        Runs FOP's JUnit unicode linebreak tests
> junit-userconfig            Runs FOP's user config JUnit tests
> junit-area-tree-xml-format
> junit-render-pdf
> 
> The following test is irrelevant:
> junit-transcoder
> 
> The following test cannot be run without hyphenation patterns, and
> causes the junit target to report failure:
> junit-layout-hyphenation
> 
> Note that only the target junit reports success or failure; other
> junit targets report success even if the test reports failure.
> 
> One could construct a test junit-package which only includes tests
> relevant to fop.jar.

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: running fop tests

Posted by Simon Pepping <sp...@leverkruid.eu>.
Re compilation errors: fop-1.0 is java 1.4 compliant and does not
contain generics. The code below is not from fop-1.0.

You can switch target version without harm.

Re junit tests: ant junit runs many tests which are not related to
fop.jar. Other jar files such as sandbox and transcoder are built, and
irrelevant tests are run.

The following tests are relevant to the functioning of fop.jar:

junit-basic                 Runs FOP's JUnit basic tests
junit-intermediate-format   Runs FOP's intermediate format JUnit tests
junit-layout-standard       Runs FOP's standard JUnit layout tests
junit-text-linebreak        Runs FOP's JUnit unicode linebreak tests
junit-userconfig            Runs FOP's user config JUnit tests
junit-area-tree-xml-format
junit-render-pdf

The following test is irrelevant:
junit-transcoder

The following test cannot be run without hyphenation patterns, and
causes the junit target to report failure:
junit-layout-hyphenation

Note that only the target junit reports success or failure; other
junit targets report success even if the test reports failure.

One could construct a test junit-package which only includes tests
relevant to fop.jar.

ON this wiki page,
http://wiki.apache.org/xmlgraphics-fop/HowTo/BuildFOPAlternatively, I
describe a method to run some tests without ant, to avoid dependencies
in the build file. But it includes only one target.

Best, Simon

On Fri, Sep 16, 2011 at 02:47:56PM +0200, Mathieu Malaterre wrote:
> Hi Simon,
> 
> On Mon, Aug 29, 2011 at 1:37 PM, Simon Pepping <sp...@leverkruid.eu> wrote:
> > It would be good if alternative builds of fop would run a number of
> > our junit tests. The fop team should look into this to formulate a
> > recommendation.
> 
> AFAIK running fop tests simply involved running the 'junit' ant target
> ? Right ? In this case the code does not compile for me:
> 
>     [javac]
> /home/mathieu/debian/pkg-java/trunk/fop/fop-1.0/src/java/org/apache/fop/util/text/LocatorFormatter.java
>     [javac] /home/mathieu/debian/pkg-java/trunk/fop/fop-1.0/src/java/org/apache/fop/fonts/type1/AFMFile.java:64:
> generics are not supported in -source 1.4
>     [javac] (use -source 5 or higher to enable generics)
>     [javac]     private List<AFMCharMetrics> charMetrics = new
> java.util.ArrayList<AFMCharMetrics>();
>     [javac]                 ^
>     [javac] /home/mathieu/debian/pkg-java/trunk/fop/fop-1.0/src/java/org/apache/fop/fonts/type1/AFMFile.java:418:
> for-each loops are not supported in -source 1.4
>     [javac] (use -source 5 or higher to enable for-each loops)
>     [javac]         for (Map.Entry<String, Map<String, Dimension2D>>
> entryFrom : this.kerningMap.entrySet()) {
>     [javac]                                                                    ^
>     [javac] /home/mathieu/debian/pkg-java/trunk/fop/fop-1.0/src/java/org/apache/fop/fonts/type1/AFMFile.java:500:
> annotations are not supported in -source 1.4
>     [javac] (use -source 5 or higher to enable annotations)
>     [javac]     @Override
>     [javac]      ^
>     [javac] 3 errors
> 
> 
> Can I switch the target version ?
> 
> Thanks
> -- 
> Mathieu
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org