Repository: ignite
Updated Branches:
  refs/heads/ignite-5737-2 [created] f173be81f


http://git-wip-us.apache.org/repos/asf/ignite/blob/f173be81/modules/web-console/backend/test/unit/ClusterService.test.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/test/unit/ClusterService.test.js 
b/modules/web-console/backend/test/unit/ClusterService.test.js
index ed04c45..66c7cf1 100644
--- a/modules/web-console/backend/test/unit/ClusterService.test.js
+++ b/modules/web-console/backend/test/unit/ClusterService.test.js
@@ -15,13 +15,17 @@
  * limitations under the License.
  */
 
+const _ = require('lodash');
 const assert = require('chai').assert;
 const injector = require('../injector');
+
 const testClusters = require('../data/clusters.json');
+const testCaches = require('../data/caches.json');
 const testAccounts = require('../data/accounts.json');
 const testSpaces = require('../data/spaces.json');
 
 let clusterService;
+let cacheService;
 let mongo;
 let errors;
 let db;
@@ -29,12 +33,14 @@ let db;
 suite('ClusterServiceTestsSuite', () => {
     suiteSetup(() => {
         return Promise.all([injector('services/clusters'),
+            injector('services/caches'),
             injector('mongo'),
             injector('errors'),
             injector('dbHelper')])
-            .then(([_clusterService, _mongo, _errors, _db]) => {
+            .then(([_clusterService, _cacheService, _mongo, _errors, _db]) => {
                 mongo = _mongo;
                 clusterService = _clusterService;
+                cacheService = _cacheService;
                 errors = _errors;
                 db = _db;
             });
@@ -42,6 +48,18 @@ suite('ClusterServiceTestsSuite', () => {
 
     setup(() => db.init());
 
+    test('Get cluster', (done) => {
+        const _id = testClusters[0]._id;
+
+        clusterService.get(testClusters[0].space, false, _id)
+            .then((cluster) => {
+                assert.isNotNull(cluster);
+                assert.equal(cluster._id, _id);
+            })
+            .then(done)
+            .catch(done);
+    });
+
     test('Create new cluster', (done) => {
         const dupleCluster = Object.assign({}, testClusters[0], {name: 'Other 
name'});
 
@@ -130,6 +148,219 @@ suite('ClusterServiceTestsSuite', () => {
             .catch(done);
     });
 
+    test('List of all clusters in space', (done) => {
+        clusterService.shortList(testAccounts[0]._id, false)
+            .then((clusters) => {
+                assert.equal(clusters.length, 2);
+
+                assert.equal(clusters[0].name, 'cluster-caches');
+                assert.isNotNull(clusters[0].discovery);
+                assert.equal(clusters[0].cachesCount, 5);
+                assert.equal(clusters[0].modelsCount, 5);
+                assert.equal(clusters[0].igfsCount, 0);
+
+                assert.equal(clusters[1].name, 'cluster-igfs');
+                assert.isNotNull(clusters[1].discovery);
+                assert.equal(clusters[1].cachesCount, 2);
+                assert.equal(clusters[1].modelsCount, 5);
+                assert.equal(clusters[1].igfsCount, 1);
+            })
+            .then(done)
+            .catch(done);
+    });
+
+    test('Create new cluster from basic', (done) => {
+        const cluster = _.head(testClusters);
+        const caches = _.filter(testCaches, ({_id}) => 
_.includes(cluster.caches, _id));
+
+        db.drop()
+            .then(() => Promise.all([mongo.Account.create(testAccounts), 
mongo.Space.create(testSpaces)]))
+            .then(() => clusterService.upsertBasic(testAccounts[0]._id, false, 
{cluster, caches}))
+            .then((output) => {
+                assert.isNotNull(output);
+
+                assert.equal(output.n, 1);
+            })
+            .then(() => clusterService.get(testAccounts[0]._id, false, 
cluster._id))
+            .then((savedCluster) => {
+                assert.isNotNull(savedCluster);
+
+                assert.equal(savedCluster._id, cluster._id);
+                assert.equal(savedCluster.name, cluster.name);
+                assert.notStrictEqual(savedCluster.caches, cluster.caches);
+
+                assert.notStrictEqual(savedCluster, cluster);
+            })
+            .then(() => cacheService.get(testAccounts[0]._id, false, 
caches[0]._id))
+            .then((cb1) => {
+                assert.isNotNull(cb1);
+            })
+            .then(() => cacheService.get(testAccounts[0]._id, false, 
caches[1]._id))
+            .then((cb2) => {
+                assert.isNotNull(cb2);
+            })
+            .then(done)
+            .catch(done);
+    });
+
+    // test('Create new cluster without space', (done) => {
+    //     const cluster = _.cloneDeep(_.head(testClusters));
+    //     const caches = _.filter(testCaches, ({_id}) => 
_.includes(cluster.caches, _id));
+    //
+    //     delete cluster.space;
+    //
+    //     db.drop()
+    //         .then(() => Promise.all([mongo.Account.create(testAccounts), 
mongo.Space.create(testSpaces)]))
+    //         .then(() => clusterService.upsertBasic(testAccounts[0]._id, 
false, {cluster, caches}))
+    //         .then(() => done())
+    //         .catch(done);
+    // });
+
+    test('Create new cluster with duplicated name', (done) => {
+        const cluster = _.cloneDeep(_.head(testClusters));
+        const caches = _.filter(testCaches, ({_id}) => 
_.includes(cluster.caches, _id));
+
+        cluster.name = _.last(testClusters).name;
+
+        clusterService.upsertBasic(testAccounts[0]._id, false, {cluster, 
caches})
+            .then(done)
+            .catch((err) => {
+                assert.instanceOf(err, errors.DuplicateKeyException);
+
+                done();
+            });
+    });
+
+    test('Update cluster from basic', (done) => {
+        const cluster = _.cloneDeep(_.head(testClusters));
+
+        cluster.communication.tcpNoDelay = false;
+        cluster.igfss = [];
+
+        cluster.memoryConfiguration = {
+            defaultMemoryPolicySize: 10,
+            memoryPolicies: [
+                {
+                    name: 'default',
+                    maxSize: 100
+                }
+            ]
+        };
+
+        cluster.caches = _.dropRight(cluster.caches, 1);
+
+        const caches = _.filter(testCaches, ({_id}) => 
_.includes(cluster.caches, _id));
+
+        _.head(caches).cacheMode = 'REPLICATED';
+        _.head(caches).readThrough = false;
+
+        clusterService.upsertBasic(testAccounts[0]._id, false, {cluster, 
caches})
+            .then(() => clusterService.get(testAccounts[0]._id, false, 
cluster._id))
+            .then((savedCluster) => {
+                assert.isNotNull(savedCluster);
+
+                assert.deepEqual(_.invokeMap(savedCluster.caches, 'toString'), 
cluster.caches);
+
+                _.forEach(savedCluster.memoryConfiguration.memoryPolicies, 
(plc) => delete plc._id);
+
+                
assert.notExists(savedCluster.memoryConfiguration.defaultMemoryPolicySize);
+                
assert.deepEqual(savedCluster.memoryConfiguration.memoryPolicies, 
cluster.memoryConfiguration.memoryPolicies);
+
+                assert.notDeepEqual(_.invokeMap(savedCluster.igfss, 
'toString'), cluster.igfss);
+                assert.notDeepEqual(savedCluster.communication, 
cluster.communication);
+            })
+            .then(() => cacheService.get(testAccounts[0]._id, false, 
_.head(caches)._id))
+            .then((cb1) => {
+                assert.isNotNull(cb1);
+                assert.equal(cb1.cacheMode, 'REPLICATED');
+                assert.isTrue(cb1.readThrough);
+            })
+            .then(() => cacheService.get(testAccounts[0]._id, false, 
_.head(testClusters).caches[1]))
+            .then((c2) => {
+                assert.isNotNull(c2);
+                assert.equal(c2.cacheMode, 'PARTITIONED');
+                assert.isTrue(c2.readThrough);
+            })
+            .then(done)
+            .catch(done);
+    });
+
+    test('Update cluster from basic with cache removing', (done) => {
+        const cluster = _.cloneDeep(_.head(testClusters));
+
+        const removedCache = _.head(cluster.caches);
+        const upsertedCache = _.last(cluster.caches);
+
+        _.pull(cluster.caches, removedCache);
+
+        const caches = _.filter(testCaches, ({_id}) => 
_.includes(cluster.caches, _id));
+
+        db.drop()
+            .then(() => Promise.all([mongo.Account.create(testAccounts), 
mongo.Space.create(testSpaces)]))
+            .then(() => clusterService.upsertBasic(testAccounts[0]._id, false, 
{cluster, caches}))
+            .then(() => cacheService.get(testAccounts[0]._id, false, 
removedCache))
+            .then((cache) => {
+                assert.isNull(cache);
+            })
+            .then(() => cacheService.get(testAccounts[0]._id, false, 
upsertedCache))
+            .then((cache) => {
+                assert.isNotNull(cache);
+
+                done();
+            })
+            .catch(done);
+    });
+
+    test('Update cluster from advanced with cache removing', (done) => {
+        const cluster = _.cloneDeep(_.head(testClusters));
+
+        cluster.communication.tcpNoDelay = false;
+        cluster.igfss = [];
+
+        cluster.memoryConfiguration = {
+            defaultMemoryPolicySize: 10,
+            memoryPolicies: [
+                {
+                    name: 'default',
+                    maxSize: 100
+                }
+            ]
+        };
+
+        const removedCache = _.head(cluster.caches);
+        const upsertedCache = _.last(cluster.caches);
+
+        _.pull(cluster.caches, removedCache);
+
+        const caches = _.filter(testCaches, ({_id}) => 
_.includes(cluster.caches, _id));
+
+        clusterService.upsert(testAccounts[0]._id, false, {cluster, caches})
+            .then(() => clusterService.get(testAccounts[0]._id, false, 
cluster._id))
+            .then((savedCluster) => {
+                assert.isNotNull(savedCluster);
+
+                assert.deepEqual(_.invokeMap(savedCluster.caches, 'toString'), 
cluster.caches);
+
+                _.forEach(savedCluster.memoryConfiguration.memoryPolicies, 
(plc) => delete plc._id);
+
+                assert.deepEqual(savedCluster.memoryConfiguration, 
cluster.memoryConfiguration);
+
+                assert.deepEqual(_.invokeMap(savedCluster.igfss, 'toString'), 
cluster.igfss);
+                assert.deepEqual(savedCluster.communication, 
cluster.communication);
+            })
+            .then(() => cacheService.get(testAccounts[0]._id, false, 
removedCache))
+            .then((cache) => {
+                assert.isNull(cache);
+            })
+            .then(() => cacheService.get(testAccounts[0]._id, false, 
upsertedCache))
+            .then((cache) => {
+                assert.isNotNull(cache);
+
+                done();
+            })
+            .catch(done);
+    });
+
     test('Update linked entities on update cluster', (done) => {
         // TODO IGNITE-3262 Add test.
         done();

http://git-wip-us.apache.org/repos/asf/ignite/blob/f173be81/modules/web-console/backend/test/unit/DomainService.test.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/test/unit/DomainService.test.js 
b/modules/web-console/backend/test/unit/DomainService.test.js
index c7cf149..e4c531d 100644
--- a/modules/web-console/backend/test/unit/DomainService.test.js
+++ b/modules/web-console/backend/test/unit/DomainService.test.js
@@ -150,6 +150,11 @@ suite('DomainsServiceTestsSuite', () => {
             .catch(done);
     });
 
+    test('List of domains in cluster', (done) => {
+        // TODO IGNITE-5737 Add test.
+        done();
+    });
+
     test('Update linked entities on update domain', (done) => {
         // TODO IGNITE-3262 Add test.
         done();

http://git-wip-us.apache.org/repos/asf/ignite/blob/f173be81/modules/web-console/frontend/app/app.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/app.js 
b/modules/web-console/frontend/app/app.js
index c19018c..46559e5 100644
--- a/modules/web-console/frontend/app/app.js
+++ b/modules/web-console/frontend/app/app.js
@@ -335,11 +335,7 @@ angular.module('ignite-console', [
         $root.revertIdentity = () => {
             $http.get('/api/v1/admin/revert/identity')
                 .then(() => User.load())
-                .then((user) => {
-                    $root.$broadcast('user', user);
-
-                    $state.go('base.settings.admin');
-                })
+                .then(() => $state.go('base.settings.admin'))
                 .then(() => Notebook.load())
                 .catch(Messages.showError);
         };

http://git-wip-us.apache.org/repos/asf/ignite/blob/f173be81/modules/web-console/frontend/app/components/page-configure-basic/template.pug
----------------------------------------------------------------------
diff --git 
a/modules/web-console/frontend/app/components/page-configure-basic/template.pug 
b/modules/web-console/frontend/app/components/page-configure-basic/template.pug
index ab8f43c..45ac17a 100644
--- 
a/modules/web-console/frontend/app/components/page-configure-basic/template.pug
+++ 
b/modules/web-console/frontend/app/components/page-configure-basic/template.pug
@@ -132,7 +132,7 @@ form(novalidate name=form)
                     'Flag indicating whether data can be read from backup<br/>\
                     If not set then always get data from primary node (never 
from backup)')
             .settings-row(ng-show='cache.cacheMode === "PARTITIONED" && 
cache.atomicityMode === "TRANSACTIONAL"')
-                +checkbox('Invalidate near cache', 'cache.invalidate', 
'"invalidate"',
+                +checkbox('Invalidate near cache', 'cache.isInvalidate', 
'"isInvalidate"',
                     'Invalidation flag for near cache entries in 
transaction<br/>\
                     If set then values will be invalidated (nullified) upon 
commit in near cache')
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/f173be81/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
----------------------------------------------------------------------
diff --git 
a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
 
b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
index 9269fc9..d714afb 100644
--- 
a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
+++ 
b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
@@ -1971,7 +1971,7 @@ export default class IgniteConfigurationGenerator {
         ccfg.intProperty('copyOnRead');
 
         if (ccfg.valueOf('cacheMode') === 'PARTITIONED' && 
ccfg.valueOf('atomicityMode') === 'TRANSACTIONAL')
-            ccfg.intProperty('invalidate');
+            ccfg.intProperty('isInvalidate', 'invalidate');
 
         return ccfg;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f173be81/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
----------------------------------------------------------------------
diff --git 
a/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
 
b/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
index 2f652d4..c45fdee 100644
--- 
a/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
+++ 
b/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
@@ -285,7 +285,7 @@ export default ['JavaTypes', 
'igniteClusterPlatformDefaults', 'igniteCachePlatfo
             ccfg.intProperty('copyOnRead');
 
             if (ccfg.valueOf('cacheMode') === 'PARTITIONED' && 
ccfg.valueOf('atomicityMode') === 'TRANSACTIONAL')
-                ccfg.intProperty('invalidate');
+                ccfg.intProperty('isInvalidate', 'invalidate');
 
             return ccfg;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f173be81/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug
----------------------------------------------------------------------
diff --git 
a/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug
 
b/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug
index 50f39e6..b857e07 100644
--- 
a/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug
+++ 
b/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug
@@ -93,7 +93,7 @@ include /app/helpers/jade/mixins
                         'Flag indicating whether copy of the value stored in 
cache should be created for cache operation implying return value<br/>\
                         Also if this flag is set copies are created for values 
passed to CacheInterceptor and to CacheEntryProcessor')
                 .settings-row(ng-show=`${model}.cacheMode === 'PARTITIONED' && 
${model}.atomicityMode === 'TRANSACTIONAL'`)
-                    +checkbox('Invalidate near cache', `${model}.invalidate`, 
'"invalidate"',
+                    +checkbox('Invalidate near cache', 
`${model}.isInvalidate`, '"isInvalidate"',
                         'Invalidation flag for near cache entries in 
transaction<br/>\
                         If set then values will be invalidated (nullified) 
upon commit in near cache')
             .col-sm-6

http://git-wip-us.apache.org/repos/asf/ignite/blob/f173be81/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug
----------------------------------------------------------------------
diff --git 
a/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug
 
b/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug
index b4b5abe..bb2018f 100644
--- 
a/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug
+++ 
b/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug
@@ -107,6 +107,12 @@ mixin table-index-item-edit(prefix, index, sortAvailable, 
idAddition)
                              Used to build / modify keys and values during SQL 
DML operations when no key - value classes are present on cluster nodes.'
                         )
                     .settings-row
+                        +ignite-form-field-dropdown('Key fields:', 
queryKeyFields, '"queryKeyFields"', false, false, true,
+                            'Select key fields', 'Configure available fields', 
'fields(\'cur\', ' + queryKeyFields + ')',
+                            'Query fields that belongs to the key.<br/>\
+                             Used to build / modify keys and values during SQL 
DML operations when no key - value classes are present on cluster nodes.'
+                        )
+                    .settings-row
                         +ignite-form-group(ng-model=queryAliases 
ng-form=queryAliasesForm)
                             ignite-form-field-label
                                 | Aliases

Reply via email to