Search in sources :

Example 51 with JavaProject

use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.

the class MavenUtilTest method testJKubeProjectConversion.

@Test
public void testJKubeProjectConversion() throws DependencyResolutionRequiredException {
    MavenProject mavenProject = getMavenProject();
    JavaProject project = MavenUtil.convertMavenProjectToJKubeProject(mavenProject, getMavenSession());
    assertEquals("testProject", project.getName());
    assertEquals("org.eclipse.jkube", project.getGroupId());
    assertEquals("test-project", project.getArtifactId());
    assertEquals("0.1.0", project.getVersion());
    assertEquals("test description", project.getDescription());
    assertEquals("target", project.getOutputDirectory().getName());
    assertEquals(".", project.getBuildDirectory().getName());
    assertEquals("https://www.eclipse.org/jkube/", project.getDocumentationUrl());
    assertEquals(1, mavenProject.getCompileClasspathElements().size());
    assertEquals("./target", mavenProject.getCompileClasspathElements().get(0));
    assertEquals("bar", project.getProperties().get("foo"));
    assertEquals("https://projects.eclipse.org/projects/ecd.jkube", project.getUrl());
    assertEquals(Collections.singletonList(org.eclipse.jkube.kit.common.Maintainer.builder().name("Dev1").email("dev1@eclipse.org").build()), project.getMaintainers());
}
Also used : JavaProject(org.eclipse.jkube.kit.common.JavaProject) MavenProject(org.apache.maven.project.MavenProject) Test(org.junit.Test)

Example 52 with JavaProject

use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.

the class SpringBootUtilTest method getSpringBootPluginConfiguration_whenSpringBootGradlePluginPresent_thenReturnsPluginConfiguration.

@Test
public void getSpringBootPluginConfiguration_whenSpringBootGradlePluginPresent_thenReturnsPluginConfiguration() {
    // Given
    JavaProject javaProject = JavaProject.builder().plugin(Plugin.builder().groupId("org.springframework.boot").artifactId("org.springframework.boot.gradle.plugin").configuration(Collections.singletonMap("mainClass", "com.example.ExampleApplication")).build()).build();
    // When
    Map<String, Object> configuration = SpringBootUtil.getSpringBootPluginConfiguration(javaProject);
    // Then
    assertNotNull(configuration);
    assertEquals("com.example.ExampleApplication", configuration.get("mainClass").toString());
}
Also used : JavaProject(org.eclipse.jkube.kit.common.JavaProject) Test(org.junit.Test)

Aggregations

JavaProject (org.eclipse.jkube.kit.common.JavaProject)52 Test (org.junit.Test)43 File (java.io.File)16 KubernetesListBuilder (io.fabric8.kubernetes.api.model.KubernetesListBuilder)9 DeploymentBuilder (io.fabric8.kubernetes.api.model.apps.DeploymentBuilder)9 Expectations (mockit.Expectations)9 HashMap (java.util.HashMap)7 Properties (java.util.Properties)6 Configuration (org.gradle.api.artifacts.Configuration)6 DeprecatableConfiguration (org.gradle.internal.deprecation.DeprecatableConfiguration)6 IOException (java.io.IOException)5 Collections (java.util.Collections)4 List (java.util.List)4 MavenProject (org.apache.maven.project.MavenProject)4 Plugin (org.eclipse.jkube.kit.common.Plugin)4 JKubeEnricherContext (org.eclipse.jkube.kit.enricher.api.JKubeEnricherContext)4 ArrayList (java.util.ArrayList)3 Optional (java.util.Optional)3 Collectors (java.util.stream.Collectors)3 StringUtils (org.apache.commons.lang3.StringUtils)3