ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject ambari git commit: AMBARI-12116. Moving back from Review-step to Customize Services doesn't restore override and config groups created previously on the Customize Services step (onechiporenko)
Date Wed, 24 Jun 2015 10:07:11 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 3ab123a10 -> 4ef534b55


AMBARI-12116. Moving back from Review-step to Customize Services doesn't restore override
and config groups created previously on the Customize Services step (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4ef534b5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4ef534b5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4ef534b5

Branch: refs/heads/trunk
Commit: 4ef534b555514f3f0319212323218209ad95b50a
Parents: 3ab123a
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Wed Jun 24 13:00:40 2015 +0300
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Wed Jun 24 13:00:40 2015 +0300

----------------------------------------------------------------------
 .../controllers/main/service/add_controller.js  | 12 ++++++
 .../app/controllers/wizard/step7_controller.js  |  2 +-
 .../main/service/add_controller_test.js         | 40 ++++++++++++++++++++
 .../test/controllers/wizard/step7_test.js       | 19 +++++++++-
 4 files changed, 70 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4ef534b5/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 1a5cd98..2a2f425 100644
--- a/ambari-web/app/controllers/main/service/add_controller.js
+++ b/ambari-web/app/controllers/main/service/add_controller.js
@@ -40,6 +40,8 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs,
{
    */
   installClientQueueLength: 0,
 
+  areInstalledConfigGroupsLoaded: false,
+
   /**
    * All wizards data will be stored in this variable
    *
@@ -589,6 +591,16 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs,
{
       this.set('skipConfigureIdentitiesStep', true);
       this.get('isStepDisabled').findProperty('step', 5).set('value', true);
     }
+  },
+
+  loadServiceConfigGroups: function () {
+    this._super();
+    this.set('areInstalledConfigGroupsLoaded', !Em.isNone(this.getDBProperty('serviceConfigGroups')));
+  },
+
+  clearStorageData: function () {
+    this._super();
+    this.set('areInstalledConfigGroupsLoaded', false);
   }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ef534b5/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 be8aeab..1fe79e7 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -752,7 +752,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
     if (this.get('wizardController.name') !== 'kerberosWizardController') {
       this.loadConfigGroups(this.get('content.configGroups'));
     }
-    if (this.get('installedServiceNames').length > 0) {
+    if (this.get('installedServiceNames').length > 0 && !this.get('wizardController.areInstalledConfigGroupsLoaded'))
{
       this.loadInstalledServicesConfigGroups(this.get('installedServiceNames'));
     }
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ef534b5/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 bb04c71..5e87ca8 100644
--- a/ambari-web/test/controllers/main/service/add_controller_test.js
+++ b/ambari-web/test/controllers/main/service/add_controller_test.js
@@ -467,4 +467,44 @@ describe('App.AddServiceController', function() {
 
   });
 
+  describe('#loadServiceConfigGroups', function () {
+
+    var dbMock,
+      cases = [
+        {
+          serviceConfigGroups: null,
+          areInstalledConfigGroupsLoaded: false
+        },
+        {
+          serviceConfigGroups: [],
+          areInstalledConfigGroupsLoaded: true
+        }
+      ];
+
+    beforeEach(function () {
+      dbMock = sinon.stub(addServiceController, 'getDBProperty');
+    });
+
+    afterEach(function () {
+      dbMock.restore();
+    });
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        dbMock.withArgs('hosts').returns({}).withArgs('serviceConfigGroups').returns(item.serviceConfigGroups);
+        addServiceController.loadServiceConfigGroups();
+        expect(addServiceController.get('areInstalledConfigGroupsLoaded')).to.equal(item.areInstalledConfigGroupsLoaded);
+      });
+    });
+
+  });
+
+  describe('#clearStorageData', function () {
+    it('areInstalledConfigGroupsLoaded should be false', function () {
+      addServiceController.set('areInstalledConfigGroupsLoaded', true);
+      addServiceController.clearStorageData();
+      expect(addServiceController.get('areInstalledConfigGroupsLoaded')).to.be.false;
+    });
+  });
+
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ef534b5/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 64c3e70..6dffd3d 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -1357,11 +1357,21 @@ describe('App.InstallerStep7Controller', function () {
         },
         {
           installedServiceNames: ['s1', 's2', 's3'],
-          m: 'installedServiceNames isn\'t empty',
+          areInstalledConfigGroupsLoaded: false,
+          m: 'installedServiceNames isn\'t empty, config groups not yet loaded',
           e: {
             loadConfigGroups: true,
             loadInstalledServicesConfigGroups: true
           }
+        },
+        {
+          installedServiceNames: ['s1', 's2', 's3'],
+          areInstalledConfigGroupsLoaded: true,
+          m: 'installedServiceNames isn\'t empty, config groups already loaded',
+          e: {
+            loadConfigGroups: true,
+            loadInstalledServicesConfigGroups: false
+          }
         }
       ]).forEach(function (test) {
         it(test.m, function () {
@@ -1369,7 +1379,12 @@ describe('App.InstallerStep7Controller', function () {
             if (k === 'supports.hostOverridesInstaller') return test.hostOverridesInstaller;
             return Em.get(App, k);
           });
-          installerStep7Controller.reopen({installedServiceNames: test.installedServiceNames});
+          installerStep7Controller.reopen({
+            installedServiceNames: test.installedServiceNames,
+            wizardController: {
+              areInstalledConfigGroupsLoaded: test.areInstalledConfigGroupsLoaded
+            }
+          });
           installerStep7Controller.checkHostOverrideInstaller();
           if (test.e.loadConfigGroups) {
             expect(installerStep7Controller.loadConfigGroups.calledOnce).to.equal(true);


Mime
View raw message