If error returned from test, result was not sent to caller.
Was still an issue when errors was an empty JSON object.
Issue-ID: VNFSDK-392
Change-Id: I588789e4bca0ce0933e318a625a54ba04260ce5e
Signed-off-by: James Guistwite <jguistwite@iconectiv.com>
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 e051336..70ec6e6 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 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 @@
// 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;