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;
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());
}
}
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;
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(
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(
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(