You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2016/05/19 09:46:02 UTC
ambari git commit: AMBARI-16761. Add Service Wizard is broken after
ambari-server restart (alexantonenko)
Repository: ambari
Updated Branches:
refs/heads/branch-2.4 e21364e3d -> e30453f1b
AMBARI-16761. Add Service Wizard is broken after ambari-server restart (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e30453f1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e30453f1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e30453f1
Branch: refs/heads/branch-2.4
Commit: e30453f1b38e5847d461473a4f844d16a0af6f11
Parents: e21364e
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu May 19 12:01:07 2016 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu May 19 12:45:19 2016 +0300
----------------------------------------------------------------------
.../controllers/main/service/add_controller.js | 12 +++++
.../main/service/add_controller_test.js | 47 ++++++++++++++++++++
2 files changed, 59 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e30453f1/ambari-web/app/controllers/main/service/add_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/add_controller.js b/ambari-web/app/controllers/main/service/add_controller.js
index 6d4f991..c8763c7 100644
--- a/ambari-web/app/controllers/main/service/add_controller.js
+++ b/ambari-web/app/controllers/main/service/add_controller.js
@@ -385,6 +385,18 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, {
},
/**
+ * Load information about hosts with clients components
+ */
+ loadClients: function () {
+ var clients = this.getDBProperty('clientInfo');
+ if (clients) {
+ this.set('content.clients', clients);
+ } else {
+ this.saveClients();
+ }
+ },
+
+ /**
* Remove all loaded data.
* Created as copy for App.router.clearAllSteps
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/e30453f1/ambari-web/test/controllers/main/service/add_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/add_controller_test.js b/ambari-web/test/controllers/main/service/add_controller_test.js
index 01f87a8..3939632 100644
--- a/ambari-web/test/controllers/main/service/add_controller_test.js
+++ b/ambari-web/test/controllers/main/service/add_controller_test.js
@@ -515,4 +515,51 @@ describe('App.AddServiceController', function() {
});
});
+ describe('#loadClients', function () {
+
+ var cases = [
+ {
+ clients: null,
+ contentClients: [],
+ saveClientsCallCount: 1,
+ title: 'no clients info in local db'
+ },
+ {
+ clients: [{}],
+ contentClients: [{}],
+ saveClientsCallCount: 0,
+ title: 'clients info saved in local db'
+ }
+ ];
+
+ cases.forEach(function (item) {
+
+ describe(item.title, function () {
+
+ beforeEach(function () {
+ sinon.stub(addServiceController, 'getDBProperty').withArgs('clientInfo').returns(item.clients);
+ sinon.stub(addServiceController, 'saveClients', Em.K);
+ addServiceController.set('content.clients', []);
+ addServiceController.loadClients();
+ });
+
+ afterEach(function () {
+ addServiceController.getDBProperty.restore();
+ addServiceController.saveClients.restore();
+ });
+
+ it('content.clients', function () {
+ expect(addServiceController.get('content.clients', [])).to.eql(item.contentClients);
+ });
+
+ it('saveClients call', function () {
+ expect(addServiceController.saveClients.callCount).to.equal(item.saveClientsCallCount);
+ });
+
+ });
+
+ });
+
+ });
+
});