use of org.eclipse.jkube.kit.common.JavaProject 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());
}
}
use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.
the class DekorateUtilTest method useDekorate_withDekorateDependency_returnsTrue.
@Test
public void useDekorate_withDekorateDependency_returnsTrue() {
// Given
JavaProject javaProject = JavaProject.builder().dependency(Dependency.builder().groupId("io.dekorate").artifactId("kubernetes-annotations").version("0.10.5").build()).build();
// When
boolean result = DekorateUtil.useDekorate(javaProject);
// Then
assertThat(result).isTrue();
}
use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.
the class DekorateUtilTest method useDekorate_withNoDekorateDependency_returnsFalse.
@Test
public void useDekorate_withNoDekorateDependency_returnsFalse() {
// Given
JavaProject javaProject = JavaProject.builder().build();
// When
boolean result = DekorateUtil.useDekorate(javaProject);
// Then
assertThat(result).isFalse();
}
use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.
the class JKubeProjectUtilTest method getProperty_whenSystemPropertyPresent_returnsSystemProperty.
@Test
public void getProperty_whenSystemPropertyPresent_returnsSystemProperty() {
// Given
new SystemMock().put("jkube.testProperty", "true");
JavaProject javaProject = JavaProject.builder().build();
// When
String result = JKubeProjectUtil.getProperty("jkube.testProperty", javaProject);
// Then
assertThat(result).isEqualTo("true");
}
use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.
the class JKubeProjectUtilTest method getFinalOutputArtifact_withArtifactAndBuildFinalNameAndPackaging_returnsArtifactFromJavaProject.
@Test
public void getFinalOutputArtifact_withArtifactAndBuildFinalNameAndPackaging_returnsArtifactFromJavaProject() throws IOException {
// Given
File artifactFile = new File(temporaryFolder.getRoot(), "foo-test-1.0.0.jar");
boolean artifactFileCreated = artifactFile.createNewFile();
JavaProject javaProject = JavaProject.builder().artifact(artifactFile).buildFinalName("foo-test-final").packaging("jar").build();
// When
File finalOutputArtifact = JKubeProjectUtil.getFinalOutputArtifact(javaProject);
// Then
assertThat(artifactFileCreated).isTrue();
assertThat(finalOutputArtifact).hasName("foo-test-1.0.0.jar");
}
Aggregations