use of io.fabric8.maven.docker.model.ImageArchiveManifestAdapter in project docker-maven-plugin by fabric8io.
the class ImageArchiveUtilTest method mapEntriesByIdSuccessfully.
@Test
public void mapEntriesByIdSuccessfully() {
ImageArchiveManifest nonEmpty = new ImageArchiveManifestAdapter(createBasicManifestJson());
Map<String, ImageArchiveManifestEntry> entries = ImageArchiveUtil.mapEntriesById(nonEmpty.getEntries());
Assert.assertNotNull(entries);
Assert.assertEquals(1, entries.size());
Assert.assertNotNull(entries.get("image-id-sha256"));
Assert.assertTrue(entries.get("image-id-sha256").getRepoTags().contains("test/image:latest"));
}
use of io.fabric8.maven.docker.model.ImageArchiveManifestAdapter in project docker-maven-plugin by fabric8io.
the class ImageArchiveUtilTest method findByRepoTagPatternSuccessfully.
@Test
public void findByRepoTagPatternSuccessfully() {
ImageArchiveManifest nonEmpty = new ImageArchiveManifestAdapter(createBasicManifestJson());
Pair<String, ImageArchiveManifestEntry> found;
// Complete match
found = ImageArchiveUtil.findEntryByRepoTagPattern("test/image:latest", nonEmpty);
Assert.assertNotNull(found);
Assert.assertEquals("test/image:latest", found.getLeft());
Assert.assertNotNull(found.getRight());
Assert.assertTrue(found.getRight().getRepoTags().contains("test/image:latest"));
// Unanchored match
found = ImageArchiveUtil.findEntryByRepoTagPattern("test/image", nonEmpty);
Assert.assertNotNull(found);
Assert.assertEquals("test/image:latest", found.getLeft());
Assert.assertNotNull(found.getRight());
Assert.assertTrue(found.getRight().getRepoTags().contains("test/image:latest"));
// Initial anchor
found = ImageArchiveUtil.findEntryByRepoTagPattern("^test/image", nonEmpty);
Assert.assertNotNull(found);
Assert.assertEquals("test/image:latest", found.getLeft());
Assert.assertNotNull(found.getRight());
Assert.assertTrue(found.getRight().getRepoTags().contains("test/image:latest"));
}
use of io.fabric8.maven.docker.model.ImageArchiveManifestAdapter in project docker-maven-plugin by fabric8io.
the class ImageArchiveUtilTest method findEntriesByRepoTagPatternEmptyManifest.
@Test
public void findEntriesByRepoTagPatternEmptyManifest() {
ImageArchiveManifest empty = new ImageArchiveManifestAdapter(new JsonArray());
Map<String, ImageArchiveManifestEntry> entries;
entries = ImageArchiveUtil.findEntriesByRepoTagPattern((String) null, null);
Assert.assertNotNull(entries);
Assert.assertTrue(entries.isEmpty());
entries = ImageArchiveUtil.findEntriesByRepoTagPattern(".*", null);
Assert.assertNotNull(entries);
Assert.assertTrue(entries.isEmpty());
entries = ImageArchiveUtil.findEntriesByRepoTagPattern((String) null, empty);
Assert.assertNotNull(entries);
Assert.assertTrue(entries.isEmpty());
entries = ImageArchiveUtil.findEntriesByRepoTagPattern(".*", empty);
Assert.assertNotNull(entries);
Assert.assertTrue(entries.isEmpty());
}
Aggregations