summaryrefslogtreecommitdiffstats
path: root/runtime-controlloop/src/test
diff options
context:
space:
mode:
authorlapentafd <francesco.lapenta@est.tech>2021-11-02 09:10:54 +0000
committerlapentafd <francesco.lapenta@est.tech>2021-11-02 09:27:09 +0000
commit5ee631b91871fefafce35c5399aef10984f1207f (patch)
tree6095f6094a5608ce34baa81f30afa6d7c8880fd2 /runtime-controlloop/src/test
parent9a49920ac001f76d796cbffce823abd7c0c7d9e2 (diff)
Clamp code coverage
Issue-ID: POLICY-3452 Change-Id: I35c10562c5e11698491a5d93adcf417784395534 Signed-off-by: lapentafd <francesco.lapenta@est.tech>
Diffstat (limited to 'runtime-controlloop/src/test')
-rw-r--r--runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java25
1 files changed, 24 insertions, 1 deletions
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java
index d8892c8b9..ae1c59851 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java
+++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java
@@ -23,6 +23,9 @@ package org.onap.policy.clamp.controlloop.runtime.instantiation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import java.io.IOException;
import java.util.ArrayList;
@@ -34,6 +37,7 @@ import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
+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.models.controlloop.concepts.ControlLoops;
import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ClElementStatisticsProvider;
@@ -63,7 +67,8 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
*
*/
class ControlLoopInstantiationProviderTest {
-
+ private static final String ID_NAME = "PMSH_Instance1";
+ private static final String ID_VERSION = "1.2.3";
private static final String CL_INSTANTIATION_CREATE_JSON = "src/test/resources/rest/controlloops/ControlLoops.json";
private static final String CL_INSTANTIATION_UPDATE_JSON =
"src/test/resources/rest/controlloops/ControlLoopsUpdate.json";
@@ -157,6 +162,24 @@ class ControlLoopInstantiationProviderTest {
}
@Test
+ void testIntanceResponses() throws PfModelException {
+ var instantiationProvider = new ControlLoopInstantiationProvider(clProvider, commissioningProvider,
+ supervisionHandler, participantProvider);
+ var instancePropertyList = instantiationProvider.createInstanceProperties(serviceTemplate);
+ assertNull(instancePropertyList.getErrorDetails());
+ var id = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
+ assertEquals(id, instancePropertyList.getAffectedInstanceProperties().get(0));
+ var instanceOrderState = instantiationProvider.getInstantiationOrderState(ID_NAME, ID_VERSION);
+ assertEquals(ControlLoopOrderedState.UNINITIALISED, instanceOrderState.getOrderedState());
+ assertEquals(ID_NAME, instanceOrderState.getControlLoopIdentifierList().get(0).getName());
+
+ assertNotNull(clProvider.getControlLoop(id));
+ var instanceResponse = instantiationProvider.deleteInstanceProperties(ID_NAME, ID_VERSION);
+ assertEquals(ID_NAME, instanceResponse.getAffectedControlLoops().get(0).getName());
+ assertNull(clProvider.getControlLoop(id));
+ }
+
+ @Test
void testInstantiationCrud() throws Exception {
participantProvider.createParticipants(CommonTestData.createParticipants());