You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/02/27 22:35:18 UTC
(commons-compress) branch master updated: Don't use a deprecate method
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git
The following commit(s) were added to refs/heads/master by this push:
new c9864c8a8 Don't use a deprecate method
c9864c8a8 is described below
commit c9864c8a887e735fd05951eaaf9881478d5c53ca
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Feb 27 17:34:51 2024 -0500
Don't use a deprecate method
- Move test fixture
- Sort members
- Normalize local variable name
- Javadoc
- Use final
- Fail the JUnit way
- Don't log to the console
---
.../commons/compress/compressors/GZipTest.java | 50 ++++++++++-----------
.../compress-666.tar.gz} | Bin
2 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/src/test/java/org/apache/commons/compress/compressors/GZipTest.java b/src/test/java/org/apache/commons/compress/compressors/GZipTest.java
index 4b9d6c3e4..2743e1d27 100644
--- a/src/test/java/org/apache/commons/compress/compressors/GZipTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/GZipTest.java
@@ -21,6 +21,8 @@ package org.apache.commons.compress.compressors;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -53,6 +55,29 @@ import org.junit.jupiter.params.provider.ValueSource;
public final class GZipTest extends AbstractTest {
+ /**
+ * Tests https://issues.apache.org/jira/browse/COMPRESS-666
+ */
+ @Disabled
+ @Test
+ public void testCompress666() throws ExecutionException, InterruptedException {
+ final ExecutorService executorService = Executors.newFixedThreadPool(10);
+ final List<Future<?>> tasks = IntStream.range(0, 200).mapToObj(index -> executorService.submit(() -> {
+ try (InputStream inputStream = this.getClass().getResourceAsStream("/COMPRESS-666/compress-666.tar.gz");
+ TarArchiveInputStream tarInputStream = new TarArchiveInputStream(new GZIPInputStream(inputStream))) {
+ TarArchiveEntry tarEntry;
+ while ((tarEntry = tarInputStream.getNextEntry()) != null) {
+ assertNotNull(tarEntry);
+ }
+ } catch (final IOException e) {
+ fail(e);
+ }
+ })).collect(Collectors.toList());
+ for (final Future<?> future : tasks) {
+ future.get();
+ }
+ }
+
@Test
public void testConcatenatedStreamsReadFirstOnly() throws Exception {
final File input = getFile("multiple.gz");
@@ -77,31 +102,6 @@ public final class GZipTest extends AbstractTest {
}
}
- @Disabled
- @Test
- void testCompress666() throws ExecutionException, InterruptedException {
- ExecutorService executorService = Executors.newFixedThreadPool(10);
- List<Future<?>> tasks = IntStream.range(0, 200)
- .mapToObj(_idx -> executorService.submit(() -> {
- try (InputStream inputStream = this.getClass()
- .getResourceAsStream("/myArchive.tar.gz");
- TarArchiveInputStream tarInputStream =
- new TarArchiveInputStream(new GZIPInputStream(inputStream))) {
- TarArchiveEntry tarEntry;
- while ((tarEntry = tarInputStream.getNextTarEntry()) != null) {
- System.out.printf(
- "Reading entry %s with size %d\n", tarEntry.getName(), tarEntry.getSize());
- }
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
- }))
- .collect(Collectors.toList());
- for (Future<?> future : tasks) {
- future.get();
- }
- }
-
/**
* @see "https://issues.apache.org/jira/browse/COMPRESS-84"
*/
diff --git a/src/test/resources/myArchive.tar.gz b/src/test/resources/COMPRESS-666/compress-666.tar.gz
similarity index 100%
rename from src/test/resources/myArchive.tar.gz
rename to src/test/resources/COMPRESS-666/compress-666.tar.gz