Search in sources :

Example 11 with ImageConfiguration

use of io.fabric8.maven.docker.config.ImageConfiguration in project docker-maven-plugin by fabric8io.

the class PropertyConfigHandlerTest method testResolve.

@Test
public void testResolve() {
    ImageConfiguration resolved = resolveExternalImageConfig(getTestData());
    validateBuildConfiguration(resolved.getBuildConfiguration());
    validateRunConfiguration(resolved.getRunConfiguration());
// validateWaitConfiguraion(resolved.getRunConfiguration().getWaitConfiguration());
}
Also used : BuildImageConfiguration(io.fabric8.maven.docker.config.BuildImageConfiguration) AbstractConfigHandlerTest(io.fabric8.maven.docker.config.handler.AbstractConfigHandlerTest)

Example 12 with ImageConfiguration

use of io.fabric8.maven.docker.config.ImageConfiguration in project docker-maven-plugin by fabric8io.

the class PropertyConfigHandlerTest method testDockerfile.

@Test
public void testDockerfile() throws Exception {
    String[] testData = new String[] { k(ConfigKey.NAME), "image", k(ConfigKey.DOCKER_FILE_DIR), "src/main/docker/", k(ConfigKey.FROM), "busybox" };
    ImageConfiguration config = resolveExternalImageConfig(testData);
    config.initAndValidate(ConfigHelper.NameFormatter.IDENTITY, null);
    assertTrue(config.getBuildConfiguration().isDockerFileMode());
    assertEquals(new File("src/main/docker/Dockerfile"), config.getBuildConfiguration().getDockerFile());
}
Also used : BuildImageConfiguration(io.fabric8.maven.docker.config.BuildImageConfiguration) File(java.io.File) AbstractConfigHandlerTest(io.fabric8.maven.docker.config.handler.AbstractConfigHandlerTest)

Example 13 with ImageConfiguration

use of io.fabric8.maven.docker.config.ImageConfiguration in project docker-maven-plugin by fabric8io.

the class PropertyConfigHandlerTest method testSpecificEnv.

@Test
public void testSpecificEnv() throws Exception {
    List<ImageConfiguration> configs = resolveImage(imageConfiguration, props("docker.from", "baase", "docker.name", "demo", "docker.envBuild.HOME", "/tmp", "docker.envRun.root.dir", "/bla"));
    assertEquals(1, configs.size());
    ImageConfiguration calcConfig = configs.get(0);
    Map<String, String> env;
    env = calcConfig.getBuildConfiguration().getEnv();
    assertEquals(1, env.size());
    assertEquals("/tmp", env.get("HOME"));
    env = calcConfig.getRunConfiguration().getEnv();
    assertEquals(1, env.size());
    assertEquals("/bla", env.get("root.dir"));
}
Also used : BuildImageConfiguration(io.fabric8.maven.docker.config.BuildImageConfiguration) AbstractConfigHandlerTest(io.fabric8.maven.docker.config.handler.AbstractConfigHandlerTest)

Example 14 with ImageConfiguration

use of io.fabric8.maven.docker.config.ImageConfiguration in project docker-maven-plugin by fabric8io.

the class PropertyConfigHandlerTest method testCleanupDefault.

@Test
public void testCleanupDefault() {
    String[] testData = new String[] { k(ConfigKey.NAME), "image", k(ConfigKey.FROM), "base" };
    ImageConfiguration config = resolveExternalImageConfig(testData);
    assertEquals(DEFAULT_CLEANUP, config.getBuildConfiguration().cleanupMode().toParameter());
}
Also used : BuildImageConfiguration(io.fabric8.maven.docker.config.BuildImageConfiguration) AbstractConfigHandlerTest(io.fabric8.maven.docker.config.handler.AbstractConfigHandlerTest)

Example 15 with ImageConfiguration

use of io.fabric8.maven.docker.config.ImageConfiguration in project docker-maven-plugin by fabric8io.

the class PropertyConfigHandlerTest method testEnvAndLabels.

@Test
public void testEnvAndLabels() throws Exception {
    List<ImageConfiguration> configs = resolveImage(imageConfiguration, props("docker.from", "baase", "docker.name", "demo", "docker.env.HOME", "/tmp", "docker.env.root.dir", "/bla", "docker.labels.version", "1.0.0", "docker.labels.blub.bla.foobar", "yep"));
    assertEquals(1, configs.size());
    ImageConfiguration calcConfig = configs.get(0);
    for (Map env : new Map[] { calcConfig.getBuildConfiguration().getEnv(), calcConfig.getRunConfiguration().getEnv() }) {
        assertEquals(2, env.size());
        assertEquals("/tmp", env.get("HOME"));
        assertEquals("/bla", env.get("root.dir"));
    }
    for (Map labels : new Map[] { calcConfig.getBuildConfiguration().getLabels(), calcConfig.getRunConfiguration().getLabels() }) {
        assertEquals(2, labels.size());
        assertEquals("1.0.0", labels.get("version"));
        assertEquals("yep", labels.get("blub.bla.foobar"));
    }
}
Also used : BuildImageConfiguration(io.fabric8.maven.docker.config.BuildImageConfiguration) AbstractConfigHandlerTest(io.fabric8.maven.docker.config.handler.AbstractConfigHandlerTest)

Aggregations

BuildImageConfiguration (io.fabric8.maven.docker.config.BuildImageConfiguration)50 ImageConfiguration (io.fabric8.maven.docker.config.ImageConfiguration)38 AbstractConfigHandlerTest (io.fabric8.maven.docker.config.handler.AbstractConfigHandlerTest)24 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)14 Test (org.junit.Test)13 ProcessorConfig (io.fabric8.maven.core.config.ProcessorConfig)10 File (java.io.File)9 IOException (java.io.IOException)9 DockerAccessException (io.fabric8.maven.docker.access.DockerAccessException)8 ArrayList (java.util.ArrayList)8 GeneratorContext (io.fabric8.maven.generator.api.GeneratorContext)7 MojoFailureException (org.apache.maven.plugin.MojoFailureException)7 Before (org.junit.Before)7 VolumeConfig (io.fabric8.maven.core.config.VolumeConfig)6 Fabric8ServiceException (io.fabric8.maven.core.service.Fabric8ServiceException)6 RunImageConfiguration (io.fabric8.maven.docker.config.RunImageConfiguration)5 Expectations (mockit.Expectations)5 KubernetesClientException (io.fabric8.kubernetes.client.KubernetesClientException)4 ExecException (io.fabric8.maven.docker.access.ExecException)4 WatchImageConfiguration (io.fabric8.maven.docker.config.WatchImageConfiguration)4