commit:     5de392670eebc911ec424ea1c560925a2fd0e7dd
Author:     Volkmar W. Pogatzki <gentoo <AT> pogatzki <DOT> net>
AuthorDate: Tue Feb 14 15:25:49 2023 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Mon Mar 27 10:24:05 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5de39267

dev-java/jdom: enable tests

Adds Automatic-module-name via MANIFEST.MF
Enables tests skipping 28 tests which otherwise would fail
  see https://bugs.gentoo.org/901743

Signed-off-by: Volkmar W. Pogatzki <gentoo <AT> pogatzki.net>
Closes: https://github.com/gentoo/gentoo/pull/29519
Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 .../files/jdom-2.0.6.1-skip-failing-tests.patch    | 248 +++++++++++++++++++++
 dev-java/jdom/jdom-2.0.6.1.ebuild                  |  47 ++--
 2 files changed, 278 insertions(+), 17 deletions(-)

diff --git a/dev-java/jdom/files/jdom-2.0.6.1-skip-failing-tests.patch 
b/dev-java/jdom/files/jdom-2.0.6.1-skip-failing-tests.patch
new file mode 100644
index 000000000000..cb8675153b8a
--- /dev/null
+++ b/dev-java/jdom/files/jdom-2.0.6.1-skip-failing-tests.patch
@@ -0,0 +1,248 @@
+In order to enable tests we skip ( @Ignore ) several of them which
+would otherwise fail, see bug #901743.
+--- a/test/src/java/org/jdom2/test/cases/input/TestSAXBuilder.java
++++ b/test/src/java/org/jdom2/test/cases/input/TestSAXBuilder.java
+@@ -86,6 +86,7 @@ import java.util.List;
+ 
+ import org.junit.Ignore;
+ import org.junit.Test;
++import org.junit.Ignore;
+ import org.xml.sax.Attributes;
+ import org.xml.sax.DTDHandler;
+ import org.xml.sax.EntityResolver;
+@@ -696,6 +697,7 @@ public final class TestSAXBuilder {
+      * are added to the DocType
+      */
+     @Test
++    @Ignore
+     public void test_TCM__void_setExpandEntities_boolean() throws 
JDOMException, IOException {
+         //test entity exansion on internal entity
+       
+--- a/test/src/java/org/jdom2/test/cases/output/AbstractTestOutputter.java
++++ b/test/src/java/org/jdom2/test/cases/output/AbstractTestOutputter.java
+@@ -6,6 +6,7 @@ import java.util.ArrayList;
+ import java.util.List;
+ 
+ import org.junit.Test;
++import org.junit.Ignore;
+ 
+ import org.jdom2.Attribute;
+ import org.jdom2.CDATA;
+@@ -483,6 +484,7 @@ public abstract class AbstractTestOutputter {
+       }
+       
+       @Test
++      @Ignore
+       public void testDocTypeSimpleISS() {
+               DocType content = new DocType("root");
+               content.setInternalSubset("<!ENTITY name \"value\">");
+@@ -518,6 +520,7 @@ public abstract class AbstractTestOutputter {
+       }
+       
+       @Test
++      @Ignore
+       public void testDocTypeSystemIDISS() {
+               DocType content = new DocType("root", "sysid");
+               content.setInternalSubset("internal");
+@@ -553,6 +556,7 @@ public abstract class AbstractTestOutputter {
+       }
+       
+       @Test
++      @Ignore
+       public void testDocTypePublicSystemIDISS() {
+               DocType content = new DocType("root", "pubid", "sysid");
+               content.setInternalSubset("internal");
+@@ -768,6 +772,7 @@ public abstract class AbstractTestOutputter {
+       }
+ 
+       @Test
++      @Ignore
+       public void testOutputElementAttributeNotSpecifiedB() {
+               String txt = "<root atta=\"val\" attb=\"attb\" />";
+               final Element root = new Element("root");
+@@ -1111,6 +1116,7 @@ public abstract class AbstractTestOutputter {
+       }
+ 
+       @Test
++      @Ignore
+       public void testOutputDocTypeInternalSubset() {
+               String dec = "<!DOCTYPE root [\ninternal]>";
+               DocType dt = new DocType("root");
+@@ -1151,6 +1157,7 @@ public abstract class AbstractTestOutputter {
+       }
+ 
+       @Test
++      @Ignore
+       public void testOutputDocumentOmitEncoding() {
+               Document doc = new Document();
+               doc.addContent(new Element("root"));
+--- a/test/src/java/org/jdom2/test/cases/output/AbstractTestRoundTrip.java
++++ b/test/src/java/org/jdom2/test/cases/output/AbstractTestRoundTrip.java
+@@ -5,6 +5,7 @@ import static org.junit.Assert.assertTrue;
+ import java.io.IOException;
+ 
+ import org.junit.Test;
++import org.junit.Ignore;
+ 
+ import org.jdom2.Document;
+ import org.jdom2.Element;
+@@ -63,6 +64,7 @@ public abstract class AbstractTestRoundTrip {
+       }
+ 
+       @Test
++      @Ignore
+       public void testNamespaces() throws JDOMException, IOException {
+               final SAXBuilder sb = new SAXBuilder();
+               
+@@ -72,6 +74,7 @@ public abstract class AbstractTestRoundTrip {
+       }
+ 
+       @Test
++      @Ignore
+       public void testComplex() throws JDOMException, IOException {
+               final SAXBuilder sb = new SAXBuilder();
+               
+--- a/test/src/java/org/jdom2/test/cases/output/TestDOMOutputter.java
++++ b/test/src/java/org/jdom2/test/cases/output/TestDOMOutputter.java
+@@ -237,6 +237,7 @@ public final class TestDOMOutputter extends 
AbstractTestOutputter {
+     }
+     
+     @Test
++    @Ignore
+     public void testWithDocType() {
+       DocType dt = new DocType("root");
+       dt.setInternalSubset("<!ELEMENT root (#PCDATA)>");
+--- a/test/src/java/org/jdom2/test/cases/output/TestStAXEventOutputter.java
++++ b/test/src/java/org/jdom2/test/cases/output/TestStAXEventOutputter.java
+@@ -347,6 +347,7 @@ public final class TestStAXEventOutputter extends 
AbstractTestOutputter {
+       }
+ 
+       @Test
++      @Ignore
+     public void test_HighSurrogatePair() throws XMLStreamException, 
IOException, JDOMException {
+       SAXBuilder builder = new SAXBuilder();
+       builder.setExpandEntities(true);
+@@ -362,6 +363,7 @@ public final class TestStAXEventOutputter extends 
AbstractTestOutputter {
+     }
+ 
+     @Test
++    @Ignore
+     public void test_HighSurrogatePairDecimal() throws JDOMException, 
IOException, XMLStreamException {
+       SAXBuilder builder = new SAXBuilder();
+       builder.setExpandEntities(true);
+@@ -376,6 +378,7 @@ public final class TestStAXEventOutputter extends 
AbstractTestOutputter {
+     }
+ 
+     @Test
++    @Ignore
+     public void test_HighSurrogateAttPair() throws JDOMException, 
IOException, XMLStreamException {
+       SAXBuilder builder = new SAXBuilder();
+       builder.setExpandEntities(true);
+@@ -390,6 +393,7 @@ public final class TestStAXEventOutputter extends 
AbstractTestOutputter {
+     }
+ 
+     @Test
++    @Ignore
+     public void test_HighSurrogateAttPairDecimal() throws JDOMException, 
IOException, XMLStreamException {
+       SAXBuilder builder = new SAXBuilder();
+       builder.setExpandEntities(true);
+@@ -405,6 +409,7 @@ public final class TestStAXEventOutputter extends 
AbstractTestOutputter {
+ 
+     // Construct a raw surrogate pair character and confirm it outputs hex 
escaped
+     @Test
++    @Ignore
+     public void test_RawSurrogatePair() throws JDOMException, IOException, 
XMLStreamException {
+       SAXBuilder builder = new SAXBuilder();
+       builder.setExpandEntities(true);
+--- a/test/src/java/org/jdom2/test/cases/output/TestStAXStreamOutputter.java
++++ b/test/src/java/org/jdom2/test/cases/output/TestStAXStreamOutputter.java
+@@ -321,6 +321,7 @@ public final class TestStAXStreamOutputter extends 
AbstractTestOutputter {
+       }
+ 
+       @Test
++      @Ignore
+     public void test_HighSurrogatePair() throws XMLStreamException, 
IOException, JDOMException {
+       SAXBuilder builder = new SAXBuilder();
+       builder.setExpandEntities(true);
+@@ -337,6 +338,7 @@ public final class TestStAXStreamOutputter extends 
AbstractTestOutputter {
+     }
+ 
+     @Test
++    @Ignore
+     public void test_HighSurrogatePairDecimal() throws JDOMException, 
IOException, XMLStreamException {
+       SAXBuilder builder = new SAXBuilder();
+       builder.setExpandEntities(true);
+@@ -352,6 +354,7 @@ public final class TestStAXStreamOutputter extends 
AbstractTestOutputter {
+     }
+ 
+     @Test
++    @Ignore
+     public void test_HighSurrogateAttPair() throws JDOMException, 
IOException, XMLStreamException {
+       SAXBuilder builder = new SAXBuilder();
+       builder.setExpandEntities(true);
+@@ -367,6 +370,7 @@ public final class TestStAXStreamOutputter extends 
AbstractTestOutputter {
+     }
+ 
+     @Test
++    @Ignore
+     public void test_HighSurrogateAttPairDecimal() throws JDOMException, 
IOException, XMLStreamException {
+       SAXBuilder builder = new SAXBuilder();
+       builder.setExpandEntities(true);
+@@ -383,6 +387,7 @@ public final class TestStAXStreamOutputter extends 
AbstractTestOutputter {
+ 
+     // Construct a raw surrogate pair character and confirm it outputs hex 
escaped
+     @Test
++    @Ignore
+     public void test_RawSurrogatePair() throws JDOMException, IOException, 
XMLStreamException {
+       SAXBuilder builder = new SAXBuilder();
+       builder.setExpandEntities(true);
+--- a/test/src/java/org/jdom2/test/cases/special/TestIssue008ExpandEntity.java
++++ b/test/src/java/org/jdom2/test/cases/special/TestIssue008ExpandEntity.java
+@@ -13,6 +13,7 @@ import org.jdom2.output.XMLOutputter;
+ import org.jdom2.test.util.FidoFetch;
+ 
+ import org.junit.Test;
++import org.junit.Ignore;
+ 
+ @SuppressWarnings("javadoc")
+ public class TestIssue008ExpandEntity {
+@@ -53,16 +54,19 @@ public class TestIssue008ExpandEntity {
+       }
+ 
+       @Test
++      @Ignore
+       public void testFalse() {
+               roundTrip(false, false, null, "<doc>&minus;</doc>");
+       }
+ 
+       @Test
++      @Ignore
+       public void testFalseUSASCII() {
+               roundTrip(false, false, "US-ASCII", "<doc>&minus;</doc>");
+       }
+ 
+       @Test
++      @Ignore
+       public void testFalseUTF8() {
+               roundTrip(false, false, "UTF-8", "<doc>&minus;</doc>");
+       }
+@@ -85,16 +89,19 @@ public class TestIssue008ExpandEntity {
+ 
+ 
+       @Test
++      @Ignore
+       public void testValidFalse() {
+               roundTrip(false, true, null, "<doc>&minus;</doc>");
+       }
+ 
+       @Test
++      @Ignore
+       public void testValidFalseUSASCII() {
+               roundTrip(false, true, "US-ASCII", "<doc>&minus;</doc>");
+       }
+ 
+       @Test
++      @Ignore
+       public void testValidFalseUTF8() {
+               roundTrip(false, true, "UTF-8", "<doc>&minus;</doc>");
+       }

diff --git a/dev-java/jdom/jdom-2.0.6.1.ebuild 
b/dev-java/jdom/jdom-2.0.6.1.ebuild
index 5cbdaa66520d..774430ba8820 100644
--- a/dev-java/jdom/jdom-2.0.6.1.ebuild
+++ b/dev-java/jdom/jdom-2.0.6.1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -12,15 +12,12 @@ inherit java-pkg-2 java-pkg-simple
 DESCRIPTION="Java-based solution for accessing, manipulating, and outputting 
XML data"
 HOMEPAGE="http://www.jdom.org";
 SRC_URI="https://github.com/hunterhacker/jdom/archive/${PN^^}-${PV}.tar.gz";
+S="${WORKDIR}/jdom-JDOM-${PV}"
 
 LICENSE="Apache-1.1"
 SLOT="2"
 KEYWORDS="amd64 ~arm arm64 ppc64 x86"
 
-# FAILURES!!!
-# Tests run: 1887,  Failures: 23
-RESTRICT="test"
-
 CP_DEPEND="
        dev-java/iso-relax:0
        dev-java/jaxen:1.2
@@ -40,35 +37,51 @@ RDEPEND="
        ${CP_DEPEND}
 "
 
-S="${WORKDIR}/jdom-JDOM-${PV}"
+PATCHES=( "${FILESDIR}/jdom-2.0.6.1-skip-failing-tests.patch" )
 
-JAVA_TEST_SRC_DIR="test/src/java"
-JAVA_TEST_RESOURCE_DIRS="test/src/resources"
 JAVA_TEST_GENTOO_CLASSPATH="junit-4,xerces-2"
+JAVA_TEST_RESOURCE_DIRS="test/src/resources"
+JAVA_TEST_SRC_DIR="test/src/java"
 
 src_prepare() {
-       default
+       java-pkg-2_src_prepare
+       default # bug #780585
        java-pkg_clean
 
+       mkdir core/resources || die
+       cp -r core/{package,resources}/META-INF || die
+
        # Remove Android stuff to avoid junit RDEPEND.
        rm -vr contrib/src/java/org/jdom2/contrib/android || die
 
-       # There are resources in JAVA_TEST_SRC_DIR
-       cp -r test/src/{java,resources}/org || die
-       # Remove .java files from JAVA_TEST_RESOURCE_DIRS
-       find test/src/resources -type f -name '*.java' -exec rm -rf {} + || die 
"deleting classes failed"
+       cd test/src/java || die
+       # java-pkg-simple.eclass expects test resources in 
JAVA_TEST_RESOURCE_DIRS
+       find . -type f ! -name '*.java' \
+               | xargs cp --parent -t ../resources || die
+
+       # We skip testDocTypeDocument() from 3 test classes due to test 
failures,
+       # see bug #901743. This requires changing also the line endings which 
would
+       # lead to huge patches. Hence we do this with sed ( 's/\r$//g' ).
+       sed \
+               -e 's/\r$//g' \
+               -e '/import org.junit.Test/a import org.junit.Ignore;' \
+               -e '/testDocTypeDocument()/i @Ignore' \
+               -i org/jdom2/test/cases/input/TestDOMBuilder.java \
+               -i org/jdom2/test/cases/input/TestStAXEventBuilder.java \
+               -i org/jdom2/test/cases/input/TestStAXStreamBuilder.java || die
 }
 
 src_compile() {
-       JAVA_SRC_DIR="core/src/java"
        JAVA_JAR_FILENAME="jdom.jar"
+       JAVA_RESOURCE_DIRS="core/resources"
+       JAVA_SRC_DIR="core/src/java"
        java-pkg-simple_src_compile
        JAVA_GENTOO_CLASSPATH_EXTRA+=":jdom.jar"
        rm -rf target || die
 
-       JAVA_SRC_DIR="contrib/src/java"
-       JAVA_RESOURCE_DIRS="contrib/src/resources"
        JAVA_JAR_FILENAME="jdom-contrib.jar"
+       JAVA_RESOURCE_DIRS="contrib/src/resources"
+       JAVA_SRC_DIR="contrib/src/java"
        java-pkg-simple_src_compile
        JAVA_GENTOO_CLASSPATH_EXTRA+=":jdom-contrib.jar"
        rm -rf target || die
@@ -85,7 +98,7 @@ src_compile() {
 }
 
 src_install() {
-       default # https://bugs.gentoo.org/789582
+       default # install README
        java-pkg_dojar "jdom.jar"
        java-pkg_dojar "jdom-contrib.jar"
        if use doc; then

Reply via email to