ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject ignite git commit: IGNITE-4678 Node version in range.
Date Wed, 15 Feb 2017 09:09:25 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 571586cdc -> 2cfd55dcf


IGNITE-4678 Node version in range.


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

Branch: refs/heads/master
Commit: 2cfd55dcff04cd81ac81e8ed68a34e7ad9ebb883
Parents: 571586c
Author: Andrey Novikov <anovikov@gridgain.com>
Authored: Wed Feb 15 16:08:57 2017 +0700
Committer: Andrey Novikov <anovikov@gridgain.com>
Committed: Wed Feb 15 16:08:57 2017 +0700

----------------------------------------------------------------------
 .../modules/configuration/Version.service.js    | 30 +++++++++++++++++---
 .../frontend/test/unit/Version.test.js          | 26 ++++++++++++++++-
 .../demo/service/DemoCachesLoadService.java     |  2 +-
 .../service/DemoRandomCacheLoadService.java     |  2 +-
 4 files changed, 53 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2cfd55dc/modules/web-console/frontend/app/modules/configuration/Version.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/Version.service.js b/modules/web-console/frontend/app/modules/configuration/Version.service.js
index 746b1ed..3fc7199 100644
--- a/modules/web-console/frontend/app/modules/configuration/Version.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/Version.service.js
@@ -77,12 +77,34 @@ export default class IgniteVersion {
     }
 
     /**
+     * Check if node version in range
+     * @param {String} nodeVer Node version.
+     * @param {Array.<String>} ranges Version ranges to compare with.
+     * @returns {Boolean} `True` if node version is equal or greater than specified range.
+     */
+    includes(nodeVer, ...ranges) {
+        return !!_.find(ranges, ([after, before]) =>
+            this.compare(nodeVer, after) >= 0 && (_.isNil(before) || this.compare(nodeVer,
before) < 0)
+        );
+    }
+
+    /**
      * Check if node version is newer or same
-     * @param {String} nodeVer
-     * @param {String} sinceVer
-     * @returns {Boolean}
+     * @param {String} nodeVer Node version.
+     * @param {String} sinceVer Version to compare with.
+     * @returns {Boolean} `True` if node version is equal or greater than specified version.
      */
     since(nodeVer, sinceVer) {
-        return this.compare(nodeVer, sinceVer) >= 0;
+        return this.includes(nodeVer, [sinceVer]);
+    }
+
+    /**
+     * Check whether node version before than specified version.
+     * @param {String} nodeVer Node version.
+     * @param {String} sinceVer Version to compare with.
+     * @return {Boolean} `True` if node version before than specified version.
+     */
+    before(nodeVer, sinceVer) {
+        return !this.since(nodeVer, sinceVer);
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/2cfd55dc/modules/web-console/frontend/test/unit/Version.test.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/test/unit/Version.test.js b/modules/web-console/frontend/test/unit/Version.test.js
index 2d75ab5..72685ea 100644
--- a/modules/web-console/frontend/test/unit/Version.test.js
+++ b/modules/web-console/frontend/test/unit/Version.test.js
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-import VersionService from '../../app/modules/configuration/Version.service.js';
+import VersionService from '../../app/modules/configuration/Version.service';
 
 const INSTANCE = new VersionService();
 
@@ -53,6 +53,7 @@ suite('VersionServiceTestsSuite', () => {
     });
 
     test('Check since call', () => {
+        assert.equal(INSTANCE.since('1.5.0', '1.5.0'), true);
         assert.equal(INSTANCE.since('1.6.0', '1.5.0'), true);
     });
 
@@ -60,6 +61,29 @@ suite('VersionServiceTestsSuite', () => {
         assert.equal(INSTANCE.since('1.3.0', '1.5.0'), false);
     });
 
+    test('Check before call', () => {
+        assert.equal(INSTANCE.before('1.5.0', '1.5.0'), false);
+        assert.equal(INSTANCE.before('1.5.0', '1.6.0'), true);
+    });
+
+    test('Check wrong before call', () => {
+        assert.equal(INSTANCE.before('1.5.0', '1.3.0'), false);
+    });
+
+    test('Check includes call', () => {
+        assert.equal(INSTANCE.includes('1.5.4', ['1.5.5', '1.6.0'], ['1.6.2']), false);
+        assert.equal(INSTANCE.includes('1.5.5', ['1.5.5', '1.6.0'], ['1.6.2']), true);
+        assert.equal(INSTANCE.includes('1.5.11', ['1.5.5', '1.6.0'], ['1.6.2']), true);
+        assert.equal(INSTANCE.includes('1.6.0', ['1.5.5', '1.6.0'], ['1.6.2']), false);
+        assert.equal(INSTANCE.includes('1.6.1', ['1.5.5', '1.6.0'], ['1.6.2']), false);
+        assert.equal(INSTANCE.includes('1.6.2', ['1.5.5', '1.6.0'], ['1.6.2']), true);
+        assert.equal(INSTANCE.includes('1.6.3', ['1.5.5', '1.6.0'], ['1.6.2']), true);
+    });
+
+    test('Check wrong before call', () => {
+        assert.equal(INSTANCE.before('1.5.0', '1.3.0'), false);
+    });
+
     test('Parse 1.7.0-SNAPSHOT', () => {
         const version = INSTANCE.parse('1.7.0-SNAPSHOT');
         assert.equal(version.major, 1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/2cfd55dc/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoCachesLoadService.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoCachesLoadService.java
b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoCachesLoadService.java
index 9117646..fbfa2ae 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoCachesLoadService.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoCachesLoadService.java
@@ -114,7 +114,7 @@ public class DemoCachesLoadService implements Service {
     /** {@inheritDoc} */
     @Override public void cancel(ServiceContext ctx) {
         if (cachePool != null)
-            cachePool.shutdown();
+            cachePool.shutdownNow();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/2cfd55dc/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoRandomCacheLoadService.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoRandomCacheLoadService.java
b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoRandomCacheLoadService.java
index 57b26a2..c704dbe 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoRandomCacheLoadService.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoRandomCacheLoadService.java
@@ -62,7 +62,7 @@ public class DemoRandomCacheLoadService implements Service {
     /** {@inheritDoc} */
     @Override public void cancel(ServiceContext ctx) {
         if (cachePool != null)
-            cachePool.shutdown();
+            cachePool.shutdownNow();
     }
 
     /** {@inheritDoc} */


Mime
View raw message