diff options
author | 2018-11-16 14:37:34 +0530 | |
---|---|---|
committer | 2018-11-16 14:37:34 +0530 | |
commit | 42f69562851f7eb7041cf37592436477d3703fe2 (patch) | |
tree | 05f51b480073cea46246365dd7a5422b1567e91f /vnfmarket-be/vnf-sdk-marketplace/src/main/java | |
parent | 4d09555dafdda0c80a3db07ae65a376e384321e2 (diff) |
Add criteria to vnftest run resultcasablanca
Issue-ID: VNFSDK-334
Change-Id: I5c8fdf1fc7615da1be980ca15448d63eb097ec18
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'vnfmarket-be/vnf-sdk-marketplace/src/main/java')
-rw-r--r-- | vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/VTPResource.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/VTPResource.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/VTPResource.java index 685e0090..a59a8856 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/VTPResource.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/VTPResource.java @@ -41,6 +41,7 @@ import org.open.infc.grpc.client.OpenRemoteCli; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.gson.internal.LinkedTreeMap; @@ -113,6 +114,15 @@ public class VTPResource { JsonNode resultJson = mapper.readTree(result.getOutput()); ((ObjectNode)resultJson).put("build_tag", System.getenv("BUILD_TAG")); + + JsonNode results = resultJson.get("results"); + if (results != null && results.isArray()) { + ArrayNode resultsArray = (ArrayNode)results; + if (resultsArray.size() >= 0) { + String error = resultsArray.get(0).get("error").asText(); + ((ObjectNode)resultJson).put("criteria", "SUCCESS".equalsIgnoreCase(error) ? "PASS" : "FAILED"); + } + } return Response.ok(resultJson.toString(), MediaType.APPLICATION_JSON).build(); } |