You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2015/12/01 19:19:57 UTC
[07/50] ambari git commit: AMBARI-14097. Should option "Enable RM HA"
be available if no RM installed on the cluster (onechiporenko)
AMBARI-14097. Should option "Enable RM HA" be available if no RM installed on the cluster (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/667e1e8b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/667e1e8b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/667e1e8b
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 667e1e8be2b84903248cad302ebffe39795183f7
Parents: 00cb7ba
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Fri Nov 27 14:37:05 2015 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Fri Nov 27 14:39:21 2015 +0200
----------------------------------------------------------------------
ambari-web/app/models/host_component.js | 19 ++++-
ambari-web/test/models/host_component_test.js | 25 +++++++
ambari-web/test/views/main/service/item_test.js | 77 ++++++++++++--------
3 files changed, 86 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/667e1e8b/ambari-web/app/models/host_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/host_component.js b/ambari-web/app/models/host_component.js
index da87071..db750e0 100644
--- a/ambari-web/app/models/host_component.js
+++ b/ambari-web/app/models/host_component.js
@@ -52,6 +52,14 @@ App.HostComponent = DS.Model.extend({
isRunning: Em.computed.existsIn('workStatus', ['STARTED', 'STARTING']),
/**
+ * Determines if component is not installed
+ * Based on <code>workStatus</code>
+ *
+ * @type {boolean}
+ */
+ isNotInstalled: Em.computed.existsIn('workStatus', ['INIT', 'INSTALL_FAILED']),
+
+ /**
* Formatted <code>componentName</code>
* @returns {String}
*/
@@ -245,6 +253,9 @@ App.HostComponentStatus = {
App.HostComponentActionMap = {
getMap: function(ctx) {
+ var NN = ctx.get('controller.content.hostComponents').findProperty('componentName', 'NAMENODE');
+ var RM = ctx.get('controller.content.hostComponents').findProperty('componentName', 'RESOURCEMANAGER');
+ var RA = ctx.get('controller.content.hostComponents').findProperty('componentName', 'RANGER_ADMIN');
return {
RESTART_ALL: {
action: 'restartAllHostComponents',
@@ -292,21 +303,21 @@ App.HostComponentActionMap = {
label: App.get('isHaEnabled') ? Em.I18n.t('admin.highAvailability.button.disable') : Em.I18n.t('admin.highAvailability.button.enable'),
cssClass: App.get('isHaEnabled') ? 'icon-arrow-down' : 'icon-arrow-up',
isHidden: App.get('isHaEnabled'),
- disabled: App.get('isSingleNode')
+ disabled: App.get('isSingleNode') || !NN || NN.get('isNotInstalled')
},
TOGGLE_RM_HA: {
action: 'enableRMHighAvailability',
label: Em.I18n.t('admin.rm_highAvailability.button.enable'),
cssClass: 'icon-arrow-up',
isHidden: App.get('isRMHaEnabled'),
- disabled: App.get('isSingleNode')
+ disabled: App.get('isSingleNode') || !RM || RM.get('isNotInstalled')
},
TOGGLE_RA_HA: {
action: 'enableRAHighAvailability',
label: Em.I18n.t('admin.ra_highAvailability.button.enable'),
cssClass: 'icon-arrow-up',
isHidden: App.get('isRAHaEnabled'),
- disabled: App.get('isSingleNode')
+ disabled: App.get('isSingleNode') || !RA || RA.get('isNotInstalled')
},
MOVE_COMPONENT: {
action: 'reassignMaster',
@@ -353,6 +364,6 @@ App.HostComponentActionMap = {
isHidden: false,
disabled: false
}
- }
+ };
}
};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/667e1e8b/ambari-web/test/models/host_component_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/host_component_test.js b/ambari-web/test/models/host_component_test.js
index 7b4cf74..6ba6fb0 100644
--- a/ambari-web/test/models/host_component_test.js
+++ b/ambari-web/test/models/host_component_test.js
@@ -314,4 +314,29 @@ describe('App.HostComponent', function() {
});
});
});
+
+ describe('#isNotInstalled', function () {
+
+ Em.A([
+ {
+ p: {workStatus: 'INIT'},
+ e: true
+ },
+ {
+ p: {workStatus: 'INSTALL_FAILED'},
+ e: true
+ },
+ {
+ p: {workStatus: 'STARTED'},
+ e: false
+ }
+ ]).forEach(function (test, index) {
+ it('#' + (index + 1), function() {
+ hc.setProperties(test.p);
+ expect(hc.get('isNotInstalled')).to.equal(test.e);
+ });
+ });
+
+ });
+
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/667e1e8b/ambari-web/test/views/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/item_test.js b/ambari-web/test/views/main/service/item_test.js
index 155e094..560760a 100644
--- a/ambari-web/test/views/main/service/item_test.js
+++ b/ambari-web/test/views/main/service/item_test.js
@@ -144,6 +144,7 @@ describe('App.MainServiceItemView', function () {
hostComponents: [
Em.Object.create({
componentName: 'NAMENODE',
+ isNotInstalled: true,
isMaster: true,
isSlave: false
}),
@@ -220,7 +221,8 @@ describe('App.MainServiceItemView', function () {
Em.Object.create({
componentName: 'RESOURCEMANAGER',
isMaster: true,
- isSlave: false
+ isSlave: false,
+ isNotInstalled: false
})
],
result: [
@@ -420,7 +422,7 @@ describe('App.MainServiceItemView', function () {
sinon.stub(App, 'get', function (k) {
switch (k) {
case 'isSingleNode':
- return (view.get('controller.content.serviceName') == 'HDFS');
+ return view.get('controller.content.serviceName') == 'HDFS';
case 'supports.autoRollbackHA':
case 'isRMHaEnabled':
case 'isHaEnabled':
@@ -504,39 +506,52 @@ describe('App.MainServiceItemView', function () {
testCases.forEach(function (testCase) {
- it('Maintenance for ' + testCase.serviceName + ' service', function () {
- view.reopen({
- controller: Em.Object.create({
- content: Em.Object.create({
- hostComponents: testCase.hostComponents,
- slaveComponents: testCase.slaveComponents,
- clientComponents: testCase.clientComponents,
- serviceName: testCase.serviceName,
- displayName: testCase.displayName,
- serviceTypes: testCase.serviceTypes,
- passiveState: 'OFF'
+ describe('Maintenance for ' + testCase.serviceName + ' service', function () {
+
+ beforeEach(function () {
+ view.reopen({
+ controller: Em.Object.create({
+ content: Em.Object.create({
+ hostComponents: testCase.hostComponents,
+ slaveComponents: testCase.slaveComponents,
+ clientComponents: testCase.clientComponents,
+ serviceName: testCase.serviceName,
+ displayName: testCase.displayName,
+ serviceTypes: testCase.serviceTypes,
+ passiveState: 'OFF'
+ }),
+ isSeveralClients: false,
+ clientComponents: [],
+ isStopDisabled: false
}),
- isSeveralClients: false,
- clientComponents: [],
- isStopDisabled: false
- }),
- mastersExcludedCommands: mastersExcludedCommands,
- hasConfigTab: hasConfigTab
+ mastersExcludedCommands: mastersExcludedCommands,
+ hasConfigTab: hasConfigTab
+ });
+ if (testCase.controller) {
+ testCase.controller.forEach(function (item) {
+ Object.keys(item).forEach(function (key) {
+ view.set('controller.' + key, item[key]);
+ });
+ });
+ }
+ view.observeMaintenanceOnce();
});
- if (testCase.controller) {
- testCase.controller.forEach(function (item) {
- Object.keys(item).forEach(function (key) {
- view.set('controller.' + key, item[key]);
+ testCase.result.forEach(function (option, index) {
+ Object.keys(option).forEach(function (key) {
+ it(option.action + ', key - ' + key, function () {
+ var r = view.get('maintenance')[index];
+ expect(Em.get(option, key)).to.eql(Em.get(r, key));
});
});
- }
- view.observeMaintenanceOnce();
- expect(view.get('maintenance')).to.eql(testCase.result);
- var oldMaintenance = JSON.parse(JSON.stringify(view.get('maintenance')));
- view.set('controller.content.passiveState', 'ON');
- view.observeMaintenanceOnce();
- expect(view.get('maintenance')).to.not.eql(oldMaintenance);
- expect(view.get('isMaintenanceSet')).to.be.true;
+ });
+
+ it('maintenance is updated', function () {
+ var oldMaintenance = JSON.parse(JSON.stringify(view.get('maintenance')));
+ view.set('controller.content.passiveState', 'ON');
+ view.observeMaintenanceOnce();
+ expect(view.get('maintenance')).to.not.eql(oldMaintenance);
+ expect(view.get('isMaintenanceSet')).to.be.true;
+ });
});
});