diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2023-12-07 08:58:32 +0000 |
---|---|---|
committer | Francesco Fiora <francesco.fiora@est.tech> | 2023-12-07 11:11:41 +0000 |
commit | b2393969603cb943bc76f2b65da748b871ee9d17 (patch) | |
tree | 80610ffcca8752119e8cc105d07002c541fad5ec /runtime-acm/src/test | |
parent | 3b28926870225fce8df70030d931d5027943e775 (diff) |
Add validation for AC instance element id
Issue-ID: POLICY-4900
Change-Id: I78be5924950eec508856be5850a3a749860e0e49
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-acm/src/test')
-rw-r--r-- | runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/InstantiationUtils.java | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/InstantiationUtils.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/InstantiationUtils.java index 38c63fa9b..8639dffcd 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/InstantiationUtils.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/InstantiationUtils.java @@ -25,6 +25,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; import java.io.File; +import java.util.ArrayList; +import java.util.UUID; import org.onap.policy.clamp.models.acm.concepts.AutomationComposition; import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationResponse; import org.onap.policy.common.utils.coder.Coder; @@ -56,6 +58,13 @@ public class InstantiationUtils { // add suffix to name automationComposition.setName(automationComposition.getName() + suffix); + var elements = new ArrayList<>(automationComposition.getElements().values()); + automationComposition.getElements().clear(); + for (var element : elements) { + // set unique UUID to the element + element.setId(UUID.randomUUID()); + automationComposition.getElements().put(element.getId(), element); + } return automationComposition; } catch (CoderException e) { fail("Cannot read or decode " + path); @@ -84,18 +93,6 @@ public class InstantiationUtils { } /** - * Assert that Instantiation Response contains proper AutomationCompositions. - * - * @param response InstantiationResponse - * @param affectedAutomationComposition ToscaConceptIdentifier - */ - public static void assertInstantiationResponse(InstantiationResponse response, - ToscaConceptIdentifier affectedAutomationComposition) { - assertThat(response).isNotNull(); - assertEquals(response.getAffectedAutomationComposition(), affectedAutomationComposition); - } - - /** * Assert that Instantiation Response contains AutomationComposition equals to automationComposition. * * @param response InstantiationResponse |