summaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-kubernetes/src/test
diff options
context:
space:
mode:
authorSirisha_Manchikanti <sirisha.manchikanti@est.tech>2021-09-06 09:15:07 +0100
committerSirisha_Manchikanti <sirisha.manchikanti@est.tech>2021-09-07 17:47:12 +0100
commit1df4475d60d9c6d46087f8284dd2e0697d59c071 (patch)
tree00763b704dd8d4818a08223afef40728d8565909 /participant/participant-impl/participant-impl-kubernetes/src/test
parent29fc6f31180fbbc48d75a3bb1ac97d4b00883e5c (diff)
Fix parsing of type heirarchy for nodetypes
Fixed an issue where a ControlLoopElement with type defined in node-types is not parsed. This commit also includes changes to save the state of a controlLoopElement coming from ControlLoopAck message into runtime database. Issue-ID: POLICY-3575 Signed-off-by: Sirisha_Manchikanti <sirisha.manchikanti@est.tech> Change-Id: I1249cf2cabd4a499d80b401f94f7f42f08b350e3
Diffstat (limited to 'participant/participant-impl/participant-impl-kubernetes/src/test')
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandlerTest.java21
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/parameters/CommonTestData.java8
2 files changed, 20 insertions, 9 deletions
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandlerTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandlerTest.java
index 2d4439a45..1f8e76952 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandlerTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandlerTest.java
@@ -47,6 +47,7 @@ import org.onap.policy.clamp.controlloop.participant.intermediary.api.Participan
import org.onap.policy.clamp.controlloop.participant.kubernetes.exception.ServiceException;
import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartInfo;
import org.onap.policy.clamp.controlloop.participant.kubernetes.models.ChartList;
+import org.onap.policy.clamp.controlloop.participant.kubernetes.parameters.CommonTestData;
import org.onap.policy.clamp.controlloop.participant.kubernetes.service.ChartService;
import org.onap.policy.clamp.controlloop.participant.kubernetes.utils.TestUtils;
import org.onap.policy.common.utils.coder.Coder;
@@ -69,7 +70,7 @@ class ControlLoopElementHandlerTest {
private static ToscaServiceTemplate toscaServiceTemplate;
private static final String K8S_CONTROL_LOOP_ELEMENT =
"org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement";
-
+ private CommonTestData commonTestData = new CommonTestData();
@InjectMocks
@Spy
@@ -98,19 +99,19 @@ class ControlLoopElementHandlerTest {
doNothing().when(chartService).uninstallChart(charts.get(0));
- controlLoopElementHandler.controlLoopElementStateChange(controlLoopElementId1, ControlLoopState.PASSIVE,
- ControlLoopOrderedState.UNINITIALISED);
+ controlLoopElementHandler.controlLoopElementStateChange(commonTestData.getControlLoopId(),
+ controlLoopElementId1, ControlLoopState.PASSIVE, ControlLoopOrderedState.UNINITIALISED);
doThrow(new ServiceException("Error uninstalling the chart")).when(chartService)
.uninstallChart(charts.get(0));
assertDoesNotThrow(() -> controlLoopElementHandler
- .controlLoopElementStateChange(controlLoopElementId1, ControlLoopState.PASSIVE,
- ControlLoopOrderedState.UNINITIALISED));
+ .controlLoopElementStateChange(commonTestData.getControlLoopId(), controlLoopElementId1,
+ ControlLoopState.PASSIVE, ControlLoopOrderedState.UNINITIALISED));
assertDoesNotThrow(() -> controlLoopElementHandler
- .controlLoopElementStateChange(controlLoopElementId1, ControlLoopState.PASSIVE,
- ControlLoopOrderedState.RUNNING));
+ .controlLoopElementStateChange(commonTestData.getControlLoopId(), controlLoopElementId1,
+ ControlLoopState.PASSIVE, ControlLoopOrderedState.RUNNING));
}
@@ -125,7 +126,8 @@ class ControlLoopElementHandlerTest {
Map<String, ToscaNodeTemplate> nodeTemplatesMap =
toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates();
- controlLoopElementHandler.controlLoopElementUpdate(element, nodeTemplatesMap.get(K8S_CONTROL_LOOP_ELEMENT));
+ controlLoopElementHandler.controlLoopElementUpdate(commonTestData.getControlLoopId(), element,
+ nodeTemplatesMap.get(K8S_CONTROL_LOOP_ELEMENT));
assertThat(controlLoopElementHandler.getChartMap()).hasSize(1).containsKey(elementId1);
@@ -134,7 +136,8 @@ class ControlLoopElementHandlerTest {
UUID elementId2 = UUID.randomUUID();
element.setId(elementId2);
- controlLoopElementHandler.controlLoopElementUpdate(element, nodeTemplatesMap.get(K8S_CONTROL_LOOP_ELEMENT));
+ controlLoopElementHandler.controlLoopElementUpdate(commonTestData.getControlLoopId(), element,
+ nodeTemplatesMap.get(K8S_CONTROL_LOOP_ELEMENT));
assertThat(controlLoopElementHandler.getChartMap().containsKey(elementId2)).isFalse();
}
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/parameters/CommonTestData.java
index 98c086205..f6ec401b8 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/parameters/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/parameters/CommonTestData.java
@@ -150,4 +150,12 @@ public class CommonTestData {
topicParams.setServers(Arrays.asList("localhost"));
return topicParams;
}
+
+ /**
+ * Get controlloop id.
+ * @return ToscaConceptIdentifier controlLoopId
+ */
+ public ToscaConceptIdentifier getControlLoopId() {
+ return new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
+ }
}