ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject git commit: AMBARI-7793 On add service, the Cap scheduler is being expanded into individual props. (ababiichuk)
Date Wed, 15 Oct 2014 18:07:56 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk a8677ebe5 -> 13b097c3d


AMBARI-7793 On add service, the Cap scheduler is being expanded into individual props. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 13b097c3d5b49d9ca709f42d2d3a29a3c401b8e1
Parents: a8677eb
Author: aBabiichuk <ababiichuk@cybervisiontech.com>
Authored: Wed Oct 15 20:15:11 2014 +0300
Committer: aBabiichuk <ababiichuk@cybervisiontech.com>
Committed: Wed Oct 15 20:15:24 2014 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  |   9 +-
 .../test/controllers/wizard/step7_test.js       | 123 +++++++++++++------
 2 files changed, 87 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/13b097c3/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 c00d743..c6ffc3f 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -733,10 +733,6 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
{
     App.config.addAdvancedConfigs(configs, advancedConfigs);
     //STEP 5: Add custom configs
     App.config.addCustomConfigs(configs);
-    //put properties from capacity-scheduler.xml into one config with textarea view
-    if (this.get('allSelectedServiceNames').contains('YARN') && !App.get('supports.capacitySchedulerUi'))
{
-      configs = App.config.fileConfigsIntoTextarea(configs, 'capacity-scheduler.xml');
-    }
 
     this.set('groupsToDelete', this.get('wizardController').getDBProperty('groupsToDelete')
|| []);
 
@@ -751,7 +747,10 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
{
   },
 
   applyServicesConfigs: function (configs, storedConfigs) {
-    if (this.get('allSelectedServiceNames').contains('STORM') || this.get('installedServiceNames').contains('STORM'))
{
+    if (this.get('allSelectedServiceNames').contains('YARN') && !App.get('supports.capacitySchedulerUi'))
{
+      configs = App.config.fileConfigsIntoTextarea(configs, 'capacity-scheduler.xml');
+    }
+    if (this.get('allSelectedServiceNames').contains('STORM')) {
       this.resolveServiceDependencyConfigs('STORM', configs);
     }
     //STEP 6: Distribute configs by service and wrap each one in App.ServiceConfigProperty
(configs -> serviceConfigs)

http://git-wip-us.apache.org/repos/asf/ambari/blob/13b097c3/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 ce07144..9316c1c 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -32,8 +32,7 @@ describe('App.InstallerStep7Controller', function () {
       content: {
         advancedServiceConfig: [],
         serviceConfigProperties: []
-      },
-      applyServicesConfigs: Em.K
+      }
     });
   });
 
@@ -971,6 +970,7 @@ describe('App.InstallerStep7Controller', function () {
       sinon.stub(installerStep7Controller, 'checkHostOverrideInstaller', Em.K);
       sinon.stub(installerStep7Controller, 'activateSpecialConfigs', Em.K);
       sinon.stub(installerStep7Controller, 'selectProperService', Em.K);
+      sinon.stub(installerStep7Controller, 'applyServicesConfigs', Em.K);
       sinon.stub(App.router, 'send', Em.K);
     });
     afterEach(function () {
@@ -986,6 +986,7 @@ describe('App.InstallerStep7Controller', function () {
       installerStep7Controller.checkHostOverrideInstaller.restore();
       installerStep7Controller.activateSpecialConfigs.restore();
       installerStep7Controller.selectProperService.restore();
+      installerStep7Controller.applyServicesConfigs.restore();
       App.router.send.restore();
     });
     it('should call clearStep', function () {
@@ -1003,44 +1004,6 @@ describe('App.InstallerStep7Controller', function () {
       expect(App.config.addAdvancedConfigs.calledOnce).to.equal(true);
       expect(App.config.addCustomConfigs.calledOnce).to.equal(true);
     });
-    Em.A([
-        {
-          allSelectedServiceNames: ['YARN'],
-          capacitySchedulerUi: false,
-          e: true
-        },
-        {
-          allSelectedServiceNames: ['YARN'],
-          capacitySchedulerUi: true,
-          e: false
-        },
-        {
-          allSelectedServiceNames: ['HDFS'],
-          capacitySchedulerUi: false,
-          e: false
-        },
-        {
-          allSelectedServiceNames: ['HDFS'],
-          capacitySchedulerUi: true,
-          e: false
-        }
-      ]).forEach(function (test) {
-        it('allSelectedServiceNames = ' + JSON.stringify(test.allSelectedServiceNames) +
', capacitySchedulerUi = ' + test.capacitySchedulerUi.toString(), function () {
-          sinon.stub(App, 'get', function (k) {
-            if (k === 'supports.capacitySchedulerUi') return test.capacitySchedulerUi;
-            return Em.get(App, k);
-          });
-          installerStep7Controller.reopen({allSelectedServiceNames: test.allSelectedServiceNames});
-          installerStep7Controller.loadStep();
-          if (test.e) {
-            expect(App.config.fileConfigsIntoTextarea.calledOnce).to.equal(true);
-          }
-          else {
-            expect(App.config.fileConfigsIntoTextarea.called).to.equal(false);
-          }
-          App.get.restore();
-        });
-      });
     it('should call setInstalledServiceConfigs for addServiceController', function () {
       installerStep7Controller.set('wizardController.name', 'addServiceController');
       installerStep7Controller.loadStep();
@@ -1048,6 +1011,86 @@ describe('App.InstallerStep7Controller', function () {
     });
   });
 
+  describe('#applyServicesConfigs', function() {
+    beforeEach(function() {
+      installerStep7Controller.reopen({
+        allSelectedServiceNames: [],
+      });
+      sinon.stub(App.config, 'fileConfigsIntoTextarea', function(configs) {
+        return configs;
+      });
+      sinon.stub(installerStep7Controller, 'resolveServiceDependencyConfigs', Em.K);
+      sinon.stub(installerStep7Controller, 'loadServerSideConfigsRecommendations', function()
{
+        return $.Deferred().resolve();
+      });
+      sinon.stub(installerStep7Controller, 'checkHostOverrideInstaller', Em.K);
+      sinon.stub(installerStep7Controller, 'activateSpecialConfigs', Em.K);
+      sinon.stub(installerStep7Controller, 'selectProperService', Em.K);
+      sinon.stub(installerStep7Controller, 'setStepConfigs', Em.K);
+      sinon.stub(App.router, 'send', Em.K);
+    });
+    afterEach(function () {
+      App.config.fileConfigsIntoTextarea.restore();
+      installerStep7Controller.resolveServiceDependencyConfigs.restore();
+      installerStep7Controller.loadServerSideConfigsRecommendations.restore();
+      installerStep7Controller.checkHostOverrideInstaller.restore();
+      installerStep7Controller.activateSpecialConfigs.restore();
+      installerStep7Controller.selectProperService.restore();
+      installerStep7Controller.setStepConfigs.restore();
+      App.router.send.restore();
+    });
+
+    it('should run some methods' , function () {
+     installerStep7Controller.applyServicesConfigs({name: 'configs'}, {name: 'storedConfigs'});
+     expect(installerStep7Controller.loadServerSideConfigsRecommendations.calledOnce).to.equal(true);
+     expect(installerStep7Controller.get('isRecommendedLoaded')).to.equal(true);
+     expect(installerStep7Controller.setStepConfigs.calledWith({name: 'configs'}, {name:
'storedConfigs'})).to.equal(true);
+     expect(installerStep7Controller.checkHostOverrideInstaller.calledOnce).to.equal(true);
+     expect(installerStep7Controller.activateSpecialConfigs.calledOnce).to.equal(true);
+     expect(installerStep7Controller.selectProperService.calledOnce).to.equal(true);
+    });
+
+    Em.A([
+      {
+        allSelectedServiceNames: ['YARN'],
+        fileConfigsIntoTextarea: true,
+        m: 'should run fileConfigsIntoTextarea',
+        capacitySchedulerUi: false
+      },
+      {
+        allSelectedServiceNames: ['YARN'],
+        m: 'shouldn\'t run fileConfigsIntoTextarea',
+        capacitySchedulerUi: true
+      },
+      {
+        allSelectedServiceNames: ['STORM'],
+        resolveServiceDependencyConfigs: true,
+        m: 'should run resolveServiceDependencyConfigs'
+      }
+    ]).forEach(function(t) {
+      it(t.m, function () {
+        sinon.stub(App, 'get', function (k) {
+          if (k === 'supports.capacitySchedulerUi') return t.capacitySchedulerUi;
+          return Em.get(App, k);
+        });
+        installerStep7Controller.reopen({
+          allSelectedServiceNames: t.allSelectedServiceNames
+        });
+        installerStep7Controller.applyServicesConfigs({name: 'configs'}, {name: 'storedConfigs'});
+        if (t.fileConfigsIntoTextarea) {
+          expect(App.config.fileConfigsIntoTextarea.calledWith({name: 'configs'}, 'capacity-scheduler.xml')).to.equal(true);
+        } else {
+          expect(App.config.fileConfigsIntoTextarea.calledOnce).to.equal(false);
+        }
+        if (t.resolveServiceDependencyConfigs) {
+          expect(installerStep7Controller.resolveServiceDependencyConfigs.calledWith('STORM',
{name: 'configs'})).to.equal(true);
+        } else {
+          expect(installerStep7Controller.resolveServiceDependencyConfigs.calledOnce).to.equal(false);
+        }
+        App.get.restore();
+      });
+    });
+  });
   describe('#_updateValueForCheckBoxConfig', function () {
     Em.A([
         {


Mime
View raw message