Repository: ambari Updated Branches: refs/heads/trunk cf5703a7c -> 28e68643d
AMBARI-10520 Remove automatedKerberos experimental, on by default. (atkach) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/28e68643 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/28e68643 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/28e68643 Branch: refs/heads/trunk Commit: 28e68643d8a67acc88628ef6e13da0b90d101a0b Parents: cf5703a Author: Andrii Tkach <atk...@hortonworks.com> Authored: Thu Apr 16 14:33:38 2015 +0300 Committer: Andrii Tkach <atk...@hortonworks.com> Committed: Thu Apr 16 14:33:38 2015 +0300 ---------------------------------------------------------------------- ambari-web/app/assets/test/tests.js | 1 + .../controllers/main/service/add_controller.js | 12 ++- ambari-web/app/routes/add_service_routes.js | 28 +++---- ambari-web/app/templates/main/service/add.hbs | 15 +--- ambari-web/app/views/main/admin.js | 18 ++-- ambari-web/app/views/main/menu.js | 18 ++-- .../main/service/add_controller_test.js | 44 ++++++++++ ambari-web/test/views/main/admin_test.js | 87 ++++++++++++++++++++ ambari-web/test/views/main/menu_test.js | 86 +++++++++++++++++++ 9 files changed, 250 insertions(+), 59 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/28e68643/ambari-web/app/assets/test/tests.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js index 391a1e1..c5316ce 100644 --- a/ambari-web/app/assets/test/tests.js +++ b/ambari-web/app/assets/test/tests.js @@ -185,6 +185,7 @@ var files = ['test/init_model_test', 'test/views/common/sort_view_test', 'test/views/common/custom_date_popup_test', 'test/views/common/progress_bar_view_test', + 'test/views/main/admin_test', 'test/views/main/dashboard_test', 'test/views/main/menu_test', 'test/views/main/host_test', http://git-wip-us.apache.org/repos/asf/ambari/blob/28e68643/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 b2b9d06..e7a714c 100644 --- a/ambari-web/app/controllers/main/service/add_controller.js +++ b/ambari-web/app/controllers/main/service/add_controller.js @@ -21,8 +21,8 @@ var App = require('app'); App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, { name: 'addServiceController', - // @TODO: remove after Kerberos Automation supports - totalSteps: App.supports.automatedKerberos ? 8 : 7, + + totalSteps: 8, /** * Used for hiding back button in wizard @@ -585,11 +585,9 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, { }, 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); - } + 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/28e68643/ambari-web/app/routes/add_service_routes.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/add_service_routes.js b/ambari-web/app/routes/add_service_routes.js index 48a553d..2b23868 100644 --- a/ambari-web/app/routes/add_service_routes.js +++ b/ambari-web/app/routes/add_service_routes.js @@ -223,11 +223,9 @@ module.exports = App.WizardRoute.extend({ var wizardStep7Controller = router.get('wizardStep7Controller'); addServiceController.saveServiceConfigProperties(wizardStep7Controller); addServiceController.saveServiceConfigGroups(wizardStep7Controller, true); - if (App.supports.automatedKerberos) { - if (router.get('mainAdminKerberosController.securityEnabled')) { - router.transitionTo('step5'); - return; - } + if (router.get('mainAdminKerberosController.securityEnabled')) { + router.transitionTo('step5'); + return; } router.transitionTo('step6'); } @@ -266,7 +264,7 @@ module.exports = App.WizardRoute.extend({ } }, next: function (router) { - if (App.supports.automatedKerberos && router.get('mainAdminKerberosController.securityEnabled')) { + if (router.get('mainAdminKerberosController.securityEnabled')) { router.get('kerberosWizardStep2Controller').createKerberosAdminSession(router.get('kerberosWizardStep4Controller.stepConfigs')[0].get('configs')); } router.transitionTo('step6'); @@ -274,11 +272,11 @@ module.exports = App.WizardRoute.extend({ }), step6: Em.Route.extend({ - route: App.supports.automatedKerberos ? '/step6' : '/step5', + route: '/step6', connectOutlets: function (router, context) { console.log('in addService.step5:connectOutlets'); var controller = router.get('addServiceController'); - controller.setCurrentStep(App.supports.automatedKerberos ? '6' : '5'); + controller.setCurrentStep('6'); controller.dataLoading().done(function () { controller.loadAllPriorSteps().done(function () { var wizardStep8Controller = router.get('wizardStep8Controller'); @@ -289,7 +287,7 @@ module.exports = App.WizardRoute.extend({ }, back: function(router){ var controller = router.get('addServiceController'); - if (App.supports.automatedKerberos && router.get('mainAdminKerberosController.securityEnabled')) { + if (router.get('mainAdminKerberosController.securityEnabled')) { router.transitionTo('step5'); return; } @@ -322,17 +320,17 @@ module.exports = App.WizardRoute.extend({ }), step7: Em.Route.extend({ - route: App.supports.automatedKerberos ? '/step7' : '/step6', + route: '/step7', connectOutlets: function (router, context) { console.log('in addService.step6:connectOutlets'); var controller = router.get('addServiceController'); - controller.setCurrentStep(App.supports.automatedKerberos ? '7' : '6'); + controller.setCurrentStep('7'); controller.dataLoading().done(function () { controller.loadAllPriorSteps().done(function () { var wizardStep9Controller = router.get('wizardStep9Controller'); wizardStep9Controller.set('wizardController', controller); if (!App.get('testMode')) { //if test mode is ON don't disable prior steps link. - controller.setLowerStepsDisable(App.supports.automatedKerberos ? 7 : 6); + controller.setLowerStepsDisable(7); } controller.connectOutlet('wizardStep9', controller.get('content')); }); @@ -371,14 +369,14 @@ module.exports = App.WizardRoute.extend({ }), step8: Em.Route.extend({ - route: App.supports.automatedKerberos ? '/step8' : '/step7', + route: '/step8', connectOutlets: function (router, context) { console.log('in addService.step7:connectOutlets'); var controller = router.get('addServiceController'); - controller.setCurrentStep(App.supports.automatedKerberos ? '8' : '7'); + controller.setCurrentStep('8'); controller.dataLoading().done(function () { controller.loadAllPriorSteps().done(function () { - controller.setLowerStepsDisable(App.supports.automatedKerberos ? 8 : 7); + controller.setLowerStepsDisable(8); controller.connectOutlet('wizardStep10', controller.get('content')); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/28e68643/ambari-web/app/templates/main/service/add.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/service/add.hbs b/ambari-web/app/templates/main/service/add.hbs index 0e94b00..4a4da2e 100644 --- a/ambari-web/app/templates/main/service/add.hbs +++ b/ambari-web/app/templates/main/service/add.hbs @@ -32,17 +32,10 @@ <li {{bindAttr class="isStep2:active view.isStep2Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep2 target="controller"}}>{{t installer.step5.header}}</a></li> <li {{bindAttr class="isStep3:active view.isStep3Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep3 target="controller"}}>{{t installer.step6.header}}</a></li> <li {{bindAttr class="isStep4:active view.isStep4Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep4 target="controller"}}>{{t installer.step7.header}}</a></li> - {{! @TODO: replace/remove after Kerberos Automation supports }} - {{#if App.supports.automatedKerberos}} - <li {{bindAttr class="isStep5:active view.isStep5Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep5 target="controller"}}>{{t admin.kerberos.wizard.step4.header}}</a></li> - <li {{bindAttr class="isStep6:active view.isStep6Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep5 target="controller"}}>{{t installer.step8.header}}</a></li> - <li {{bindAttr class="isStep7:active view.isStep7Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep6 target="controller"}}>{{t installer.step9.header}}</a></li> - <li {{bindAttr class="isStep8:active view.isStep8Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep7 target="controller"}}>{{t installer.step10.header}}</a></li> - {{else}} - <li {{bindAttr class="isStep5:active view.isStep5Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep5 target="controller"}}>{{t installer.step8.header}}</a></li> - <li {{bindAttr class="isStep6:active view.isStep6Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep6 target="controller"}}>{{t installer.step9.header}}</a></li> - <li {{bindAttr class="isStep7:active view.isStep7Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep7 target="controller"}}>{{t installer.step10.header}}</a></li> - {{/if}} + <li {{bindAttr class="isStep5:active view.isStep5Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep5 target="controller"}}>{{t admin.kerberos.wizard.step4.header}}</a></li> + <li {{bindAttr class="isStep6:active view.isStep6Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep5 target="controller"}}>{{t installer.step8.header}}</a></li> + <li {{bindAttr class="isStep7:active view.isStep7Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep6 target="controller"}}>{{t installer.step9.header}}</a></li> + <li {{bindAttr class="isStep8:active view.isStep8Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep7 target="controller"}}>{{t installer.step10.header}}</a></li> </ul> </div> </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/28e68643/ambari-web/app/views/main/admin.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/admin.js b/ambari-web/app/views/main/admin.js index 317154d..089d593 100644 --- a/ambari-web/app/views/main/admin.js +++ b/ambari-web/app/views/main/admin.js @@ -34,19 +34,11 @@ App.MainAdminView = Em.View.extend({ label: Em.I18n.t('common.serviceAccounts') }); if (!App.get('isHadoopWindowsStack')) { - if (App.get('supports.automatedKerberos')) { - items.push({ - name: 'kerberos', - url: 'adminKerberos.index', - label: Em.I18n.t('common.kerberos') - }); - } else { - items.push({ - name: 'security', - url: 'adminSecurity.index', - label: Em.I18n.t('common.security') - }); - } + items.push({ + name: 'kerberos', + url: 'adminKerberos.index', + label: Em.I18n.t('common.kerberos') + }); } return items; }.property(''), http://git-wip-us.apache.org/repos/asf/ambari/blob/28e68643/ambari-web/app/views/main/menu.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/menu.js b/ambari-web/app/views/main/menu.js index 28338bf..40f9781 100644 --- a/ambari-web/app/views/main/menu.js +++ b/ambari-web/app/views/main/menu.js @@ -129,19 +129,11 @@ App.MainMenuView = Em.CollectionView.extend({ label: Em.I18n.t('common.serviceAccounts') }); if (!App.get('isHadoopWindowsStack')) { - if (App.get('supports.automatedKerberos')) { - categories.push({ - name: 'kerberos', - url: 'kerberos/', - label: Em.I18n.t('common.kerberos') - }); - } else { - categories.push({ - name: 'security', - url: 'security/', - label: Em.I18n.t('common.security') - }); - } + categories.push({ + name: 'kerberos', + url: 'kerberos/', + label: Em.I18n.t('common.kerberos') + }); } } return categories; http://git-wip-us.apache.org/repos/asf/ambari/blob/28e68643/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 79b0f21..bb04c71 100644 --- a/ambari-web/test/controllers/main/service/add_controller_test.js +++ b/ambari-web/test/controllers/main/service/add_controller_test.js @@ -423,4 +423,48 @@ describe('App.AddServiceController', function() { }, this); }); + describe('#checkSecurityStatus', function () { + + var cases = [ + { + securityEnabled: true, + skipConfigureIdentitiesStep: false, + isStep5Disabled: false, + title: 'security enabled' + }, + { + securityEnabled: false, + skipConfigureIdentitiesStep: true, + isStep5Disabled: true, + title: 'security disabled' + } + ]; + + beforeEach(function () { + addServiceController.setProperties({ + skipConfigureIdentitiesStep: false, + isStepDisabled: [ + Em.Object.create({ + step: 5, + value: false + }) + ] + }); + }); + + afterEach(function () { + App.router.get.restore(); + }); + + cases.forEach(function (item) { + it(item.title, function () { + sinon.stub(App.router, 'get').withArgs('mainAdminKerberosController.securityEnabled').returns(item.securityEnabled); + addServiceController.checkSecurityStatus(); + expect(addServiceController.get('skipConfigureIdentitiesStep')).to.equal(item.skipConfigureIdentitiesStep); + expect(addServiceController.get('isStepDisabled').findProperty('step', 5).get('value')).to.equal(item.isStep5Disabled); + }); + }); + + }); + }); http://git-wip-us.apache.org/repos/asf/ambari/blob/28e68643/ambari-web/test/views/main/admin_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/admin_test.js b/ambari-web/test/views/main/admin_test.js new file mode 100644 index 0000000..a62ff2d --- /dev/null +++ b/ambari-web/test/views/main/admin_test.js @@ -0,0 +1,87 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +var App = require('app'); +require('views/main/admin'); + +describe('App.MainAdminView', function () { + + var view; + + beforeEach(function () { + view = App.MainAdminView.create(); + }); + + describe('#categories', function () { + + var cases = [ + { + isHadoopWindowsStack: true, + categories: [ + { + name: 'stackAndUpgrade', + url: 'stackAndUpgrade.index', + label: Em.I18n.t('admin.stackUpgrade.title') + }, + { + name: 'adminServiceAccounts', + url: 'adminServiceAccounts', + label: Em.I18n.t('common.serviceAccounts') + } + ], + title: 'HDPWIN' + }, + { + isHadoopWindowsStack: false, + categories: [ + { + name: 'stackAndUpgrade', + url: 'stackAndUpgrade.index', + label: Em.I18n.t('admin.stackUpgrade.title') + }, + { + name: 'adminServiceAccounts', + url: 'adminServiceAccounts', + label: Em.I18n.t('common.serviceAccounts') + }, + { + name: 'kerberos', + url: 'adminKerberos.index', + label: Em.I18n.t('common.kerberos') + } + ], + title: 'not HDPWIN' + } + ]; + + afterEach(function () { + App.get.restore(); + }); + + cases.forEach(function (item) { + it(item.title, function () { + sinon.stub(App, 'get').withArgs('isHadoopWindowsStack').returns(item.isHadoopWindowsStack); + view.propertyDidChange('categories'); + expect(view.get('categories')).to.eql(item.categories); + }); + }); + + }); + +}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/28e68643/ambari-web/test/views/main/menu_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/menu_test.js b/ambari-web/test/views/main/menu_test.js index 5a8a3b1..1332bbe 100644 --- a/ambari-web/test/views/main/menu_test.js +++ b/ambari-web/test/views/main/menu_test.js @@ -48,4 +48,90 @@ describe('App.MainMenuView', function () { }); }); + + describe('#itemViewClass', function () { + + beforeEach(function () { + mainMenuView.reopen({ + content: [ + mainMenuView.get('itemViewClass').create({ + content: { + routing: 'dashboard' + } + }), + mainMenuView.get('itemViewClass').create({ + content: { + routing: 'admin' + } + }) + ] + }); + }); + + describe('#dropdownCategories', function () { + + var cases = [ + { + itemName: 'dashboard', + dropdownCategories: [], + title: 'not Admin item' + }, + { + itemName: 'admin', + isHadoopWindowsStack: true, + dropdownCategories: [ + { + name: 'stackAndUpgrade', + url: 'stack', + label: Em.I18n.t('admin.stackUpgrade.title') + }, + { + name: 'adminServiceAccounts', + url: 'serviceAccounts', + label: Em.I18n.t('common.serviceAccounts') + } + ], + title: 'Admin item, HDPWIN' + }, + { + itemName: 'admin', + isHadoopWindowsStack: false, + dropdownCategories: [ + { + name: 'stackAndUpgrade', + url: 'stack', + label: Em.I18n.t('admin.stackUpgrade.title') + }, + { + name: 'adminServiceAccounts', + url: 'serviceAccounts', + label: Em.I18n.t('common.serviceAccounts') + }, + { + name: 'kerberos', + url: 'kerberos/', + label: Em.I18n.t('common.kerberos') + } + ], + title: 'Admin item, not HDPWIN' + } + ]; + + afterEach(function () { + App.get.restore(); + }); + + cases.forEach(function (item) { + it(item.title, function () { + sinon.stub(App, 'get').withArgs('isHadoopWindowsStack').returns(item.isHadoopWindowsStack); + var menuItem = mainMenuView.get('content').findProperty('content.routing', item.itemName); + menuItem.propertyDidChange('dropdownCategories'); + expect(menuItem.get('dropdownCategories')).to.eql(item.dropdownCategories); + }); + }); + + }); + + }); + });