use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.
the class MavenScmEnricherTest method testMavenNoScm.
@Test
public void testMavenNoScm() {
final JavaProject project = JavaProject.builder().build();
// Setup mock behaviour
new Expectations() {
{
{
context.getProject();
result = project;
}
}
};
MavenScmEnricher mavenScmEnricher = new MavenScmEnricher(context);
KubernetesListBuilder builder = new KubernetesListBuilder().withItems(new DeploymentBuilder().withNewMetadata().withName("foo").endMetadata().build());
mavenScmEnricher.create(PlatformMode.kubernetes, builder);
Map<String, String> scmAnnotations = builder.buildFirstItem().getMetadata().getAnnotations();
assertNotNull(scmAnnotations);
}
use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.
the class MavenScmEnricherTest method testMavenScmOnlyDevConnection.
@Test
public void testMavenScmOnlyDevConnection() {
final JavaProject project = JavaProject.builder().scmUrl("git://github.com/jkubeio/kubernetes-maven-plugin.git").build();
// Setup mock behaviour
new Expectations() {
{
{
context.getProject();
result = project;
}
}
};
MavenScmEnricher mavenScmEnricher = new MavenScmEnricher(context);
KubernetesListBuilder builder = new KubernetesListBuilder().withItems(new DeploymentBuilder().withNewMetadata().withName("foo").endMetadata().build());
mavenScmEnricher.create(PlatformMode.kubernetes, builder);
Map<String, String> scmAnnotations = builder.buildFirstItem().getMetadata().getAnnotations();
assertNotNull(scmAnnotations);
Assert.assertEquals(1, scmAnnotations.size());
assertEquals("git://github.com/jkubeio/kubernetes-maven-plugin.git", scmAnnotations.get(JKubeAnnotations.SCM_URL.value()));
Assert.assertFalse(scmAnnotations.containsKey(JKubeAnnotations.SCM_TAG.value()));
}
use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.
the class MavenIssueManagementEnricherTest method testMavenNoIssueManagement.
@Test
public void testMavenNoIssueManagement() {
final JavaProject project = JavaProject.builder().build();
// 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 MavenScmEnricherTest method testMavenScmAll.
@Test
public void testMavenScmAll() {
final JavaProject project = JavaProject.builder().scmUrl("git://github.com/jkubeio/kubernetes-maven-plugin.git").scmTag("HEAD").build();
// Setup mock behaviour
new Expectations() {
{
{
context.getProject();
result = project;
}
}
};
MavenScmEnricher mavenScmEnricher = new MavenScmEnricher(context);
KubernetesListBuilder builder = new KubernetesListBuilder().withItems(new DeploymentBuilder().withNewMetadata().withName("foo").endMetadata().build());
mavenScmEnricher.create(PlatformMode.kubernetes, builder);
Map<String, String> scmAnnotations = builder.buildFirstItem().getMetadata().getAnnotations();
assertNotNull(scmAnnotations);
Assert.assertEquals(2, scmAnnotations.size());
assertEquals("HEAD", scmAnnotations.get(JKubeAnnotations.SCM_TAG.value()));
assertEquals("git://github.com/jkubeio/kubernetes-maven-plugin.git", scmAnnotations.get(JKubeAnnotations.SCM_URL.value()));
}
use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.
the class MavenScmEnricherTest method testMavenScmOnlyConnection.
@Test
public void testMavenScmOnlyConnection() {
final JavaProject project = JavaProject.builder().scmUrl("scm:git:git://github.com/jkubeio/kubernetes-maven-plugin.git").build();
// Setup mock behaviour
new Expectations() {
{
{
context.getProject();
result = project;
}
}
};
MavenScmEnricher mavenScmEnricher = new MavenScmEnricher(context);
KubernetesListBuilder builder = new KubernetesListBuilder().withItems(new DeploymentBuilder().withNewMetadata().withName("foo").endMetadata().build());
mavenScmEnricher.create(PlatformMode.kubernetes, builder);
Map<String, String> scmAnnotations = builder.buildFirstItem().getMetadata().getAnnotations();
assertNotNull(scmAnnotations);
Assert.assertEquals(1, scmAnnotations.size());
Assert.assertFalse(scmAnnotations.containsKey(JKubeAnnotations.SCM_TAG.value()));
Assert.assertEquals("scm:git:git://github.com/jkubeio/kubernetes-maven-plugin.git", scmAnnotations.get(JKubeAnnotations.SCM_URL.value()));
}
Aggregations