ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ivasilin...@apache.org
Subject incubator-ignite git commit: #ignite-964: small fixes.
Date Thu, 02 Jul 2015 22:24:38 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-964-1 91ed4f6da -> 27bfca241


#ignite-964: small fixes.


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

Branch: refs/heads/ignite-964-1
Commit: 27bfca24156ab5180394b45c8a51e0b772d1b728
Parents: 91ed4f6
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Fri Jul 3 01:24:45 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Fri Jul 3 01:24:45 2015 +0300

----------------------------------------------------------------------
 .../handlers/scripting/JSONCacheObject.java     |  4 ++++
 modules/nodejs/src/test/js/test-cache-api.js    |  2 +-
 modules/nodejs/src/test/js/test-compute.js      |  5 ++++-
 .../http/jetty/GridJettyRestHandler.java        | 22 +++++++++++++++++---
 4 files changed, 28 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/27bfca24/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/JSONCacheObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/JSONCacheObject.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/JSONCacheObject.java
index 7264f16..0725b89 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/JSONCacheObject.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/JSONCacheObject.java
@@ -41,6 +41,10 @@ public class JSONCacheObject implements JSObject {
             addField(toSimpleObject(key), toSimpleObject(o.get(key)));
     }
 
+    public Map<Object, Object> getFields() {
+        return fields;
+    }
+
     @Override public int hashCode() {
         return fields.hashCode();
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/27bfca24/modules/nodejs/src/test/js/test-cache-api.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/test/js/test-cache-api.js b/modules/nodejs/src/test/js/test-cache-api.js
index c3a2f9e..d092d37 100644
--- a/modules/nodejs/src/test/js/test-cache-api.js
+++ b/modules/nodejs/src/test/js/test-cache-api.js
@@ -166,7 +166,7 @@ testReplace = function() {
 
         function onReplace(cache, err, res) {
             assert(err === null, "Get error on get and put [err=" + err + "]");
-            assert(res === true, "Incorrect result for replace [expected=true, val" + res
+ "]");
+            assert(res === true, "Incorrect result for replace [expected=true, val=" + res
+ "]");
 
             cache.get(entry[0], function(err, res) {
                 assert(!err);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/27bfca24/modules/nodejs/src/test/js/test-compute.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/test/js/test-compute.js b/modules/nodejs/src/test/js/test-compute.js
index 0999748..b926653 100644
--- a/modules/nodejs/src/test/js/test-compute.js
+++ b/modules/nodejs/src/test/js/test-compute.js
@@ -190,7 +190,10 @@ function computeCacheExecute(error, ignite) {
         assert(TestUtils.compareObject({"1": 1}, res),
             "Incorrect result [exp= {1:1}, val=" + res);
 
-        TestUtils.testDone();
+        ignite.cache("mycache").size(function(err, size){
+            assert(size === 3, "Incorrect size [size=" + 3 + ", res=" + size + "]");
+            TestUtils.testDone();
+        })
     }
 
     entries = [];

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/27bfca24/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 0e659f9..4b764f2 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
@@ -333,6 +333,15 @@ public class GridJettyRestHandler extends AbstractHandler {
                 res.add(new RestEntry(k, o.get(k)));
 
             cmdRes.setResponse(res);
+
+        }
+        else if (cmd == CACHE_GET || cmd == CACHE_GET_AND_PUT ||
+                cmd == CACHE_GET_AND_PUT_IF_ABSENT || cmd == CACHE_GET_AND_REMOVE ||
+                cmd == CACHE_GET_AND_REPLACE) {
+            Object o = cmdRes.getResponse();
+
+            if (o instanceof JSONCacheObject)
+                cmdRes.setResponse(((JSONCacheObject)o).getFields());
         }
     }
 
@@ -413,7 +422,7 @@ public class GridJettyRestHandler extends AbstractHandler {
                     else if (cmd == CACHE_GET_ALL || cmd == CACHE_REMOVE_ALL || cmd == CACHE_CONTAINS_KEYS)
{
                         JSONCacheObject cacheObj = new JSONCacheObject(o);
 
-                        List keys = (List)cacheObj.getField("keys");
+                        Object[] keys = (Object[])cacheObj.getField("keys");
 
                         for (Object key : keys)
                             map.put(key, null);
@@ -812,8 +821,15 @@ public class GridJettyRestHandler extends AbstractHandler {
          * @param val Value.
          */
         public RestEntry(Object key, Object val) {
-            this.key = key;
-            this.value = val;
+            if (key instanceof JSONCacheObject)
+                this.key = ((JSONCacheObject)key).getFields();
+            else
+                this.key = key;
+
+            if (val instanceof JSONCacheObject)
+                this.value = ((JSONCacheObject)val).getFields();
+            else
+                this.value = val;
         }
 
         /**


Mime
View raw message