Search in sources :

Example 86 with DeploymentBuilder

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");
}
Also used : KubernetesListBuilder(io.fabric8.kubernetes.api.model.KubernetesListBuilder) DeploymentBuilder(io.fabric8.kubernetes.api.model.apps.DeploymentBuilder) Test(org.junit.Test)

Example 87 with DeploymentBuilder

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()));
}
Also used : Expectations(mockit.Expectations) KubernetesListBuilder(io.fabric8.kubernetes.api.model.KubernetesListBuilder) MavenProject(org.apache.maven.project.MavenProject) IssueManagement(org.apache.maven.model.IssueManagement) DeploymentBuilder(io.fabric8.kubernetes.api.model.apps.DeploymentBuilder) Test(org.junit.Test)

Example 88 with DeploymentBuilder

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());
}
Also used : Expectations(mockit.Expectations) KubernetesListBuilder(io.fabric8.kubernetes.api.model.KubernetesListBuilder) MavenProject(org.apache.maven.project.MavenProject) IssueManagement(org.apache.maven.model.IssueManagement) DeploymentBuilder(io.fabric8.kubernetes.api.model.apps.DeploymentBuilder) Test(org.junit.Test)

Example 89 with DeploymentBuilder

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()));
}
Also used : Expectations(mockit.Expectations) KubernetesListBuilder(io.fabric8.kubernetes.api.model.KubernetesListBuilder) MavenProject(org.apache.maven.project.MavenProject) Scm(org.apache.maven.model.Scm) DeploymentBuilder(io.fabric8.kubernetes.api.model.apps.DeploymentBuilder) Test(org.junit.Test)

Example 90 with DeploymentBuilder

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()));
}
Also used : Expectations(mockit.Expectations) KubernetesListBuilder(io.fabric8.kubernetes.api.model.KubernetesListBuilder) MavenProject(org.apache.maven.project.MavenProject) Scm(org.apache.maven.model.Scm) DeploymentBuilder(io.fabric8.kubernetes.api.model.apps.DeploymentBuilder) Test(org.junit.Test)

Aggregations

DeploymentBuilder (io.fabric8.kubernetes.api.model.apps.DeploymentBuilder)153 Deployment (io.fabric8.kubernetes.api.model.apps.Deployment)80 KubernetesListBuilder (io.fabric8.kubernetes.api.model.KubernetesListBuilder)60 Test (org.junit.Test)60 Test (org.junit.jupiter.api.Test)32 ContainerBuilder (io.fabric8.kubernetes.api.model.ContainerBuilder)26 Expectations (mockit.Expectations)26 Test (org.testng.annotations.Test)22 HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)17 ArrayList (java.util.ArrayList)17 Container (io.fabric8.kubernetes.api.model.Container)16 HashMap (java.util.HashMap)16 PodBuilder (io.fabric8.kubernetes.api.model.PodBuilder)15 PodTemplateSpec (io.fabric8.kubernetes.api.model.PodTemplateSpec)15 DeploymentBuilder (io.fabric8.kubernetes.api.model.extensions.DeploymentBuilder)14 Properties (java.util.Properties)14 Pod (io.fabric8.kubernetes.api.model.Pod)13 PodTemplateSpecBuilder (io.fabric8.kubernetes.api.model.PodTemplateSpecBuilder)13 ObjectMetaBuilder (io.fabric8.kubernetes.api.model.ObjectMetaBuilder)12 InternalRecipe (org.eclipse.che.api.workspace.server.spi.environment.InternalRecipe)12