aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKanagaraj Manickam <kanagaraj.manickam@huawei.com>2019-05-06 04:37:36 +0000
committerGerrit Code Review <gerrit@onap.org>2019-05-06 04:37:36 +0000
commit4f0967e0bcbf7b8bdce69cd01009bc1d65230161 (patch)
treee46f07c2668e70609f7e5284c142001d8df51d9d
parent50fce5d2dc4bdb8a17e5e48a6bad1499413f29d6 (diff)
parent07dd70511d455cea91241b11e7e76933cdcbe8f8 (diff)
Merge "If error returned from test, result was not sent to caller. Was still an issue when errors was an empty JSON object."
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java
index e0513360..70ec6e6a 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java
@@ -40,6 +40,7 @@ import javax.ws.rs.core.Response;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
import org.eclipse.jetty.http.HttpStatus;
import org.glassfish.jersey.media.multipart.BodyPartEntity;
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
@@ -100,12 +101,12 @@ public class VTPExecutionResource extends VTPResource{
// tests can fail but still produce results.
ObjectMapper mapper = new ObjectMapper();
Map<String,String> m = output.getAttrsMap();
- if (m.containsKey("results")) {
- execution.setResults(mapper.readTree(m.get("results")));
- }
- else if (m.containsKey("error")) {
+ if ((m.containsKey("error")) && (!StringUtils.equals(m.get("error"), "{}"))) {
execution.setResults(mapper.readTree(m.get("error")));
}
+ else if (m.containsKey("results")) {
+ execution.setResults(mapper.readTree(m.get("results")));
+ }
}
return executions;