ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject ambari git commit: AMBARI-9553. Ranger:Add Service wizard navigates to 'Configure Identities' step for unsecure cluster. (akovalenko)
Date Wed, 11 Feb 2015 13:14:23 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk edec73af9 -> e52dbb5f4


AMBARI-9553. Ranger:Add Service wizard navigates to 'Configure Identities' step for unsecure
cluster. (akovalenko)


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

Branch: refs/heads/trunk
Commit: e52dbb5f471b2e4d315a38c145cbf00e5694b9a1
Parents: edec73a
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Tue Feb 10 20:08:40 2015 +0200
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Wed Feb 11 15:13:53 2015 +0200

----------------------------------------------------------------------
 .../main/admin/kerberos/step4_controller.js     |  4 ++
 .../controllers/main/service/add_controller.js  |  1 +
 .../admin/kerberos/step4_controller_test.js     | 51 +++++++++++++++++++-
 3 files changed, 55 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e52dbb5f/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
index d8cd8a6..f03b054 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
@@ -31,6 +31,10 @@ App.KerberosWizardStep4Controller = App.WizardStep7Controller.extend(App.AddSecu
   },
   
   loadStep: function() {
+    if (this.get('wizardController.skipConfigureIdentitiesStep')) {
+      App.router.send('next');
+      return;
+    }
     var self = this;
     this.clearStep();
     this.getDescriptorConfigs().then(function(properties) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/e52dbb5f/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 0043f92..7f86969 100644
--- a/ambari-web/app/controllers/main/service/add_controller.js
+++ b/ambari-web/app/controllers/main/service/add_controller.js
@@ -547,6 +547,7 @@ App.AddServiceController = App.WizardController.extend({
   checkSecurityStatus: function() {
     if (App.supports.automatedKerberos) {
       if (!App.router.get('mainAdminKerberosController.securityEnabled')) {
+        this.set('skipConfigureIdentitiesStep', true);
         this.get('isStepDisabled').findProperty('step', 5).set('value', true);
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e52dbb5f/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js b/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
index 4316bf5..b67b3dd 100644
--- a/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
@@ -247,6 +247,55 @@ describe('App.KerberosWizardStep4Controller', function() {
       controller.set('wizardController.name', 'KerberosWizard');
       expect(controller.createCategoryForServices()).to.eql([App.ServiceConfigCategory.create({
name: 'HDFS', displayName: 'HDFS', collapsedByDefault: true})]);
     });
-  })
+  });
+
+  describe('#loadStep', function() {
+
+    describe('skip "Configure Identities" step', function() {
+      beforeEach(function() {
+        this.controller = App.KerberosWizardStep4Controller.create({});
+        this.wizardController = App.AddServiceController.create({});
+        this.controller.set('wizardController', this.wizardController);
+        sinon.stub(this.controller, 'clearStep').returns(true);
+        sinon.stub(this.controller, 'getDescriptorConfigs').returns((new $.Deferred()).resolve(true).promise());
+        sinon.stub(this.controller, 'setStepConfigs').returns(true);
+        sinon.stub(App.router, 'send').withArgs('next');
+      });
+
+      afterEach(function() {
+        this.controller.clearStep.restore();
+        this.controller.getDescriptorConfigs.restore();
+        this.controller.setStepConfigs.restore();
+        App.router.send.restore();
+      });
+
+      var tests = [
+        {
+          securityEnabled: true,
+          stepSkipped: false,
+        },
+        {
+          securityEnabled: false,
+          stepSkipped: true
+        }
+      ];
+
+      tests.forEach(function(test) {
+        it('security {0} configure identities step should be {1}'.format(!!test.securityEnabled
? 'enabled' : 'disabled', !!test.stepSkipped ? 'skipped' : 'not skipped'), function() {
+          sinon.stub(App.router, 'get').withArgs('mainAdminKerberosController.securityEnabled').returns(test.securityEnabled);
+          this.wizardController.checkSecurityStatus();
+          App.router.get.restore();
+          this.controller.loadStep();
+          expect(App.router.send.calledWith('next')).to.be.eql(test.stepSkipped);
+        });
+      }, this);
+
+      it('step should not be disabled for Add Kerberos wizard', function() {
+        this.controller.set('wizardController', App.KerberosWizardController.create({}));
+        this.controller.loadStep();
+        expect(App.router.send.calledWith('next')).to.be.false;
+      });
+    });
+  });
 
 });


Mime
View raw message