summaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-http
diff options
context:
space:
mode:
Diffstat (limited to 'participant/participant-impl/participant-impl-http')
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/handler/ClElementHandlerTest.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/handler/ClElementHandlerTest.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/handler/ClElementHandlerTest.java
index d80436ef3..28b62c2c5 100644
--- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/handler/ClElementHandlerTest.java
+++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/handler/ClElementHandlerTest.java
@@ -24,15 +24,20 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
+import java.io.IOException;
import java.util.Map;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.Spy;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
import org.onap.policy.clamp.controlloop.participant.http.main.handler.ControlLoopElementHandler;
+import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigRequest;
import org.onap.policy.clamp.controlloop.participant.http.utils.CommonTestData;
import org.onap.policy.clamp.controlloop.participant.http.utils.ToscaUtils;
import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
@@ -64,6 +69,30 @@ class ClElementHandlerTest {
}
@Test
+ void test_controlLoopElementeStateChange() throws IOException {
+ var controlLoopId = commonTestData.getControlLoopId();
+ var element = commonTestData.getControlLoopElement();
+ var controlLoopElementId = element.getId();
+
+ var config = Mockito.mock(ConfigRequest.class);
+ assertDoesNotThrow(() -> controlLoopElementHandler.invokeHttpClient(config));
+
+ assertDoesNotThrow(() -> controlLoopElementHandler
+ .controlLoopElementStateChange(controlLoopId,
+ controlLoopElementId, ControlLoopState.PASSIVE, ControlLoopOrderedState.PASSIVE));
+
+ assertDoesNotThrow(() -> controlLoopElementHandler
+ .controlLoopElementStateChange(controlLoopId,
+ controlLoopElementId, ControlLoopState.PASSIVE, ControlLoopOrderedState.UNINITIALISED));
+
+ assertDoesNotThrow(() -> controlLoopElementHandler
+ .controlLoopElementStateChange(controlLoopId,
+ controlLoopElementId, ControlLoopState.PASSIVE, ControlLoopOrderedState.RUNNING));
+
+ controlLoopElementHandler.close();
+ }
+
+ @Test
void test_ControlLoopElementUpdate() {
doNothing().when(controlLoopElementHandler).invokeHttpClient(any());
ControlLoopElement element = commonTestData.getControlLoopElement();