use of io.fabric8.maven.docker.config.ImageConfiguration in project docker-maven-plugin by fabric8io.
the class PropertyConfigHandlerTest method testInvalidDockerFileArchiveConfig.
@Test(expected = IllegalArgumentException.class)
public void testInvalidDockerFileArchiveConfig() {
String[] testData = new String[] { k(ConfigKey.NAME), "image", k(ConfigKey.DOCKER_FILE_DIR), "src/main/docker/", k(ConfigKey.DOCKER_ARCHIVE), "dockerLoad.tar", k(ConfigKey.FROM), "base" };
ImageConfiguration config = resolveExternalImageConfig(testData);
config.initAndValidate(ConfigHelper.NameFormatter.IDENTITY, null);
}
use of io.fabric8.maven.docker.config.ImageConfiguration in project docker-maven-plugin by fabric8io.
the class PropertyConfigHandlerTest method testCleanup.
@Test
public void testCleanup() {
CleanupMode mode = CleanupMode.REMOVE;
String[] testData = new String[] { k(ConfigKey.NAME), "image", k(ConfigKey.FROM), "base", k(ConfigKey.CLEANUP), mode.toParameter() };
ImageConfiguration config = resolveExternalImageConfig(testData);
assertEquals(mode, config.getBuildConfiguration().cleanupMode());
}
use of io.fabric8.maven.docker.config.ImageConfiguration in project docker-maven-plugin by fabric8io.
the class PropertyConfigHandlerTest method testPorts.
@Test
public void testPorts() {
List<ImageConfiguration> configs = resolveImage(imageConfiguration, props("docker.name", "demo", "docker.ports.1", "jolokia.port:8080", "docker.ports.2", "9090", "docker.ports.3", "0.0.0.0:80:80", "docker.from", "busybox"));
assertEquals(1, configs.size());
RunImageConfiguration runConfig = configs.get(0).getRunConfiguration();
List<String> portsAsList = runConfig.getPorts();
String[] ports = new ArrayList<>(portsAsList).toArray(new String[portsAsList.size()]);
assertArrayEquals(new String[] { "jolokia.port:8080", "9090", "0.0.0.0:80:80" }, ports);
BuildImageConfiguration buildConfig = configs.get(0).getBuildConfiguration();
ports = new ArrayList<>(buildConfig.getPorts()).toArray(new String[buildConfig.getPorts().size()]);
assertArrayEquals(new String[] { "8080", "9090", "80" }, ports);
}
use of io.fabric8.maven.docker.config.ImageConfiguration in project docker-maven-plugin by fabric8io.
the class LogOutputSpecFactoryTest method createSpec.
private LogOutputSpec createSpec(String prefix) {
LogOutputSpecFactory factory = new LogOutputSpecFactory(false, false, null);
LogConfiguration logConfig = new LogConfiguration.Builder().prefix(prefix).build();
RunImageConfiguration runConfig = new RunImageConfiguration.Builder().log(logConfig).build();
ImageConfiguration imageConfiguration = new ImageConfiguration.Builder().alias(ALIAS).name(NAME).runConfig(runConfig).build();
return factory.createSpec(CONTAINER_ID, imageConfiguration);
}
use of io.fabric8.maven.docker.config.ImageConfiguration in project docker-maven-plugin by fabric8io.
the class ContainerTrackerTest method getImageConfiguration.
private ImageConfiguration getImageConfiguration(String name, String alias, int shutdown, int kill, String preStop, boolean breakOnError) {
WaitConfiguration waitConfig = null;
if (shutdown != 0 && kill != 0) {
WaitConfiguration.Builder builder = new WaitConfiguration.Builder().shutdown(shutdown).kill(kill);
if (preStop != null) {
builder.preStop(preStop);
builder.breakOnError(breakOnError);
}
waitConfig = builder.build();
}
return new ImageConfiguration.Builder().name(name).alias(alias).runConfig(new RunImageConfiguration.Builder().wait(waitConfig).build()).build();
}
Aggregations