geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jensde...@apache.org
Subject [03/50] [abbrv] incubator-geode git commit: GEODE-907: Converted core functionality to use jackson
Date Thu, 25 Feb 2016 20:26:51 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MemberRegionsService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MemberRegionsService.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MemberRegionsService.java
index 2c17886..05a96ec 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MemberRegionsService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MemberRegionsService.java
@@ -19,22 +19,21 @@
 
 package com.vmware.gemfire.tools.pulse.internal.service;
 
-import java.text.DecimalFormat;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-import org.springframework.stereotype.Service;
-
+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.vmware.gemfire.tools.pulse.internal.controllers.PulseController;
 import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
 import com.vmware.gemfire.tools.pulse.internal.data.PulseConstants;
 import com.vmware.gemfire.tools.pulse.internal.data.Repository;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONArray;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONException;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
 import com.vmware.gemfire.tools.pulse.internal.util.StringUtils;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.DecimalFormat;
 
 /**
  * Class MemberRegionsService
@@ -50,91 +49,80 @@ import com.vmware.gemfire.tools.pulse.internal.util.StringUtils;
 @Scope("singleton")
 public class MemberRegionsService implements PulseService {
 
+  private final ObjectMapper mapper = new ObjectMapper();
+
   // String constants used for forming a json response
   private final String NAME = "name";
   private final String ENTRY_SIZE = "entrySize";
   private final String DISC_STORE_NAME = "diskStoreName";
   private final String DISC_SYNCHRONOUS = "diskSynchronous";
 
-  public JSONObject execute(final HttpServletRequest request) throws Exception {
+  public ObjectNode tempExecute(final HttpServletRequest request) throws Exception {
 
     // get cluster object
     Cluster cluster = Repository.get().getCluster();
 
     // json object to be sent as response
-    JSONObject responseJSON = new JSONObject();
-
-    try {
-
-      JSONObject requestDataJSON = new JSONObject(
-          request.getParameter("pulseData"));
-      String memberName = requestDataJSON.getJSONObject("MemberRegions")
-          .getString("memberName");
-
-      Cluster.Member clusterMember = cluster.getMember(StringUtils
-          .makeCompliantName(memberName));
-
-      if (clusterMember != null) {
-        responseJSON.put("memberId", clusterMember.getId());
-        responseJSON.put(this.NAME, clusterMember.getName());
-        responseJSON.put("host", clusterMember.getHost());
-
-        // member's regions
-        Cluster.Region[] memberRegions = clusterMember.getMemberRegionsList();
-        JSONArray regionsListJson = new JSONArray();
-        for (Cluster.Region memberRegion : memberRegions) {
-          JSONObject regionJSON = new JSONObject();
-          regionJSON.put(this.NAME, memberRegion.getName());
-
-          if (PulseConstants.PRODUCT_NAME_SQLFIRE
-              .equalsIgnoreCase(PulseController.getPulseProductSupport())) {
-            // Convert region path to dot separated region path
-            regionJSON.put("fullPath", StringUtils
-                .getTableNameFromRegionName(memberRegion.getFullPath()));
-          } else {
-            regionJSON.put("fullPath", memberRegion.getFullPath());
-          }
-
-          regionJSON.put("type", memberRegion.getRegionType());
-          regionJSON
-              .put("entryCount", memberRegion.getSystemRegionEntryCount());
-          Long entrySize = memberRegion.getEntrySize();
-
-          DecimalFormat form = new DecimalFormat(
-              PulseConstants.DECIMAL_FORMAT_PATTERN_2);
-          String entrySizeInMB = form.format(entrySize / (1024f * 1024f));
-
-          if (entrySize < 0) {
-            regionJSON.put(this.ENTRY_SIZE, this.VALUE_NA);
-          } else {
-            regionJSON.put(this.ENTRY_SIZE, entrySizeInMB);
-          }
-          regionJSON.put("scope", memberRegion.getScope());
-          String diskStoreName = memberRegion.getDiskStoreName();
-          if (StringUtils.isNotNullNotEmptyNotWhiteSpace(diskStoreName)) {
-            regionJSON.put(this.DISC_STORE_NAME, diskStoreName);
-            regionJSON.put(this.DISC_SYNCHRONOUS,
-                memberRegion.isDiskSynchronous());
-          } else {
-            regionJSON.put(this.DISC_SYNCHRONOUS, this.VALUE_NA);
-            regionJSON.put(this.DISC_STORE_NAME, "");
-          }
-          regionJSON.put("gatewayEnabled", memberRegion.getWanEnabled());
-
-          regionsListJson.put(regionJSON);
+    ObjectNode responseJSON = mapper.createObjectNode();
+
+    JsonNode requestDataJSON = mapper.readTree(request.getParameter("pulseData"));
+    String memberName = requestDataJSON.get("MemberRegions").get("memberName").textValue();
+
+    Cluster.Member clusterMember = cluster.getMember(StringUtils.makeCompliantName(memberName));
+
+    if (clusterMember != null) {
+      responseJSON.put("memberId", clusterMember.getId());
+      responseJSON.put(this.NAME, clusterMember.getName());
+      responseJSON.put("host", clusterMember.getHost());
+
+      // member's regions
+      Cluster.Region[] memberRegions = clusterMember.getMemberRegionsList();
+      ArrayNode regionsListJson = mapper.createArrayNode();
+      for (Cluster.Region memberRegion : memberRegions) {
+        ObjectNode regionJSON = mapper.createObjectNode();
+        regionJSON.put(this.NAME, memberRegion.getName());
+
+        if (PulseConstants.PRODUCT_NAME_SQLFIRE.equalsIgnoreCase(PulseController.getPulseProductSupport())) {
+          // Convert region path to dot separated region path
+          regionJSON.put("fullPath", StringUtils.getTableNameFromRegionName(memberRegion.getFullPath()));
+        } else {
+          regionJSON.put("fullPath", memberRegion.getFullPath());
         }
-        responseJSON.put("memberRegions", regionsListJson);
 
-        // response
-        responseJSON.put("status", "Normal");
+        regionJSON.put("type", memberRegion.getRegionType());
+        regionJSON.put("entryCount", memberRegion.getSystemRegionEntryCount());
+        Long entrySize = memberRegion.getEntrySize();
 
+        DecimalFormat form = new DecimalFormat(PulseConstants.DECIMAL_FORMAT_PATTERN_2);
+        String entrySizeInMB = form.format(entrySize / (1024f * 1024f));
+
+        if (entrySize < 0) {
+          regionJSON.put(this.ENTRY_SIZE, this.VALUE_NA);
+        } else {
+          regionJSON.put(this.ENTRY_SIZE, entrySizeInMB);
+        }
+        regionJSON.put("scope", memberRegion.getScope());
+        String diskStoreName = memberRegion.getDiskStoreName();
+        if (StringUtils.isNotNullNotEmptyNotWhiteSpace(diskStoreName)) {
+          regionJSON.put(this.DISC_STORE_NAME, diskStoreName);
+          regionJSON.put(this.DISC_SYNCHRONOUS,
+              memberRegion.isDiskSynchronous());
+        } else {
+          regionJSON.put(this.DISC_SYNCHRONOUS, this.VALUE_NA);
+          regionJSON.put(this.DISC_STORE_NAME, "");
+        }
+        regionJSON.put("gatewayEnabled", memberRegion.getWanEnabled());
+
+        regionsListJson.add(regionJSON);
       }
+      responseJSON.put("memberRegions", regionsListJson);
 
-      // Send json response
-      return responseJSON;
+      // response
+      responseJSON.put("status", "Normal");
 
-    } catch (JSONException e) {
-      throw new Exception(e);
     }
+
+    // Send json response
+    return responseJSON;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MembersListService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MembersListService.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MembersListService.java
index 3a730c5..9ea701a 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MembersListService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MembersListService.java
@@ -19,11 +19,11 @@
 
 package com.vmware.gemfire.tools.pulse.internal.service;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
 import com.vmware.gemfire.tools.pulse.internal.data.Repository;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONArray;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONException;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Service;
@@ -43,35 +43,34 @@ import javax.servlet.http.HttpServletRequest;
 @Scope("singleton")
 public class MembersListService implements PulseService {
 
-  public JSONObject execute(final HttpServletRequest request) throws Exception {
+  private final ObjectMapper mapper = new ObjectMapper();
+
+  public ObjectNode tempExecute(final HttpServletRequest request) throws Exception {
 
     // get cluster object
     Cluster cluster = Repository.get().getCluster();
 
     // json object to be sent as response
-    JSONObject responseJSON = new JSONObject();
+    ObjectNode responseJSON = mapper.createObjectNode();
 
     // members list
-    JSONArray memberListJson = new JSONArray();
+    ArrayNode memberListJson = mapper.createArrayNode();
     Cluster.Member[] memberSet = cluster.getMembers();
 
-    try {
-      for (Cluster.Member member : memberSet) {
-        JSONObject memberJSON = new JSONObject();
-        memberJSON.put("memberId", member.getId());
-        memberJSON.put("name", member.getName());
-        memberJSON.put("host", member.getHost());
-        memberJSON.put("hostnameForClients", member.getHostnameForClients());
-        memberListJson.put(memberJSON);
-      }
+    for (Cluster.Member member : memberSet) {
+      ObjectNode memberJSON = mapper.createObjectNode();
+      memberJSON.put("memberId", member.getId());
+      memberJSON.put("name", member.getName());
+      memberJSON.put("host", member.getHost());
 
-      // Response JSON
-      responseJSON.put("clusterMembers", memberListJson);
-      responseJSON.put("clusterName", cluster.getServerName());
-      // Send json response
-      return responseJSON;
-    } catch (JSONException e) {
-      throw new Exception(e);
+      memberListJson.add(memberJSON);
     }
+
+    // Response JSON
+    responseJSON.put("clusterMembers", memberListJson);
+    responseJSON.put("clusterName", cluster.getServerName());
+
+    // Send json response
+    return responseJSON;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/PulseService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/PulseService.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/PulseService.java
index e01c911..f3a6ee9 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/PulseService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/PulseService.java
@@ -21,6 +21,7 @@ package com.vmware.gemfire.tools.pulse.internal.service;
 
 import javax.servlet.http.HttpServletRequest;
 
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
 
 /**
@@ -37,6 +38,11 @@ public interface PulseService {
   String VALUE_ON = "ON";
   String VALUE_OFF = "OFF";
 
-  JSONObject execute(HttpServletRequest httpServletRequest)
-      throws Exception;
+  default JSONObject execute(HttpServletRequest httpServletRequest) throws Exception {
+    return null;
+  }
+
+  default ObjectNode tempExecute(HttpServletRequest httpServletRequest) throws Exception {
+    return null;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/PulseVersionService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/PulseVersionService.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/PulseVersionService.java
index 7d6a7ef..b2e15c9 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/PulseVersionService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/PulseVersionService.java
@@ -19,15 +19,14 @@
 
 package com.vmware.gemfire.tools.pulse.internal.service;
 
-import javax.servlet.http.HttpServletRequest;
-
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.vmware.gemfire.tools.pulse.internal.controllers.PulseController;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Service;
 
-import com.vmware.gemfire.tools.pulse.internal.controllers.PulseController;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONException;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
+import javax.servlet.http.HttpServletRequest;
 
 /**
  * Class PulseVersionService
@@ -45,28 +44,21 @@ import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
 @Scope("singleton")
 public class PulseVersionService implements PulseService {
 
-  public JSONObject execute(final HttpServletRequest request) throws Exception {
+  private final ObjectMapper mapper = new ObjectMapper();
+
+  public ObjectNode tempExecute(final HttpServletRequest request) throws Exception {
 
     // json object to be sent as response
-    JSONObject responseJSON = new JSONObject();
+    ObjectNode responseJSON = mapper.createObjectNode();
+
+    // Response
+    responseJSON.put("pulseVersion", PulseController.pulseVersion.getPulseVersion());
+    responseJSON.put("buildId", PulseController.pulseVersion.getPulseBuildId());
+    responseJSON.put("buildDate", PulseController.pulseVersion.getPulseBuildDate());
+    responseJSON.put("sourceDate", PulseController.pulseVersion.getPulseSourceDate());
+    responseJSON.put("sourceRevision", PulseController.pulseVersion.getPulseSourceRevision());
+    responseJSON.put("sourceRepository", PulseController.pulseVersion.getPulseSourceRepository());
 
-    try {
-      // Response
-      responseJSON.put("pulseVersion",
-          PulseController.pulseVersion.getPulseVersion());
-      responseJSON.put("buildId",
-          PulseController.pulseVersion.getPulseBuildId());
-      responseJSON.put("buildDate",
-          PulseController.pulseVersion.getPulseBuildDate());
-      responseJSON.put("sourceDate",
-          PulseController.pulseVersion.getPulseSourceDate());
-      responseJSON.put("sourceRevision",
-          PulseController.pulseVersion.getPulseSourceRevision());
-      responseJSON.put("sourceRepository",
-          PulseController.pulseVersion.getPulseSourceRepository());
-    } catch (JSONException e) {
-      throw new Exception(e);
-    }
     // Send json response
     return responseJSON;
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/QueryStatisticsService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/QueryStatisticsService.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/QueryStatisticsService.java
index a20a2ed..c3987b2 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/QueryStatisticsService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/QueryStatisticsService.java
@@ -21,6 +21,9 @@ package com.vmware.gemfire.tools.pulse.internal.service;
 
 import javax.servlet.http.HttpServletRequest;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Service;
@@ -46,107 +49,71 @@ import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
 @Scope("singleton")
 public class QueryStatisticsService implements PulseService {
 
+  private final ObjectMapper mapper = new ObjectMapper();
+
   @Override
-  public JSONObject execute(final HttpServletRequest request) throws Exception {
+  public ObjectNode tempExecute(final HttpServletRequest request) throws Exception {
 
     // get cluster object
     Cluster cluster = Repository.get().getCluster();
 
     // json object to be sent as response
-    JSONObject responseJSON = new JSONObject();
+    ObjectNode responseJSON = mapper.createObjectNode();
 
-    try {
-      Cluster.Statement[] stmts = cluster.getStatements();
+    Cluster.Statement[] stmts = cluster.getStatements();
 
-      JSONObject queryJSON;
-      JSONArray queryListJson = new JSONArray();
-      for (int i = 0; i < stmts.length; ++i) {
-        queryJSON = new JSONObject();
-        queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_QUERYDEFINITION,
-            stmts[i].getQueryDefinition());
-        queryJSON.put(
-            PulseConstants.MBEAN_ATTRIBUTE_NUMTIMESCOMPILED,
-            (stmts[i].getNumTimesCompiled() < 0) ? this.VALUE_NA : stmts[i]
-                .getNumTimesCompiled());
-        queryJSON.put(
-            PulseConstants.MBEAN_ATTRIBUTE_NUMEXECUTION,
-            (stmts[i].getNumExecution() < 0) ? this.VALUE_NA : stmts[i]
-                .getNumExecution());
-        queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_NUMEXECUTIONSINPROGRESS,
-            (stmts[i].getNumExecutionsInProgress() < 0) ? this.VALUE_NA
-                : stmts[i].getNumExecutionsInProgress());
-        queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_NUMTIMESGLOBALINDEXLOOKUP,
-            (stmts[i].getNumTimesGlobalIndexLookup() < 0) ? this.VALUE_NA
-                : stmts[i].getNumTimesGlobalIndexLookup());
-        queryJSON.put(
-            PulseConstants.MBEAN_ATTRIBUTE_NUMROWSMODIFIED,
-            (stmts[i].getNumRowsModified() < 0) ? this.VALUE_NA : stmts[i]
-                .getNumRowsModified());
-        queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_PARSETIME, (stmts[i]
-            .getParseTime() < 0) ? this.VALUE_NA : stmts[i].getParseTime());
-        queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_BINDTIME, (stmts[i]
-            .getBindTime() < 0) ? this.VALUE_NA : stmts[i].getBindTime());
-        queryJSON.put(
-            PulseConstants.MBEAN_ATTRIBUTE_OPTIMIZETIME,
-            (stmts[i].getOptimizeTime() < 0) ? this.VALUE_NA : stmts[i]
-                .getOptimizeTime());
-        queryJSON.put(
-            PulseConstants.MBEAN_ATTRIBUTE_ROUTINGINFOTIME,
-            (stmts[i].getRoutingInfoTime() < 0) ? this.VALUE_NA : stmts[i]
-                .getRoutingInfoTime());
-        queryJSON.put(
-            PulseConstants.MBEAN_ATTRIBUTE_GENERATETIME,
-            (stmts[i].getGenerateTime() < 0) ? this.VALUE_NA : stmts[i]
-                .getGenerateTime());
-        queryJSON.put(
-            PulseConstants.MBEAN_ATTRIBUTE_TOTALCOMPILATIONTIME,
-            (stmts[i].getTotalCompilationTime() < 0) ? this.VALUE_NA : stmts[i]
-                .getTotalCompilationTime());
-        queryJSON.put(
-            PulseConstants.MBEAN_ATTRIBUTE_EXECUTIONTIME,
-            (stmts[i].getExecutionTime() < 0) ? this.VALUE_NA : stmts[i]
-                .getExecutionTime());
-        queryJSON.put(
-            PulseConstants.MBEAN_ATTRIBUTE_PROJECTIONTIME,
-            (stmts[i].getProjectionTime() < 0) ? this.VALUE_NA : stmts[i]
-                .getProjectionTime());
-        queryJSON.put(
-            PulseConstants.MBEAN_ATTRIBUTE_TOTALEXECUTIONTIME,
-            (stmts[i].getTotalExecutionTime() < 0) ? this.VALUE_NA : stmts[i]
-                .getTotalExecutionTime());
-        queryJSON.put(
-            PulseConstants.MBEAN_ATTRIBUTE_ROWSMODIFICATIONTIME,
-            (stmts[i].getRowsModificationTime() < 0) ? this.VALUE_NA : stmts[i]
-                .getRowsModificationTime());
-        queryJSON.put(
-            PulseConstants.MBEAN_ATTRIBUTE_QNNUMROWSSEEN,
-            (stmts[i].getqNNumRowsSeen() < 0) ? this.VALUE_NA : stmts[i]
-                .getqNNumRowsSeen());
-        queryJSON.put(
-            PulseConstants.MBEAN_ATTRIBUTE_QNMSGSENDTIME,
-            (stmts[i].getqNMsgSendTime() < 0) ? this.VALUE_NA : stmts[i]
-                .getqNMsgSendTime());
-        queryJSON.put(
-            PulseConstants.MBEAN_ATTRIBUTE_QNMSGSERTIME,
-            (stmts[i].getqNMsgSerTime() < 0) ? this.VALUE_NA : stmts[i]
-                .getqNMsgSerTime());
-        queryJSON.put(
-            PulseConstants.MBEAN_ATTRIBUTE_QNRESPDESERTIME,
-            (stmts[i].getqNRespDeSerTime() < 0) ? this.VALUE_NA : stmts[i]
-                .getqNRespDeSerTime());
-        queryListJson.put(queryJSON);
-      }
-      responseJSON.put("queriesList", queryListJson);
+    ArrayNode queryListJson = mapper.createArrayNode();
+    for (int i = 0; i < stmts.length; ++i) {
+      ObjectNode queryJSON = mapper.createObjectNode();
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_QUERYDEFINITION, stmts[i].getQueryDefinition());
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_NUMTIMESCOMPILED,
+          mapper.valueToTree(stmts[i].getNumTimesCompiled() < 0 ? this.VALUE_NA : stmts[i].getNumTimesCompiled()));
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_NUMEXECUTION,
+          mapper.valueToTree(stmts[i].getNumExecution() < 0 ? this.VALUE_NA : stmts[i].getNumExecution()));
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_NUMEXECUTIONSINPROGRESS,
+          mapper.valueToTree(stmts[i].getNumExecutionsInProgress() < 0 ? this.VALUE_NA : stmts[i].getNumExecutionsInProgress()));
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_NUMTIMESGLOBALINDEXLOOKUP,
+          mapper.valueToTree(stmts[i].getNumTimesGlobalIndexLookup() < 0 ? this.VALUE_NA : stmts[i].getNumTimesGlobalIndexLookup()));
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_NUMROWSMODIFIED,
+          mapper.valueToTree(stmts[i].getNumRowsModified() < 0 ? this.VALUE_NA : stmts[i].getNumRowsModified()));
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_PARSETIME,
+          mapper.valueToTree(stmts[i].getParseTime() < 0 ? this.VALUE_NA : stmts[i].getParseTime()));
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_BINDTIME,
+          mapper.valueToTree(stmts[i].getBindTime() < 0 ? this.VALUE_NA : stmts[i].getBindTime()));
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_OPTIMIZETIME,
+          mapper.valueToTree(stmts[i].getOptimizeTime() < 0 ? this.VALUE_NA : stmts[i].getOptimizeTime()));
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_ROUTINGINFOTIME,
+          mapper.valueToTree(stmts[i].getRoutingInfoTime() < 0 ? this.VALUE_NA : stmts[i].getRoutingInfoTime()));
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_GENERATETIME,
+          mapper.valueToTree(stmts[i].getGenerateTime() < 1 ? this.VALUE_NA : stmts[i].getGenerateTime()));
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_TOTALCOMPILATIONTIME,
+          mapper.valueToTree(stmts[i].getTotalCompilationTime() < 0 ? this.VALUE_NA : stmts[i].getTotalCompilationTime()));
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_EXECUTIONTIME,
+          mapper.valueToTree(stmts[i].getExecutionTime() < 0 ? this.VALUE_NA : stmts[i].getExecutionTime()));
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_PROJECTIONTIME,
+          mapper.valueToTree(stmts[i].getProjectionTime() < 0 ? this.VALUE_NA : stmts[i].getProjectionTime()));
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_TOTALEXECUTIONTIME,
+          mapper.valueToTree(stmts[i].getTotalExecutionTime() < 0 ? this.VALUE_NA : stmts[i].getTotalExecutionTime()));
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_ROWSMODIFICATIONTIME,
+          mapper.valueToTree(stmts[i].getRowsModificationTime() < 0 ? this.VALUE_NA : stmts[i].getRowsModificationTime()));
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_QNNUMROWSSEEN,
+          mapper.valueToTree(stmts[i].getqNNumRowsSeen() < 0 ? this.VALUE_NA : stmts[i].getqNNumRowsSeen()));
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_QNMSGSENDTIME,
+          mapper.valueToTree(stmts[i].getqNMsgSendTime() < 0 ? this.VALUE_NA : stmts[i].getqNMsgSendTime()));
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_QNMSGSERTIME,
+          mapper.valueToTree(stmts[i].getqNMsgSerTime() < 0 ? this.VALUE_NA : stmts[i].getqNMsgSerTime()));
+      queryJSON.put(PulseConstants.MBEAN_ATTRIBUTE_QNRESPDESERTIME,
+          mapper.valueToTree(stmts[i].getqNRespDeSerTime() < 0 ? this.VALUE_NA : stmts[i].getqNRespDeSerTime()));
+      queryListJson.add(queryJSON);
+    }
+    responseJSON.put("queriesList", queryListJson);
 
-      // return jmx status
-      responseJSON.put("connectedFlag", cluster.isConnectedFlag());
-      responseJSON.put("connectedErrorMsg", cluster.getConnectionErrorMsg());
+    // return jmx status
+    responseJSON.put("connectedFlag", cluster.isConnectedFlag());
+    responseJSON.put("connectedErrorMsg", cluster.getConnectionErrorMsg());
 
-      // Send json response
-      return responseJSON;
+    // Send json response
+    return responseJSON;
 
-    } catch (JSONException e) {
-      throw new Exception(e);
-    }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/SystemAlertsService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/SystemAlertsService.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/SystemAlertsService.java
index 4aa5560..47fd20d 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/SystemAlertsService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/SystemAlertsService.java
@@ -19,18 +19,18 @@
 
 package com.vmware.gemfire.tools.pulse.internal.service;
 
-import javax.servlet.http.HttpServletRequest;
-
+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.vmware.gemfire.tools.pulse.internal.data.Cluster;
+import com.vmware.gemfire.tools.pulse.internal.data.Repository;
+import com.vmware.gemfire.tools.pulse.internal.util.StringUtils;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Service;
 
-import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
-import com.vmware.gemfire.tools.pulse.internal.data.Repository;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONArray;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONException;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
-import com.vmware.gemfire.tools.pulse.internal.util.StringUtils;
+import javax.servlet.http.HttpServletRequest;
 
 /**
  * Class SystemAlertsService
@@ -47,37 +47,32 @@ import com.vmware.gemfire.tools.pulse.internal.util.StringUtils;
 @Scope("singleton")
 public class SystemAlertsService implements PulseService {
 
-  public JSONObject execute(final HttpServletRequest request) throws Exception {
+  private static final ObjectMapper mapper = new ObjectMapper();
+
+  public ObjectNode tempExecute(final HttpServletRequest request) throws Exception {
 
     // get cluster object
     Cluster cluster = Repository.get().getCluster();
 
     // json object to be sent as response
-    JSONObject responseJSON = new JSONObject();
-
-    try {
-      JSONObject requestDataJSON = new JSONObject(
-          request.getParameter("pulseData"));
-      int pageNumber = 1; // Default
-      String strPageNumber = requestDataJSON.getJSONObject("SystemAlerts")
-          .getString("pageNumber");
-      if (StringUtils.isNotNullNotEmptyNotWhiteSpace(strPageNumber)) {
-        try {
-          pageNumber = Integer.valueOf(strPageNumber);
-        } catch (NumberFormatException e) {
-        }
+    ObjectNode responseJSON = mapper.createObjectNode();
+
+    JsonNode requestDataJSON = mapper.readTree(request.getParameter("pulseData"));
+    int pageNumber = 1; // Default
+    String strPageNumber = requestDataJSON.get("SystemAlerts").get("pageNumber").textValue();
+    if (StringUtils.isNotNullNotEmptyNotWhiteSpace(strPageNumber)) {
+      try {
+        pageNumber = Integer.valueOf(strPageNumber);
+      } catch (NumberFormatException e) {
       }
-
-      // clucter's Members
-      responseJSON.put("systemAlerts", getAlertsJson(cluster, pageNumber));
-      responseJSON.put("pageNumber", cluster.getNotificationPageNumber());
-      responseJSON.put("connectedFlag", cluster.isConnectedFlag());
-      responseJSON.put("connectedErrorMsg", cluster.getConnectionErrorMsg());
-
-    } catch (JSONException e) {
-      throw new Exception(e);
     }
 
+    // cluster's Members
+    responseJSON.put("systemAlerts", getAlertsJson(cluster, pageNumber));
+    responseJSON.put("pageNumber", cluster.getNotificationPageNumber());
+    responseJSON.put("connectedFlag", cluster.isConnectedFlag());
+    responseJSON.put("connectedErrorMsg", cluster.getConnectionErrorMsg());
+
     // Send json response
     return responseJSON;
   }
@@ -89,23 +84,22 @@ public class SystemAlertsService implements PulseService {
    * @param cluster
    * @return JSONObject Array list
    */
-  public static JSONObject getAlertsJson(Cluster cluster, int pageNumber)
-      throws JSONException {
+  public static ObjectNode getAlertsJson(Cluster cluster, int pageNumber) {
     // getting list of all types of alerts
     Cluster.Alert[] alertsList = cluster.getAlertsList();
 
     // create alerts json
-    JSONObject alertsJsonObject = new JSONObject();
+    ObjectNode alertsJsonObject = mapper.createObjectNode();
 
     if ((alertsList != null) && (alertsList.length > 0)) {
-      JSONArray errorJsonArray = new JSONArray();
-      JSONArray severeJsonArray = new JSONArray();
-      JSONArray warningJsonArray = new JSONArray();
-      JSONArray infoJsonArray = new JSONArray();
+      ArrayNode errorJsonArray = mapper.createArrayNode();
+      ArrayNode severeJsonArray = mapper.createArrayNode();
+      ArrayNode warningJsonArray = mapper.createArrayNode();
+      ArrayNode infoJsonArray = mapper.createArrayNode();
 
       cluster.setNotificationPageNumber(pageNumber);
       for (Cluster.Alert alert : alertsList) {
-        JSONObject objAlertJson = new JSONObject();
+        ObjectNode objAlertJson = mapper.createObjectNode();
         objAlertJson.put("description", alert.getDescription());
         objAlertJson.put("memberName", alert.getMemberName());
         objAlertJson.put("severity", alert.getSeverity());
@@ -115,13 +109,13 @@ public class SystemAlertsService implements PulseService {
         objAlertJson.put("id", alert.getId());
 
         if (alert.getSeverity() == Cluster.Alert.SEVERE) {
-          severeJsonArray.put(objAlertJson);
+          severeJsonArray.add(objAlertJson);
         } else if (alert.getSeverity() == Cluster.Alert.ERROR) {
-          errorJsonArray.put(objAlertJson);
+          errorJsonArray.add(objAlertJson);
         } else if (alert.getSeverity() == Cluster.Alert.WARNING) {
-          warningJsonArray.put(objAlertJson);
+          warningJsonArray.add(objAlertJson);
         } else {
-          infoJsonArray.put(objAlertJson);
+          infoJsonArray.add(objAlertJson);
         }
       }
       alertsJsonObject.put("info", infoJsonArray);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/controllers/PulseControllerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/controllers/PulseControllerJUnitTest.java b/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/controllers/PulseControllerJUnitTest.java
index c4f7a49..33e0a1c 100644
--- a/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/controllers/PulseControllerJUnitTest.java
+++ b/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/controllers/PulseControllerJUnitTest.java
@@ -1,13 +1,15 @@
 package com.vmware.gemfire.tools.pulse.controllers;
 
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
 import com.vmware.gemfire.tools.pulse.internal.PulseAppListener;
+import com.vmware.gemfire.tools.pulse.internal.controllers.PulseController;
 import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
 import com.vmware.gemfire.tools.pulse.internal.data.PulseConfig;
 import com.vmware.gemfire.tools.pulse.internal.data.Repository;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
 import org.apache.commons.collections.buffer.CircularFifoBuffer;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -35,6 +37,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.UUID;
 
+import static org.hamcrest.Matchers.contains;
 import static org.hamcrest.Matchers.containsInAnyOrder;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -50,13 +53,13 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
 /**
  * @author Jens Deppe
  */
-@Category(IntegrationTest.class)
+@Category(UnitTest.class)
 @PrepareForTest(Repository.class)
 @RunWith(PowerMockRunner.class)
 @PowerMockRunnerDelegate(SpringJUnit4ClassRunner.class)
 @WebAppConfiguration
 @ContextConfiguration("classpath*:mvc-dispatcher-servlet.xml")
-@PowerMockIgnore("*.IntegrationTest")
+@PowerMockIgnore("*.UnitTest")
 public class PulseControllerJUnitTest {
 
   @Autowired
@@ -79,6 +82,8 @@ public class PulseControllerJUnitTest {
   private static final String REGION_TYPE = "PARTITION";
   private static final String AEQ_LISTENER = "async-event-listener";
   private static final String CLIENT_NAME = "client-1";
+  private static final String PHYSICAL_HOST_NAME = "physical-host-1";
+  private static final String GEMFIRE_VERSION = "1.0.0";
 
   private static final Principal principal;
 
@@ -86,6 +91,8 @@ public class PulseControllerJUnitTest {
     principal = () -> PRINCIPAL_USER;
   }
 
+  private final ObjectMapper mapper = new ObjectMapper();
+
   @Before
   public void setup() throws Exception {
     this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
@@ -106,12 +113,14 @@ public class PulseControllerJUnitTest {
     region.setRegionOnMembers(new ArrayList<Cluster.RegionOnMember>() {{
       add(regionOnMember);
     }});
-    cluster.addClusterRegion("/mock-region", region);
+    cluster.addClusterRegion(REGION_PATH, region);
 
     Cluster.Member member = new Cluster.Member();
     member.setId(MEMBER_ID);
     member.setName(MEMBER_NAME);
     member.setUptime(1L);
+    member.setHost(PHYSICAL_HOST_NAME);
+    member.setGemfireVersion(GEMFIRE_VERSION);
 
     member.setMemberRegions(new HashMap<String, Cluster.Region>() {{
       put(REGION_NAME, region);
@@ -131,13 +140,35 @@ public class PulseControllerJUnitTest {
       put(CLIENT_NAME, client);
     }});
 
-    cluster.setMembersHMap(new HashMap() {{put(MEMBER_NAME, member);}});
+    cluster.setMembersHMap(new HashMap() {{
+      put(MEMBER_NAME, member);
+    }});
+    cluster.setPhysicalToMember(new HashMap() {{
+      put(PHYSICAL_HOST_NAME, new ArrayList() {{
+        add(member);
+      }});
+    }});
     cluster.setServerName(CLUSTER_NAME);
     cluster.setMemoryUsageTrend(new CircularFifoBuffer() {{
       add(1);
       add(2);
       add(3);
     }});
+    cluster.setWritePerSecTrend(new CircularFifoBuffer() {{
+      add(1);
+      add(2);
+      add(3);
+    }});
+    cluster.setThroughoutReadsTrend(new CircularFifoBuffer() {{
+      add(1);
+      add(2);
+      add(3);
+    }});
+    cluster.setThroughoutWritesTrend(new CircularFifoBuffer() {{
+      add(4);
+      add(5);
+      add(6);
+    }});
 
     Repository repo = Mockito.spy(Repository.class);
 
@@ -150,6 +181,13 @@ public class PulseControllerJUnitTest {
     File tempQueryLog = tempFolder.newFile("query_history.log");
     config.setQueryHistoryFileName(tempQueryLog.toString());
     doReturn(config).when(repo).getPulseConfig();
+
+    PulseController.pulseVersion.setPulseVersion("not empty");
+    PulseController.pulseVersion.setPulseBuildId("not empty");
+    PulseController.pulseVersion.setPulseBuildDate("not empty");
+    PulseController.pulseVersion.setPulseSourceDate("not empty");
+    PulseController.pulseVersion.setPulseSourceRevision("not empty");
+    PulseController.pulseVersion.setPulseSourceRepository("not empty");
   }
 
   @Test
@@ -160,7 +198,7 @@ public class PulseControllerJUnitTest {
         .accept(MediaType.parseMediaType(MediaType.APPLICATION_JSON_UTF8_VALUE)))
         .andExpect(status().isOk())
         .andExpect(jsonPath("$.ClusterDetails.userName").value(PRINCIPAL_USER))
-        .andExpect(jsonPath("$.ClusterDetails.totalHeap").value(0))
+        .andExpect(jsonPath("$.ClusterDetails.totalHeap").value(0D))
         .andExpect(jsonPath("$.ClusterDetails.clusterName").value(CLUSTER_NAME))
     ;
   }
@@ -172,10 +210,10 @@ public class PulseControllerJUnitTest {
         .principal(principal)
         .accept(MediaType.parseMediaType(MediaType.APPLICATION_JSON_UTF8_VALUE)))
         .andExpect(status().isOk())
-        .andExpect(jsonPath("$.ClusterDiskThroughput.currentThroughputWrites").value(0))
-        .andExpect(jsonPath("$.ClusterDiskThroughput.throughputReads").isEmpty())
-        .andExpect(jsonPath("$.ClusterDiskThroughput.currentThroughputReads").value(0))
-        .andExpect(jsonPath("$.ClusterDiskThroughput.throughputWrites").isEmpty())
+        .andExpect(jsonPath("$.ClusterDiskThroughput.currentThroughputWrites").value(0D))
+        .andExpect(jsonPath("$.ClusterDiskThroughput.throughputReads", contains(1, 2, 3)))
+        .andExpect(jsonPath("$.ClusterDiskThroughput.currentThroughputReads").value(0D))
+        .andExpect(jsonPath("$.ClusterDiskThroughput.throughputWrites", contains(4, 5, 6)))
     ;
   }
 
@@ -200,7 +238,7 @@ public class PulseControllerJUnitTest {
         .andExpect(status().isOk())
         .andExpect(jsonPath("$.ClusterKeyStatistics.readPerSecTrend").isEmpty())
         .andExpect(jsonPath("$.ClusterKeyStatistics.queriesPerSecTrend").isEmpty())
-        .andExpect(jsonPath("$.ClusterKeyStatistics.writePerSecTrend").isEmpty())
+        .andExpect(jsonPath("$.ClusterKeyStatistics.writePerSecTrend", contains(1, 2, 3)))
     ;
   }
 
@@ -212,7 +250,7 @@ public class PulseControllerJUnitTest {
         .accept(MediaType.parseMediaType(MediaType.APPLICATION_JSON_UTF8_VALUE)))
         .andExpect(status().isOk())
         .andExpect(jsonPath("$.ClusterMembers.members[0].serverGroups[0]").value("Default"))
-        .andExpect(jsonPath("$.ClusterMembers.members[0].cpuUsage").value(0))
+        .andExpect(jsonPath("$.ClusterMembers.members[0].cpuUsage").value(0D))
         .andExpect(jsonPath("$.ClusterMembers.members[0].clients").value(1))
         .andExpect(jsonPath("$.ClusterMembers.members[0].heapUsage").value(0))
         .andExpect(jsonPath("$.ClusterMembers.members[0].name").value(MEMBER_NAME))
@@ -233,9 +271,33 @@ public class PulseControllerJUnitTest {
         .andExpect(status().isOk())
         .andExpect(jsonPath("$.ClusterMembersRGraph.memberCount").value(0))
         .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.data").isEmpty())
-        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children").isEmpty())
         .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.name").value(0))
         .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.id").value(0))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].id").value(PHYSICAL_HOST_NAME))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].name").value(PHYSICAL_HOST_NAME))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].data.loadAvg").isEmpty())
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].data.sockets").isEmpty())
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].data.threads").value(0))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].data.cpuUsage").value(0D))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].data.memoryUsage").value(0))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].data.hostStatus").value("Normal"))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].data.$type").value("hostNormalNode"))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].children[0].id").value(MEMBER_ID))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].children[0].name").value(MEMBER_NAME))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].children[0].data.gemfireVersion").value(GEMFIRE_VERSION))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].children[0].data.memoryUsage").value(0))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].children[0].data.cpuUsage").value(0D))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].children[0].data.regions").value(1))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].children[0].data.host").value(PHYSICAL_HOST_NAME))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].children[0].data.port").value("-"))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].children[0].data.clients").value(1))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].children[0].data.gcPauses").value(0))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].children[0].data.numThreads").value(0))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].children[0].data.nodeType").value("memberNormalNode"))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].children[0].data.$type").value("memberNormalNode"))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].children[0].data.gatewaySender").value(0))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].children[0].data.gatewayReceiver").value(0))
+        .andExpect(jsonPath("$.ClusterMembersRGraph.clustor.children[0].children[0].children").isEmpty())
     ;
   }
 
@@ -263,7 +325,7 @@ public class PulseControllerJUnitTest {
         .andExpect(jsonPath("$.ClusterRegion.region[0].regionPath").value(REGION_PATH))
         .andExpect(jsonPath("$.ClusterRegion.region[0].diskReadsTrend").isEmpty())
         .andExpect(jsonPath("$.ClusterRegion.region[0].memoryUsage").value("0.0000"))
-        .andExpect(jsonPath("$.ClusterRegion.region[0].getsRate").value(0))
+        .andExpect(jsonPath("$.ClusterRegion.region[0].getsRate").value(0D))
         .andExpect(jsonPath("$.ClusterRegion.region[0].wanEnabled").value(false))
         .andExpect(jsonPath("$.ClusterRegion.region[0].memberCount").value(1))
         .andExpect(jsonPath("$.ClusterRegion.region[0].isHDFSWriteOnly").value("NA"))
@@ -272,7 +334,7 @@ public class PulseControllerJUnitTest {
         .andExpect(jsonPath("$.ClusterRegion.region[0].emptyNodes").value(0))
         .andExpect(jsonPath("$.ClusterRegion.region[0].type").value(REGION_TYPE))
         .andExpect(jsonPath("$.ClusterRegion.region[0].isEnableOffHeapMemory").value("OFF"))
-        .andExpect(jsonPath("$.ClusterRegion.region[0].putsRate").value(0))
+        .andExpect(jsonPath("$.ClusterRegion.region[0].putsRate").value(0D))
         .andExpect(jsonPath("$.ClusterRegion.region[0].totalMemory").value(0))
         .andExpect(jsonPath("$.ClusterRegion.region[0].entryCount").value(0))
         .andExpect(jsonPath("$.ClusterRegion.region[0].compressionCodec").value("NA"))
@@ -297,7 +359,7 @@ public class PulseControllerJUnitTest {
         .andExpect(jsonPath("$.ClusterRegions.regions[0].regionPath").value(REGION_PATH))
         .andExpect(jsonPath("$.ClusterRegions.regions[0].diskReadsTrend").isEmpty())
         .andExpect(jsonPath("$.ClusterRegions.regions[0].memoryUsage").value("0.0000"))
-        .andExpect(jsonPath("$.ClusterRegions.regions[0].getsRate").value(0))
+        .andExpect(jsonPath("$.ClusterRegions.regions[0].getsRate").value(0D))
         .andExpect(jsonPath("$.ClusterRegions.regions[0].wanEnabled").value(false))
         .andExpect(jsonPath("$.ClusterRegions.regions[0].memberCount").value(1))
         .andExpect(jsonPath("$.ClusterRegions.regions[0].isHDFSWriteOnly").value("NA"))
@@ -306,7 +368,7 @@ public class PulseControllerJUnitTest {
         .andExpect(jsonPath("$.ClusterRegions.regions[0].emptyNodes").value(0))
         .andExpect(jsonPath("$.ClusterRegions.regions[0].type").value(REGION_TYPE))
         .andExpect(jsonPath("$.ClusterRegions.regions[0].isEnableOffHeapMemory").value("OFF"))
-        .andExpect(jsonPath("$.ClusterRegions.regions[0].putsRate").value(0))
+        .andExpect(jsonPath("$.ClusterRegions.regions[0].putsRate").value(0D))
         .andExpect(jsonPath("$.ClusterRegions.regions[0].totalMemory").value(0))
         .andExpect(jsonPath("$.ClusterRegions.regions[0].entryCount").value(0))
         .andExpect(jsonPath("$.ClusterRegions.regions[0].compressionCodec").value("NA"))
@@ -328,13 +390,13 @@ public class PulseControllerJUnitTest {
         .principal(principal)
         .accept(MediaType.parseMediaType(MediaType.APPLICATION_JSON_UTF8_VALUE)))
         .andExpect(status().isOk())
-        .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.lruEvictionRate").value(0))
-        .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.getsRate").value(0))
+        .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.lruEvictionRate").value(0D))
+        .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.getsRate").value(0D))
         .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.emptyNodes").value(0))
         .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.type").value(REGION_TYPE))
         .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.isEnableOffHeapMemory").value("OFF"))
         .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.path").value(REGION_PATH))
-        .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.members[0].cpuUsage").value(0))
+        .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.members[0].cpuUsage").value(0D))
         .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.members[0].clients").value(1))
         .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.members[0].heapUsage").value(0))
         .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.members[0].name").value(MEMBER_NAME))
@@ -352,7 +414,7 @@ public class PulseControllerJUnitTest {
         .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.wanEnabled").value(false))
         .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.memberCount").value(1))
         .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.isHDFSWriteOnly").value("NA"))
-        .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.putsRate").value(0))
+        .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.putsRate").value(0D))
         .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.totalMemory").value(0))
         .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.entryCount").value(0))
         .andExpect(jsonPath("$.ClusterSelectedRegion.selectedRegion.compressionCodec").value("NA"))
@@ -445,7 +507,7 @@ public class PulseControllerJUnitTest {
         .andExpect(status().isOk())
         .andExpect(jsonPath("$.MemberDetails.name").value(MEMBER_NAME))
         .andExpect(jsonPath("$.MemberDetails.offHeapUsedSize").value(0))
-        .andExpect(jsonPath("$.MemberDetails.diskStorageUsed").value(0))
+        .andExpect(jsonPath("$.MemberDetails.diskStorageUsed").value(0D))
         .andExpect(jsonPath("$.MemberDetails.regionsCount").value(1))
         .andExpect(jsonPath("$.MemberDetails.clusterName").value(CLUSTER_NAME))
         .andExpect(jsonPath("$.MemberDetails.name").value(MEMBER_NAME))
@@ -468,8 +530,8 @@ public class PulseControllerJUnitTest {
         .andExpect(status().isOk())
         .andExpect(jsonPath("$.MemberDiskThroughput.throughputWritesTrend").isEmpty())
         .andExpect(jsonPath("$.MemberDiskThroughput.throughputReadsTrend").isEmpty())
-        .andExpect(jsonPath("$.MemberDiskThroughput.throughputWrites").value(0))
-        .andExpect(jsonPath("$.MemberDiskThroughput.throughputReads").value(0))
+        .andExpect(jsonPath("$.MemberDiskThroughput.throughputWrites").value(0D))
+        .andExpect(jsonPath("$.MemberDiskThroughput.throughputReads").value(0D))
     ;
   }
 
@@ -571,12 +633,12 @@ public class PulseControllerJUnitTest {
         .principal(principal)
         .accept(MediaType.parseMediaType(MediaType.APPLICATION_JSON_UTF8_VALUE)))
         .andExpect(status().isOk())
-        .andExpect(jsonPath("$.PulseVersion.sourceDate").isNotEmpty())
-        .andExpect(jsonPath("$.PulseVersion.sourceRepository").isNotEmpty())
-        .andExpect(jsonPath("$.PulseVersion.pulseVersion").isNotEmpty())
-        .andExpect(jsonPath("$.PulseVersion.sourceRevision").isNotEmpty())
-        .andExpect(jsonPath("$.PulseVersion.buildId").isNotEmpty())
-        .andExpect(jsonPath("$.PulseVersion.buildDate").isNotEmpty())
+        .andExpect(jsonPath("$.PulseVersion.sourceDate").value("not empty"))
+        .andExpect(jsonPath("$.PulseVersion.sourceRepository").value("not empty"))
+        .andExpect(jsonPath("$.PulseVersion.pulseVersion").value("not empty"))
+        .andExpect(jsonPath("$.PulseVersion.sourceRevision").value("not empty"))
+        .andExpect(jsonPath("$.PulseVersion.buildId").value("not empty"))
+        .andExpect(jsonPath("$.PulseVersion.buildDate").value("not empty"))
     ;
   }
 
@@ -691,7 +753,7 @@ public class PulseControllerJUnitTest {
 
   @Test
   public void dataBrowserQuery() throws Exception {
-    doReturn(new JSONObject().put("foo", "bar")).when(cluster).executeQuery(anyString(), anyString(), anyInt());
+    doReturn(mapper.createObjectNode().put("foo", "bar")).when(cluster).executeQuery(anyString(), anyString(), anyInt());
 
     this.mockMvc.perform(get("/dataBrowserQuery")
         .param("query", "SELECT * FROM " + REGION_PATH)
@@ -712,7 +774,7 @@ public class PulseControllerJUnitTest {
         .principal(principal)
         .accept(MediaType.parseMediaType(MediaType.APPLICATION_JSON_UTF8_VALUE)))
         .andExpect(status().isOk())
-        .andExpect(jsonPath("$.queryHistory[0].queryText").value("SELECT * FROM " + REGION_PATH))
+        .andExpect(jsonPath("$.queryHistory[0].queryText").value("\"SELECT * FROM " + REGION_PATH + "\""))
     ;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/PropMockDataUpdater.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/PropMockDataUpdater.java b/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/PropMockDataUpdater.java
index 0cd1d37..51cc279 100644
--- a/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/PropMockDataUpdater.java
+++ b/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/PropMockDataUpdater.java
@@ -18,18 +18,8 @@
  */
 package com.vmware.gemfire.tools.pulse.testbed;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Random;
-import java.util.ResourceBundle;
-
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
 import com.vmware.gemfire.tools.pulse.internal.data.Cluster.Alert;
 import com.vmware.gemfire.tools.pulse.internal.data.Cluster.Client;
@@ -40,13 +30,22 @@ import com.vmware.gemfire.tools.pulse.internal.data.Cluster.Region;
 import com.vmware.gemfire.tools.pulse.internal.data.IClusterUpdater;
 import com.vmware.gemfire.tools.pulse.internal.data.PulseConstants;
 import com.vmware.gemfire.tools.pulse.internal.data.Repository;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONException;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
 import com.vmware.gemfire.tools.pulse.internal.log.PulseLogWriter;
 import com.vmware.gemfire.tools.pulse.testbed.GemFireDistributedSystem.Locator;
 import com.vmware.gemfire.tools.pulse.testbed.GemFireDistributedSystem.Peer;
 import com.vmware.gemfire.tools.pulse.testbed.GemFireDistributedSystem.Server;
 
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Random;
+import java.util.ResourceBundle;
 
 public class PropMockDataUpdater implements IClusterUpdater {
   private static final int MAX_HOSTS = 40;
@@ -61,6 +60,8 @@ public class PropMockDataUpdater implements IClusterUpdater {
   private TestBed testbed;
   private final String testbedFile = System.getProperty("pulse.propMockDataUpdaterFile");;
 
+  private final ObjectMapper mapper = new ObjectMapper();
+
   public PropMockDataUpdater(Cluster cluster) {
     this.cluster = cluster;
     try {
@@ -348,7 +349,6 @@ public class PropMockDataUpdater implements IClusterUpdater {
     gatewayReceiver.setStatus(true);
     gatewayReceiver.setBatchSize(Math.abs(r.nextInt(10)));
 
-
     int gatewaySenderCount = Math.abs(r.nextInt(10));
 
     List<GatewaySender> list = m.getGatewaySenderList();
@@ -357,7 +357,6 @@ public class PropMockDataUpdater implements IClusterUpdater {
       list.add(createGatewaySenderCount(r));
     }
 
-
     Map<String, List<Member>> physicalToMember = cluster.getPhysicalToMember();
 
     List<Cluster.Member> memberArrList = physicalToMember.get(m.getHost());
@@ -506,8 +505,7 @@ public class PropMockDataUpdater implements IClusterUpdater {
   }
 
   @Override
-  public JSONObject executeQuery(String queryText, String members, int limit)
-      throws JSONException {
+  public ObjectNode executeQuery(String queryText, String members, int limit) {
     // TODO for Sushant/Sachin - Add implementation for MockUpdater for Automation
     return null;
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/junit/BaseServiceTest.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/junit/BaseServiceTest.java b/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/junit/BaseServiceTest.java
index 8de628c..b607978 100644
--- a/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/junit/BaseServiceTest.java
+++ b/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/junit/BaseServiceTest.java
@@ -18,18 +18,11 @@
  */
 package com.vmware.gemfire.tools.pulse.tests.junit;
 
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.URI;
-import java.util.List;
-import java.util.Properties;
-
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.gemstone.gemfire.test.junit.categories.UITest;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
+import com.google.gson.JsonObject;
+import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpUriRequest;
@@ -39,11 +32,23 @@ import org.apache.http.impl.client.BasicCookieStore;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.util.EntityUtils;
-import org.junit.*;
-
-import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URI;
+import java.util.List;
+import java.util.Properties;
+
 
 /**
  * Base class to be extended by other JUnit test classes. This class defines and automatically invokes test for testing server login-logout so no need to add
@@ -61,14 +66,14 @@ public abstract class BaseServiceTest {
 
   protected static Properties propsForJUnit = new Properties();
   protected static String strHost = null;
-    protected static String strPort = null;
-    protected static String LOGIN_URL;
-    protected static String LOGOUT_URL;
-    protected static String IS_AUTHENTICATED_USER_URL;
-    protected static String PULSE_UPDATE_URL;
-
-    protected static final String PULSE_UPDATE_PARAM = "pulseData";
-    protected static final String PULSE_UPDATE_1_VALUE = "{'ClusterSelectedRegion':{'regionFullPath':'/GlobalVilage_2/GlobalVilage_9'}}";
+  protected static String strPort = null;
+  protected static String LOGIN_URL;
+  protected static String LOGOUT_URL;
+  protected static String IS_AUTHENTICATED_USER_URL;
+  protected static String PULSE_UPDATE_URL;
+
+  protected static final String PULSE_UPDATE_PARAM = "pulseData";
+  protected static final String PULSE_UPDATE_1_VALUE = "{'ClusterSelectedRegion':{'regionFullPath':'/GlobalVilage_2/GlobalVilage_9'}}";
   protected static final String PULSE_UPDATE_2_VALUE = "{'ClusterSelectedRegion':{'regionFullPath':'/Rubbish'}}";
 
   protected static final String PULSE_UPDATE_3_VALUE = "{'ClusterSelectedRegionsMember':{'regionFullPath':'/GlobalVilage_2/GlobalVilage_9'}}";
@@ -78,25 +83,27 @@ public abstract class BaseServiceTest {
   protected static final String PULSE_UPDATE_6_VALUE = "{'MemberGatewayHub':{'memberName':'pnq-visitor2'}}";
   protected static CloseableHttpClient httpclient = null;
 
+  private final ObjectMapper mapper = new ObjectMapper();
 
-    @BeforeClass
-    public static void beforeClass() throws Exception{
-        InputStream stream = BaseServiceTest.class.getClassLoader().getResourceAsStream("pulse.properties");
-
-        try{
-            propsForJUnit.load(stream);
-        } catch(Exception exProps){
-            System.out.println("BaseServiceTest :: Error loading properties from pulse.properties in classpath");
-        }
-        strHost = propsForJUnit.getProperty("pulse.host");
-        strPort = propsForJUnit.getProperty("pulse.port");
-        System.out.println("BaseServiceTest :: Loaded properties from classpath. Checking properties for hostname. Hostname found = " + strHost);
-        LOGIN_URL =                 "http://" + strHost + ":" + strPort + "/pulse/j_spring_security_check";
-        LOGOUT_URL =                "http://" + strHost + ":" + strPort + "/pulse/clusterLogout";
-        IS_AUTHENTICATED_USER_URL = "http://" + strHost + ":" + strPort + "/pulse/authenticateUser";
-        PULSE_UPDATE_URL =          "http://" + strHost + ":" + strPort + "/pulse/pulseUpdate";
+  @BeforeClass
+  public static void beforeClass() throws Exception {
+    InputStream stream = BaseServiceTest.class.getClassLoader().getResourceAsStream("pulse.properties");
 
+    try {
+      propsForJUnit.load(stream);
+    } catch (Exception exProps) {
+      System.out.println("BaseServiceTest :: Error loading properties from pulse.properties in classpath");
     }
+    strHost = propsForJUnit.getProperty("pulse.host");
+    strPort = propsForJUnit.getProperty("pulse.port");
+    System.out.println(
+        "BaseServiceTest :: Loaded properties from classpath. Checking properties for hostname. Hostname found = " + strHost);
+    LOGIN_URL = "http://" + strHost + ":" + strPort + "/pulse/j_spring_security_check";
+    LOGOUT_URL = "http://" + strHost + ":" + strPort + "/pulse/clusterLogout";
+    IS_AUTHENTICATED_USER_URL = "http://" + strHost + ":" + strPort + "/pulse/authenticateUser";
+    PULSE_UPDATE_URL = "http://" + strHost + ":" + strPort + "/pulse/pulseUpdate";
+
+  }
   /**
   *
   * @author rbhandekar
@@ -232,8 +239,8 @@ public abstract class BaseServiceTest {
             System.out.println("BaseServiceTest :: JSON response returned : " + jsonResp);
             EntityUtils.consume(entity);
 
-            JSONObject jsonObj = new JSONObject(jsonResp);
-            boolean isUserLoggedIn = jsonObj.getBoolean("isUserLoggedIn");
+            JsonNode jsonObj = mapper.readTree(jsonResp);
+            boolean isUserLoggedIn = jsonObj.get("isUserLoggedIn").booleanValue();
             Assert.assertNotNull("BaseServiceTest :: Server returned null response in 'isUserLoggedIn'", isUserLoggedIn);
             Assert.assertTrue("BaseServiceTest :: User login failed for this username, password", (isUserLoggedIn == true));
           } finally {


Mime
View raw message