import java.util.List;
import java.util.Map;
import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
import org.apache.http.HttpStatus;
+import org.onap.policy.clamp.acm.participant.intermediary.api.CompositionElementDto;
+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.intermediary.api.impl.AcElementListenerV1;
+import org.onap.policy.clamp.acm.participant.intermediary.api.impl.AcElementListenerV2;
import org.onap.policy.clamp.acm.participant.policy.client.PolicyApiHttpClient;
import org.onap.policy.clamp.acm.participant.policy.client.PolicyPapHttpClient;
-import org.onap.policy.clamp.models.acm.concepts.AcElementDeploy;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
import org.onap.policy.clamp.models.acm.concepts.StateChangeResult;
import org.onap.policy.models.base.PfModelException;
* This class handles implementation of automationCompositionElement updates.
*/
@Component
-public class AutomationCompositionElementHandler extends AcElementListenerV1 {
+public class AutomationCompositionElementHandler extends AcElementListenerV2 {
private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionElementHandler.class);
- private final Map<UUID, ToscaServiceTemplate> serviceTemplateMap = new ConcurrentHashMap<>();
-
private final PolicyApiHttpClient apiHttpClient;
private final PolicyPapHttpClient papHttpClient;
/**
* Callback method to handle a automation composition element state change.
*
- * @param automationCompositionId the ID of the automation composition
- * @param automationCompositionElementId the ID of the automation composition element
+ * @param compositionElement the information of the Automation Composition Definition Element
+ * @param instanceElement the information of the Automation Composition Instance Element
+ * @throws PfModelException in case of a model exception
*/
@Override
- public void undeploy(UUID automationCompositionId, UUID automationCompositionElementId) throws PfModelException {
- var automationCompositionDefinition = serviceTemplateMap.get(automationCompositionElementId);
- if (automationCompositionDefinition == null) {
- LOGGER.debug("No policies to undeploy to {}", automationCompositionElementId);
- intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
- automationCompositionElementId, DeployState.UNDEPLOYED, null, StateChangeResult.NO_ERROR,
+ public void undeploy(CompositionElementDto compositionElement, InstanceElementDto instanceElement)
+ throws PfModelException {
+ var automationCompositionDefinition = instanceElement.toscaServiceTemplateFragment();
+ if (automationCompositionDefinition.getToscaTopologyTemplate() == null) {
+ LOGGER.debug("No policies to undeploy to {}", instanceElement.elementId());
+ intermediaryApi.updateAutomationCompositionElementState(instanceElement.instanceId(),
+ instanceElement.elementId(), DeployState.UNDEPLOYED, null, StateChangeResult.NO_ERROR,
"Undeployed");
return;
}
var policyList = getPolicyList(automationCompositionDefinition);
- undeployPolicies(policyList, automationCompositionElementId);
+ undeployPolicies(policyList, instanceElement.elementId());
var policyTypeList = getPolicyTypeList(automationCompositionDefinition);
deletePolicyData(policyTypeList, policyList);
- serviceTemplateMap.remove(automationCompositionElementId);
- intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, automationCompositionElementId,
- DeployState.UNDEPLOYED, null, StateChangeResult.NO_ERROR, "Undeployed");
+ intermediaryApi.updateAutomationCompositionElementState(instanceElement.instanceId(),
+ instanceElement.elementId(), DeployState.UNDEPLOYED, null, StateChangeResult.NO_ERROR,
+ "Undeployed");
}
private void deletePolicyData(List<ToscaConceptIdentifier> policyTypeList,
/**
* Callback method to handle an update on automation composition element.
*
- * @param automationCompositionId the automationComposition Id
- * @param element the information on the automation composition element
- * @param properties properties Map
- * @throws PfModelException in case of an exception
+ * @param compositionElement the information of the Automation Composition Definition Element
+ * @param instanceElement the information of the Automation Composition Instance Element
+ * @throws PfModelException from Policy framework
*/
@Override
- public void deploy(UUID automationCompositionId, AcElementDeploy element, Map<String, Object> properties)
+ public void deploy(CompositionElementDto compositionElement, InstanceElementDto instanceElement)
throws PfModelException {
var createPolicyTypeResp = HttpStatus.SC_OK;
var createPolicyResp = HttpStatus.SC_OK;
- var automationCompositionDefinition = element.getToscaServiceTemplateFragment();
+ var automationCompositionDefinition = instanceElement.toscaServiceTemplateFragment();
if (automationCompositionDefinition.getToscaTopologyTemplate() == null) {
- intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(),
- DeployState.UNDEPLOYED, null, StateChangeResult.FAILED, "ToscaTopologyTemplate not defined");
+ intermediaryApi.updateAutomationCompositionElementState(instanceElement.instanceId(),
+ instanceElement.elementId(), DeployState.UNDEPLOYED, null, StateChangeResult.FAILED,
+ "ToscaTopologyTemplate not defined");
return;
}
- serviceTemplateMap.put(element.getId(), automationCompositionDefinition);
if (automationCompositionDefinition.getPolicyTypes() != null) {
LOGGER.info("Found Policy Types in automation composition definition: {} , Creating Policy Types",
automationCompositionDefinition.getName());
if (createPolicyTypeResp == HttpStatus.SC_OK && createPolicyResp == HttpStatus.SC_OK) {
LOGGER.info(
"PolicyTypes/Policies for the automation composition element : {} are created " + "successfully",
- element.getId());
+ instanceElement.elementId());
var policyList = getPolicyList(automationCompositionDefinition);
- deployPolicies(policyList, automationCompositionId, element.getId());
+ deployPolicies(policyList, instanceElement.instanceId(), instanceElement.elementId());
} else {
- intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(),
- DeployState.UNDEPLOYED, null, StateChangeResult.FAILED,
+ intermediaryApi.updateAutomationCompositionElementState(instanceElement.instanceId(),
+ instanceElement.elementId(), DeployState.UNDEPLOYED, null, StateChangeResult.FAILED,
"Creation of PolicyTypes/Policies failed. Policies will not be deployed.");
}
}
import java.util.Map;
import java.util.UUID;
import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.acm.participant.intermediary.api.CompositionElementDto;
+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.policy.client.PolicyApiHttpClient;
import org.onap.policy.clamp.acm.participant.policy.client.PolicyPapHttpClient;
-import org.onap.policy.clamp.models.acm.concepts.AcElementDeploy;
-import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
-import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.clamp.models.acm.concepts.StateChangeResult;
-import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
class AutomationCompositionElementHandlerTest {
- private static final String ID_NAME = "org.onap.PM_CDS_Blueprint";
- private static final String ID_VERSION = "1.0.1";
- private static final UUID automationCompositionElementId = UUID.randomUUID();
- public static final UUID AC_ID = UUID.randomUUID();
- private static final ToscaConceptIdentifier DEFINITION = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
+ private static final ToscaConceptIdentifier DEFINITION =
+ new ToscaConceptIdentifier("1.0.1", "org.onap.PM_CDS_Blueprint");
@Test
void testHandlerUndeployNoPolicy() throws PfModelException {
var handler = new AutomationCompositionElementHandler(mock(PolicyApiHttpClient.class),
mock(PolicyPapHttpClient.class), intermediaryApi);
- handler.undeploy(AC_ID, automationCompositionElementId);
- verify(intermediaryApi).updateAutomationCompositionElementState(AC_ID, automationCompositionElementId,
- DeployState.UNDEPLOYED, null, StateChangeResult.NO_ERROR, "Undeployed");
+ var compositionElement = getCompositionElement();
+ var instanceElement = getInstanceElementWithNullTopology();
+
+ handler.undeploy(compositionElement, instanceElement);
+ verify(intermediaryApi).updateAutomationCompositionElementState(instanceElement.instanceId(),
+ instanceElement.elementId(), DeployState.UNDEPLOYED, null, StateChangeResult.NO_ERROR,
+ "Undeployed");
+ }
+
+ private CompositionElementDto getCompositionElement() {
+ return new CompositionElementDto(UUID.randomUUID(), DEFINITION, Map.of(), Map.of());
}
- private AcElementDeploy getTestingAcElement() {
- var element = new AcElementDeploy();
- element.setDefinition(DEFINITION);
- element.setId(automationCompositionElementId);
- element.setOrderedState(DeployOrder.DEPLOY);
+ private InstanceElementDto getInstanceElement() {
var template = new ToscaServiceTemplate();
template.setToscaTopologyTemplate(new ToscaTopologyTemplate());
template.getToscaTopologyTemplate().setPolicies(List.of(Map.of("DummyPolicy", new ToscaPolicy())));
template.setPolicyTypes(Map.of("dummy policy type", new ToscaPolicyType()));
- element.setToscaServiceTemplateFragment(template);
- return element;
+ return new InstanceElementDto(UUID.randomUUID(), UUID.randomUUID(), template, Map.of(), Map.of());
}
@Test
var intermediaryApi = mock(ParticipantIntermediaryApi.class);
var handler = new AutomationCompositionElementHandler(api, pap, intermediaryApi);
- handler.deploy(AC_ID, getTestingAcElement(), Map.of());
- verify(intermediaryApi).updateAutomationCompositionElementState(AC_ID, automationCompositionElementId,
- DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Deployed");
+ var compositionElement = getCompositionElement();
+ var instanceElement = getInstanceElement();
+
+ handler.deploy(compositionElement, instanceElement);
+ verify(intermediaryApi).updateAutomationCompositionElementState(instanceElement.instanceId(),
+ instanceElement.elementId(), DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR,
+ "Deployed");
- handler.undeploy(AC_ID, automationCompositionElementId);
- verify(intermediaryApi).updateAutomationCompositionElementState(AC_ID, automationCompositionElementId,
- DeployState.UNDEPLOYED, null, StateChangeResult.NO_ERROR, "Undeployed");
+ handler.undeploy(compositionElement, instanceElement);
+ verify(intermediaryApi).updateAutomationCompositionElementState(instanceElement.instanceId(),
+ instanceElement.elementId(), DeployState.UNDEPLOYED, null, StateChangeResult.NO_ERROR,
+ "Undeployed");
}
@Test
var handler = new AutomationCompositionElementHandler(mock(PolicyApiHttpClient.class),
mock(PolicyPapHttpClient.class), intermediaryApi);
- var acElement = getTestingAcElement();
- acElement.getToscaServiceTemplateFragment().setToscaTopologyTemplate(null);
- handler.deploy(AC_ID, acElement, Map.of());
- verify(intermediaryApi).updateAutomationCompositionElementState(AC_ID, automationCompositionElementId,
- DeployState.UNDEPLOYED, null, StateChangeResult.FAILED, "ToscaTopologyTemplate not defined");
+ var compositionElement = getCompositionElement();
+ var instanceElement = getInstanceElementWithNullTopology();
+ handler.deploy(compositionElement, instanceElement);
+ verify(intermediaryApi).updateAutomationCompositionElementState(instanceElement.instanceId(),
+ instanceElement.elementId(), DeployState.UNDEPLOYED, null, StateChangeResult.FAILED,
+ "ToscaTopologyTemplate not defined");
+ }
+
+ private InstanceElementDto getInstanceElementWithNullTopology() {
+ var template = new ToscaServiceTemplate();
+ template.setToscaTopologyTemplate(null);
+ return new InstanceElementDto(UUID.randomUUID(), UUID.randomUUID(), template, Map.of(), Map.of());
}
@Test
var intermediaryApi = mock(ParticipantIntermediaryApi.class);
var handler = new AutomationCompositionElementHandler(api, pap, intermediaryApi);
- var element = getTestingAcElement();
+ var compositionElement = getCompositionElement();
+ var instanceElement = getInstanceElement();
// Mock failure in policy type creation
- handler.deploy(AC_ID, element, Map.of());
- verify(intermediaryApi).updateAutomationCompositionElementState(AC_ID, automationCompositionElementId,
- DeployState.UNDEPLOYED, null, StateChangeResult.FAILED,
+ handler.deploy(compositionElement, instanceElement);
+ verify(intermediaryApi).updateAutomationCompositionElementState(instanceElement.instanceId(),
+ instanceElement.elementId(), DeployState.UNDEPLOYED, null, StateChangeResult.FAILED,
"Creation of PolicyTypes/Policies failed. Policies will not be deployed.");
}
var intermediaryApi = mock(ParticipantIntermediaryApi.class);
var handler = new AutomationCompositionElementHandler(api, pap, intermediaryApi);
- var element = getTestingAcElement();
- assertThatThrownBy(() -> handler.deploy(AC_ID, element, Map.of()))
+ var compositionElement = getCompositionElement();
+ var instanceElement = getInstanceElement();
+ assertThatThrownBy(() -> handler.deploy(compositionElement, instanceElement))
.hasMessageMatching("Deploy of Policy failed.");
}
-
- @Test
- void testUpdate() 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.update(AC_ID, acElement, Map.of());
- verify(intermediaryApi).updateAutomationCompositionElementState(AC_ID, automationCompositionElementId,
- DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Update not supported");
- }
-
- @Test
- void testLock() throws Exception {
- var intermediaryApi = mock(ParticipantIntermediaryApi.class);
- var handler = new AutomationCompositionElementHandler(mock(PolicyApiHttpClient.class),
- mock(PolicyPapHttpClient.class), intermediaryApi);
-
- handler.lock(AC_ID, automationCompositionElementId);
- verify(intermediaryApi).updateAutomationCompositionElementState(AC_ID, automationCompositionElementId, null,
- LockState.LOCKED, StateChangeResult.NO_ERROR, "Locked");
- }
-
- @Test
- void testUnlock() throws Exception {
- var intermediaryApi = mock(ParticipantIntermediaryApi.class);
- var handler = new AutomationCompositionElementHandler(mock(PolicyApiHttpClient.class),
- mock(PolicyPapHttpClient.class), intermediaryApi);
-
- handler.unlock(AC_ID, automationCompositionElementId);
- verify(intermediaryApi).updateAutomationCompositionElementState(AC_ID, automationCompositionElementId, null,
- LockState.UNLOCKED, StateChangeResult.NO_ERROR, "Unlocked");
- }
-
- @Test
- void testDelete() throws Exception {
- var intermediaryApi = mock(ParticipantIntermediaryApi.class);
- var handler = new AutomationCompositionElementHandler(mock(PolicyApiHttpClient.class),
- mock(PolicyPapHttpClient.class), intermediaryApi);
-
- handler.delete(AC_ID, automationCompositionElementId);
- verify(intermediaryApi).updateAutomationCompositionElementState(AC_ID, automationCompositionElementId,
- DeployState.DELETED, null, StateChangeResult.NO_ERROR, "Deleted");
- }
-
- @Test
- void testPrime() throws Exception {
- var intermediaryApi = mock(ParticipantIntermediaryApi.class);
- var handler = new AutomationCompositionElementHandler(mock(PolicyApiHttpClient.class),
- mock(PolicyPapHttpClient.class), intermediaryApi);
-
- handler.prime(AC_ID, List.of());
- verify(intermediaryApi).updateCompositionState(AC_ID, AcTypeState.PRIMED, StateChangeResult.NO_ERROR, "Primed");
- }
-
- @Test
- void testDeprime() throws Exception {
- var intermediaryApi = mock(ParticipantIntermediaryApi.class);
- var handler = new AutomationCompositionElementHandler(mock(PolicyApiHttpClient.class),
- mock(PolicyPapHttpClient.class), intermediaryApi);
-
- handler.deprime(AC_ID);
- verify(intermediaryApi).updateCompositionState(AC_ID, AcTypeState.COMMISSIONED, StateChangeResult.NO_ERROR,
- "Deprimed");
- }
-
- @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");
- }
}
private void handleLockState(UUID messageId, final AutomationComposition automationComposition,
Integer startPhaseMsg) {
+ automationComposition.setLockState(LockState.LOCKING);
+ var serviceTemplateFragment = cacheProvider
+ .getServiceTemplateFragmentMap().get(automationComposition.getCompositionId());
for (var element : automationComposition.getElements().values()) {
var compositionInProperties = cacheProvider
.getCommonProperties(automationComposition.getCompositionId(), element.getDefinition());
var compositionElement = cacheProvider.createCompositionElementDto(
automationComposition.getCompositionId(), element, compositionInProperties);
var instanceElement = new InstanceElementDto(automationComposition.getInstanceId(), element.getId(),
- null, element.getProperties(), element.getOutProperties());
+ serviceTemplateFragment, element.getProperties(), element.getOutProperties());
listener.lock(messageId, compositionElement, instanceElement);
}
}
private void handleUnlockState(UUID messageId, final AutomationComposition automationComposition,
Integer startPhaseMsg) {
+ automationComposition.setLockState(LockState.UNLOCKING);
+ var serviceTemplateFragment = cacheProvider
+ .getServiceTemplateFragmentMap().get(automationComposition.getCompositionId());
for (var element : automationComposition.getElements().values()) {
var compositionInProperties = cacheProvider
.getCommonProperties(automationComposition.getCompositionId(), element.getDefinition());
var compositionElement = cacheProvider.createCompositionElementDto(
automationComposition.getCompositionId(), element, compositionInProperties);
var instanceElement = new InstanceElementDto(automationComposition.getInstanceId(), element.getId(),
- null, element.getProperties(), element.getOutProperties());
+ serviceTemplateFragment, element.getProperties(), element.getOutProperties());
listener.unlock(messageId, compositionElement, instanceElement);
}
}
private final ParticipantMessagePublisher publisher;
private final ThreadHandler listener;
-
/**
* Handle a automation composition state change message.
*
for (var participantDeploy : updateMsg.getParticipantUpdatesList()) {
if (cacheProvider.getParticipantId().equals(participantDeploy.getParticipantId())) {
-
- var acCopy = new AutomationComposition(cacheProvider.getAutomationComposition(
- updateMsg.getAutomationCompositionId()));
+ var automationComposition = cacheProvider.getAutomationComposition(
+ updateMsg.getAutomationCompositionId());
+ automationComposition.setDeployState(DeployState.UPDATING);
+ var acCopy = new AutomationComposition(automationComposition);
updateExistingElementsOnThisParticipant(updateMsg.getAutomationCompositionId(), participantDeploy,
DeployState.UPDATING);
private void callParticipanDeploy(UUID messageId, List<AcElementDeploy> acElementDeployList,
Integer startPhaseMsg, UUID instanceId) {
var automationComposition = cacheProvider.getAutomationComposition(instanceId);
+ automationComposition.setDeployState(DeployState.DEPLOYING);
for (var elementDeploy : acElementDeployList) {
var element = automationComposition.getElements().get(elementDeploy.getId());
var compositionInProperties = cacheProvider
private Map<UUID, InstanceElementDto> getInstanceElementDtoMap(AutomationComposition automationComposition) {
Map<UUID, InstanceElementDto> map = new HashMap<>();
+ var serviceTemplateFragment = cacheProvider
+ .getServiceTemplateFragmentMap().get(automationComposition.getCompositionId());
for (var element : automationComposition.getElements().values()) {
var instanceElement = new InstanceElementDto(automationComposition.getInstanceId(), element.getId(),
- null, element.getProperties(), element.getOutProperties());
+ serviceTemplateFragment, element.getProperties(), element.getOutProperties());
map.put(element.getId(), instanceElement);
}
return map;
private void handleUndeployState(UUID messageId, final AutomationComposition automationComposition,
Integer startPhaseMsg) {
automationComposition.setCompositionTargetId(null);
+ automationComposition.setDeployState(DeployState.UNDEPLOYING);
+ var serviceTemplateFragment = cacheProvider
+ .getServiceTemplateFragmentMap().get(automationComposition.getCompositionId());
for (var element : automationComposition.getElements().values()) {
var compositionInProperties = cacheProvider
.getCommonProperties(automationComposition.getCompositionId(), element.getDefinition());
var compositionElement = cacheProvider.createCompositionElementDto(
automationComposition.getCompositionId(), element, compositionInProperties);
var instanceElement = new InstanceElementDto(automationComposition.getInstanceId(), element.getId(),
- null, element.getProperties(), element.getOutProperties());
+ serviceTemplateFragment, element.getProperties(), element.getOutProperties());
listener.undeploy(messageId, compositionElement, instanceElement);
}
}
private void handleDeleteState(UUID messageId, final AutomationComposition automationComposition,
Integer startPhaseMsg) {
+ automationComposition.setDeployState(DeployState.DELETING);
+ var serviceTemplateFragment = cacheProvider
+ .getServiceTemplateFragmentMap().get(automationComposition.getCompositionId());
for (var element : automationComposition.getElements().values()) {
var compositionInProperties = cacheProvider
.getCommonProperties(automationComposition.getCompositionId(), element.getDefinition());
var compositionElement = cacheProvider.createCompositionElementDto(
automationComposition.getCompositionId(), element, compositionInProperties);
var instanceElement = new InstanceElementDto(automationComposition.getInstanceId(), element.getId(),
- null, element.getProperties(), element.getOutProperties());
+ serviceTemplateFragment, element.getProperties(), element.getOutProperties());
listener.delete(messageId, compositionElement, instanceElement);
}
}
}
var acCopy = new AutomationComposition(automationComposition);
automationComposition.setCompositionTargetId(migrationMsg.getCompositionTargetId());
+ automationComposition.setDeployState(DeployState.MIGRATING);
for (var participantDeploy : migrationMsg.getParticipantUpdatesList()) {
if (cacheProvider.getParticipantId().equals(participantDeploy.getParticipantId())) {
import org.onap.policy.clamp.models.acm.concepts.ParticipantSupportedElementType;
import org.onap.policy.models.base.PfUtils;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.springframework.stereotype.Component;
@Component
@Getter
private final Map<UUID, UUID> msgIdentification = new ConcurrentHashMap<>();
+ @Getter
+ private final Map<UUID, ToscaServiceTemplate> serviceTemplateFragmentMap = new ConcurrentHashMap<>();
+
/**
* Constructor.
*
public void removeElementDefinition(@NonNull UUID compositionId) {
acElementsDefinitions.remove(compositionId);
+ serviceTemplateFragmentMap.remove(compositionId);
}
/**
acElement.setOutProperties(acElementLast.getOutProperties());
acElement.setOperationalState(acElementLast.getOperationalState());
acElement.setUseState(acElementLast.getUseState());
+ if (element.getToscaServiceTemplateFragment() != null) {
+ serviceTemplateFragmentMap.put(compositionId, element.getToscaServiceTemplateFragment());
+ }
}
acElementMap.put(element.getId(), acElement);
}
acElement.setProperties(element.getProperties());
acElement.setOutProperties(element.getOutProperties());
acElementMap.put(element.getId(), acElement);
+ if (element.getToscaServiceTemplateFragment() != null) {
+ serviceTemplateFragmentMap.put(compositionId, element.getToscaServiceTemplateFragment());
+ }
}
var automationComposition = new AutomationComposition();
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
/**
* Class to hold/create all parameters for test cases.
acElementRestart.setUseState("UseState");
acElementRestart.setProperties(Map.of("key", "value"));
acElementRestart.setOutProperties(Map.of("keyOut", "valueOut"));
+ acElementRestart.setToscaServiceTemplateFragment(new ToscaServiceTemplate());
acElementRestart.setId(UUID.randomUUID());
participantRestartAc.getAcElementList().add(acElementRestart);
return participantRestartAc;
acElement.setId(element.getId());
acElement.setDefinition(element.getDefinition());
acElement.setProperties(element.getProperties());
+ acElement.setToscaServiceTemplateFragment(new ToscaServiceTemplate());
participantDeploy.getAcElementList().add(acElement);
}
return participantDeploy;