Repository: ambari Updated Branches: refs/heads/branch-2.2 94129bbc8 -> 2d485431c
AMBARI-15054 Changing Yarn queues does not update hive.server2.tez.default.queues. (ababiichuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2d485431 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2d485431 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2d485431 Branch: refs/heads/branch-2.2 Commit: 2d485431c257972e6c909bc269b06a013f59d243 Parents: 94129bb Author: ababiichuk <ababiic...@hortonworks.com> Authored: Wed Feb 17 12:03:10 2016 +0200 Committer: ababiichuk <ababiic...@hortonworks.com> Committed: Wed Feb 17 12:03:10 2016 +0200 ---------------------------------------------------------------------- .../controllers/main/service/info/configs.js | 3 +- ambari-web/app/controllers/wizard.js | 3 - .../app/controllers/wizard/step7_controller.js | 6 +- .../app/mixins/common/configs/configs_saver.js | 4 - .../configs/objects/service_config_property.js | 2 + ambari-web/app/utils/config.js | 152 +++++++------------ ambari-web/app/views/common/controls_view.js | 75 +++++++++ .../test/controllers/wizard/step7_test.js | 37 ----- ambari-web/test/utils/config_test.js | 149 ------------------ 9 files changed, 140 insertions(+), 291 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/2d485431/ambari-web/app/controllers/main/service/info/configs.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js index f265c66..8b96113 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/ambari-web/app/controllers/main/service/info/configs.js @@ -392,8 +392,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A //put properties from capacity-scheduler.xml into one config with textarea view if (this.get('content.serviceName') === 'YARN') { - var configsToSkip = this.get('settingsTabProperties').filterProperty('filename', 'capacity-scheduler.xml'); - configs = App.config.fileConfigsIntoTextarea(configs, 'capacity-scheduler.xml', configsToSkip); + configs = App.config.addYarnCapacityScheduler(configs); } if (this.get('content.serviceName') === 'KERBEROS') { http://git-wip-us.apache.org/repos/asf/ambari/blob/2d485431/ambari-web/app/controllers/wizard.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js index aa82234..9e94182 100644 --- a/ambari-web/app/controllers/wizard.js +++ b/ambari-web/app/controllers/wizard.js @@ -870,9 +870,6 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM installedServiceNamesMap[name] = true; }); stepController.get('stepConfigs').forEach(function (_content) { - if (_content.serviceName === 'YARN') { - _content.set('configs', App.config.textareaIntoFileConfigs(_content.get('configs'), 'capacity-scheduler.xml')); - } _content.get('configs').forEach(function (_configProperties) { if (!Em.isNone(_configProperties.get('group'))) { return false; http://git-wip-us.apache.org/repos/asf/ambari/blob/2d485431/ambari-web/app/controllers/wizard/step7_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js index 148a9a2..74de5d6 100644 --- a/ambari-web/app/controllers/wizard/step7_controller.js +++ b/ambari-web/app/controllers/wizard/step7_controller.js @@ -713,9 +713,6 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E }, applyServicesConfigs: function (configs, storedConfigs) { - if (this.get('allSelectedServiceNames').contains('YARN')) { - configs = App.config.fileConfigsIntoTextarea(configs, 'capacity-scheduler.xml', []); - } // If HAWQ service is being added, add NN-HA/RM-HA/Kerberos related parameters to hdfs-client/yarn-client if applicable if (this.get('wizardController.name') == 'addServiceController') { if (!this.get('installedServiceNames').contains('HAWQ') && this.get('allSelectedServiceNames').contains('HAWQ')) { @@ -990,6 +987,9 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E serviceConfigProperty.validate(); configsByService.pushObject(serviceConfigProperty); }, this); + if (service.get('serviceName') === 'YARN') { + configsByService = App.config.addYarnCapacityScheduler(configsByService); + } var serviceConfig = App.config.createServiceConfig(service.get('serviceName')); serviceConfig.set('showConfig', service.get('showConfig')); serviceConfig.set('configs', configsByService); http://git-wip-us.apache.org/repos/asf/ambari/blob/2d485431/ambari-web/app/mixins/common/configs/configs_saver.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mixins/common/configs/configs_saver.js b/ambari-web/app/mixins/common/configs/configs_saver.js index ecc3466..9fa2e4f 100644 --- a/ambari-web/app/mixins/common/configs/configs_saver.js +++ b/ambari-web/app/mixins/common/configs/configs_saver.js @@ -293,10 +293,6 @@ App.ConfigsSaverMixin = Em.Mixin.create({ */ getServiceConfigToSave: function(serviceName, configs) { - if (serviceName === 'YARN') { - configs = App.config.textareaIntoFileConfigs(configs, 'capacity-scheduler.xml'); - } - //generates list of properties that was changed var modifiedConfigs = this.getModifiedConfigs(configs); var serviceFilenames = Object.keys(App.StackService.find(serviceName).get('configTypes')).map(function (type) { http://git-wip-us.apache.org/repos/asf/ambari/blob/2d485431/ambari-web/app/models/configs/objects/service_config_property.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/configs/objects/service_config_property.js b/ambari-web/app/models/configs/objects/service_config_property.js index dcc7a1e..328703a 100644 --- a/ambari-web/app/models/configs/objects/service_config_property.js +++ b/ambari-web/app/models/configs/objects/service_config_property.js @@ -367,6 +367,8 @@ App.ServiceConfigProperty = Em.Object.extend({ return App.ServiceConfigComponentHostsView; case 'supportTextConnection': return App.checkConnectionView; + case 'capacityScheduler': + return App.CapacitySceduler; default: if (this.get('unit')) { return App.ServiceConfigTextFieldWithUnit; http://git-wip-us.apache.org/repos/asf/ambari/blob/2d485431/ambari-web/app/utils/config.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js index c6620a3..209452c 100644 --- a/ambari-web/app/utils/config.js +++ b/ambari-web/app/utils/config.js @@ -454,7 +454,13 @@ App.config = Em.Object.create({ * @returns {string} */ getDefaultCategory: function(stackConfigProperty, fileName) { - return (stackConfigProperty ? 'Advanced ' : 'Custom ') + this.getConfigTagFromFileName(fileName); + var tag = this.getConfigTagFromFileName(fileName); + switch (tag) { + case 'capacity-scheduler': + return 'CapacityScheduler'; + default : + return (stackConfigProperty ? 'Advanced ' : 'Custom ') + tag; + } }, /** @@ -902,107 +908,67 @@ App.config = Em.Object.create({ return App.ServiceConfigProperty.create(propertyObject); }, - complexConfigsTemplate: [ - { - "name": "capacity-scheduler", - "displayName": "Capacity Scheduler", - "value": "", - "description": "Capacity Scheduler properties", - "displayType": "custom", - "isOverridable": true, - "isRequired": true, - "isVisible": true, - "isReconfigurable": true, - "supportsFinal": false, - "serviceName": "YARN", - "filename": "capacity-scheduler.xml", - "category": "CapacityScheduler" - } - ], - /** - * transform set of configs from file - * into one config with textarea content: - * name=value - * @param {App.ServiceConfigProperty[]} configs - * @param {String} filename - * @param {App.ServiceConfigProperty[]} [configsToSkip=[]] - * @return {*} + * + * @param configs */ - fileConfigsIntoTextarea: function (configs, filename, configsToSkip) { - var fileConfigs = configs.filterProperty('filename', filename); - var value = '', savedValue = '', recommendedValue = ''; - var template = this.get('complexConfigsTemplate').findProperty('filename', filename); - var complexConfig = $.extend({}, template); - if (complexConfig) { - fileConfigs.forEach(function (_config) { - if (!(configsToSkip && configsToSkip.someProperty('name', _config.name))) { - value += _config.name + '=' + _config.value + '\n'; - if (!Em.isNone(_config.savedValue)) { - savedValue += _config.name + '=' + _config.savedValue + '\n'; - } - if (!Em.isNone(_config.recommendedValue)) { - recommendedValue += _config.name + '=' + _config.recommendedValue + '\n'; - } - } - }, this); - var isFinal = fileConfigs.someProperty('isFinal', true); - var savedIsFinal = fileConfigs.someProperty('savedIsFinal', true); - var recommendedIsFinal = fileConfigs.someProperty('recommendedIsFinal', true); - complexConfig.value = value; - if (savedValue) { - complexConfig.savedValue = savedValue; + addYarnCapacityScheduler: function(configs) { + var value = '', savedValue = '', recommendedValue = '', + excludedConfigs = App.config.getPropertiesFromTheme('YARN'); + + var connectedConfigs = configs.filter(function(config) { + return !excludedConfigs.contains(App.config.configId(config.get('name'), config.get('filename'))) && (config.get('filename') === 'capacity-scheduler.xml'); + }); + connectedConfigs.setEach('isVisible', false); + + connectedConfigs.forEach(function (config) { + value += config.get('name') + '=' + config.get('value') + '\n'; + if (!Em.isNone(config.get('savedValue'))) { + savedValue += config.get('name') + '=' + config.get('savedValue') + '\n'; } - if (recommendedValue) { - complexConfig.recommendedValue = recommendedValue; + if (!Em.isNone(config.get('recommendedValue'))) { + recommendedValue += config.get('name') + '=' + config.get('recommendedValue') + '\n'; } - complexConfig.isFinal = isFinal; - complexConfig.savedIsFinal = savedIsFinal; - complexConfig.recommendedIsFinal = recommendedIsFinal; - configs = configs.filter(function (_config) { - return _config.filename !== filename || (configsToSkip && configsToSkip.someProperty('name', _config.name)); - }); - configs.push(App.ServiceConfigProperty.create(complexConfig)); - } + }, this); + + var isFinal = connectedConfigs.someProperty('isFinal', true); + var savedIsFinal = connectedConfigs.someProperty('savedIsFinal', true); + var recommendedIsFinal = connectedConfigs.someProperty('recommendedIsFinal', true); + + var cs = App.config.createDefaultConfig('capacity-scheduler', 'YARN', 'capacity-scheduler.xml', true, { + 'value': value, + 'savedValue': savedValue || null, + 'recommendedValue': recommendedValue || null, + 'isFinal': isFinal, + 'savedIsFinal': savedIsFinal, + 'recommendedIsFinal': recommendedIsFinal, + 'displayName': 'Capacity Scheduler', + 'description': 'Capacity Scheduler properties', + 'displayType': 'capacityScheduler', + 'isRequiredByAgent': false + }); + + configs.push(App.ServiceConfigProperty.create(cs)); return configs; }, /** - * transform one config with textarea content - * into set of configs of file - * @param configs - * @param filename - * @return {*} + * + * @param serviceName + * @returns {Array} */ - textareaIntoFileConfigs: function (configs, filename) { - var complexConfigName = this.get('complexConfigsTemplate').findProperty('filename', filename).name; - var configsTextarea = configs.findProperty('name', complexConfigName); - if (configsTextarea && !App.get('testMode')) { - var properties = configsTextarea.get('value').split('\n'); - - properties.forEach(function (_property) { - var name, value; - if (_property) { - _property = _property.split('='); - name = _property[0]; - value = (_property[1]) ? _property[1] : ""; - configs.push(Em.Object.create({ - name: name, - value: value, - savedValue: value, - serviceName: configsTextarea.get('serviceName'), - filename: filename, - isFinal: configsTextarea.get('isFinal'), - isNotDefaultValue: configsTextarea.get('isNotDefaultValue'), - isRequiredByAgent: configsTextarea.get('isRequiredByAgent'), - group: null - })); - } - }); - return configs.without(configsTextarea); - } - console.log('ERROR: textarea config - ' + complexConfigName + ' is missing'); - return configs; + getPropertiesFromTheme: function (serviceName) { + var properties = []; + App.Tab.find().forEach(function (t) { + if (!t.get('isAdvanced') && t.get('serviceName') === serviceName) { + t.get('sections').forEach(function (s) { + s.get('subSections').forEach(function (ss) { + properties = properties.concat(ss.get('configProperties')); + }); + }); + } + }, this); + return properties.mapProperty('id'); }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/2d485431/ambari-web/app/views/common/controls_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/controls_view.js b/ambari-web/app/views/common/controls_view.js index 2c9078b..95d097f 100644 --- a/ambari-web/app/views/common/controls_view.js +++ b/ambari-web/app/views/common/controls_view.js @@ -291,6 +291,81 @@ App.ServiceConfigTextAreaContent = Ember.TextArea.extend(App.ServiceConfigPopove classNames: ['span10'] }); + + +/** + * Special config type for Capacity Scheduler + */ +App.CapacitySceduler = Ember.TextArea.extend(App.ServiceConfigPopoverSupport, App.ServiceConfigCalculateId, App.SupportsDependentConfigs, { + + configs: function() { + return this.get('controller.stepConfigs').findProperty('serviceName', 'YARN').get('configs'); + }.property('controller.stepConfigs'), + + valueBinding: 'serviceConfig.value', + excludedConfigs: function() { + return App.config.getPropertiesFromTheme('YARN'); + }.property(), + rows: 16, + classNames: ['directories'], + classNameBindings: ['widthClass'], + widthClass: 'span9', + + connectedConfigs: function() { + return this.get('categoryConfigsAll').filter(function(config) { + return !this.get('excludedConfigs').contains(App.config.configId(config.get('name'), config.get('filename'))) + && (config.get('name') !== this.get('serviceConfig.name')) + && (config.get('filename') === 'capacity-scheduler.xml'); + }, this); + }.property('categoryConfigsAll.length'), + + valueObserver: function () { + var self = this, names = []; + delay(function () { + self.get('serviceConfig.value').split('\n').forEach(function (_property) { + if (_property) { + _property = _property.split('='); + var name = _property[0]; + var value = (_property[1]) ? _property[1] : ""; + + names.push(name); + + var cfg = self.get('connectedConfigs').findProperty('name', name); + if (cfg) { + /** update configs **/ + if (cfg.get('value') !== value) { + cfg.set('value', value); + self.sendRequestRorDependentConfigs(cfg); + } + } else { + /** add configs **/ + var newCfg = App.config.createDefaultConfig(name, 'YARN', 'capacity-scheduler', true, { + 'value': value + }); + self.get('configs').pushObject(App.ServiceConfigProperty.create(newCfg)); + } + } + }); + + /** remove configs **/ + self.get('connectedConfigs').filter(function(c) { + return !names.contains(c.get('name')); + }).forEach(function(c) { + self.get('configs').removeObject(c); + }); + + }, 500); + }.observes('serviceConfig.value'), + + /** + * + */ + isFinalObserver: function () { + this.get('connectedConfigs').setEach('isFinal', this.get('serviceConfig.isFinal')); + }.observes('serviceConfig.isFinal') +}); + + /** * Textarea control with bigger height * @type {*} http://git-wip-us.apache.org/repos/asf/ambari/blob/2d485431/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 79f0202..95b2bbe 100644 --- a/ambari-web/test/controllers/wizard/step7_test.js +++ b/ambari-web/test/controllers/wizard/step7_test.js @@ -1400,7 +1400,6 @@ describe('App.InstallerStep7Controller', function () { }) }); sinon.stub(App.config, 'mergePreDefinedWithStack', Em.K); - sinon.stub(App.config, 'fileConfigsIntoTextarea', Em.K); sinon.stub(installerStep7Controller, 'clearStep', Em.K); sinon.stub(installerStep7Controller, 'getConfigTags', Em.K); sinon.stub(installerStep7Controller, 'setInstalledServiceConfigs', Em.K); @@ -1414,7 +1413,6 @@ describe('App.InstallerStep7Controller', function () { }); afterEach(function () { App.config.mergePreDefinedWithStack.restore(); - App.config.fileConfigsIntoTextarea.restore(); installerStep7Controller.clearStep.restore(); installerStep7Controller.getConfigTags.restore(); installerStep7Controller.setInstalledServiceConfigs.restore(); @@ -1451,9 +1449,6 @@ describe('App.InstallerStep7Controller', function () { installerStep7Controller.reopen({ allSelectedServiceNames: [] }); - sinon.stub(App.config, 'fileConfigsIntoTextarea', function(configs) { - return configs; - }); sinon.stub(installerStep7Controller, 'resolveServiceDependencyConfigs', Em.K); sinon.stub(installerStep7Controller, 'loadServerSideConfigsRecommendations', function() { return $.Deferred().resolve(); @@ -1479,7 +1474,6 @@ describe('App.InstallerStep7Controller', function () { installerStep7Controller.set('content.hosts', Em.A([{hostName: 'h1'}, {hostName: 'h2'}])); }); afterEach(function () { - App.config.fileConfigsIntoTextarea.restore(); installerStep7Controller.resolveServiceDependencyConfigs.restore(); installerStep7Controller.loadServerSideConfigsRecommendations.restore(); installerStep7Controller.checkHostOverrideInstaller.restore(); @@ -1499,37 +1493,6 @@ describe('App.InstallerStep7Controller', function () { expect(installerStep7Controller.activateSpecialConfigs.calledOnce).to.equal(true); expect(installerStep7Controller.selectProperService.calledOnce).to.equal(true); }); - - Em.A([ - { - allSelectedServiceNames: ['YARN'], - fileConfigsIntoTextarea: true, - m: 'should run fileConfigsIntoTextarea and resolveServiceDependencyConfigs', - resolveServiceDependencyConfigs: true - }, - { - allSelectedServiceNames: ['STORM'], - resolveServiceDependencyConfigs: true, - m: 'should run resolveServiceDependencyConfigs' - } - ]).forEach(function(t) { - it(t.m, function () { - installerStep7Controller.reopen({ - allSelectedServiceNames: t.allSelectedServiceNames - }); - installerStep7Controller.applyServicesConfigs({name: 'configs'}, {name: 'storedConfigs'}); - if (t.fileConfigsIntoTextarea) { - 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); - } - }); - }); }); describe('#_updateIsEditableFlagForConfig', function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/2d485431/ambari-web/test/utils/config_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/utils/config_test.js b/ambari-web/test/utils/config_test.js index 1b47011..22ba404 100644 --- a/ambari-web/test/utils/config_test.js +++ b/ambari-web/test/utils/config_test.js @@ -25,155 +25,6 @@ var modelSetup = setups.configs; describe('App.config', function () { - describe('#fileConfigsIntoTextarea', function () { - var filename = 'capacity-scheduler.xml'; - var configs = [ - { - name: 'config1', - value: 'value1', - recommendedValue: 'value1', - filename: 'capacity-scheduler.xml' - }, - { - name: 'config2', - value: 'value2', - recommendedValue: 'value2', - filename: 'capacity-scheduler.xml' - } - ]; - it('two configs into textarea', function () { - var result = App.config.fileConfigsIntoTextarea.call(App.config, configs, filename); - expect(result.length).to.equal(1); - expect(result[0].value).to.equal('config1=value1\nconfig2=value2\n'); - expect(result[0].recommendedValue).to.equal('config1=value1\nconfig2=value2\n'); - }); - it('three config into textarea', function () { - configs.push({ - name: 'config3', - value: 'value3', - recommendedValue: 'value3', - filename: 'capacity-scheduler.xml' - }); - var result = App.config.fileConfigsIntoTextarea.call(App.config, configs, filename); - expect(result.length).to.equal(1); - expect(result[0].value).to.equal('config1=value1\nconfig2=value2\nconfig3=value3\n'); - expect(result[0].recommendedValue).to.equal('config1=value1\nconfig2=value2\nconfig3=value3\n'); - }); - it('one of three configs has different filename', function () { - configs[1].filename = 'another filename'; - var result = App.config.fileConfigsIntoTextarea.call(App.config, configs, filename); - //result contains two configs: one with different filename and one textarea config - expect(result.length).to.equal(2); - expect(result[1].value).to.equal('config1=value1\nconfig3=value3\n'); - expect(result[1].recommendedValue).to.equal('config1=value1\nconfig3=value3\n'); - }); - it('none configs into empty textarea', function () { - filename = 'capacity-scheduler.xml'; - configs.clear(); - var result = App.config.fileConfigsIntoTextarea.call(App.config, configs, filename); - expect(result.length).to.equal(1); - expect(result[0].value).to.equal(''); - expect(Em.isNone(result[0].recommendedValue)).to.be.true; - expect(Em.isNone(result[0].savedValue)).to.be.true; - }); - it("filename has configs that shouldn't be included in textarea", function () { - var configs = [ - { - name: 'config1', - value: 'value1', - recommendedValue: 'value1', - filename: filename - }, - { - name: 'config2', - value: 'value2', - recommendedValue: 'value2', - filename: filename - } - ]; - var cfg = { - name: 'config3', - value: 'value3', - recommendedValue: 'value3', - filename: filename - }; - configs.push(cfg); - var result = App.config.fileConfigsIntoTextarea.call(App.config, configs, filename, [cfg]); - expect(result.length).to.equal(2); - expect(result[1].value).to.equal('config1=value1\nconfig2=value2\n'); - expect(result[1].recommendedValue).to.equal('config1=value1\nconfig2=value2\n'); - expect(configs.findProperty('name', 'config3')).to.eql(cfg); - }); - }); - - describe('#textareaIntoFileConfigs', function () { - var filename = 'capacity-scheduler.xml'; - var testData = [ - { - configs: [Em.Object.create({ - "name": "capacity-scheduler", - "value": "config1=value1", - "filename": "capacity-scheduler.xml", - "isRequiredByAgent": true - })] - }, - { - configs: [Em.Object.create({ - "name": "capacity-scheduler", - "value": "config1=value1\nconfig2=value2\n", - "filename": "capacity-scheduler.xml", - "isRequiredByAgent": false - })] - }, - { - configs: [Em.Object.create({ - "name": "capacity-scheduler", - "value": "config1=value1,value2\n", - "filename": "capacity-scheduler.xml", - "isRequiredByAgent": true - })] - }, - { - configs: [Em.Object.create({ - "name": "capacity-scheduler", - "value": "config1=value1 config2=value2\n", - "filename": "capacity-scheduler.xml", - "isRequiredByAgent": false - })] - } - ]; - - it('config1=value1 to one config', function () { - var result = App.config.textareaIntoFileConfigs.call(App.config, testData[0].configs, filename); - expect(result.length).to.equal(1); - expect(result[0].value).to.equal('value1'); - expect(result[0].name).to.equal('config1'); - expect(result[0].isRequiredByAgent).to.be.true; - }); - it('config1=value1\\nconfig2=value2\\n to two configs', function () { - var result = App.config.textareaIntoFileConfigs.call(App.config, testData[1].configs, filename); - expect(result.length).to.equal(2); - expect(result[0].value).to.equal('value1'); - expect(result[0].name).to.equal('config1'); - expect(result[1].value).to.equal('value2'); - expect(result[1].name).to.equal('config2'); - expect(result[0].isRequiredByAgent).to.be.false; - expect(result[1].isRequiredByAgent).to.be.false; - }); - it('config1=value1,value2\n to one config', function () { - var result = App.config.textareaIntoFileConfigs.call(App.config, testData[2].configs, filename); - expect(result.length).to.equal(1); - expect(result[0].value).to.equal('value1,value2'); - expect(result[0].name).to.equal('config1'); - expect(result[0].isRequiredByAgent).to.be.true; - }); - it('config1=value1 config2=value2 to two configs', function () { - var result = App.config.textareaIntoFileConfigs.call(App.config, testData[3].configs, filename); - expect(result.length).to.equal(1); - expect(result[0].isRequiredByAgent).to.be.false; - }); - }); - describe('#trimProperty',function() { var testMessage = 'displayType `{0}`, value `{1}`{3} should return `{2}`'; var tests = [