AMBARI-8919 Fix Hive MetaStore UI to make sure we show list of hive servers on the UI. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bf9a825f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bf9a825f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bf9a825f Branch: refs/heads/trunk Commit: bf9a825fe1f5e8a505024fc99faafeaa780bf287 Parents: 3ae9a5c Author: aBabiichuk <[email protected]> Authored: Thu Dec 25 17:21:42 2014 +0200 Committer: aBabiichuk <[email protected]> Committed: Thu Dec 25 17:21:42 2014 +0200 ---------------------------------------------------------------------- .../controllers/main/service/info/configs.js | 25 ++++---- .../app/controllers/wizard/step7_controller.js | 2 +- .../app/controllers/wizard/step8_controller.js | 24 ++------ ambari-web/app/data/BIGTOP/site_properties.js | 7 +-- ambari-web/app/data/HDP2/site_properties.js | 9 ++- ambari-web/app/data/PHD/site_properties.js | 7 +-- ambari-web/app/models/service_config.js | 2 +- ambari-web/app/utils/config.js | 17 ++++++ ambari-web/app/views/wizard/controls_view.js | 2 +- .../main/service/info/config_test.js | 5 +- .../test/controllers/wizard/step7_test.js | 64 ++++++++++++++++++++ .../test/controllers/wizard/step8_test.js | 46 ++++++++++++++ ambari-web/test/models/service_config_test.js | 24 +++++++- ambari-web/test/utils/config_test.js | 29 +++++++++ .../test/views/wizard/controls_view_test.js | 51 ++++++++++++++++ 15 files changed, 262 insertions(+), 52 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/bf9a825f/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 2ba65a8..dcbce69 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/ambari-web/app/controllers/main/service/info/configs.js @@ -1595,7 +1595,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM if (hiveDb.value === 'New MySQL Database' || hiveDb.value === 'New PostgreSQL Database') { var ambariHost = configs.findProperty('name', 'hive_ambari_host'); if (ambariHost) { - ambariHost.name = 'hive_hostname'; + dbHostPropertyName = 'hive_ambari_host'; } configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_host')); configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_database')); @@ -1612,7 +1612,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM if (existingMySqlHost) { dbHostPropertyName = 'hive_existing_mysql_host'; } - configs = configs.without(configs.findProperty('name', 'hive_ambari_host')); configs = configs.without(configs.findProperty('name', 'hive_ambari_database')); configs = configs.without(configs.findProperty('name', 'hive_existing_oracle_host')); configs = configs.without(configs.findProperty('name', 'hive_existing_oracle_database')); @@ -1627,7 +1626,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM if (existingPostgreSqlHost) { dbHostPropertyName = 'hive_existing_postgresql_host'; } - configs = configs.without(configs.findProperty('name', 'hive_ambari_host')); configs = configs.without(configs.findProperty('name', 'hive_ambari_database')); configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_host')); configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_database')); @@ -1642,7 +1640,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM if (existingOracleHost) { dbHostPropertyName = 'hive_existing_oracle_host'; } - configs = configs.without(configs.findProperty('name', 'hive_ambari_host')); configs = configs.without(configs.findProperty('name', 'hive_ambari_database')); configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_host')); configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_database')); @@ -1657,7 +1654,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM if (existingMSSQLServerHost) { dbHostPropertyName = 'hive_existing_mssql_server_host'; } - configs = configs.without(configs.findProperty('name', 'hive_ambari_host')); configs = configs.without(configs.findProperty('name', 'hive_ambari_database')); configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_host')); configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_database')); @@ -1672,7 +1668,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM if (existingMSSQL2ServerHost) { dbHostPropertyName = 'hive_existing_mssql_server_2_host'; } - configs = configs.without(configs.findProperty('name', 'hive_ambari_host')); configs = configs.without(configs.findProperty('name', 'hive_ambari_database')); configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_host')); configs = configs.without(configs.findProperty('name', 'hive_existing_mysql_database')); @@ -1851,7 +1846,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM var configs = configMapping.filterProperty('foreignKey', null); this.addDynamicProperties(configs); configs.forEach(function (_config) { - var valueWithOverrides = this.getGlobConfigValueWithOverrides(_config.templateName, _config.value); + var valueWithOverrides = this.getGlobConfigValueWithOverrides(_config.templateName, _config.value, _config.name); if (valueWithOverrides !== null) { uiConfig.pushObject({ "id": "site property", @@ -1872,9 +1867,9 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM if (!templetonHiveProperty && this.get('content.serviceName') === 'HIVE') { configs.pushObject({ "name": "templeton.hive.properties", - "templateName": ["hivemetastore_host"], + "templateName": ["hive.metastore.uris"], "foreignKey": null, - "value": "hive.metastore.local=false,hive.metastore.uris=thrift://<templateName[0]>:9083,hive.metastore.sasl.enabled=yes,hive.metastore.execute.setugi=true,hive.metastore.warehouse.dir=/apps/hive/warehouse", + "value": "hive.metastore.local=false,hive.metastore.uris=<templateName[0]>,hive.metastore.sasl.enabled=yes,hive.metastore.execute.setugi=true,hive.metastore.warehouse.dir=/apps/hive/warehouse", "filename": "webhcat-site.xml" }); } @@ -1884,6 +1879,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM * return config value * @param templateName * @param expression + * @param name * @return {Object} * example: <code>{ * value: '...', @@ -1893,7 +1889,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM * } * }</code> */ - getGlobConfigValueWithOverrides: function (templateName, expression) { + getGlobConfigValueWithOverrides: function (templateName, expression, name) { var express = expression.match(/<(.*?)>/g); var value = expression; var overrideHostToValue = {}; @@ -1907,11 +1903,11 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM for (var ov in globOverride) { globOverride[ov].forEach(function (host) { var replacedVal = (host in overrideHostToValue) ? overrideHostToValue[host] : expression; - overrideHostToValue[host] = replacedVal.replace(_express, ov); + overrideHostToValue[host] = App.config.replaceConfigValues(name, _express, replacedVal, ov); }, this); } } - value = expression.replace(_express, globalObj.value); + value = App.config.replaceConfigValues(name, _express, expression, globalObj.value); } else { value = null; } @@ -2303,9 +2299,10 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM }, { hostProperty: 'hivemetastore_host', - componentName: 'HIVE_SERVER', + componentName: 'HIVE_METASTORE', serviceName: 'HIVE', - serviceUseThis: ['HIVE'] + serviceUseThis: ['HIVE'], + m: true }, { hostProperty: 'oozieserver_host', http://git-wip-us.apache.org/repos/asf/ambari/blob/bf9a825f/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 4859c88..f497642 100644 --- a/ambari-web/app/controllers/wizard/step7_controller.js +++ b/ambari-web/app/controllers/wizard/step7_controller.js @@ -1173,7 +1173,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, { * @method getAmbariDatabaseSuccess */ getAmbariDatabaseSuccess: function (data) { - var hiveDBHostname = this.get('stepConfigs').findProperty('serviceName', 'HIVE').configs.findProperty('name', 'hivemetastore_host').value; + var hiveDBHostname = this.get('stepConfigs').findProperty('serviceName', 'HIVE').configs.findProperty('name', 'hive_ambari_host').value; var ambariServiceHostComponents = data.hostComponents; if (!!ambariServiceHostComponents.length) { var ambariDBInfo = JSON.stringify(ambariServiceHostComponents[0].RootServiceHostComponents.properties); http://git-wip-us.apache.org/repos/asf/ambari/blob/bf9a825f/ambari-web/app/controllers/wizard/step8_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js index 35fae1d..61d3014 100644 --- a/ambari-web/app/controllers/wizard/step8_controller.js +++ b/ambari-web/app/controllers/wizard/step8_controller.js @@ -440,9 +440,9 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz if (!templetonHiveProperty) { configs.pushObject({ "name": "templeton.hive.properties", - "templateName": ["hivemetastore_host"], + "templateName": ["hive.metastore.uris"], "foreignKey": null, - "value": "hive.metastore.local=false,hive.metastore.uris=thrift://<templateName[0]>:9083,hive.metastore.sasl.enabled=yes,hive.metastore.execute.setugi=true,hive.metastore.warehouse.dir=/apps/hive/warehouse", + "value": "hive.metastore.local=false,hive.metastore.uris=<templateName[0]>,hive.metastore.sasl.enabled=yes,hive.metastore.execute.setugi=true,hive.metastore.warehouse.dir=/apps/hive/warehouse", "filename": "webhcat-site.xml" }); } @@ -507,7 +507,7 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz var preReplaceValue = null; if (value !== null) { // if the property depends on more than one template name like <templateName[0]>/<templateName[1]> then don't proceed to the next if the prior is null or not found in the global configs preReplaceValue = value; - value = this._replaceConfigValues(name, _express, value, globValue); + value = App.config.replaceConfigValues(name, _express, value, globValue); } if (globalObj.overrides != null) { globalObj.overrides.forEach(function (override) { @@ -515,9 +515,9 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz var hostsArray = override.hosts; hostsArray.forEach(function (host) { if (!(host in overrideHostToValue)) { - overrideHostToValue[host] = this._replaceConfigValues(name, _express, preReplaceValue, ov); + overrideHostToValue[host] = App.config.replaceConfigValues(name, _express, preReplaceValue, ov); } else { - overrideHostToValue[host] = this._replaceConfigValues(name, _express, overrideHostToValue[host], ov); + overrideHostToValue[host] = App.config.replaceConfigValues(name, _express, overrideHostToValue[host], ov); } }, this); }, this); @@ -557,20 +557,6 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz }, /** - * replace some values in config property - * @param {string} name - * @param {string} express - * @param {string} value - * @param {string} globValue - * @return {string} - * @private - * @method _replaceConfigValues - */ - _replaceConfigValues: function (name, express, value, globValue) { - return value.replace(express, globValue); - }, - - /** * Load all info about cluster to <code>clusterInfo</code> variable * @method loadClusterInfo */ http://git-wip-us.apache.org/repos/asf/ambari/blob/bf9a825f/ambari-web/app/data/BIGTOP/site_properties.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/data/BIGTOP/site_properties.js b/ambari-web/app/data/BIGTOP/site_properties.js index 79f920a..4bbea1f 100644 --- a/ambari-web/app/data/BIGTOP/site_properties.js +++ b/ambari-web/app/data/BIGTOP/site_properties.js @@ -2495,11 +2495,11 @@ module.exports = { "id": "puppet var", "name": "hivemetastore_host", - "displayName": "Hive Metastore host", + "displayName": "Hive Metastore hosts", "value": "", "defaultValue": "", - "description": "The host that has been assigned to run Hive Metastore", - "displayType": "masterHost", + "description": "The hosts that have been assigned to run Hive Metastore", + "displayType": "masterHosts", "isOverridable": false, "isRequiredByAgent": false, "isVisible": true, @@ -2680,7 +2680,6 @@ module.exports = "description": "Host on which the database will be created by Ambari", "isReconfigurable": false, "displayType": "masterHost", - "isRequiredByAgent": false, "isOverridable": false, "isVisible": false, "serviceName": "HIVE", http://git-wip-us.apache.org/repos/asf/ambari/blob/bf9a825f/ambari-web/app/data/HDP2/site_properties.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/data/HDP2/site_properties.js b/ambari-web/app/data/HDP2/site_properties.js index eb0600a..d904683 100644 --- a/ambari-web/app/data/HDP2/site_properties.js +++ b/ambari-web/app/data/HDP2/site_properties.js @@ -3219,12 +3219,12 @@ module.exports = { "id": "puppet var", "name": "hivemetastore_host", - "displayName": "Hive Metastore host", + "displayName": "Hive Metastore hosts", "value": "", "defaultValue": "", - "description": "The host that has been assigned to run Hive Metastore", - "displayType": "masterHost", - "isOverridable": true, + "description": "The hosts that have been assigned to run Hive Metastore", + "displayType": "masterHosts", + "isOverridable": false, "isRequiredByAgent": false, "isVisible": true, "serviceName": "HIVE", @@ -3451,7 +3451,6 @@ module.exports = "description": "Host on which the database will be created by Ambari", "isReconfigurable": false, "displayType": "masterHost", - "isRequiredByAgent": false, "isOverridable": false, "isVisible": false, "serviceName": "HIVE", http://git-wip-us.apache.org/repos/asf/ambari/blob/bf9a825f/ambari-web/app/data/PHD/site_properties.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/data/PHD/site_properties.js b/ambari-web/app/data/PHD/site_properties.js index 44c6628..3d66e7d 100644 --- a/ambari-web/app/data/PHD/site_properties.js +++ b/ambari-web/app/data/PHD/site_properties.js @@ -2343,11 +2343,11 @@ module.exports = { "id": "puppet var", "name": "hivemetastore_host", - "displayName": "Hive Metastore host", + "displayName": "Hive Metastore hosts", "value": "", "defaultValue": "", - "description": "The host that has been assigned to run Hive Metastore", - "displayType": "masterHost", + "description": "The hosts that have been assigned to run Hive Metastore", + "displayType": "masterHosts", "isOverridable": false, "isRequiredByAgent": false, "isVisible": true, @@ -2529,7 +2529,6 @@ module.exports = "description": "Host on which the database will be created by Ambari", "isReconfigurable": false, "displayType": "masterHost", - "isRequiredByAgent": false, "isOverridable": false, "isVisible": false, "serviceName": "HIVE", http://git-wip-us.apache.org/repos/asf/ambari/blob/bf9a825f/ambari-web/app/models/service_config.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/service_config.js b/ambari-web/app/models/service_config.js index f2902c3..47108e4 100644 --- a/ambari-web/app/models/service_config.js +++ b/ambari-web/app/models/service_config.js @@ -434,7 +434,7 @@ App.ServiceConfigProperty = Em.Object.extend({ this.set('value', slaveComponentHostsInDB.findProperty('componentName', 'HBASE_REGIONSERVER').hosts.mapProperty('hostName')); break; case 'hivemetastore_host': - this.set('value', masterComponentHostsInDB.findProperty('component', 'HIVE_SERVER').hostName); + this.set('value', masterComponentHostsInDB.filterProperty('component', 'HIVE_METASTORE').mapProperty('hostName')); break; case 'hive_ambari_host': this.set('value', masterComponentHostsInDB.findProperty('component', 'HIVE_SERVER').hostName); http://git-wip-us.apache.org/repos/asf/ambari/blob/bf9a825f/ambari-web/app/utils/config.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js index a6bac39..4d6fe89 100644 --- a/ambari-web/app/utils/config.js +++ b/ambari-web/app/utils/config.js @@ -1777,5 +1777,22 @@ App.config = Em.Object.create({ if (properties) return $.extend(baseObj, properties); else return baseObj; }); + }, + + /** + * replace some values in config property + * @param {string} name + * @param {string} express + * @param {string} value + * @param {string} globValue + * @return {string} + * @private + * @method replaceConfigValues + */ + replaceConfigValues: function (name, express, value, globValue) { + if (name == 'templeton.hive.properties') { + globValue = globValue.replace(/,/g, '\\,'); + } + return value.replace(express, globValue); } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/bf9a825f/ambari-web/app/views/wizard/controls_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/wizard/controls_view.js b/ambari-web/app/views/wizard/controls_view.js index 1c41ab6..9c29ac8 100644 --- a/ambari-web/app/views/wizard/controls_view.js +++ b/ambari-web/app/views/wizard/controls_view.js @@ -886,7 +886,7 @@ App.CheckDBConnectionView = Ember.View.extend({ var serviceMasterMap = { 'OOZIE': 'oozieserver_host', 'HDFS': 'hadoop_host', - 'HIVE': 'hivemetastore_host' + 'HIVE': 'hive_ambari_host' }; return this.get('parentView.categoryConfigsAll').findProperty('name', serviceMasterMap[this.get('parentView.service.serviceName')]).get('value'); }.property(), http://git-wip-us.apache.org/repos/asf/ambari/blob/bf9a825f/ambari-web/test/controllers/main/service/info/config_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/service/info/config_test.js b/ambari-web/test/controllers/main/service/info/config_test.js index 541f4af..f160f71 100644 --- a/ambari-web/test/controllers/main/service/info/config_test.js +++ b/ambari-web/test/controllers/main/service/info/config_test.js @@ -828,9 +828,9 @@ describe("App.MainServiceInfoConfigsController", function () { ]; var dynamicProperty = { "name": "templeton.hive.properties", - "templateName": ["hivemetastore_host"], + "templateName": ["hive.metastore.uris"], "foreignKey": null, - "value": "hive.metastore.local=false,hive.metastore.uris=thrift://<templateName[0]>:9083,hive.metastore.sasl.enabled=yes,hive.metastore.execute.setugi=true,hive.metastore.warehouse.dir=/apps/hive/warehouse", + "value": "hive.metastore.local=false,hive.metastore.uris=<templateName[0]>,hive.metastore.sasl.enabled=yes,hive.metastore.execute.setugi=true,hive.metastore.warehouse.dir=/apps/hive/warehouse", "filename": "webhcat-site.xml" }; @@ -913,6 +913,7 @@ describe("App.MainServiceInfoConfigsController", function () { it("load ui config", function() { expect(mainServiceInfoConfigsController.loadUiSideConfigs(t.configMapping)[0]).to.deep.equal(t.uiConfigs[0]); expect(mainServiceInfoConfigsController.addDynamicProperties.calledWith(t.configMappingf)).to.equal(true); + expect(mainServiceInfoConfigsController.getGlobConfigValueWithOverrides.calledWith(t.configMapping[0].templateName, t.configMapping[0].value, t.configMapping[0].name)).to.equal(true); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/bf9a825f/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 77668d5..7cbb35e 100644 --- a/ambari-web/test/controllers/wizard/step7_test.js +++ b/ambari-web/test/controllers/wizard/step7_test.js @@ -1334,4 +1334,68 @@ describe('App.InstallerStep7Controller', function () { }); + describe('#getAmbariDatabaseSuccess', function () { + + var controller = App.WizardStep7Controller.create({ + stepConfigs: [ + { + serviceName: 'HIVE', + configs: [ + { + name: 'hive_ambari_host', + value: 'h0' + } + ] + } + ] + }), + cases = [ + { + data: { + hostComponents: [] + }, + mySQLServerConflict: false, + title: 'no Ambari Server host components' + }, + { + data: { + hostComponents: [ + { + RootServiceHostComponents: { + properties: { + 'server.jdbc.url': 'jdbc:mysql://h0/db0?createDatabaseIfNotExist=true' + } + } + } + ] + }, + mySQLServerConflict: true, + title: 'Ambari MySQL Server and Hive Server are on the same host' + }, + { + data: { + hostComponents: [ + { + RootServiceHostComponents: { + properties: { + 'server.jdbc.url': 'jdbc:mysql://h1/db1?createDatabaseIfNotExist=true' + } + } + } + ] + }, + mySQLServerConflict: false, + title: 'Ambari MySQL Server and Hive Server are on different hosts' + } + ]; + + cases.forEach(function (item) { + it(item.title, function () { + controller.getAmbariDatabaseSuccess(item.data); + expect(controller.get('mySQLServerConflict')).to.equal(item.mySQLServerConflict); + }); + }); + + }); + }); http://git-wip-us.apache.org/repos/asf/ambari/blob/bf9a825f/ambari-web/test/controllers/wizard/step8_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/wizard/step8_test.js b/ambari-web/test/controllers/wizard/step8_test.js index 912a3f4..26a1b0d 100644 --- a/ambari-web/test/controllers/wizard/step8_test.js +++ b/ambari-web/test/controllers/wizard/step8_test.js @@ -1505,4 +1505,50 @@ describe('App.WizardStep8Controller', function () { }); }); + describe("#addDynamicProperties", function() { + + var tests = [ + { + content: Em.Object.create({ + serviceConfigProperties: [ + Em.Object.create({ + configs: [] + }) + ] + }), + m: 'add dynamic property', + addDynamic: true + }, + { + content: Em.Object.create({ + serviceConfigProperties: [ + Em.Object.create({ + name: 'templeton.hive.properties' + }) + ] + }), + m: 'don\'t add dynamic property (already included)', + addDynamic: false + } + ], + dynamicProperty = { + name: 'templeton.hive.properties', + templateName: ['hive.metastore.uris'], + foreignKey: null, + value: 'hive.metastore.local=false,hive.metastore.uris=<templateName[0]>,hive.metastore.sasl.enabled=yes,hive.metastore.execute.setugi=true,hive.metastore.warehouse.dir=/apps/hive/warehouse', + filename: 'webhcat-site.xml' + }; + + tests.forEach(function(t) { + it(t.m, function() { + installerStep8Controller.set('content', t.content); + var configs = []; + installerStep8Controller.addDynamicProperties(configs); + if (t.addDynamic){ + expect(configs.findProperty('name', 'templeton.hive.properties')).to.deep.eql(dynamicProperty); + } + }); + }); + }); + }); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/bf9a825f/ambari-web/test/models/service_config_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/models/service_config_test.js b/ambari-web/test/models/service_config_test.js index c49a99b..23ea087 100644 --- a/ambari-web/test/models/service_config_test.js +++ b/ambari-web/test/models/service_config_test.js @@ -736,7 +736,23 @@ describe('App.ServiceConfigProperty', function () { isUnionAllMountPointsCalled: false, title: 'unionAllMountPoints shouldn\'t be called' } - ] + ], + 'hivemetastore_host': { + localDB: { + masterComponentHosts: [ + { + component: 'HIVE_METASTORE', + hostName: 'h0' + }, + { + component: 'HIVE_METASTORE', + hostName: 'h1' + } + ] + }, + value: ['h0', 'h1'], + title: 'array that contains names of hosts with Hive Metastore' + } }; cases['kafka.ganglia.metrics.host'].forEach(function(item){ @@ -809,5 +825,11 @@ describe('App.ServiceConfigProperty', function () { }); }); + it(cases['hivemetastore_host'].title, function () { + serviceConfigProperty.set('name', 'hivemetastore_host'); + serviceConfigProperty.initialValue(cases['hivemetastore_host'].localDB); + expect(serviceConfigProperty.get('value')).to.eql(cases['hivemetastore_host'].value); + }); + }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/bf9a825f/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 0286884..530f18d 100644 --- a/ambari-web/test/utils/config_test.js +++ b/ambari-web/test/utils/config_test.js @@ -725,4 +725,33 @@ describe('App.config', function () { }); }); + describe('#replaceConfigValues', function () { + + var cases = [ + { + name: 'name', + express: '<templateName[0]>', + value: '<templateName[0]>', + globValue: 'v', + expected: 'v', + title: 'default case' + }, + { + name: 'templeton.hive.properties', + express: '<templateName[0]>', + value: 'hive.matestore.uris=<templateName[0]>', + globValue: 'thrift://h0:9933,thrift://h1:9933,thrift://h2:9933', + expected: 'hive.matestore.uris=thrift://h0:9933\\,thrift://h1:9933\\,thrift://h2:9933', + title: 'should escape commas for templeton.hive.properties' + } + ]; + + cases.forEach(function (item) { + it(item.title, function () { + expect(App.config.replaceConfigValues(item.name, item.express, item.value, item.globValue)).to.equal(item.expected); + }); + }); + + }); + }); http://git-wip-us.apache.org/repos/asf/ambari/blob/bf9a825f/ambari-web/test/views/wizard/controls_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/wizard/controls_view_test.js b/ambari-web/test/views/wizard/controls_view_test.js index a28f493..5cc7449 100644 --- a/ambari-web/test/views/wizard/controls_view_test.js +++ b/ambari-web/test/views/wizard/controls_view_test.js @@ -613,3 +613,54 @@ describe('App.ServiceConfigRadioButton', function () { }); }); + +describe('App.CheckDBConnectionView', function () { + + describe('#masterHostName', function () { + + var cases = [ + { + serviceName: 'OOZIE', + value: 'h0' + }, + { + serviceName: 'HDFS', + value: 'h1' + }, + { + serviceName: 'HIVE', + value: 'h2' + } + ], + categoryConfigsAll = [ + Em.Object.create({ + name: 'oozieserver_host', + value: 'h0' + }), + Em.Object.create({ + name: 'hadoop_host', + value: 'h1' + }), + Em.Object.create({ + name: 'hive_ambari_host', + value: 'h2' + }) + ]; + + cases.forEach(function (item) { + it(item.serviceName, function () { + var view = App.CheckDBConnectionView.create({ + parentView: { + service: { + serviceName: item.serviceName + }, + categoryConfigsAll: categoryConfigsAll + } + }); + expect(view.get('masterHostName')).to.equal(item.value); + }); + }); + + }); + +}); \ No newline at end of file
