summaryrefslogtreecommitdiffstats
path: root/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so
diff options
context:
space:
mode:
Diffstat (limited to 'so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so')
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClientTest.java39
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClientTest.java73
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/CreateAsTaskTest.java2
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/DeleteAsTaskTest.java12
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateAsTaskTest.java103
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MockedHelmClient.java16
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateAsTaskTest.java57
7 files changed, 168 insertions, 134 deletions
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClientTest.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClientTest.java
index 1856dec..4f6de0f 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClientTest.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/helm/HelmClientTest.java
@@ -54,6 +54,7 @@ public class HelmClientTest {
private static final Path DUMMY_HELM_CHART = Paths.get("/some/dir/dummy/dummy-chart.tgz");
private static final Path DUMMY_KUBE_CONFIG = Paths.get("/some/dir/dummy/kube-config");
private static final String DUMMY_RELEASE_NAME = "RELEASE_NAME";
+ private static final String DUMMY_NAME_SPACE = "default";
private static final PropertiesToYamlConverter PROPERTIES_TO_YAML_CONVERTER = new PropertiesToYamlConverter();
private static final List<String> EXPECTED_COMMANDS = Arrays.asList("helm", "install", DUMMY_RELEASE_NAME, "-n",
"default", DUMMY_HELM_CHART.toString(), "--dry-run", "--kubeconfig", DUMMY_KUBE_CONFIG.toString());
@@ -87,7 +88,8 @@ public class HelmClientTest {
final HelmClient objUnderTest =
new StubbedHelmClientImpl(PROPERTIES_TO_YAML_CONVERTER, mockedProcessBuilder);
- objUnderTest.runHelmChartInstallWithDryRunFlag(DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG, DUMMY_HELM_CHART);
+ objUnderTest.runHelmChartInstallWithDryRunFlag(DUMMY_NAME_SPACE, DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG,
+ DUMMY_HELM_CHART);
}
}
@@ -101,13 +103,14 @@ public class HelmClientTest {
final ProcessBuilder mockedProcessBuilder = mock(ProcessBuilder.class);
final ListMatcher expectedCommandsMatcher = new ListMatcher(EXPECTED_COMMANDS);
- mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream, FAILED_EXIT_CODE,
- EXPECTED_COMMANDS);
+ mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream,
+ FAILED_EXIT_CODE, EXPECTED_COMMANDS);
final HelmClient objUnderTest =
new StubbedHelmClientImpl(PROPERTIES_TO_YAML_CONVERTER, mockedProcessBuilder);
- objUnderTest.runHelmChartInstallWithDryRunFlag(DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG, DUMMY_HELM_CHART);
+ objUnderTest.runHelmChartInstallWithDryRunFlag(DUMMY_NAME_SPACE, DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG,
+ DUMMY_HELM_CHART);
}
}
@@ -121,13 +124,13 @@ public class HelmClientTest {
final ProcessBuilder mockedProcessBuilder = mock(ProcessBuilder.class);
final ListMatcher expectedCommandsMatcher = new ListMatcher(EXPECTED_GET_KUBE_KINDS_COMMANDS);
- mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream, SUCCESSFUL_EXIT_CODE,
- EXPECTED_GET_KUBE_KINDS_COMMANDS);
+ mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream,
+ SUCCESSFUL_EXIT_CODE, EXPECTED_GET_KUBE_KINDS_COMMANDS);
final HelmClient objUnderTest =
new StubbedHelmClientImpl(PROPERTIES_TO_YAML_CONVERTER, mockedProcessBuilder);
- final List<String> actualKubeKinds =
- objUnderTest.getKubeKinds(DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG, DUMMY_HELM_CHART);
+ final List<String> actualKubeKinds = objUnderTest.getKubeKinds(DUMMY_NAME_SPACE, DUMMY_RELEASE_NAME,
+ DUMMY_KUBE_CONFIG, DUMMY_HELM_CHART);
assertEquals(Arrays.asList(Constants.KIND_REPLICA_SET), actualKubeKinds);
@@ -144,14 +147,14 @@ public class HelmClientTest {
final ProcessBuilder mockedProcessBuilder = mock(ProcessBuilder.class);
final ListMatcher expectedCommandsMatcher = new ListMatcher(EXPECTED_GET_KUBE_KINDS_MANIFEST_COMMANDS);
- mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream, SUCCESSFUL_EXIT_CODE,
- EXPECTED_GET_KUBE_KINDS_COMMANDS);
+ mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream,
+ SUCCESSFUL_EXIT_CODE, EXPECTED_GET_KUBE_KINDS_COMMANDS);
final HelmClient objUnderTest =
new StubbedHelmClientImpl(PROPERTIES_TO_YAML_CONVERTER, mockedProcessBuilder);
- final List<String> actualKubeKinds =
- objUnderTest.getKubeKindsUsingManifestCommand(DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG);
+ final List<String> actualKubeKinds = objUnderTest.getKubeKindsUsingManifestCommand(DUMMY_NAME_SPACE,
+ DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG);
assertEquals(Arrays.asList(Constants.KIND_DAEMON_SET), actualKubeKinds);
}
}
@@ -165,13 +168,13 @@ public class HelmClientTest {
final ProcessBuilder mockedProcessBuilder = mock(ProcessBuilder.class);
final ListMatcher expectedCommandsMatcher = new ListMatcher(EXPECTED_HELM_INSTALL_COMMANDS);
- mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream, SUCCESSFUL_EXIT_CODE,
- EXPECTED_HELM_INSTALL_COMMANDS);
+ mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream,
+ SUCCESSFUL_EXIT_CODE, EXPECTED_HELM_INSTALL_COMMANDS);
final HelmClient objUnderTest =
new StubbedHelmClientImpl(PROPERTIES_TO_YAML_CONVERTER, mockedProcessBuilder);
- objUnderTest.installHelmChart(DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG, DUMMY_HELM_CHART,
+ objUnderTest.installHelmChart(DUMMY_NAME_SPACE, DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG, DUMMY_HELM_CHART,
Collections.emptyMap());
}
}
@@ -185,13 +188,13 @@ public class HelmClientTest {
final ProcessBuilder mockedProcessBuilder = mock(ProcessBuilder.class);
final ListMatcher expectedCommandsMatcher = new ListMatcher(EXPECTED_HELM_UNINSTALL_COMMANDS);
- mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream, SUCCESSFUL_EXIT_CODE,
- EXPECTED_HELM_UNINSTALL_COMMANDS);
+ mockProcessBuilder(mockedProcessBuilder, expectedCommandsMatcher, errorStream, inputStream,
+ SUCCESSFUL_EXIT_CODE, EXPECTED_HELM_UNINSTALL_COMMANDS);
final HelmClient objUnderTest =
new StubbedHelmClientImpl(PROPERTIES_TO_YAML_CONVERTER, mockedProcessBuilder);
- objUnderTest.unInstallHelmChart(DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG);
+ objUnderTest.unInstallHelmChart(DUMMY_NAME_SPACE, DUMMY_RELEASE_NAME, DUMMY_KUBE_CONFIG);
}
}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClientTest.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClientTest.java
index 7d69436..8dcab50 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClientTest.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/extclients/kubernetes/KubernetesClientTest.java
@@ -22,6 +22,7 @@ package org.onap.so.cnfm.lcm.bpmn.flows.extclients.kubernetes;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
@@ -74,6 +75,7 @@ import okio.BufferedSource;
*/
public class KubernetesClientTest {
+ private static final String DUMMY_NAME_SPACE = "default";
private static final String DUMMY_LABEL_SELECTOR = "app.kubernetes.io/instance=test";
private static final String BATCH_V1 = "batch/v1";
private static final String V1 = "v1";
@@ -90,7 +92,7 @@ public class KubernetesClientTest {
public void testIsJobReady_jobStatusComplete_true() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(getJobResponse("Complete", "Running"));
- assertTrue(objUnderTest.isJobReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isJobReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -98,7 +100,7 @@ public class KubernetesClientTest {
public void testIsJobReady_jobStatusFailed_throwException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(getJobResponse("Failed", "Not Running"));
- objUnderTest.isJobReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isJobReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -106,7 +108,7 @@ public class KubernetesClientTest {
public void testIsJobReady_apiExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(ApiException.class);
- objUnderTest.isJobReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isJobReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -114,7 +116,7 @@ public class KubernetesClientTest {
public void testIsJobReady_RuntimeExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(RuntimeException.class);
- objUnderTest.isJobReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isJobReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -122,7 +124,7 @@ public class KubernetesClientTest {
public void testIsJobReady_jobStatusPending_false() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(getJobResponse("pending", "pending"));
- assertFalse(objUnderTest.isJobReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isJobReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -131,7 +133,7 @@ public class KubernetesClientTest {
final V1PodCondition condition = new V1PodCondition().type("Ready").status(Boolean.TRUE.toString());
final ApiClient mockedApiClient = mockApiClientResponse(getPodResponse(condition));
- assertTrue(objUnderTest.isPodReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isPodReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -140,7 +142,7 @@ public class KubernetesClientTest {
final V1PodCondition condition = new V1PodCondition().type("Ready").status(Boolean.FALSE.toString());
final ApiClient mockedApiClient = mockApiClientResponse(getPodResponse(condition));
- assertFalse(objUnderTest.isPodReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isPodReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -148,7 +150,7 @@ public class KubernetesClientTest {
public void testIsPodReady_missingCondition_false() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(getPodResponse(null));
- assertFalse(objUnderTest.isPodReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isPodReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -156,7 +158,7 @@ public class KubernetesClientTest {
public void testIsPodReady_apiExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(ApiException.class);
- objUnderTest.isPodReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isPodReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -164,14 +166,14 @@ public class KubernetesClientTest {
public void testIsPodReady_RuntimeExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(RuntimeException.class);
- objUnderTest.isPodReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isPodReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@Test
public void testIsServiceReady_exists_true() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(getServiceResponse());
- assertTrue(objUnderTest.isServiceReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isServiceReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -179,7 +181,7 @@ public class KubernetesClientTest {
public void testIsServiceReady_apiExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(ApiException.class);
- objUnderTest.isServiceReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isServiceReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -187,7 +189,7 @@ public class KubernetesClientTest {
public void testIsServiceReady_RuntimeExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(RuntimeException.class);
- objUnderTest.isServiceReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isServiceReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -199,7 +201,7 @@ public class KubernetesClientTest {
final V1DeploymentSpec spec = new V1DeploymentSpec().replicas(Integer.valueOf(2));
final ApiClient mockedApiClient = mockApiClientResponse(getDeploymentResponse(status, spec));
- assertTrue(objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -211,7 +213,7 @@ public class KubernetesClientTest {
final V1DeploymentSpec spec = new V1DeploymentSpec().replicas(Integer.valueOf(2));
final ApiClient mockedApiClient = mockApiClientResponse(getDeploymentResponse(status, spec));
- assertFalse(objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -221,7 +223,7 @@ public class KubernetesClientTest {
final V1DeploymentSpec spec = new V1DeploymentSpec().replicas(Integer.valueOf(2));
final ApiClient mockedApiClient = mockApiClientResponse(getDeploymentResponse(null, spec));
- assertFalse(objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -229,7 +231,7 @@ public class KubernetesClientTest {
public void testIsDeploymentReady_apiExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(ApiException.class);
- objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -237,7 +239,7 @@ public class KubernetesClientTest {
public void testIsDeploymentReady_RuntimeExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(RuntimeException.class);
- objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isDeploymentReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -249,7 +251,7 @@ public class KubernetesClientTest {
final V1ReplicaSetSpec spec = new V1ReplicaSetSpec().replicas(Integer.valueOf(1));
final ApiClient mockedApiClient = mockApiClientResponse(getReplicaSetResponse(status, spec));
- assertTrue(objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -260,7 +262,7 @@ public class KubernetesClientTest {
final V1ReplicaSetSpec spec = new V1ReplicaSetSpec().replicas(Integer.valueOf(2));
final ApiClient mockedApiClient = mockApiClientResponse(getReplicaSetResponse(status, spec));
- assertFalse(objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -270,7 +272,7 @@ public class KubernetesClientTest {
final V1ReplicaSetStatus status = new V1ReplicaSetStatus().readyReplicas(Integer.valueOf(1));
final ApiClient mockedApiClient = mockApiClientResponse(getReplicaSetResponse(status, null));
- assertFalse(objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -278,7 +280,7 @@ public class KubernetesClientTest {
public void testIsReplicaSetReady_apiExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(ApiException.class);
- objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -286,7 +288,7 @@ public class KubernetesClientTest {
public void testIsReplicaSetReady_RuntimeExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(RuntimeException.class);
- objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isReplicaSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -301,7 +303,7 @@ public class KubernetesClientTest {
.numberReady(Integer.valueOf(2)).updatedNumberScheduled(Integer.valueOf(2));
final ApiClient mockedApiClient = mockApiClientResponse(getDaemonSetResponse(status, spec));
- assertTrue(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -314,7 +316,7 @@ public class KubernetesClientTest {
final V1DaemonSetStatus status = new V1DaemonSetStatus();
final ApiClient mockedApiClient = mockApiClientResponse(getDaemonSetResponse(status, spec));
- assertTrue(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -328,7 +330,7 @@ public class KubernetesClientTest {
final ApiClient mockedApiClient = mockApiClientResponse(getDaemonSetResponse(status, spec));
- assertFalse(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -344,7 +346,7 @@ public class KubernetesClientTest {
.numberReady(Integer.valueOf(2)).updatedNumberScheduled(Integer.valueOf(6));
final ApiClient mockedApiClient = mockApiClientResponse(getDaemonSetResponse(status, spec));
- assertTrue(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -361,7 +363,7 @@ public class KubernetesClientTest {
.numberReady(Integer.valueOf(1)).updatedNumberScheduled(Integer.valueOf(6));
final ApiClient mockedApiClient = mockApiClientResponse(getDaemonSetResponse(status, spec));
- assertFalse(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -369,7 +371,7 @@ public class KubernetesClientTest {
public void testIsDaemonSetReady_apiExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(ApiException.class);
- objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -377,7 +379,7 @@ public class KubernetesClientTest {
public void testIsDaemonSetReady_RuntimeExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(RuntimeException.class);
- objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isDaemonSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -393,7 +395,7 @@ public class KubernetesClientTest {
new V1StatefulSetStatus().updatedReplicas(Integer.valueOf(2)).readyReplicas(Integer.valueOf(2));
final ApiClient mockedApiClient = mockApiClientResponse(getStatefulSetResponse(status, spec));
- assertTrue(objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -406,7 +408,7 @@ public class KubernetesClientTest {
final V1StatefulSetStatus status = new V1StatefulSetStatus();
final ApiClient mockedApiClient = mockApiClientResponse(getStatefulSetResponse(status, spec));
- assertTrue(objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertTrue(objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@@ -420,14 +422,14 @@ public class KubernetesClientTest {
final V1StatefulSetStatus status = new V1StatefulSetStatus().updatedReplicas(Integer.valueOf(2));
final ApiClient mockedApiClient = mockApiClientResponse(getStatefulSetResponse(status, spec));
- assertFalse(objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR));
+ assertFalse(objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR));
}
@Test(expected = KubernetesRequestProcessingException.class)
public void testIsStatefulSetReady_apiExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(ApiException.class);
- objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -435,7 +437,7 @@ public class KubernetesClientTest {
public void testIsStatefulSetReady_RuntimeExceptionThrown_throwsException() throws ApiException, IOException {
final ApiClient mockedApiClient = mockApiClientResponse(RuntimeException.class);
- objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_LABEL_SELECTOR);
+ objUnderTest.isStatefulSetReady(mockedApiClient, DUMMY_NAME_SPACE, DUMMY_LABEL_SELECTOR);
}
@@ -512,6 +514,7 @@ public class KubernetesClientTest {
final BufferedSource mockedBufferedSource = mock(BufferedSource.class);
final Call mockedCall = mock(Call.class);
+ when(mockedApiClient.escapeString(anyString())).thenCallRealMethod();
when(mockedApiClient.getJSON()).thenReturn(json);
doNothing().when(mockedResponse).close();
when(mockedResponse.body()).thenReturn(mockedResponseBody);
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/CreateAsTaskTest.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/CreateAsTaskTest.java
index c5683e8..5beadbd 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/CreateAsTaskTest.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/CreateAsTaskTest.java
@@ -206,7 +206,7 @@ public class CreateAsTaskTest extends BaseTest {
.asPackageId(UUID.randomUUID().toString()).asdInvariantId(asdId).asProvider(DUMMY_VALUE)
.asApplicationName(DUMMY_VALUE).asApplicationVersion(DUMMY_VALUE).serviceInstanceId(DUMMY_VALUE)
.serviceInstanceName(DUMMY_VALUE).cloudOwner(DUMMY_VALUE).cloudRegion(DUMMY_VALUE).tenantId(DUMMY_VALUE)
- .status(State.INSTANTIATED).statusUpdatedTime(LocalDateTime.now()));
+ .namespace(DUMMY_VALUE).status(State.INSTANTIATED).statusUpdatedTime(LocalDateTime.now()));
try {
objUnderTest.runCreateAsJob(createAsRequest);
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/DeleteAsTaskTest.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/DeleteAsTaskTest.java
index 9ad993b..3b5d5c6 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/DeleteAsTaskTest.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/DeleteAsTaskTest.java
@@ -184,12 +184,12 @@ public class DeleteAsTaskTest extends BaseTest {
private void addDummyAsToDatabase(final String asInstanceId, final State state) {
final String asdId = UUID.randomUUID().toString();
- final AsInst asInst =
- new AsInst().asInstId(asInstanceId).name("asName").asdId(asdId).asdInvariantId(asInstanceId)
- .status(state).statusUpdatedTime(LocalDateTime.now()).asApplicationName("asApplicationName")
- .asApplicationVersion("asApplicationVersion").asProvider("asProvider")
- .serviceInstanceId(SERVICE_INSTANCE_ID).serviceInstanceName("serviceInstanceName")
- .cloudOwner("cloudOwner").cloudRegion("cloudRegion").tenantId("tenantId");
+ final AsInst asInst = new AsInst().asInstId(asInstanceId).name("asName").asdId(asdId)
+ .asdInvariantId(asInstanceId).status(state).statusUpdatedTime(LocalDateTime.now())
+ .asApplicationName("asApplicationName").asApplicationVersion("asApplicationVersion")
+ .asProvider("asProvider").serviceInstanceId(SERVICE_INSTANCE_ID)
+ .serviceInstanceName("serviceInstanceName").cloudOwner("cloudOwner").cloudRegion("cloudRegion")
+ .tenantId("tenantId").namespace("namespace");
databaseServiceProvider.saveAsInst(asInst);
}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateAsTaskTest.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateAsTaskTest.java
index 3080459..3061bff 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateAsTaskTest.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/InstantiateAsTaskTest.java
@@ -104,6 +104,7 @@ import io.kubernetes.client.util.Watch;
* @author Waqas Ikram (waqas.ikram@est.tech)
*/
public class InstantiateAsTaskTest extends BaseTest {
+ private static final String NAMESPACE_VALUE = "default";
private static final String BATCH_V1 = "batch/v1";
private static final String V1 = "v1";
private static final String APPS_V1 = "apps/v1";
@@ -312,7 +313,7 @@ public class InstantiateAsTaskTest extends BaseTest {
.asApplicationName("asApplicationName").asApplicationVersion("asApplicationVersion")
.asProvider("asProvider").serviceInstanceId(SERVICE_INSTANCE_ID)
.serviceInstanceName("serviceInstanceName").cloudOwner("cloudOwner").cloudRegion("cloudRegion")
- .tenantId("tenantId");
+ .tenantId("tenantId").namespace(NAMESPACE_VALUE);
databaseServiceProvider.saveAsInst(asInst);
@@ -339,55 +340,65 @@ public class InstantiateAsTaskTest extends BaseTest {
}
private void mockKubernetesClientEndpoint() {
- wireMockServer.stubFor(get(urlMatching("/apis/batch/v1/jobs\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME
- + "|" + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true"))
+ wireMockServer.stubFor(get(urlMatching("/apis/batch/v1/namespaces/" + NAMESPACE_VALUE
+ + "/jobs\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME + "|" + DEPLOYMENT_ITEM_2_RELEASE_NAME
+ + ")&timeoutSeconds=1&watch=true"))
.willReturn(aResponse().withBody(getJobResponse()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
- wireMockServer.stubFor(get(urlMatching("/apis/batch/v1/jobs\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getJobList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+ wireMockServer.stubFor(
+ get(urlMatching("/apis/batch/v1/namespaces/" + NAMESPACE_VALUE + "/jobs\\?labelSelector.*&watch=false"))
+ .willReturn(aResponse().withBody(getJobList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
- wireMockServer.stubFor(get(urlMatching("/api/v1/pods\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME + "|"
- + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true"))
- .willReturn(aResponse().withBody(getPodResponse()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
- wireMockServer.stubFor(get(urlMatching("/api/v1/pods\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getPodList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+ wireMockServer.stubFor(get(urlMatching(
+ "/api/v1/namespaces/" + NAMESPACE_VALUE + "/pods\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME
+ + "|" + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true")).willReturn(
+ aResponse().withBody(getPodResponse()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+ wireMockServer.stubFor(
+ get(urlMatching("/api/v1/namespaces/" + NAMESPACE_VALUE + "/pods\\?labelSelector.*&watch=false"))
+ .willReturn(aResponse().withBody(getPodList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
- wireMockServer.stubFor(get(urlMatching("/api/v1/services\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME
- + "|" + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true")).willReturn(
+ wireMockServer.stubFor(get(urlMatching("/api/v1/namespaces/" + NAMESPACE_VALUE + "/services\\?labelSelector.*("
+ + DEPLOYMENT_ITEM_1_RELEASE_NAME + "|" + DEPLOYMENT_ITEM_2_RELEASE_NAME
+ + ")&timeoutSeconds=1&watch=true")).willReturn(
aResponse().withBody(getServiceResponse()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
- wireMockServer.stubFor(get(urlMatching("/api/v1/services\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getServiceList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
-
- wireMockServer
- .stubFor(get(urlMatching("/apis/apps/v1/deployments\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME
- + "|" + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true"))
- .willReturn(aResponse().withBody(getDeploymentResponse()).withHeader(ACCEPT,
- APPLICATION_JSON_VALUE)));
- wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/deployments\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getDeploymentList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
-
- wireMockServer
- .stubFor(get(urlMatching("/apis/apps/v1/replicasets\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME
- + "|" + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true"))
- .willReturn(aResponse().withBody(getReplicaSetResponse()).withHeader(ACCEPT,
- APPLICATION_JSON_VALUE)));
- wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/replicasets\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getReplicaSetList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
-
- wireMockServer
- .stubFor(get(urlMatching("/apis/apps/v1/daemonsets\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME
- + "|" + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true"))
- .willReturn(aResponse().withBody(getDaemonSetResponse()).withHeader(ACCEPT,
- APPLICATION_JSON_VALUE)));
- wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/daemonsets\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getDaemonSetList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
-
wireMockServer.stubFor(
- get(urlMatching("/apis/apps/v1/statefulsets\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME + "|"
- + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true"))
- .willReturn(aResponse().withBody(getStatefulSetResponse()).withHeader(ACCEPT,
- APPLICATION_JSON_VALUE)));
- wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/statefulsets\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getStatefulSetList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+ get(urlMatching("/api/v1/namespaces/" + NAMESPACE_VALUE + "/services\\?labelSelector.*&watch=false"))
+ .willReturn(aResponse().withBody(getServiceList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/namespaces/" + NAMESPACE_VALUE
+ + "/deployments\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME + "|"
+ + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true")).willReturn(
+ aResponse().withBody(getDeploymentResponse()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+ wireMockServer.stubFor(get(urlMatching(
+ "/apis/apps/v1/namespaces/" + NAMESPACE_VALUE + "/deployments\\?labelSelector.*&watch=false"))
+ .willReturn(
+ aResponse().withBody(getDeploymentList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/namespaces/" + NAMESPACE_VALUE
+ + "/replicasets\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME + "|"
+ + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true")).willReturn(
+ aResponse().withBody(getReplicaSetResponse()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+ wireMockServer.stubFor(get(urlMatching(
+ "/apis/apps/v1/namespaces/" + NAMESPACE_VALUE + "/replicasets\\?labelSelector.*&watch=false"))
+ .willReturn(
+ aResponse().withBody(getReplicaSetList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/namespaces/" + NAMESPACE_VALUE
+ + "/daemonsets\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME + "|"
+ + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true")).willReturn(
+ aResponse().withBody(getDaemonSetResponse()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+ wireMockServer.stubFor(get(urlMatching(
+ "/apis/apps/v1/namespaces/" + NAMESPACE_VALUE + "/daemonsets\\?labelSelector.*&watch=false"))
+ .willReturn(
+ aResponse().withBody(getDaemonSetList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/namespaces/" + NAMESPACE_VALUE
+ + "/statefulsets\\?labelSelector.*(" + DEPLOYMENT_ITEM_1_RELEASE_NAME + "|"
+ + DEPLOYMENT_ITEM_2_RELEASE_NAME + ")&timeoutSeconds=1&watch=true")).willReturn(
+ aResponse().withBody(getStatefulSetResponse()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
+ wireMockServer.stubFor(get(urlMatching(
+ "/apis/apps/v1/namespaces/" + NAMESPACE_VALUE + "/statefulsets\\?labelSelector.*&watch=false"))
+ .willReturn(
+ aResponse().withBody(getStatefulSetList()).withHeader(ACCEPT, APPLICATION_JSON_VALUE)));
}
private String getStatefulSetResponse() {
@@ -558,7 +569,7 @@ public class InstantiateAsTaskTest extends BaseTest {
.asdInvariantId(as_inst_id).status(State.NOT_INSTANTIATED).statusUpdatedTime(LocalDateTime.now())
.asApplicationName("asApplicationName").asApplicationVersion("asApplicationVersion")
.asProvider("asProvider").serviceInstanceId(as_inst_id).serviceInstanceName("serviceInstanceName")
- .cloudOwner("cloudOwner").cloudRegion("cloudRegion").tenantId("tenantId");
+ .cloudOwner("cloudOwner").cloudRegion("cloudRegion").tenantId("tenantId").namespace(NAMESPACE_VALUE);
final String helmFile1 = "Artifacts/Deployment/HELM/sampleapp-db-operator-helm.tgz";
final AsLifecycleParam lcp1 = new AsLifecycleParam().asLifecycleParam(DEPLOYMENT_ITEM_1_LIFECYCLE_PARAM_1);
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MockedHelmClient.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MockedHelmClient.java
index 2b718d5..1729b5d 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MockedHelmClient.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/MockedHelmClient.java
@@ -45,8 +45,8 @@ public class MockedHelmClient implements HelmClient {
}
@Override
- public void runHelmChartInstallWithDryRunFlag(final String releaseName, final Path kubeconfig,
- final Path helmChart) {
+ public void runHelmChartInstallWithDryRunFlag(final String namespace, final String releaseName,
+ final Path kubeconfig, final Path helmChart) {
Integer count = counter.get(releaseName);
if (count == null) {
count = 0;
@@ -56,7 +56,8 @@ public class MockedHelmClient implements HelmClient {
}
@Override
- public List<String> getKubeKinds(final String releaseName, final Path kubeconfig, final Path helmChart) {
+ public List<String> getKubeKinds(final String namespace, final String releaseName, final Path kubeconfig,
+ final Path helmChart) {
Integer count = counter.get(releaseName);
if (count == null) {
count = 0;
@@ -66,7 +67,8 @@ public class MockedHelmClient implements HelmClient {
}
@Override
- public List<String> getKubeKindsUsingManifestCommand(final String releaseName, final Path kubeconfig) {
+ public List<String> getKubeKindsUsingManifestCommand(final String namespace, final String releaseName,
+ final Path kubeconfig) {
Integer count = unInstallCounter.get(releaseName);
if (count == null) {
count = 0;
@@ -76,8 +78,8 @@ public class MockedHelmClient implements HelmClient {
}
@Override
- public void installHelmChart(final String releaseName, final Path kubeconfig, final Path helmChart,
- final Map<String, String> lifeCycleParams) {
+ public void installHelmChart(final String namespace, final String releaseName, final Path kubeconfig,
+ final Path helmChart, final Map<String, String> lifeCycleParams) {
Integer count = counter.get(releaseName);
if (count == null) {
count = 0;
@@ -86,7 +88,7 @@ public class MockedHelmClient implements HelmClient {
}
@Override
- public void unInstallHelmChart(final String releaseName, final Path kubeConfigFilePath)
+ public void unInstallHelmChart(final String namespace, final String releaseName, final Path kubeConfigFilePath)
throws HelmClientExecuteException {
Integer count = unInstallCounter.get(releaseName);
if (count == null) {
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateAsTaskTest.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateAsTaskTest.java
index 832d675..4f89617 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateAsTaskTest.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/src/test/java/org/onap/so/cnfm/lcm/bpmn/flows/tasks/TerminateAsTaskTest.java
@@ -73,6 +73,7 @@ import org.springframework.beans.factory.annotation.Value;
*/
public class TerminateAsTaskTest extends BaseTest {
+ private static final String NAMESPACE_VALUE = "default";
private static final String AS_INST_ID = UUID.randomUUID().toString();
private static final String AS_DEPLOYMENT_ITEM_ONE_INST_ID = UUID.randomUUID().toString();
private static final String AS_DEPLOYMENT_ITEM_TWO_INST_ID = UUID.randomUUID().toString();
@@ -154,7 +155,7 @@ public class TerminateAsTaskTest extends BaseTest {
.asApplicationName("asApplicationName").asApplicationVersion("asApplicationVersion")
.asProvider("asProvider").serviceInstanceId(SERVICE_INSTANCE_ID)
.serviceInstanceName(SERVICE_INSTANCE_NAME).cloudOwner("cloudOwner").cloudRegion("cloudRegion")
- .tenantId("tenantId");
+ .tenantId("tenantId").namespace(NAMESPACE_VALUE);
final String helmFile1 = "Artifacts/Deployment/HELM/sampleapp-db-operator-helm.tgz";
final AsDeploymentItem dItemOne = new AsDeploymentItem().asDeploymentItemInstId(AS_DEPLOYMENT_ITEM_ONE_INST_ID)
@@ -176,26 +177,40 @@ public class TerminateAsTaskTest extends BaseTest {
private void mockKubernetesClientEndpoint() {
- wireMockServer.stubFor(get(urlMatching("/apis/batch/v1/jobs\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getJobList()).withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)));
-
- wireMockServer.stubFor(get(urlMatching("/api/v1/pods\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getPodList()).withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)));
-
- wireMockServer.stubFor(get(urlMatching("/api/v1/services\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getServiceList()).withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)));
-
- wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/deployments\\?labelSelector.*&watch=false")).willReturn(
- aResponse().withBody(getDeploymentList()).withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)));
-
- wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/daemonsets\\?labelSelector.*&watch=false"))
- .willReturn(aResponse().withBody(getDaemonList()).withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)));
-
- wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/replicasets\\?labelSelector.*&watch=false")).willReturn(
- aResponse().withBody(getReplicaSetList()).withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)));
-
- wireMockServer.stubFor(get(urlMatching("/apis/apps/v1/statefulsets\\?labelSelector.*&watch=false")).willReturn(
- aResponse().withBody(getStatefulSetList()).withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)));
+ wireMockServer.stubFor(
+ get(urlMatching("/apis/batch/v1/namespaces/" + NAMESPACE_VALUE + "/jobs\\?labelSelector.*&watch=false"))
+ .willReturn(
+ aResponse().withBody(getJobList()).withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(
+ get(urlMatching("/api/v1/namespaces/" + NAMESPACE_VALUE + "/pods\\?labelSelector.*&watch=false"))
+ .willReturn(
+ aResponse().withBody(getPodList()).withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(
+ get(urlMatching("/api/v1/namespaces/" + NAMESPACE_VALUE + "/services\\?labelSelector.*&watch=false"))
+ .willReturn(aResponse().withBody(getServiceList()).withHeader(CONTENT_TYPE,
+ APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(get(urlMatching(
+ "/apis/apps/v1/namespaces/" + NAMESPACE_VALUE + "/deployments\\?labelSelector.*&watch=false"))
+ .willReturn(aResponse().withBody(getDeploymentList()).withHeader(CONTENT_TYPE,
+ APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(get(urlMatching(
+ "/apis/apps/v1/namespaces/" + NAMESPACE_VALUE + "/daemonsets\\?labelSelector.*&watch=false"))
+ .willReturn(aResponse().withBody(getDaemonList()).withHeader(CONTENT_TYPE,
+ APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(get(urlMatching(
+ "/apis/apps/v1/namespaces/" + NAMESPACE_VALUE + "/replicasets\\?labelSelector.*&watch=false"))
+ .willReturn(aResponse().withBody(getReplicaSetList()).withHeader(CONTENT_TYPE,
+ APPLICATION_JSON_VALUE)));
+
+ wireMockServer.stubFor(get(urlMatching(
+ "/apis/apps/v1/namespaces/" + NAMESPACE_VALUE + "/statefulsets\\?labelSelector.*&watch=false"))
+ .willReturn(aResponse().withBody(getStatefulSetList()).withHeader(CONTENT_TYPE,
+ APPLICATION_JSON_VALUE)));
}
private void mockAAIEndPoints() {