Search in sources :

Example 1 with DefaultProperty

use of org.gradle.api.internal.provider.DefaultProperty in project jkube by eclipse.

the class KubernetesPushTaskTest method runTask_withSkipPush_shouldDoNothing.

@Test
public void runTask_withSkipPush_shouldDoNothing() throws JKubeServiceException {
    // Given
    extension = new TestKubernetesExtension() {

        @Override
        public Property<Boolean> getSkipPush() {
            return new DefaultProperty<>(Boolean.class).value(true);
        }
    };
    when(taskEnvironment.project.getExtensions().getByType(KubernetesExtension.class)).thenReturn(extension);
    final KubernetesPushTask pushTask = new KubernetesPushTask(KubernetesExtension.class);
    when(pushTask.getName()).thenReturn("k8sPush");
    // When
    pushTask.runTask();
    // Then
    Assertions.assertThat(dockerBuildServiceMockedConstruction.constructed()).isEmpty();
    verify(pushTask.jKubeServiceHub.getBuildService(), times(0)).push(any(), anyInt(), any(), anyBoolean());
    verify(taskEnvironment.logger, times(1)).lifecycle(contains("k8s: `k8sPush` task is skipped."));
}
Also used : DefaultProperty(org.gradle.api.internal.provider.DefaultProperty) Property(org.gradle.api.provider.Property) DefaultProperty(org.gradle.api.internal.provider.DefaultProperty) TestKubernetesExtension(org.eclipse.jkube.gradle.plugin.TestKubernetesExtension) Test(org.junit.Test)

Example 2 with DefaultProperty

use of org.gradle.api.internal.provider.DefaultProperty in project jkube by eclipse.

the class KubernetesApplyTaskTest method runTask_withSkipApply_shouldDoNothing.

@Test
public void runTask_withSkipApply_shouldDoNothing() {
    // Given
    extension = new TestKubernetesExtension() {

        @Override
        public Property<Boolean> getSkipApply() {
            return new DefaultProperty<>(Boolean.class).value(true);
        }
    };
    when(taskEnvironment.project.getExtensions().getByType(KubernetesExtension.class)).thenReturn(extension);
    final KubernetesApplyTask applyTask = new KubernetesApplyTask(KubernetesExtension.class);
    // When
    applyTask.runTask();
    // Then
    assertThat(applyServiceMockedConstruction.constructed()).isEmpty();
}
Also used : DefaultProperty(org.gradle.api.internal.provider.DefaultProperty) Property(org.gradle.api.provider.Property) DefaultProperty(org.gradle.api.internal.provider.DefaultProperty) TestKubernetesExtension(org.eclipse.jkube.gradle.plugin.TestKubernetesExtension) Test(org.junit.Test)

Example 3 with DefaultProperty

use of org.gradle.api.internal.provider.DefaultProperty in project jkube by eclipse.

the class KubernetesBuildTaskTest method runTask_withSkipBuild_shouldDoNothing.

@Test
public void runTask_withSkipBuild_shouldDoNothing() throws JKubeServiceException {
    // Given
    extension = new TestKubernetesExtension() {

        @Override
        public Property<Boolean> getSkipBuild() {
            return new DefaultProperty<>(Boolean.class).value(true);
        }
    };
    when(taskEnvironment.project.getExtensions().getByType(KubernetesExtension.class)).thenReturn(extension);
    final KubernetesBuildTask buildTask = new KubernetesBuildTask(KubernetesExtension.class);
    // When
    buildTask.runTask();
    // Then
    Assertions.assertThat(dockerBuildServiceMockedConstruction.constructed()).isEmpty();
    verify(buildTask.jKubeServiceHub.getBuildService(), times(0)).build(any());
}
Also used : DefaultProperty(org.gradle.api.internal.provider.DefaultProperty) Property(org.gradle.api.provider.Property) DefaultProperty(org.gradle.api.internal.provider.DefaultProperty) TestKubernetesExtension(org.eclipse.jkube.gradle.plugin.TestKubernetesExtension) Test(org.junit.Test)

Aggregations

TestKubernetesExtension (org.eclipse.jkube.gradle.plugin.TestKubernetesExtension)3 DefaultProperty (org.gradle.api.internal.provider.DefaultProperty)3 Property (org.gradle.api.provider.Property)3 Test (org.junit.Test)3