You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/06/24 17:26:13 UTC

[2/3] incubator-ignite git commit: #ignite-965: fix Compute.prototype.runScript.

#ignite-965:  fix Compute.prototype.runScript.


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

Branch: refs/heads/ignite-965
Commit: 62a80c41797029de5d4ea6b49410b8f19a9bf127
Parents: 39cd83e
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Jun 24 17:43:11 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Jun 24 17:43:11 2015 +0300

----------------------------------------------------------------------
 .../handlers/scripting/IgniteScriptingCommandHandler.java    | 4 ++--
 .../processors/rest/request/RestMapReduceScriptRequest.java  | 6 +++---
 modules/nodejs/src/main/js/compute.js                        | 7 ++-----
 modules/nodejs/src/test/js/test-compute.js                   | 8 ++++----
 .../rest/protocols/http/jetty/GridJettyRestHandler.java      | 2 +-
 5 files changed, 12 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/62a80c41/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
index c41315b..f491d07 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
@@ -129,7 +129,7 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter
         private GridKernalContext ctx;
 
         /** Map function argument. */
-        private String arg;
+        private Object arg;
 
         /** Emit results. */
         private IgniteJsEmitResult emitRes;
@@ -140,7 +140,7 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter
          * @param reduceFunc Reduce function.
          * @param ctx Kernal context.
          */
-        public JsTask(String mapFunc, String arg, String reduceFunc, GridKernalContext ctx, IgniteJsEmitResult emitRes) {
+        public JsTask(String mapFunc, Object arg, String reduceFunc, GridKernalContext ctx, IgniteJsEmitResult emitRes) {
             this.mapFunc = mapFunc;
             this.reduceFunc = reduceFunc;
             this.arg = arg;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/62a80c41/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestMapReduceScriptRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestMapReduceScriptRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestMapReduceScriptRequest.java
index c21fcf4..904af74 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestMapReduceScriptRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestMapReduceScriptRequest.java
@@ -25,7 +25,7 @@ public class RestMapReduceScriptRequest extends GridRestRequest {
     private String mapFunc;
 
     /** Function argument. */
-    private String arg;
+    private Object arg;
 
     /** Reduce function. */
     private String reduceFunc;
@@ -61,14 +61,14 @@ public class RestMapReduceScriptRequest extends GridRestRequest {
     /**
      * @param arg Argument.
      */
-    public void argument(String arg) {
+    public void argument(Object arg) {
         this.arg = arg;
     }
 
     /**
      * @return Argument.
      */
-    public String argument() {
+    public Object argument() {
         return arg;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/62a80c41/modules/nodejs/src/main/js/compute.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/compute.js b/modules/nodejs/src/main/js/compute.js
index c7a386e..0f932e7 100644
--- a/modules/nodejs/src/main/js/compute.js
+++ b/modules/nodejs/src/main/js/compute.js
@@ -28,14 +28,11 @@ function Compute(server) {
 
 /**
  * @this {Compute}
- * @param {string} cacheName Cache name
- * @param {string} key Key
  * @param runnable Function without parameters
  * @param {onGet} callback Callback
  */
-Compute.prototype.runScript = function(cacheName, key, runnable, callback) {
-    this._server.runCommand("runscript", [Server.pair("cacheName", cacheName),
-        Server.pair("key", key), Server.pair("func", this._escape(runnable))], callback);
+Compute.prototype.runScript = function(runnable, callback) {
+    this._server.runCommand("runscript", [Server.pair("func", this._escape(runnable))], callback);
 }
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/62a80c41/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 80f0900..fec5914 100644
--- a/modules/nodejs/src/test/js/test-compute.js
+++ b/modules/nodejs/src/test/js/test-compute.js
@@ -61,7 +61,7 @@ function computeRunScript(ignite, error) {
         TestUtils.testDone();
     }
 
-    comp.runScript("mycache", "key999", f, onEnd.bind(null));
+    comp.runScript(f, onEnd.bind(null));
 }
 
 function computeExecute(error, ignite) {
@@ -115,7 +115,7 @@ function computeAllNodeExecute(error, ignite) {
     var reduce = function(results) {};
 
     var callback = function(err, res) {
-        assert(err == null, "Get error on compute task. [err=" + err + "].");
+        assert(err == null, "Get error on compute task [err=" + err + "]");
         TestUtils.testDone();
     }
 
@@ -133,8 +133,8 @@ function computeErrorExecute(error, ignite) {
     var callback = function(err, res) {
         assert(err != null, "Do not get error on compute task.");
 
-        assert(err.indexOf("Function evaluation failed") > -1, "Incorrect error."+
-            "[expected=function evaluation failed, value=" + err + "].");
+        assert(err.indexOf("Function evaluation failed") > -1, "Incorrect error "+
+            "[expected=function evaluation failed, value=" + err + "]");
 
         TestUtils.testDone();
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/62a80c41/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 faffbf1..b650554 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
@@ -461,7 +461,7 @@ public class GridJettyRestHandler extends AbstractHandler {
                 RestMapReduceScriptRequest restReq0 = new RestMapReduceScriptRequest();
 
                 restReq0.mapFunction((String) params.get("map"));
-                restReq0.argument((String)params.get("arg"));
+                restReq0.argument(params.get("arg"));
                 restReq0.reduceFunction((String) params.get("reduce"));
 
                 restReq = restReq0;