package org.onap.so.asdc.client;
+import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
+ artifact.getArtifactUUID ()
+ ")");
+ String filePath = System.getProperty("mso.config.path") + "/ASDC" + "/" + artifact.getArtifactVersion() + "/" + artifact.getArtifactName();
+ // make parent directory
+ File file = new File(filePath);
+ File fileParent = file.getParentFile();
+ if (!fileParent.exists()) {
+ fileParent.mkdirs();
+ }
+
byte[] payloadBytes = resultArtifact.getArtifactPayload();
- try (FileOutputStream outFile = new FileOutputStream(System.getProperty("mso.config.path") + "/ASDC" + "/" + artifact.getArtifactName())) {
+ try (FileOutputStream outFile = new FileOutputStream(filePath)) {
LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***WRITE FILE ARTIFACT NAME", "ASDC", artifact.getArtifactName());
outFile.write(payloadBytes, 0, payloadBytes.length);
outFile.close();
LOGGER.debug("MSO config path is: " + System.getProperty("mso.config.path"));
- File spoolFile = new File(System.getProperty("mso.config.path") + "/ASDC/" + artifact.getArtifactName());
+ String filePath = System.getProperty("mso.config.path") + "/ASDC/" + artifact.getArtifactVersion() + "/" + artifact.getArtifactName();
+
+ File spoolFile = new File(filePath);
LOGGER.debug("ASDC File path is: " + spoolFile.getAbsolutePath());
LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***PATH", "ASDC", spoolFile.getAbsolutePath());
HashMap<String, String> map = new Gson().fromJson(value, new TypeToken<HashMap<String, String>>() {}.getType());
- File csarFile = new File(System.getProperty("mso.config.path") + "ASDC/" + map.get("name"));
+ String filePath = System.getProperty("mso.config.path") + "ASDC/" + map.get("version") + "/" + map.get("name");
+
+ File csarFile = new File(filePath);
if(!csarFile.exists()) {
throw new Exception("csar file does not exist.");