You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2016/12/15 13:15:06 UTC
ambari git commit: AMBARI-19208. Manage Journalnode Wizard: error on
step3 akovalenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 060387783 -> 3ad2ffb85
AMBARI-19208. Manage Journalnode Wizard: error on step3 akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3ad2ffb8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3ad2ffb8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3ad2ffb8
Branch: refs/heads/trunk
Commit: 3ad2ffb851831aa958b0f5a479e7f84d52c815a7
Parents: 0603877
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Thu Dec 15 13:38:34 2016 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Thu Dec 15 13:40:13 2016 +0200
----------------------------------------------------------------------
.../main/admin/highAvailability_controller.js | 15 ++++--
ambari-web/app/messages.js | 1 +
.../admin/highAvailability_controller_test.js | 53 ++++++++++++++++++++
3 files changed, 66 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/3ad2ffb8/ambari-web/app/controllers/main/admin/highAvailability_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability_controller.js b/ambari-web/app/controllers/main/admin/highAvailability_controller.js
index 71c11db..4899b43 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability_controller.js
@@ -115,10 +115,19 @@ App.MainAdminHighAvailabilityController = App.WizardController.extend({
App.router.transitionTo('main.services.enableRAHighAvailability');
return true;
},
-
+
+ /**
+ * open Manage JournalNode Wizard if there are two started NameNodes with defined active/standby state
+ * @returns {boolean}
+ */
manageJournalNode: function() {
- App.router.transitionTo('main.services.manageJournalNode');
- return true;
+ var nameNodes = App.HostComponent.find().filterProperty('componentName', 'NAMENODE');
+ if (nameNodes.someProperty('displayNameAdvanced', 'Active NameNode') && nameNodes.someProperty('displayNameAdvanced', 'Standby NameNode')) {
+ App.router.transitionTo('main.services.manageJournalNode');
+ return true;
+ }
+ this.showErrorPopup(Em.I18n.t('admin.manageJournalNode.warning'));
+ return false;
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/3ad2ffb8/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 24ff1fc..cc8102a 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1295,6 +1295,7 @@ Em.I18n.translations = {
'admin.kerberos.wizard.step1.notice.inProgress': 'Please wait while cluster is being unkerberized',
'admin.manageJournalNode.label': 'Manage JournalNodes',
+ 'admin.manageJournalNode.warning': 'Manage JournalNodes Wizard requires all NameNodes be started and have Active/Standby state defined',
'admin.manageJournalNode.wizard.header': 'Manage JournalNodes Wizard',
'admin.manageJournalNode.wizard.step1.header': 'Assign JournalNodes',
'admin.manageJournalNode.wizard.step2.header': 'Review',
http://git-wip-us.apache.org/repos/asf/ambari/blob/3ad2ffb8/ambari-web/test/controllers/main/admin/highAvailability_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability_controller_test.js
index 1e3d140..f5a144b 100644
--- a/ambari-web/test/controllers/main/admin/highAvailability_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/highAvailability_controller_test.js
@@ -200,4 +200,57 @@ describe('App.MainAdminHighAvailabilityController', function () {
});
});
+ describe('#manageJournalNode()', function () {
+
+ beforeEach(function () {
+ this.mock = sinon.stub(App.HostComponent, 'find');
+ sinon.stub(App.router, 'transitionTo', Em.K);
+ sinon.spy(controller, "showErrorPopup");
+ });
+
+ afterEach(function () {
+ App.router.transitionTo.restore();
+ controller.showErrorPopup.restore();
+ App.HostComponent.find.restore();
+ });
+
+ it('should show error popup if there is no NNs', function () {
+ this.mock.returns([]);
+ var result = controller.manageJournalNode();
+ expect(result).to.be.false;
+ expect(controller.showErrorPopup.calledOnce).to.be.true;
+ });
+
+ it('should show error popup if there is no NNs', function () {
+ this.mock.returns([
+ Em.Object.create({
+ componentName: 'NAMENODE',
+ displayNameAdvanced: 'Active NameNode'
+ }),
+ Em.Object.create({
+ componentName: 'NAMENODE'
+ })
+ ]);
+ var result = controller.manageJournalNode();
+ expect(result).to.be.false;
+ expect(controller.showErrorPopup.calledOnce).to.be.true;
+ });
+
+ it('should call transition to wizard if we have both standby and active NNs', function () {
+ this.mock.returns([
+ Em.Object.create({
+ componentName: 'NAMENODE',
+ displayNameAdvanced: 'Active NameNode'
+ }),
+ Em.Object.create({
+ componentName: 'NAMENODE',
+ displayNameAdvanced: 'Standby NameNode'
+ })
+ ]);
+ var result = controller.manageJournalNode();
+ expect(result).to.be.true;
+ expect(App.router.transitionTo.calledOnce).to.be.true;
+ });
+ });
+
});