You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by iv...@apache.org on 2015/07/23 17:43:19 UTC

[5/5] incubator-ignite git commit: #ignite-961: merge commands.

#ignite-961:  merge commands.


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

Branch: refs/heads/ignite-961
Commit: 8201b48fe9123c641747bf5e2ca4d73b49f8dcc5
Parents: 47ddae7
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jul 23 18:43:07 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jul 23 18:43:07 2015 +0300

----------------------------------------------------------------------
 .../JettyRestProcessorAbstractSelfTest.java     | 102 ++++++++++---------
 modules/nodejs/src/main/js/cache.js             |  26 ++---
 modules/nodejs/src/main/js/ignite.js            |   4 +-
 .../http/jetty/GridJettyRestHandler.java        |   6 +-
 4 files changed, 74 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8201b48f/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 762e496..5a54cd1 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
@@ -24,6 +24,7 @@ import org.apache.ignite.cache.query.*;
 import org.apache.ignite.cache.query.annotations.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.processors.json.*;
 import org.apache.ignite.internal.processors.rest.handlers.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.testframework.*;
@@ -389,10 +390,10 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testGetPost() throws Exception {
-        jcache().put("key0", "val0");
+        jcache().put(new IgniteJsonString("key0"), new IgniteJsonString("val0"));
 
         String val = "{\"key\":\"key0\"}";
-        String ret = makePostRequest(F.asMap("cmd", "get"), val);
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_GET.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -406,10 +407,10 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testReplacePost() throws Exception {
-        jcache().put("key0", "val0");
+        jcache().put(new IgniteJsonString("key0"), new IgniteJsonString("val0"));
 
         String val = "{\"key\":\"key0\", \"val\":\"val2\", \"oldVal\":\"val1\"}";
-        String ret = makePostRequest(F.asMap("cmd", "repval"), val);
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_REPLACE_VALUE.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -419,31 +420,32 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         jsonEquals(ret, cachePattern(false, true));
 
         val = "{\"key\":\"key0\", \"val\":\"val2\"}";
-        ret = makePostRequest(F.asMap("cmd", "getandreplace"), val);
+        ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_REPLACE.key()),
+            val);
 
         jsonEquals(ret, cachePattern("val0", true));
 
-        assertEquals("val2", grid(0).cache(null).get("key0"));
+        assertEquals(new IgniteJsonString("val2"), grid(0).cache(null).get(new IgniteJsonString("key0")));
 
         val = "{\"key\":\"key0\", \"val\":\"val3\"}";
-        ret = makePostRequest(F.asMap("cmd", "rep"), val);
+        ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_REPLACE.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
 
         info("Get command result: " + ret);
 
-        assertEquals("val3", grid(0).cache(null).get("key0"));
+        assertEquals(new IgniteJsonString("val3"), grid(0).cache(null).get(new IgniteJsonString("key0")));
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testRemovePost() throws Exception {
-        jcache().put("key0", "val0");
+        jcache().put(new IgniteJsonString("key0"), new IgniteJsonString("val0"));
 
         String val = "{\"key\":\"key0\", \"val\":\"val2\"}";
-        String ret = makePostRequest(F.asMap("cmd", "rmvvalue"), val);
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_VALUE.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -452,25 +454,25 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         jsonEquals(ret, cachePattern(false, true));
 
-        assertEquals("val0", grid(0).cache(null).get("key0"));
+        assertEquals(new IgniteJsonString("val0"), grid(0).cache(null).get(new IgniteJsonString("key0")));
 
         val = "{\"key\":\"key0\"}";
-        ret = makePostRequest(F.asMap("cmd", "getandrmv"), val);
+        ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_REMOVE.key()), val);
 
         jsonEquals(ret, cachePattern("val0", true));
 
-        assertNull(grid(0).cache(null).get("key0"));
+        assertNull(grid(0).cache(null).get(new IgniteJsonString("key0")));
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testRemoveAllPost() throws Exception {
-        jcache().put("key0", "val0");
-        jcache().put("key1", "val1");
+        jcache().put(new IgniteJsonString("key0"), new IgniteJsonString("val0"));
+        jcache().put(new IgniteJsonString("key1"), new IgniteJsonString("val1"));
 
         String val = "{\"keys\": [\"key0\", \"key1\"]}";
-        String ret = makePostRequest(F.asMap("cmd", "rmvall"), val);
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_ALL.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -483,15 +485,18 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      */
     public void testPutPost() throws Exception {
         String val = "{\"key\":\"key0\",\"val\":\"val0\"}";
-        String ret = makePostRequest(F.asMap("cmd", "put"), val);
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_PUT.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
 
-        assertNotNull(grid(0).cache(null).get("key0"));
+        info("Result: " + ret);
+
+        assertEquals(1, grid(0).cache(null).size());
+        assertNotNull(grid(0).cache(null).get(new IgniteJsonString("key0")));
 
         val = "{\"key\":\"key0\"}";
-        ret = makePostRequest(F.asMap("cmd", "containskey"), val);
+        ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_CONTAINS_KEY.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -504,7 +509,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      */
     public void testIncorrectPutPost() throws Exception {
         String val = "{\"key\":\"key0\"}";
-        String ret = makePostRequest(F.asMap("cmd", "put"), val);
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_PUT.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -516,42 +521,42 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      */
     public void testGetAndPutPost() throws Exception {
         String val = "{\"key\":\"key0\", \"val\":\"val0\"}";
-        String ret = makePostRequest(F.asMap("cmd", "getandput"), val);
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_PUT.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
 
         jsonEquals(ret, cacheNullPattern(true));
 
-        assertNotNull(grid(0).cache(null).get("key0"));
+        assertNotNull(grid(0).cache(null).get(new IgniteJsonString("key0")));
 
         val = "{\"key\": \"key0\", \"val\":\"val1\"}";
-        ret = makePostRequest(F.asMap("cmd", "getandputifabsent"), val);
+        ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_PUT_IF_ABSENT.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
 
         jsonEquals(ret, cachePattern("val0", true));
 
-        assertEquals("val0", grid(0).cache(null).get("key0"));
+        assertEquals(new IgniteJsonString("val0"), grid(0).cache(null).get(new IgniteJsonString("key0")));
 
         val = "{\"key\": \"key0\"}";
-        ret = makePostRequest(F.asMap("cmd", "rmv"), val);
+        ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_REMOVE.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
 
-        assertNull(grid(0).cache(null).get("key0"));
+        assertNull(grid(0).cache(null).get(new IgniteJsonString("key0")));
 
         val = "{\"key\": \"key0\", \"val\":\"val1\"}";
-        ret = makePostRequest(F.asMap("cmd", "putifabsent"), val);
+        ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_PUT_IF_ABSENT.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
 
         jsonEquals(ret, cachePattern(true, true));
 
-        assertEquals("val1", grid(0).cache(null).get("key0"));
+        assertEquals(new IgniteJsonString("val1"), grid(0).cache(null).get(new IgniteJsonString("key0")));
     }
 
     /**
@@ -559,22 +564,22 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      */
     public void testPutAllPost() throws Exception {
         String val = "{\"entries\": [{\"key\":\"key0\", \"value\": \"val0\"}, {\"key\":\"key1\", \"value\":\"val1\"}]}";
-        String ret = makePostRequest(F.asMap("cmd", "putAll"), val);
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_PUT_ALL.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
 
-        assertNotNull(grid(0).cache(null).get("key0"));
+        assertNotNull(grid(0).cache(null).get(new IgniteJsonString("key0")));
 
         val = "{\"keys\": [\"key0\",\"key1\"]}";
-        ret = makePostRequest(F.asMap("cmd", "containskeys"), val);
+        ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_CONTAINS_KEYS.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
 
         jsonEquals(ret, cacheBulkPattern(true, true));
 
-        ret = makePostRequest(F.asMap("cmd", "getAll"), val);
+        ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_GET_ALL.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -923,7 +928,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         jsonEquals(ret, cacheBulkPattern(true, true));
 
-        ret = content(F.asMap("cmd", "rmvall"));
+        ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_ALL.key()));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -1274,7 +1279,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testVersion() throws Exception {
-        String ret = content(F.asMap("cmd", "version"));
+        String ret = content(F.asMap("cmd", GridRestCommand.VERSION.key()));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -1437,7 +1442,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      */
     public void testRunScriptPost() throws Exception {
         String f = "function(param){return param;}";
-        String ret = makePostRequest(F.asMap("cmd", "runscript", "func", URLEncoder.encode(f)), "{\"arg\":\"hello\"}");
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.RUN_SCRIPT.key(), "func", URLEncoder.encode(f)), "{\"arg\":\"hello\"}");
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -1450,7 +1455,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      */
     public void testRunScript() throws Exception {
         String f = "function(param){return param;}";
-        String ret = content(F.asMap("cmd", "runscript", "func", URLEncoder.encode(f), "arg", "hello"));
+        String ret = content(F.asMap("cmd", GridRestCommand.RUN_SCRIPT.key(), "func",
+            URLEncoder.encode(f), "arg", "hello"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -1462,7 +1468,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testRunAffinityScriptPost() throws Exception {
-        ClusterNode node = grid(0).affinity(null).mapKeyToNode("key0");
+        ClusterNode node = grid(0).affinity(null).mapKeyToNode(new IgniteJsonString("key0"));
 
         Ignite ignite = null;
 
@@ -1479,7 +1485,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
             "}" +
             "return ignite.name();}";
 
-        String ret = makePostRequest(F.asMap("cmd", "affrun", "func", URLEncoder.encode(f)),
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.AFFINITY_RUN_SCRIPT.key(),
+                "func", URLEncoder.encode(f)),
             "{\"arg\":\"" + "hello" + "\",\"key\":\"key0\"}");
 
         assertNotNull(ret);
@@ -1509,8 +1516,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
             "}" +
             "return ignite.name();}";
 
-        String ret = content(F.asMap("cmd", "affrun", "func", URLEncoder.encode(f),
-            "key", "key0", "arg", "hello"));
+        String ret = content(F.asMap("cmd", GridRestCommand.AFFINITY_RUN_SCRIPT.key(),
+            "func", URLEncoder.encode(f), "key", "key0", "arg", "hello"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -1540,7 +1547,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
             "return sum;" +
             "};";
 
-        String ret = makePostRequest(F.asMap("cmd", "excmapreduce", "map", URLEncoder.encode(map),
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.EXECUTE_MAP_REDUCE_SCRIPT.key(),
+            "map", URLEncoder.encode(map),
             "reduce", URLEncoder.encode(reduce)), "{\"arg\": \"Hello world!\"}");
 
         assertNotNull(ret);
@@ -1571,8 +1579,10 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
             "return sum;" +
             "};";
 
-        String ret = content(F.asMap("cmd", "excmapreduce", "map", URLEncoder.encode(map),
-            "reduce", URLEncoder.encode(reduce), "arg", URLEncoder.encode("Hello world!")));
+        String ret = content(F.asMap("cmd", GridRestCommand.EXECUTE_MAP_REDUCE_SCRIPT.key(),
+            "map", URLEncoder.encode(map),
+            "reduce", URLEncoder.encode(reduce),
+            "arg", URLEncoder.encode("Hello world!")));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -1586,9 +1596,9 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testQueryArgsPost() throws Exception {
         String qry = "salary > ? and salary <= ?";
 
-        String ret = makePostRequest(F.asMap("cmd", "qryexecute", "type", "Person", "psz", "10", "cacheName", "person",
-                "qry", URLEncoder.encode(qry)),
-            "{\"arg\": [1000, 2000]}");
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.EXECUTE_SQL_QUERY.key(),
+                "type", "Person", "psz", "10", "cacheName", "person",
+                "qry", URLEncoder.encode(qry)), "{\"arg\": [1000, 2000]}");
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8201b48f/modules/nodejs/src/main/js/cache.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js
index 6cae632..a232558 100644
--- a/modules/nodejs/src/main/js/cache.js
+++ b/modules/nodejs/src/main/js/cache.js
@@ -75,7 +75,7 @@ Cache.prototype.put = function(key, value) {
  * @param {string} value Value
  */
 Cache.prototype.putIfAbsent = function(key, value) {
-    return this.__createPromise(this._createCommand("putifabsent").
+    return this.__createPromise(this._createCommand("putifabs").
         setPostData(JSON.stringify({"key": key, "val" : value})));
 }
 
@@ -98,7 +98,7 @@ Cache.prototype.remove = function(key, callback) {
  * @param value Value
  */
 Cache.prototype.removeValue = function(key, value, callback) {
-    return this.__createPromise(this._createCommand("rmvvalue").
+    return this.__createPromise(this._createCommand("rmvval").
         setPostData(JSON.stringify({"key": key, "val" : value})));
 }
 
@@ -109,7 +109,7 @@ Cache.prototype.removeValue = function(key, value, callback) {
  * @param {string} key Key
  */
 Cache.prototype.getAndRemove = function(key, callback) {
-    return this.__createPromise(this._createCommand("getandrmv").
+    return this.__createPromise(this._createCommand("getrmv").
         setPostData(JSON.stringify({"key": key})));
 }
 
@@ -179,7 +179,7 @@ Cache.prototype.getAll = function(keys, callback) {
  * @param {Object} key Key
  */
 Cache.prototype.containsKey = function(key) {
-    return this.__createPromise(this._createCommand("containskey").
+    return this.__createPromise(this._createCommand("conkey").
         setPostData(JSON.stringify({"key" : key})));
 }
 
@@ -190,7 +190,7 @@ Cache.prototype.containsKey = function(key) {
  * @param {Object[]} keys Keys
  */
 Cache.prototype.containsKeys = function(keys, callback) {
-    return this.__createPromise(this._createCommand("containskeys").
+    return this.__createPromise(this._createCommand("conkeys").
         setPostData(JSON.stringify({"keys" : keys})));
 }
 
@@ -202,7 +202,7 @@ Cache.prototype.containsKeys = function(keys, callback) {
  * @param {string} value Value
  */
 Cache.prototype.getAndPut = function(key, val) {
-    return this.__createPromise(this._createCommand("getandput").
+    return this.__createPromise(this._createCommand("getput").
         setPostData(JSON.stringify({"key" : key, "val" : val})));
 }
 
@@ -227,7 +227,7 @@ Cache.prototype.replace = function(key, val, callback) {
  * @param oldVal Old value
  */
 Cache.prototype.replaceValue = function(key, val, oldVal) {
-    return this.__createPromise(this._createCommand("repVal").
+    return this.__createPromise(this._createCommand("repval").
         setPostData(JSON.stringify({"key" : key, "val" : val, "oldVal" : oldVal})));
 }
 
@@ -239,7 +239,7 @@ Cache.prototype.replaceValue = function(key, val, oldVal) {
  * @param {string} value Value
  */
 Cache.prototype.getAndReplace = function(key, val) {
-    return this.__createPromise(this._createCommand("getandreplace").
+    return this.__createPromise(this._createCommand("getrep").
         setPostData(JSON.stringify({"key" : key, "val" : val})));
 }
 
@@ -251,7 +251,7 @@ Cache.prototype.getAndReplace = function(key, val) {
  * @param {string} value Value
  */
 Cache.prototype.getAndPutIfAbsent = function(key, val) {
-    return this.__createPromise(this._createCommand("getandputifabsent").
+    return this.__createPromise(this._createCommand("getputifabs").
         setPostData(JSON.stringify({"key" : key, "val" : val})));
 }
 
@@ -259,7 +259,7 @@ Cache.prototype.getAndPutIfAbsent = function(key, val) {
  * @this {Cache}
  */
 Cache.prototype.size = function(callback) {
-    return this.__createPromise(this._createCommand("cachesize"));
+    return this.__createPromise(this._createCommand("size"));
 }
 
 /**
@@ -412,7 +412,7 @@ QueryCursor.prototype.close = function() {
     }
 
     var server = this._cache._server;
-    var cmd = this._createQueryCommand("qryclose", this._qry).addParam("qryId", this._res.queryId);
+    var cmd = this._createQueryCommand("qrycls", this._qry).addParam("qryId", this._res.queryId);
 
     return new Promise(function(resolve, reject) {
        server.runCommand(cmd, function(err, res) {
@@ -455,12 +455,12 @@ QueryCursor.prototype._getQueryCommand = function() {
 }
 
 QueryCursor.prototype._sqlFieldsQuery = function(qry) {
-    return this._createQueryCommand("qryfieldsexecute", qry).
+    return this._createQueryCommand("qryfldexe", qry).
         setPostData(JSON.stringify({"arg" : qry.arguments()}));
 }
 
 QueryCursor.prototype._sqlQuery = function(qry) {
-    return this._createQueryCommand("qryexecute", qry).addParam("type", qry.returnType()).
+    return this._createQueryCommand("qryexe", qry).addParam("type", qry.returnType()).
         setPostData(JSON.stringify({"arg" : qry.arguments()}));
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8201b48f/modules/nodejs/src/main/js/ignite.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/ignite.js b/modules/nodejs/src/main/js/ignite.js
index c3d90ac..5b68c23 100644
--- a/modules/nodejs/src/main/js/ignite.js
+++ b/modules/nodejs/src/main/js/ignite.js
@@ -60,7 +60,7 @@ Ignite.prototype.cache = function(cacheName) {
 Ignite.prototype.getOrCreateCache = function(cacheName) {
     var server = this._server;
     return new Promise(function(resolve, reject) {
-        server.runCommand(new Command("getorcreatecache").addParam("cacheName", cacheName),
+        server.runCommand(new Command("getorcreate").addParam("cacheName", cacheName),
             function(err, res) {
                 if (err != null) {
                     reject(err);
@@ -79,7 +79,7 @@ Ignite.prototype.getOrCreateCache = function(cacheName) {
  * @param {string} cacheName Cache name to stop
  */
 Ignite.prototype.destroyCache = function(cacheName) {
-    return this._createPromise(new Command("destroycache").addParam("cacheName", cacheName));
+    return this._createPromise(new Command("destcache").addParam("cacheName", cacheName));
 }
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8201b48f/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 196e680..2cf9988 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
@@ -584,7 +584,7 @@ public class GridJettyRestHandler extends AbstractHandler {
 
                 if (req.getHeader("Content-Type") != null && req.getHeader("Content-Type").contains("json")) {
                     Map o = parseRequest(req);
-                    restReq0.argument(ctx.scripting().toJavaObject(o.get("arg")));
+                    restReq0.argument(ctx.scripting().toScriptObject(o.get("arg")));
                 }
                 else
                     restReq0.argument(params.get("arg"));
@@ -602,7 +602,7 @@ public class GridJettyRestHandler extends AbstractHandler {
 
                 if (req.getHeader("Content-Type") != null && req.getHeader("Content-Type").contains("json")) {
                     Map o = parseRequest(req);
-                    restReq0.argument(ctx.scripting().toJavaObject(o.get("arg")));
+                    restReq0.argument(ctx.scripting().toScriptObject(o.get("arg")));
 
                     Object cacheObj = ctx.scripting().toJavaObject(o.get("key"));
                     restReq0.affinityKey(cacheObj);
@@ -625,7 +625,7 @@ public class GridJettyRestHandler extends AbstractHandler {
 
                 if (req.getHeader("Content-Type") != null && req.getHeader("Content-Type").contains("json")) {
                     Map o = parseRequest(req);
-                    restReq0.argument(ctx.scripting().toJavaObject(o.get("arg")));
+                    restReq0.argument(ctx.scripting().toScriptObject(o.get("arg")));
                 }
                 else
                     restReq0.argument(params.get("arg"));