use of io.fabric8.maven.docker.model.ImageArchiveManifest in project docker-maven-plugin by fabric8io.
the class ImageArchiveUtilTest method readEmptyArchiveFromFile.
@Test
public void readEmptyArchiveFromFile() throws IOException {
File temporaryTar = temporaryFolder.newFile();
try (FileOutputStream fileOutput = new FileOutputStream(temporaryTar);
TarArchiveOutputStream tarOutput = new TarArchiveOutputStream(fileOutput)) {
tarOutput.finish();
}
ImageArchiveManifest manifest = ImageArchiveUtil.readManifest(temporaryTar);
Assert.assertNull(manifest);
}
use of io.fabric8.maven.docker.model.ImageArchiveManifest in project docker-maven-plugin by fabric8io.
the class ImageArchiveUtilTest method findByRepoTagNonEmptyManifest.
@Test
public void findByRepoTagNonEmptyManifest() {
ImageArchiveManifest nonEmpty = new ImageArchiveManifestAdapter(createBasicManifestJson());
Assert.assertNull(ImageArchiveUtil.findEntryByRepoTag("anything", nonEmpty));
// Prefix
Assert.assertNull(ImageArchiveUtil.findEntryByRepoTag("test", nonEmpty));
// Prefix
Assert.assertNull(ImageArchiveUtil.findEntryByRepoTag("test/image", nonEmpty));
}
use of io.fabric8.maven.docker.model.ImageArchiveManifest in project docker-maven-plugin by fabric8io.
the class ImageArchiveUtilTest method readEmptyCompressedArchive.
@Test
public void readEmptyCompressedArchive() throws IOException {
byte[] emptyTar;
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZIPOutputStream gzip = new GZIPOutputStream(baos);
TarArchiveOutputStream tarOutput = new TarArchiveOutputStream(gzip)) {
tarOutput.finish();
gzip.finish();
emptyTar = baos.toByteArray();
}
ImageArchiveManifest manifest = ImageArchiveUtil.readManifest(new ByteArrayInputStream(emptyTar));
Assert.assertNull(manifest);
}
use of io.fabric8.maven.docker.model.ImageArchiveManifest in project docker-maven-plugin by fabric8io.
the class ImageArchiveUtilTest method readEmptyArchiveFromStreamWithoutMarkSupport.
@Test
public void readEmptyArchiveFromStreamWithoutMarkSupport() throws IOException {
byte[] emptyTar;
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
TarArchiveOutputStream tarOutput = new TarArchiveOutputStream(baos)) {
tarOutput.finish();
emptyTar = baos.toByteArray();
}
ImageArchiveManifest manifest = ImageArchiveUtil.readManifest(new ByteArrayInputStream(emptyTar) {
public boolean markSupported() {
return false;
}
});
Assert.assertNull(manifest);
}
use of io.fabric8.maven.docker.model.ImageArchiveManifest in project docker-maven-plugin by fabric8io.
the class ImageArchiveUtilTest method findEntriesByRepoTagPatternNonEmptyManifest.
@Test
public void findEntriesByRepoTagPatternNonEmptyManifest() {
ImageArchiveManifest nonEmpty = new ImageArchiveManifestAdapter(createBasicManifestJson());
Map<String, ImageArchiveManifestEntry> entries;
entries = ImageArchiveUtil.findEntriesByRepoTagPattern("does/not:match", nonEmpty);
Assert.assertNotNull(entries);
Assert.assertTrue(entries.isEmpty());
// Anchored pattern
entries = ImageArchiveUtil.findEntriesByRepoTagPattern("^test/image$", nonEmpty);
Assert.assertNotNull(entries);
Assert.assertTrue(entries.isEmpty());
}
Aggregations