2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2024-2025 OpenInfra Foundation Europe. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.clamp.acm.participant.sim.main.handler;
23 import static org.mockito.Mockito.mock;
24 import static org.mockito.Mockito.verify;
26 import java.util.HashMap;
27 import java.util.List;
29 import java.util.UUID;
30 import org.junit.jupiter.api.Test;
31 import org.onap.policy.clamp.acm.participant.intermediary.api.CompositionDto;
32 import org.onap.policy.clamp.acm.participant.intermediary.api.CompositionElementDto;
33 import org.onap.policy.clamp.acm.participant.intermediary.api.ElementState;
34 import org.onap.policy.clamp.acm.participant.intermediary.api.InstanceElementDto;
35 import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
36 import org.onap.policy.clamp.acm.participant.sim.comm.CommonTestData;
37 import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
38 import org.onap.policy.clamp.models.acm.concepts.DeployState;
39 import org.onap.policy.clamp.models.acm.concepts.LockState;
40 import org.onap.policy.clamp.models.acm.concepts.StateChangeResult;
41 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
43 class AutomationCompositionElementHandlerTest {
45 private static final ToscaConceptIdentifier ELEMENT_DEFINITION_ID = new ToscaConceptIdentifier("name", "1.0.0");
46 private static final CompositionElementDto COMPOSITION_ELEMENT =
47 new CompositionElementDto(UUID.randomUUID(), ELEMENT_DEFINITION_ID, Map.of(), Map.of());
48 private static final InstanceElementDto INSTANCE_ELEMENT =
49 new InstanceElementDto(UUID.randomUUID(), UUID.randomUUID(), Map.of(), new HashMap<>());
50 private static final CompositionDto COMPOSITION = new CompositionDto(UUID.randomUUID(),
51 Map.of(ELEMENT_DEFINITION_ID, Map.of()), Map.of(ELEMENT_DEFINITION_ID, new HashMap<>()));
55 var config = CommonTestData.createSimConfig();
56 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
57 var simulatorService = new SimulatorService(intermediaryApi);
58 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
59 simulatorService.setConfig(config);
60 acElementHandler.deploy(COMPOSITION_ELEMENT, INSTANCE_ELEMENT);
61 verify(intermediaryApi).updateAutomationCompositionElementState(
62 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), DeployState.DEPLOYED,
63 null, StateChangeResult.NO_ERROR, "Deployed");
65 config.setDeploySuccess(false);
66 acElementHandler.deploy(COMPOSITION_ELEMENT, INSTANCE_ELEMENT);
67 verify(intermediaryApi).updateAutomationCompositionElementState(
68 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), DeployState.UNDEPLOYED,
69 null, StateChangeResult.FAILED, "Deploy failed!");
74 var config = CommonTestData.createSimConfig();
75 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
76 var simulatorService = new SimulatorService(intermediaryApi);
77 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
78 simulatorService.setConfig(config);
79 acElementHandler.undeploy(COMPOSITION_ELEMENT, INSTANCE_ELEMENT);
80 verify(intermediaryApi).updateAutomationCompositionElementState(
81 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), DeployState.UNDEPLOYED,
82 null, StateChangeResult.NO_ERROR, "Undeployed");
84 config.setUndeploySuccess(false);
85 acElementHandler.undeploy(COMPOSITION_ELEMENT, INSTANCE_ELEMENT);
86 verify(intermediaryApi).updateAutomationCompositionElementState(
87 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), DeployState.DEPLOYED,
88 null, StateChangeResult.FAILED, "Undeploy failed!");
93 var config = CommonTestData.createSimConfig();
94 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
95 var simulatorService = new SimulatorService(intermediaryApi);
96 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
97 simulatorService.setConfig(config);
98 acElementHandler.lock(COMPOSITION_ELEMENT, INSTANCE_ELEMENT);
99 verify(intermediaryApi).updateAutomationCompositionElementState(
100 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), null, LockState.LOCKED,
101 StateChangeResult.NO_ERROR, "Locked");
103 config.setLockSuccess(false);
104 acElementHandler.lock(COMPOSITION_ELEMENT, INSTANCE_ELEMENT);
105 verify(intermediaryApi).updateAutomationCompositionElementState(
106 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), null, LockState.UNLOCKED,
107 StateChangeResult.FAILED, "Lock failed!");
112 var config = CommonTestData.createSimConfig();
113 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
114 var simulatorService = new SimulatorService(intermediaryApi);
115 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
116 simulatorService.setConfig(config);
117 acElementHandler.unlock(COMPOSITION_ELEMENT, INSTANCE_ELEMENT);
118 verify(intermediaryApi).updateAutomationCompositionElementState(
119 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), null, LockState.UNLOCKED,
120 StateChangeResult.NO_ERROR, "Unlocked");
122 config.setUnlockSuccess(false);
123 acElementHandler.unlock(COMPOSITION_ELEMENT, INSTANCE_ELEMENT);
124 verify(intermediaryApi).updateAutomationCompositionElementState(
125 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), null, LockState.LOCKED,
126 StateChangeResult.FAILED, "Unlock failed!");
131 var config = CommonTestData.createSimConfig();
132 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
133 var simulatorService = new SimulatorService(intermediaryApi);
134 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
135 simulatorService.setConfig(config);
136 var instanceElementUpdated = new InstanceElementDto(
137 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
138 Map.of("key", "value"), Map.of());
139 acElementHandler.update(COMPOSITION_ELEMENT, INSTANCE_ELEMENT, instanceElementUpdated);
140 verify(intermediaryApi).updateAutomationCompositionElementState(
141 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
142 DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Updated");
144 config.setUpdateSuccess(false);
145 acElementHandler.update(COMPOSITION_ELEMENT, INSTANCE_ELEMENT, instanceElementUpdated);
146 verify(intermediaryApi).updateAutomationCompositionElementState(
147 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
148 DeployState.DEPLOYED, null, StateChangeResult.FAILED, "Update failed!");
153 var config = CommonTestData.createSimConfig();
154 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
155 var simulatorService = new SimulatorService(intermediaryApi);
156 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
157 simulatorService.setConfig(config);
158 acElementHandler.delete(COMPOSITION_ELEMENT, INSTANCE_ELEMENT);
159 verify(intermediaryApi).updateAutomationCompositionElementState(
160 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), DeployState.DELETED,
161 null, StateChangeResult.NO_ERROR, "Deleted");
163 config.setDeleteSuccess(false);
164 acElementHandler.delete(COMPOSITION_ELEMENT, INSTANCE_ELEMENT);
165 verify(intermediaryApi).updateAutomationCompositionElementState(
166 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), DeployState.UNDEPLOYED,
167 null, StateChangeResult.FAILED, "Delete failed!");
172 var config = CommonTestData.createSimConfig();
173 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
174 var simulatorService = new SimulatorService(intermediaryApi);
175 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
176 simulatorService.setConfig(config);
177 acElementHandler.prime(COMPOSITION);
178 verify(intermediaryApi).updateCompositionState(
179 COMPOSITION.compositionId(), AcTypeState.PRIMED, StateChangeResult.NO_ERROR, "Primed");
181 config.setPrimeSuccess(false);
182 acElementHandler.prime(COMPOSITION);
183 verify(intermediaryApi).updateCompositionState(
184 COMPOSITION.compositionId(), AcTypeState.COMMISSIONED, StateChangeResult.FAILED, "Prime failed!");
189 var config = CommonTestData.createSimConfig();
190 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
191 var simulatorService = new SimulatorService(intermediaryApi);
192 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
193 simulatorService.setConfig(config);
194 acElementHandler.deprime(COMPOSITION);
195 verify(intermediaryApi).updateCompositionState(
196 COMPOSITION.compositionId(), AcTypeState.COMMISSIONED, StateChangeResult.NO_ERROR, "Deprimed");
198 config.setDeprimeSuccess(false);
199 acElementHandler.deprime(COMPOSITION);
200 verify(intermediaryApi).updateCompositionState(
201 COMPOSITION.compositionId(), AcTypeState.PRIMED, StateChangeResult.FAILED, "Deprime failed!");
206 var config = CommonTestData.createSimConfig();
207 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
208 var simulatorService = new SimulatorService(intermediaryApi);
209 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
210 simulatorService.setConfig(config);
211 var compositionElementTarget = new CompositionElementDto(UUID.randomUUID(), new ToscaConceptIdentifier(),
213 var instanceElementMigrated = new InstanceElementDto(
214 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
215 Map.of("key", "value"), new HashMap<>());
217 .migrate(COMPOSITION_ELEMENT, compositionElementTarget, INSTANCE_ELEMENT, instanceElementMigrated, 0);
218 verify(intermediaryApi).updateAutomationCompositionElementState(
219 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
220 DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Migrated");
222 config.setMigrateSuccess(false);
224 .migrate(COMPOSITION_ELEMENT, compositionElementTarget, INSTANCE_ELEMENT, instanceElementMigrated, 0);
225 verify(intermediaryApi).updateAutomationCompositionElementState(
226 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
227 DeployState.DEPLOYED, null, StateChangeResult.FAILED, "Migrate failed!");
231 void testMigrateStage() {
232 var config = CommonTestData.createSimConfig();
233 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
234 var simulatorService = new SimulatorService(intermediaryApi);
235 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
236 simulatorService.setConfig(config);
237 var compositionElementTarget = new CompositionElementDto(UUID.randomUUID(), new ToscaConceptIdentifier(),
238 Map.of("stage", List.of(1, 2)), Map.of());
239 var instanceElementMigrated = new InstanceElementDto(INSTANCE_ELEMENT.instanceId(),
240 INSTANCE_ELEMENT.elementId(), Map.of(), new HashMap<>());
242 .migrate(COMPOSITION_ELEMENT, compositionElementTarget, INSTANCE_ELEMENT, instanceElementMigrated, 1);
243 verify(intermediaryApi).updateAutomationCompositionElementStage(
244 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
245 StateChangeResult.NO_ERROR, 2, "stage 1 Migrated");
249 void testMigrateAdd() {
250 var config = CommonTestData.createSimConfig();
251 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
252 var simulatorService = new SimulatorService(intermediaryApi);
253 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
254 simulatorService.setConfig(config);
255 var compositionElement = new CompositionElementDto(
256 UUID.randomUUID(), new ToscaConceptIdentifier(), Map.of(), Map.of(), ElementState.NOT_PRESENT);
258 var instanceElement = new InstanceElementDto(
259 UUID.randomUUID(), UUID.randomUUID(), Map.of(), Map.of(), ElementState.NOT_PRESENT);
261 var compoElTargetAdd = new CompositionElementDto(
262 UUID.randomUUID(), new ToscaConceptIdentifier(), Map.of(), Map.of(), ElementState.NEW);
263 var inElMigratedAdd = new InstanceElementDto(instanceElement.instanceId(), instanceElement.elementId(),
264 Map.of(), new HashMap<>(), ElementState.NEW);
266 .migrate(compositionElement, compoElTargetAdd, instanceElement, inElMigratedAdd, 0);
267 verify(intermediaryApi).updateAutomationCompositionElementState(
268 instanceElement.instanceId(), instanceElement.elementId(),
269 DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Migrated");
273 void testMigrateRemove() {
274 var config = CommonTestData.createSimConfig();
275 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
276 var simulatorService = new SimulatorService(intermediaryApi);
277 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
278 simulatorService.setConfig(config);
280 var compoElTargetRemove = new CompositionElementDto(UUID.randomUUID(), new ToscaConceptIdentifier(),
281 Map.of(), Map.of(), ElementState.REMOVED);
282 var inElMigratedRemove = new InstanceElementDto(
283 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
284 Map.of("key", "value"), Map.of(), ElementState.REMOVED);
286 .migrate(COMPOSITION_ELEMENT, compoElTargetRemove, INSTANCE_ELEMENT, inElMigratedRemove, 0);
287 verify(intermediaryApi).updateAutomationCompositionElementState(
288 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
289 DeployState.DELETED, null, StateChangeResult.NO_ERROR, "Deleted");
293 void testMigratePrecheck() {
294 var config = CommonTestData.createSimConfig();
295 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
296 var simulatorService = new SimulatorService(intermediaryApi);
297 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
298 simulatorService.setConfig(config);
299 var compositionElementTarget = new CompositionElementDto(UUID.randomUUID(), new ToscaConceptIdentifier(),
301 var instanceElementMigrated = new InstanceElementDto(
302 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
303 Map.of("key", "value"), Map.of());
304 acElementHandler.migratePrecheck(COMPOSITION_ELEMENT, compositionElementTarget,
305 INSTANCE_ELEMENT, instanceElementMigrated);
306 verify(intermediaryApi).updateAutomationCompositionElementState(
307 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
308 DeployState.DEPLOYED, null,
309 StateChangeResult.NO_ERROR, "Migration precheck completed");
311 config.setMigratePrecheck(false);
312 acElementHandler.migratePrecheck(COMPOSITION_ELEMENT, compositionElementTarget,
313 INSTANCE_ELEMENT, instanceElementMigrated);
314 verify(intermediaryApi).updateAutomationCompositionElementState(
315 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
316 DeployState.DEPLOYED, null,
317 StateChangeResult.FAILED, "Migration precheck failed");
322 var config = CommonTestData.createSimConfig();
323 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
324 var simulatorService = new SimulatorService(intermediaryApi);
325 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
326 simulatorService.setConfig(config);
327 acElementHandler.prepare(COMPOSITION_ELEMENT, INSTANCE_ELEMENT, 0);
328 verify(intermediaryApi).updateAutomationCompositionElementState(
329 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), DeployState.UNDEPLOYED,
330 null, StateChangeResult.NO_ERROR, "Prepare completed");
332 config.setPrepare(false);
333 acElementHandler.prepare(COMPOSITION_ELEMENT, INSTANCE_ELEMENT, 0);
334 verify(intermediaryApi).updateAutomationCompositionElementState(
335 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), DeployState.UNDEPLOYED,
336 null, StateChangeResult.FAILED, "Prepare failed");
341 var config = CommonTestData.createSimConfig();
342 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
343 var simulatorService = new SimulatorService(intermediaryApi);
344 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
345 simulatorService.setConfig(config);
346 acElementHandler.review(COMPOSITION_ELEMENT, INSTANCE_ELEMENT);
347 verify(intermediaryApi).updateAutomationCompositionElementState(
348 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), DeployState.DEPLOYED,
349 null, StateChangeResult.NO_ERROR, "Review completed");
351 config.setReview(false);
352 acElementHandler.review(COMPOSITION_ELEMENT, INSTANCE_ELEMENT);
353 verify(intermediaryApi).updateAutomationCompositionElementState(
354 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), DeployState.DEPLOYED,
355 null, StateChangeResult.FAILED, "Review failed");
359 void testRollback() {
360 var config = CommonTestData.createSimConfig();
361 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
362 var simulatorService = new SimulatorService(intermediaryApi);
363 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
364 simulatorService.setConfig(config);
365 var compositionElementRollback = new CompositionElementDto(UUID.randomUUID(), new ToscaConceptIdentifier(),
367 var instanceElementRollback = new InstanceElementDto(
368 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
369 Map.of("key", "value"), new HashMap<>());
370 acElementHandler.rollbackMigration(COMPOSITION_ELEMENT, compositionElementRollback, INSTANCE_ELEMENT,
371 instanceElementRollback, 0);
372 verify(intermediaryApi).updateAutomationCompositionElementState(
373 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), DeployState.DEPLOYED,
374 null, StateChangeResult.NO_ERROR, "Migration rollback done");
376 config.setRollback(false);
377 acElementHandler.rollbackMigration(COMPOSITION_ELEMENT, compositionElementRollback, INSTANCE_ELEMENT,
378 instanceElementRollback, 0);
379 verify(intermediaryApi).updateAutomationCompositionElementState(
380 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(), DeployState.DEPLOYED,
381 null, StateChangeResult.FAILED, "Migration rollback failed");
386 void testRollbackStage() {
387 var config = CommonTestData.createSimConfig();
388 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
389 var simulatorService = new SimulatorService(intermediaryApi);
390 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
391 simulatorService.setConfig(config);
392 var compositionElementRollback = new CompositionElementDto(UUID.randomUUID(), new ToscaConceptIdentifier(),
393 Map.of("stage", List.of(1, 2)), Map.of());
394 var instanceElementRollback = new InstanceElementDto(INSTANCE_ELEMENT.instanceId(),
395 INSTANCE_ELEMENT.elementId(), Map.of(), new HashMap<>());
396 acElementHandler.rollbackMigration(COMPOSITION_ELEMENT, compositionElementRollback, INSTANCE_ELEMENT,
397 instanceElementRollback, 1);
398 verify(intermediaryApi).updateAutomationCompositionElementStage(
399 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
400 StateChangeResult.NO_ERROR, 2, "stage 1 Migration rollback");
404 void testRollbackAdd() {
405 var config = CommonTestData.createSimConfig();
406 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
407 var simulatorService = new SimulatorService(intermediaryApi);
408 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
409 simulatorService.setConfig(config);
410 var compositionElement = new CompositionElementDto(
411 UUID.randomUUID(), new ToscaConceptIdentifier(), Map.of(), Map.of(), ElementState.NOT_PRESENT);
413 var instanceElement = new InstanceElementDto(
414 UUID.randomUUID(), UUID.randomUUID(), Map.of(), Map.of(), ElementState.NOT_PRESENT);
416 var compoElRollbackAdd = new CompositionElementDto(
417 UUID.randomUUID(), new ToscaConceptIdentifier(), Map.of(), Map.of(), ElementState.NEW);
418 var inElRollbackAdd = new InstanceElementDto(instanceElement.instanceId(), instanceElement.elementId(),
419 Map.of(), new HashMap<>(), ElementState.NEW);
421 .rollbackMigration(compositionElement, compoElRollbackAdd, instanceElement, inElRollbackAdd, 0);
422 verify(intermediaryApi).updateAutomationCompositionElementState(
423 instanceElement.instanceId(), instanceElement.elementId(),
424 DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Migration rollback done");
428 void testRollbackRemove() {
429 var config = CommonTestData.createSimConfig();
430 var intermediaryApi = mock(ParticipantIntermediaryApi.class);
431 var simulatorService = new SimulatorService(intermediaryApi);
432 var acElementHandler = new AutomationCompositionElementHandler(intermediaryApi, simulatorService);
433 simulatorService.setConfig(config);
435 var compoElRollbackRemove = new CompositionElementDto(UUID.randomUUID(), new ToscaConceptIdentifier(),
436 Map.of(), Map.of(), ElementState.REMOVED);
437 var inElRollbackRemove = new InstanceElementDto(
438 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
439 Map.of("key", "value"), Map.of(), ElementState.REMOVED);
441 .rollbackMigration(COMPOSITION_ELEMENT, compoElRollbackRemove, INSTANCE_ELEMENT, inElRollbackRemove, 0);
442 verify(intermediaryApi).updateAutomationCompositionElementState(
443 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
444 DeployState.UNDEPLOYED, null, StateChangeResult.NO_ERROR, "Undeployed");
445 verify(intermediaryApi).updateAutomationCompositionElementState(
446 INSTANCE_ELEMENT.instanceId(), INSTANCE_ELEMENT.elementId(),
447 DeployState.DELETED, null, StateChangeResult.NO_ERROR, "Deleted");