1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.commons.compress;
21
22 import static org.junit.jupiter.api.Assertions.assertEquals;
23 import static org.junit.jupiter.api.Assertions.assertNotNull;
24
25 import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
26 import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
27 import org.apache.commons.compress.archivers.tar.TarConstants;
28 import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
29 import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
30 import org.junit.jupiter.api.Test;
31
32 class ChainingTest extends AbstractTest {
33
34 @Test
35 void testTarBzip2() throws Exception {
36 try (TarArchiveInputStream is = new TarArchiveInputStream(new BZip2CompressorInputStream(newInputStream("bla.tar.bz2")))) {
37 final TarArchiveEntry entry = is.getNextEntry();
38 assertNotNull(entry);
39 assertEquals("test1.xml", entry.getName());
40 assertEquals(TarConstants.LF_NORMAL, entry.getLinkFlag());
41 }
42 }
43
44 @Test
45 void testTarGzip() throws Exception {
46 try (TarArchiveInputStream is = new TarArchiveInputStream(new GzipCompressorInputStream(newInputStream("bla.tgz")))) {
47 final TarArchiveEntry entry = is.getNextEntry();
48 assertNotNull(entry);
49 assertEquals("test1.xml", entry.getName());
50 assertEquals(TarConstants.LF_NORMAL, entry.getLinkFlag());
51 }
52 }
53 }