intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(), deployState,
lockState, StateChangeResult.NO_ERROR, "Restarted");
}
+
+ @Override
+ public void migrate(UUID automationCompositionId, AcElementDeploy element, UUID compositionTargetId,
+ Map<String, Object> properties) throws PfModelException {
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(),
+ DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Migrated");
+ }
}
verify(intermediaryApi).updateAutomationCompositionElementState(automationCompositionId,
automationCompositionElementId, DeployState.UNDEPLOYED, null, StateChangeResult.NO_ERROR, "Undeployed");
}
+
+ @Test
+ void testMigrate() throws PfModelException {
+ var participantIntermediaryApi = mock(ParticipantIntermediaryApi.class);
+ var automationCompositionElementHandler =
+ new AutomationCompositionElementHandler(participantIntermediaryApi, acA1PmsClient);
+
+ var automationCompositionId = UUID.randomUUID();
+ var element = commonTestData.getAutomationCompositionElement();
+ automationCompositionElementHandler.migrate(automationCompositionId, element, UUID.randomUUID(), Map.of());
+
+ verify(participantIntermediaryApi).updateAutomationCompositionElementState(automationCompositionId,
+ element.getId(), DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Migrated");
+ }
}
intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(), deployState,
lockState, StateChangeResult.NO_ERROR, "Restarted");
}
+
+ @Override
+ public void migrate(UUID automationCompositionId, AcElementDeploy element, UUID compositionTargetId,
+ Map<String, Object> properties) throws PfModelException {
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(),
+ DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Migrated");
+ }
}
verify(participantIntermediaryApi).updateAutomationCompositionElementState(instanceId, element.getId(),
DeployState.DEPLOYED, LockState.LOCKED, StateChangeResult.NO_ERROR, "Restarted");
}
+
+ @Test
+ void testMigrate() throws PfModelException {
+ var instanceId = commonTestData.getAutomationCompositionId();
+ var element = commonTestData.getAutomationCompositionElement();
+ var acElementId = element.getId();
+ var participantIntermediaryApi = mock(ParticipantIntermediaryApi.class);
+
+ var automationCompositionElementHandler =
+ new AutomationCompositionElementHandler(participantIntermediaryApi, mock(AcHttpClient.class));
+
+ automationCompositionElementHandler.migrate(instanceId, element, UUID.randomUUID(), Map.of());
+ verify(participantIntermediaryApi).updateAutomationCompositionElementState(instanceId, acElementId,
+ DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Migrated");
+ }
}
intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(), deployState,
lockState, StateChangeResult.NO_ERROR, "Restarted");
}
+
+ @Override
+ public void migrate(UUID automationCompositionId, AcElementDeploy element, UUID compositionTargetId,
+ Map<String, Object> properties) throws PfModelException {
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(),
+ DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Migrated");
+ }
}
nodeTemplatesMap.get(KSERVE_AUTOMATION_COMPOSITION_ELEMENT).getProperties(), DeployState.UNDEPLOYING,
LockState.LOCKED));
}
+
+ @Test
+ void testMigrate() throws PfModelException {
+ var automationCompositionId = commonTestData.getAutomationCompositionId();
+ var element = commonTestData.getAutomationCompositionElement();
+ assertDoesNotThrow(() -> automationCompositionElementHandler.migrate(automationCompositionId, element,
+ UUID.randomUUID(), Map.of()));
+ }
}
intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(), deployState,
lockState, StateChangeResult.NO_ERROR, "Restarted");
}
+
+ @Override
+ public void migrate(UUID automationCompositionId, AcElementDeploy element, UUID compositionTargetId,
+ Map<String, Object> properties) throws PfModelException {
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(),
+ DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Migrated");
+ }
}
nodeTemplatesMap.get(K8S_AUTOMATION_COMPOSITION_ELEMENT).getProperties(), DeployState.UNDEPLOYING,
LockState.LOCKED));
}
+
+ @Test
+ void testMigrate() throws PfModelException {
+ var element = CommonTestData.createAcElementDeploy();
+ var automationCompositionId = commonTestData.getAutomationCompositionId();
+ assertDoesNotThrow(() -> automationCompositionElementHandler.migrate(automationCompositionId, element,
+ UUID.randomUUID(), Map.of()));
+ }
}
intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(), deployState,
lockState, StateChangeResult.NO_ERROR, "Restarted");
}
+
+ @Override
+ public void migrate(UUID automationCompositionId, AcElementDeploy element, UUID compositionTargetId,
+ Map<String, Object> properties) throws PfModelException {
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(),
+ DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Migrated");
+ }
}
verify(intermediaryApi).updateAutomationCompositionElementState(AC_ID, automationCompositionElementId,
DeployState.DEPLOYED, LockState.LOCKED, StateChangeResult.NO_ERROR, "Restarted");
}
+
+ @Test
+ void testMigrate() throws Exception {
+ var intermediaryApi = mock(ParticipantIntermediaryApi.class);
+ var handler = new AutomationCompositionElementHandler(mock(PolicyApiHttpClient.class),
+ mock(PolicyPapHttpClient.class), intermediaryApi);
+
+ var acElement = getTestingAcElement();
+ acElement.getToscaServiceTemplateFragment().setToscaTopologyTemplate(null);
+ handler.migrate(AC_ID, acElement, UUID.randomUUID(), Map.of());
+ verify(intermediaryApi).updateAutomationCompositionElementState(AC_ID, automationCompositionElementId,
+ DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Migrated");
+ }
}
intermediaryApi.sendAcDefinitionInfo(compositionId, compositionDefinitionElementId, outProperties);
}
+
+ @Override
+ public void migrate(UUID automationCompositionId, AcElementDeploy element, UUID compositionTargetId,
+ Map<String, Object> properties) throws PfModelException {
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(),
+ DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Migrated");
+ }
}
void handleRestartInstance(UUID automationCompositionId, AcElementDeploy element, Map<String, Object> properties,
DeployState deployState, LockState lockState) throws PfModelException;
+
+ void migrate(UUID instanceId, AcElementDeploy element, UUID compositionTargetId, Map<String, Object> properties)
+ throws PfModelException;
}
public void handleRestartInstance(UUID automationCompositionId, AcElementDeploy element,
Map<String, Object> properties, DeployState deployState, LockState lockState) throws PfModelException {
}
+
+ @Override
+ public void migrate(UUID instanceId, AcElementDeploy element, UUID compositionTargetId,
+ Map<String, Object> properties) throws PfModelException {
+ }
}