summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolkmar W. Pogatzki <gentoo@pogatzki.net>2023-03-31 12:24:39 +0200
committerMiroslav Šulc <fordfrog@gentoo.org>2023-04-07 10:09:02 +0200
commitbfa1d6c232c00963d4485bd5057a6a11217f7b3a (patch)
treee24c65498f6f36347f982fc5f6d11c8dffe2e2dc /dev-java/fop
parentsec-keys/openpgp-keys-apache-xmlgraphics-fop: new package, add 20150603 (diff)
downloadgentoo-bfa1d6c232c00963d4485bd5057a6a11217f7b3a.tar.gz
gentoo-bfa1d6c232c00963d4485bd5057a6a11217f7b3a.tar.bz2
gentoo-bfa1d6c232c00963d4485bd5057a6a11217f7b3a.zip
dev-java/fop: enable tests on the fop-core module
Adds verify-sig Switches test dependency mockito:4 -> mockito:2 Skips one failing test via selection: ! -name 'MissingLanguageWarningTestCase.java' \ Skips three other failing tests via patch: PATCHES=( "${FILESDIR}/fop-2.8-skip-failing-tests.patch" ) Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net> Closes: https://github.com/gentoo/gentoo/pull/30491 Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
Diffstat (limited to 'dev-java/fop')
-rw-r--r--dev-java/fop/Manifest2
-rw-r--r--dev-java/fop/files/fop-2.8-skip-failing-tests.patch48
-rw-r--r--dev-java/fop/fop-2.8-r1.ebuild187
3 files changed, 237 insertions, 0 deletions
diff --git a/dev-java/fop/Manifest b/dev-java/fop/Manifest
index 4f4eb358b352..0d9b604c3ef6 100644
--- a/dev-java/fop/Manifest
+++ b/dev-java/fop/Manifest
@@ -1,2 +1,4 @@
DIST fop-2.7-jars.tar.xz 7348 BLAKE2B 79a5b4f1948bbc9628e571a9873494e2d2088d7a90296e81e03cafa6ecd8f9d1c8dd6779d15c47a0e110304aa07e706c56412e3766a84e0a66c8224fdd92f61c SHA512 71c39cbb20416dc29beb8628ae8bac2a663c0b0d1f0418a241f3795a2d5e01159572c210b5a2d2eff8274247dc3631980de50fea4f94182ddde095d0e5e605c6
DIST fop-2.8-src.tar.gz 22855369 BLAKE2B 183649f531068b8f7513613c89f9f66a48894ab97a659e110b91853d5dffc1664d3830a8ced9ba221e22ca02fc51aed991ddee0e927cab59b9160a504f6dab02 SHA512 22e1737b5cd87dc5e014838e2ad867ccf46bdc564fb5c231cc6b4c1f8a9862864679ea7ddf143126058553ed90045941fb07aa2657db9e3ed35660ce11169357
+DIST fop-2.8-src.tar.gz.asc 833 BLAKE2B f761b427bac89249ab4ab5f2194468e44f997e28ed77392a785764fb60dd2fbbc716ef881e2009a3dbad416ef195fc8ae4d2ebdbd63c3fb3f47d355acab8389b SHA512 c25e94ac4a72c9ff9bfa487369ee1510ab5b19a6178f14f5076b9cf0548044e79eca707025e962c63d268d0f48661cc7110f604036957e447f8413cdb582d3de
+DIST fop-hyph-2.0.jar 6655933 BLAKE2B bfbefcc2ebd9a9a467c23a70d7cef256f83cf2335f6e17db6bbefceaf8a3cee78de0302f269d096eb3238b3f4883429e09cc640bed11a42da4ef67ab9f0cb164 SHA512 3d5f27623008c7beba5332387bd42c501b7ae1dddfc98014b3fb35273394ca5f0a4ce69e7726090ec468c9b4f7983fb8b1a5759f49e81ea342c81c61311d87b3
diff --git a/dev-java/fop/files/fop-2.8-skip-failing-tests.patch b/dev-java/fop/files/fop-2.8-skip-failing-tests.patch
new file mode 100644
index 000000000000..729795e93fd2
--- /dev/null
+++ b/dev-java/fop/files/fop-2.8-skip-failing-tests.patch
@@ -0,0 +1,48 @@
+# https://bugs.gentoo.org/903880
+--- a/fop-core/src/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java
++++ b/fop-core/src/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java
+@@ -43,6 +43,7 @@ import javax.xml.transform.stream.StreamSource;
+
+ import org.custommonkey.xmlunit.Diff;
+ import org.junit.Test;
++import org.junit.Ignore;
+ import org.w3c.dom.Document;
+ import org.xml.sax.SAXException;
+ import org.xml.sax.helpers.AttributesImpl;
+@@ -144,7 +145,7 @@ public class FO2StructureTreeConverterTestCase {
+ assertNull(d.getStructureTreeEventHandler().startNode("table-body", null, null));
+ }
+
+- @Test
++ @Test @Ignore
+ public void testRemoveBlocks() throws Exception {
+ keepEmptyTags = false;
+ compare("<fo:root xmlns:fo=\"http://www.w3.org/1999/XSL/Format\">\n"
+@@ -180,7 +181,7 @@ public class FO2StructureTreeConverterTestCase {
+ + "</structure-tree-sequence>\n");
+ }
+
+- @Test
++ @Test @Ignore
+ public void testRemoveTableHeader() throws Exception {
+ keepEmptyTags = false;
+ String fo = IOUtils.toString(getResource("table-artifact.fo"), "utf8").replace("role=\"artifact\"", "");
+--- a/fop-core/src/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java
++++ b/fop-core/src/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java
+@@ -25,6 +25,7 @@ import java.io.File;
+ import java.io.IOException;
+
+ import org.junit.Test;
++import org.junit.Ignore;
+ import org.xml.sax.SAXException;
+
+ import static org.junit.Assert.assertEquals;
+@@ -61,7 +62,7 @@ public class PDFEncodingTestCase extends BasePDFTest {
+ * Test using a standard FOP font
+ * @throws Exception checkstyle wants a comment here, even a silly one
+ */
+- @Test
++ @Test @Ignore
+ public void testPDFEncodingWithStandardFont() throws Exception {
+
+ /* If the PDF encoding is correct, a text dump of the generated PDF file contains this (excerpts)
diff --git a/dev-java/fop/fop-2.8-r1.ebuild b/dev-java/fop/fop-2.8-r1.ebuild
new file mode 100644
index 000000000000..487cd4d7cade
--- /dev/null
+++ b/dev-java/fop/fop-2.8-r1.ebuild
@@ -0,0 +1,187 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+JAVA_PKG_IUSE="doc source test"
+MAVEN_ID="org.apache.xmlgraphics:fop:${PV}"
+JAVA_TESTING_FRAMEWORKS="junit-4"
+
+inherit java-pkg-2 java-pkg-simple verify-sig
+
+DESCRIPTION="XML Graphics Format Object Processor All-In-One"
+HOMEPAGE="https://xmlgraphics.apache.org/fop/"
+SRC_URI="
+ mirror://apache/xmlgraphics/fop/source/${P}-src.tar.gz
+ https://dev.gentoo.org/~flow/distfiles/fop/fop-2.7-jars.tar.xz
+ verify-sig? ( https://www.apache.org/dist/xmlgraphics/fop/source/${P}-src.tar.gz.asc )
+ test? ( https://repo1.maven.org/maven2/net/sf/offo/fop-hyph/2.0/fop-hyph-2.0.jar )
+"
+S="${WORKDIR}/fop-${PV}"
+
+LICENSE="Apache-2.0"
+SLOT="2.8"
+KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
+
+CP_DEPEND="
+ dev-java/batik:1.16
+ dev-java/commons-io:1
+ dev-java/commons-logging:0
+ dev-java/fontbox:0
+ dev-java/qdox:1.12
+ dev-java/xmlgraphics-commons:2
+"
+
+DEPEND="${CP_DEPEND}
+ >=virtual/jdk-1.8:*
+ dev-java/ant-core:0
+ dev-java/javax-servlet-api:2.2
+ dev-java/sun-jai-bin:0
+ test? (
+ dev-java/mockito:2
+ dev-java/pdfbox:0
+ dev-java/xmlunit:1
+ )
+"
+
+RDEPEND="${CP_DEPEND}
+ >=virtual/jre-1.8:*"
+
+BDEPEND="dev-java/xalan:0"
+
+DOCS=( NOTICE README )
+
+PATCHES=( "${FILESDIR}/fop-2.8-skip-failing-tests.patch" )
+
+JAVA_CLASSPATH_EXTRA="
+ ant-core
+ javax-servlet-api-2.2
+ sun-jai-bin
+"
+
+BDEPEND="verify-sig? ( sec-keys/openpgp-keys-apache-xmlgraphics-fop )"
+VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}/usr/share/openpgp-keys/xmlgraphics-fop.apache.org.asc"
+src_unpack() {
+ if use verify-sig; then
+ verify-sig_verify_detached "${DISTDIR}"/${P}-src.tar.gz{,.asc}
+ fi
+ default
+}
+
+src_prepare() {
+ java-pkg_clean
+ java-pkg-2_src_prepare
+ default
+}
+
+src_compile() {
+ JAVA_JAR_FILENAME="fop-util.jar"
+ JAVA_SRC_DIR="fop-util/src/main/java"
+ java-pkg-simple_src_compile
+ JAVA_GENTOO_CLASSPATH_EXTRA+=":fop-util.jar"
+ rm -r target || die
+
+ JAVA_JAR_FILENAME="fop-events.jar"
+ JAVA_RESOURCE_DIRS="fop-events/src/main/resources"
+ JAVA_SRC_DIR="fop-events/src/main/java"
+ java-pkg-simple_src_compile
+ JAVA_GENTOO_CLASSPATH_EXTRA+=":fop-events.jar"
+ rm -r target || die
+
+ JAVA_JAR_FILENAME="fop-core.jar"
+ JAVA_MAIN_CLASS=$( sed -n 's:.*<mainClass>\(.*\)</mainClass>:\1:p' fop-core/pom.xml )
+ JAVA_RESOURCE_DIRS="fop-core/src/main/resources"
+ JAVA_SRC_DIR="fop-core/src/main/java"
+ # Code generation according to
+ # https://github.com/apache/xmlgraphics-fop/blob/fop-2_8/fop-core/pom.xml#L156-L225
+ pushd fop-core/src/main/codegen/fonts > /dev/null || die
+ local fonts=$(find . -name "Courier*.xml" \
+ -o -name "Helvetica*.xml" \
+ -o -name "Times*.xml" \
+ -o -name "Symbol.xml" \
+ -o -name "ZapfDingbats.xml"
+ )
+ for font in ${fonts}; do \
+ xalan -XSLTC \
+ -IN $font \
+ -XSL font-file.xsl \
+ -OUT ../../java/org/apache/fop/fonts/base14/${font//.xml}.java || die
+ done
+ xalan -XSLTC \
+ -IN encodings.xml \
+ -XSL code-point-mapping.xsl \
+ -OUT ../../java/org/apache/fop/fonts/base14/CodePointMapping.java || die
+ popd > /dev/null || die
+ java-pkg-simple_src_compile
+
+ # Update "fop-core.jar" with "event-mode.xml" files produced manually
+ # by running "mvn package".
+ # Upstream does this with maven-antrun-plugin:
+ # https://github.com/apache/xmlgraphics-fop/blob/fop-2_8/fop-core/pom.xml#L269-L290
+ mkdir event-model && pushd $_ > /dev/null || die
+ jar -xf "${WORKDIR}/fop-2.7-core-event-models.jar"
+ popd > /dev/null || die
+
+ jar -uf "fop-core.jar" -C event-model . || die
+ JAVA_GENTOO_CLASSPATH_EXTRA+=":fop-core.jar"
+ rm -r target || die
+
+ if use doc; then \
+ JAVA_SRC_DIR=(
+ "fop-util/src/main/java"
+ "fop-events/src/main/java"
+ "fop-core/src/main/java"
+ )
+ JAVA_JAR_FILENAME="ignoreme.jar"
+ java-pkg-simple_src_compile
+ fi
+}
+
+src_test() {
+ JAVA_TEST_GENTOO_CLASSPATH="junit-4,mockito-2,pdfbox,xmlunit-1"
+
+ einfo "Testing fop-events"
+ JAVA_TEST_EXCLUDES="org.apache.fop.events.TestEventProducer"
+ JAVA_TEST_SRC_DIR="fop-events/src/test/java"
+ # This jar file was created manually from the output of "mvn test".
+ # Upstream does this with maven-antrun-plugin
+ jar -xf "${WORKDIR}/fop-2.7-test-event-model.jar" || die
+ java-pkg-simple_src_test
+
+ einfo "Testing fop-core"
+ pushd fop-core/src/test/java > /dev/null || die
+ # Excluding one test, see https://bugs.gentoo.org/903880
+ local JAVA_TEST_RUN_ONLY=$(find * -type f \
+ -name "*TestCase.java" \
+ ! -name 'MissingLanguageWarningTestCase.java' \
+ )
+ JAVA_TEST_RUN_ONLY="${JAVA_TEST_RUN_ONLY//.java}"
+ JAVA_TEST_RUN_ONLY="${JAVA_TEST_RUN_ONLY//\//.}"
+ popd > /dev/null || die
+ # https://github.com/apache/xmlgraphics-fop/blob/fop-2_8/fop-core/pom.xml#L297-L307
+ # <workingDirectory>../fop</workingDirectory>
+ pushd fop > /dev/null || die
+ JAVA_GENTOO_CLASSPATH_EXTRA="${DISTDIR}/fop-hyph-2.0.jar"
+ JAVA_GENTOO_CLASSPATH_EXTRA+=":../fop-util.jar"
+ JAVA_GENTOO_CLASSPATH_EXTRA+=":../fop-events.jar"
+ JAVA_GENTOO_CLASSPATH_EXTRA+=":../fop-core.jar"
+ JAVA_TEST_RESOURCE_DIRS="../fop-core/src/test/resources"
+ JAVA_TEST_SRC_DIR="../fop-core/src/test/java"
+ java-pkg-simple_src_test
+ popd > /dev/null || die
+}
+
+src_install() {
+ local module
+ for module in fop-util fop-events fop-core ; do
+ java-pkg_dojar "${module}.jar"
+ if use source; then
+ java-pkg_dosrc "${module}/src/main/java/*"
+ fi
+ done
+ if use doc; then
+ java-pkg_dojavadoc target/api
+ fi
+ java-pkg_dolauncher "fop-${SLOT}" --main "org.apache.fop.cli.Main"
+ einstalldocs
+}