2222
2323import static org .junit .jupiter .api .Assertions .assertNotNull ;
2424
25- import java .io .IOException ;
2625import java .nio .file .Path ;
26+ import land .oras .utils .ArchiveUtils ;
27+ import land .oras .utils .Const ;
2728import org .junit .jupiter .api .Test ;
2829import org .junit .jupiter .api .io .TempDir ;
2930import org .junit .jupiter .api .parallel .Execution ;
@@ -53,7 +54,7 @@ void shouldPUllManifest() {
5354 }
5455
5556 @ Test
56- void shouldPullOneBlob () throws IOException {
57+ void shouldPullOneBlob () {
5758 Registry registry = Registry .builder ().build ();
5859 ContainerRef containerRef1 = ContainerRef .parse ("ghcr.io/oras-project/oras:main" );
5960 Index index = registry .getIndex (containerRef1 );
@@ -63,4 +64,14 @@ void shouldPullOneBlob() throws IOException {
6364 registry .fetchBlob (containerRef1 .withDigest (oneLayer .getDigest ()), tempDir .resolve ("my-blob" ));
6465 assertNotNull (tempDir .resolve ("my-blob" ));
6566 }
67+
68+ @ Test
69+ void shouldPullArtifact () {
70+ Registry registry = Registry .builder ().build ();
71+ ContainerRef artifact = ContainerRef .parse ("ghcr.io/aquasecurity/trivy-db:2" );
72+ registry .pullArtifact (artifact , tempDir , false );
73+ assertNotNull (tempDir .resolve ("db.tar.gz" ));
74+ ArchiveUtils .uncompressuntar (
75+ tempDir .resolve ("db.tar.gz" ), tempDir .resolve ("db" ), Const .DEFAULT_BLOB_DIR_MEDIA_TYPE );
76+ }
6677}
0 commit comments