You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2018/08/22 13:54:54 UTC
[5/9] ignite git commit: IGNITE-9262 Web Console: Fixed generation of
project on Configuration screen.
IGNITE-9262 Web Console: Fixed generation of project on Configuration screen.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bab61f13
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bab61f13
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bab61f13
Branch: refs/heads/ignite-9340
Commit: bab61f133270248ab2974c751b1e1b20ca6d64b3
Parents: c43876e
Author: Vasiliy Sisko <vs...@gridgain.com>
Authored: Wed Aug 22 16:54:32 2018 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Aug 22 16:54:32 2018 +0700
----------------------------------------------------------------------
.../services/ConfigurationResource.js | 4 +-
.../services/ConfigurationResource.spec.js | 78 ++++++++++++++++++++
2 files changed, 81 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bab61f13/modules/web-console/frontend/app/components/page-configure/services/ConfigurationResource.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure/services/ConfigurationResource.js b/modules/web-console/frontend/app/components/page-configure/services/ConfigurationResource.js
index 2dab8a3..269eb93 100644
--- a/modules/web-console/frontend/app/components/page-configure/services/ConfigurationResource.js
+++ b/modules/web-console/frontend/app/components/page-configure/services/ConfigurationResource.js
@@ -27,7 +27,9 @@ export default function ConfigurationResourceService($http) {
.then(({data}) => data)
.catch(({data}) => Promise.reject(data));
},
- populate({spaces, clusters, caches, igfss, domains}) {
+ populate(data) {
+ const {spaces, clusters, caches, igfss, domains} = _.cloneDeep(data);
+
_.forEach(clusters, (cluster) => {
cluster.caches = _.filter(caches, ({_id}) => _.includes(cluster.caches, _id));
http://git-wip-us.apache.org/repos/asf/ignite/blob/bab61f13/modules/web-console/frontend/app/components/page-configure/services/ConfigurationResource.spec.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure/services/ConfigurationResource.spec.js b/modules/web-console/frontend/app/components/page-configure/services/ConfigurationResource.spec.js
new file mode 100644
index 0000000..d52d94a
--- /dev/null
+++ b/modules/web-console/frontend/app/components/page-configure/services/ConfigurationResource.spec.js
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+import configurationResource from './ConfigurationResource';
+
+import { suite, test } from 'mocha';
+import { assert } from 'chai';
+
+const CHECKED_CONFIGURATION = {
+ spaces: [{
+ _id: '1space',
+ name: 'Test space'
+ }],
+ clusters: [{
+ _id: '1cluster',
+ space: '1space',
+ name: 'Test cluster',
+ caches: ['1cache'],
+ models: ['1model'],
+ igfss: ['1igfs']
+ }],
+ caches: [{
+ _id: '1cache',
+ space: '1space',
+ name: 'Test cache',
+ clusters: ['1cluster'],
+ models: ['1model']
+ }],
+ domains: [{
+ _id: '1model',
+ space: '1space',
+ name: 'Test model',
+ clusters: ['1cluster'],
+ caches: ['1cache']
+ }],
+ igfss: [{
+ _id: '1igfs',
+ space: '1space',
+ name: 'Test IGFS',
+ clusters: ['1cluster']
+ }]
+};
+
+suite('ConfigurationResourceTestsSuite', () => {
+ test('ConfigurationResourceService correctly populate data', async() => {
+ const service = configurationResource(null);
+ const converted = _.cloneDeep(CHECKED_CONFIGURATION);
+ const res = await service.populate(converted);
+
+ assert.notEqual(res.clusters[0], converted.clusters[0]);
+
+ assert.deepEqual(converted.clusters[0].caches, CHECKED_CONFIGURATION.clusters[0].caches);
+ assert.deepEqual(converted.clusters[0].models, CHECKED_CONFIGURATION.clusters[0].models);
+ assert.deepEqual(converted.clusters[0].igfss, CHECKED_CONFIGURATION.clusters[0].igfss);
+
+ assert.deepEqual(converted.caches[0].clusters, CHECKED_CONFIGURATION.caches[0].clusters);
+ assert.deepEqual(converted.caches[0].models, CHECKED_CONFIGURATION.caches[0].models);
+
+ assert.deepEqual(converted.domains[0].clusters, CHECKED_CONFIGURATION.domains[0].clusters);
+ assert.deepEqual(converted.domains[0].caches, CHECKED_CONFIGURATION.domains[0].caches);
+
+ assert.deepEqual(converted.igfss[0].clusters, CHECKED_CONFIGURATION.igfss[0].clusters);
+ });
+});