You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2016/06/20 16:00:44 UTC

[1/4] ignite git commit: IGNITE-3277-preview

Repository: ignite
Updated Branches:
  refs/heads/ignite-3277-preview [created] ee0a40e0d


http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index b6a386b..c2679df 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.internal.processors.rest.protocols.http.jetty;
 
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import java.io.BufferedInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -24,6 +26,7 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.LineNumberReader;
 import java.net.InetSocketAddress;
+import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -34,17 +37,11 @@ import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import net.sf.json.JSON;
-import net.sf.json.JSONException;
-import net.sf.json.JSONSerializer;
-import net.sf.json.JsonConfig;
-import net.sf.json.processors.JsonValueProcessor;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.internal.processors.rest.GridRestCommand;
 import org.apache.ignite.internal.processors.rest.GridRestProtocolHandler;
 import org.apache.ignite.internal.processors.rest.GridRestResponse;
-import org.apache.ignite.internal.processors.rest.client.message.GridClientTaskResultBean;
 import org.apache.ignite.internal.processors.rest.request.DataStructuresRequest;
 import org.apache.ignite.internal.processors.rest.request.GridRestCacheRequest;
 import org.apache.ignite.internal.processors.rest.request.GridRestLogRequest;
@@ -68,32 +65,30 @@ import static org.apache.ignite.internal.processors.rest.GridRestCommand.EXECUTE
 import static org.apache.ignite.internal.processors.rest.GridRestResponse.STATUS_FAILED;
 
 /**
- * Jetty REST handler. The following URL format is supported:
- * {@code /ignite?cmd=cmdName&param1=abc&param2=123}
+ * Jetty REST handler. The following URL format is supported: {@code /ignite?cmd=cmdName&param1=abc&param2=123}
  */
 public class GridJettyRestHandler extends AbstractHandler {
-    /** JSON value processor that does not transform input object. */
-    private static final JsonValueProcessor SKIP_STR_VAL_PROC = new JsonValueProcessor() {
-        @Override public Object processArrayValue(Object o, JsonConfig jsonConfig) {
-            return o;
-        }
-
-        @Override public Object processObjectValue(String s, Object o, JsonConfig jsonConfig) {
-            return o;
-        }
-    };
+    /** Used to sent request charset. */
+    private static final String CHARSET = StandardCharsets.UTF_8.name();
 
     /** Logger. */
     private final IgniteLogger log;
+
     /** Authentication checker. */
     private final IgniteClosure<String, Boolean> authChecker;
+
     /** Request handlers. */
     private GridRestProtocolHandler hnd;
+
     /** Default page. */
     private volatile String dfltPage;
+
     /** Favicon. */
     private volatile byte[] favicon;
 
+    /** Mapper from Java object to JSON. */
+    private final ObjectMapper jsonMapper;
+
     /**
      * Creates new HTTP requests handler.
      *
@@ -108,6 +103,7 @@ public class GridJettyRestHandler extends AbstractHandler {
         this.hnd = hnd;
         this.log = log;
         this.authChecker = authChecker;
+        this.jsonMapper = new GridJettyObjectMapper();
 
         // Init default page and favicon.
         try {
@@ -137,14 +133,14 @@ public class GridJettyRestHandler extends AbstractHandler {
      * @param key Key.
      * @param params Parameters map.
      * @param dfltVal Default value.
-     * @return Long value from parameters map or {@code dfltVal} if null
-     *     or not exists.
+     * @return Long value from parameters map or {@code dfltVal} if null or not exists.
      * @throws IgniteCheckedException If parsing failed.
      */
-    @Nullable private static Long longValue(String key, Map<String, Object> params, Long dfltVal) throws IgniteCheckedException {
+    @Nullable private static Long longValue(String key, Map<String, Object> params,
+        Long dfltVal) throws IgniteCheckedException {
         assert key != null;
 
-        String val = (String) params.get(key);
+        String val = (String)params.get(key);
 
         try {
             return val == null ? dfltVal : Long.valueOf(val);
@@ -160,17 +156,16 @@ public class GridJettyRestHandler extends AbstractHandler {
      * @param key Key.
      * @param params Parameters map.
      * @param dfltVal Default value.
-     * @return Integer value from parameters map or {@code dfltVal} if null
-     *     or not exists.
+     * @return Integer value from parameters map or {@code dfltVal} if null or not exists.
      * @throws IgniteCheckedException If parsing failed.
      */
-    @Nullable private static Integer intValue(String key, Map<String, Object> params, Integer dfltVal) throws IgniteCheckedException {
+    private static int intValue(String key, Map<String, Object> params, int dfltVal) throws IgniteCheckedException {
         assert key != null;
 
-        String val = (String) params.get(key);
+        String val = (String)params.get(key);
 
         try {
-            return val == null ? dfltVal : Integer.valueOf(val);
+            return val == null ? dfltVal : Integer.parseInt(val);
         }
         catch (NumberFormatException ignore) {
             throw new IgniteCheckedException("Failed to parse parameter of Integer type [" + key + "=" + val + "]");
@@ -182,14 +177,13 @@ public class GridJettyRestHandler extends AbstractHandler {
      *
      * @param key Key.
      * @param params Parameters map.
-     * @return UUID value from parameters map or {@code null} if null
-     *     or not exists.
+     * @return UUID value from parameters map or {@code null} if null or not exists.
      * @throws IgniteCheckedException If parsing failed.
      */
     @Nullable private static UUID uuidValue(String key, Map<String, Object> params) throws IgniteCheckedException {
         assert key != null;
 
-        String val = (String) params.get(key);
+        String val = (String)params.get(key);
 
         try {
             return val == null ? null : UUID.fromString(val);
@@ -208,7 +202,7 @@ public class GridJettyRestHandler extends AbstractHandler {
         InputStream in = getClass().getResourceAsStream("rest.html");
 
         if (in != null) {
-            LineNumberReader rdr = new LineNumberReader(new InputStreamReader(in));
+            LineNumberReader rdr = new LineNumberReader(new InputStreamReader(in, CHARSET));
 
             try {
                 StringBuilder buf = new StringBuilder(2048);
@@ -217,7 +211,7 @@ public class GridJettyRestHandler extends AbstractHandler {
                     buf.append(line);
 
                     if (!line.endsWith(" "))
-                        buf.append(" ");
+                        buf.append(' ');
                 }
 
                 dfltPage = buf.toString();
@@ -368,39 +362,35 @@ public class GridJettyRestHandler extends AbstractHandler {
                 throw (Error)e;
         }
 
-        JsonConfig cfg = new GridJettyJsonConfig(log);
-
-        // Workaround for not needed transformation of string into JSON object.
-        if (cmdRes.getResponse() instanceof String)
-            cfg.registerJsonValueProcessor(cmdRes.getClass(), "response", SKIP_STR_VAL_PROC);
-
-        // Workaround for not needed transformation of result field string into JSON object at GridClientTaskResultBean.
-        if (cmdRes.getResponse() instanceof GridClientTaskResultBean
-            && ((GridClientTaskResultBean)cmdRes.getResponse()).getResult() instanceof String)
-            cfg.registerJsonValueProcessor(cmdRes.getResponse().getClass(), "result", SKIP_STR_VAL_PROC);
-
-        JSON json;
+        String json;
 
         try {
-            json = JSONSerializer.toJSON(cmdRes, cfg);
+            json = jsonMapper.writeValueAsString(cmdRes);
         }
-        catch (JSONException e) {
-            U.error(log, "Failed to convert response to JSON: " + cmdRes, e);
+        catch (JsonProcessingException e1) {
+            U.error(log, "Failed to convert response to JSON: " + cmdRes, e1);
+
+            GridRestResponse resFailed = new GridRestResponse(STATUS_FAILED, e1.getMessage());
 
-            json = JSONSerializer.toJSON(new GridRestResponse(STATUS_FAILED, e.getMessage()), cfg);
+            try {
+                json = jsonMapper.writeValueAsString(resFailed);
+            }
+            catch (JsonProcessingException e2) {
+                json = "{\"successStatus\": \"1\", \"error:\" \"" + e2.getMessage() + "\"}}";
+            }
         }
 
         try {
             if (log.isDebugEnabled())
-                log.debug("Parsed command response into JSON object: " + json.toString(2));
+                log.debug("Parsed command response into JSON object: " + json);
 
-            res.getWriter().write(json.toString());
+            res.getWriter().write(json);
 
             if (log.isDebugEnabled())
                 log.debug("Processed HTTP request [action=" + act + ", jsonRes=" + cmdRes + ", req=" + req + ']');
         }
         catch (IOException e) {
-            U.error(log, "Failed to send HTTP response: " + json.toString(2), e);
+            U.error(log, "Failed to send HTTP response: " + json, e);
         }
     }
 
@@ -510,10 +500,10 @@ public class GridJettyRestHandler extends AbstractHandler {
             case NODE: {
                 GridRestTopologyRequest restReq0 = new GridRestTopologyRequest();
 
-                restReq0.includeMetrics(Boolean.parseBoolean((String) params.get("mtr")));
-                restReq0.includeAttributes(Boolean.parseBoolean((String) params.get("attr")));
+                restReq0.includeMetrics(Boolean.parseBoolean((String)params.get("mtr")));
+                restReq0.includeAttributes(Boolean.parseBoolean((String)params.get("attr")));
 
-                restReq0.nodeIp((String) params.get("ip"));
+                restReq0.nodeIp((String)params.get("ip"));
 
                 restReq0.nodeId(uuidValue("id", params));
 
@@ -527,12 +517,12 @@ public class GridJettyRestHandler extends AbstractHandler {
             case NOOP: {
                 GridRestTaskRequest restReq0 = new GridRestTaskRequest();
 
-                restReq0.taskId((String) params.get("id"));
-                restReq0.taskName((String) params.get("name"));
+                restReq0.taskId((String)params.get("id"));
+                restReq0.taskName((String)params.get("name"));
 
                 restReq0.params(values("p", params));
 
-                restReq0.async(Boolean.parseBoolean((String) params.get("async")));
+                restReq0.async(Boolean.parseBoolean((String)params.get("async")));
 
                 restReq0.timeout(longValue("timeout", params, 0L));
 
@@ -544,7 +534,7 @@ public class GridJettyRestHandler extends AbstractHandler {
             case LOG: {
                 GridRestLogRequest restReq0 = new GridRestLogRequest();
 
-                restReq0.path((String) params.get("path"));
+                restReq0.path((String)params.get("path"));
 
                 restReq0.from(intValue("from", params, -1));
                 restReq0.to(intValue("to", params, -1));
@@ -569,9 +559,9 @@ public class GridJettyRestHandler extends AbstractHandler {
 
                 restReq0.arguments(values("arg", params).toArray());
 
-                restReq0.typeName((String) params.get("type"));
+                restReq0.typeName((String)params.get("type"));
 
-                String pageSize = (String) params.get("pageSize");
+                String pageSize = (String)params.get("pageSize");
 
                 if (pageSize != null)
                     restReq0.pageSize(Integer.parseInt(pageSize));
@@ -612,7 +602,7 @@ public class GridJettyRestHandler extends AbstractHandler {
             case FETCH_SQL_QUERY: {
                 RestQueryRequest restReq0 = new RestQueryRequest();
 
-                String qryId = (String) params.get("qryId");
+                String qryId = (String)params.get("qryId");
 
                 if (qryId != null)
                     restReq0.queryId(Long.parseLong(qryId));
@@ -632,7 +622,7 @@ public class GridJettyRestHandler extends AbstractHandler {
             case CLOSE_SQL_QUERY: {
                 RestQueryRequest restReq0 = new RestQueryRequest();
 
-                String qryId = (String) params.get("qryId");
+                String qryId = (String)params.get("qryId");
 
                 if (qryId != null)
                     restReq0.queryId(Long.parseLong(qryId));
@@ -659,7 +649,7 @@ public class GridJettyRestHandler extends AbstractHandler {
             restReq.credentials(cred);
         }
 
-        String clientId = (String) params.get("clientId");
+        String clientId = (String)params.get("clientId");
 
         try {
             if (clientId != null)
@@ -669,7 +659,7 @@ public class GridJettyRestHandler extends AbstractHandler {
             // Ignore invalid client id. Rest handler will process this logic.
         }
 
-        String destId = (String) params.get("destId");
+        String destId = (String)params.get("destId");
 
         try {
             if (destId != null)
@@ -679,7 +669,7 @@ public class GridJettyRestHandler extends AbstractHandler {
             // Don't fail - try to execute locally.
         }
 
-        String sesTokStr = (String) params.get("sessionToken");
+        String sesTokStr = (String)params.get("sessionToken");
 
         try {
             if (sesTokStr != null)
@@ -699,7 +689,7 @@ public class GridJettyRestHandler extends AbstractHandler {
      * @param params Parameters map.
      * @return Values.
      */
-    @Nullable protected List<Object> values(String keyPrefix, Map<String, Object> params) {
+    protected List<Object> values(String keyPrefix, Map<String, Object> params) {
         assert keyPrefix != null;
 
         List<Object> vals = new LinkedList<>();
@@ -720,15 +710,14 @@ public class GridJettyRestHandler extends AbstractHandler {
      * @param req Request.
      * @return Command.
      */
-    @Nullable GridRestCommand command(ServletRequest req) {
+    @Nullable private GridRestCommand command(ServletRequest req) {
         String cmd = req.getParameter("cmd");
 
         return cmd == null ? null : GridRestCommand.fromKey(cmd.toLowerCase());
     }
 
     /**
-     * Parses HTTP parameters in an appropriate format and return back map of
-     * values to predefined list of names.
+     * Parses HTTP parameters in an appropriate format and return back map of values to predefined list of names.
      *
      * @param req Request.
      * @return Map of parsed parameters.

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index c493248..662ab55 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -74,6 +74,7 @@
         <httpclient.version>4.5.1</httpclient.version>
         <httpcore.version>4.4.3</httpcore.version>
         <jackson.version>1.9.13</jackson.version>
+        <jackson2.version>2.7.4</jackson2.version>
         <javax.cache.bundle.version>1.0.0_1</javax.cache.bundle.version>
         <javax.cache.version>1.0.0</javax.cache.version>
         <jetty.version>9.2.11.v20150529</jetty.version>


[4/4] ignite git commit: IGNITE-3277-preview

Posted by ak...@apache.org.
IGNITE-3277-preview


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ee0a40e0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ee0a40e0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ee0a40e0

Branch: refs/heads/ignite-3277-preview
Commit: ee0a40e0dcbffca22dfa44728141b2f6d81880a1
Parents: 54bd923
Author: AKuznetsov <ak...@gridgain.com>
Authored: Mon Jun 20 22:58:37 2016 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Mon Jun 20 22:58:37 2016 +0700

----------------------------------------------------------------------
 modules/clients/pom.xml                         |   8 -
 .../client/ClientDefaultCacheSelfTest.java      | 119 ++-
 .../ignite/internal/client/ClientHttpTask.java  |  33 +-
 .../ignite/internal/client/ClientTcpTask.java   |  10 +-
 .../integration/ClientAbstractSelfTest.java     |  92 +-
 .../JettyRestProcessorAbstractSelfTest.java     | 982 ++++++++-----------
 .../internal/processors/rest/SimplePerson.java  |  59 ++
 modules/core/pom.xml                            |  15 +-
 .../apache/ignite/internal/LessNamingBean.java  |  28 +
 .../cache/query/GridCacheSqlIndexMetadata.java  |   3 +-
 .../cache/query/GridCacheSqlMetadata.java       |   3 +-
 .../internal/util/IgniteExceptionRegistry.java  |   3 +-
 .../ignite/internal/visor/cache/VisorCache.java |   4 +-
 .../cache/VisorCacheAffinityConfiguration.java  |   3 +-
 .../cache/VisorCacheAggregatedMetrics.java      |   3 +-
 .../visor/cache/VisorCacheConfiguration.java    |   3 +-
 .../cache/VisorCacheDefaultConfiguration.java   |   3 +-
 .../cache/VisorCacheEvictionConfiguration.java  |   3 +-
 .../internal/visor/cache/VisorCacheMetrics.java |   3 +-
 .../cache/VisorCacheNearConfiguration.java      |   3 +-
 .../visor/cache/VisorCachePartition.java        |   3 +-
 .../visor/cache/VisorCachePartitions.java       |   3 +-
 .../cache/VisorCacheQueryConfiguration.java     |   3 +-
 .../visor/cache/VisorCacheQueryMetrics.java     |   3 +-
 .../cache/VisorCacheRebalanceConfiguration.java |   3 +-
 .../cache/VisorCacheStoreConfiguration.java     |   3 +-
 .../cache/VisorCacheTypeFieldMetadata.java      |   3 +-
 .../visor/cache/VisorCacheTypeMetadata.java     |   3 +-
 .../internal/visor/cache/VisorCacheV4.java      | 124 +++
 .../internal/visor/debug/VisorThreadInfo.java   |   3 +-
 .../visor/debug/VisorThreadLockInfo.java        |   3 +-
 .../internal/visor/event/VisorGridEvent.java    |   3 +-
 .../internal/visor/file/VisorFileBlock.java     |   3 +-
 .../ignite/internal/visor/igfs/VisorIgfs.java   |   3 +-
 .../internal/visor/igfs/VisorIgfsEndpoint.java  |   3 +-
 .../internal/visor/igfs/VisorIgfsMetrics.java   |   3 +-
 .../visor/igfs/VisorIgfsProfilerEntry.java      |   3 +-
 .../VisorIgfsProfilerUniformityCounters.java    |   3 +-
 .../visor/log/VisorLogSearchResult.java         |   3 +-
 .../visor/node/VisorAtomicConfiguration.java    |   3 +-
 .../visor/node/VisorBasicConfiguration.java     |   3 +-
 .../node/VisorExecutorServiceConfiguration.java |   3 +-
 .../visor/node/VisorGridConfiguration.java      |   3 +-
 .../visor/node/VisorIgfsConfiguration.java      |   3 +-
 .../visor/node/VisorLifecycleConfiguration.java |   3 +-
 .../visor/node/VisorMetricsConfiguration.java   |   3 +-
 .../visor/node/VisorNodeDataCollectorJob.java   |  26 +-
 .../node/VisorNodeDataCollectorTaskResult.java  |   3 +-
 .../node/VisorPeerToPeerConfiguration.java      |   3 +-
 .../visor/node/VisorRestConfiguration.java      |   3 +-
 .../node/VisorSegmentationConfiguration.java    |   3 +-
 .../visor/node/VisorSpisConfiguration.java      |   3 +-
 .../node/VisorTransactionConfiguration.java     |   3 +-
 .../internal/visor/query/VisorQueryField.java   |   3 +-
 .../internal/visor/query/VisorQueryResult.java  |   3 +-
 .../plugin/security/SecurityPermissionSet.java  |   3 +-
 .../ignite/plugin/security/SecuritySubject.java |   3 +-
 modules/rest-http/pom.xml                       |  25 +-
 .../http/jetty/GridJettyJsonConfig.java         | 317 ------
 .../http/jetty/GridJettyObjectMapper.java       | 259 +++++
 .../http/jetty/GridJettyRestHandler.java        | 127 ++-
 parent/pom.xml                                  |   1 +
 62 files changed, 1223 insertions(+), 1141 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/clients/pom.xml
----------------------------------------------------------------------
diff --git a/modules/clients/pom.xml b/modules/clients/pom.xml
index 5b328e0..fa25d18 100644
--- a/modules/clients/pom.xml
+++ b/modules/clients/pom.xml
@@ -83,14 +83,6 @@
         </dependency>
 
         <dependency>
-            <groupId>net.sf.json-lib</groupId>
-            <artifactId>json-lib</artifactId>
-            <version>2.4</version>
-            <classifier>jdk15</classifier>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
             <groupId>org.apache.ignite</groupId>
             <artifactId>ignite-core</artifactId>
             <version>${project.version}</version>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientDefaultCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientDefaultCacheSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientDefaultCacheSelfTest.java
index f910b7d..09f99fd 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientDefaultCacheSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientDefaultCacheSelfTest.java
@@ -17,20 +17,26 @@
 
 package org.apache.ignite.internal.client;
 
-import java.io.BufferedReader;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.io.LineNumberReader;
 import java.net.URL;
 import java.net.URLConnection;
+import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.Collection;
+import java.util.Map;
 import java.util.UUID;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.ConnectorConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.processors.rest.GridRestCommand;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
@@ -58,7 +64,7 @@ public class ClientDefaultCacheSelfTest extends GridCommonAbstractTest {
     private static final int HTTP_PORT = 8081;
 
     /** Url address to send HTTP request. */
-    private static final String TEST_URL = "http://" + HOST + ":" + HTTP_PORT + "/ignite";
+    private static final String TEST_URL = "http://" + HOST + ":" + HTTP_PORT + "/ignite?";
 
     /** Used to sent request charset. */
     private static final String CHARSET = StandardCharsets.UTF_8.name();
@@ -66,6 +72,9 @@ public class ClientDefaultCacheSelfTest extends GridCommonAbstractTest {
     /** Name of node local cache. */
     private static final String LOCAL_CACHE = "local";
 
+    /** JSON to java mapper. */
+    private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
+
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
         System.setProperty(IGNITE_JETTY_PORT, String.valueOf(HTTP_PORT));
@@ -103,77 +112,95 @@ public class ClientDefaultCacheSelfTest extends GridCommonAbstractTest {
 
         cfg.setDiscoverySpi(disco);
 
-        CacheConfiguration cLocal = new CacheConfiguration();
+        CacheConfiguration cLoc = new CacheConfiguration();
 
-        cLocal.setName(LOCAL_CACHE);
+        cLoc.setName(LOCAL_CACHE);
 
-        cLocal.setCacheMode(CacheMode.LOCAL);
+        cLoc.setCacheMode(CacheMode.LOCAL);
 
-        cLocal.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+        cLoc.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
 
-        cfg.setCacheConfiguration(defaultCacheConfiguration(), cLocal);
+        cfg.setCacheConfiguration(defaultCacheConfiguration(), cLoc);
 
         return cfg;
     }
 
     /**
-     * Builds list of connection strings with few different ports.
-     * Used to avoid possible failures in case of port range active.
-     *
-     * @param startPort Port to start list from.
-     * @return List of client connection strings.
-     */
-    private Collection<String> getServerList(int startPort) {
-        Collection<String> srvs = new ArrayList<>();
-
-        for (int i = startPort; i < startPort + 10; i++)
-            srvs.add(HOST + ":" + i);
-
-        return srvs;
-    }
-
-    /*
      * Send HTTP request to Jetty server of node and process result.
      *
-     * @param query Send query parameters.
+     * @param params Command parameters.
      * @return Processed response string.
+     * @throws IOException If failed.
      */
-    private String sendHttp(String query) {
-        String res = "No result";
+    private String content(Map<String, String> params) throws IOException {
+        SB sb = new SB(TEST_URL);
+
+        for (Map.Entry<String, String> e : params.entrySet())
+            sb.a(e.getKey()).a('=').a(e.getValue()).a('&');
+
+        String qry = sb.toString();
 
         try {
-            URLConnection connection = new URL(TEST_URL + "?" + query).openConnection();
+            URL url = new URL(qry);
 
-            connection.setRequestProperty("Accept-Charset", CHARSET);
+            URLConnection conn = url.openConnection();
 
-            BufferedReader r = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+            conn.setRequestProperty("Accept-Charset", CHARSET);
 
-            res = r.readLine();
+            InputStream in = conn.getInputStream();
 
-            r.close();
+            StringBuilder buf = new StringBuilder(256);
+
+            try (LineNumberReader rdr = new LineNumberReader(new InputStreamReader(in, "UTF-8"))) {
+                for (String line = rdr.readLine(); line != null; line = rdr.readLine())
+                    buf.append(line);
+            }
+
+            return buf.toString();
         }
         catch (IOException e) {
-            error("Failed to send HTTP request: " + TEST_URL + "?" + query, e);
+            error("Failed to send HTTP request: " + TEST_URL + "?" + qry, e);
+
+            throw e;
         }
+    }
+
+    /**
+     * @param content Content to check.
+     */
+    private JsonNode jsonResponse(String content) throws IOException {
+        assertNotNull(content);
+        assertFalse(content.isEmpty());
+
+        JsonNode node = JSON_MAPPER.readTree(content);
+
+        assertFalse(node.get("affinityNodeId").asText().isEmpty());
+        assertEquals(0, node.get("successStatus").asInt());
+        assertTrue(node.get("error").asText().isEmpty());
+        assertTrue(node.get("sessionToken").asText().isEmpty());
 
-        // Cut node id from response.
-        return res.substring(res.indexOf("\"response\""));
+        return node.get("response");
     }
 
     /**
      * Json format string in cache should not transform to Json object on get request.
      */
-    public void testSkipString2JsonTransformation() {
+    public void testSkipString2JsonTransformation() throws Exception {
+        String val = "{\"v\":\"my Value\",\"t\":1422559650154}";
+
         // Put to cache JSON format string value.
-        assertEquals("Incorrect query response", "\"response\":true,\"sessionToken\":\"\",\"successStatus\":0}",
-            sendHttp("cmd=put&cacheName=" + LOCAL_CACHE +
-                "&key=a&val=%7B%22v%22%3A%22my%20Value%22%2C%22t%22%3A1422559650154%7D"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT.key(), "cacheName", LOCAL_CACHE,
+            "key", "a", "val", URLEncoder.encode(val, CHARSET)));
+
+        JsonNode res = jsonResponse(ret);
+
+        assertEquals("Incorrect put response", true, res.asBoolean());
 
         // Escape '\' symbols disappear from response string on transformation to JSON object.
-        assertEquals(
-            "Incorrect query response",
-            "\"response\":\"{\\\"v\\\":\\\"my Value\\\",\\\"t\\\":1422559650154}\"," +
-                "\"sessionToken\":\"\",\"successStatus\":0}",
-            sendHttp("cmd=get&cacheName=" + LOCAL_CACHE + "&key=a"));
+        ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "cacheName", LOCAL_CACHE, "key", "a"));
+
+        res = jsonResponse(ret);
+
+        assertEquals("Incorrect get response", val, res.asText());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientHttpTask.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientHttpTask.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientHttpTask.java
index 9604c29..977a1eb 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientHttpTask.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientHttpTask.java
@@ -17,12 +17,13 @@
 
 package org.apache.ignite.internal.client;
 
+import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
-import net.sf.json.JSON;
-import net.sf.json.JSONArray;
-import net.sf.json.JSONSerializer;
-import net.sf.json.JsonConfig;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.ignite.IgniteException;
 import org.apache.ignite.compute.ComputeJob;
 import org.apache.ignite.compute.ComputeJobResult;
 import org.apache.ignite.compute.ComputeJobResultPolicy;
@@ -40,14 +41,28 @@ public class ClientHttpTask extends ComputeTaskSplitAdapter<String, Integer> {
     /** Task delegate. */
     private final ClientTcpTask delegate = new ClientTcpTask();
 
+    /** JSON to java mapper. */
+    private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
+
     /** {@inheritDoc} */
     @Override protected Collection<? extends ComputeJob> split(int gridSize, String arg) {
-        JSON json = JSONSerializer.toJSON(arg);
+        try {
+            JsonNode json = JSON_MAPPER.readTree(arg);
+
+            List<String> list = null;
+
+            if (json.isArray()) {
+                list = new ArrayList<>();
 
-        List list = json.isArray() ? JSONArray.toList((JSONArray)json, String.class, new JsonConfig()) : null;
+                for (JsonNode child : json)
+                    list.add(child.asText());
+            }
 
-        //noinspection unchecked
-        return delegate.split(gridSize, list);
+            return delegate.split(gridSize, list);
+        }
+        catch (IOException e) {
+            throw new IgniteException(e);
+        }
     }
 
     /** {@inheritDoc} */
@@ -62,4 +77,4 @@ public class ClientHttpTask extends ComputeTaskSplitAdapter<String, Integer> {
 
         return WAIT;
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpTask.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpTask.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpTask.java
index 8458c0e..54a58e6 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpTask.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpTask.java
@@ -34,13 +34,13 @@ import static org.apache.ignite.compute.ComputeJobResultPolicy.WAIT;
  * <p>
  * The argument of the task is a collection of objects to calculate string length sum of.
  */
-public class ClientTcpTask extends ComputeTaskSplitAdapter<List<Object>, Integer> {
+public class ClientTcpTask extends ComputeTaskSplitAdapter<List<String>, Integer> {
     /** {@inheritDoc} */
-    @Override protected Collection<? extends ComputeJob> split(int gridSize, List<Object> list) {
+    @Override protected Collection<? extends ComputeJob> split(int gridSize, List<String> list) {
         Collection<ComputeJobAdapter> jobs = new ArrayList<>();
 
         if (list != null)
-            for (final Object val : list)
+            for (final String val : list)
                 jobs.add(new ComputeJobAdapter() {
                     @Override public Object execute() {
                         try {
@@ -50,7 +50,7 @@ public class ClientTcpTask extends ComputeTaskSplitAdapter<List<Object>, Integer
                             Thread.currentThread().interrupt();
                         }
 
-                        return val == null ? 0 : val.toString().length();
+                        return val == null ? 0 : val.length();
                     }
                 });
 
@@ -74,4 +74,4 @@ public class ClientTcpTask extends ComputeTaskSplitAdapter<List<Object>, Integer
 
         return WAIT;
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
index 125603e..3fbd570 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
@@ -17,9 +17,11 @@
 
 package org.apache.ignite.internal.client.integration;
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -31,12 +33,12 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.atomic.AtomicInteger;
+import javax.cache.Cache;
 import javax.cache.configuration.Factory;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import junit.framework.Assert;
-import net.sf.json.JSON;
-import net.sf.json.JSONArray;
-import net.sf.json.JSONSerializer;
-import net.sf.json.JsonConfig;
+import org.apache.ignite.IgniteException;
 import org.apache.ignite.cache.store.CacheStore;
 import org.apache.ignite.cache.store.CacheStoreAdapter;
 import org.apache.ignite.compute.ComputeJob;
@@ -246,8 +248,8 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
             cacheConfiguration("partitioned"), cacheConfiguration(CACHE_NAME));
 
         clientCfg.setMessageInterceptor(new ConnectorMessageInterceptor() {
-            @Override
-            public Object onReceive(@Nullable Object obj) {
+            /** {@inheritDoc} */
+            @Override public Object onReceive(@Nullable Object obj) {
                 if (obj != null)
                     INTERCEPTED_OBJECTS.put(obj, obj);
 
@@ -255,8 +257,8 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
                     obj + INTERCEPTED_SUF : obj;
             }
 
-            @Override
-            public Object onSend(Object obj) {
+            /** {@inheritDoc} */
+            @Override public Object onSend(Object obj) {
                 if (obj != null)
                     INTERCEPTED_OBJECTS.put(obj, obj);
 
@@ -332,7 +334,7 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
         cfg.setDataConfigurations(Arrays.asList(nullCache, cache));
 
         cfg.setProtocol(protocol());
-        cfg.setServers(Arrays.asList(serverAddress()));
+        cfg.setServers(Collections.singleton(serverAddress()));
 
         // Setting custom executor, to avoid failures on client shutdown.
         // And applying custom naming scheme to ease debugging.
@@ -390,9 +392,9 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
         futs.put("put", data.putAsync("key", "val"));
         futs.put("putAll", data.putAllAsync(F.asMap("key", "val")));
         futs.put("get", data.getAsync("key"));
-        futs.put("getAll", data.getAllAsync(Arrays.asList("key")));
+        futs.put("getAll", data.getAllAsync(Collections.singletonList("key")));
         futs.put("remove", data.removeAsync("key"));
-        futs.put("removeAll", data.removeAllAsync(Arrays.asList("key")));
+        futs.put("removeAll", data.removeAllAsync(Collections.singletonList("key")));
         futs.put("replace", data.replaceAsync("key", "val"));
         futs.put("cas", data.casAsync("key", "val", "val2"));
         futs.put("metrics", data.metricsAsync());
@@ -500,8 +502,8 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
 
         GridClientCompute compute = client.compute();
 
-        Assert.assertEquals(new Integer(17), compute.execute(taskName, taskArg));
-        Assert.assertEquals(new Integer(17), compute.executeAsync(taskName, taskArg).get());
+        Assert.assertEquals(17, compute.execute(taskName, taskArg));
+        Assert.assertEquals(17, compute.executeAsync(taskName, taskArg).get());
     }
 
     /**
@@ -570,13 +572,13 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
     /**
      * Test task.
      */
-    private static class TestTask extends ComputeTaskSplitAdapter<List<Object>, Integer> {
+    private static class TestTask extends ComputeTaskSplitAdapter<List<String>, Integer> {
         /** {@inheritDoc} */
-        @Override protected Collection<? extends ComputeJob> split(int gridSize, List<Object> list) {
+        @Override protected Collection<? extends ComputeJob> split(int gridSize, List<String> list) {
             Collection<ComputeJobAdapter> jobs = new ArrayList<>();
 
             if (list != null)
-                for (final Object val : list)
+                for (final String val : list)
                     jobs.add(new ComputeJobAdapter() {
                         @Override public Object execute() {
                             try {
@@ -586,7 +588,7 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
                                 Thread.currentThread().interrupt();
                             }
 
-                            return val == null ? 0 : val.toString().length();
+                            return val == null ? 0 : val.length();
                         }
                     });
 
@@ -607,20 +609,20 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
     /**
      * Test task that sleeps 5 seconds.
      */
-    private static class SleepTestTask extends ComputeTaskSplitAdapter<List<Object>, Integer> {
+    private static class SleepTestTask extends ComputeTaskSplitAdapter<List<String>, Integer> {
         /** {@inheritDoc} */
-        @Override protected Collection<? extends ComputeJob> split(int gridSize, List<Object> list)
+        @Override protected Collection<? extends ComputeJob> split(int gridSize, List<String> list)
             {
             Collection<ComputeJobAdapter> jobs = new ArrayList<>();
 
             if (list != null)
-                for (final Object val : list)
+                for (final String val : list)
                     jobs.add(new ComputeJobAdapter() {
                         @Override public Object execute() {
                             try {
                                 Thread.sleep(5000);
 
-                                return val == null ? 0 : val.toString().length();
+                                return val == null ? 0 : val.length();
                             }
                             catch (InterruptedException ignored) {
                                 return -1;
@@ -642,10 +644,14 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
         }
     }
 
+    /** JSON to java mapper. */
+    private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
+
     /**
      * Http test task with restriction to string arguments only.
      */
     protected static class HttpTestTask extends ComputeTaskSplitAdapter<String, Integer> {
+        /** */
         private final TestTask delegate = new TestTask();
 
         /** {@inheritDoc} */
@@ -654,11 +660,23 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
             if (arg.endsWith("intercepted"))
                 arg = arg.substring(0, arg.length() - 11);
 
-            JSON json = JSONSerializer.toJSON(arg);
+            try {
+                JsonNode json = JSON_MAPPER.readTree(arg);
+
+                List<String> list = null;
 
-            List list = json.isArray() ? JSONArray.toList((JSONArray)json, String.class, new JsonConfig()) : null;
+                if (json.isArray()) {
+                    list = new ArrayList<>();
 
-            return delegate.split(gridSize, list);
+                    for (JsonNode child : json)
+                        list.add(child.asText());
+                }
+
+                return delegate.split(gridSize, list);
+            }
+            catch (IOException e) {
+                throw new IgniteException(e);
+            }
         }
 
         /** {@inheritDoc} */
@@ -671,16 +689,29 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
      * Http wrapper for sleep task.
      */
     protected static class SleepHttpTestTask extends ComputeTaskSplitAdapter<String, Integer> {
+        /** */
         private final SleepTestTask delegate = new SleepTestTask();
 
         /** {@inheritDoc} */
         @SuppressWarnings("unchecked")
         @Override protected Collection<? extends ComputeJob> split(int gridSize, String arg) {
-            JSON json = JSONSerializer.toJSON(arg);
+            try {
+                JsonNode json = JSON_MAPPER.readTree(arg);
+
+                List<String> list = null;
 
-            List list = json.isArray() ? JSONArray.toList((JSONArray)json, String.class, new JsonConfig()) : null;
+                if (json.isArray()) {
+                    list = new ArrayList<>();
+
+                    for (JsonNode child : json)
+                        list.add(child.asText());
+                }
 
-            return delegate.split(gridSize, list);
+                return delegate.split(gridSize, list);
+            }
+            catch (IOException e) {
+                throw new IgniteException(e);
+            }
         }
 
         /** {@inheritDoc} */
@@ -698,9 +729,8 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
 
         /** {@inheritDoc} */
         @Override public void loadCache(IgniteBiInClosure<Object, Object> clo, Object... args) {
-            for (Map.Entry e : map.entrySet()) {
+            for (Map.Entry e : map.entrySet())
                 clo.apply(e.getKey(), e.getValue());
-            }
         }
 
         /** {@inheritDoc} */
@@ -709,7 +739,7 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
         }
 
         /** {@inheritDoc} */
-        @Override public void write(javax.cache.Cache.Entry<? extends Object, ? extends Object> e) {
+        @Override public void write(Cache.Entry<?, ?> e) {
             map.put(e.getKey(), e.getValue());
         }
 
@@ -718,4 +748,4 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
             map.remove(key);
         }
     }
-}
\ No newline at end of file
+}


[2/4] ignite git commit: IGNITE-3277-preview

Posted by ak...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java
index efebfe5..5aeb92a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java
@@ -19,12 +19,13 @@ package org.apache.ignite.internal.visor.cache;
 
 import java.io.Serializable;
 import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Data transfer object for default cache configuration properties.
  */
-public class VisorCacheDefaultConfiguration implements Serializable {
+public class VisorCacheDefaultConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheEvictionConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheEvictionConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheEvictionConfiguration.java
index db216e0..ace9a90 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheEvictionConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheEvictionConfiguration.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.visor.cache;
 import java.io.Serializable;
 import org.apache.ignite.cache.eviction.EvictionPolicy;
 import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.jetbrains.annotations.Nullable;
 
@@ -29,7 +30,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.evictionPolic
 /**
  * Data transfer object for eviction configuration properties.
  */
-public class VisorCacheEvictionConfiguration implements Serializable {
+public class VisorCacheEvictionConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
index c658871..1204cbc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
@@ -22,13 +22,14 @@ import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CacheMetrics;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Data transfer object for {@link CacheMetrics}.
  */
-public class VisorCacheMetrics implements Serializable {
+public class VisorCacheMetrics implements Serializable, LessNamingBean {
     /** */
     private static final float MICROSECONDS_IN_SECOND = 1_000_000;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
index 23195e6..ff49fc9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.visor.cache;
 import java.io.Serializable;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.processors.cache.GridCacheUtils;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.jetbrains.annotations.Nullable;
@@ -30,7 +31,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.evictionPolic
 /**
  * Data transfer object for near cache configuration properties.
  */
-public class VisorCacheNearConfiguration implements Serializable {
+public class VisorCacheNearConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java
index 5909c1a..a6c0839 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java
@@ -18,12 +18,13 @@
 package org.apache.ignite.internal.visor.cache;
 
 import java.io.Serializable;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Data transfer object for information about keys in cache partition.
  */
-public class VisorCachePartition implements Serializable {
+public class VisorCachePartition implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java
index 4634fa6..af48825 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java
@@ -20,12 +20,13 @@ package org.apache.ignite.internal.visor.cache;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Data transfer object for information about cache partitions.
  */
-public class VisorCachePartitions implements Serializable {
+public class VisorCachePartitions implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java
index 73088bc..e0d1e72 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java
@@ -19,12 +19,13 @@ package org.apache.ignite.internal.visor.cache;
 
 import java.io.Serializable;
 import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.U;
 
 /**
  * Data transfer object for cache query configuration data.
  */
-public class VisorCacheQueryConfiguration implements Serializable {
+public class VisorCacheQueryConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java
index ffbe585..4e88c5a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java
@@ -19,12 +19,13 @@ package org.apache.ignite.internal.visor.cache;
 
 import java.io.Serializable;
 import org.apache.ignite.cache.query.QueryMetrics;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Data transfer object for cache query metrics.
  */
-public class VisorCacheQueryMetrics implements Serializable {
+public class VisorCacheQueryMetrics implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java
index d2dd32e..99f6196 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java
@@ -20,12 +20,13 @@ package org.apache.ignite.internal.visor.cache;
 import java.io.Serializable;
 import org.apache.ignite.cache.CacheRebalanceMode;
 import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Data transfer object for cache rebalance configuration properties.
  */
-public class VisorCacheRebalanceConfiguration implements Serializable {
+public class VisorCacheRebalanceConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
index 2ba1b57..5d3e1e1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
@@ -22,6 +22,7 @@ import org.apache.ignite.cache.store.CacheStore;
 import org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.jetbrains.annotations.Nullable;
@@ -31,7 +32,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
 /**
  * Data transfer object for cache store configuration properties.
  */
-public class VisorCacheStoreConfiguration implements Serializable {
+public class VisorCacheStoreConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java
index 323e536..f3dffd6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java
@@ -19,12 +19,13 @@ package org.apache.ignite.internal.visor.cache;
 
 import java.io.Serializable;
 import org.apache.ignite.cache.CacheTypeFieldMetadata;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.U;
 
 /**
  * Data transfer object for {@link CacheTypeFieldMetadata}.
  */
-public class VisorCacheTypeFieldMetadata implements Serializable {
+public class VisorCacheTypeFieldMetadata implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
index ec7a114..4e38d81 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
@@ -30,6 +30,7 @@ import org.apache.ignite.cache.QueryIndex;
 import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory;
 import org.apache.ignite.cache.store.jdbc.JdbcType;
 import org.apache.ignite.cache.store.jdbc.JdbcTypeField;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
@@ -39,7 +40,7 @@ import javax.cache.configuration.Factory;
 /**
  * Data transfer object for {@link CacheTypeMetadata}.
  */
-public class VisorCacheTypeMetadata implements Serializable {
+public class VisorCacheTypeMetadata implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV4.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV4.java
new file mode 100644
index 0000000..81dbacb
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV4.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.cache;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
+import org.apache.ignite.internal.processors.cache.GridCacheSwapManager;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * Data transfer object for {@link IgniteCache}.
+ */
+public class VisorCacheV4 extends VisorCacheV2 {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Number of primary entries in offheap. */
+    private int offHeapPrimaryEntriesCnt;
+
+    /** Number of backup entries in offheap. */
+    private int offHeapBackupEntriesCnt;
+
+    /** Number of primary entries in swap. */
+    private int swapPrimaryEntriesCnt;
+
+    /** Number of backup entries in swap. */
+    private int swapBackupEntriesCnt;
+
+    /** {@inheritDoc} */
+    @Override public VisorCache from(IgniteEx ignite, String cacheName, int sample) throws IgniteCheckedException {
+        VisorCache c = super.from(ignite, cacheName, sample);
+
+        if (c != null && c instanceof VisorCacheV4) {
+            VisorCacheV4 cacheV4 = (VisorCacheV4)c;
+
+            GridCacheAdapter ca = ignite.context().cache().internalCache(cacheName);
+
+            // Process only started caches.
+            if (ca != null && ca.context().started()) {
+                GridCacheSwapManager swap = ca.context().swap();
+
+                cacheV4.offHeapPrimaryEntriesCnt = swap.offheapEntriesCount(true, false, AffinityTopologyVersion.NONE);
+                cacheV4.offHeapBackupEntriesCnt = swap.offheapEntriesCount(false, true, AffinityTopologyVersion.NONE);
+
+                cacheV4.swapPrimaryEntriesCnt = swap.swapEntriesCount(true, false, AffinityTopologyVersion.NONE);
+                cacheV4.swapBackupEntriesCnt = swap.swapEntriesCount(false, true, AffinityTopologyVersion.NONE);
+            }
+        }
+
+        return c;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected VisorCache initHistory(VisorCache c) {
+        super.initHistory(c);
+
+        if (c instanceof VisorCacheV4) {
+            VisorCacheV4 cacheV4 = (VisorCacheV4)c;
+
+            cacheV4.offHeapPrimaryEntriesCnt = offHeapPrimaryEntriesCnt;
+            cacheV4.offHeapBackupEntriesCnt = offHeapBackupEntriesCnt;
+            cacheV4.swapPrimaryEntriesCnt = swapPrimaryEntriesCnt;
+            cacheV4.swapBackupEntriesCnt = swapBackupEntriesCnt;
+        }
+
+        return c;
+    }
+
+    /** {@inheritDoc} */
+    @Override public VisorCache history() {
+        return initHistory(new VisorCacheV3());
+    }
+
+    /**
+     * @return Off-heap heap primary entries count.
+     */
+    public int offHeapPrimaryEntriesCount() {
+        return offHeapPrimaryEntriesCnt;
+    }
+
+    /**
+     * @return Off-heap heap backup entries count.
+     */
+    public int offHeapBackupEntriesCount() {
+        return offHeapBackupEntriesCnt;
+    }
+
+    /**
+     * @return Swap primary entries count.
+     */
+    public int swapPrimaryEntriesCount() {
+        return swapPrimaryEntriesCnt;
+    }
+
+    /**
+     * @return Swap backup entries count.
+     */
+    public int swapBackupEntriesCount() {
+        return swapBackupEntriesCnt;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorCacheV4.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java
index 3671bcd..84d15eb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java
@@ -19,11 +19,12 @@ package org.apache.ignite.internal.visor.debug;
 
 import java.io.Serializable;
 import java.lang.management.ThreadInfo;
+import org.apache.ignite.internal.LessNamingBean;
 
 /**
  * Data transfer object for Visor {@link ThreadInfo}.
  */
-public class VisorThreadInfo implements Serializable {
+public class VisorThreadInfo implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadLockInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadLockInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadLockInfo.java
index 13c81cc..4f34ee5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadLockInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadLockInfo.java
@@ -19,11 +19,12 @@ package org.apache.ignite.internal.visor.debug;
 
 import java.io.Serializable;
 import java.lang.management.LockInfo;
+import org.apache.ignite.internal.LessNamingBean;
 
 /**
  * Data transfer object for {@link LockInfo}.
  */
-public class VisorThreadLockInfo implements Serializable {
+public class VisorThreadLockInfo implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEvent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEvent.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEvent.java
index 8a26bddc..df2caae 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEvent.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEvent.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.visor.event;
 
 import java.io.Serializable;
 import java.util.UUID;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
@@ -26,7 +27,7 @@ import org.jetbrains.annotations.Nullable;
 /**
  * Base class for lightweight counterpart for various {@link org.apache.ignite.events.Event}.
  */
-public class VisorGridEvent implements Serializable {
+public class VisorGridEvent implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlock.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlock.java
index f82c703..463b81d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlock.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlock.java
@@ -18,12 +18,13 @@
 package org.apache.ignite.internal.visor.file;
 
 import java.io.Serializable;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Represents block of bytes from a file, could be optionally zipped.
  */
-public class VisorFileBlock implements Serializable {
+public class VisorFileBlock implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java
index 847975a..ab2ee9a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java
@@ -20,12 +20,13 @@ package org.apache.ignite.internal.visor.igfs;
 import java.io.Serializable;
 import org.apache.ignite.IgniteFileSystem;
 import org.apache.ignite.igfs.IgfsMode;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Data transfer object for {@link org.apache.ignite.IgniteFileSystem}.
  */
-public class VisorIgfs implements Serializable {
+public class VisorIgfs implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsEndpoint.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsEndpoint.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsEndpoint.java
index b6d7f43..e955f64 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsEndpoint.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsEndpoint.java
@@ -18,13 +18,14 @@
 package org.apache.ignite.internal.visor.igfs;
 
 import java.io.Serializable;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.jetbrains.annotations.Nullable;
 
 /**
  * IGFS endpoint descriptor.
  */
-public class VisorIgfsEndpoint implements Serializable {
+public class VisorIgfsEndpoint implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java
index 47738eb..8c464f2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java
@@ -19,12 +19,13 @@ package org.apache.ignite.internal.visor.igfs;
 
 import java.io.Serializable;
 import org.apache.ignite.igfs.IgfsMetrics;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Data transfer object for {@link IgfsMetrics}.
  */
-public class VisorIgfsMetrics implements Serializable {
+public class VisorIgfsMetrics implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerEntry.java
index 2ceea60..a412c92 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerEntry.java
@@ -20,12 +20,13 @@ package org.apache.ignite.internal.visor.igfs;
 import java.io.Serializable;
 import java.util.Comparator;
 import org.apache.ignite.igfs.IgfsMode;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Visor IGFS profiler information about one file.
  */
-public class VisorIgfsProfilerEntry implements Serializable {
+public class VisorIgfsProfilerEntry implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java
index 55244c2..a43d111 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.visor.igfs;
 
 import java.io.Serializable;
 import java.util.ArrayList;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.F;
 
 import static org.apache.ignite.internal.visor.igfs.VisorIgfsProfiler.UNIFORMITY_BLOCKS;
@@ -31,7 +32,7 @@ import static org.apache.ignite.internal.visor.igfs.VisorIgfsProfiler.UNIFORMITY
  * </p>
  * Count read frequency for each file and compare with ideal uniform distribution.
  */
-public class VisorIgfsProfilerUniformityCounters implements Serializable {
+public class VisorIgfsProfilerUniformityCounters implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchResult.java
index a492516..706f787 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchResult.java
@@ -19,13 +19,14 @@ package org.apache.ignite.internal.visor.log;
 
 import java.io.Serializable;
 import java.util.UUID;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Result for log search operation.
  * Contains found line and several lines before and after, plus other info.
  */
-public class VisorLogSearchResult implements Serializable {
+public class VisorLogSearchResult implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAtomicConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAtomicConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAtomicConfiguration.java
index 6966dbb..2fee762 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAtomicConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAtomicConfiguration.java
@@ -20,12 +20,13 @@ package org.apache.ignite.internal.visor.node;
 import java.io.Serializable;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.AtomicConfiguration;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Data transfer object for configuration of atomic data structures.
  */
-public class VisorAtomicConfiguration implements Serializable {
+public class VisorAtomicConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java
index 84095b6..b7dadee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java
@@ -21,6 +21,7 @@ import java.io.Serializable;
 import java.util.UUID;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.jetbrains.annotations.Nullable;
 
@@ -42,7 +43,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactObject
 /**
  * Data transfer object for node basic configuration properties.
  */
-public class VisorBasicConfiguration implements Serializable {
+public class VisorBasicConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java
index 14a8dcc..5ababe1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java
@@ -20,12 +20,13 @@ package org.apache.ignite.internal.visor.node;
 import java.io.Serializable;
 import org.apache.ignite.configuration.ConnectorConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Data transfer object for node executors configuration properties.
  */
-public class VisorExecutorServiceConfiguration implements Serializable {
+public class VisorExecutorServiceConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
index d6c7fab..7153c6c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
@@ -24,6 +24,7 @@ import java.util.Properties;
 import org.apache.ignite.IgniteSystemProperties;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray;
@@ -31,7 +32,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray;
 /**
  * Data transfer object for node configuration data.
  */
-public class VisorGridConfiguration implements Serializable {
+public class VisorGridConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
index 50917eb..9f7652b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
@@ -26,6 +26,7 @@ import org.apache.ignite.configuration.FileSystemConfiguration;
 import org.apache.ignite.igfs.IgfsIpcEndpointConfiguration;
 import org.apache.ignite.igfs.IgfsMode;
 import org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystem;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.jetbrains.annotations.Nullable;
 
@@ -34,7 +35,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
 /**
  * Data transfer object for IGFS configuration properties.
  */
-public class VisorIgfsConfiguration implements Serializable {
+public class VisorIgfsConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorLifecycleConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorLifecycleConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorLifecycleConfiguration.java
index 396c7f0..8c5a8b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorLifecycleConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorLifecycleConfiguration.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.visor.node;
 
 import java.io.Serializable;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.jetbrains.annotations.Nullable;
 
@@ -27,7 +28,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray;
 /**
  * Data transfer object for node lifecycle configuration properties.
  */
-public class VisorLifecycleConfiguration implements Serializable {
+public class VisorLifecycleConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java
index c5ff882..0e82966 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java
@@ -19,12 +19,13 @@ package org.apache.ignite.internal.visor.node;
 
 import java.io.Serializable;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Data transfer object for node metrics configuration properties.
  */
-public class VisorMetricsConfiguration implements Serializable {
+public class VisorMetricsConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
index 79760ef..9a9b1cd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
@@ -31,6 +31,7 @@ import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.cache.VisorCache;
 import org.apache.ignite.internal.visor.cache.VisorCacheV2;
 import org.apache.ignite.internal.visor.cache.VisorCacheV3;
+import org.apache.ignite.internal.visor.cache.VisorCacheV4;
 import org.apache.ignite.internal.visor.compute.VisorComputeMonitoringHolder;
 import org.apache.ignite.internal.visor.igfs.VisorIgfs;
 import org.apache.ignite.internal.visor.igfs.VisorIgfsEndpoint;
@@ -57,6 +58,9 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
     /** */
     private static final IgniteProductVersion VER_1_5_9 = IgniteProductVersion.fromString("1.5.9");
 
+    /** */
+    private static final IgniteProductVersion VER_1_5_26 = IgniteProductVersion.fromString("1.5.26");
+
     /**
      * Create job with given argument.
      *
@@ -125,7 +129,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
 
     /**
      * @param ver Version to check.
-     * @return {@code true} if compatible.
+     * @return {@code true} if found at least one compatible node with specified version.
      */
     private boolean compatibleWith(IgniteProductVersion ver) {
         for (ClusterNode node : ignite.cluster().nodes())
@@ -136,6 +140,22 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
     }
 
     /**
+     * @return Compatible {@link VisorCache} instance.
+     */
+    private VisorCache createVisorCache() {
+        if (compatibleWith(VER_1_4_1))
+            return new VisorCache();
+
+        if (compatibleWith(VER_1_5_9))
+            return new VisorCacheV2();
+
+        if (compatibleWith(VER_1_5_26))
+            return new VisorCacheV3();
+
+        return new VisorCacheV4();
+    }
+
+    /**
      * Collect caches.
      *
      * @param res Job result.
@@ -152,9 +172,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
                     long start0 = U.currentTimeMillis();
 
                     try {
-                        VisorCache cache = (compatibleWith(VER_1_4_1) ? new VisorCache() :
-                                compatibleWith(VER_1_5_9) ? new VisorCacheV2() : new VisorCacheV3())
-                                    .from(ignite, cacheName, arg.sample());
+                        VisorCache cache = createVisorCache().from(ignite, cacheName, arg.sample());
 
                         if (cache != null)
                             res.caches().add(cache);

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
index 9ca1232..fb21b4b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
@@ -24,6 +24,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.visor.cache.VisorCache;
 import org.apache.ignite.internal.visor.event.VisorGridEvent;
 import org.apache.ignite.internal.visor.igfs.VisorIgfs;
@@ -33,7 +34,7 @@ import org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
 /**
  * Data collector task result.
  */
-public class VisorNodeDataCollectorTaskResult implements Serializable {
+public class VisorNodeDataCollectorTaskResult implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java
index 622aa6d..835fe9d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.visor.node;
 
 import java.io.Serializable;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.jetbrains.annotations.Nullable;
 
@@ -27,7 +28,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray;
 /**
  * Data transfer object for node P2P configuration properties.
  */
-public class VisorPeerToPeerConfiguration implements Serializable {
+public class VisorPeerToPeerConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java
index c5ab55a..2fdd610 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.visor.node;
 import java.io.Serializable;
 import org.apache.ignite.configuration.ConnectorConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.jetbrains.annotations.Nullable;
 
@@ -32,7 +33,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.intValue;
 /**
  * Create data transfer object for node REST configuration properties.
  */
-public class VisorRestConfiguration implements Serializable {
+public class VisorRestConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java
index 84365dc..e7c2878 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.visor.node;
 
 import java.io.Serializable;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.plugin.segmentation.SegmentationPolicy;
 import org.jetbrains.annotations.Nullable;
@@ -28,7 +29,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray;
 /**
  * Data transfer object for node segmentation configuration properties.
  */
-public class VisorSegmentationConfiguration implements Serializable {
+public class VisorSegmentationConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java
index c576426..896e44f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java
@@ -23,6 +23,7 @@ import java.lang.reflect.Method;
 import java.util.HashMap;
 import java.util.Map;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.lang.IgniteBiTuple;
@@ -35,7 +36,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactObject
 /**
  * Data transfer object for node SPIs configuration properties.
  */
-public class VisorSpisConfiguration implements Serializable {
+public class VisorSpisConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java
index 419350d..21d008d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.visor.node;
 
 import java.io.Serializable;
 import org.apache.ignite.configuration.TransactionConfiguration;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
@@ -26,7 +27,7 @@ import org.apache.ignite.transactions.TransactionIsolation;
 /**
  * Data transfer object for transaction configuration.
  */
-public class VisorTransactionConfiguration implements Serializable {
+public class VisorTransactionConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryField.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryField.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryField.java
index 3191e56..c9347fd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryField.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryField.java
@@ -18,13 +18,14 @@
 package org.apache.ignite.internal.visor.query;
 
 import java.io.Serializable;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Data transfer object for query field type description.
  */
-public class VisorQueryField implements Serializable {
+public class VisorQueryField implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResult.java
index b086f7c..a70a600 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResult.java
@@ -19,12 +19,13 @@ package org.apache.ignite.internal.visor.query;
 
 import java.io.Serializable;
 import java.util.List;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Result for cache query tasks.
  */
-public class VisorQueryResult implements Serializable {
+public class VisorQueryResult implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSet.java b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSet.java
index eecc169..56e28a3 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSet.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSet.java
@@ -20,6 +20,7 @@ package org.apache.ignite.plugin.security;
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.Map;
+import org.apache.ignite.internal.LessNamingBean;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -31,7 +32,7 @@ import org.jetbrains.annotations.Nullable;
  * Property {@link #defaultAllowAll()} specifies whether to allow or deny
  * cache and task operations if they were not explicitly specified.
  */
-public interface SecurityPermissionSet extends Serializable {
+public interface SecurityPermissionSet extends Serializable, LessNamingBean {
     /**
      * Flag indicating whether to allow or deny cache and task operations
      * if they were not explicitly specified.

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/plugin/security/SecuritySubject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecuritySubject.java b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecuritySubject.java
index 1cf403a..aa940fd 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecuritySubject.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecuritySubject.java
@@ -20,11 +20,12 @@ package org.apache.ignite.plugin.security;
 import java.io.Serializable;
 import java.net.InetSocketAddress;
 import java.util.UUID;
+import org.apache.ignite.internal.LessNamingBean;
 
 /**
  * Security subject representing authenticated node with a set of permissions.
  */
-public interface SecuritySubject extends Serializable {
+public interface SecuritySubject extends Serializable, LessNamingBean {
     /**
      * Gets subject ID.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/rest-http/pom.xml
----------------------------------------------------------------------
diff --git a/modules/rest-http/pom.xml b/modules/rest-http/pom.xml
index c97d670..b535dda 100644
--- a/modules/rest-http/pom.xml
+++ b/modules/rest-http/pom.xml
@@ -97,28 +97,15 @@
         </dependency>
 
         <dependency>
-            <groupId>net.sf.json-lib</groupId>
-            <artifactId>json-lib</artifactId>
-            <version>${jsonlib.version}</version>
-            <classifier>jdk15</classifier>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-core</artifactId>
+            <version>${jackson2.version}</version>
         </dependency>
 
         <dependency>
-            <groupId>net.sf.ezmorph</groupId>
-            <artifactId>ezmorph</artifactId>
-            <version>${ezmorph.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-collections</groupId>
-            <artifactId>commons-collections</artifactId>
-            <version>${commons.collections.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-beanutils</groupId>
-            <artifactId>commons-beanutils</artifactId>
-            <version>${commons.beanutils.version}</version>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+            <version>${jackson2.version}</version>
         </dependency>
 
         <dependency>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyJsonConfig.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyJsonConfig.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyJsonConfig.java
deleted file mode 100644
index c2795a4..0000000
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyJsonConfig.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.rest.protocols.http.jetty;
-
-import java.lang.reflect.Method;
-import java.text.DateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import net.sf.json.JSONObject;
-import net.sf.json.JsonConfig;
-import net.sf.json.processors.JsonBeanProcessor;
-import net.sf.json.processors.JsonBeanProcessorMatcher;
-import net.sf.json.processors.JsonValueProcessor;
-import net.sf.json.processors.JsonValueProcessorMatcher;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.internal.processors.cache.query.GridCacheSqlIndexMetadata;
-import org.apache.ignite.internal.processors.cache.query.GridCacheSqlMetadata;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.internal.visor.cache.VisorCache;
-import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.lang.IgniteUuid;
-
-/**
- * Jetty protocol json configuration.
- */
-class GridJettyJsonConfig extends JsonConfig {
-    /** Logger. */
-    private final IgniteLogger log;
-
-    /**
-     * Class for finding a matching JsonBeanProcessor.
-     */
-    private static final JsonBeanProcessorMatcher LESS_NAMING_BEAN_MATCHER = new JsonBeanProcessorMatcher() {
-        /** {@inheritDoc} */
-        @Override public Object getMatch(Class target, Set keys) {
-            return GridJettyJsonConfig.getMatch(target, keys);
-        }
-    };
-
-    /**
-     * Class for finding a matching JsonValueProcessor.
-     */
-    private static final JsonValueProcessorMatcher LESS_NAMING_VALUE_MATCHER = new JsonValueProcessorMatcher() {
-        /** {@inheritDoc} */
-        @Override public Object getMatch(Class target, Set keys) {
-            return GridJettyJsonConfig.getMatch(target, keys);
-        }
-    };
-
-    /**
-     * Helper class for simple to-string conversion for {@link UUID}.
-     */
-    private static JsonValueProcessor UUID_PROCESSOR = new JsonValueProcessor() {
-        /** {@inheritDoc} */
-        @Override public Object processArrayValue(Object val, JsonConfig jsonCfg) {
-            if (val == null)
-                return new JSONObject(true);
-
-            if (val instanceof UUID)
-                return val.toString();
-
-            throw new UnsupportedOperationException("Serialize value to json is not supported: " + val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object processObjectValue(String key, Object val, JsonConfig jsonCfg) {
-            return processArrayValue(val, jsonCfg);
-        }
-    };
-
-    /**
-     * Helper class for simple to-string conversion for {@link UUID}.
-     */
-    private static JsonValueProcessor IGNITE_BI_TUPLE_PROCESSOR = new JsonValueProcessor() {
-        /** {@inheritDoc} */
-        @Override public Object processArrayValue(Object val, JsonConfig jsonCfg) {
-            if (val == null)
-                return new JSONObject(true);
-
-            if (val instanceof IgniteBiTuple) {
-                IgniteBiTuple t2 = (IgniteBiTuple)val;
-
-                final JSONObject ret = new JSONObject();
-
-                ret.element("key", t2.getKey(), jsonCfg);
-                ret.element("value", t2.getValue(), jsonCfg);
-
-                return ret;
-            }
-
-            throw new UnsupportedOperationException("Serialize value to json is not supported: " + val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object processObjectValue(String key, Object val, JsonConfig jsonCfg) {
-            return processArrayValue(val, jsonCfg);
-        }
-    };
-
-    /**
-     * Helper class for simple to-string conversion for {@link IgniteUuid}.
-     */
-    private static JsonValueProcessor IGNITE_UUID_PROCESSOR = new JsonValueProcessor() {
-        /** {@inheritDoc} */
-        @Override public Object processArrayValue(Object val, JsonConfig jsonCfg) {
-            if (val == null)
-                return new JSONObject(true);
-
-            if (val instanceof IgniteUuid)
-                return val.toString();
-
-            throw new UnsupportedOperationException("Serialize value to json is not supported: " + val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object processObjectValue(String key, Object val, JsonConfig jsonCfg) {
-            return processArrayValue(val, jsonCfg);
-        }
-    };
-
-    /**
-     * Helper class for simple to-string conversion for {@link Date}.
-     */
-    private static JsonValueProcessor DATE_PROCESSOR = new JsonValueProcessor() {
-        /** Thread local US date format. */
-        private final ThreadLocal<DateFormat> dateFmt = new ThreadLocal<DateFormat>() {
-            @Override protected DateFormat initialValue() {
-                return DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.US);
-            }
-        };
-
-        /** {@inheritDoc} */
-        @Override public synchronized Object processArrayValue(Object val, JsonConfig jsonCfg) {
-            if (val == null)
-                return new JSONObject(true);
-
-            if (val instanceof Date)
-                return dateFmt.get().format(val);
-
-            throw new UnsupportedOperationException("Serialize value to json is not supported: " + val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public synchronized Object processObjectValue(String key, Object val, JsonConfig jsonCfg) {
-            return processArrayValue(val, jsonCfg);
-        }
-    };
-
-    /**
-     * Constructs default jetty json config.
-     */
-    GridJettyJsonConfig(IgniteLogger log) {
-        this.log = log;
-
-        setAllowNonStringKeys(true);
-
-        registerJsonValueProcessor(IgniteBiTuple.class, IGNITE_BI_TUPLE_PROCESSOR);
-        registerJsonValueProcessor(UUID.class, UUID_PROCESSOR);
-        registerJsonValueProcessor(IgniteUuid.class, IGNITE_UUID_PROCESSOR);
-        registerJsonValueProcessor(Date.class, DATE_PROCESSOR);
-        registerJsonValueProcessor(java.sql.Date.class, DATE_PROCESSOR);
-
-        final LessNamingProcessor lessNamingProcessor = new LessNamingProcessor();
-
-        registerJsonBeanProcessor(LessNamingProcessor.class, lessNamingProcessor);
-        registerJsonValueProcessor(LessNamingProcessor.class, lessNamingProcessor);
-
-        setJsonBeanProcessorMatcher(LESS_NAMING_BEAN_MATCHER);
-        setJsonValueProcessorMatcher(LESS_NAMING_VALUE_MATCHER);
-    }
-
-    /**
-     * Returns the matching class calculated with the target class and the provided set. Matches the target class with
-     * instanceOf, for Visor classes return custom processor class.
-     *
-     * @param target the target class to match
-     * @param keys a set of possible matches
-     */
-    private static Object getMatch(Class target, Set keys) {
-        if (target == null || keys == null)
-            return null;
-
-        if (target.getSimpleName().startsWith("Visor") ||
-            GridCacheSqlMetadata.class.isAssignableFrom(target) ||
-            GridCacheSqlIndexMetadata.class.isAssignableFrom(target))
-            return LessNamingProcessor.class;
-
-        if (keys.contains(target))
-            return target;
-
-        for (Object key : keys) {
-            Class<?> clazz = (Class<?>)key;
-
-            if (clazz.isAssignableFrom(target))
-                return key;
-        }
-
-        return null;
-    }
-
-    /**
-     * Helper class for simple to-json conversion for Visor classes.
-     */
-    private class LessNamingProcessor implements JsonBeanProcessor, JsonValueProcessor {
-        /** Methods to exclude. */
-        private final Collection<String> exclMtds = Arrays.asList("toString", "hashCode", "clone", "getClass");
-
-        /** */
-        private final Map<Class<?>, Collection<Method>> clsCache = new HashMap<>();
-
-        /** */
-        private final ReadWriteLock rwLock = new ReentrantReadWriteLock();
-
-        /** {@inheritDoc} */
-        @Override public JSONObject processBean(Object bean, JsonConfig jsonCfg) {
-            if (bean == null)
-                return new JSONObject(true);
-
-            final JSONObject ret = new JSONObject();
-
-            Collection<Method> methods;
-
-            Class<?> cls = bean.getClass();
-
-            // Get descriptor from cache.
-            rwLock.readLock().lock();
-
-            try {
-                methods = clsCache.get(cls);
-            }
-            finally {
-                rwLock.readLock().unlock();
-            }
-
-            // If missing in cache - build descriptor
-            if (methods == null) {
-                Method[] publicMtds = cls.getMethods();
-
-                methods = new ArrayList<>(publicMtds.length);
-
-                for (Method mtd : publicMtds) {
-                    Class retType = mtd.getReturnType();
-
-                    if (mtd.getParameterTypes().length != 0 ||
-                        retType == void.class ||
-                        retType == cls ||
-                        exclMtds.contains(mtd.getName()) ||
-                        (retType == VisorCache.class && mtd.getName().equals("history")))
-                        continue;
-
-                    mtd.setAccessible(true);
-
-                    methods.add(mtd);
-                }
-
-                /*
-                 * Allow multiple puts for the same class - they will simply override.
-                 */
-                rwLock.writeLock().lock();
-
-                try {
-                    clsCache.put(cls, methods);
-                }
-                finally {
-                    rwLock.writeLock().unlock();
-                }
-            }
-
-            // Extract fields values using descriptor and build JSONObject.
-            for (Method mtd : methods) {
-                try {
-                    ret.element(mtd.getName(), mtd.invoke(bean), jsonCfg);
-                }
-                catch (Exception e) {
-                    U.error(log, "Failed to read object property [type= " + cls.getName()
-                        + ", property=" + mtd.getName() + "]", e);
-                }
-            }
-
-            return ret;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object processArrayValue(Object val, JsonConfig jsonCfg) {
-            return processBean(val, jsonCfg);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object processObjectValue(String key, Object val, JsonConfig jsonCfg) {
-            return processArrayValue(val, jsonCfg);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java
new file mode 100644
index 0000000..f09b583
--- /dev/null
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java
@@ -0,0 +1,259 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.rest.protocols.http.jetty;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.BeanProperty;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationConfig;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider;
+import com.fasterxml.jackson.databind.ser.SerializerFactory;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.sql.SQLException;
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import org.apache.ignite.internal.LessNamingBean;
+import org.apache.ignite.internal.visor.cache.VisorCache;
+import org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
+import org.apache.ignite.lang.IgniteBiTuple;
+import org.apache.ignite.lang.IgniteUuid;
+
+/**
+ * Custom object mapper for HTTP REST API.
+ */
+public class GridJettyObjectMapper extends ObjectMapper {
+    /**
+     * Default constructor.
+     */
+    public GridJettyObjectMapper() {
+        super(null, new CustomSerializerProvider(), null);
+
+        setDateFormat(DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.US));
+
+        SimpleModule module = new SimpleModule();
+
+        module.addSerializer(Throwable.class, THROWABLE_SERIALIZER);
+        module.addSerializer(IgniteBiTuple.class, IGNITE_TUPLE_SERIALIZER);
+        module.addSerializer(IgniteUuid.class, IGNITE_UUID_SERIALIZER);
+        module.addSerializer(LessNamingBean.class, LESS_NAMING_SERIALIZER);
+
+        registerModule(module);
+    }
+
+    /** Custom {@code null} value serializer. */
+    private static final JsonSerializer<Object> NULL_SERIALIZER = new JsonSerializer<Object>() {
+        /** {@inheritDoc} */
+        @Override public void serialize(Object val, JsonGenerator gen, SerializerProvider ser) throws IOException {
+            gen.writeNull();
+        }
+    };
+
+    /** Custom {@code null} string serializer. */
+    private static final JsonSerializer<Object> NULL_STRING_SERIALIZER = new JsonSerializer<Object>() {
+        /** {@inheritDoc} */
+        @Override public void serialize(Object val, JsonGenerator gen, SerializerProvider ser) throws IOException {
+            gen.writeString("");
+        }
+    };
+
+    /**
+     * Custom serializers provider that provide special serializers for {@code null} values.
+     */
+    private static class CustomSerializerProvider extends DefaultSerializerProvider {
+        /**
+         * Default constructor.
+         */
+        CustomSerializerProvider() {
+            super();
+        }
+
+        /**
+         * Full constructor.
+         *
+         * @param src Blueprint object used as the baseline for this instance.
+         * @param cfg Provider configuration.
+         * @param f Serializers factory.
+         */
+        CustomSerializerProvider(SerializerProvider src, SerializationConfig cfg, SerializerFactory f) {
+            super(src, cfg, f);
+        }
+
+        /** {@inheritDoc} */
+        public DefaultSerializerProvider createInstance(SerializationConfig cfg, SerializerFactory jsf) {
+            return new CustomSerializerProvider(this, cfg, jsf);
+        }
+
+        /** {@inheritDoc} */
+        @Override public JsonSerializer<Object> findNullValueSerializer(BeanProperty prop) throws JsonMappingException {
+            if (prop.getType().getRawClass() == String.class)
+                return NULL_STRING_SERIALIZER;
+
+            return NULL_SERIALIZER;
+        }
+    }
+
+    /** Custom serializer for {@link Throwable} */
+    private static final JsonSerializer<Throwable> THROWABLE_SERIALIZER = new JsonSerializer<Throwable>() {
+        /** {@inheritDoc} */
+        @Override public void serialize(Throwable e, JsonGenerator gen, SerializerProvider ser) throws IOException {
+            gen.writeStartObject();
+
+            if (e instanceof VisorExceptionWrapper) {
+                VisorExceptionWrapper wrapper = (VisorExceptionWrapper)e;
+
+                gen.writeStringField("className", wrapper.getClassName());
+            }
+            else
+                gen.writeStringField("className", e.getClass().getName());
+
+            if (e.getMessage() != null)
+                gen.writeStringField("message", e.getMessage());
+
+            if (e.getCause() != null)
+                gen.writeObjectField("cause", e.getCause());
+
+            if (e instanceof SQLException) {
+                SQLException sqlE = (SQLException)e;
+
+                gen.writeNumberField("errorCode", sqlE.getErrorCode());
+                gen.writeStringField("SQLState", sqlE.getSQLState());
+            }
+
+            gen.writeEndObject();
+        }
+    };
+
+    /** Custom serializer for {@link IgniteUuid} */
+    private static final JsonSerializer<IgniteUuid> IGNITE_UUID_SERIALIZER = new JsonSerializer<IgniteUuid>() {
+        /** {@inheritDoc} */
+        @Override public void serialize(IgniteUuid uid, JsonGenerator gen, SerializerProvider ser) throws IOException {
+            gen.writeString(uid.toString());
+        }
+    };
+
+    /** Custom serializer for {@link IgniteBiTuple} */
+    private static final JsonSerializer<IgniteBiTuple> IGNITE_TUPLE_SERIALIZER = new JsonSerializer<IgniteBiTuple>() {
+        /** {@inheritDoc} */
+        @Override public void serialize(IgniteBiTuple t, JsonGenerator gen, SerializerProvider ser) throws IOException {
+            gen.writeStartObject();
+
+            gen.writeObjectField("key", t.getKey());
+            gen.writeObjectField("value", t.getValue());
+
+            gen.writeEndObject();
+        }
+    };
+
+    /**
+     * Custom serializer for Visor classes with non JavaBeans getters.
+     */
+    private static final JsonSerializer<Object> LESS_NAMING_SERIALIZER = new JsonSerializer<Object>() {
+        /** Methods to exclude. */
+        private final Collection<String> exclMtds = Arrays.asList("toString", "hashCode", "clone", "getClass");
+
+        /** */
+        private final Map<Class<?>, Collection<Method>> clsCache = new HashMap<>();
+
+        /** */
+        private final ReadWriteLock rwLock = new ReentrantReadWriteLock();
+
+        /** {@inheritDoc} */
+        @Override public void serialize(Object bean, JsonGenerator gen, SerializerProvider ser) throws IOException {
+            if (bean != null) {
+                gen.writeStartObject();
+
+                Class<?> cls = bean.getClass();
+
+                Collection<Method> methods;
+
+                // Get descriptor from cache.
+                rwLock.readLock().lock();
+
+                try {
+                    methods = clsCache.get(cls);
+                }
+                finally {
+                    rwLock.readLock().unlock();
+                }
+
+                // If missing in cache - build descriptor
+                if (methods == null) {
+                    Method[] publicMtds = cls.getMethods();
+
+                    methods = new ArrayList<>(publicMtds.length);
+
+                    for (Method mtd : publicMtds) {
+                        Class retType = mtd.getReturnType();
+
+                        String mtdName = mtd.getName();
+
+                        if (mtd.getParameterTypes().length != 0 ||
+                            retType == void.class || retType == cls ||
+                            exclMtds.contains(mtdName) ||
+                            (VisorCache.class.isAssignableFrom(retType) && "history".equals(mtdName)))
+                            continue;
+
+                        mtd.setAccessible(true);
+
+                        methods.add(mtd);
+                    }
+
+                    // Allow multiple puts for the same class - they will simply override.
+                    rwLock.writeLock().lock();
+
+                    try {
+                        clsCache.put(cls, methods);
+                    }
+                    finally {
+                        rwLock.writeLock().unlock();
+                    }
+                }
+
+                // Extract fields values using descriptor and build JSONObject.
+                for (Method mtd : methods) {
+                    try {
+                        Object prop = mtd.invoke(bean);
+
+                        if (prop != null)
+                            gen.writeObjectField(mtd.getName(), prop);
+                    }
+                    catch (IOException ioe) {
+                        throw ioe;
+                    }
+                    catch (Exception e) {
+                        throw new IOException(e);
+                    }
+                }
+
+                gen.writeEndObject();
+            }
+        }
+    };
+}


[3/4] ignite git commit: IGNITE-3277-preview

Posted by ak...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
index 9fd3044..058b0c9 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
@@ -17,24 +17,27 @@
 
 package org.apache.ignite.internal.processors.rest;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.LineNumberReader;
 import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
 import java.net.URL;
 import java.net.URLConnection;
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.text.DateFormat;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.regex.Pattern;
-import net.sf.json.JSONNull;
-import net.sf.json.JSONObject;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
@@ -52,10 +55,12 @@ import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
 import org.apache.ignite.internal.processors.cache.query.GridCacheSqlIndexMetadata;
 import org.apache.ignite.internal.processors.cache.query.GridCacheSqlMetadata;
 import org.apache.ignite.internal.processors.rest.handlers.GridRestCommandHandler;
+import org.apache.ignite.internal.processors.rest.protocols.http.jetty.GridJettyObjectMapper;
 import org.apache.ignite.internal.util.lang.GridTuple3;
 import org.apache.ignite.internal.util.typedef.C1;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.P1;
+import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.visor.cache.VisorCacheClearTask;
@@ -103,6 +108,7 @@ import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.testframework.GridTestUtils;
 
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_JETTY_PORT;
+import static org.apache.ignite.internal.IgniteVersionUtils.VER_STR;
 
 /**
  * Tests for Jetty REST protocol.
@@ -112,6 +118,15 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     /** Grid count. */
     private static final int GRID_CNT = 3;
 
+    /** Url address to send HTTP request. */
+    private final String TEST_URL = "http://" + LOC_HOST + ":" + restPort() + "/ignite?";
+
+    /** Used to sent request charset. */
+    private static final String CHARSET = StandardCharsets.UTF_8.name();
+
+    /** JSON to java mapper. */
+    private static final ObjectMapper JSON_MAPPER = new GridJettyObjectMapper();
+
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
         System.setProperty(IGNITE_JETTY_PORT, Integer.toString(restPort()));
@@ -157,12 +172,12 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     protected String content(Map<String, String> params) throws Exception {
-        String addr = "http://" + LOC_HOST + ":" + restPort() + "/ignite?";
+        SB sb = new SB(TEST_URL);
 
         for (Map.Entry<String, String> e : params.entrySet())
-            addr += e.getKey() + '=' + e.getValue() + '&';
+            sb.a(e.getKey()).a('=').a(e.getValue()).a('&');
 
-        URL url = new URL(addr);
+        URL url = new URL(sb.toString());
 
         URLConnection conn = url.openConnection();
 
@@ -173,165 +188,252 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         InputStream in = conn.getInputStream();
 
-        LineNumberReader rdr = new LineNumberReader(new InputStreamReader(in));
-
         StringBuilder buf = new StringBuilder(256);
 
-        for (String line = rdr.readLine(); line != null; line = rdr.readLine())
-            buf.append(line);
+        try (LineNumberReader rdr = new LineNumberReader(new InputStreamReader(in, "UTF-8"))) {
+            for (String line = rdr.readLine(); line != null; line = rdr.readLine())
+                buf.append(line);
+        }
 
         return buf.toString();
     }
 
     /**
-     * @param json JSON response.
-     * @param ptrn Pattern to match.
+     * @param content Content to check.
      */
-    @SuppressWarnings("TypeMayBeWeakened")
-    protected void jsonEquals(String json, String ptrn) {
-        assertTrue("JSON mismatch [json=" + json + ", ptrn=" + ptrn + ']', Pattern.matches(ptrn, json));
+    private void assertResponseContainsError(String content) throws IOException {
+        assertNotNull(content);
+        assertFalse(content.isEmpty());
+
+        JsonNode node = JSON_MAPPER.readTree(content);
+
+        assertEquals(1, node.get("successStatus").asInt());
+        assertFalse(node.get("error").asText().isEmpty());
+        assertTrue(node.get("response").isNull());
+        assertTrue(node.get("sessionToken").asText().isEmpty());
     }
 
     /**
-     * @param res Response.
-     * @param success Success flag.
-     * @return Regex pattern for JSON.
+     * @param content Content to check.
+     * @param err Error message.
      */
-    private String cachePattern(String res, boolean success) {
-        return "\\{\\\"affinityNodeId\\\":\\\"\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}\\\"\\," +
-            "\\\"error\\\":\\\"\\\"\\," +
-            "\\\"response\\\":\\\"" + res + "\\\"\\," +
-            "\\\"sessionToken\\\":\\\"" + (securityEnabled() && success ? ".+" : "") + "\\\"," +
-            "\\\"successStatus\\\":" + (success ? 0 : 1) + "\\}";
+    private void assertResponseContainsError(String content, String err) throws IOException {
+        assertNotNull(content);
+        assertFalse(content.isEmpty());
+
+        assertNotNull(err);
+
+        JsonNode node = JSON_MAPPER.readTree(content);
+
+        assertEquals(1, node.get("successStatus").asInt());
+
+        assertTrue(node.get("response").isNull());
+        assertEquals(err, node.get("error").asText());
     }
 
     /**
-     * @param err Error.
-     * @return Regex pattern for JSON.
+     * @param content Content to check.
      */
-    private String errorPattern(String err) {
-        return "\\{" +
-            "\\\"error\\\":\\\"" + err + "\\\"\\," +
-            "\\\"response\\\":null\\," +
-            "\\\"sessionToken\\\":\\\"\\\"," +
-            "\\\"successStatus\\\":" + 1 + "\\}";
+    private JsonNode jsonCacheOperationResponse(String content, boolean bulk) throws IOException {
+        assertNotNull(content);
+        assertFalse(content.isEmpty());
+
+        JsonNode node = JSON_MAPPER.readTree(content);
+
+        assertEquals(bulk, node.get("affinityNodeId").asText().isEmpty());
+        assertEquals(0, node.get("successStatus").asInt());
+        assertTrue(node.get("error").asText().isEmpty());
+
+        assertNotSame(securityEnabled(), node.get("sessionToken").asText().isEmpty());
+
+        return node.get("response");
     }
 
     /**
+     * @param content Content to check.
      * @param res Response.
-     * @param success Success flag.
-     * @return Regex pattern for JSON.
      */
-    private String integerPattern(int res, boolean success) {
-        return "\\{\\\"error\\\":\\\"\\\"\\," +
-            "\\\"response\\\":" + res + "\\," +
-            "\\\"sessionToken\\\":\\\"" + (securityEnabled() && success ? ".+" : "") + "\\\"," +
-            "\\\"successStatus\\\":" + (success ? 0 : 1) + "\\}";
+    private void assertCacheOperation(String content, Object res) throws IOException {
+        JsonNode ret = jsonCacheOperationResponse(content, false);
+
+        assertEquals(String.valueOf(res), ret.asText());
     }
 
     /**
+     * @param content Content to check.
      * @param res Response.
-     * @param success Success flag.
-     * @return Regex pattern for JSON.
      */
-    private String cacheBulkPattern(String res, boolean success) {
-        return "\\{\\\"affinityNodeId\\\":\\\"\\\"\\," +
-            "\\\"error\\\":\\\"\\\"\\," +
-            "\\\"response\\\":" + res + "\\," +
-            "\\\"sessionToken\\\":\\\"" + (securityEnabled() && success ? ".+" : "") + "\\\"," +
-            "\\\"successStatus\\\":" + (success ? 0 : 1) + "\\}";
+    private void assertCacheBulkOperation(String content, Object res) throws IOException {
+        JsonNode ret = jsonCacheOperationResponse(content, true);
+
+        assertEquals(String.valueOf(res), ret.asText());
     }
 
     /**
-     * @param res Response.
-     * @param success Success flag.
-     * @return Regex pattern for JSON.
+     * @param content Content to check.
      */
-    private String cacheBulkPattern(int res, boolean success) {
-        return "\\{\\\"affinityNodeId\\\":\\\"\\\"\\," +
-            "\\\"error\\\":\\\"\\\"\\," +
-            "\\\"response\\\":" + res + "\\," +
-            "\\\"sessionToken\\\":\\\"" + (securityEnabled() && success ? ".+" : "") + "\\\"," +
-            "\\\"successStatus\\\":" + (success ? 0 : 1) + "\\}";
+    private void assertCacheMetrics(String content) throws IOException {
+        JsonNode ret = jsonCacheOperationResponse(content, true);
+
+        assertTrue(ret.isObject());
     }
 
     /**
-     * @param res Response.
-     * @param success Success flag.
-     * @return Regex pattern for JSON.
+     * @param content Content to check.
+     * @return REST result.
      */
-    private String cachePattern(boolean res, boolean success) {
-        return "\\{\\\"affinityNodeId\\\":\\\"\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}\\\"\\," +
-            "\\\"error\\\":\\\"\\\"\\," +
-            "\\\"response\\\":" + res + "\\," +
-            "\\\"sessionToken\\\":\\\"" + (securityEnabled() && success ? ".+" : "") + "\\\"," +
-            "\\\"successStatus\\\":" + (success ? 0 : 1) + "\\}";
+    protected JsonNode jsonResponse(String content) throws IOException {
+        assertNotNull(content);
+        assertFalse(content.isEmpty());
+
+        JsonNode node = JSON_MAPPER.readTree(content);
+
+        assertEquals(0, node.get("successStatus").asInt());
+        assertTrue(node.get("error").asText().isEmpty());
+
+        assertNotSame(securityEnabled(), node.get("sessionToken").asText().isEmpty());
+
+        return node.get("response");
     }
 
     /**
-     * @param res Response.
-     * @param success Success flag.
-     * @return Regex pattern for JSON.
+     * @param content Content to check.
+     * @return Task result.
      */
-    private String cacheBulkPattern(boolean res, boolean success) {
-        return "\\{\\\"affinityNodeId\\\":\\\"\\\"\\," +
-            "\\\"error\\\":\\\"\\\"\\," +
-            "\\\"response\\\":" + res + "\\," +
-            "\\\"sessionToken\\\":\\\"" + (securityEnabled() && success ? ".+" : "") + "\\\"," +
-            "\\\"successStatus\\\":" + (success ? 0 : 1) + "\\}";
+    protected JsonNode jsonTaskResult(String content) throws IOException {
+        assertNotNull(content);
+        assertFalse(content.isEmpty());
+
+        JsonNode node = JSON_MAPPER.readTree(content);
+
+        assertEquals(0, node.get("successStatus").asInt());
+        assertTrue(node.get("error").asText().isEmpty());
+        assertFalse(node.get("response").isNull());
+
+        assertEquals(securityEnabled(), !node.get("sessionToken").asText().isEmpty());
+
+        JsonNode res = node.get("response");
+
+        assertTrue(res.isObject());
+
+        assertFalse(res.get("id").asText().isEmpty());
+        assertTrue(res.get("finished").asBoolean());
+        assertTrue(res.get("error").asText().isEmpty());
+
+        return res.get("result");
     }
 
     /**
-     * @param res Response.
-     * @param success Success flag.
-     * @return Regex pattern for JSON.
+     * @throws Exception If failed.
      */
-    private String cacheMetricsPattern(String res, boolean success) {
-        return "\\{\\\"affinityNodeId\\\":\\\"(\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12})?\\\"\\," +
-            "\\\"error\\\":\\\"\\\"\\," +
-            "\\\"response\\\":" + res + "\\," +
-            "\\\"sessionToken\\\":\\\"" + (securityEnabled() && success ? ".+" : "") + "\\\"," +
-            "\\\"successStatus\\\":" + (success ? 0 : 1) + "\\}";
+    public void testGet() throws Exception {
+        jcache().put("getKey", "getVal");
+
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "getKey"));
+
+        info("Get command result: " + ret);
+
+        assertCacheOperation(ret, "getVal");
     }
 
     /**
-     * @param res Response.
-     * @param success Success flag.
-     * @return Regex pattern for JSON.
+     * @throws Exception If failed.
      */
-    protected String pattern(String res, boolean success) {
-        return "\\{\\\"error\\\":\\\"" + (!success ? ".+" : "") + "\\\"\\," +
-            "\\\"response\\\":" + res + "\\," +
-            "\\\"sessionToken\\\":\\\"" + (securityEnabled() && success ? ".+" : "") + "\\\"," +
-            "\\\"successStatus\\\":" + (success ? 0 : 1) + "\\}";
+    public void testSimpleObject()  throws Exception {
+        SimplePerson p = new SimplePerson(1, "Test", java.sql.Date.valueOf("1977-01-26"), 1000.55);
+
+        jcache().put("simplePersonKey", p);
+
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "simplePersonKey"));
+
+        info("Get command result: " + ret);
+
+        JsonNode res = jsonCacheOperationResponse(ret, false);
+
+        assertEquals(res.get("id").asInt(), p.id);
+        assertEquals(res.get("name").asText(), p.name);
+        assertEquals(res.get("birthday").asText(), p.birthday.toString());
+        assertEquals(res.get("salary").asDouble(), p.salary);
     }
 
     /**
-     * @param res Response.
-     * @param success Success flag.
-     * @return Regex pattern for JSON.
+     * @throws Exception If failed.
      */
-    private String stringPattern(String res, boolean success) {
-        return "\\{\\\"error\\\":\\\"" + (!success ? ".+" : "") + "\\\"\\," +
-            "\\\"response\\\":\\\"" + res + "\\\"\\," +
-            "\\\"sessionToken\\\":\\\"" + (securityEnabled() && success ? ".+" : "") + "\\\"," +
-            "\\\"successStatus\\\":" + (success ? 0 : 1) + "\\}";
+    public void testDate() throws Exception {
+        java.util.Date utilDate = new java.util.Date();
+
+        DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.US);
+
+        String date = formatter.format(utilDate);
+
+        jcache().put("utilDateKey", utilDate);
+
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "utilDateKey"));
+
+        info("Get command result: " + ret);
+
+        assertCacheOperation(ret, date);
+
+        java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
+
+        jcache().put("sqlDateKey", sqlDate);
+
+        ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "sqlDateKey"));
+
+        info("Get SQL result: " + ret);
+
+        assertCacheOperation(ret, sqlDate.toString());
+
+        jcache().put("timestampKey", new java.sql.Timestamp(utilDate.getTime()));
+
+        ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "timestampKey"));
+
+        info("Get timestamp: " + ret);
+
+        assertCacheOperation(ret, date);
     }
 
     /**
      * @throws Exception If failed.
      */
-    public void testGet() throws Exception {
-        jcache().put("getKey", "getVal");
+    public void testUUID() throws Exception {
+        UUID uuid = UUID.randomUUID();
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "getKey"));
+        jcache().put("uuidKey", uuid);
+
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "uuidKey"));
+
+        info("Get command result: " + ret);
+
+        assertCacheOperation(ret, uuid.toString());
+
+        IgniteUuid igniteUuid = IgniteUuid.fromUuid(uuid);
+
+        jcache().put("igniteUuidKey", igniteUuid);
+
+        ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "igniteUuidKey"));
+
+        info("Get command result: " + ret);
+
+        assertCacheOperation(ret, igniteUuid.toString());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTuple() throws Exception {
+        T2 t = new T2("key", "value");
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
+        jcache().put("tupleKey", t);
+
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "tupleKey"));
 
         info("Get command result: " + ret);
 
-        jsonEquals(ret, cachePattern("getVal", true));
+        JsonNode res = jsonCacheOperationResponse(ret, false);
+
+        assertEquals(t.getKey(), res.get("key").asText());
+        assertEquals(t.getValue(), res.get("value").asText());
     }
 
     /**
@@ -344,12 +446,9 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_SIZE.key()));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("Size command result: " + ret);
 
-        jsonEquals(ret, cacheBulkPattern(1, true));
+        assertCacheBulkOperation(ret, 1);
     }
 
     /**
@@ -358,12 +457,9 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testIgniteName() throws Exception {
         String ret = content(F.asMap("cmd", GridRestCommand.NAME.key()));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("Name command result: " + ret);
 
-        jsonEquals(ret, stringPattern(getTestGridName(0), true));
+        assertEquals(getTestGridName(0), jsonResponse(ret).asText());
     }
 
     /**
@@ -372,17 +468,13 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testGetOrCreateCache() throws Exception {
         String ret = content(F.asMap("cmd", GridRestCommand.GET_OR_CREATE_CACHE.key(), "cacheName", "testCache"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("Name command result: " + ret);
 
         grid(0).cache("testCache").put("1", "1");
 
         ret = content(F.asMap("cmd", GridRestCommand.DESTROY_CACHE.key(), "cacheName", "testCache"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
+        assertTrue(jsonResponse(ret).isNull());
 
         assertNull(grid(0).cache("testCache"));
     }
@@ -391,20 +483,19 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testGetAll() throws Exception {
-        jcache().put("getKey1", "getVal1");
-        jcache().put("getKey2", "getVal2");
+        final Map<String, String> entries = F.asMap("getKey1", "getVal1", "getKey2", "getVal2");
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_ALL.key(), "k1", "getKey1", "k2", "getKey2"));
+        jcache().putAll(entries);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_ALL.key(), "k1", "getKey1", "k2", "getKey2"));
 
         info("Get all command result: " + ret);
 
-        jsonEquals(ret,
-            // getKey[12] is used since the order is not determined.
-            cacheBulkPattern("\\{\\\"getKey[12]\\\":\\\"getVal[12]\\\"\\,\\\"getKey[12]\\\":\\\"getVal[12]\\\"\\}",
-                true));
+        JsonNode res = jsonCacheOperationResponse(ret, true);
+
+        assertTrue(res.isObject());
+
+        assertTrue(entries.equals(JSON_MAPPER.treeToValue(res, Map.class)));
     }
 
     /**
@@ -413,9 +504,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testIncorrectPut() throws Exception {
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT.key(), "key", "key0"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-        jsonEquals(ret, errorPattern("Failed to find mandatory parameter in request: val"));
+        assertResponseContainsError(ret, "Failed to find mandatory parameter in request: val");
     }
 
     /**
@@ -426,10 +515,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CONTAINS_KEY.key(), "key", "key0"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, cachePattern(true, true));
+        assertCacheOperation(ret, true);
     }
 
     /**
@@ -442,10 +528,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CONTAINS_KEYS.key(),
             "k1", "key0", "k2", "key1"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, cacheBulkPattern(true, true));
+        assertCacheBulkOperation(ret, true);
     }
 
     /**
@@ -456,10 +539,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_PUT.key(), "key", "key0", "val", "val1"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, cachePattern("val0", true));
+        assertCacheOperation(ret, "val0");
 
         assertEquals("val1", grid(0).cache(null).get("key0"));
     }
@@ -473,10 +553,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_PUT_IF_ABSENT.key(),
             "key", "key0", "val", "val1"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, cachePattern("val0", true));
+        assertCacheOperation(ret, "val0");
 
         assertEquals("val0", grid(0).cache(null).get("key0"));
     }
@@ -488,10 +565,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT_IF_ABSENT.key(),
             "key", "key0", "val", "val1"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, cachePattern(true, true));
+        assertCacheOperation(ret, true);
 
         assertEquals("val1", grid(0).cache(null).get("key0"));
     }
@@ -505,20 +579,14 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_VALUE.key(),
             "key", "key0", "val", "val1"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, cachePattern(false, true));
+        assertCacheOperation(ret, false);
 
         assertEquals("val0", grid(0).cache(null).get("key0"));
 
         ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_VALUE.key(),
             "key", "key0", "val", "val0"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, cachePattern(true, true));
+        assertCacheOperation(ret, true);
 
         assertNull(grid(0).cache(null).get("key0"));
     }
@@ -532,10 +600,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_REMOVE.key(),
             "key", "key0"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, cachePattern("val0", true));
+        assertCacheOperation(ret, "val0");
 
         assertNull(grid(0).cache(null).get("key0"));
     }
@@ -549,20 +614,14 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REPLACE_VALUE.key(),
             "key", "key0", "val", "val1", "val2", "val2"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, cachePattern(false, true));
+        assertCacheOperation(ret, false);
 
         assertEquals("val0", grid(0).cache(null).get("key0"));
 
         ret = content(F.asMap("cmd", GridRestCommand.CACHE_REPLACE_VALUE.key(),
             "key", "key0", "val", "val1", "val2", "val0"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, cachePattern(true, true));
+        assertCacheOperation(ret, true);
 
         assertEquals("val1", grid(0).cache(null).get("key0"));
     }
@@ -576,10 +635,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_REPLACE.key(),
             "key", "key0", "val", "val1"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, cachePattern("val0", true));
+        assertCacheOperation(ret, "val0");
 
         assertEquals("val1", grid(0).cache(null).get("key0"));
     }
@@ -591,14 +647,11 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT.key(),
             "key", "putKey", "val", "putVal"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("Put command result: " + ret);
 
         assertEquals("putVal", jcache().localPeek("putKey", CachePeekMode.ONHEAP));
 
-        jsonEquals(ret, cachePattern(true, true));
+        assertCacheOperation(ret, true);
     }
 
     /**
@@ -608,10 +661,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT.key(),
             "key", "putKey", "val", "putVal", "exp", "2000"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, cachePattern(true, true));
+        assertCacheOperation(ret, true);
 
         assertEquals("putVal", jcache().get("putKey"));
 
@@ -629,10 +679,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_ADD.key(),
             "key", "addKey2", "val", "addVal2"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, cachePattern(true, true));
+        assertCacheOperation(ret, true);
 
         assertEquals("addVal1", jcache().localPeek("addKey1", CachePeekMode.ONHEAP));
         assertEquals("addVal2", jcache().localPeek("addKey2", CachePeekMode.ONHEAP));
@@ -645,10 +692,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_ADD.key(),
             "key", "addKey", "val", "addVal", "exp", "2000"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, cachePattern(true, true));
+        assertCacheOperation(ret, true);
 
         assertEquals("addVal", jcache().get("addKey"));
 
@@ -665,15 +709,12 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
             "k1", "putKey1", "k2", "putKey2",
             "v1", "putVal1", "v2", "putVal2"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("Put all command result: " + ret);
 
         assertEquals("putVal1", jcache().localPeek("putKey1", CachePeekMode.ONHEAP));
         assertEquals("putVal2", jcache().localPeek("putKey2", CachePeekMode.ONHEAP));
 
-        jsonEquals(ret, cacheBulkPattern(true, true));
+        assertCacheBulkOperation(ret, true);
     }
 
     /**
@@ -687,14 +728,11 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE.key(),
             "key", "rmvKey"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("Remove command result: " + ret);
 
         assertNull(jcache().localPeek("rmvKey", CachePeekMode.ONHEAP));
 
-        jsonEquals(ret, cachePattern(true, true));
+        assertCacheOperation(ret, true);
     }
 
     /**
@@ -714,9 +752,6 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_ALL.key(),
             "k1", "rmvKey1", "k2", "rmvKey2"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("Remove all command result: " + ret);
 
         assertNull(jcache().localPeek("rmvKey1", CachePeekMode.ONHEAP));
@@ -724,13 +759,10 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         assertEquals("rmvVal3", jcache().localPeek("rmvKey3", CachePeekMode.ONHEAP));
         assertEquals("rmvVal4", jcache().localPeek("rmvKey4", CachePeekMode.ONHEAP));
 
-        jsonEquals(ret, cacheBulkPattern(true, true));
+        assertCacheBulkOperation(ret, true);
 
         ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_ALL.key()));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("Remove all command result: " + ret);
 
         assertNull(jcache().localPeek("rmvKey1", CachePeekMode.ONHEAP));
@@ -739,7 +771,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         assertNull(jcache().localPeek("rmvKey4", CachePeekMode.ONHEAP));
         assertTrue(jcache().localSize() == 0);
 
-        jsonEquals(ret, cacheBulkPattern(true, true));
+        assertCacheBulkOperation(ret, true);
     }
 
     /**
@@ -753,14 +785,11 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CAS.key(),
             "key", "casKey", "val2", "casOldVal", "val1", "casNewVal"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("CAS command result: " + ret);
 
         assertEquals("casNewVal", jcache().localPeek("casKey", CachePeekMode.ONHEAP));
 
-        jsonEquals(ret, cachePattern(true, true));
+        assertCacheOperation(ret, true);
 
         jcache().remove("casKey");
     }
@@ -776,14 +805,11 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REPLACE.key(),
             "key", "repKey", "val", "repVal"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("Replace command result: " + ret);
 
         assertEquals("repVal", jcache().localPeek("repKey", CachePeekMode.ONHEAP));
 
-        jsonEquals(ret, cachePattern(true, true));
+        assertCacheOperation(ret, true);
     }
 
     /**
@@ -797,10 +823,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REPLACE.key(),
             "key", "replaceKey", "val", "replaceValNew", "exp", "2000"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, cachePattern(true, true));
+        assertCacheOperation(ret, true);
 
         assertEquals("replaceValNew", jcache().get("replaceKey"));
 
@@ -819,10 +842,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_APPEND.key(),
             "key", "appendKey", "val", "_suffix"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, cachePattern(true, true));
+        assertCacheOperation(ret, true);
 
         assertEquals("appendVal_suffix", jcache().get("appendKey"));
     }
@@ -836,10 +856,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PREPEND.key(),
             "key", "prependKey", "val", "prefix_"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, cachePattern(true, true));
+        assertCacheOperation(ret, true);
 
         assertEquals("prefix_prependVal", jcache().get("prependKey"));
     }
@@ -851,20 +868,16 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.ATOMIC_INCREMENT.key(),
             "key", "incrKey", "init", "2", "delta", "3"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, integerPattern(5, true));
+        JsonNode res = jsonResponse(ret);
 
+        assertEquals(5, res.asInt());
         assertEquals(5, grid(0).atomicLong("incrKey", 0, true).get());
 
         ret = content(F.asMap("cmd", GridRestCommand.ATOMIC_INCREMENT.key(), "key", "incrKey", "delta", "10"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, integerPattern(15, true));
+        res = jsonResponse(ret);
 
+        assertEquals(15, res.asInt());
         assertEquals(15, grid(0).atomicLong("incrKey", 0, true).get());
     }
 
@@ -875,21 +888,17 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.ATOMIC_DECREMENT.key(),
             "key", "decrKey", "init", "15", "delta", "10"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, integerPattern(5, true));
+        JsonNode res = jsonResponse(ret);
 
+        assertEquals(5, res.asInt());
         assertEquals(5, grid(0).atomicLong("decrKey", 0, true).get());
 
         ret = content(F.asMap("cmd", GridRestCommand.ATOMIC_DECREMENT.key(),
             "key", "decrKey", "delta", "3"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, integerPattern(2, true));
+        res = jsonResponse(ret);
 
+        assertEquals(2, res.asInt());
         assertEquals(2, grid(0).atomicLong("decrKey", 0, true).get());
     }
 
@@ -904,14 +913,11 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CAS.key(),
             "key", "casKey", "val2", "casOldVal"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("CAR command result: " + ret);
 
         assertNull(jcache().localPeek("casKey", CachePeekMode.ONHEAP));
 
-        jsonEquals(ret, cachePattern(true, true));
+        assertCacheOperation(ret, true);
     }
 
     /**
@@ -923,14 +929,11 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CAS.key(),
             "key", "casKey", "val1", "casNewVal"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("PutIfAbsent command result: " + ret);
 
         assertEquals("casNewVal", jcache().localPeek("casKey", CachePeekMode.ONHEAP));
 
-        jsonEquals(ret, cachePattern(true, true));
+        assertCacheOperation(ret, true);
     }
 
     /**
@@ -943,14 +946,11 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CAS.key(), "key", "casKey"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("CAS Remove command result: " + ret);
 
         assertNull(jcache().localPeek("casKey", CachePeekMode.ONHEAP));
 
-        jsonEquals(ret, cachePattern(true, true));
+        assertCacheOperation(ret, true);
     }
 
     /**
@@ -959,12 +959,9 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testMetrics() throws Exception {
         String ret = content(F.asMap("cmd", GridRestCommand.CACHE_METRICS.key()));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("Cache metrics command result: " + ret);
 
-        jsonEquals(ret, cacheMetricsPattern("\\{.+\\}", true));
+        assertCacheMetrics(ret);
     }
 
     /**
@@ -981,20 +978,16 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         String ret = content(params);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("Cache metadata result: " + ret);
 
-        jsonEquals(ret, pattern("\\[.+\\]", true));
-
-        Collection<Map> results = (Collection)JSONObject.fromObject(ret).get("response");
+        JsonNode arr = jsonResponse(ret);
 
-        assertEquals(metas.size(), results.size());
-        assertEquals(cacheNameArg, F.first(results).get("cacheName"));
+        assertTrue(arr.isArray());
+        assertEquals(metas.size(), arr.size());
 
-        for (Map res : results) {
-            final Object cacheName = res.get("cacheName");
+        for (JsonNode item : arr) {
+            JsonNode cacheNameNode = item.get("cacheName");
+            final String cacheName = cacheNameNode != null ? cacheNameNode.asText() : null;
 
             GridCacheSqlMetadata meta = F.find(metas, null, new P1<GridCacheSqlMetadata>() {
                 @Override public boolean apply(GridCacheSqlMetadata meta) {
@@ -1004,49 +997,60 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
             assertNotNull("REST return metadata for unexpected cache: " + cacheName, meta);
 
-            Collection types = (Collection)res.get("types");
+            JsonNode types = item.get("types");
 
             assertNotNull(types);
-            assertEqualsCollections(meta.types(), types);
+            assertFalse(types.isNull());
 
-            Map keyClasses = (Map)res.get("keyClasses");
+            assertEqualsCollections(meta.types(), JSON_MAPPER.treeToValue(types, Collection.class));
+
+            JsonNode keyClasses = item.get("keyClasses");
 
             assertNotNull(keyClasses);
-            assertTrue(meta.keyClasses().equals(keyClasses));
+            assertFalse(keyClasses.isNull());
+
+            assertTrue(meta.keyClasses().equals(JSON_MAPPER.treeToValue(keyClasses, Map.class)));
 
-            Map valClasses = (Map)res.get("valClasses");
+            JsonNode valClasses = item.get("valClasses");
 
             assertNotNull(valClasses);
-            assertTrue(meta.valClasses().equals(valClasses));
+            assertFalse(valClasses.isNull());
+
+            assertTrue(meta.valClasses().equals(JSON_MAPPER.treeToValue(valClasses, Map.class)));
 
-            Map fields = (Map)res.get("fields");
+            JsonNode fields = item.get("fields");
 
             assertNotNull(fields);
-            assertTrue(meta.fields().equals(fields));
+            assertFalse(fields.isNull());
+            assertTrue(meta.fields().equals(JSON_MAPPER.treeToValue(fields, Map.class)));
 
-            Map indexesByType = (Map)res.get("indexes");
+            JsonNode indexesByType = item.get("indexes");
 
             assertNotNull(indexesByType);
+            assertFalse(indexesByType.isNull());
             assertEquals(meta.indexes().size(), indexesByType.size());
 
             for (Map.Entry<String, Collection<GridCacheSqlIndexMetadata>> metaIndexes : meta.indexes().entrySet()) {
-                Collection<Map> indexes = (Collection<Map>)indexesByType.get(metaIndexes.getKey());
+                JsonNode indexes = indexesByType.get(metaIndexes.getKey());
 
                 assertNotNull(indexes);
+                assertFalse(indexes.isNull());
                 assertEquals(metaIndexes.getValue().size(), indexes.size());
 
                 for (final GridCacheSqlIndexMetadata metaIdx : metaIndexes.getValue()) {
-                    Map idx = F.find(indexes, null, new P1<Map>() {
-                        @Override public boolean apply(Map map) {
-                            return metaIdx.name().equals(map.get("name"));
+                    JsonNode idx = F.find(indexes, null, new P1<JsonNode>() {
+                        @Override public boolean apply(JsonNode idx) {
+                            return metaIdx.name().equals(idx.get("name").asText());
                         }
                     });
 
                     assertNotNull(idx);
 
-                    assertEqualsCollections(metaIdx.fields(), (Collection)idx.get("fields"));
-                    assertEqualsCollections(metaIdx.descendings(), (Collection)idx.get("descendings"));
-                    assertEquals(metaIdx.unique(), idx.get("unique"));
+                    assertEqualsCollections(metaIdx.fields(),
+                        JSON_MAPPER.treeToValue(idx.get("fields"), Collection.class));
+                    assertEqualsCollections(metaIdx.descendings(),
+                        JSON_MAPPER.treeToValue(idx.get("descendings"), Collection.class));
+                    assertEquals(metaIdx.unique(), idx.get("unique").asBoolean());
                 }
             }
         }
@@ -1087,32 +1091,28 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testTopology() throws Exception {
         String ret = content(F.asMap("cmd", GridRestCommand.TOPOLOGY.key(), "attr", "false", "mtr", "false"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("Topology command result: " + ret);
 
-        jsonEquals(ret, pattern("\\[\\{.+\\}\\]", true));
-
-        JSONObject json = JSONObject.fromObject(ret);
+        JsonNode res = jsonResponse(ret);
 
-        Collection<Map> nodes = (Collection)json.get("response");
+        assertEquals(GRID_CNT, res.size());
 
-        assertEquals(GRID_CNT, nodes.size());
+        for (JsonNode node : res) {
+            assertTrue(node.get("attributes").isNull());
+            assertTrue(node.get("metrics").isNull());
 
-        for (Map node : nodes) {
-            assertEquals(JSONNull.getInstance(), node.get("attributes"));
-            assertEquals(JSONNull.getInstance(), node.get("metrics"));
+            JsonNode caches = node.get("caches");
 
-            Collection<Map> caches = (Collection)node.get("caches");
+            assertFalse(caches.isNull());
 
             Collection<IgniteCacheProxy<?, ?>> publicCaches = grid(0).context().cache().publicCaches();
 
-            assertNotNull(caches);
             assertEquals(publicCaches.size(), caches.size());
 
-            for (Map cache : caches) {
-                final String cacheName = cache.get("name").equals("") ? null : (String)cache.get("name");
+            for (JsonNode cache : caches) {
+                String cacheName0 = cache.get("name").asText();
+
+                final String cacheName = cacheName0.equals("") ? null : cacheName0;
 
                 IgniteCacheProxy<?, ?> publicCache = F.find(publicCaches, null, new P1<IgniteCacheProxy<?, ?>>() {
                     @Override public boolean apply(IgniteCacheProxy<?, ?> c) {
@@ -1122,9 +1122,9 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
                 assertNotNull(publicCache);
 
-                CacheMode cacheMode = CacheMode.valueOf((String)cache.get("mode"));
+                CacheMode cacheMode = CacheMode.valueOf(cache.get("mode").asText());
 
-                assertEquals(publicCache.getConfiguration(CacheConfiguration.class).getCacheMode(),cacheMode);
+                assertEquals(publicCache.getConfiguration(CacheConfiguration.class).getCacheMode(), cacheMode);
             }
         }
     }
@@ -1136,31 +1136,30 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String ret = content(F.asMap("cmd", GridRestCommand.NODE.key(), "attr", "true", "mtr", "true", "id",
             grid(0).localNode().id().toString()));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("Topology command result: " + ret);
 
-        jsonEquals(ret, pattern("\\{.+\\}", true));
+        JsonNode res = jsonResponse(ret);
 
-        ret = content(F.asMap("cmd", GridRestCommand.NODE.key(), "attr", "false", "mtr", "false", "ip", LOC_HOST));
+        assertTrue(res.get("attributes").isObject());
+        assertTrue(res.get("metrics").isObject());
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
+        ret = content(F.asMap("cmd", GridRestCommand.NODE.key(), "attr", "false", "mtr", "false", "ip", LOC_HOST));
 
         info("Topology command result: " + ret);
 
-        jsonEquals(ret, pattern("\\{.+\\}", true));
+        res = jsonResponse(ret);
+
+        assertTrue(res.get("attributes").isNull());
+        assertTrue(res.get("metrics").isNull());
 
         ret = content(F.asMap("cmd", GridRestCommand.NODE.key(), "attr", "false", "mtr", "false", "ip", LOC_HOST, "id",
             UUID.randomUUID().toString()));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("Topology command result: " + ret);
 
-        jsonEquals(ret, pattern("null", true));
+        res = jsonResponse(ret);
+
+        assertTrue(res.isNull());
     }
 
     /**
@@ -1173,52 +1172,41 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testExe() throws Exception {
         String ret = content(F.asMap("cmd", GridRestCommand.EXE.key()));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("Exe command result: " + ret);
 
-        jsonEquals(ret, pattern("null", false));
+        assertResponseContainsError(ret);
 
         // Attempt to execute unknown task (UNKNOWN_TASK) will result in exception on server.
         ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", "UNKNOWN_TASK"));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("Exe command result: " + ret);
 
-        jsonEquals(ret, pattern("null", false));
+        assertResponseContainsError(ret);
 
         grid(0).compute().localDeployTask(TestTask1.class, TestTask1.class.getClassLoader());
         grid(0).compute().localDeployTask(TestTask2.class, TestTask2.class.getClassLoader());
 
         ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", TestTask1.class.getName()));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
         info("Exe command result: " + ret);
 
-        jsonEquals(ret, pattern("\\{.+\\}", true));
+        JsonNode res = jsonTaskResult(ret);
 
-        ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", TestTask2.class.getName()));
+        assertTrue(res.isNull());
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
+        ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", TestTask2.class.getName()));
 
         info("Exe command result: " + ret);
 
-        jsonEquals(ret, pattern("\\{.+" + TestTask2.RES + ".+\\}", true));
+        res = jsonTaskResult(ret);
 
-        ret = content(F.asMap("cmd", GridRestCommand.RESULT.key()));
+        assertEquals(TestTask2.RES, res.asText());
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
+        ret = content(F.asMap("cmd", GridRestCommand.RESULT.key()));
 
         info("Exe command result: " + ret);
 
-        jsonEquals(ret, pattern("null", false));
+        assertResponseContainsError(ret);
     }
 
     /**
@@ -1229,9 +1217,6 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testVisorGateway() throws Exception {
         ClusterNode locNode = grid(1).localNode();
 
-        final String successRes = pattern(
-            "\\{\\\"error\\\":\\\"\\\",\\\"finished\\\":true,\\\"id\\\":\\\"[^\\\"]+\\\",\\\"result\\\":.+}", true);
-
         final IgniteUuid cid = grid(1).context().cache().internalCache("person").context().dynamicDeploymentId();
 
         String ret = content(new VisorGatewayArgument(VisorCacheConfigurationCollectorTask.class)
@@ -1240,10 +1225,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorCacheConfigurationCollectorTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorCacheNodesTask.class)
             .forNode(locNode)
@@ -1251,10 +1233,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorCacheNodesTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorCacheLoadTask.class)
             .forNode(locNode)
@@ -1262,10 +1241,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorCacheLoadTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorCacheSwapBackupsTask.class)
             .forNode(locNode)
@@ -1273,10 +1249,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorCacheSwapBackupsTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorCacheRebalanceTask.class)
             .forNode(locNode)
@@ -1284,10 +1257,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorCacheRebalanceTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorCacheMetadataTask.class)
             .forNode(locNode)
@@ -1295,10 +1265,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorCacheMetadataTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorCacheResetMetricsTask.class)
             .forNode(locNode)
@@ -1306,10 +1273,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorCacheResetMetricsTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorIgfsSamplingStateTask.class)
             .forNode(locNode)
@@ -1317,10 +1281,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorIgfsSamplingStateTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorIgfsProfilerClearTask.class)
             .forNode(locNode)
@@ -1328,10 +1289,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorIgfsProfilerClearTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorIgfsProfilerTask.class)
             .forNode(locNode)
@@ -1339,10 +1297,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorIgfsProfilerTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorIgfsFormatTask.class)
             .forNode(locNode)
@@ -1350,10 +1305,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorIgfsFormatTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorIgfsResetMetricsTask.class)
             .forNode(locNode)
@@ -1361,20 +1313,14 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorIgfsResetMetricsTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorThreadDumpTask.class)
             .forNode(locNode));
 
         info("VisorThreadDumpTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorLatestTextFilesTask.class)
             .forNode(locNode)
@@ -1382,20 +1328,14 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorLatestTextFilesTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorLatestVersionTask.class)
             .forNode(locNode));
 
         info("VisorLatestVersionTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorFileBlockTask.class)
             .forNode(locNode)
@@ -1403,10 +1343,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorFileBlockTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorNodePingTask.class)
             .forNode(locNode)
@@ -1414,45 +1351,31 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorNodePingTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorNodeConfigurationCollectorTask.class)
             .forNode(locNode));
 
         info("VisorNodeConfigurationCollectorTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorComputeResetMetricsTask.class)
             .forNode(locNode));
 
         info("VisorComputeResetMetricsTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorQueryTask.class)
             .forNode(locNode)
-            .argument(VisorQueryArg.class, "person", URLEncoder.encode("select * from Person"), false, 1));
+            .argument(VisorQueryArg.class, "person", URLEncoder.encode("select * from Person", CHARSET), false, 1));
 
         info("VisorQueryTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
+        JsonNode res = jsonTaskResult(ret);
 
-        jsonEquals(ret, successRes);
-
-        JSONObject json = JSONObject.fromObject(ret);
-
-        final String qryId = (String)((Map)((Map)((Map)json.get("response")).get("result")).get("value")).get("queryId");
+        final String qryId = res.get("value").get("queryId").asText();
 
         ret = content(new VisorGatewayArgument(VisorQueryNextPageTask.class)
             .forNode(locNode)
@@ -1460,30 +1383,21 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorQueryNextPageTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorQueryCleanupTask.class)
             .map(UUID.class, Set.class, F.asMap(locNode.id(), qryId)));
 
         info("VisorQueryCleanupTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorResolveHostNameTask.class)
             .forNode(locNode));
 
         info("VisorResolveHostNameTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         // Multinode tasks
 
@@ -1492,10 +1406,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorComputeCancelSessionsTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorCacheMetricsCollectorTask.class)
             .pair(Boolean.class, Set.class, false, "person"));
@@ -1508,39 +1419,27 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorCacheMetricsCollectorTask (with nodes) result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorLogSearchTask.class)
             .argument(VisorLogSearchTask.VisorLogSearchArg.class, ".", ".", "abrakodabra.txt", 1));
 
         info("VisorLogSearchTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorNodeGcTask.class));
 
         info("VisorNodeGcTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorAckTask.class)
             .argument("MSG"));
 
         info("VisorAckTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorNodeEventsCollectorTask.class)
             .argument(VisorNodeEventsCollectorTask.VisorNodeEventsCollectorTaskArg.class,
@@ -1548,10 +1447,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorNodeEventsCollectorTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorNodeDataCollectorTask.class)
             .argument(VisorNodeDataCollectorTaskArg.class, false,
@@ -1559,30 +1455,21 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorNodeDataCollectorTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorComputeToggleMonitoringTask.class)
             .pair(String.class, Boolean.class, UUID.randomUUID(), false));
 
         info("VisorComputeToggleMonitoringTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorNodeSuppressedErrorsTask.class)
             .map(UUID.class, Long.class, new HashMap()));
 
         info("VisorNodeSuppressedErrorsTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorCacheClearTask.class)
             .forNode(locNode)
@@ -1590,10 +1477,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorCacheClearTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         /** Spring XML to start cache via Visor task. */
         final String START_CACHE =
@@ -1608,14 +1492,12 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
                     "</beans>";
 
         ret = content(new VisorGatewayArgument(VisorCacheStartTask.class)
-            .argument(VisorCacheStartTask.VisorCacheStartArg.class, false, "person2", URLEncoder.encode(START_CACHE)));
+            .argument(VisorCacheStartTask.VisorCacheStartArg.class, false, "person2",
+                URLEncoder.encode(START_CACHE, CHARSET)));
 
         info("VisorCacheStartTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorCacheStopTask.class)
             .forNode(locNode)
@@ -1623,10 +1505,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         info("VisorCacheStopTask result: " + ret);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        jsonEquals(ret, successRes);
+        jsonTaskResult(ret);
     }
 
     /**
@@ -1635,10 +1514,9 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testVersion() throws Exception {
         String ret = content(F.asMap("cmd", GridRestCommand.VERSION.key()));
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
+        JsonNode res = jsonResponse(ret);
 
-        jsonEquals(ret, stringPattern(".+", true));
+        assertEquals(VER_STR, res.asText());
     }
 
     /**
@@ -1652,18 +1530,13 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         params.put("type", "Person");
         params.put("pageSize", "10");
         params.put("cacheName", "person");
-        params.put("qry", URLEncoder.encode(qry));
+        params.put("qry", URLEncoder.encode(qry, CHARSET));
         params.put("arg1", "1000");
         params.put("arg2", "2000");
 
         String ret = content(params);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        JSONObject json = JSONObject.fromObject(ret);
-
-        List items = (List)((Map)json.get("response")).get("items");
+        JsonNode items = jsonResponse(ret).get("items");
 
         assertEquals(2, items.size());
 
@@ -1681,12 +1554,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         String ret = content(params);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        JSONObject json = JSONObject.fromObject(ret);
-
-        List items = (List)((Map)json.get("response")).get("items");
+        JsonNode items = jsonResponse(ret).get("items");
 
         assertEquals(4, items.size());
 
@@ -1705,12 +1573,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         String ret = content(params);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        JSONObject json = JSONObject.fromObject(ret);
-
-        List items = (List)((Map)json.get("response")).get("items");
+        JsonNode items = jsonResponse(ret).get("items");
 
         assertEquals(2, items.size());
 
@@ -1721,22 +1584,17 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testIncorrectFilterQueryScan() throws Exception {
+        String clsName = ScanFilter.class.getName() + 1;
+
         Map<String, String> params = new HashMap<>();
         params.put("cmd", GridRestCommand.EXECUTE_SCAN_QUERY.key());
         params.put("pageSize", "10");
         params.put("cacheName", "person");
-        params.put("className", ScanFilter.class.getName() + 1);
+        params.put("className", clsName);
 
         String ret = content(params);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        JSONObject json = JSONObject.fromObject(ret);
-
-        String err = (String)json.get("error");
-
-        assertTrue(err.contains("Failed to find target class"));
+        assertResponseContainsError(ret, "Failed to find target class: " + clsName);
     }
 
     /**
@@ -1751,42 +1609,33 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         params.put("cmd", GridRestCommand.EXECUTE_SQL_QUERY.key());
         params.put("type", "String");
         params.put("pageSize", "1");
-        params.put("qry", URLEncoder.encode("select * from String"));
+        params.put("qry", URLEncoder.encode("select * from String", CHARSET));
 
         String ret = content(params);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        JSONObject json = JSONObject.fromObject(ret);
-
-        Integer qryId = (Integer)((Map)json.get("response")).get("queryId");
+        JsonNode qryId = jsonResponse(ret).get("queryId");
 
-        assertNotNull(qryId);
+        assertFalse(jsonResponse(ret).get("queryId").isNull());
 
         ret = content(F.asMap("cmd", GridRestCommand.FETCH_SQL_QUERY.key(),
-            "pageSize", "1", "qryId", String.valueOf(qryId)));
+            "pageSize", "1", "qryId", qryId.asText()));
 
-        json = JSONObject.fromObject(ret);
+        JsonNode res = jsonResponse(ret);
 
-        Integer qryId0 = (Integer)((Map)json.get("response")).get("queryId");
-
-        Boolean last = (Boolean)((Map)json.get("response")).get("last");
+        JsonNode qryId0 = jsonResponse(ret).get("queryId");
 
         assertEquals(qryId0, qryId);
-        assertFalse(last);
+        assertFalse(res.get("last").asBoolean());
 
         ret = content(F.asMap("cmd", GridRestCommand.FETCH_SQL_QUERY.key(),
-            "pageSize", "1", "qryId", String.valueOf(qryId)));
-
-        json = JSONObject.fromObject(ret);
+            "pageSize", "1", "qryId", qryId.asText()));
 
-        qryId0 = (Integer)((Map)json.get("response")).get("queryId");
+        res = jsonResponse(ret);
 
-        last = (Boolean)((Map)json.get("response")).get("last");
+        qryId0 = jsonResponse(ret).get("queryId");
 
         assertEquals(qryId0, qryId);
-        assertTrue(last);
+        assertTrue(res.get("last").asBoolean());
 
         assertFalse(queryCursorFound());
     }
@@ -1801,16 +1650,11 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         params.put("cmd", GridRestCommand.EXECUTE_SQL_FIELDS_QUERY.key());
         params.put("pageSize", "10");
         params.put("cacheName", "person");
-        params.put("qry", URLEncoder.encode(qry));
+        params.put("qry", URLEncoder.encode(qry, CHARSET));
 
         String ret = content(params);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        JSONObject json = JSONObject.fromObject(ret);
-
-        List items = (List)((Map)json.get("response")).get("items");
+        JsonNode items = jsonResponse(ret).get("items");
 
         assertEquals(4, items.size());
 
@@ -1827,29 +1671,25 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         params.put("cmd", GridRestCommand.EXECUTE_SQL_FIELDS_QUERY.key());
         params.put("pageSize", "10");
         params.put("cacheName", "person");
-        params.put("qry", URLEncoder.encode(qry));
+        params.put("qry", URLEncoder.encode(qry, CHARSET));
 
         String ret = content(params);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
+        JsonNode res = jsonResponse(ret);
 
-        JSONObject json = JSONObject.fromObject(ret);
+        JsonNode items = res.get("items");
 
-        List items = (List)((Map)json.get("response")).get("items");
-
-        List meta = (List)((Map)json.get("response")).get("fieldsMetadata");
+        JsonNode meta = res.get("fieldsMetadata");
 
         assertEquals(4, items.size());
-
         assertEquals(2, meta.size());
 
-        JSONObject o = (JSONObject)meta.get(0);
+        JsonNode o = meta.get(0);
 
-        assertEquals("FIRSTNAME", o.get("fieldName"));
-        assertEquals("java.lang.String", o.get("fieldTypeName"));
-        assertEquals("person", o.get("schemaName"));
-        assertEquals("PERSON", o.get("typeName"));
+        assertEquals("FIRSTNAME", o.get("fieldName").asText());
+        assertEquals("java.lang.String", o.get("fieldTypeName").asText());
+        assertEquals("person", o.get("schemaName").asText());
+        assertEquals("PERSON", o.get("typeName").asText());
 
         assertFalse(queryCursorFound());
     }
@@ -1865,32 +1705,23 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         params.put("type", "Person");
         params.put("pageSize", "1");
         params.put("cacheName", "person");
-        params.put("qry", URLEncoder.encode(qry));
+        params.put("qry", URLEncoder.encode(qry, CHARSET));
         params.put("arg1", "1000");
         params.put("arg2", "2000");
 
         String ret = content(params);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        JSONObject json = JSONObject.fromObject(ret);
+        JsonNode res = jsonResponse(ret);
 
-        List items = (List)((Map)json.get("response")).get("items");
-
-        assertEquals(1, items.size());
+        assertEquals(1, res.get("items").size());
 
         assertTrue(queryCursorFound());
 
-        Integer qryId = (Integer)((Map)json.get("response")).get("queryId");
-
-        assertNotNull(qryId);
+        assertFalse(res.get("queryId").isNull());
 
-        ret = content(F.asMap("cmd", GridRestCommand.CLOSE_SQL_QUERY.key(),
-            "cacheName", "person", "qryId", String.valueOf(qryId)));
+        String qryId = res.get("queryId").asText();
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
+        content(F.asMap("cmd", GridRestCommand.CLOSE_SQL_QUERY.key(), "cacheName", "person", "qryId", qryId));
 
         assertFalse(queryCursorFound());
     }
@@ -1906,7 +1737,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         params.put("type", "Person");
         params.put("pageSize", "1");
         params.put("cacheName", "person");
-        params.put("qry", URLEncoder.encode(qry));
+        params.put("qry", URLEncoder.encode(qry, CHARSET));
         params.put("arg1", "1000");
         params.put("arg2", "2000");
 
@@ -1915,12 +1746,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         for (int i = 0; i < 10; ++i)
             ret = content(params);
 
-        assertNotNull(ret);
-        assertTrue(!ret.isEmpty());
-
-        JSONObject json = JSONObject.fromObject(ret);
-
-        List items = (List)((Map)json.get("response")).get("items");
+        JsonNode items = jsonResponse(ret).get("items");
 
         assertEquals(1, items.size());
 
@@ -2238,7 +2064,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
          * @param valCls Value class.
          * @param map Map.
          */
-        public VisorGatewayArgument map(Class keyCls, Class valCls, Map<?, ?> map) {
+        public VisorGatewayArgument map(Class keyCls, Class valCls, Map<?, ?> map) throws UnsupportedEncodingException {
             put("p" + idx++, Map.class.getName());
             put("p" + idx++, keyCls.getName());
             put("p" + idx++, valCls.getName());
@@ -2259,7 +2085,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
                 first = false;
             }
 
-            put("p" + idx++, URLEncoder.encode(sb.toString()));
+            put("p" + idx++, URLEncoder.encode(sb.toString(), CHARSET));
 
             return this;
         }
@@ -2285,7 +2111,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
             }
 
             return sb.toString();
-        };
+        }
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/SimplePerson.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/SimplePerson.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/SimplePerson.java
new file mode 100644
index 0000000..119e873
--- /dev/null
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/SimplePerson.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.rest;
+
+import java.sql.Date;
+
+/**
+ * Test class with public fields and without getters and setters.
+ */
+public class SimplePerson {
+    /** Person ID. */
+    public int id;
+
+    /** Person name. */
+    public String name;
+
+    /** Person birthday. */
+    public Date birthday;
+
+    /** Person salary. */
+    public double salary;
+
+    /**
+     * Default constructor.
+     */
+    public SimplePerson() {
+        // No-op.
+    }
+
+    /**
+     * Full constructor.
+     *
+     * @param id Person ID.
+     * @param name Person name.
+     * @param birthday Person birthday.
+     * @param salary Person salary.
+     */
+    public SimplePerson(int id, String name, Date birthday, double salary) {
+        this.id = id;
+        this.name = name;
+        this.birthday = birthday;
+        this.salary = salary;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index 34368c8..5e32caf 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -76,6 +76,13 @@
         </dependency>
 
         <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+            <version>3.2.2</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
             <groupId>commons-dbcp</groupId>
             <artifactId>commons-dbcp</artifactId>
             <version>1.4</version>
@@ -153,14 +160,6 @@
         </dependency>
 
         <dependency>
-            <groupId>net.sf.json-lib</groupId>
-            <artifactId>json-lib</artifactId>
-            <version>${jsonlib.version}</version>
-            <classifier>jdk15</classifier>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
             <groupId>org.gridgain</groupId>
             <artifactId>ignite-shmem</artifactId>
             <version>1.0.0</version>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/LessNamingBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/LessNamingBean.java b/modules/core/src/main/java/org/apache/ignite/internal/LessNamingBean.java
new file mode 100644
index 0000000..3b885f9
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/LessNamingBean.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+
+/**
+ * Marker interface for beans with less naming conventions i.e., without "get" and "set" prefixes.
+ */
+@GridToStringExclude
+public interface LessNamingBean {
+    // No-op.
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlIndexMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlIndexMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlIndexMetadata.java
index 539a156..94602f7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlIndexMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlIndexMetadata.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache.query;
 
 import java.io.Externalizable;
 import java.util.Collection;
+import org.apache.ignite.internal.LessNamingBean;
 
 /**
  * Ignite index descriptor.
@@ -27,7 +28,7 @@ import java.util.Collection;
  * {@link GridCacheSqlMetadata#indexes(String)} method.
  * @see GridCacheSqlMetadata
  */
-public interface GridCacheSqlIndexMetadata extends Externalizable {
+public interface GridCacheSqlIndexMetadata extends Externalizable, LessNamingBean {
     /**
      * Gets name of the index.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlMetadata.java
index 724962e..c82d2cb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlMetadata.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.query;
 import java.io.Externalizable;
 import java.util.Collection;
 import java.util.Map;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.spi.indexing.IndexingSpi;
 import org.jetbrains.annotations.Nullable;
 
@@ -30,7 +31,7 @@ import org.jetbrains.annotations.Nullable;
  * can be used to gather information about what can
  * be queried using Ignite cache queries feature.
  */
-public interface GridCacheSqlMetadata extends Externalizable {
+public interface GridCacheSqlMetadata extends Externalizable, LessNamingBean {
     /**
      * Cache name.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
index 1c3a5b5..84ada07 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
@@ -26,6 +26,7 @@ import java.util.concurrent.ConcurrentLinkedDeque;
 import java.util.concurrent.atomic.AtomicLong;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -156,7 +157,7 @@ public class IgniteExceptionRegistry {
      * Detailed info about suppressed error.
      */
     @SuppressWarnings("PublicInnerClass")
-    public static class ExceptionInfo implements Serializable {
+    public static class ExceptionInfo implements Serializable, LessNamingBean {
         /** */
         private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
index f06813f..a440ac3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
@@ -21,12 +21,12 @@ import java.io.Serializable;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
-import java.util.Set;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
@@ -42,7 +42,7 @@ import org.jetbrains.annotations.Nullable;
 /**
  * Data transfer object for {@link IgniteCache}.
  */
-public class VisorCache implements Serializable {
+public class VisorCache implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java
index 7aa6215..3d18e59 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java
@@ -21,6 +21,7 @@ import java.io.Serializable;
 import org.apache.ignite.cache.affinity.AffinityFunction;
 import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
 import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.jetbrains.annotations.Nullable;
 
@@ -29,7 +30,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
 /**
  * Data transfer object for affinity configuration properties.
  */
-public class VisorCacheAffinityConfiguration implements Serializable {
+public class VisorCacheAffinityConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
index 0cba24b..c779051 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
@@ -23,12 +23,13 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
 import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Data transfer object for aggregated cache metrics.
  */
-public class VisorCacheAggregatedMetrics implements Serializable {
+public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee0a40e0/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
index 5d27a8a..869a12c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
@@ -27,6 +27,7 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.jetbrains.annotations.Nullable;
 import org.apache.ignite.lang.IgniteProductVersion;
@@ -36,7 +37,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
 /**
  * Data transfer object for cache configuration properties.
  */
-public class VisorCacheConfiguration implements Serializable {
+public class VisorCacheConfiguration implements Serializable, LessNamingBean {
     /** */
     private static final long serialVersionUID = 0L;