use of io.fabric8.maven.docker.config.RunImageConfiguration in project docker-maven-plugin by fabric8io.
the class LogOutputSpecFactory method extractLogConfiguration.
private LogConfiguration extractLogConfiguration(ImageConfiguration imageConfiguration) {
RunImageConfiguration runConfig = imageConfiguration.getRunConfiguration();
LogConfiguration logConfig = null;
if (runConfig != null) {
logConfig = runConfig.getLogConfiguration();
}
if (logConfig == null) {
logConfig = LogConfiguration.DEFAULT;
}
return logConfig;
}
use of io.fabric8.maven.docker.config.RunImageConfiguration in project docker-maven-plugin by fabric8io.
the class AbstractConfigHandlerTest method validateRunConfiguration.
protected void validateRunConfiguration(RunImageConfiguration runConfig) {
assertEquals(a("/foo", "/tmp:/tmp"), runConfig.getVolumeConfiguration().getBind());
assertEquals(a("CAP"), runConfig.getCapAdd());
assertEquals(a("CAP"), runConfig.getCapDrop());
assertEquals("command.sh", runConfig.getCmd().getShell());
assertEquals(a("8.8.8.8"), runConfig.getDns());
assertEquals(a("example.com"), runConfig.getDnsSearch());
assertEquals("domain.com", runConfig.getDomainname());
assertEquals("entrypoint.sh", runConfig.getEntrypoint().getShell());
assertEquals(a("localhost:127.0.0.1"), runConfig.getExtraHosts());
assertEquals("subdomain", runConfig.getHostname());
assertEquals(a("redis"), runConfig.getLinks());
assertEquals((Long) 1L, runConfig.getMemory());
assertEquals((Long) 1L, runConfig.getMemorySwap());
assertEquals(getRunNamingStrategy(), runConfig.getNamingStrategy());
assertEquals(getEnvPropertyFile(), runConfig.getEnvPropertyFile());
assertEquals("/tmp/props.txt", runConfig.getPortPropertyFile());
assertEquals(a("8081:8080"), runConfig.getPorts());
assertEquals(true, runConfig.getPrivileged());
assertEquals("tomcat", runConfig.getUser());
assertEquals(a("from"), runConfig.getVolumeConfiguration().getFrom());
assertEquals("foo", runConfig.getWorkingDir());
validateEnv(runConfig.getEnv());
// not sure it's worth it to implement 'equals/hashcode' for these
RestartPolicy policy = runConfig.getRestartPolicy();
assertEquals("on-failure", policy.getName());
assertEquals(1, policy.getRetry());
}
use of io.fabric8.maven.docker.config.RunImageConfiguration 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.RunImageConfiguration 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.RunImageConfiguration in project docker-maven-plugin by fabric8io.
the class PropertyConfigHandlerTest method testPortsFromConfigAndProperties.
@Test
public void testPortsFromConfigAndProperties() {
imageConfiguration = new ImageConfiguration.Builder().externalConfig(new HashMap<String, String>()).buildConfig(new BuildImageConfiguration.Builder().ports(Arrays.asList("1234")).build()).runConfig(new RunImageConfiguration.Builder().ports(Arrays.asList("jolokia.port:1234")).build()).build();
makeExternalConfigUse(PropertyMode.Override);
List<ImageConfiguration> configs = resolveImage(imageConfiguration, props("docker.name", "demo", "docker.ports.1", "9090", "docker.ports.2", "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[] { "9090", "0.0.0.0:80:80", "jolokia.port:1234" }, ports);
BuildImageConfiguration buildConfig = configs.get(0).getBuildConfiguration();
ports = new ArrayList<>(buildConfig.getPorts()).toArray(new String[buildConfig.getPorts().size()]);
assertArrayEquals(new String[] { "9090", "80", "1234" }, ports);
}
Aggregations