Search in sources :

Example 1 with ImageArchiveManifestAdapter

use of io.fabric8.maven.docker.model.ImageArchiveManifestAdapter 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));
}
Also used : ImageArchiveManifestAdapter(io.fabric8.maven.docker.model.ImageArchiveManifestAdapter) ImageArchiveManifest(io.fabric8.maven.docker.model.ImageArchiveManifest) Test(org.junit.Test)

Example 2 with ImageArchiveManifestAdapter

use of io.fabric8.maven.docker.model.ImageArchiveManifestAdapter 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());
}
Also used : ImageArchiveManifestAdapter(io.fabric8.maven.docker.model.ImageArchiveManifestAdapter) ImageArchiveManifest(io.fabric8.maven.docker.model.ImageArchiveManifest) ImageArchiveManifestEntry(io.fabric8.maven.docker.model.ImageArchiveManifestEntry) Test(org.junit.Test)

Example 3 with ImageArchiveManifestAdapter

use of io.fabric8.maven.docker.model.ImageArchiveManifestAdapter in project docker-maven-plugin by fabric8io.

the class ImageArchiveUtilTest method findByRepoTagPatternInvalidPattern.

@Test(expected = PatternSyntaxException.class)
public void findByRepoTagPatternInvalidPattern() {
    ImageArchiveManifest nonEmpty = new ImageArchiveManifestAdapter(createBasicManifestJson());
    Assert.assertNull(ImageArchiveUtil.findEntryByRepoTagPattern("*(?", nonEmpty));
}
Also used : ImageArchiveManifestAdapter(io.fabric8.maven.docker.model.ImageArchiveManifestAdapter) ImageArchiveManifest(io.fabric8.maven.docker.model.ImageArchiveManifest) Test(org.junit.Test)

Example 4 with ImageArchiveManifestAdapter

use of io.fabric8.maven.docker.model.ImageArchiveManifestAdapter in project docker-maven-plugin by fabric8io.

the class ImageArchiveUtilTest method findByRepoTagEmptyManifest.

@Test
public void findByRepoTagEmptyManifest() {
    ImageArchiveManifest empty = new ImageArchiveManifestAdapter(new JsonArray());
    Assert.assertNull(ImageArchiveUtil.findEntryByRepoTag("anything", empty));
    Assert.assertNull(ImageArchiveUtil.findEntryByRepoTag("anything", null));
    Assert.assertNull(ImageArchiveUtil.findEntryByRepoTag(null, null));
}
Also used : ImageArchiveManifestAdapter(io.fabric8.maven.docker.model.ImageArchiveManifestAdapter) JsonArray(com.google.gson.JsonArray) ImageArchiveManifest(io.fabric8.maven.docker.model.ImageArchiveManifest) Test(org.junit.Test)

Example 5 with ImageArchiveManifestAdapter

use of io.fabric8.maven.docker.model.ImageArchiveManifestAdapter in project docker-maven-plugin by fabric8io.

the class ImageArchiveUtilTest method findEntriesByRepoTagPatternInvalidPattern.

@Test(expected = PatternSyntaxException.class)
public void findEntriesByRepoTagPatternInvalidPattern() {
    ImageArchiveManifest nonEmpty = new ImageArchiveManifestAdapter(createBasicManifestJson());
    Assert.assertNull(ImageArchiveUtil.findEntryByRepoTagPattern("*(?", nonEmpty));
}
Also used : ImageArchiveManifestAdapter(io.fabric8.maven.docker.model.ImageArchiveManifestAdapter) ImageArchiveManifest(io.fabric8.maven.docker.model.ImageArchiveManifest) Test(org.junit.Test)

Aggregations

ImageArchiveManifestAdapter (io.fabric8.maven.docker.model.ImageArchiveManifestAdapter)13 ImageArchiveManifest (io.fabric8.maven.docker.model.ImageArchiveManifest)12 Test (org.junit.Test)12 ImageArchiveManifestEntry (io.fabric8.maven.docker.model.ImageArchiveManifestEntry)7 JsonArray (com.google.gson.JsonArray)3 Gson (com.google.gson.Gson)1 JsonElement (com.google.gson.JsonElement)1 JsonParseException (com.google.gson.JsonParseException)1 InputStreamReader (java.io.InputStreamReader)1 LinkedHashMap (java.util.LinkedHashMap)1 TarArchiveEntry (org.apache.commons.compress.archivers.tar.TarArchiveEntry)1 TarArchiveInputStream (org.apache.commons.compress.archivers.tar.TarArchiveInputStream)1