diff options
author | brunomilitzer <bruno.militzer@est.tech> | 2021-07-28 16:58:45 +0100 |
---|---|---|
committer | Bruno Militzer <bruno.militzer@est.tech> | 2021-08-23 13:00:57 +0000 |
commit | 784eb5b7c8b85c0d24403eff2f0b1d40e024e448 (patch) | |
tree | 97c309a2811510e11c689be976489f5b2d467530 /runtime-controlloop/src/test/java | |
parent | 172f990bd92e1441eca6dd161458efddb674b2fc (diff) |
Add Create Instance Rest Endpoint
Added Camel Endpoint
Will Apply Unit Tests on POLICY-3537, since focus is to
get the functionalities completed.
Issue-ID: POLICY-3436
Change-Id: I8305896b24c30fc0403c57b3925af983065a5ec2
Signed-off-by: brunomilitzer <bruno.militzer@est.tech>
Diffstat (limited to 'runtime-controlloop/src/test/java')
-rw-r--r-- | runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/InstantiationUtils.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/InstantiationUtils.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/InstantiationUtils.java index 9a9fc1680..e98ad1380 100644 --- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/InstantiationUtils.java +++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/InstantiationUtils.java @@ -25,8 +25,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; +import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops; +import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstancePropertiesResponse; import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationCommand; import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationResponse; import org.onap.policy.clamp.controlloop.runtime.commissioning.CommissioningProvider; @@ -133,11 +135,30 @@ public class InstantiationUtils { * @throws PfModelException if an error occurs */ public static void storeToscaServiceTemplate(String path, CommissioningProvider commissioningProvider) - throws PfModelException { + throws PfModelException, ControlLoopException { ToscaServiceTemplate template = yamlTranslator.fromYaml(ResourceUtils.getResourceAsString(path), ToscaServiceTemplate.class); commissioningProvider.createControlLoopDefinitions(template); } + + /** + * Assert that instance properties has been properly saved. + * + * @param response InstancePropertiesResponse + * @throws PfModelException if an error occurs + */ + public static void assertInstancePropertiesResponse(InstancePropertiesResponse response) throws PfModelException { + + assertThat(response).isNotNull(); + assertThat(response.getErrorDetails()).isNull(); + assertThat(response.getAffectedInstanceProperties()).hasSize(8); + + boolean containsInstance = response.getAffectedInstanceProperties().stream() + .anyMatch(identifier -> identifier.getName().contains("_Instance")); + + assertThat(containsInstance).isTrue(); + + } } |