Search in sources :

Example 21 with JavaProject

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

the class MavenIssueManagementEnricher method getAnnotations.

private Map<String, String> getAnnotations() {
    Map<String, String> annotations = new HashMap<>();
    if (getContext() instanceof JKubeEnricherContext) {
        JKubeEnricherContext jkubeEnricherContext = (JKubeEnricherContext) getContext();
        JavaProject rootProject = jkubeEnricherContext.getProject();
        if (hasIssueManagement(rootProject)) {
            String system = rootProject.getIssueManagementSystem();
            String url = rootProject.getIssueManagementUrl();
            if (StringUtils.isNotEmpty(system) && StringUtils.isNotEmpty(url)) {
                annotations.put(JKubeAnnotations.ISSUE_SYSTEM.value(), system);
                annotations.put(JKubeAnnotations.ISSUE_TRACKER_URL.value(), url);
            }
        }
    }
    return annotations;
}
Also used : JavaProject(org.eclipse.jkube.kit.common.JavaProject) JKubeEnricherContext(org.eclipse.jkube.kit.enricher.api.JKubeEnricherContext) HashMap(java.util.HashMap)

Example 22 with JavaProject

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

the class MavenScmEnricher method getAnnotations.

private Map<String, String> getAnnotations() {
    Map<String, String> annotations = new HashMap<>();
    if (getContext() instanceof JKubeEnricherContext) {
        JKubeEnricherContext jkubeEnricherContext = (JKubeEnricherContext) getContext();
        JavaProject rootProject = jkubeEnricherContext.getProject();
        if (hasScm(rootProject)) {
            String url = rootProject.getScmUrl();
            String tag = rootProject.getScmTag();
            if (StringUtils.isNotEmpty(tag)) {
                annotations.put(JKubeAnnotations.SCM_TAG.value(), tag);
            }
            if (StringUtils.isNotEmpty(url)) {
                annotations.put(JKubeAnnotations.SCM_URL.value(), url);
            }
        }
    }
    return annotations;
}
Also used : JavaProject(org.eclipse.jkube.kit.common.JavaProject) JKubeEnricherContext(org.eclipse.jkube.kit.enricher.api.JKubeEnricherContext) HashMap(java.util.HashMap)

Example 23 with JavaProject

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

the class AssemblyConfigurationSourceTest method testReactorProjects.

@Test
public void testReactorProjects() {
    JavaProject project1 = JavaProject.builder().build();
    JavaProject project2 = JavaProject.builder().build();
    JKubeConfiguration buildContext = JKubeConfiguration.builder().sourceDirectory("/src/docker").outputDirectory("/output/docker").reactorProjects(Arrays.asList(project1, project2)).build();
    AssemblyConfigurationSource source = new AssemblyConfigurationSource(buildContext, null, null);
    assertEquals(2, source.getReactorProjects().size());
}
Also used : JavaProject(org.eclipse.jkube.kit.common.JavaProject) JKubeConfiguration(org.eclipse.jkube.kit.common.JKubeConfiguration) Test(org.junit.Test)

Example 24 with JavaProject

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

the class AssemblyManagerTest method testEnsureThatArtifactFileIsSetWithProjectArtifactSet.

@Test
public void testEnsureThatArtifactFileIsSetWithProjectArtifactSet() throws IOException {
    // Given
    JavaProject project = JavaProject.builder().artifact(temporaryFolder.newFile("temp-project-0.0.1.jar")).build();
    // When
    final File artifactFile = assemblyManager.ensureThatArtifactFileIsSet(project);
    // Then
    assertThat(artifactFile).isFile().exists().hasName("temp-project-0.0.1.jar");
}
Also used : JavaProject(org.eclipse.jkube.kit.common.JavaProject) File(java.io.File) Test(org.junit.Test)

Example 25 with JavaProject

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

the class AssemblyManagerTest method testEnsureThatArtifactFileIsSetWithNullProjectArtifact.

@Test
public void testEnsureThatArtifactFileIsSetWithNullProjectArtifact() throws IOException {
    // Given
    assertTrue(new File(targetDirectory, "foo-project-0.0.1.jar").createNewFile());
    JavaProject project = JavaProject.builder().buildDirectory(targetDirectory).packaging("jar").buildFinalName("foo-project-0.0.1").build();
    // When
    final File artifactFile = assemblyManager.ensureThatArtifactFileIsSet(project);
    // Then
    assertThat(artifactFile).isFile().exists().hasName("foo-project-0.0.1.jar");
}
Also used : JavaProject(org.eclipse.jkube.kit.common.JavaProject) File(java.io.File) 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