diff options
author | 2021-11-17 16:51:16 +0000 | |
---|---|---|
committer | 2021-11-17 16:51:22 +0000 | |
commit | bb4b558d8c253381b1ab04bd300f495dc10a1a7c (patch) | |
tree | 7928e574c3d4e1ef4ed6648e254ebf0d43c1ab1b /participant/participant-impl/participant-impl-http | |
parent | 225dcb4d6f801d88094a9512d79c82c4189c07f6 (diff) |
Code coverage clamp participant
Issue-ID: POLICY-3452
Change-Id: I5de10918f91ff2857cf81cc362c9cbecfcb01ec1
Signed-off-by: lapentafd <francesco.lapenta@est.tech>
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.java | 29 |
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(); |