aboutsummaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-simulator
diff options
context:
space:
mode:
Diffstat (limited to 'participant/participant-impl/participant-impl-simulator')
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/sim/main/handler/AutomationCompositionElementHandlerV3.java10
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/main/handler/AutomationCompositionElementHandlerV3Test.java12
2 files changed, 15 insertions, 7 deletions
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/sim/main/handler/AutomationCompositionElementHandlerV3.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/sim/main/handler/AutomationCompositionElementHandlerV3.java
index 3e9db9031..e406a6127 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/sim/main/handler/AutomationCompositionElementHandlerV3.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/sim/main/handler/AutomationCompositionElementHandlerV3.java
@@ -20,6 +20,8 @@
package org.onap.policy.clamp.acm.participant.sim.main.handler;
+import java.util.ArrayList;
+import java.util.List;
import lombok.Getter;
import lombok.Setter;
import org.onap.policy.clamp.acm.participant.intermediary.api.CompositionDto;
@@ -128,8 +130,14 @@ public class AutomationCompositionElementHandlerV3 extends AcElementListenerV3 {
simulatorService.undeploy(instanceElement.instanceId(), instanceElement.elementId());
simulatorService.delete(instanceElement.instanceId(), instanceElement.elementId());
} else {
- simulatorService.migrate(instanceElement.instanceId(), instanceElement.elementId(), stage,
+ simulatorService.migrate(instanceElementMigrate.instanceId(), instanceElementMigrate.elementId(), stage,
compositionElementTarget.inProperties());
+ instanceElementMigrate.outProperties().putIfAbsent("stage", new ArrayList<>());
+ @SuppressWarnings("unchecked")
+ var stageList = (List<Integer>) instanceElementMigrate.outProperties().get("stage");
+ stageList.add(stage);
+ intermediaryApi.sendAcElementInfo(instanceElementMigrate.instanceId(), instanceElementMigrate.elementId(),
+ null, null, instanceElementMigrate.outProperties());
}
}
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 12703c7d4..d2d3d5c7e 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
@@ -23,6 +23,7 @@ package org.onap.policy.clamp.acm.participant.sim.main.handler;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -209,7 +210,7 @@ class AutomationCompositionElementHandlerV3Test {
Map.of(), Map.of());
var instanceElementMigrated = new InstanceElementDto(
INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
- null, Map.of("key", "value"), Map.of());
+ null, Map.of("key", "value"), new HashMap<>());
acElementHandler
.migrate(COMPOSITION_ELEMENT, compositionElementTarget, INSTANCE_ELEMENT, instanceElementMigrated, 0);
verify(intermediaryApi).updateAutomationCompositionElementState(
@@ -233,9 +234,8 @@ class AutomationCompositionElementHandlerV3Test {
simulatorService.setConfig(config);
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(), Map.of());
+ var instanceElementMigrated = new InstanceElementDto(INSTANCE_ELEMENT.instanceId(),
+ INSTANCE_ELEMENT.elementId(), null, Map.of(), new HashMap<>());
acElementHandler
.migrate(COMPOSITION_ELEMENT, compositionElementTarget, INSTANCE_ELEMENT, instanceElementMigrated, 1);
verify(intermediaryApi).updateAutomationCompositionElementStage(
@@ -258,8 +258,8 @@ class AutomationCompositionElementHandlerV3Test {
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(), Map.of(), ElementState.NEW);
+ var inElMigratedAdd = new InstanceElementDto(instanceElement.instanceId(), instanceElement.elementId(),
+ null, Map.of(), new HashMap<>(), ElementState.NEW);
acElementHandler
.migrate(compositionElement, compoElTargetAdd, instanceElement, inElMigratedAdd, 0);
verify(intermediaryApi).updateAutomationCompositionElementState(