summaryrefslogtreecommitdiffstats
path: root/sdc-distribution-ci/src/main
diff options
context:
space:
mode:
authorPavel Aharoni <pa0916@att.com>2017-05-25 20:29:43 +0300
committerPavel Aharoni <pa0916@att.com>2017-05-25 20:29:43 +0300
commit2aed5c9968c48f665b85569333aa61011e611321 (patch)
tree89d369125093e7d621d795808679234f954f5c0f /sdc-distribution-ci/src/main
parent9e430cd9d4722c3e614c8a2fd822cff1604be1f2 (diff)
[SDC-24] sdnc problems
Change-Id: I5bb5fd91ae1daf73fdf63cf8108531295bb8e96d Signed-off-by: Pavel Aharoni <pa0916@att.com>
Diffstat (limited to 'sdc-distribution-ci/src/main')
-rw-r--r--sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java42
-rw-r--r--sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java2
2 files changed, 38 insertions, 6 deletions
diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java b/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java
index 1166109..c5cce09 100644
--- a/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java
+++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java
@@ -26,8 +26,11 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.stream.Collectors;
+import org.json.JSONArray;
+import org.json.JSONObject;
import org.openecomp.sdc.api.IDistributionClient;
import org.openecomp.sdc.api.consumer.IDistributionStatusMessage;
import org.openecomp.sdc.api.consumer.INotificationCallback;
@@ -157,7 +160,7 @@ public class SimpleCallback implements INotificationCallback {
if (downloadResult.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS) {
- handleSuccessfullDownload(data, relevantArtifact);
+ handleSuccessfullDownload(data, relevantArtifact, downloadResult.getArtifactPayload());
} else {
handleFailedDownload(data, relevantArtifact);
}
@@ -207,7 +210,7 @@ public class SimpleCallback implements INotificationCallback {
postDownloadStatusSendLogic(sendDownloadStatus);
}
- private void handleSuccessfullDownload(INotificationData data, IArtifactInfo relevantArtifact) {
+ private void handleSuccessfullDownload(INotificationData data, IArtifactInfo relevantArtifact, byte[] payload) {
// Send Download Status
IDistributionClientResult sendDownloadStatus = client.sendDownloadStatus(buildStatusMessage(client, data, relevantArtifact, DistributionStatusEnum.DOWNLOAD_OK));
@@ -216,7 +219,7 @@ public class SimpleCallback implements INotificationCallback {
// Doing deployment ...
postDownloadStatusSendLogic(sendDownloadStatus);
- boolean isDeployedSuccessfully = handleDeployment();
+ boolean isDeployedSuccessfully = handleDeployment(data, relevantArtifact, payload);
IDistributionClientResult deploymentStatus;
try {
Thread.sleep(1000);
@@ -269,8 +272,37 @@ public class SimpleCallback implements INotificationCallback {
return false;
}
- private boolean handleDeployment() {
- return true;
+ private boolean handleDeployment(INotificationData data, IArtifactInfo relevantArtifact, byte[] payload) {
+ if (relevantArtifact.getArtifactType().equals(ArtifactTypeEnum.VF_MODULES_METADATA.name())) {
+
+ try {
+ List<IArtifactInfo> serviceArtifacts = data.getServiceArtifacts();
+ JSONArray jsonData = new JSONArray(new String(payload));
+ boolean artifactIsFound = true;
+ for (int index = 0 ; index < jsonData.length(); index++) {
+
+ JSONObject jsonObject = (JSONObject) jsonData.get(index);
+ JSONArray artifacts = (JSONArray) jsonObject.get("artifacts");
+ for (int i = 0 ; i < artifacts.length(); i++) {
+ String artifact = artifacts.getString(i).toString();
+ Optional<IArtifactInfo> serviceArtifactFound = serviceArtifacts.stream().filter(x -> x.getArtifactUUID().equals(artifact)).findFirst();
+ if (!serviceArtifactFound.isPresent()) {
+ artifactIsFound = false;
+ System.out.println("################ Artifact: " + artifact + " NOT FOUND in Notification Data ################");
+ }
+ }
+ }
+ return artifactIsFound;
+
+ } catch (Exception e) {
+ System.out.println("################ Couldn't convert vf_modules_metadata.json to json : " + e.getMessage());
+ return false;
+ }
+ }
+ else {
+ return true;
+ }
+
// to return deploy_error use return false
// return false;
}
diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java b/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java
index 9c07c12..115bfab 100644
--- a/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java
+++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java
@@ -150,7 +150,7 @@ public class SimpleConfiguration implements IConfiguration{
}
public static Boolean toDownload() {
- return false;
+ return true;
}
public static String downloadPath() {