use of io.fabric8.kubernetes.api.model.extensions.DeploymentBuilder in project fabric8-maven-plugin by fabric8io.
the class ImageEnricherTest method checkEnrichDeployment.
@Test
public void checkEnrichDeployment() throws Exception {
KubernetesListBuilder builder = new KubernetesListBuilder().addToItems(new DeploymentBuilder().build());
imageEnricher.create(PlatformMode.kubernetes, builder);
assertCorrectlyGeneratedResources(builder.build(), "Deployment");
}
use of io.fabric8.kubernetes.api.model.extensions.DeploymentBuilder in project fabric8-maven-plugin by fabric8io.
the class MavenIssueManagementEnricherTest method testMavenIssueManagementAll.
@Test
public void testMavenIssueManagementAll() {
final MavenProject project = new MavenProject();
final IssueManagement issueManagement = new IssueManagement();
issueManagement.setSystem("GitHub");
issueManagement.setUrl("https://github.com/reactiverse/vertx-maven-plugin/issues/");
project.setIssueManagement(issueManagement);
// 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(Fabric8Annotations.ISSUE_SYSTEM.value()));
assertEquals("https://github.com/reactiverse/vertx-maven-plugin/issues/", scmAnnotations.get(Fabric8Annotations.ISSUE_TRACKER_URL.value()));
}
use of io.fabric8.kubernetes.api.model.extensions.DeploymentBuilder in project fabric8-maven-plugin by fabric8io.
the class MavenIssueManagementEnricherTest method testMavenIssueManagementOnlyUrl.
@Test
public void testMavenIssueManagementOnlyUrl() {
final MavenProject project = new MavenProject();
final IssueManagement issueManagement = new IssueManagement();
issueManagement.setUrl("https://github.com/fabric8io/fabric8-maven-plugin/issues/");
project.setIssueManagement(issueManagement);
// 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 io.fabric8.kubernetes.api.model.extensions.DeploymentBuilder in project fabric8-maven-plugin by fabric8io.
the class MavenScmEnricherTest method testMavenScmAll.
@Test
public void testMavenScmAll() {
final MavenProject project = new MavenProject();
final Scm scm = new Scm();
scm.setConnection("scm:git:git://github.com/fabric8io/fabric8-maven-plugin.git");
scm.setDeveloperConnection("scm:git:git://github.com/fabric8io/fabric8-maven-plugin.git");
scm.setTag("HEAD");
scm.setUrl("git://github.com/fabric8io/fabric8-maven-plugin.git");
project.setScm(scm);
// 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(Fabric8Annotations.SCM_TAG.value()));
assertEquals("git://github.com/fabric8io/fabric8-maven-plugin.git", scmAnnotations.get(Fabric8Annotations.SCM_URL.value()));
}
use of io.fabric8.kubernetes.api.model.extensions.DeploymentBuilder in project fabric8-maven-plugin by fabric8io.
the class MavenScmEnricherTest method testMavenScmOnlyUrl.
@Test
public void testMavenScmOnlyUrl() {
final MavenProject project = new MavenProject();
final Scm scm = new Scm();
scm.setDeveloperConnection("scm:git:git://github.com/fabric8io/fabric8-maven-plugin.git");
project.setScm(scm);
// 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("HEAD", scmAnnotations.get(Fabric8Annotations.SCM_TAG.value()));
}
Aggregations