Repository: ambari Updated Branches: refs/heads/trunk 9de11b0d6 -> ef208aaac
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/test/controllers/wizard/step7_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js index dedc469..cf6f051 100644 --- a/ambari-web/test/controllers/wizard/step7_test.js +++ b/ambari-web/test/controllers/wizard/step7_test.js @@ -343,149 +343,6 @@ describe('App.InstallerStep7Controller', function () { }); }); - describe('#activateSpecialConfigs', function () { - var expected = [{ - "smokeuser": { - "isEditable": true - }, - "group": { - "isEditable": true - }, - "services": [ - { - "serviceName": "s1", - "isSelected": true, - "isInstalled": false - }, - { - "serviceName": "s2", - "isSelected": false, - "isInstalled": false - }, - { - "serviceName": "s3", - "isSelected": true, - "isInstalled": true - }, - { - "serviceName": "s4", - "isSelected": false, - "isInstalled": false - }, - { - "serviceName": "s5", - "isSelected": true, - "isInstalled": false - }, - { - "serviceName": "s6", - "isSelected": false, - "isInstalled": false - }, - { - "serviceName": "s7", - "isSelected": true, - "isInstalled": true - }, - { - "serviceName": "s8", - "isSelected": false, - "isInstalled": false - } - ] - },[ - { - "serviceName": "MISC", - "configs": [ - { - "name": "smokeuser", - "value": { - "isEditable": true - }, - "isEditable": false - }, - { - "name": "user_group", - "value": { - "isEditable": true - }, - "isEditable": false - }, - { - "name": "kdc_type" - } - ] - }, - { - "serviceName": "KERBEROS", - "configs": [ - { - "name": "smokeuser", - "value": { - "isEditable": true - }, - "isEditable": false - }, - { - "name": "user_group", - "value": { - "isEditable": true - }, - "isEditable": false - }, - { - "name": "kdc_type" - } - ] - } - ]]; - var allSelectedServiceNames = ['SLIDER', 'YARN']; - var configs = Em.A([Em.Object.create({ - name: 'smokeuser', - value: '' - }),Em.Object.create({ - name: 'user_group', - value: '' - }),Em.Object.create({ - name: 'kdc_type', - value: '' - })]); - var stepConfigs = Em.A([Em.Object.create({serviceName: 'MISC', configs: configs}), - Em.Object.create({serviceName: 'KERBEROS', configs: configs})]); - var content = Em.Object.create({ - smokeuser: Em.Object.create({isEditable: true}), - group: Em.Object.create({isEditable: true}), - services: Em.A([ - Em.Object.create({isSelected: true, isInstalled: false, serviceName: 's1'}), - Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's2'}), - Em.Object.create({isSelected: true, isInstalled: true, serviceName: 's3'}), - Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's4'}), - Em.Object.create({isSelected: true, isInstalled: false, serviceName: 's5'}), - Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's6'}), - Em.Object.create({isSelected: true, isInstalled: true, serviceName: 's7'}), - Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's8'}) - ]) - }); - it('should return configs with true value', function () { - installerStep7Controller.set('wizardController', Em.Object.create(App.LocalStorage, {name: 'addServiceController'})); - installerStep7Controller.set('addMiscTabToPage',true); - installerStep7Controller.reopen({allSelectedServiceNames: allSelectedServiceNames}); - installerStep7Controller.set('stepConfigs', stepConfigs); - installerStep7Controller.set('content', content); - installerStep7Controller.activateSpecialConfigs(); - expect(JSON.parse(JSON.stringify(installerStep7Controller.get('content')))).to.be.eql(expected[0]); - }); - it('should return stepsConfigs with true value', function () { - installerStep7Controller.set('wizardController', Em.Object.create(App.LocalStorage, {name: 'kerberosWizardController'})); - installerStep7Controller.set('addMiscTabToPage',true); - installerStep7Controller.reopen({allSelectedServiceNames: allSelectedServiceNames}); - installerStep7Controller.set('stepConfigs', stepConfigs); - installerStep7Controller.set('content', content); - installerStep7Controller.activateSpecialConfigs(); - expect(JSON.parse(JSON.stringify(installerStep7Controller.get('stepConfigs')))).to.be.eql(expected[1]); - }); - }); - describe('#getConfigTagsSuccess', function () { beforeEach(function(){ sinon.stub(App.StackService, 'find', function () { @@ -652,68 +509,6 @@ describe('App.InstallerStep7Controller', function () { }); }); - describe('#resolveYarnConfigs', function () { - it('should set property to true', function () { - var allSelectedServiceNames = ['SLIDER', 'YARN'], - configs = [ - {name: 'hadoop.registry.rm.enabled', value: 'false', recommendedValue: 'false'} - ], - expected = [ - {name: 'hadoop.registry.rm.enabled', value: 'true', recommendedValue: 'true'} - ]; - installerStep7Controller.reopen({allSelectedServiceNames: allSelectedServiceNames}); - installerStep7Controller.resolveYarnConfigs(configs); - expect(configs[0]).to.eql(expected[0]); - }); - - it('should set property to false', function () { - var allSelectedServiceNames = ['YARN'], - configs = [ - {name: 'hadoop.registry.rm.enabled', value: 'true', recommendedValue: 'true'} - ], - expected = [ - {name: 'hadoop.registry.rm.enabled', value: 'false', recommendedValue: 'false'} - ]; - installerStep7Controller.reopen({allSelectedServiceNames: allSelectedServiceNames}); - installerStep7Controller.resolveYarnConfigs(configs); - expect(configs[0]).to.eql(expected[0]); - }); - - it('should skip setting property', function () { - var allSelectedServiceNames = ['YARN', 'SLIDER'], - configs = [ - {name: 'hadoop.registry.rm.enabled', value: 'true', recommendedValue: 'true'} - ], - expected = [ - {name: 'hadoop.registry.rm.enabled', value: 'true', recommendedValue: 'true'} - ]; - installerStep7Controller.reopen({allSelectedServiceNames: allSelectedServiceNames}); - installerStep7Controller.resolveYarnConfigs(configs); - expect(configs[0]).to.eql(expected[0]); - }); - }); - - describe('#resolveServiceDependencyConfigs', function () { - beforeEach(function () { - sinon.stub(installerStep7Controller, 'resolveYarnConfigs', Em.K); - }); - afterEach(function () { - installerStep7Controller.resolveYarnConfigs.restore(); - }); - [ - {serviceName: 'YARN', method: "resolveYarnConfigs"} - ].forEach(function(t) { - it("should call " + t.method + " if serviceName is " + t.serviceName, function () { - var configs = [ - {}, - {} - ]; - installerStep7Controller.resolveServiceDependencyConfigs(t.serviceName, configs); - expect(installerStep7Controller[t.method].calledWith(configs)).to.equal(true); - }); - }); - }); - describe('#selectedServiceObserver', function () { beforeEach(function () { installerStep7Controller.reopen({content: {services: []}}); @@ -1250,10 +1045,7 @@ describe('App.InstallerStep7Controller', function () { sinon.stub(installerStep7Controller, 'clearStep', Em.K); sinon.stub(installerStep7Controller, 'getConfigTags', Em.K); sinon.stub(installerStep7Controller, 'setInstalledServiceConfigs', Em.K); - sinon.stub(installerStep7Controller, 'resolveServiceDependencyConfigs', Em.K); - sinon.stub(installerStep7Controller, 'setStepConfigs', Em.K); sinon.stub(installerStep7Controller, 'checkHostOverrideInstaller', Em.K); - sinon.stub(installerStep7Controller, 'activateSpecialConfigs', Em.K); sinon.stub(installerStep7Controller, 'selectProperService', Em.K); sinon.stub(installerStep7Controller, 'applyServicesConfigs', Em.K); sinon.stub(App.router, 'send', Em.K); @@ -1263,10 +1055,7 @@ describe('App.InstallerStep7Controller', function () { installerStep7Controller.clearStep.restore(); installerStep7Controller.getConfigTags.restore(); installerStep7Controller.setInstalledServiceConfigs.restore(); - installerStep7Controller.resolveServiceDependencyConfigs.restore(); - installerStep7Controller.setStepConfigs.restore(); installerStep7Controller.checkHostOverrideInstaller.restore(); - installerStep7Controller.activateSpecialConfigs.restore(); installerStep7Controller.selectProperService.restore(); installerStep7Controller.applyServicesConfigs.restore(); App.router.send.restore(); @@ -1295,14 +1084,11 @@ describe('App.InstallerStep7Controller', function () { sinon.stub(App.config, 'fileConfigsIntoTextarea', function(configs) { return configs; }); - sinon.stub(installerStep7Controller, 'resolveServiceDependencyConfigs', Em.K); sinon.stub(installerStep7Controller, 'loadServerSideConfigsRecommendations', function() { return $.Deferred().resolve(); }); sinon.stub(installerStep7Controller, 'checkHostOverrideInstaller', Em.K); - sinon.stub(installerStep7Controller, 'activateSpecialConfigs', Em.K); sinon.stub(installerStep7Controller, 'selectProperService', Em.K); - sinon.stub(installerStep7Controller, 'setStepConfigs', Em.K); sinon.stub(App.router, 'send', Em.K); sinon.stub(App.StackService, 'find', function () { return { @@ -1320,23 +1106,18 @@ describe('App.InstallerStep7Controller', function () { }); afterEach(function () { App.config.fileConfigsIntoTextarea.restore(); - installerStep7Controller.resolveServiceDependencyConfigs.restore(); installerStep7Controller.loadServerSideConfigsRecommendations.restore(); installerStep7Controller.checkHostOverrideInstaller.restore(); - installerStep7Controller.activateSpecialConfigs.restore(); installerStep7Controller.selectProperService.restore(); - installerStep7Controller.setStepConfigs.restore(); App.router.send.restore(); App.StackService.find.restore(); }); it('should run some methods' , function () { - installerStep7Controller.applyServicesConfigs({name: 'configs'}, {name: 'storedConfigs'}); + installerStep7Controller.applyServicesConfigs([{name: 'configs'}]); expect(installerStep7Controller.loadServerSideConfigsRecommendations.calledOnce).to.equal(true); expect(installerStep7Controller.get('isRecommendedLoaded')).to.equal(true); - expect(installerStep7Controller.setStepConfigs.calledOnce).to.equal(true); expect(installerStep7Controller.checkHostOverrideInstaller.calledOnce).to.equal(true); - expect(installerStep7Controller.activateSpecialConfigs.calledOnce).to.equal(true); expect(installerStep7Controller.selectProperService.calledOnce).to.equal(true); }); @@ -1344,25 +1125,19 @@ describe('App.InstallerStep7Controller', function () { { allSelectedServiceNames: ['YARN'], fileConfigsIntoTextarea: true, - m: 'should run fileConfigsIntoTextarea and resolveServiceDependencyConfigs', - resolveServiceDependencyConfigs: true + m: 'should run fileConfigsIntoTextarea' } ]).forEach(function(t) { it(t.m, function () { installerStep7Controller.reopen({ allSelectedServiceNames: t.allSelectedServiceNames }); - installerStep7Controller.applyServicesConfigs({name: 'configs'}, {name: 'storedConfigs'}); + installerStep7Controller.applyServicesConfigs([{name: 'configs'}]); if (t.fileConfigsIntoTextarea) { - expect(App.config.fileConfigsIntoTextarea.calledWith({name: 'configs'}, 'capacity-scheduler.xml')).to.equal(true); + expect(App.config.fileConfigsIntoTextarea.calledWith([{name: 'configs'}], 'capacity-scheduler.xml')).to.equal(true); } else { expect(App.config.fileConfigsIntoTextarea.calledOnce).to.equal(false); } - if (t.resolveServiceDependencyConfigs) { - expect(installerStep7Controller.resolveServiceDependencyConfigs.calledWith(t.allSelectedServiceNames[0], {name: 'configs'})).to.equal(true); - } else { - expect(installerStep7Controller.resolveServiceDependencyConfigs.calledOnce).to.equal(false); - } }); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/test/data/HDP2.2/site_properties_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/data/HDP2.2/site_properties_test.js b/ambari-web/test/data/HDP2.2/site_properties_test.js index 01e6119..1cde085 100644 --- a/ambari-web/test/data/HDP2.2/site_properties_test.js +++ b/ambari-web/test/data/HDP2.2/site_properties_test.js @@ -26,7 +26,7 @@ describe('hdp2SiteProperties', function () { * @stackProperties: All the properties that are derived from stack definition */ var stackProperties = siteProperties.filter(function(item){ - return (!(item.isRequiredByAgent === false || item.filename === 'alert_notification' || item.category === 'Ambari Principals' || item.name === 'oozie_hostname')) + return !(item.isRequiredByAgent === false || item.category === 'Ambari Principals') }); stackProperties.forEach(function(siteProperty){ http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/test/data/HDP2.3/site_properties_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/data/HDP2.3/site_properties_test.js b/ambari-web/test/data/HDP2.3/site_properties_test.js index 4e5589e..263ad6a 100644 --- a/ambari-web/test/data/HDP2.3/site_properties_test.js +++ b/ambari-web/test/data/HDP2.3/site_properties_test.js @@ -26,8 +26,7 @@ describe('hdp2SiteProperties', function () { * @stackProperties: All the properties that are derived from stack definition */ var stackProperties = siteProperties.filter(function(item){ - return (!(item.isRequiredByAgent === false || item.filename === 'alert_notification' || item.category === 'Ambari Principals' - || item.name === 'oozie_hostname')) + return !(item.isRequiredByAgent === false || item.category === 'Ambari Principals') }); stackProperties.forEach(function(siteProperty){ http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/test/data/HDP2/site_properties_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/data/HDP2/site_properties_test.js b/ambari-web/test/data/HDP2/site_properties_test.js index aee3072..89e0ea1 100644 --- a/ambari-web/test/data/HDP2/site_properties_test.js +++ b/ambari-web/test/data/HDP2/site_properties_test.js @@ -26,7 +26,7 @@ describe('hdp2SiteProperties', function () { * @stackProperties: All the properties that are derived from stack definition */ var stackProperties = siteProperties.filter(function(item){ - return (!(item.isRequiredByAgent === false || item.filename === 'alert_notification' || item.category === 'Ambari Principals' || item.name === 'oozie_hostname')) + return !(item.isRequiredByAgent === false || item.category === 'Ambari Principals') }); stackProperties.forEach(function(siteProperty){ http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/test/mappers/configs/config_versions_mapper_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/mappers/configs/config_versions_mapper_test.js b/ambari-web/test/mappers/configs/config_versions_mapper_test.js deleted file mode 100644 index 7c9db65..0000000 --- a/ambari-web/test/mappers/configs/config_versions_mapper_test.js +++ /dev/null @@ -1,119 +0,0 @@ -/** - * 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 App = require('app'); -require('mappers/configs/config_versions_mapper'); - -describe.skip('App.configVersionsMapper', function () { - - var allHosts = App.get('allHostNames'); - var defaultAllHosts = ['host1', 'host2', 'host3']; - beforeEach(function () { - App.set('allHostNames', defaultAllHosts); - }); - afterEach(function(){ - App.set('allHostNames', allHosts); - }); - - describe("#map", function() { - - var json = { items: [ - { - "cluster_name" : "1", - "createtime" : 1425979244738, - "group_id" : -1, - "group_name" : "default", - "hosts" : [ ], - "is_current" : true, - "service_config_version" : 1, - "service_config_version_note" : "Initial configurations for SERVICE1", - "service_name" : "SERVICE1", - "user" : "admin" - }, - { - "cluster_name" : "1", - "configurations" : [ - { - "Config" : { - "cluster_name" : "1" - }, - "type" : "hadoop-env", - "tag" : "version1426088081862", - "version" : 2, - "properties" : { - "dtnode_heapsize" : "1026m" - }, - "properties_attributes" : { } - } - ], - "createtime" : 1426088137115, - "group_id" : 2, - "group_name" : "1", - "hosts" : [ - "host1" - ], - "is_current" : false, - "service_config_version" : 4, - "service_config_version_note" : "", - "service_name" : "SERVICE2", - "user" : "admin" - }, - ]}; - - beforeEach(function () { - App.resetDsStoreTypeMap(App.ConfigVersion); - sinon.stub(App.store, 'commit', Em.K); - }); - afterEach(function(){ - App.store.commit.restore(); - }); - - it('should not do anything as there is no json', function() { - App.configVersionsMapper.map(null); - expect(App.ConfigVersion.find().get('length')).to.equal(0); - }); - - it('should load data to model', function() { - App.configVersionsMapper.map(json); - expect(App.ConfigVersion.find().get('length')).to.equal(2); - expect(App.ConfigVersion.find().mapProperty('id')).to.eql(['SERVICE1_1','SERVICE2_4']); - - //SERVICE1_1 - expect(App.ConfigVersion.find('SERVICE1_1').get('createTime')).to.eql(1425979244738); - expect(App.ConfigVersion.find('SERVICE1_1').get('groupId')).to.eql(-1); - expect(App.ConfigVersion.find('SERVICE1_1').get('hosts')).to.eql(defaultAllHosts); - expect(App.ConfigVersion.find('SERVICE1_1').get('isCurrent')).to.be.true; - expect(App.ConfigVersion.find('SERVICE1_1').get('version')).to.eql(1); - expect(App.ConfigVersion.find('SERVICE1_1').get('notes')).to.eql("Initial configurations for SERVICE1"); - expect(App.ConfigVersion.find('SERVICE1_1').get('serviceName')).to.eql("SERVICE1"); - expect(App.ConfigVersion.find('SERVICE1_1').get('author')).to.eql("admin"); - - //SERVICE1_2 - expect(App.ConfigVersion.find('SERVICE2_4').get('createTime')).to.eql(1426088137115); - expect(App.ConfigVersion.find('SERVICE2_4').get('groupId')).to.eql(2); - expect(App.ConfigVersion.find('SERVICE2_4').get('hosts')).to.eql(["host1"]); - expect(App.ConfigVersion.find('SERVICE2_4').get('isCurrent')).to.be.false; - expect(App.ConfigVersion.find('SERVICE2_4').get('version')).to.eql(4); - expect(App.ConfigVersion.find('SERVICE2_4').get('notes')).to.eql(""); - expect(App.ConfigVersion.find('SERVICE2_4').get('serviceName')).to.eql("SERVICE2"); - expect(App.ConfigVersion.find('SERVICE2_4').get('author')).to.eql("admin"); - }); - }); - -}); - http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/test/mappers/configs/service_config_version_mapper_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/mappers/configs/service_config_version_mapper_test.js b/ambari-web/test/mappers/configs/service_config_version_mapper_test.js new file mode 100644 index 0000000..c118ada --- /dev/null +++ b/ambari-web/test/mappers/configs/service_config_version_mapper_test.js @@ -0,0 +1,119 @@ +/** + * 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 App = require('app'); +require('mappers/configs/service_config_version_mapper'); + +describe.skip('App.serviceConfigVersionsMapper', function () { + + var allHosts = App.get('allHostNames'); + var defaultAllHosts = ['host1', 'host2', 'host3']; + beforeEach(function () { + App.set('allHostNames', defaultAllHosts); + }); + afterEach(function(){ + App.set('allHostNames', allHosts); + }); + + describe("#map", function() { + + var json = { items: [ + { + "cluster_name" : "1", + "createtime" : 1425979244738, + "group_id" : -1, + "group_name" : "default", + "hosts" : [ ], + "is_current" : true, + "service_config_version" : 1, + "service_config_version_note" : "Initial configurations for SERVICE1", + "service_name" : "SERVICE1", + "user" : "admin" + }, + { + "cluster_name" : "1", + "configurations" : [ + { + "Config" : { + "cluster_name" : "1" + }, + "type" : "hadoop-env", + "tag" : "version1426088081862", + "version" : 2, + "properties" : { + "dtnode_heapsize" : "1026m" + }, + "properties_attributes" : { } + } + ], + "createtime" : 1426088137115, + "group_id" : 2, + "group_name" : "1", + "hosts" : [ + "host1" + ], + "is_current" : false, + "service_config_version" : 4, + "service_config_version_note" : "", + "service_name" : "SERVICE2", + "user" : "admin" + }, + ]}; + + beforeEach(function () { + App.resetDsStoreTypeMap(App.ServiceConfigVersion); + sinon.stub(App.store, 'commit', Em.K); + }); + afterEach(function(){ + App.store.commit.restore(); + }); + + it('should not do anything as there is no json', function() { + App.serviceConfigVersionsMapper.map(null); + expect(App.ServiceConfigVersion.find().get('length')).to.equal(0); + }); + + it('should load data to model', function() { + App.serviceConfigVersionsMapper.map(json); + expect(App.ServiceConfigVersion.find().get('length')).to.equal(2); + expect(App.ServiceConfigVersion.find().mapProperty('id')).to.eql(['SERVICE1_1','SERVICE2_4']); + + //SERVICE1_1 + expect(App.ServiceConfigVersion.find('SERVICE1_1').get('createTime')).to.eql(1425979244738); + expect(App.ServiceConfigVersion.find('SERVICE1_1').get('groupId')).to.eql(-1); + expect(App.ServiceConfigVersion.find('SERVICE1_1').get('hosts')).to.eql(defaultAllHosts); + expect(App.ServiceConfigVersion.find('SERVICE1_1').get('isCurrent')).to.be.true; + expect(App.ServiceConfigVersion.find('SERVICE1_1').get('version')).to.eql(1); + expect(App.ServiceConfigVersion.find('SERVICE1_1').get('notes')).to.eql("Initial configurations for SERVICE1"); + expect(App.ServiceConfigVersion.find('SERVICE1_1').get('serviceName')).to.eql("SERVICE1"); + expect(App.ServiceConfigVersion.find('SERVICE1_1').get('author')).to.eql("admin"); + + //SERVICE1_2 + expect(App.ServiceConfigVersion.find('SERVICE2_4').get('createTime')).to.eql(1426088137115); + expect(App.ServiceConfigVersion.find('SERVICE2_4').get('groupId')).to.eql(2); + expect(App.ServiceConfigVersion.find('SERVICE2_4').get('hosts')).to.eql(["host1"]); + expect(App.ServiceConfigVersion.find('SERVICE2_4').get('isCurrent')).to.be.false; + expect(App.ServiceConfigVersion.find('SERVICE2_4').get('version')).to.eql(4); + expect(App.ServiceConfigVersion.find('SERVICE2_4').get('notes')).to.eql(""); + expect(App.ServiceConfigVersion.find('SERVICE2_4').get('serviceName')).to.eql("SERVICE2"); + expect(App.ServiceConfigVersion.find('SERVICE2_4').get('author')).to.eql("admin"); + }); + }); + +}); + http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/test/mappers/configs/themes_mapper_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/mappers/configs/themes_mapper_test.js b/ambari-web/test/mappers/configs/themes_mapper_test.js index 872308f..a958335 100644 --- a/ambari-web/test/mappers/configs/themes_mapper_test.js +++ b/ambari-web/test/mappers/configs/themes_mapper_test.js @@ -21,7 +21,6 @@ require('mappers/configs/themes_mapper'); require('models/configs/theme/tab'); require('models/configs/theme/section'); require('models/configs/theme/sub_section'); -require('models/configs/stack_config_property'); describe('App.themeMapper', function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/test/models/configs/config_property_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/models/configs/config_property_test.js b/ambari-web/test/models/configs/config_property_test.js deleted file mode 100644 index 5faad7a..0000000 --- a/ambari-web/test/models/configs/config_property_test.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * 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 App = require('app'); - -require('models/configs/config_property'); - -var model; - -describe('App.ConfigProperty', function () { - model = App.ConfigProperty.createRecord(); - - describe('#hasErrors', function () { - it('should set hasErrors to true', function () { - expect(model.setProperties({'errorMessage': 'some error'}).get('hasErrors')).to.eql(true); - }); - it('should set hasErrors to false', function () { - expect(model.setProperties({'errorMessage': ''}).get('hasErrors')).to.eql(false); - }); - }); - - describe('#hasWarnings', function () { - it('should set hasWarnings to true', function () { - expect(model.setProperties({'warnMessage': 'some warning'}).get('hasWarnings')).to.eql(true); - }); - it('should set hasWarnings to false', function () { - expect(model.setProperties({'warnMessage': ''}).get('hasWarnings')).to.eql(false); - }); - }); - - describe.skip('#isNotDefaultValue', function () { - var tests = [ - { isEditable: false, value: 1, defaultValue: 2, supportsFinal: true, isFinal: true, defaultIsFinal: false, isNotDefaultValue: false }, - { isEditable: true, value: 1, defaultValue: 1, supportsFinal: false, isFinal: true, defaultIsFinal: true, isNotDefaultValue: false }, - { isEditable: true, value: 1, defaultValue: null, supportsFinal: false, isFinal: true, defaultIsFinal: true, isNotDefaultValue: false }, - { isEditable: true, value: 1, defaultValue: 1, supportsFinal: true, isFinal: true, defaultIsFinal: true, isNotDefaultValue: false }, - - { isEditable: true, value: 2, defaultValue: 1, supportsFinal: true, isFinal: true, defaultIsFinal: true, isNotDefaultValue: true }, - { isEditable: true, value: 2, defaultValue: 1, supportsFinal: false, isFinal: true, defaultIsFinal: false, isNotDefaultValue: true }, - { isEditable: true, value: 1, defaultValue: 1, supportsFinal: true, isFinal: false, defaultIsFinal: true, isNotDefaultValue: true }, - ]; - - tests.forEach(function(t, i) { - it('should set isNotDefaultValue to ' + t.isNotDefaultValue + ' situation ' + i, function () { - expect(model.setProperties({'isEditable': t.isEditable, 'value': t.value, defaultValue: t.defaultValue, - supportsFinal: t.supportsFinal, isFinal: t.isFinal, defaultIsFinal:t.defaultIsFinal}).get('isNotDefaultValue')).to.eql(t.isNotDefaultValue); - }); - }); - }); - -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js b/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js index ec408f6..1da7d8a 100644 --- a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js +++ b/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js @@ -465,7 +465,7 @@ describe('App.SliderConfigWidgetView', function () { beforeEach(function() { viewInt.set('config', {}); - stackConfigProperty = App.StackConfigProperty.createRecord({name: 'p1', widget: { units: [ { 'unit-name': "int"}]}, valueAttributes: {minimum: 1, maximum: 10, increment_step: 4, type: 'int'}}); + stackConfigProperty = {name: 'p1', widget: { units: [ { 'unit-name': "int"}]}, valueAttributes: {minimum: 1, maximum: 10, increment_step: 4, type: 'int'}}; viewInt.set('config.stackConfigProperty', stackConfigProperty); viewInt.set('config.isValid', true); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js b/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js index a7b81a9..90c7fa0 100644 --- a/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js +++ b/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js @@ -253,7 +253,7 @@ describe('App.TimeIntervalSpinnerView', function () { beforeEach(function() { view.set('config', Em.Object.create({})); - stackConfigProperty = App.StackConfigProperty.createRecord({ + stackConfigProperty = { name: 'p1', valueAttributes: { minimum: 1, maximum: 10, increment_step: 4, type: 'int', unit: 'seconds' }, @@ -264,7 +264,7 @@ describe('App.TimeIntervalSpinnerView', function () { } ] } - }); + }; view.set('config.stackConfigProperty', stackConfigProperty); view.set('config.isValid', true); view.set('maxValue', [{"value":10,"type":"hours","minValue":0,"maxValue":10,"incrementStep":1,"enabled":true},{"value":0,"type":"minutes","minValue":0,"maxValue":59,"incrementStep":1,"enabled":true}]);
