From c64297165be8ea0a07ba762dfcdb156e3f08e956 Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Thu, 26 May 2022 13:53:17 +0100 Subject: Fix operation definition extended format handling Signed-off-by: MichaelMorris Issue-ID: SDC-4024 Change-Id: I95d0b8274c7461120cc04456b5c93a96e9e86329 --- .../components/impl/InterfaceDefinitionHandler.java | 19 ++++++++++++------- .../interfaceDefinition-legacy.yaml | 8 +++++++- 2 files changed, 19 insertions(+), 8 deletions(-) (limited to 'catalog-be') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceDefinitionHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceDefinitionHandler.java index b60e31a513..029c32930e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceDefinitionHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceDefinitionHandler.java @@ -231,7 +231,8 @@ public class InterfaceDefinitionHandler { Map implDetails = (Map) ((Map)operationDefinitionMap.get(IMPLEMENTATION.getElementName())).get("primary"); if (implDetails.get("file") != null) { - artifactDataDefinition.setArtifactName(implDetails.get("file").toString()); + final String file = implDetails.get("file").toString(); + artifactDataDefinition.setArtifactName(generateArtifactName(file)); } if (implDetails.get("type") != null) { artifactDataDefinition.setArtifactType(implDetails.get("type").toString()); @@ -256,16 +257,20 @@ public class InterfaceDefinitionHandler { } } if (operationDefinitionMap.get(IMPLEMENTATION.getElementName()) instanceof String) { - final String artifactName = (String) operationDefinitionMap.get(IMPLEMENTATION.getElementName()); - if (OperationArtifactUtil.artifactNameIsALiteralValue(artifactName)) { - artifactDataDefinition.setArtifactName(artifactName); - } else { - artifactDataDefinition.setArtifactName(QUOTE + artifactName + QUOTE); - } + final String implementation = (String) operationDefinitionMap.get(IMPLEMENTATION.getElementName()); + artifactDataDefinition.setArtifactName(generateArtifactName(implementation)); } return Optional.of(artifactDataDefinition); } + private String generateArtifactName(final String name) { + if (OperationArtifactUtil.artifactNameIsALiteralValue(name)) { + return name; + } else { + return QUOTE + name + QUOTE; + } + } + private ToscaPropertyType getTypeFromObject(final Object value) { if (value instanceof String) { return ToscaPropertyType.STRING; diff --git a/catalog-be/src/test/resources/interfaceDefinition/interfaceDefinition-legacy.yaml b/catalog-be/src/test/resources/interfaceDefinition/interfaceDefinition-legacy.yaml index 2c4c1ec967..49de865f63 100644 --- a/catalog-be/src/test/resources/interfaceDefinition/interfaceDefinition-legacy.yaml +++ b/catalog-be/src/test/resources/interfaceDefinition/interfaceDefinition-legacy.yaml @@ -9,7 +9,13 @@ inputs: type: org.openecomp.resource.datatypes.Action type: tosca.interfaces.node.lifecycle.Standard create: - implementation: "camunda/serviceSelect" + implementation: + primary: + type: tosca.artifacts.asd.deploymentItem + file: camunda/serviceSelect + artifact_version: '1' + properties: + artifact_type: typeA start: implementation: "camunda/executeAction" inputs: -- cgit 1.2.3-korg