use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.
the class JKubeProjectUtilTest method getFinalOutputArtifact_withNothingProvided_returnsNull.
@Test
public void getFinalOutputArtifact_withNothingProvided_returnsNull() {
// Given
JavaProject javaProject = JavaProject.builder().build();
// When
File finalOutputArtifact = JKubeProjectUtil.getFinalOutputArtifact(javaProject);
// Then
assertThat(finalOutputArtifact).isNull();
}
use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.
the class JKubeProjectUtilTest method getFinalOutputArtifact_withProjectArtifactVersionPackagingBuildDir_returnsInferredArtifact.
@Test
public void getFinalOutputArtifact_withProjectArtifactVersionPackagingBuildDir_returnsInferredArtifact() throws IOException {
// Given
File artifactFile = new File(temporaryFolder.getRoot(), "foo-test-1.0.0.jar");
boolean artifactFileCreated = artifactFile.createNewFile();
JavaProject javaProject = JavaProject.builder().artifactId("foo-test").version("1.0.0").packaging("jar").buildDirectory(temporaryFolder.getRoot()).build();
// When
File finalOutputArtifact = JKubeProjectUtil.getFinalOutputArtifact(javaProject);
// Then
assertThat(artifactFileCreated).isTrue();
assertThat(finalOutputArtifact).hasName("foo-test-1.0.0.jar");
}
use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.
the class MavenIssueManagementEnricherTest method testMavenIssueManagementOnlyUrl.
@Test
public void testMavenIssueManagementOnlyUrl() {
final JavaProject project = JavaProject.builder().build();
project.setIssueManagementUrl("https://github.com/fabric8org.eclipse.jkube-maven-plugin/issues/");
// Setup mock behaviour
new Expectations() {
{
{
context.getProject();
result = project;
}
}
};
MavenIssueManagementEnricher enricher = new MavenIssueManagementEnricher(context);
KubernetesListBuilder builder = new KubernetesListBuilder().withItems(new DeploymentBuilder().withNewMetadata().withName("foo").endMetadata().build());
enricher.create(PlatformMode.kubernetes, builder);
Map<String, String> scmAnnotations = builder.buildFirstItem().getMetadata().getAnnotations();
assertNotNull(scmAnnotations);
assertTrue(scmAnnotations.isEmpty());
}
use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.
the class MavenIssueManagementEnricherTest method testMavenIssueManagementAll.
@Test
public void testMavenIssueManagementAll() {
final JavaProject project = JavaProject.builder().build();
project.setIssueManagementUrl("https://github.com/reactiverse/vertx-maven-plugin/issues/");
project.setIssueManagementSystem("GitHub");
// Setup mock behaviour
new Expectations() {
{
{
context.getProject();
result = project;
}
}
};
MavenIssueManagementEnricher enricher = new MavenIssueManagementEnricher(context);
KubernetesListBuilder builder = new KubernetesListBuilder().withItems(new DeploymentBuilder().withNewMetadata().withName("foo").endMetadata().build());
enricher.create(PlatformMode.kubernetes, builder);
Map<String, String> scmAnnotations = builder.buildFirstItem().getMetadata().getAnnotations();
assertNotNull(scmAnnotations);
Assert.assertEquals(2, scmAnnotations.size());
assertEquals("GitHub", scmAnnotations.get(JKubeAnnotations.ISSUE_SYSTEM.value()));
assertEquals("https://github.com/reactiverse/vertx-maven-plugin/issues/", scmAnnotations.get(JKubeAnnotations.ISSUE_TRACKER_URL.value()));
}
use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.
the class MavenIssueManagementEnricherTest method testMavenIssueManagementOnlySystem.
@Test
public void testMavenIssueManagementOnlySystem() {
final JavaProject project = JavaProject.builder().build();
project.setIssueManagementSystem("GitHub");
// Setup mock behaviour
new Expectations() {
{
{
context.getProject();
result = project;
}
}
};
MavenIssueManagementEnricher enricher = new MavenIssueManagementEnricher(context);
KubernetesListBuilder builder = new KubernetesListBuilder().withItems(new DeploymentBuilder().withNewMetadata().withName("foo").endMetadata().build());
enricher.create(PlatformMode.kubernetes, builder);
Map<String, String> scmAnnotations = builder.buildFirstItem().getMetadata().getAnnotations();
assertNotNull(scmAnnotations);
assertTrue(scmAnnotations.isEmpty());
}
Aggregations