Repository: ignite Updated Branches: refs/heads/ignite-5072-merge fe50d761e -> 588ddcb8f
IGNITE-5095 NULL strings in REST-HTTP should be serialized as null. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6ccfc0b2 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6ccfc0b2 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6ccfc0b2 Branch: refs/heads/ignite-5072-merge Commit: 6ccfc0b26ea9af2d40d76359e3da621f0fded95d Parents: f5db974 Author: Alexey Kuznetsov <[email protected]> Authored: Thu Apr 27 15:37:17 2017 +0700 Committer: Alexey Kuznetsov <[email protected]> Committed: Thu Apr 27 15:37:17 2017 +0700 ---------------------------------------------------------------------- .../client/ClientDefaultCacheSelfTest.java | 4 +- .../JettyRestProcessorAbstractSelfTest.java | 143 +++++++++---------- .../http/jetty/GridJettyObjectMapper.java | 13 +- 3 files changed, 74 insertions(+), 86 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/6ccfc0b2/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 25fa2e9..2fe6084 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 @@ -176,8 +176,8 @@ public class ClientDefaultCacheSelfTest extends GridCommonAbstractTest { assertFalse(node.get("affinityNodeId").asText().isEmpty()); assertEquals(0, node.get("successStatus").asInt()); - assertTrue(node.get("error").asText().isEmpty()); - assertTrue(node.get("sessionToken").asText().isEmpty()); + assertTrue(node.get("error").isNull()); + assertTrue(node.get("sessionToken").isNull()); return node.get("response"); } http://git-wip-us.apache.org/repos/asf/ignite/blob/6ccfc0b2/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 130d9d1..0207782 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 @@ -238,9 +238,9 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro JsonNode node = JSON_MAPPER.readTree(content); assertEquals(1, node.get("successStatus").asInt()); - assertFalse(node.get("error").asText().isEmpty()); + assertFalse(node.get("error").isNull()); assertTrue(node.get("response").isNull()); - assertTrue(node.get("sessionToken").asText().isEmpty()); + assertTrue(node.get("sessionToken").isNull()); } /** @@ -270,11 +270,11 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro JsonNode node = JSON_MAPPER.readTree(content); - assertEquals(bulk, node.get("affinityNodeId").asText().isEmpty()); + assertEquals(bulk, node.get("affinityNodeId").isNull()); assertEquals(0, node.get("successStatus").asInt()); - assertTrue(node.get("error").asText().isEmpty()); + assertTrue(node.get("error").isNull()); - assertNotSame(securityEnabled(), node.get("sessionToken").asText().isEmpty()); + assertNotSame(securityEnabled(), node.get("sessionToken").isNull()); return node.get("response"); } @@ -319,9 +319,9 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro JsonNode node = JSON_MAPPER.readTree(content); assertEquals(0, node.get("successStatus").asInt()); - assertTrue(node.get("error").asText().isEmpty()); + assertTrue(node.get("error").isNull()); - assertNotSame(securityEnabled(), node.get("sessionToken").asText().isEmpty()); + assertNotSame(securityEnabled(), node.get("sessionToken").isNull()); return node.get("response"); } @@ -337,18 +337,18 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro JsonNode node = JSON_MAPPER.readTree(content); assertEquals(0, node.get("successStatus").asInt()); - assertTrue(node.get("error").asText().isEmpty()); + assertTrue(node.get("error").isNull()); assertFalse(node.get("response").isNull()); - assertEquals(securityEnabled(), !node.get("sessionToken").asText().isEmpty()); + assertEquals(securityEnabled(), !node.get("sessionToken").isNull()); JsonNode res = node.get("response"); assertTrue(res.isObject()); - assertFalse(res.get("id").asText().isEmpty()); + assertFalse(res.get("id").isNull()); assertTrue(res.get("finished").asBoolean()); - assertTrue(res.get("error").asText().isEmpty()); + assertTrue(res.get("error").isNull()); return res.get("result"); } @@ -359,7 +359,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro public void testGet() throws Exception { jcache().put("getKey", "getVal"); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "getKey")); + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET.key(), "key", "getKey")); info("Get command result: " + ret); @@ -376,7 +376,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro jcache().put("mapKey1", map1); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "mapKey1")); + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET.key(), "key", "mapKey1")); info("Get command result: " + ret); @@ -390,7 +390,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro jcache().put("mapKey2", map2); - ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "mapKey2")); + ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET.key(), "key", "mapKey2")); info("Get command result: " + ret); @@ -407,7 +407,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro jcache().put("simplePersonKey", p); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "simplePersonKey")); + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET.key(), "key", "simplePersonKey")); info("Get command result: " + ret); @@ -434,7 +434,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro jcache().put("utilDateKey", utilDate); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "utilDateKey")); + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET.key(), "key", "utilDateKey")); info("Get command result: " + ret); @@ -444,7 +444,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro jcache().put("sqlDateKey", sqlDate); - ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "sqlDateKey")); + ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET.key(), "key", "sqlDateKey")); info("Get SQL result: " + ret); @@ -452,7 +452,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro jcache().put("timestampKey", new java.sql.Timestamp(utilDate.getTime())); - ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "timestampKey")); + ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET.key(), "key", "timestampKey")); info("Get timestamp: " + ret); @@ -467,7 +467,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro jcache().put("uuidKey", uuid); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "uuidKey")); + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET.key(), "key", "uuidKey")); info("Get command result: " + ret); @@ -477,7 +477,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro jcache().put("igniteUuidKey", igniteUuid); - ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "igniteUuidKey")); + ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET.key(), "key", "igniteUuidKey")); info("Get command result: " + ret); @@ -492,7 +492,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro jcache().put("tupleKey", t); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "tupleKey")); + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET.key(), "key", "tupleKey")); info("Get command result: " + ret); @@ -510,7 +510,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro jcache().put("getKey", "getVal"); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_SIZE.key())); + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_SIZE.key())); info("Size command result: " + ret); @@ -521,7 +521,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro * @throws Exception If failed. */ public void testIgniteName() throws Exception { - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.NAME.key())); + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.NAME.key())); info("Name command result: " + ret); @@ -532,13 +532,13 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro * @throws Exception If failed. */ public void testGetOrCreateCache() throws Exception { - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.GET_OR_CREATE_CACHE.key(), "cacheName", "testCache")); + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.GET_OR_CREATE_CACHE.key(), "cacheName", "testCache")); info("Name command result: " + ret); grid(0).cache("testCache").put("1", "1"); - ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.DESTROY_CACHE.key(), "cacheName", "testCache")); + ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.DESTROY_CACHE.key(), "cacheName", "testCache")); assertTrue(jsonResponse(ret).isNull()); @@ -711,7 +711,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro * @throws Exception If failed. */ public void testPut() throws Exception { - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_PUT.key(), + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_PUT.key(), "key", "putKey", "val", "putVal")); info("Put command result: " + ret); @@ -725,7 +725,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro * @throws Exception If failed. */ public void testPutWithExpiration() throws Exception { - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_PUT.key(), + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_PUT.key(), "key", "putKey", "val", "putVal", "exp", "2000")); assertCacheOperation(ret, true); @@ -743,7 +743,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro public void testAdd() throws Exception { jcache().put("addKey1", "addVal1"); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_ADD.key(), + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_ADD.key(), "key", "addKey2", "val", "addVal2")); assertCacheOperation(ret, true); @@ -756,7 +756,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro * @throws Exception If failed. */ public void testAddWithExpiration() throws Exception { - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_ADD.key(), + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_ADD.key(), "key", "addKey", "val", "addVal", "exp", "2000")); assertCacheOperation(ret, true); @@ -797,7 +797,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro assertEquals("rmvVal", jcache().localPeek("rmvKey")); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_REMOVE.key(), + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_REMOVE.key(), "key", "rmvKey")); info("Remove command result: " + ret); @@ -821,7 +821,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro assertEquals("rmvVal3", jcache().localPeek("rmvKey3")); assertEquals("rmvVal4", jcache().localPeek("rmvKey4")); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_REMOVE_ALL.key(), + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_REMOVE_ALL.key(), "k1", "rmvKey1", "k2", "rmvKey2")); info("Remove all command result: " + ret); @@ -833,7 +833,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro assertCacheBulkOperation(ret, true); - ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_REMOVE_ALL.key())); + ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_REMOVE_ALL.key())); info("Remove all command result: " + ret); @@ -854,7 +854,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro assertEquals("casOldVal", jcache().localPeek("casKey")); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_CAS.key(), + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_CAS.key(), "key", "casKey", "val2", "casOldVal", "val1", "casNewVal")); info("CAS command result: " + ret); @@ -874,7 +874,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro assertEquals("repOldVal", jcache().localPeek("repKey")); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_REPLACE.key(), + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_REPLACE.key(), "key", "repKey", "val", "repVal")); info("Replace command result: " + ret); @@ -892,7 +892,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro assertEquals("replaceVal", jcache().get("replaceKey")); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_REPLACE.key(), + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_REPLACE.key(), "key", "replaceKey", "val", "replaceValNew", "exp", "2000")); assertCacheOperation(ret, true); @@ -911,7 +911,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro public void testAppend() throws Exception { jcache().put("appendKey", "appendVal"); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_APPEND.key(), + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_APPEND.key(), "key", "appendKey", "val", "_suffix")); assertCacheOperation(ret, true); @@ -925,7 +925,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro public void testPrepend() throws Exception { jcache().put("prependKey", "prependVal"); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_PREPEND.key(), + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_PREPEND.key(), "key", "prependKey", "val", "prefix_")); assertCacheOperation(ret, true); @@ -937,7 +937,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro * @throws Exception If failed. */ public void testIncrement() throws Exception { - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.ATOMIC_INCREMENT.key(), + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.ATOMIC_INCREMENT.key(), "key", "incrKey", "init", "2", "delta", "3")); JsonNode res = jsonResponse(ret); @@ -945,7 +945,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro assertEquals(5, res.asInt()); assertEquals(5, grid(0).atomicLong("incrKey", 0, true).get()); - ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.ATOMIC_INCREMENT.key(), "key", "incrKey", "delta", "10")); + ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.ATOMIC_INCREMENT.key(), "key", "incrKey", "delta", "10")); res = jsonResponse(ret); @@ -957,7 +957,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro * @throws Exception If failed. */ public void testDecrement() throws Exception { - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.ATOMIC_DECREMENT.key(), + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.ATOMIC_DECREMENT.key(), "key", "decrKey", "init", "15", "delta", "10")); JsonNode res = jsonResponse(ret); @@ -965,7 +965,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro assertEquals(5, res.asInt()); assertEquals(5, grid(0).atomicLong("decrKey", 0, true).get()); - ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.ATOMIC_DECREMENT.key(), + ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.ATOMIC_DECREMENT.key(), "key", "decrKey", "delta", "3")); res = jsonResponse(ret); @@ -982,7 +982,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro assertEquals("casOldVal", jcache().localPeek("casKey")); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_CAS.key(), + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_CAS.key(), "key", "casKey", "val2", "casOldVal")); info("CAR command result: " + ret); @@ -998,7 +998,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro public void testPutIfAbsent() throws Exception { assertNull(jcache().localPeek("casKey")); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_CAS.key(), + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_CAS.key(), "key", "casKey", "val1", "casNewVal")); info("PutIfAbsent command result: " + ret); @@ -1016,7 +1016,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro assertEquals("casVal", jcache().localPeek("casKey")); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_CAS.key(), "key", "casKey")); + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_CAS.key(), "key", "casKey")); info("CAS Remove command result: " + ret); @@ -1029,7 +1029,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro * @throws Exception If failed. */ public void testMetrics() throws Exception { - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_METRICS.key())); + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_METRICS.key())); info("Cache metrics command result: " + ret); @@ -1127,13 +1127,13 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro Collection<GridCacheSqlMetadata> metas = cache.context().queries().sqlMetadata(); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_METADATA.key())); + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_METADATA.key())); info("Cache metadata: " + ret); testMetadata(metas, ret); - ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_METADATA.key(), "cacheName", "person")); + ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_METADATA.key(), "cacheName", "person")); info("Cache metadata with cacheName parameter: " + ret); @@ -1153,13 +1153,13 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro Collection<GridCacheSqlMetadata> metas = c.context().queries().sqlMetadata(); - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_METADATA.key())); + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_METADATA.key())); info("Cache metadata: " + ret); testMetadata(metas, ret); - ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_METADATA.key(), "cacheName", "person")); + ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_METADATA.key(), "cacheName", "person")); info("Cache metadata with cacheName parameter: " + ret); @@ -1170,7 +1170,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro * @throws Exception If failed. */ public void testTopology() throws Exception { - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.TOPOLOGY.key(), "attr", "false", "mtr", "false")); + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.TOPOLOGY.key(), "attr", "false", "mtr", "false")); info("Topology command result: " + ret); @@ -1214,7 +1214,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro * @throws Exception If failed. */ public void testNode() throws Exception { - String ret = content(F.asMap("cmd",GridRestCommand.NODE.key(), "attr", "true", "mtr", "true", "id", + String ret = content(F.asMap("cmd", GridRestCommand.NODE.key(), "attr", "true", "mtr", "true", "id", grid(0).localNode().id().toString())); info("Topology command result: " + ret); @@ -1224,7 +1224,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro assertTrue(res.get("attributes").isObject()); assertTrue(res.get("metrics").isObject()); - ret = content(F.asMap("cmd",GridRestCommand.NODE.key(), "attr", "false", "mtr", "false", "ip", LOC_HOST)); + ret = content(F.asMap("cmd", GridRestCommand.NODE.key(), "attr", "false", "mtr", "false", "ip", LOC_HOST)); info("Topology command result: " + ret); @@ -1233,7 +1233,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro 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", + ret = content(F.asMap("cmd", GridRestCommand.NODE.key(), "attr", "false", "mtr", "false", "ip", LOC_HOST, "id", UUID.randomUUID().toString())); info("Topology command result: " + ret); @@ -1251,14 +1251,14 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro * @throws Exception If failed. */ public void testExe() throws Exception { - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.EXE.key())); + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.EXE.key())); info("Exe command result: " + ret); assertResponseContainsError(ret); // Attempt to execute unknown task (UNKNOWN_TASK) will result in exception on server. - ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.EXE.key(), "name", "UNKNOWN_TASK")); + ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.EXE.key(), "name", "UNKNOWN_TASK")); info("Exe command result: " + ret); @@ -1267,7 +1267,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro grid(0).compute().localDeployTask(TestTask1.class, TestTask1.class.getClassLoader()); grid(0).compute().localDeployTask(TestTask2.class, TestTask2.class.getClassLoader()); - ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.EXE.key(), "name", TestTask1.class.getName())); + ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.EXE.key(), "name", TestTask1.class.getName())); info("Exe command result: " + ret); @@ -1275,7 +1275,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro assertTrue(res.isNull()); - ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.EXE.key(), "name", TestTask2.class.getName())); + ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.EXE.key(), "name", TestTask2.class.getName())); info("Exe command result: " + ret); @@ -1283,7 +1283,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro assertEquals(TestTask2.RES, res.asText()); - ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.RESULT.key())); + ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.RESULT.key())); info("Exe command result: " + ret); @@ -1602,14 +1602,14 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro // Spring XML to start cache via Visor task. final String START_CACHE = "<beans xmlns=\"http://www.springframework.org/schema/beans\"\n" + - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + - " xsi:schemaLocation=\"http://www.springframework.org/schema/beans\n" + - " http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\">\n" + - " <bean id=\"cacheConfiguration\" class=\"org.apache.ignite.configuration.CacheConfiguration\">\n" + - " <property name=\"cacheMode\" value=\"PARTITIONED\"/>\n" + - " <property name=\"name\" value=\"c\"/>\n" + - " </bean>\n" + - "</beans>"; + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + + " xsi:schemaLocation=\"http://www.springframework.org/schema/beans\n" + + " http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\">\n" + + " <bean id=\"cacheConfiguration\" class=\"org.apache.ignite.configuration.CacheConfiguration\">\n" + + " <property name=\"cacheMode\" value=\"PARTITIONED\"/>\n" + + " <property name=\"name\" value=\"c\"/>\n" + + " </bean>\n" + + "</beans>"; ret = content(new VisorGatewayArgument(VisorCacheStartTask.class) .argument(VisorCacheStartTaskArg.class, false, "person2", @@ -1653,7 +1653,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro * @throws Exception If failed. */ public void testVersion() throws Exception { - String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.VERSION.key())); + String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.VERSION.key())); JsonNode res = jsonResponse(ret); @@ -1759,7 +1759,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro assertFalse(jsonResponse(ret).get("queryId").isNull()); - ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.FETCH_SQL_QUERY.key(), + ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.FETCH_SQL_QUERY.key(), "pageSize", "1", "qryId", qryId.asText())); JsonNode res = jsonResponse(ret); @@ -1769,7 +1769,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro assertEquals(qryId0, qryId); assertFalse(res.get("last").asBoolean()); - ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.FETCH_SQL_QUERY.key(), + ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.FETCH_SQL_QUERY.key(), "pageSize", "1", "qryId", qryId.asText())); res = jsonResponse(ret); @@ -1911,7 +1911,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro String qryId = res.get("queryId").asText(); - content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CLOSE_SQL_QUERY.key(), "cacheName", "person", "qryId", qryId)); + content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CLOSE_SQL_QUERY.key(), "cacheName", "person", "qryId", qryId)); assertFalse(queryCursorFound()); } @@ -2016,7 +2016,6 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro assertEquals(2, personCache.query(qry).getAll().size()); } - /** * Organization class. */ @@ -2216,7 +2215,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro * @return This helper for chaining method calls. */ public VisorGatewayArgument arguments(Object... vals) { - for (Object val: vals) + for (Object val : vals) put("p" + idx++, String.valueOf(val)); return this; http://git-wip-us.apache.org/repos/asf/ignite/blob/6ccfc0b2/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 index 44dd09c..5a94315 100644 --- 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 @@ -77,14 +77,6 @@ public class GridJettyObjectMapper extends ObjectMapper { } }; - /** Custom {@code null} string serializer. */ - private static final JsonSerializer<Object> NULL_STRING_VALUE_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. */ @@ -108,7 +100,7 @@ public class GridJettyObjectMapper extends ObjectMapper { } /** {@inheritDoc} */ - public DefaultSerializerProvider createInstance(SerializationConfig cfg, SerializerFactory jsf) { + @Override public DefaultSerializerProvider createInstance(SerializationConfig cfg, SerializerFactory jsf) { return new CustomSerializerProvider(this, cfg, jsf); } @@ -120,9 +112,6 @@ public class GridJettyObjectMapper extends ObjectMapper { /** {@inheritDoc} */ @Override public JsonSerializer<Object> findNullValueSerializer(BeanProperty prop) throws JsonMappingException { - if (prop.getType().getRawClass() == String.class) - return NULL_STRING_VALUE_SERIALIZER; - return NULL_VALUE_SERIALIZER; } }
