From 28e7f0f13e3d7b75750a449c9bda6c0d4a1986ce Mon Sep 17 00:00:00 2001 From: franciscovila Date: Tue, 15 Mar 2022 08:29:04 +0000 Subject: Copy entry_defintion_type to TOSCA.meta Copy "entry_defintion_type" from the manifest file of ASD package into the generated TOSCA.meta for the VSP package Issue-ID: SDC-3884 Signed-off-by: franciscovila Change-Id: I35c4d0180529e8c60edc714aecadd0150cbd2c03 --- .../sdc/translator/services/heattotosca/TranslationService.java | 4 +++- .../impl/functiontranslation/FunctionTranslationGetFileImpl.java | 4 +++- .../ResourceTranslationContrailServiceInstanceImpl.java | 4 +++- .../impl/functiontranslation/FunctionTranslationGetFileImplTest.java | 4 +++- .../heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java | 4 +++- .../impl/resourcetranslation/BaseResourceTranslationTest.java | 4 +++- 6 files changed, 18 insertions(+), 6 deletions(-) (limited to 'openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src') diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/TranslationService.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/TranslationService.java index 0547ec730b..97b572235c 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/TranslationService.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/TranslationService.java @@ -42,6 +42,8 @@ import org.openecomp.sdc.heat.datatypes.model.Output; import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; +import org.openecomp.sdc.tosca.csar.AsdPackageHelper; +import org.openecomp.sdc.tosca.csar.ManifestUtils; import org.openecomp.sdc.tosca.datatypes.ToscaGroupType; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.tosca.services.DataModelUtil; @@ -181,7 +183,7 @@ public class TranslationService { private void createHeatStackGroup(ServiceTemplate serviceTemplate, FileData heatFileData, HeatOrchestrationTemplate heatOrchestrationTemplate, TranslationContext context) { - ToscaFileOutputService toscaFileOutputService = new ToscaFileOutputServiceCsarImpl(); + ToscaFileOutputService toscaFileOutputService = new ToscaFileOutputServiceCsarImpl(new AsdPackageHelper(new ManifestUtils())); final String fileName = heatFileData.getFile(); final String heatStackGroupId = FileUtils.getFileWithoutExtention(fileName) + "_group"; GroupDefinition groupDefinition = new GroupDefinition(); diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetFileImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetFileImpl.java index 253410e493..6606d0cf25 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetFileImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetFileImpl.java @@ -21,6 +21,8 @@ import java.util.List; import java.util.Map; import org.onap.sdc.tosca.datatypes.model.ArtifactDefinition; import org.onap.sdc.tosca.datatypes.model.NodeTemplate; +import org.openecomp.sdc.tosca.csar.AsdPackageHelper; +import org.openecomp.sdc.tosca.csar.ManifestUtils; import org.openecomp.sdc.tosca.datatypes.ToscaArtifactType; import org.openecomp.sdc.tosca.datatypes.ToscaFunctions; import org.openecomp.sdc.tosca.services.ToscaConstants; @@ -46,7 +48,7 @@ public class FunctionTranslationGetFileImpl implements FunctionTranslation { artifactParameters.add(ToscaConstants.MODELABLE_ENTITY_NAME_SELF); returnValue.put(ToscaFunctions.GET_ARTIFACT.getFunctionName(), artifactParameters); artifactParameters.add(artifactId); - ToscaFileOutputService toscaFileOutputService = new ToscaFileOutputServiceCsarImpl(); + ToscaFileOutputService toscaFileOutputService = new ToscaFileOutputServiceCsarImpl(new AsdPackageHelper(new ManifestUtils())); if (functionTranslator.getToscaTemplate() instanceof NodeTemplate) { NodeTemplate nodeTemplate = (NodeTemplate) functionTranslator.getToscaTemplate(); ArtifactDefinition artifactDefinition = createArtifactDefinition(file, toscaFileOutputService); diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailServiceInstanceImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailServiceInstanceImpl.java index d4ee120fb8..e3f28f6fdc 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailServiceInstanceImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailServiceInstanceImpl.java @@ -50,6 +50,8 @@ import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.heat.services.HeatConstants; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; +import org.openecomp.sdc.tosca.csar.AsdPackageHelper; +import org.openecomp.sdc.tosca.csar.ManifestUtils; import org.openecomp.sdc.tosca.datatypes.ToscaCapabilityType; import org.openecomp.sdc.tosca.datatypes.ToscaFunctions; import org.openecomp.sdc.tosca.datatypes.ToscaGroupType; @@ -418,7 +420,7 @@ public class ResourceTranslationContrailServiceInstanceImpl extends ResourceTran serviceInstanceGroupDefinition.setType(ToscaGroupType.HEAT_STACK); Map groupProperties = new HashMap<>(); groupProperties - .put("heat_file", "../" + (new ToscaFileOutputServiceCsarImpl()).getArtifactsFolderName() + "/" + translateTo.getHeatFileName()); + .put("heat_file", "../" + (new ToscaFileOutputServiceCsarImpl(new AsdPackageHelper(new ManifestUtils()))).getArtifactsFolderName() + "/" + translateTo.getHeatFileName()); serviceInstanceGroupDefinition.setProperties(groupProperties); serviceInstanceGroupDefinition.setMembers(new ArrayList<>()); String heatStackGroupKey = translateTo.getTranslatedId() + "_group"; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetFileImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetFileImplTest.java index 57115764aa..847a88cb08 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetFileImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetFileImplTest.java @@ -21,6 +21,8 @@ import org.junit.Test; import org.onap.sdc.tosca.datatypes.model.NodeTemplate; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate; +import org.openecomp.sdc.tosca.csar.AsdPackageHelper; +import org.openecomp.sdc.tosca.csar.ManifestUtils; import org.openecomp.sdc.tosca.services.ToscaConstants; import org.openecomp.sdc.tosca.services.ToscaFileOutputService; import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl; @@ -81,7 +83,7 @@ public class FunctionTranslationGetFileImplTest { Assert.assertNotNull(nodeTemplate.getArtifacts()); Assert.assertNotNull( nodeTemplate.getArtifacts().get(FileUtils.getFileWithoutExtention((String) function))); - ToscaFileOutputService toscaFileOutputService = new ToscaFileOutputServiceCsarImpl(); + ToscaFileOutputService toscaFileOutputService = new ToscaFileOutputServiceCsarImpl(new AsdPackageHelper(new ManifestUtils())); Assert.assertEquals( nodeTemplate.getArtifacts().get(FileUtils.getFileWithoutExtention((String) function)) .getFile(), "../" + toscaFileOutputService.getArtifactsFolderName() + "/" + function); diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java index 31dbb21a4c..fded190868 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java @@ -43,6 +43,8 @@ import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.datatypes.error.ErrorLevel; +import org.openecomp.sdc.tosca.csar.AsdPackageHelper; +import org.openecomp.sdc.tosca.csar.ManifestUtils; import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl; import org.openecomp.sdc.translator.TestUtils; import org.togglz.testing.TestFeatureManager; @@ -111,7 +113,7 @@ public class BaseFullTranslationTest { .build()); } - return new ToscaFileOutputServiceCsarImpl().createOutputFile(translatorOutput.getToscaServiceModel(), null); + return new ToscaFileOutputServiceCsarImpl(new AsdPackageHelper(new ManifestUtils())).createOutputFile(translatorOutput.getToscaServiceModel(), null); } } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java index 42f4cfdfd5..60717bf0b9 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java @@ -60,6 +60,8 @@ import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.heat.datatypes.manifest.FileData; import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent; import org.openecomp.sdc.heat.datatypes.manifest.ManifestFile; +import org.openecomp.sdc.tosca.csar.AsdPackageHelper; +import org.openecomp.sdc.tosca.csar.ManifestUtils; import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl; import org.openecomp.sdc.translator.TestUtils; import org.openecomp.sdc.translator.datatypes.heattotosca.TranslationContext; @@ -144,7 +146,7 @@ public class BaseResourceTranslationTest { .build()); } - return new ToscaFileOutputServiceCsarImpl().createOutputFile(translatorOutput.getToscaServiceModel(), null); + return new ToscaFileOutputServiceCsarImpl(new AsdPackageHelper(new ManifestUtils())).createOutputFile(translatorOutput.getToscaServiceModel(), null); } -- cgit 1.2.3-korg