From 2df59bcd84c52b013ac5f607acd0ae50fdbff8bf Mon Sep 17 00:00:00 2001 From: FrancescoFioraEst Date: Wed, 18 Sep 2024 17:27:04 +0100 Subject: Move policy definition data under instance properties Move policy definition data under instance properties for policy-participant. Issue-ID: POLICY-4938 Change-Id: I60c6536554ce3750f03e42e397f000b35b5d6e07 Signed-off-by: FrancescoFioraEst --- .../AutomationCompositionElementHandlerV2Test.java | 15 +++++++-------- .../AutomationCompositionElementHandlerV3Test.java | 16 ++++++++-------- 2 files changed, 15 insertions(+), 16 deletions(-) (limited to 'participant/participant-impl/participant-impl-simulator/src') diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/main/handler/AutomationCompositionElementHandlerV2Test.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/main/handler/AutomationCompositionElementHandlerV2Test.java index e89a82696..2f1e9dc9d 100644 --- a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/main/handler/AutomationCompositionElementHandlerV2Test.java +++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/main/handler/AutomationCompositionElementHandlerV2Test.java @@ -44,7 +44,7 @@ class AutomationCompositionElementHandlerV2Test { private static final CompositionElementDto COMPOSITION_ELEMENT = new CompositionElementDto(UUID.randomUUID(), new ToscaConceptIdentifier(), Map.of(), Map.of()); private static final InstanceElementDto INSTANCE_ELEMENT = - new InstanceElementDto(UUID.randomUUID(), UUID.randomUUID(), null, Map.of(), Map.of()); + new InstanceElementDto(UUID.randomUUID(), UUID.randomUUID(), Map.of(), Map.of()); private static final CompositionDto COMPOSITION = new CompositionDto(UUID.randomUUID(), Map.of(), Map.of()); @Test @@ -131,7 +131,7 @@ class AutomationCompositionElementHandlerV2Test { var acElementHandler = new AutomationCompositionElementHandlerV2(intermediaryApi, simulatorService); simulatorService.setConfig(config); var instanceElementUpdated = new InstanceElementDto( - INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), null, + INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), Map.of("key", "value"), Map.of()); acElementHandler.update(COMPOSITION_ELEMENT, INSTANCE_ELEMENT, instanceElementUpdated); verify(intermediaryApi).updateAutomationCompositionElementState( @@ -209,7 +209,7 @@ class AutomationCompositionElementHandlerV2Test { Map.of(), Map.of()); var instanceElementMigrated = new InstanceElementDto( INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), - null, Map.of("key", "value"), new HashMap<>()); + Map.of("key", "value"), new HashMap<>()); acElementHandler .migrate(COMPOSITION_ELEMENT, compositionElementTarget, INSTANCE_ELEMENT, instanceElementMigrated); verify(intermediaryApi).updateAutomationCompositionElementState( @@ -236,13 +236,12 @@ class AutomationCompositionElementHandlerV2Test { UUID.randomUUID(), new ToscaConceptIdentifier(), Map.of(), Map.of(), ElementState.NOT_PRESENT); var instanceElement = new InstanceElementDto( - UUID.randomUUID(), UUID.randomUUID(), null, Map.of(), Map.of(), ElementState.NOT_PRESENT); + UUID.randomUUID(), UUID.randomUUID(), Map.of(), Map.of(), ElementState.NOT_PRESENT); var compoElTargetAdd = new CompositionElementDto( UUID.randomUUID(), new ToscaConceptIdentifier(), Map.of(), Map.of(), ElementState.NEW); var inElMigratedAdd = new InstanceElementDto( - instanceElement.instanceId(), instanceElement.elementId(), null, - Map.of(), new HashMap<>(), ElementState.NEW); + instanceElement.instanceId(), instanceElement.elementId(), Map.of(), new HashMap<>(), ElementState.NEW); acElementHandler .migrate(compositionElement, compoElTargetAdd, instanceElement, inElMigratedAdd); verify(intermediaryApi).updateAutomationCompositionElementState( @@ -262,7 +261,7 @@ class AutomationCompositionElementHandlerV2Test { Map.of(), Map.of(), ElementState.REMOVED); var inElMigratedRemove = new InstanceElementDto( INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), - null, Map.of("key", "value"), Map.of(), ElementState.REMOVED); + Map.of("key", "value"), Map.of(), ElementState.REMOVED); acElementHandler .migrate(COMPOSITION_ELEMENT, compoElTargetRemove, INSTANCE_ELEMENT, inElMigratedRemove); verify(intermediaryApi).updateAutomationCompositionElementState( @@ -284,7 +283,7 @@ class AutomationCompositionElementHandlerV2Test { Map.of(), Map.of()); var instanceElementMigrated = new InstanceElementDto( INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), - null, Map.of("key", "value"), Map.of()); + Map.of("key", "value"), Map.of()); acElementHandler.migratePrecheck(COMPOSITION_ELEMENT, compositionElementTarget, INSTANCE_ELEMENT, instanceElementMigrated); verify(intermediaryApi).updateAutomationCompositionElementState( diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/main/handler/AutomationCompositionElementHandlerV3Test.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/main/handler/AutomationCompositionElementHandlerV3Test.java index d2d3d5c7e..41b3f2001 100644 --- a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/main/handler/AutomationCompositionElementHandlerV3Test.java +++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/main/handler/AutomationCompositionElementHandlerV3Test.java @@ -45,7 +45,7 @@ class AutomationCompositionElementHandlerV3Test { private static final CompositionElementDto COMPOSITION_ELEMENT = new CompositionElementDto(UUID.randomUUID(), new ToscaConceptIdentifier(), Map.of(), Map.of()); private static final InstanceElementDto INSTANCE_ELEMENT = - new InstanceElementDto(UUID.randomUUID(), UUID.randomUUID(), null, Map.of(), Map.of()); + new InstanceElementDto(UUID.randomUUID(), UUID.randomUUID(), Map.of(), Map.of()); private static final CompositionDto COMPOSITION = new CompositionDto(UUID.randomUUID(), Map.of(), Map.of()); @Test @@ -132,7 +132,7 @@ class AutomationCompositionElementHandlerV3Test { var acElementHandler = new AutomationCompositionElementHandlerV3(intermediaryApi, simulatorService); simulatorService.setConfig(config); var instanceElementUpdated = new InstanceElementDto( - INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), null, + INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), Map.of("key", "value"), Map.of()); acElementHandler.update(COMPOSITION_ELEMENT, INSTANCE_ELEMENT, instanceElementUpdated); verify(intermediaryApi).updateAutomationCompositionElementState( @@ -210,7 +210,7 @@ class AutomationCompositionElementHandlerV3Test { Map.of(), Map.of()); var instanceElementMigrated = new InstanceElementDto( INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), - null, Map.of("key", "value"), new HashMap<>()); + Map.of("key", "value"), new HashMap<>()); acElementHandler .migrate(COMPOSITION_ELEMENT, compositionElementTarget, INSTANCE_ELEMENT, instanceElementMigrated, 0); verify(intermediaryApi).updateAutomationCompositionElementState( @@ -235,7 +235,7 @@ class AutomationCompositionElementHandlerV3Test { var compositionElementTarget = new CompositionElementDto(UUID.randomUUID(), new ToscaConceptIdentifier(), Map.of("stage", List.of(1, 2)), Map.of()); var instanceElementMigrated = new InstanceElementDto(INSTANCE_ELEMENT.instanceId(), - INSTANCE_ELEMENT.elementId(), null, Map.of(), new HashMap<>()); + INSTANCE_ELEMENT.elementId(), Map.of(), new HashMap<>()); acElementHandler .migrate(COMPOSITION_ELEMENT, compositionElementTarget, INSTANCE_ELEMENT, instanceElementMigrated, 1); verify(intermediaryApi).updateAutomationCompositionElementStage( @@ -254,12 +254,12 @@ class AutomationCompositionElementHandlerV3Test { UUID.randomUUID(), new ToscaConceptIdentifier(), Map.of(), Map.of(), ElementState.NOT_PRESENT); var instanceElement = new InstanceElementDto( - UUID.randomUUID(), UUID.randomUUID(), null, Map.of(), Map.of(), ElementState.NOT_PRESENT); + UUID.randomUUID(), UUID.randomUUID(), Map.of(), Map.of(), ElementState.NOT_PRESENT); var compoElTargetAdd = new CompositionElementDto( UUID.randomUUID(), new ToscaConceptIdentifier(), Map.of(), Map.of(), ElementState.NEW); var inElMigratedAdd = new InstanceElementDto(instanceElement.instanceId(), instanceElement.elementId(), - null, Map.of(), new HashMap<>(), ElementState.NEW); + Map.of(), new HashMap<>(), ElementState.NEW); acElementHandler .migrate(compositionElement, compoElTargetAdd, instanceElement, inElMigratedAdd, 0); verify(intermediaryApi).updateAutomationCompositionElementState( @@ -279,7 +279,7 @@ class AutomationCompositionElementHandlerV3Test { Map.of(), Map.of(), ElementState.REMOVED); var inElMigratedRemove = new InstanceElementDto( INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), - null, Map.of("key", "value"), Map.of(), ElementState.REMOVED); + Map.of("key", "value"), Map.of(), ElementState.REMOVED); acElementHandler .migrate(COMPOSITION_ELEMENT, compoElTargetRemove, INSTANCE_ELEMENT, inElMigratedRemove, 0); verify(intermediaryApi).updateAutomationCompositionElementState( @@ -301,7 +301,7 @@ class AutomationCompositionElementHandlerV3Test { Map.of(), Map.of()); var instanceElementMigrated = new InstanceElementDto( INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), - null, Map.of("key", "value"), Map.of()); + Map.of("key", "value"), Map.of()); acElementHandler.migratePrecheck(COMPOSITION_ELEMENT, compositionElementTarget, INSTANCE_ELEMENT, instanceElementMigrated); verify(intermediaryApi).updateAutomationCompositionElementState( -- cgit 1.2.3-korg