Add build-tag in test result 43/72743/1
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Thu, 15 Nov 2018 08:43:45 +0000 (14:13 +0530)
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Thu, 15 Nov 2018 08:43:45 +0000 (14:13 +0530)
Issue-ID: VNFSDK-334

Change-Id: Iaff5c9459f47397721eea971c087e1d3e0d5a7be
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/VTPResource.java

index 6c8b127..685e009 100644 (file)
@@ -39,6 +39,9 @@ import org.onap.vnfsdk.marketplace.db.exception.MarketplaceResourceException;
 import org.open.infc.grpc.Result;
 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.ObjectNode;
 import com.google.gson.internal.LinkedTreeMap;
 
 import io.swagger.annotations.Api;
@@ -106,6 +109,11 @@ public class VTPResource {
             return Response.serverError().entity(result.getOutput()).build();
         }
 
-        return Response.ok(result.getOutput(), MediaType.APPLICATION_JSON).build();
+        ObjectMapper mapper = new ObjectMapper();
+        JsonNode resultJson = mapper.readTree(result.getOutput());
+
+        ((ObjectNode)resultJson).put("build_tag", System.getenv("BUILD_TAG"));
+
+        return Response.ok(resultJson.toString(), MediaType.APPLICATION_JSON).build();
     }
 }