From d4e5d3c532f6d71cc3ff79047068ff904972ea42 Mon Sep 17 00:00:00 2001 From: talio Date: Mon, 23 Oct 2017 16:27:16 +0300 Subject: Artifacts in CSAR pack all artifact files under Artifacts/ directory, and not under Artifacts/Artifacts (in import CSAR scenario) Issue - Id : SDC-495 Change-Id: I65299d449ed87a6fb492a802c40e1ab12535453a Signed-off-by: talio --- .../openecomp/core/converter/datatypes/CsarFileTypes.java | 3 ++- .../java/org/openecomp/core/impl/ToscaConverterImpl.java | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'openecomp-be/lib') diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/CsarFileTypes.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/CsarFileTypes.java index 323bd8a5fb..d17f79bb6c 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/CsarFileTypes.java +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/CsarFileTypes.java @@ -5,5 +5,6 @@ public enum CsarFileTypes { globalServiceTemplate, externalFile, toscaMetadata, - definitionsFile,; + definitionsFile, + Artifacts; } diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java index 348739e780..9b694c5207 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java @@ -54,7 +54,8 @@ public class ToscaConverterImpl implements ToscaConverter { break; case externalFile: - artifacts.addFile(fileEntry.getKey(), fileEntry.getValue()); + artifacts.addFile( + getConcreteArtifactFileName(fileEntry.getKey()), fileEntry.getValue()); break; case definitionsFile: @@ -94,6 +95,17 @@ public class ToscaConverterImpl implements ToscaConverter { } } + private String getConcreteArtifactFileName(String fileName){ + int artifactIndex = fileName.indexOf(CsarFileTypes.Artifacts.name()); + if(artifactIndex < 0){ + return fileName; + } + + int artifactDirectoryIndex = + artifactIndex + CsarFileTypes.Artifacts.name().length() + 1; + return fileName.substring(artifactDirectoryIndex); + } + private void updateToscaServiceModel(ToscaServiceModel toscaServiceModel, Map serviceTemplates, FileContentHandler externalFilesHandler, -- cgit 1.2.3-korg