From 8939b6feac940c26fc7ad6b275b7da760d302b8f Mon Sep 17 00:00:00 2001 From: Mat Booth Date: Thu, 7 Feb 2019 15:00:38 +0000 Subject: [PATCH] Fix test suite build against Mockito 2.x --- 0001-Remove-Brotli-compressor.patch | 8 ++--- 0002-Remove-ZSTD-compressor.patch | 8 ++--- 0003-Avoid-use-of-internal-Mockito-API.patch | 32 ++++++++++++++++++++ apache-commons-compress.spec | 9 +++++- 4 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 0003-Avoid-use-of-internal-Mockito-API.patch diff --git a/0001-Remove-Brotli-compressor.patch b/0001-Remove-Brotli-compressor.patch index f733b34..cb3ba5b 100644 --- a/0001-Remove-Brotli-compressor.patch +++ b/0001-Remove-Brotli-compressor.patch @@ -1,10 +1,10 @@ -From bba585e9e4fdfc67de3b53b58b8d60923e1ccd0c Mon Sep 17 00:00:00 2001 +From d42b16c3334229cc400c6713f3bd11c8df2f70cc Mon Sep 17 00:00:00 2001 From: Michael Simacek Date: Mon, 12 Feb 2018 10:53:48 +0100 -Subject: [PATCH 1/2] Remove Brotli compressor +Subject: [PATCH 1/3] Remove Brotli compressor --- - .../commons/compress/compressors/CompressorStreamFactory.java | 7 +------ + .../compress/compressors/CompressorStreamFactory.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java @@ -33,5 +33,5 @@ index d730b9d..ab178a9 100644 if (XZ.equalsIgnoreCase(name)) { -- -2.14.3 +2.20.1 diff --git a/0002-Remove-ZSTD-compressor.patch b/0002-Remove-ZSTD-compressor.patch index dbb7755..de8a529 100644 --- a/0002-Remove-ZSTD-compressor.patch +++ b/0002-Remove-ZSTD-compressor.patch @@ -1,10 +1,10 @@ -From bab91e014f73296a8ac9a3aef2aaa324a85e9b96 Mon Sep 17 00:00:00 2001 +From 575df9b9a3519186ac801a10eb632e0e2b4ddbdd Mon Sep 17 00:00:00 2001 From: Michael Simacek Date: Mon, 12 Feb 2018 10:59:55 +0100 -Subject: [PATCH 2/2] Remove ZSTD compressor +Subject: [PATCH 2/3] Remove ZSTD compressor --- - .../compress/compressors/CompressorStreamFactory.java | 14 ++------------ + .../compressors/CompressorStreamFactory.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java @@ -54,5 +54,5 @@ index ab178a9..3817704 100644 } catch (final IOException e) { throw new CompressorException("Could not create CompressorOutputStream", e); -- -2.14.3 +2.20.1 diff --git a/0003-Avoid-use-of-internal-Mockito-API.patch b/0003-Avoid-use-of-internal-Mockito-API.patch new file mode 100644 index 0000000..a63e95f --- /dev/null +++ b/0003-Avoid-use-of-internal-Mockito-API.patch @@ -0,0 +1,32 @@ +From 4dd332d8f82d3a5f0ac6654d2c1733e44da6ddbd Mon Sep 17 00:00:00 2001 +From: Mat Booth +Date: Thu, 7 Feb 2019 14:57:25 +0000 +Subject: [PATCH 3/3] Avoid use of internal Mockito API + +--- + .../compress/utils/FixedLengthBlockOutputStreamTest.java | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/src/test/java/org/apache/commons/compress/utils/FixedLengthBlockOutputStreamTest.java b/src/test/java/org/apache/commons/compress/utils/FixedLengthBlockOutputStreamTest.java +index cfda61b..e94ccee 100644 +--- a/src/test/java/org/apache/commons/compress/utils/FixedLengthBlockOutputStreamTest.java ++++ b/src/test/java/org/apache/commons/compress/utils/FixedLengthBlockOutputStreamTest.java +@@ -39,7 +39,6 @@ import java.nio.file.Path; + import java.util.concurrent.atomic.AtomicBoolean; + import org.hamcrest.core.IsInstanceOf; + import org.junit.Test; +-import org.mockito.internal.matchers.GreaterOrEqual; + + public class FixedLengthBlockOutputStreamTest { + +@@ -294,7 +293,6 @@ public class FixedLengthBlockOutputStreamTest { + + private static void assertContainsAtOffset(String msg, byte[] expected, int offset, + byte[] actual) { +- assertThat(actual.length, new GreaterOrEqual<>(offset + expected.length)); + for (int i = 0; i < expected.length; i++) { + assertEquals(String.format("%s ([%d])", msg, i), expected[i], actual[i + offset]); + } +-- +2.20.1 + diff --git a/apache-commons-compress.spec b/apache-commons-compress.spec index 449b1e0..8c5580f 100644 --- a/apache-commons-compress.spec +++ b/apache-commons-compress.spec @@ -3,7 +3,7 @@ Name: apache-%{short_name} Version: 1.18 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Java API for working with compressed files and archivers License: ASL 2.0 URL: http://commons.apache.org/proper/commons-compress/ @@ -13,6 +13,7 @@ Source0: http://archive.apache.org/dist/commons/compress/source/%{short_n Patch0: 0001-Remove-Brotli-compressor.patch Patch1: 0002-Remove-ZSTD-compressor.patch +Patch2: 0003-Avoid-use-of-internal-Mockito-API.patch BuildRequires: maven-local BuildRequires: mvn(junit:junit) @@ -50,6 +51,9 @@ rm -r src/{main,test}/java/org/apache/commons/compress/compressors/brotli rm -r src/{main,test}/java/org/apache/commons/compress/compressors/zstandard rm src/test/java/org/apache/commons/compress/compressors/DetectCompressorTestCase.java +# Avoid using internal Mockito APIs +%patch2 -p1 + # remove osgi tests, we don't have deps for them %pom_remove_dep org.ops4j.pax.exam:::test %pom_remove_dep :org.apache.felix.framework::test @@ -73,6 +77,9 @@ rm src/test/java/org/apache/commons/compress/OsgiITest.java %doc LICENSE.txt NOTICE.txt %changelog +* Thu Feb 07 2019 Mat Booth - 1.18-3 +- Fix test suite build against Mockito 2.x + * Thu Jan 31 2019 Fedora Release Engineering - 1.18-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild