You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2016/03/30 13:55:30 UTC
ambari git commit: AMBARI-15618 Remove "isHadoop22Stack" and
"isHadoop20Stack" flags. (ababiichuk)
Repository: ambari
Updated Branches:
refs/heads/trunk 7bc68e162 -> dd0086cb9
AMBARI-15618 Remove "isHadoop22Stack" and "isHadoop20Stack" flags. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/dd0086cb
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/dd0086cb
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/dd0086cb
Branch: refs/heads/trunk
Commit: dd0086cb9f77fcfc656a578fb54b5029ea0cfd1a
Parents: 7bc68e1
Author: ababiichuk <ab...@hortonworks.com>
Authored: Tue Mar 29 19:21:22 2016 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Wed Mar 30 14:54:49 2016 +0300
----------------------------------------------------------------------
ambari-web/app/app.js | 19 --
ambari-web/app/controllers/main/host/details.js | 4 +-
.../controllers/main/service/info/configs.js | 16 +-
ambari-web/app/controllers/wizard.js | 11 +-
ambari-web/app/data/HDP2/secure_mapping.js | 6 +-
ambari-web/app/data/HDP2/site_properties.js | 4 +-
.../mixins/common/configs/enhanced_configs.js | 2 +-
.../app/mixins/wizard/addSecurityConfigs.js | 39 ++-
.../configs/objects/service_config_property.js | 8 +-
ambari-web/app/utils/config.js | 6 +-
.../configs/add_component_config_initializer.js | 26 +-
.../views/common/configs/service_config_view.js | 8 +-
ambari-web/app/views/main/service/item.js | 6 +-
ambari-web/test/app_test.js | 52 ----
.../main/host/configs_service_test.js | 6 +
.../test/controllers/main/host/details_test.js | 281 +++++--------------
16 files changed, 122 insertions(+), 372 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0086cb/ambari-web/app/app.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/app.js b/ambari-web/app/app.js
index 44a5823..5fa4448 100644
--- a/ambari-web/app/app.js
+++ b/ambari-web/app/app.js
@@ -198,28 +198,9 @@ module.exports = Em.Application.create({
return (stringUtils.compareVersions(this.get('currentStackVersionNumber'), "2.3") > -1);
}.property('currentStackVersionNumber'),
- isHadoop22Stack: function () {
- return (stringUtils.compareVersions(this.get('currentStackVersionNumber'), "2.2") > -1);
- }.property('currentStackVersionNumber'),
-
- /**
- * Determines if current stack is 2.0.*
- * @type {boolean}
- */
- isHadoop20Stack: function () {
- return (stringUtils.compareVersions(this.get('currentStackVersionNumber'), "2.1") == -1 && stringUtils.compareVersions(this.get('currentStackVersionNumber'), "2.0") > -1);
- }.property('currentStackVersionNumber'),
-
isHadoopWindowsStack: Em.computed.equal('currentStackName', 'HDPWIN'),
/**
- * when working with enhanced configs we should rely on stack version
- * as version that is below 2.2 doesn't supports it
- * @type {boolean}
- */
- isClusterSupportsEnhancedConfigs: Em.computed.alias('isHadoop22Stack'),
-
- /**
* If NameNode High Availability is enabled
* Based on <code>clusterStatus.isInstalled</code>, stack version, <code>SNameNode</code> availability
*
http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0086cb/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 07540b8..fd73510 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -1317,7 +1317,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
if (services.someProperty('serviceName', 'STORM')) {
urlParams.push('(type=storm-site&tag=' + data.Clusters.desired_configs['storm-site'].tag + ')');
}
- if ((services.someProperty('serviceName', 'YARN') && App.get('isHadoop22Stack')) || App.get('isRMHaEnabled')) {
+ if (services.someProperty('serviceName', 'YARN')) {
urlParams.push('(type=yarn-site&tag=' + data.Clusters.desired_configs['yarn-site'].tag + ')');
urlParams.push('(type=zoo.cfg&tag=' + data.Clusters.desired_configs['zoo.cfg'].tag + ')');
}
@@ -1357,7 +1357,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
}
];
var installedServiceNames = App.Service.find().mapProperty('serviceName');
- if (installedServiceNames.contains('YARN') && App.get('isHadoop22Stack') || App.get('isRMHaEnabled')) {
+ if (installedServiceNames.contains('YARN')) {
groups.push(
{
properties: {
http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0086cb/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 b8a716c..5208694 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -294,16 +294,12 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
var serviceName = this.get('content.serviceName');
this.clearStep();
this.set('dependentServiceNames', App.StackService.find(serviceName).get('dependentServiceNames'));
- if (App.get('isClusterSupportsEnhancedConfigs')) {
- this.loadConfigTheme(serviceName).always(function() {
- App.themesMapper.generateAdvancedTabs([serviceName]);
- // Theme mapper has UI only configs that needs to be merged with current service version configs
- // This requires calling `loadCurrentVersions` after theme has loaded
- self.loadCurrentVersions();
- });
- } else {
- this.loadCurrentVersions();
- }
+ this.loadConfigTheme(serviceName).always(function() {
+ if (!$.mocho) { App.themesMapper.generateAdvancedTabs([serviceName]); }
+ // Theme mapper has UI only configs that needs to be merged with current service version configs
+ // This requires calling `loadCurrentVersions` after theme has loaded
+ self.loadCurrentVersions();
+ });
this.loadServiceConfigVersions();
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0086cb/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index 7a3c4de..26893b5 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -1270,16 +1270,11 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
// Load stack configs before loading themes
App.config.loadClusterConfigsFromStack().always(function() {
App.config.loadConfigsFromStack(serviceNames).done(function () {
- if (App.get('isClusterSupportsEnhancedConfigs')) {
- self.loadConfigThemeForServices(serviceNames).always(function () {
- self.set('stackConfigsLoaded', true);
- App.themesMapper.generateAdvancedTabs(serviceNames);
- dfd.resolve();
- });
- } else {
+ self.loadConfigThemeForServices(serviceNames).always(function () {
self.set('stackConfigsLoaded', true);
+ App.themesMapper.generateAdvancedTabs(serviceNames);
dfd.resolve();
- }
+ });
});
});
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0086cb/ambari-web/app/data/HDP2/secure_mapping.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2/secure_mapping.js b/ambari-web/app/data/HDP2/secure_mapping.js
index 55b65ca..8d952e8 100644
--- a/ambari-web/app/data/HDP2/secure_mapping.js
+++ b/ambari-web/app/data/HDP2/secure_mapping.js
@@ -205,7 +205,7 @@ var props = [
"name": "yarn.timeline-service.enabled",
"templateName": [],
"foreignKey": null,
- "value": App.get('isHadoop22Stack') ? "true" : "false",
+ "value": "true",
"nonSecureValue": "false",
"filename": "yarn-site.xml",
"serviceName": "YARN"
@@ -999,8 +999,6 @@ var yarn22Mapping = [
}
];
-if (App.get('isHadoop22Stack')) {
- props.pushObjects(yarn22Mapping);
-}
+props.pushObjects(yarn22Mapping);
module.exports = props;
http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0086cb/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 4b2dfb7..40676df 100644
--- a/ambari-web/app/data/HDP2/site_properties.js
+++ b/ambari-web/app/data/HDP2/site_properties.js
@@ -2010,9 +2010,7 @@ var atsProperties = [
}
];
-if (!App.get('isHadoop20Stack')) {
- hdp2properties.pushObjects(atsProperties);
-}
+hdp2properties.pushObjects(atsProperties);
module.exports =
{
http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0086cb/ambari-web/app/mixins/common/configs/enhanced_configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/enhanced_configs.js b/ambari-web/app/mixins/common/configs/enhanced_configs.js
index 303b0c7..4ae9ca5 100644
--- a/ambari-web/app/mixins/common/configs/enhanced_configs.js
+++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js
@@ -46,7 +46,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create(App.ConfigWithOverrideRecommendationP
* flag is true when Ambari changes some of the dependent properties
* @type {boolean}
*/
- hasChangedDependencies: Em.computed.and('App.isClusterSupportsEnhancedConfigs', 'isControllerSupportsEnhancedConfigs', 'changedProperties.length'),
+ hasChangedDependencies: Em.computed.and('isControllerSupportsEnhancedConfigs', 'changedProperties.length'),
/**
* defines is block with changed dependent configs should be shown
http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0086cb/ambari-web/app/mixins/wizard/addSecurityConfigs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/addSecurityConfigs.js b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
index b769c4e..c1c301f 100644
--- a/ambari-web/app/mixins/wizard/addSecurityConfigs.js
+++ b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
@@ -33,29 +33,24 @@ App.AddSecurityConfigs = Em.Mixin.create({
/**
* security configs, which values should be modified after APPLY CONFIGURATIONS stage
*/
- secureConfigs: function () {
- var configs = [
- {
- name: 'zookeeper_principal_name',
- serviceName: 'ZOOKEEPER'
- },
- {
- name: 'knox_principal_name',
- serviceName: 'KNOX'
- },
- {
- name: 'storm_principal_name',
- serviceName: 'STORM'
- }
- ];
- if (App.get('isHadoop22Stack')) {
- configs.push({
- name: 'nimbus_principal_name',
- serviceName: 'STORM'
- });
+ secureConfigs: [
+ {
+ name: 'zookeeper_principal_name',
+ serviceName: 'ZOOKEEPER'
+ },
+ {
+ name: 'knox_principal_name',
+ serviceName: 'KNOX'
+ },
+ {
+ name: 'storm_principal_name',
+ serviceName: 'STORM'
+ },
+ {
+ name: 'nimbus_principal_name',
+ serviceName: 'STORM'
}
- return configs;
- }.property('App.isHadoop22Stack'),
+ ],
/**
* Store status of kerberos descriptor located in cluster artifacts.
http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0086cb/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 a437c98..290356c 100644
--- a/ambari-web/app/models/configs/objects/service_config_property.js
+++ b/ambari-web/app/models/configs/objects/service_config_property.js
@@ -492,12 +492,8 @@ App.ServiceConfigProperty = Em.Object.extend({
* @returns {*|Boolean|boolean}
*/
configSupportHeterogeneous: function() {
- if (App.get('isHadoop22Stack')) {
- return ['directories', 'directory'].contains(this.get('displayType')) && ['dfs.datanode.data.dir'].contains(this.get('name'));
- } else {
- return false;
- }
- }.property('displayType', 'name', 'App.isHadoop22Stack'),
+ return ['directories', 'directory'].contains(this.get('displayType')) && ['dfs.datanode.data.dir'].contains(this.get('name'));
+ }.property('displayType', 'name'),
/**
* Get override for selected group
http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0086cb/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index db6c27f..467c96f 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -171,12 +171,10 @@ App.config = Em.Object.create({
return sitePropertiesForCurrentStack.configProperties;
} else if (App.get('isHadoop23Stack')) {
return require('data/HDP2.3/site_properties').configProperties;
- } else if (App.get('isHadoop22Stack')) {
- return require('data/HDP2.2/site_properties').configProperties;
} else {
- return require('data/HDP2/site_properties').configProperties;
+ return require('data/HDP2.2/site_properties').configProperties;
}
- }.property('App.isHadoop22Stack', 'App.isHadoop23Stack'),
+ }.property('App.isHadoop23Stack'),
preDefinedSiteProperties: function () {
var serviceNames = App.StackService.find().mapProperty('serviceName').concat('MISC');
http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0086cb/ambari-web/app/utils/configs/add_component_config_initializer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/add_component_config_initializer.js b/ambari-web/app/utils/configs/add_component_config_initializer.js
index 466f7b1..9c27f20 100644
--- a/ambari-web/app/utils/configs/add_component_config_initializer.js
+++ b/ambari-web/app/utils/configs/add_component_config_initializer.js
@@ -210,21 +210,17 @@ App.AddComponentConfigInitializer = App.HaConfigInitializerClass.extend(App.Host
];
},
- _initYarnRMZkAdress: function(configProperty, localDB, dependencies) {
- if (App.get('isRMHaEnabled') || App.get('isHadoop22Stack')) {
- return this._initAsHostsWithPort(configProperty, localDB, dependencies, {
- component: 'ZOOKEEPER_SERVER',
- componentExists: true,
- modifier: {
- prefix: '',
- suffix: '',
- delimiter: ','
- },
- portKey: 'zkClientPort'
- });
- } else {
- return configProperty;
- }
+ _initYarnRMZkAdress: function (configProperty, localDB, dependencies) {
+ return this._initAsHostsWithPort(configProperty, localDB, dependencies, {
+ component: 'ZOOKEEPER_SERVER',
+ componentExists: true,
+ modifier: {
+ prefix: '',
+ suffix: '',
+ delimiter: ','
+ },
+ portKey: 'zkClientPort'
+ });
},
_initTempletonHiveProperties: function(configProperty, localDB, dependecies, initializer) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0086cb/ambari-web/app/views/common/configs/service_config_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_config_view.js b/ambari-web/app/views/common/configs/service_config_view.js
index 65e7d77..b74a429 100644
--- a/ambari-web/app/views/common/configs/service_config_view.js
+++ b/ambari-web/app/views/common/configs/service_config_view.js
@@ -108,9 +108,6 @@ App.ServiceConfigView = Em.View.extend({
*/
supportsConfigLayout: function() {
var supportedControllers = ['wizardStep7Controller', 'mainServiceInfoConfigsController', 'mainHostServiceConfigsController'];
- if (!App.get('isClusterSupportsEnhancedConfigs')) {
- return false;
- }
if (App.Tab.find().someProperty('serviceName', this.get('controller.selectedService.serviceName')) && supportedControllers.contains(this.get('controller.name'))) {
return !Em.isEmpty(App.Tab.find().filterProperty('serviceName', this.get('controller.selectedService.serviceName')).filterProperty('isAdvanced', false));
} else {
@@ -172,9 +169,6 @@ App.ServiceConfigView = Em.View.extend({
* @returns {Ember.A}
*/
tabs: function() {
- if (!App.get('isClusterSupportsEnhancedConfigs')) {
- return Em.A([]);
- }
var tabs = App.Tab.find().filterProperty('serviceName', this.get('controller.selectedService.serviceName'));
var advancedTab = tabs.findProperty('isAdvanced', true);
if (advancedTab) {
@@ -182,7 +176,7 @@ App.ServiceConfigView = Em.View.extend({
}
this.processTabs(tabs);
return tabs;
- }.property('controller.selectedService.serviceName', 'App.isClusterSupportsEnhancedConfigs'),
+ }.property('controller.selectedService.serviceName'),
/**
* Set active tab when view attached and configs are linked to tabs.
http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0086cb/ambari-web/app/views/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/item.js b/ambari-web/app/views/main/service/item.js
index c92160a..558c6aa 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -52,15 +52,13 @@ App.MainServiceItemView = Em.View.extend({
cssClass: 'icon-plus',
'label': '{0} {1}'.format(Em.I18n.t('add'), Em.I18n.t('dashboard.services.hive.metastore')),
service: 'HIVE',
- component: 'HIVE_METASTORE',
- isHidden: !App.get('isHadoop22Stack')
+ component: 'HIVE_METASTORE'
},
{
cssClass: 'icon-plus',
'label': '{0} {1}'.format(Em.I18n.t('add'), Em.I18n.t('dashboard.services.hive.server2')),
service: 'HIVE',
- component: 'HIVE_SERVER',
- isHidden: !App.get('isHadoop22Stack')
+ component: 'HIVE_SERVER'
},
{
cssClass: 'icon-plus',
http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0086cb/ambari-web/test/app_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/app_test.js b/ambari-web/test/app_test.js
index aeeb5a9..445fe94 100644
--- a/ambari-web/test/app_test.js
+++ b/ambari-web/test/app_test.js
@@ -411,58 +411,6 @@ describe('App', function () {
})
});
- describe('#isHadoop20Stack', function () {
-
- Em.A([
- {
- currentStackVersion: 'HDP-2.2',
- e: false
- },
- {
- currentStackVersion: 'HDP-2.1',
- e: false
- },
- {
- currentStackVersion: 'HDP-2.0',
- e: true
- },
- {
- currentStackVersion: 'HDP-2.0.0',
- e: true
- },
- {
- currentStackVersion: 'HDP-2.0.6',
- e: true
- },
- {
- currentStackVersion: 'HDPLocal-2.2',
- e: false
- },
- {
- currentStackVersion: 'HDPLocal-2.1',
- e: false
- },
- {
- currentStackVersion: 'HDPLocal-2.0',
- e: true
- },
- {
- currentStackVersion: 'HDPLocal-2.0.0',
- e: true
- },
- {
- currentStackVersion: 'HDPLocal-2.0.6',
- e: true
- }
- ]).forEach(function (test) {
- it('for ' + test.currentStackVersion + ' isHadoop20Stack = ' + test.e.toString(), function () {
- App.set('currentStackVersion', test.currentStackVersion);
- expect(App.get('isHadoop20Stack')).to.equal(test.e);
- });
- });
-
- });
-
describe('#upgradeIsRunning', function () {
Em.A([
http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0086cb/ambari-web/test/controllers/main/host/configs_service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/configs_service_test.js b/ambari-web/test/controllers/main/host/configs_service_test.js
index d715df7..deb01ae 100644
--- a/ambari-web/test/controllers/main/host/configs_service_test.js
+++ b/ambari-web/test/controllers/main/host/configs_service_test.js
@@ -102,10 +102,16 @@ describe('App.MainHostServiceConfigsController', function () {
describe("#loadStep()", function () {
beforeEach(function() {
+ sinon.stub(App.themesMapper, 'generateAdvancedTabs', Em.K);
sinon.stub(controller, 'loadCurrentVersions', Em.K);
+ sinon.stub(controller, 'loadConfigTheme', function() {
+ return { always: Em.K };
+ });
});
afterEach(function() {
controller.loadCurrentVersions.restore();
+ controller.loadConfigTheme.restore();
+ App.themesMapper.generateAdvancedTabs.restore();
});
it("should set host", function () {
controller.set('content', {
http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0086cb/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index c2ad8f2..4f6b039 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -959,7 +959,6 @@ describe('App.MainHostDetailsController', function () {
id: 'SECONDARY_NAMENODE_host1',
component_name: 'SECONDARY_NAMENODE'
});
- App.set('currentStackVersion', 'HDP-2.0.1');
});
it('HBASE is installed', function () {
@@ -978,31 +977,15 @@ describe('App.MainHostDetailsController', function () {
expect(controller.constructConfigUrlParams(data)).to.eql(['(type=storm-site&tag=1)']);
});
- it('YARN for 2.2 stack is installed', function () {
- App.set('currentStackVersion', 'HDP-2.2.0');
+ it('YARN is installed', function () {
loadService('YARN');
expect(controller.constructConfigUrlParams(data)).to.eql(['(type=yarn-site&tag=1)', '(type=zoo.cfg&tag=1)']);
- App.set('currentStackVersion', 'HDP-2.0.1');
});
it('ACCUMULO is installed', function () {
loadService('ACCUMULO');
expect(controller.constructConfigUrlParams(data)).to.eql(['(type=accumulo-site&tag=1)']);
});
-
- describe('isRMHaEnabled true', function () {
- beforeEach(function () {
- sinon.stub(App, 'get').withArgs('isRMHaEnabled').returns(true);
- });
- afterEach(function () {
- App.get.restore();
- });
-
- it('params are valid', function () {
- expect(controller.constructConfigUrlParams(data)).to.eql(['(type=yarn-site&tag=1)', '(type=zoo.cfg&tag=1)']);
- });
-
- });
});
describe('#loadConfigsSuccessCallback()', function () {
@@ -1030,164 +1013,91 @@ describe('App.MainHostDetailsController', function () {
describe('#saveZkConfigs()', function () {
- var yarnCases = [
- {
- isYARNInstalled: true,
- isHadoop22Stack: true,
- isRMHaEnabled: true,
- shouldYarnSiteBeModified: true,
- title: 'HDP 2.2, YARN installed, RM HA enabled'
- },
+ var data = {
+ items: [
{
- isYARNInstalled: true,
- isHadoop22Stack: false,
- isRMHaEnabled: true,
- shouldYarnSiteBeModified: true,
- title: 'HDP < 2.2, YARN installed, RM HA enabled'
+ type: 'yarn-site',
+ properties: {
+ p: 'ys'
+ },
+ properties_attributes: {
+ p: 'pa_ys'
+ }
},
{
- isYARNInstalled: true,
- isHadoop22Stack: true,
- isRMHaEnabled: false,
- shouldYarnSiteBeModified: true,
- title: 'HDP 2.2, YARN installed, RM HA disabled'
+ type: 'hive-site',
+ properties: {
+ hs: 'hs'
+ },
+ properties_attributes: {
+ hs: 'pa_hs'
+ }
},
{
- isYARNInstalled: false,
- isHadoop22Stack: true,
- isRMHaEnabled: false,
- shouldYarnSiteBeModified: false,
- title: 'HDP 2.2, YARN not installed'
+ type: 'webhcat-site',
+ properties: {
+ ws: 'ws'
+ },
+ properties_attributes: {
+ ws: 'pa_ws'
+ }
},
{
- isYARNInstalled: true,
- isHadoop22Stack: false,
- isRMHaEnabled: false,
- shouldYarnSiteBeModified: false,
- title: 'HDP < 2.2, YARN installed, RM HA disabled'
+ type: 'hbase-site',
+ properties: {
+ hbs: 'hbs'
+ },
+ properties_attributes: {
+ hbs: 'pa_hbs'
+ }
},
{
- isYARNInstalled: false,
- isHadoop22Stack: false,
- isRMHaEnabled: false,
- shouldYarnSiteBeModified: false,
- title: 'HDP < 2.2, YARN not installed'
- }
- ],
- yarnData = {
- items: [
- {
- type: 'yarn-site',
- properties: {
- p: 'v'
- }
+ type: 'accumulo-site',
+ properties: {
+ as: 'as'
+ },
+ properties_attributes: {
+ as: 'pa_as'
}
- ]
- };
+ }
+ ]
+ };
beforeEach(function () {
sinon.stub(controller, 'saveConfigsBatch', Em.K);
- });
- afterEach(function () {
- controller.saveConfigsBatch.restore();
- });
+ sinon.stub(controller, 'updateZkConfigs', Em.K);
+ sinon.stub(App.Service, 'find', function() {
+ return [
+ Em.Object.create({ serviceName: 'HIVE' }),
+ Em.Object.create({ serviceName: 'YARN' }),
+ Em.Object.create({ serviceName: 'HBASE' }),
+ Em.Object.create({ serviceName: 'ACCUMULO' })
+ ];
+ });
- it('call saveConfigsBatch()', function () {
- var data = {items: []};
controller.saveZkConfigs(data);
- expect(controller.saveConfigsBatch.calledOnce).to.be.true;
+ this.groups = controller.saveConfigsBatch.args[0][0];
});
-
- yarnCases.forEach(function (item) {
- describe(item.title, function () {
- var servicesMock = item.isYARNInstalled ? [
- {
- serviceName: 'YARN'
- }
- ] : [];
-
- beforeEach(function () {
- sinon.stub(App, 'get').withArgs('isHadoop22Stack').returns(item.isHadoop22Stack).
- withArgs('isRMHaEnabled').returns(item.isRMHaEnabled);
- sinon.stub(App.Service, 'find').returns(servicesMock);
- controller.saveZkConfigs(yarnData);
- });
-
- afterEach(function () {
- App.get.restore();
- App.Service.find.restore();
- });
-
- it('some properties.yarn-site = true (' + item.shouldYarnSiteBeModified + ')', function () {
- expect(controller.saveConfigsBatch.firstCall.args[0].someProperty('properties.yarn-site')).to.equal(item.shouldYarnSiteBeModified);
- });
-
- it('some properties_attributes.yarn-site = true (' + item.shouldYarnSiteBeModified + ')', function () {
- expect(controller.saveConfigsBatch.firstCall.args[0].someProperty('properties_attributes.yarn-site')).to.equal(item.shouldYarnSiteBeModified);
- });
-
- });
+ afterEach(function () {
+ App.Service.find.restore();
+ controller.updateZkConfigs.restore();
+ controller.saveConfigsBatch.restore();
});
- describe('check groups', function () {
-
- var data = {
- items: [
- {
- type: 'hive-site',
- properties: {
- hs: 'hs'
- },
- properties_attributes: {
- hs: 'pa_hs'
- }
- },
- {
- type: 'webhcat-site',
- properties: {
- ws: 'ws'
- },
- properties_attributes: {
- ws: 'pa_ws'
- }
- },
- {
- type: 'hbase-site',
- properties: {
- hbs: 'hbs'
- },
- properties_attributes: {
- hbs: 'pa_hbs'
+ it('configs for YARN', function () {
+ var expected = {
+ properties: {
+ 'yarn-site': {
+ p: 'ys'
}
},
- {
- type: 'accumulo-site',
- properties: {
- as: 'as'
- },
- properties_attributes: {
- as: 'pa_as'
+ properties_attributes: {
+ 'yarn-site': {
+ p: 'pa_ys'
}
}
- ]
- };
-
- beforeEach(function () {
- sinon.stub(controller, 'updateZkConfigs', Em.K);
- sinon.stub(App.Service, 'find', function () {
- return [
- {serviceName: 'YARN'},
- {serviceName: 'HBASE'},
- {serviceName: 'ACCUMULO'}
- ];
- });
- controller.saveZkConfigs(data);
- this.groups = controller.saveConfigsBatch.args[0][0];
- });
-
- afterEach(function () {
- controller.updateZkConfigs.restore();
- App.Service.find.restore();
+ };
+ expect(this.groups[1]).to.be.eql(expected);
});
it('configs for HIVE', function () {
@@ -1225,7 +1135,7 @@ describe('App.MainHostDetailsController', function () {
}
}
};
- expect(this.groups[1]).to.be.eql(expected);
+ expect(this.groups[2]).to.be.eql(expected);
});
it('configs for ACCUMULO', function () {
@@ -1241,11 +1151,9 @@ describe('App.MainHostDetailsController', function () {
}
}
};
- expect(this.groups[2]).to.be.eql(expected);
+ expect(this.groups[3]).to.be.eql(expected);
});
- });
-
});
describe("#saveConfigsBatch()", function () {
@@ -1426,25 +1334,6 @@ describe('App.MainHostDetailsController', function () {
},
{
appGetterStubs: {
- isRMHaEnabled: false
- },
- hostComponentModel: makeHostComponentModel('ZOOKEEPER_SERVER', ['host1', 'host2']),
- configs: {
- "yarn-site": {
- "yarn.resourcemanager.zk-address": "host3:2181"
- }
- },
- m: 'yarn.resourcemanager.zk-address property, ResourceManager HA not activated. Property value should be untouched.',
- e: {
- configs: {
- "yarn-site": {
- "yarn.resourcemanager.zk-address": "host3:2181"
- }
- }
- }
- },
- {
- appGetterStubs: {
currentStackVersionNumber: '2.2'
},
hostComponentModel: makeHostComponentModel('ZOOKEEPER_SERVER', ['host1', 'host2']),
@@ -1464,44 +1353,6 @@ describe('App.MainHostDetailsController', function () {
},
{
appGetterStubs: {
- currentStackVersionNumber: '2.1'
- },
- hostComponentModel: makeHostComponentModel('ZOOKEEPER_SERVER', ['host1', 'host2']),
- configs: {
- "hive-site": {
- "hive.zookeeper.quorum": "host3:2181"
- }
- },
- m: 'hive.zookeeper.quorum property, current stack version is 2.1 property should be untouched.',
- e: {
- configs: {
- "hive-site": {
- "hive.zookeeper.quorum": "host3:2181"
- }
- }
- }
- },
- {
- appGetterStubs: {
- currentStackVersionNumber: '2.1'
- },
- hostComponentModel: makeHostComponentModel('ZOOKEEPER_SERVER', ['host1', 'host2']),
- configs: {
- "yarn-site": {
- "hadoop.registry.zk.quorum": "host3:2181"
- }
- },
- m: 'hadoop.registry.zk.quorum property, current stack version is 2.1 property should be untouched.',
- e: {
- configs: {
- "yarn-site": {
- "hadoop.registry.zk.quorum": "host3:2181"
- }
- }
- }
- },
- {
- appGetterStubs: {
currentStackVersionNumber: '2.2'
},
hostComponentModel: makeHostComponentModel('ZOOKEEPER_SERVER', ['host1', 'host2']),