2020
2121package land .oras .utils ;
2222
23+ import static org .junit .jupiter .api .Assertions .assertNotNull ;
2324import static org .junit .jupiter .api .Assertions .assertThrows ;
2425import static org .junit .jupiter .api .Assertions .assertTrue ;
2526import static org .mockito .Mockito .doReturn ;
2829import java .io .IOException ;
2930import java .nio .file .Files ;
3031import java .nio .file .Path ;
32+ import java .nio .file .Paths ;
3133import java .nio .file .attribute .PosixFilePermission ;
3234import java .util .Set ;
3335import land .oras .LocalPath ;
3436import land .oras .exception .OrasException ;
3537import org .apache .commons .compress .archivers .tar .TarArchiveEntry ;
3638import org .junit .jupiter .api .BeforeAll ;
39+ import org .junit .jupiter .api .Disabled ;
3740import org .junit .jupiter .api .Test ;
3841import org .junit .jupiter .api .io .CleanupMode ;
3942import org .junit .jupiter .api .io .TempDir ;
4043import org .junit .jupiter .api .parallel .Execution ;
4144import org .junit .jupiter .api .parallel .ExecutionMode ;
45+ import org .junit .jupiter .params .ParameterizedTest ;
46+ import org .junit .jupiter .params .provider .ValueSource ;
4247import org .slf4j .Logger ;
4348import org .slf4j .LoggerFactory ;
4449
@@ -62,6 +67,9 @@ class ArchiveUtilsTest {
6267 @ TempDir (cleanup = CleanupMode .ON_SUCCESS )
6368 private static Path targetZstdDir ;
6469
70+ @ TempDir (cleanup = CleanupMode .ON_SUCCESS )
71+ private static Path existingArchiveDir ;
72+
6573 @ BeforeAll
6674 static void beforeAll () throws Exception {
6775 // Create directory structure with few files
@@ -190,6 +198,16 @@ void shouldCreateTarGzAndExtractIt() throws Exception {
190198 assertTrue (Files .exists (temp ), "Temp should exist" );
191199 }
192200
201+ @ ParameterizedTest
202+ @ ValueSource (strings = {"jenkins-chart.tgz" , "jenkins-sources.tar.gz" })
203+ @ Disabled ("https://issues.apache.org/jira/browse/COMPRESS-705" )
204+ void shouldExtractSeveralExistingArchive (String file ) {
205+ Path archive = Paths .get ("src/test/resources/archives" ).resolve (file );
206+ assertNotNull (archive , "Archive should exist" );
207+ assertTrue (Files .exists (archive ), "Archive should exist" );
208+ ArchiveUtils .uncompressuntar (archive , existingArchiveDir , SupportedCompression .GZIP .getMediaType ());
209+ }
210+
193211 @ Test
194212 void shouldCreateTarZstdAndExtractIt () throws Exception {
195213 LocalPath directory = LocalPath .of (archiveDir , Const .BLOB_DIR_ZSTD_MEDIA_TYPE );
0 commit comments