summaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-kubernetes/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'participant/participant-impl/participant-impl-kubernetes/src/test/java')
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/HelmClientTest.java1
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ChartControllerTest.java15
2 files changed, 16 insertions, 0 deletions
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/HelmClientTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/HelmClientTest.java
index 7f1943c97..d85ab6d9f 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/HelmClientTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/helm/HelmClientTest.java
@@ -111,6 +111,7 @@ class HelmClientTest {
mockedClient.when(() -> HelmClient.executeCommand(any()))
.thenReturn(new String());
when(repo.getRepoName()).thenReturn("RepoName");
+ when(repo.getAddress()).thenReturn("http://localhost:8080");
assertDoesNotThrow(() -> helmClient.addRepository(repo));
mockedClient.when(() -> HelmClient.executeCommand(any()))
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ChartControllerTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ChartControllerTest.java
index 73c5c98a1..c59e7fb5d 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ChartControllerTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ChartControllerTest.java
@@ -22,6 +22,7 @@
package org.onap.policy.clamp.acm.participant.kubernetes.rest;
import static org.hamcrest.CoreMatchers.is;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
@@ -225,6 +226,7 @@ class ChartControllerTest {
@Test
void testConfigureRepo() throws Exception {
RequestBuilder requestBuilder;
+ when(chartService.configureRepository(any())).thenReturn(true);
requestBuilder = MockMvcRequestBuilders.post(CONFIGURE_REPO_URL).accept(MediaType.APPLICATION_JSON_VALUE)
.content(getInstallationJson(charts.get(0).getChartId().getName(), charts.get(0).getChartId().getVersion()))
@@ -234,6 +236,19 @@ class ChartControllerTest {
}
+ @Test
+ void testConfigureRepoAlreadyExist() throws Exception {
+ RequestBuilder requestBuilder;
+ when(chartService.configureRepository(any())).thenReturn(false);
+
+ requestBuilder = MockMvcRequestBuilders.post(CONFIGURE_REPO_URL).accept(MediaType.APPLICATION_JSON_VALUE)
+ .content(getInstallationJson(charts.get(0).getChartId().getName(), charts.get(0).getChartId().getVersion()))
+ .contentType(MediaType.APPLICATION_JSON_VALUE);
+
+ mockMvc.perform(requestBuilder).andExpect(status().isConflict());
+
+ }
+
private String getInstallationJson(String name, String version) {
JSONObject jsonObj = new JSONObject();