dev-java/commons-beanutils: fix test failures

Test sources of commons-collections-3.2.2 are needed for compiling the
test cases but are not part of the commons-collections.jar file.

Adds verify-sig

Closes: https://bugs.gentoo.org/923600
Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
Closes: https://github.com/gentoo/gentoo/pull/35952
Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
This commit is contained in:
Volkmar W. Pogatzki
2024-03-28 13:18:09 +01:00
committed by Miroslav Šulc
parent bfd9e78c2d
commit 5c7991bdf5
4 changed files with 273 additions and 101 deletions

View File

@@ -1 +1,3 @@
DIST commons-beanutils-1.9.4-src.tar.gz 412606 BLAKE2B 213a2ad4d976ed4c55c9a73c0970a656e2f03efcba886369c8be164e04618937ad636ce7ffa6aa7b981e9595b24e4cbacc2bc632268bbfede8172091ef6eb4ff SHA512 6f3d30d02b9a66cf20509bd868c6e2dadb44bb27da1e6b9af7275675e0f3826845a5d4005509dd1eb77a5b2937820c4770a3753daaab072785dcdab0caa69e73
DIST commons-beanutils-1.9.4-src.tar.gz.asc 833 BLAKE2B c971231cfb034bd9bbbd6e7801a4fcb54853c0d18872cfae81ce761fc8f71ebb70955456827ad33b4abd4df8c9820031fd49f28c50eddef5251b2a0d1b01cff9 SHA512 2a966959b2c94bf013df71885c2906a092b43a0ac6d63963f1462e7c09376964bb948c0681278a58fffae6716d042dc846b1649e1f4b0816e2adb3733bf14451
DIST commons-collections-3.2.2-src.tar.gz 630693 BLAKE2B a70cebe9526291d5207db7edd7c9b50060413880d41dcb28c01cf05f7e00a9f5e1560012c3c3c763162412282db9512bc2b64a5788f210c5c8866943d912dafb SHA512 2e8ef638f07515b028a3e7e97851fcf1d9023a2c188e211bd1e936f35d3d91c2885adf3b1103ad17dfb7aeea6e7a67ce7826ee346a8a29c1aa7c6b0cf14e9230

View File

@@ -1,101 +0,0 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Skeleton command:
# java-ebuilder --generate-ebuild --workdir . --pom pom.xml --download-uri mirror://apache/commons/beanutils/source/1.9.4-src.tar.gz --slot 1.7 --keywords "~amd64 ~x86 ~ppc64 ~amd64-linux ~x86-linux ~x64-macos" --ebuild commons-beanutils-1.9.4.ebuild
EAPI=8
JAVA_PKG_IUSE="doc source test"
MAVEN_ID="commons-beanutils:commons-beanutils:1.9.4"
JAVA_TESTING_FRAMEWORKS="junit-4"
inherit java-pkg-2 java-pkg-simple
DESCRIPTION="Provides easy-to-use wrappers around Reflection and Introspection APIs"
HOMEPAGE="https://commons.apache.org/proper/commons-beanutils/"
SRC_URI="mirror://apache/commons/beanutils/source/${P}-src.tar.gz"
LICENSE="Apache-2.0"
SLOT="1.7"
KEYWORDS="amd64 ~arm arm64 ppc64 x86 ~amd64-linux ~x86-linux ~x64-macos"
# Common dependencies
# POM: pom.xml
# commons-collections:commons-collections:3.2.2 -> >=dev-java/commons-collections-3.2.2:0
# commons-logging:commons-logging:1.2 -> >=dev-java/commons-logging-1.2:0
CP_DEPEND="
dev-java/commons-collections:0
dev-java/commons-logging:0
"
# Compile dependencies
# POM: pom.xml
# test? commons-collections:commons-collections-testframework:3.2.1 -> !!!artifactId-not-found!!!
# test? junit:junit:4.12 -> >=dev-java/junit-4.12:4
DEPEND="${CP_DEPEND}
>=virtual/jdk-1.8:*
test? (
dev-java/commons-collections:0[test]
)"
RDEPEND="${CP_DEPEND}
>=virtual/jre-1.8:*"
DOCS=( {CONTRIBUTING,README}.md {LICENSE,NOTICE,RELEASE-NOTES}.txt )
S="${WORKDIR}/${P}-src"
JAVA_ENCODING="iso-8859-1"
JAVA_SRC_DIR="src/main/java"
JAVA_TEST_GENTOO_CLASSPATH="commons-collections,junit-4"
JAVA_TEST_SRC_DIR="src/test/java"
JAVA_TEST_EXCLUDES=(
# Upstream: Tests run: 1293, Failures: 0, Errors: 0, Skipped: 3
"org.apache.commons.beanutils.TestBeanPublicSubclass" # Invalid test class
"org.apache.commons.beanutils.TestBeanPackageSubclass" # Invalid test class
"org.apache.commons.beanutils.TestResultSetMetaData" # Invalid test class
"org.apache.commons.beanutils.TestResultSet" # Test class can only have one constructor
"org.apache.commons.beanutils.TestBean" # Test class can only have one constructor
# https://github.com/apache/commons-beanutils/blob/32ceb2c92512d44f97638805e2f3fd9d70dfcfc6/pom.xml#L378-L383
# <!-- This test case is known to fail, and there isn't any proposed fix
# - so we will just exclude it until someone comes up with a solution.
# -->
"org.apache.commons.beanutils.converters.MemoryTestCase"
)
src_test() {
# There were 8 failures:
# 1) testPropertyUtilsBean_descriptorsCache_memoryLeak(org.apache.commons.beanutils.memoryleaktests.MemoryLeakTestCase)
# java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
# 2) testPropertyUtilsBean_mappedDescriptorsCache_memoryLeak(org.apache.commons.beanutils.memoryleaktests.MemoryLeakTestCase)
# java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
# 3) testMappedPropertyDescriptor_MappedMethodReference1(org.apache.commons.beanutils.memoryleaktests.MemoryLeakTestCase)
# java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
# 4) testMappedPropertyDescriptor_MappedMethodReference2(org.apache.commons.beanutils.memoryleaktests.MemoryLeakTestCase)
# java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
# 5) testLocaleConvertUtilsBean_converters_memoryLeak(org.apache.commons.beanutils.memoryleaktests.MemoryLeakTestCase)
# java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
# 6) testWrapDynaClass_dynaClasses_memoryLeak(org.apache.commons.beanutils.memoryleaktests.MemoryLeakTestCase)
# java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
# 7) testMethodUtils_cache_memoryLeak(org.apache.commons.beanutils.memoryleaktests.MemoryLeakTestCase)
# java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
# 8) testConvertUtilsBean_converters_memoryLeak(org.apache.commons.beanutils.memoryleaktests.MemoryLeakTestCase)
# java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
local vm_version="$(java-config -g PROVIDES_VERSION)"
if [[ "${vm_version}" == "11" ]] ; then
JAVA_TEST_EXCLUDES+=( "org.apache.commons.beanutils.memoryleaktests.MemoryLeakTestCase" )
fi
java-pkg-simple_src_test
}
src_install() {
default # https://bugs.gentoo.org/789582
java-pkg-simple_src_install
}

View File

@@ -0,0 +1,84 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
JAVA_PKG_IUSE="doc source test"
MAVEN_ID="commons-beanutils:commons-beanutils:1.9.4"
JAVA_TESTING_FRAMEWORKS="junit-4"
inherit java-pkg-2 java-pkg-simple verify-sig
DESCRIPTION="Provides easy-to-use wrappers around Reflection and Introspection APIs"
HOMEPAGE="https://commons.apache.org/proper/commons-beanutils/"
# We need some test classes of commons-collections which are not part of the jar file.
ACC="commons-collections-3.2.2"
SRC_URI="mirror://apache/commons/beanutils/source/${P}-src.tar.gz
test? ( https://archive.apache.org/dist/commons/collections/source/${ACC}-src.tar.gz )
verify-sig? ( https://downloads.apache.org/commons/beanutils/source/${P}-src.tar.gz.asc )"
S="${WORKDIR}/${P}-src"
LICENSE="Apache-2.0"
SLOT="1.7"
KEYWORDS="amd64 ~arm arm64 ppc64 x86 ~amd64-linux ~x86-linux ~x64-macos"
VERIFY_SIG_OPENPGP_KEY_PATH="/usr/share/openpgp-keys/commons.apache.org.asc"
BDEPEND="verify-sig? ( sec-keys/openpgp-keys-apache-commons )"
CP_DEPEND="
dev-java/commons-collections:0
dev-java/commons-logging:0
"
DEPEND="${CP_DEPEND}
>=virtual/jdk-1.8:*"
RDEPEND="${CP_DEPEND}
>=virtual/jre-1.8:*"
DOCS=( {CONTRIBUTING,README}.md {NOTICE,RELEASE-NOTES}.txt )
JAVA_ENCODING="iso-8859-1"
JAVA_SRC_DIR="src/main/java"
JAVA_TEST_GENTOO_CLASSPATH="junit-4 "
JAVA_TEST_SRC_DIR=(
src/test/java
../"${ACC}"-src/src/test
)
src_unpack() {
if use verify-sig; then
verify-sig_verify_detached "${DISTDIR}"/${P}-src.tar.gz{,.asc}
fi
default
}
src_test() {
export LC_ALL="en_US.UTF-8"
# Apply patch to unpacked commons-collections
pushd "../${ACC}-src" >> /dev/null || die
eapply "${FILESDIR}/${ACC}-fixes.patch"
popd
pushd src/test/java || die
# Selection according to lines 375-383 pom.xml
local JAVA_TEST_RUN_ONLY=$(find * \
-path "**/*TestCase.java" \
! -path "**/*MemoryTestCase.java" \
! -path "**/*MemoryLeakTestCase.java" \
! -path "**/*LocaleBeanificationTestCase.java" \
! -path "**/Jira347TestCase.java" \
)
popd
JAVA_TEST_RUN_ONLY="${JAVA_TEST_RUN_ONLY//.java}"
JAVA_TEST_RUN_ONLY="${JAVA_TEST_RUN_ONLY//\//.}"
# We skip 2 more test classes conditionally which have failures with Java 21
# Error converting 'String' to 'java.sql.Time' using pattern 'h:mm a'
# Error converting 'String' to 'java.sql.Timestamp' using pattern 'M/d/yy, h:mm a'
local vm_version="$(java-config -g PROVIDES_VERSION)"
if ver_test "${vm_version}" -ge "21"; then
JAVA_TEST_RUN_ONLY=${JAVA_TEST_RUN_ONLY//org.apache.commons.beanutils.converters.SqlTimeConverterTestCase}
JAVA_TEST_RUN_ONLY=${JAVA_TEST_RUN_ONLY//org.apache.commons.beanutils.converters.SqlTimestampConverterTestCase}
fi
java-pkg-simple_src_test
}

View File

@@ -0,0 +1,187 @@
Patch stolen from:
From e90a6173247f06514731825677f3fc67c62bdc52 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miroslav=20=C5=A0ulc?= <fordfrog@gentoo.org>
Date: Wed, 21 Apr 2021 11:31:11 +0200
--- a/build.xml
+++ b/build.xml
@@ -154,8 +154,7 @@
<!-- NOTE: A jar built using JDK1.4 is incompatible with JDK1.2 -->
<jar jarfile="${build.jar.name}"
- basedir="${build.classes}"
- manifest="${build.conf}/MANIFEST.MF"/>
+ basedir="${build.classes}"/>
</target>
<!-- ====================================================================== -->
--- a/src/java/org/apache/commons/collections/MultiHashMap.java
+++ b/src/java/org/apache/commons/collections/MultiHashMap.java
@@ -331,7 +331,7 @@ public class MultiHashMap extends HashMap implements MultiMap {
* @param item the value to remove
* @return the value removed (which was passed in), null if nothing removed
*/
- public Object remove(Object key, Object item) {
+ public Object removeMapping(Object key, Object item) {
Collection valuesForKey = getCollection(key);
if (valuesForKey == null) {
return null;
--- a/src/java/org/apache/commons/collections/MultiMap.java
+++ b/src/java/org/apache/commons/collections/MultiMap.java
@@ -66,7 +66,7 @@ public interface MultiMap extends Map {
* @throws ClassCastException if the key or value is of an invalid type
* @throws NullPointerException if the key or value is null and null is invalid
*/
- public Object remove(Object key, Object item);
+ public Object removeMapping(Object key, Object item);
//-----------------------------------------------------------------------
/**
--- a/src/java/org/apache/commons/collections/map/MultiKeyMap.java
+++ b/src/java/org/apache/commons/collections/map/MultiKeyMap.java
@@ -197,7 +197,7 @@ public class MultiKeyMap
* @param key2 the second key
* @return the value mapped to the removed key, null if key not in map
*/
- public Object remove(Object key1, Object key2) {
+ public Object removeMultiKey(Object key1, Object key2) {
int hashCode = hash(key1, key2);
int index = map.hashIndex(hashCode, map.data.length);
AbstractHashedMap.HashEntry entry = map.data[index];
--- a/src/java/org/apache/commons/collections/map/MultiValueMap.java
+++ b/src/java/org/apache/commons/collections/map/MultiValueMap.java
@@ -153,7 +153,7 @@ public class MultiValueMap extends AbstractMapDecorator implements MultiMap {
* @param value the value to remove
* @return the value removed (which was passed in), null if nothing removed
*/
- public Object remove(Object key, Object value) {
+ public Object removeMapping(Object key, Object value) {
Collection valuesForKey = getCollection(key);
if (valuesForKey == null) {
return null;
--- a/src/test/org/apache/commons/collections/TestMultiHashMap.java
+++ b/src/test/org/apache/commons/collections/TestMultiHashMap.java
@@ -217,7 +217,7 @@ public class TestMultiHashMap extends AbstractTestMap {
MultiHashMap one = new MultiHashMap();
Integer value = new Integer(1);
one.put("One", value);
- one.remove("One", value);
+ one.removeMapping("One", value);
MultiHashMap two = new MultiHashMap();
assertEquals(two, one);
@@ -269,7 +269,7 @@ public class TestMultiHashMap extends AbstractTestMap {
assertEquals(4, map.totalSize());
map.remove("A");
assertEquals(3, map.totalSize());
- map.remove("B", "BC");
+ map.removeMapping("B", "BC");
assertEquals(2, map.totalSize());
}
@@ -292,7 +292,7 @@ public class TestMultiHashMap extends AbstractTestMap {
map.remove("A");
assertEquals(0, map.size("A"));
assertEquals(3, map.size("B"));
- map.remove("B", "BC");
+ map.removeMapping("B", "BC");
assertEquals(0, map.size("A"));
assertEquals(2, map.size("B"));
}
@@ -464,11 +464,11 @@ public class TestMultiHashMap extends AbstractTestMap {
map.put("A", "AA");
map.put("A", "AB");
map.put("A", "AC");
- assertEquals(null, map.remove("C", "CA"));
- assertEquals(null, map.remove("A", "AD"));
- assertEquals("AC", map.remove("A", "AC"));
- assertEquals("AB", map.remove("A", "AB"));
- assertEquals("AA", map.remove("A", "AA"));
+ assertEquals(null, map.removeMapping("C", "CA"));
+ assertEquals(null, map.removeMapping("A", "AD"));
+ assertEquals("AC", map.removeMapping("A", "AC"));
+ assertEquals("AB", map.removeMapping("A", "AB"));
+ assertEquals("AA", map.removeMapping("A", "AA"));
assertEquals(new MultiHashMap(), map);
}
--- a/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java
+++ b/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java
@@ -1116,7 +1116,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
verify();
try {
- array = collection.toArray(null);
+ array = collection.toArray((Object[]) null);
fail("toArray(null) should raise NPE");
} catch (NullPointerException e) {
// expected
--- a/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java
+++ b/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java
@@ -315,10 +315,10 @@ public class TestMultiKeyMap extends AbstractTestIterableMap {
switch (key.size()) {
case 2:
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1)));
- assertEquals(value, multimap.remove(key.getKey(0), key.getKey(1)));
+ assertEquals(value, multimap.removeMultiKey(key.getKey(0), key.getKey(1)));
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1)));
assertEquals(size - 1, multimap.size());
- assertEquals(null, multimap.remove(key.getKey(0), key.getKey(1)));
+ assertEquals(null, multimap.removeMultiKey(key.getKey(0), key.getKey(1)));
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1)));
break;
case 3:
--- a/src/test/org/apache/commons/collections/map/TestMultiValueMap.java
+++ b/src/test/org/apache/commons/collections/map/TestMultiValueMap.java
@@ -161,7 +161,7 @@ public class TestMultiValueMap extends TestCase {
MultiValueMap one = new MultiValueMap();
Integer value = new Integer(1);
one.put("One", value);
- one.remove("One", value);
+ one.removeMapping("One", value);
MultiValueMap two = new MultiValueMap();
assertEquals(two, one);
@@ -187,7 +187,7 @@ public class TestMultiValueMap extends TestCase {
assertEquals(4, map.totalSize());
map.remove("A");
assertEquals(3, map.totalSize());
- map.remove("B", "BC");
+ map.removeMapping("B", "BC");
assertEquals(2, map.totalSize());
}
@@ -204,7 +204,7 @@ public class TestMultiValueMap extends TestCase {
assertEquals(2, map.size());
map.remove("A");
assertEquals(2, map.size());
- map.remove("B", "BC");
+ map.removeMapping("B", "BC");
assertEquals(2, map.size());
}
@@ -227,7 +227,7 @@ public class TestMultiValueMap extends TestCase {
map.remove("A");
assertEquals(0, map.size("A"));
assertEquals(3, map.size("B"));
- map.remove("B", "BC");
+ map.removeMapping("B", "BC");
assertEquals(0, map.size("A"));
assertEquals(2, map.size("B"));
}
@@ -338,11 +338,11 @@ public class TestMultiValueMap extends TestCase {
map.put("A", "AA");
map.put("A", "AB");
map.put("A", "AC");
- assertEquals(null, map.remove("C", "CA"));
- assertEquals(null, map.remove("A", "AD"));
- assertEquals("AC", map.remove("A", "AC"));
- assertEquals("AB", map.remove("A", "AB"));
- assertEquals("AA", map.remove("A", "AA"));
+ assertEquals(null, map.removeMapping("C", "CA"));
+ assertEquals(null, map.removeMapping("A", "AD"));
+ assertEquals("AC", map.removeMapping("A", "AC"));
+ assertEquals("AB", map.removeMapping("A", "AB"));
+ assertEquals("AA", map.removeMapping("A", "AA"));
assertEquals(new MultiValueMap(), map);
}