use of org.eclipse.jkube.kit.config.image.build.BuildConfiguration in project jkube by eclipse.
the class MicronautGeneratorTest method customize_webPortIsFirst.
@Test
public void customize_webPortIsFirst() {
// Given
when(ctx.getProject().getCompileClassPathElements()).thenReturn(Collections.emptyList());
when(ctx.getProject().getOutputDirectory()).thenReturn(new File("MOCK"));
// When
final List<ImageConfiguration> result = micronautGenerator.customize(new ArrayList<>(), false);
// Then
assertThat(result).singleElement().extracting(ImageConfiguration::getBuildConfiguration).extracting(BuildConfiguration::getPorts).asList().containsExactly("8080", "8778", "9779");
}
use of org.eclipse.jkube.kit.config.image.build.BuildConfiguration in project jkube by eclipse.
the class DefaultServiceEnricherAddMissingPartsTest method setUp.
@Before
public void setUp() {
properties = new Properties();
images = new ArrayList<>();
images.add(ImageConfiguration.builder().name("test-image").build(new BuildConfiguration()).build());
// @formatter:off
new Expectations() {
{
context.getProperties();
result = properties;
context.getConfiguration().getImages();
result = images;
context.getGav().getSanitizedArtifactId();
result = "artifact-id";
}
};
// @formatter:on
enricher = new DefaultServiceEnricher(context);
}
use of org.eclipse.jkube.kit.config.image.build.BuildConfiguration in project jkube by eclipse.
the class ContainerHandlerTest method containerPortsWithoutPortTest.
@Test
public void containerPortsWithoutPortTest() {
ContainerHandler handler = createContainerHandler(project);
// without Ports
final BuildConfiguration buildImageConfiguration2 = BuildConfiguration.builder().from("fabric8/maven:latest").cleanup("try").compressionString("gzip").build();
ImageConfiguration imageConfiguration2 = ImageConfiguration.builder().name("test").alias("test-app").build(buildImageConfiguration2).registry("docker.io").build();
images.clear();
images.add(imageConfiguration2);
containers = handler.getContainers(config, images);
assertNull(containers.get(0).getPorts());
}
use of org.eclipse.jkube.kit.config.image.build.BuildConfiguration in project jkube by eclipse.
the class ContainerHandlerTest method getContainersWithAliasTest.
@Test
public void getContainersWithAliasTest() {
project.setArtifactId("test-artifact");
project.setGroupId("test-group");
ports.add("8080");
ports.add("9090");
tags.add("latest");
tags.add("test");
ContainerHandler handler = new ContainerHandler(project.getProperties(), new GroupArtifactVersion("test-group", "test-artifact", "0"), probeHandler);
// container name with alias
final BuildConfiguration buildImageConfiguration = BuildConfiguration.builder().ports(ports).from("fabric8/maven:latest").cleanup("try").tags(tags).compressionString("gzip").build();
ImageConfiguration imageConfiguration = ImageConfiguration.builder().name("docker.io/test/test-app:1.2").alias("test-app").build(buildImageConfiguration).registry("docker-alternate.io").build();
images.clear();
images.add(imageConfiguration);
containers = handler.getContainers(config, images);
assertNotNull(containers);
assertEquals("test-app", containers.get(0).getName());
assertEquals("docker.io/test/test-app:1.2", containers.get(0).getImage());
assertEquals("IfNotPresent", containers.get(0).getImagePullPolicy());
}
use of org.eclipse.jkube.kit.config.image.build.BuildConfiguration in project jkube by eclipse.
the class ContainerHandlerTest method registryHandling.
@Test
public void registryHandling() {
// container name with alias
final BuildConfiguration buildImageConfiguration = BuildConfiguration.builder().build();
String[] testData = { "docker.io/test/test-app:1.2", "docker-alternate.io", null, null, "docker.io/test/test-app:1.2", "test/test-app:1.2", "docker-image-config.io", "docker-pull.io", "docker-default.io", "docker-image-config.io/test/test-app:1.2", "test/test-app", null, "docker-pull.io", "docker-default.io", "docker-pull.io/test/test-app:latest", "test/test-app", null, null, "docker-default.io", "docker-default.io/test/test-app:latest" };
for (int i = 0; i < testData.length; i += 5) {
JavaProject testProject = JavaProject.builder().properties(new Properties()).build();
Properties testProps = new Properties();
if (testData[i + 2] != null) {
testProps.put("jkube.docker.pull.registry", testData[i + 2]);
}
if (testData[i + 3] != null) {
testProps.put("jkube.docker.registry", testData[i + 3]);
}
Properties properties = testProject.getProperties();
properties.putAll(testProps);
testProject.setProperties(properties);
ContainerHandler handler = createContainerHandler(testProject);
// container name with alias
ImageConfiguration imageConfiguration = ImageConfiguration.builder().build(buildImageConfiguration).name(testData[i]).registry(testData[i + 1]).build();
images.clear();
images.add(imageConfiguration);
containers = handler.getContainers(config, images);
assertNotNull(containers);
assertEquals(testData[i + 4], containers.get(0).getImage());
}
}
Aggregations