aboutsummaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-simulator/src/test/java
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2024-03-20 16:17:46 +0000
committerFrancesco Fiora <francesco.fiora@est.tech>2024-08-06 10:33:25 +0000
commita2477d552ad3993989a4f8b7a7adac6686719cf3 (patch)
treea7acc256cd3967e85ea091bd3646272def3d3d3d /participant/participant-impl/participant-impl-simulator/src/test/java
parente1589aa82ddfb58b0d4bcabe1c63cdda29939e6a (diff)
Allow migration to be performed in stages in ACM intermediary
Allow migration to be performed in stages, and replace newElement and removedElement with an Enum in CompositionElementDto and InstanceElementDto. Issue-ID: POLICY-5091 Change-Id: I2d66abc453776fd708fc18fd9019ca248f8d2eee Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-impl/participant-impl-simulator/src/test/java')
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/main/handler/AutomationCompositionElementHandlerV2Test.java23
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/main/handler/AutomationCompositionElementHandlerV3Test.java22
2 files changed, 29 insertions, 16 deletions
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 e8e9b766c..f3a1839f0 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
@@ -28,6 +28,7 @@ import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.acm.participant.intermediary.api.CompositionDto;
import org.onap.policy.clamp.acm.participant.intermediary.api.CompositionElementDto;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ElementState;
import org.onap.policy.clamp.acm.participant.intermediary.api.InstanceElementDto;
import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
import org.onap.policy.clamp.acm.participant.sim.comm.CommonTestData;
@@ -229,15 +230,21 @@ class AutomationCompositionElementHandlerV2Test {
var simulatorService = new SimulatorService(intermediaryApi);
var acElementHandler = new AutomationCompositionElementHandlerV2(intermediaryApi, simulatorService);
simulatorService.setConfig(config);
- var compoElTargetAdd = new CompositionElementDto(UUID.randomUUID(), new ToscaConceptIdentifier(),
- Map.of(), Map.of(), true, false);
+
+ var compositionElement = new CompositionElementDto(
+ 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);
+
+ var compoElTargetAdd = new CompositionElementDto(
+ UUID.randomUUID(), new ToscaConceptIdentifier(), Map.of(), Map.of(), ElementState.NEW);
var inElMigratedAdd = new InstanceElementDto(
- INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
- null, Map.of("key", "value"), Map.of(), true, false);
+ instanceElement.instanceId(), instanceElement.elementId(), null, Map.of(), Map.of(), ElementState.NEW);
acElementHandler
- .migrate(COMPOSITION_ELEMENT, compoElTargetAdd, INSTANCE_ELEMENT, inElMigratedAdd);
+ .migrate(compositionElement, compoElTargetAdd, instanceElement, inElMigratedAdd);
verify(intermediaryApi).updateAutomationCompositionElementState(
- INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
+ instanceElement.instanceId(), instanceElement.elementId(),
DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Migrated");
}
@@ -250,10 +257,10 @@ class AutomationCompositionElementHandlerV2Test {
simulatorService.setConfig(config);
var compoElTargetRemove = new CompositionElementDto(UUID.randomUUID(), new ToscaConceptIdentifier(),
- Map.of(), Map.of(), false, true);
+ Map.of(), Map.of(), ElementState.REMOVED);
var inElMigratedRemove = new InstanceElementDto(
INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
- null, Map.of("key", "value"), Map.of(), false, true);
+ null, Map.of("key", "value"), Map.of(), ElementState.REMOVED);
acElementHandler
.migrate(COMPOSITION_ELEMENT, compoElTargetRemove, INSTANCE_ELEMENT, inElMigratedRemove);
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 3a7af2456..12703c7d4 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
@@ -29,6 +29,7 @@ import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.acm.participant.intermediary.api.CompositionDto;
import org.onap.policy.clamp.acm.participant.intermediary.api.CompositionElementDto;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ElementState;
import org.onap.policy.clamp.acm.participant.intermediary.api.InstanceElementDto;
import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
import org.onap.policy.clamp.acm.participant.sim.comm.CommonTestData;
@@ -249,15 +250,20 @@ class AutomationCompositionElementHandlerV3Test {
var simulatorService = new SimulatorService(intermediaryApi);
var acElementHandler = new AutomationCompositionElementHandlerV3(intermediaryApi, simulatorService);
simulatorService.setConfig(config);
- var compoElTargetAdd = new CompositionElementDto(UUID.randomUUID(), new ToscaConceptIdentifier(),
- Map.of(), Map.of(), true, false);
+ var compositionElement = new CompositionElementDto(
+ 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);
+
+ var compoElTargetAdd = new CompositionElementDto(
+ UUID.randomUUID(), new ToscaConceptIdentifier(), Map.of(), Map.of(), ElementState.NEW);
var inElMigratedAdd = new InstanceElementDto(
- INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
- null, Map.of("key", "value"), Map.of(), true, false);
+ instanceElement.instanceId(), instanceElement.elementId(), null, Map.of(), Map.of(), ElementState.NEW);
acElementHandler
- .migrate(COMPOSITION_ELEMENT, compoElTargetAdd, INSTANCE_ELEMENT, inElMigratedAdd, 0);
+ .migrate(compositionElement, compoElTargetAdd, instanceElement, inElMigratedAdd, 0);
verify(intermediaryApi).updateAutomationCompositionElementState(
- INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
+ instanceElement.instanceId(), instanceElement.elementId(),
DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Migrated");
}
@@ -270,10 +276,10 @@ class AutomationCompositionElementHandlerV3Test {
simulatorService.setConfig(config);
var compoElTargetRemove = new CompositionElementDto(UUID.randomUUID(), new ToscaConceptIdentifier(),
- Map.of(), Map.of(), false, true);
+ Map.of(), Map.of(), ElementState.REMOVED);
var inElMigratedRemove = new InstanceElementDto(
INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
- null, Map.of("key", "value"), Map.of(), false, true);
+ null, Map.of("key", "value"), Map.of(), ElementState.REMOVED);
acElementHandler
.migrate(COMPOSITION_ELEMENT, compoElTargetRemove, INSTANCE_ELEMENT, inElMigratedRemove, 0);
verify(intermediaryApi).updateAutomationCompositionElementState(