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/25 14:33:23 UTC
[3/7] incubator-ignite git commit: #ignite-965: Implement node js
ignite method version.
#ignite-965: Implement node js ignite method version.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/54d92739
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/54d92739
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/54d92739
Branch: refs/heads/ignite-965
Commit: 54d92739a8b15b06262c0dc1c6caf69c7600d086
Parents: 710c2fa
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jun 25 12:29:43 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jun 25 12:29:43 2015 +0300
----------------------------------------------------------------------
modules/nodejs/src/main/js/ignite.js | 6 +++
.../ignite/internal/NodeJsIgniteSelfTest.java | 47 ++++++++++++++++++++
modules/nodejs/src/test/js/test-ignite.js | 40 +++++++++++++++++
3 files changed, 93 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/54d92739/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 fb24a19..2df2493 100644
--- a/modules/nodejs/src/main/js/ignite.js
+++ b/modules/nodejs/src/main/js/ignite.js
@@ -58,4 +58,10 @@ Ignite.prototype.compute = function() {
return new Compute(this._server);
}
+/**
+ * @param {onGet} callback Result in callback contains string with Ignite version.
+ */
+Ignite.prototype.version = function(callback) {
+ this._server.runCommand("version", [], callback);
+}
exports.Ignite = Ignite;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/54d92739/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsIgniteSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsIgniteSelfTest.java b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsIgniteSelfTest.java
new file mode 100644
index 0000000..6c17218
--- /dev/null
+++ b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsIgniteSelfTest.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+/**
+ * Test for node js ignite.
+ */
+public class NodeJsIgniteSelfTest extends NodeJsAbstractTest {
+ /**
+ * Constructor.
+ */
+ public NodeJsIgniteSelfTest() {
+ super("test-ignite.js");
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ startGrid(0);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testIgniteVersion() throws Exception {
+ runJsScript("testIgniteVersion");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/54d92739/modules/nodejs/src/test/js/test-ignite.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/test/js/test-ignite.js b/modules/nodejs/src/test/js/test-ignite.js
new file mode 100644
index 0000000..af42086
--- /dev/null
+++ b/modules/nodejs/src/test/js/test-ignite.js
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var TestUtils = require("./test-utils").TestUtils;
+
+var assert = require("assert");
+
+testIgniteVersion = function() {
+ function igniteVer(err, res) {
+ assert.equal(err, null);
+
+ var verRegex = /([0-9]+)\.([0-9]+)\.([0-9]+)/;
+
+ assert(verRegex.exec(res) !== null, "Incorrect ignite version [ver=" + res + "]");
+
+ TestUtils.testDone();
+ }
+
+ function onStart(err, ignite) {
+ assert.equal(err, null);
+
+ ignite.version(igniteVer.bind(null));
+ }
+
+ TestUtils.startIgniteNode(onStart.bind(null));
+}
\ No newline at end of file