Merge "Artifacts in CSAR" into release-1.1.0
authorAvi Gaffa <avi.gaffa@amdocs.com>
Tue, 24 Oct 2017 08:08:47 +0000 (08:08 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 24 Oct 2017 08:08:47 +0000 (08:08 +0000)
openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/CsarFileTypes.java
openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java

index f38d7f2..55f92aa 100644 (file)
@@ -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<String, ServiceTemplate> serviceTemplates,
                                          FileContentHandler externalFilesHandler,