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 2017/04/27 04:59:18 UTC
ignite git commit: IGNITE-5095 NULL strings in REST-HTTP should be
serialized as null.
Repository: ignite
Updated Branches:
refs/heads/ignite-5095 [created] 57a423d6c
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/57a423d6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/57a423d6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/57a423d6
Branch: refs/heads/ignite-5095
Commit: 57a423d6c2c62c4492621ff547e23f937173fd5f
Parents: 1104ca0
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Apr 27 12:00:22 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Apr 27 12:00:22 2017 +0700
----------------------------------------------------------------------
.../JettyRestProcessorAbstractSelfTest.java | 124 +++++++++----------
.../http/jetty/GridJettyObjectMapper.java | 13 +-
2 files changed, 63 insertions(+), 74 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/57a423d6/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..451cdd4 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);
@@ -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());
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/57a423d6/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;
}
}