You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2015/06/18 15:48:32 UTC
[2/4] ambari git commit: AMBARI-11995 Remove add security wizard from
Ambari. (ababiichuk)
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/routes/add_security.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_security.js b/ambari-web/app/routes/add_security.js
deleted file mode 100644
index dce4bed..0000000
--- a/ambari-web/app/routes/add_security.js
+++ /dev/null
@@ -1,242 +0,0 @@
-/**
- * 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');
-
-module.exports = App.WizardRoute.extend({
- route: '/addSecurity',
- enter: function (router) {
- console.log('in /security/add:enter');
- var controller = router.get('addSecurityController');
- controller.dataLoading().done(Ember.run.next(function () {
- //after refresh check if the wizard is open then restore it
- if (router.get('mainAdminSecurityController').getAddSecurityWizardStatus() === 'RUNNING') {
- var mainAdminSecurityController = router.get('mainAdminSecurityController');
- var addSecurityController = router.get('addSecurityController');
- var currentStep = router.get('addSecurityController').get('currentStep');
- App.router.get('updateController').set('isWorking', false);
- App.ModalPopup.show({
- classNames: ['full-width-modal'],
- header: Em.I18n.t('admin.addSecurity.header'),
- bodyClass: App.MainAdminSecurityAddMenuView.extend({
- controllerBinding: 'App.router.addSecurityController'
- }),
- primary: Em.I18n.t('form.cancel'),
- secondary: null,
- showFooter: false,
-
- onClose: function () {
- var self = this;
- if (router.get('addSecurityController.currentStep') == 4) {
- var controller = router.get('mainAdminSecurityAddStep4Controller');
- if (!controller.get('isSubmitDisabled')) {
- router.get('mainAdminSecurityAddStep4Controller').clearStep();
- self.proceedOnClose();
- return;
- }
- var applyingConfigCommand = router.get('mainAdminSecurityAddStep4Controller.commands').findProperty('name', 'APPLY_CONFIGURATIONS');
- if (applyingConfigCommand) {
- if (!applyingConfigCommand.get('isCompleted')) {
- if (applyingConfigCommand.get('isStarted')) {
- App.showAlertPopup(Em.I18n.t('admin.security.applying.config.header'), Em.I18n.t('admin.security.applying.config.body'));
- } else {
- App.showConfirmationPopup(function () {
- self.proceedOnClose();
- }, Em.I18n.t('admin.addSecurity.enable.onClose'));
- }
- } else {
- App.showConfirmationPopup(function () {
- self.proceedOnClose();
- },
- Em.I18n.t('admin.addSecurity.enable.after.stage2.onClose')
- );
- }
- return;
- }
- }
- router.get('mainAdminSecurityAddStep4Controller').clearStep();
- App.db.setSecurityDeployCommands(undefined);
- self.proceedOnClose();
- },
- proceedOnClose: function () {
- var self = this;
- router.get('mainAdminSecurityAddStep4Controller').clearStep();
- router.get('addSecurityController.content.services').clear();
- router.set('addSecurityController.content.serviceConfigProperties', null);
- App.router.get('updateController').set('isWorking', true);
- mainAdminSecurityController.setAddSecurityWizardStatus(null);
- App.db.setSecurityDeployCommands(undefined);
- addSecurityController.finish();
- App.clusterStatus.setClusterStatus({
- clusterName: router.get('content.cluster.name'),
- clusterState: 'DEFAULT',
- localdb: App.db.data
- }, {alwaysCallback: function() {
- self.hide();
- router.transitionTo('adminSecurity.index');
- location.reload(); // this is needed because the ATS Component may be deleted in older HDP stacks.
- }});
- },
- didInsertElement: function () {
- this.fitHeight();
- }
- }
- );
-
- App.router.transitionTo('step' + currentStep);
- } else {
- router.transitionTo('adminSecurity.index');
- }
- }));
- },
-
- step1: Em.Route.extend({
- route: '/start',
- enter: function (router) {
- router.get('addSecurityController').setCurrentStep('1');
- if(!App.get('testMode')){
- App.clusterStatus.setClusterStatus({
- clusterName: this.get('clusterName'),
- clusterState: 'ADD_SECURITY_STEP_1',
- wizardControllerName: router.get('addSecurityController.name'),
- localdb: App.db.data
- });
- }
- },
-
- connectOutlets: function (router) {
- console.log('in addSecurity.step1:connectOutlets');
- var controller = router.get('addSecurityController');
- controller.dataLoading().done(function () {
- controller.loadAllPriorSteps();
- controller.connectOutlet('mainAdminSecurityAddStep1', controller.get('content'));
- })
- },
-
- unroutePath: function () {
- return false;
- },
-
- next: function (router) {
- var addSecurityController = router.get('addSecurityController');
- addSecurityController.get('content').set('serviceConfigProperties', null);
- App.db.setSecureConfigProperties(null);
- router.transitionTo('step2');
- }
- }),
-
- step2: Em.Route.extend({
- route: '/configure',
-
- enter: function (router) {
- router.get('addSecurityController').setCurrentStep('2');
- if(!App.get('testMode')){
- App.clusterStatus.setClusterStatus({
- clusterName: this.get('clusterName'),
- clusterState: 'ADD_SECURITY_STEP_2',
- wizardControllerName: router.get('addSecurityController.name'),
- localdb: App.db.data
- });
- }
- },
- connectOutlets: function (router) {
- console.log('in addSecurity.step2:connectOutlets');
- var controller = router.get('addSecurityController');
- controller.dataLoading().done(function () {
- controller.loadAllPriorSteps();
- controller.connectOutlet('mainAdminSecurityAddStep2', controller.get('content'));
- })
- },
- unroutePath: function () {
- return false;
- },
- back: Em.Router.transitionTo('step1'),
- next: function (router) {
- var addSecurityController = router.get('addSecurityController');
- var addSecurityStep2Controller = router.get('mainAdminSecurityAddStep2Controller');
- addSecurityController.saveServiceConfigProperties(addSecurityStep2Controller);
- router.transitionTo('step3');
- }
- }),
-
- step3: Em.Route.extend({
- route: '/principal_keytab',
-
- enter: function (router) {
- router.get('addSecurityController').setCurrentStep('3');
- if(!App.get('testMode')){
- App.clusterStatus.setClusterStatus({
- clusterName: this.get('clusterName'),
- clusterState: 'ADD_SECURITY_STEP_3',
- wizardControllerName: router.get('addSecurityController.name'),
- localdb: App.db.data
- });
- }
- },
- connectOutlets: function (router) {
- console.log('in addSecurity.step3:connectOutlets');
- var controller = router.get('addSecurityController');
- controller.dataLoading().done(function () {
- controller.loadAllPriorSteps();
- controller.connectOutlet('mainAdminSecurityAddStep3', controller.get('content'));
- })
- },
- unroutePath: function () {
- return false;
- },
- back: Em.Router.transitionTo('step2'),
- next: function (router) {
- App.db.setSecurityDeployCommands(undefined);
- router.transitionTo('step4');
- }
- }),
-
- step4: Em.Route.extend({
- route: '/apply',
-
- enter: function (router) {
- router.get('addSecurityController').setCurrentStep('4');
- },
-
- connectOutlets: function (router) {
- console.log('in addSecurity.step4:connectOutlets');
- var controller = router.get('addSecurityController');
- controller.dataLoading().done(function () {
- controller.loadAllPriorSteps();
- controller.setLowerStepsDisable(4);
- controller.connectOutlet('mainAdminSecurityAddStep4', controller.get('content'));
- })
- },
- unroutePath: function () {
- return false;
- },
- back: function (router, context) {
- var controller = router.get('mainAdminSecurityAddStep4Controller');
- if (!controller.get('isBackBtnDisabled')) {
- router.transitionTo('step3');
- }
- },
- done: function (router, context) {
- var controller = router.get('mainAdminSecurityAddStep4Controller');
- if (!controller.get('isSubmitDisabled')) {
- $(context.currentTarget).parents("#modal").find(".close").trigger('click');
- }
- }
- })
-
-});
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 78d8243..c410d15 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -356,43 +356,6 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
}
}),
- adminSecurity: Em.Route.extend({
- route: '/security',
- enter: function (router) {
- router.set('mainAdminController.category', "security");
- var controller = router.get('mainAdminSecurityController');
- if (!(controller.getAddSecurityWizardStatus() === 'RUNNING') && !(controller.getDisableSecurityStatus() === 'RUNNING')) {
- Em.run.next(function () {
- router.transitionTo('adminSecurity.index');
- });
- } else if (controller.getAddSecurityWizardStatus() === 'RUNNING') {
- Em.run.next(function () {
- router.transitionTo('adminAddSecurity');
- });
- } else if (controller.getDisableSecurityStatus() === 'RUNNING') {
- Em.run.next(function () {
- router.transitionTo('disableSecurity');
- });
- }
- },
-
- index: Em.Route.extend({
- route: '/',
- connectOutlets: function (router, context) {
- var controller = router.get('mainAdminController');
- controller.set('category', "security");
- controller.connectOutlet('mainAdminSecurity');
- }
- }),
-
- addSecurity: function (router, object) {
- router.get('mainAdminSecurityController').setAddSecurityWizardStatus('RUNNING');
- router.transitionTo('adminAddSecurity');
- },
-
- adminAddSecurity: require('routes/add_security')
- }),
-
adminKerberos: Em.Route.extend({
route: '/kerberos',
index: Em.Route.extend({
@@ -436,7 +399,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
// otherwise show confirmation window
App.showConfirmationPopup(function () {
self.proceedOnClose();
- }, Em.I18n.t('admin.addSecurity.disable.onClose'));
+ }, Em.I18n.t('admin.security.disable.onClose'));
}
} else {
self.proceedOnClose();
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/templates/main/admin/kerberos/notify_security_off_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/kerberos/notify_security_off_popup.hbs b/ambari-web/app/templates/main/admin/kerberos/notify_security_off_popup.hbs
new file mode 100644
index 0000000..a68102a
--- /dev/null
+++ b/ambari-web/app/templates/main/admin/kerberos/notify_security_off_popup.hbs
@@ -0,0 +1,21 @@
+{{!
+* 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.
+}}
+
+<div class="alert">
+ {{t admin.security.disable.popup.body}}
+</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/templates/main/admin/security.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/security.hbs b/ambari-web/app/templates/main/admin/security.hbs
deleted file mode 100644
index 2355937..0000000
--- a/ambari-web/app/templates/main/admin/security.hbs
+++ /dev/null
@@ -1,43 +0,0 @@
-{{!
-* 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.
-}}
-{{#if dataIsLoaded}}
- {{#if securityEnabled}}
- <div>
- <p class="text-success">{{t admin.security.enabled}}
- {{#isAccessible ADMIN}}
- <a class="btn btn-padding btn-warning admin-disable-security-btn" {{bindAttr disabled="isSubmitDisabled"}} {{action notifySecurityOffPopup target="controller"}}>{{t admin.security.button.disable}}
- </a> <br/>
- {{/isAccessible}}
- </p>
- </div>
- <div id="serviceConfig">
- {{view App.ServicesConfigView}}
- </div>
- {{else}}
- <div>
- <p class="muted">{{t admin.security.disabled}}
- {{#isAccessible ADMIN}}
- <a class="btn btn-padding btn-success admin-enable-security-btn" {{action addSecurity}}>{{t admin.security.button.enable}}
- </a> <br/>
- {{/isAccessible}}
- </p>
- </div>
- {{/if}}
-{{else}}
- <div class="spinner"></div>
-{{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/templates/main/admin/security/add/menu.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/security/add/menu.hbs b/ambari-web/app/templates/main/admin/security/add/menu.hbs
deleted file mode 100644
index fe52c8d..0000000
--- a/ambari-web/app/templates/main/admin/security/add/menu.hbs
+++ /dev/null
@@ -1,42 +0,0 @@
-{{!
-* 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.
-}}
-
-
-<div class="wizard" id="enable_security">
- <div class="container">
- <div class="container-fluid">
- <div class="row-fluid">
- <div class="span3">
- <!--Sidebar content-->
- <div class="well">
- <ul class="nav nav-pills nav-stacked">
- <li class="nav-header">{{t admin.addSecurity.header}}</li>
- <li {{bindAttr class="isStep1:active view.isStep1Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep1 target="controller"}}>{{t admin.security.step1.header}}</a></li>
- <li {{bindAttr class="isStep2:active view.isStep2Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep2 target="controller"}}>{{t admin.security.step2.header}}</a></li>
- <li {{bindAttr class="isStep3:active view.isStep3Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep3 target="controller"}}>{{t admin.security.step3.header}}</a></li>
- <li {{bindAttr class="isStep4:active view.isStep4Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep4 target="controller"}}>{{t admin.security.step4.header}}</a></li>
- </ul>
- </div>
- </div>
- <div class="wizard-content well span9">
- {{outlet}}
- </div>
- </div>
- </div>
- </div>
-</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/templates/main/admin/security/add/step1.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/security/add/step1.hbs b/ambari-web/app/templates/main/admin/security/add/step1.hbs
deleted file mode 100644
index a8684c8..0000000
--- a/ambari-web/app/templates/main/admin/security/add/step1.hbs
+++ /dev/null
@@ -1,38 +0,0 @@
-{{!
-* 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.
-}}
-
-<h2>{{t admin.security.step1.header}}</h2>
-<p class="alert">
- {{t admin.security.step1.body.header}}
-</p>
-<div class="alert alert-info">
- <ol>
- <li>{{t admin.security.step1.body.instruction1}}</li>
- <li>{{t admin.security.step1.body.instruction2}}</li>
- <li>{{t admin.security.step1.body.instruction3}}</li>
- <li>{{t admin.security.step1.body.instruction4}}</li>
- {{#if view.shouldRemoveATS}}
- <li>{{{t admin.security.step1.body.instruction5}}}</li>
- {{/if}}
- </ol>
-</div>
-
-
-<div class="btn-area">
- <a class="btn btn-success pull-right" {{action "next"}}>{{t common.next}} →</a>
-</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/templates/main/admin/security/add/step2.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/security/add/step2.hbs b/ambari-web/app/templates/main/admin/security/add/step2.hbs
deleted file mode 100644
index c900fcd..0000000
--- a/ambari-web/app/templates/main/admin/security/add/step2.hbs
+++ /dev/null
@@ -1,34 +0,0 @@
-{{!
-* 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.
-}}
-
-<h2>{{t admin.security.step2.header}}</h2>
-
-<div id="serviceConfig">
- <p class="alert alert-info">
- {{t admin.security.step2.body.header}}
- </p>
- {{view App.ServicesConfigView}}
-
- <div class="btn-area">
- <a class="btn" {{action back}}>← {{t common.back}}</a>
-
- <button class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}}
- {{action next}}>{{t common.next}} →
- </button>
- </div>
-</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/templates/main/admin/security/add/step3.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/security/add/step3.hbs b/ambari-web/app/templates/main/admin/security/add/step3.hbs
deleted file mode 100644
index b57c6fd..0000000
--- a/ambari-web/app/templates/main/admin/security/add/step3.hbs
+++ /dev/null
@@ -1,31 +0,0 @@
-{{!
-* 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.
-}}
-
-<h2>{{t admin.security.step3.header}}</h2>
-<div class="alert alert-info">{{t admin.security.step3.notice}}</div>
-{{#if isLoaded}}
- <div class="btn-area">
- <a class="btn" {{action back}}>← {{t common.back}}</a>
- <div class="pull-right">
- <button class="btn btn-info" {{action doDownloadCsv target="controller"}}>{{t admin.security.step3.downloadCSV}}</button>
- <button class="btn btn-success" {{bindAttr disabled="isSubmitDisabled"}} {{action next}}>{{t common.apply}} →</button>
- </div>
- </div>
-{{else}}
- <div class="spinner"></div>
-{{/if}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/templates/main/admin/security/add/step4.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/security/add/step4.hbs b/ambari-web/app/templates/main/admin/security/add/step4.hbs
deleted file mode 100644
index 7736c0b..0000000
--- a/ambari-web/app/templates/main/admin/security/add/step4.hbs
+++ /dev/null
@@ -1,32 +0,0 @@
-{{!
-* 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.
-}}
-
-<h2>{{t admin.security.step4.header}}</h2>
-
-{{#if view.message}}
- <p {{bindAttr class="view.msgColor :alert"}}>{{view.message}}</p>
-{{/if}}
-
-{{view App.MainServiceReconfigureView}}
-
-<div class="btn-area">
- <a class="btn" {{bindAttr disabled="isBackBtnDisabled"}}
- {{action back}}>← {{t common.back}}</a>
- <a class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}}
- {{action done}}>{{t common.done}} </a>
-</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/templates/main/admin/security/disable.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/security/disable.hbs b/ambari-web/app/templates/main/admin/security/disable.hbs
deleted file mode 100644
index 3f2fb21..0000000
--- a/ambari-web/app/templates/main/admin/security/disable.hbs
+++ /dev/null
@@ -1,26 +0,0 @@
-{{!
-* 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.
-}}
-
-{{#if view.message}}
- <p {{bindAttr class="view.msgColor :alert"}}>{{view.message}}</p>
-{{/if}}
-{{view App.MainServiceReconfigureView}}
-<div class="btn-area">
- <button class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}}
- {{action done}}>{{t common.done}} </button>
-</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/templates/main/admin/security/notify_security_off_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/security/notify_security_off_popup.hbs b/ambari-web/app/templates/main/admin/security/notify_security_off_popup.hbs
deleted file mode 100644
index a68102a..0000000
--- a/ambari-web/app/templates/main/admin/security/notify_security_off_popup.hbs
+++ /dev/null
@@ -1,21 +0,0 @@
-{{!
-* 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.
-}}
-
-<div class="alert">
- {{t admin.security.disable.popup.body}}
-</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/utils/host_progress_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/host_progress_popup.js b/ambari-web/app/utils/host_progress_popup.js
index 6c75340..97ac87c 100644
--- a/ambari-web/app/utils/host_progress_popup.js
+++ b/ambari-web/app/utils/host_progress_popup.js
@@ -922,10 +922,6 @@ App.HostPopup = Em.Object.create({
*/
switchLevel: function (levelName) {
var dataSourceController = this.get('controller.dataSourceController');
- var securityControllers = [
- 'mainAdminSecurityDisableController',
- 'mainAdminSecurityAddStep4Controller'
- ];
if (this.get("controller.isBackgroundOperations")) {
var levelInfo = dataSourceController.get('levelInfo');
levelInfo.set('taskId', this.get('openedTaskId'));
@@ -944,13 +940,6 @@ App.HostPopup = Em.Object.create({
} else {
this.set('taskCategory', this.get('categories').findProperty('value','all'));
}
- } else if (securityControllers.contains(dataSourceController.get('name'))) {
- if (levelName === 'TASK_DETAILS') {
- this.set('isLevelLoaded', false);
- dataSourceController.startUpdatingTask(this.get('controller.currentServiceId'), this.get('openedTaskId'));
- } else {
- dataSourceController.stopUpdatingTask(this.get('controller.currentServiceId'));
- }
} else if (dataSourceController.get('name') == 'highAvailabilityProgressPopupController') {
if (levelName === 'TASK_DETAILS') {
this.set('isLevelLoaded', false);
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index d796441..f766d84 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -177,14 +177,6 @@ require('views/main/admin/kerberos/step6_view');
require('views/main/admin/kerberos/step7_view');
require('views/main/admin/kerberos/step8_view');
-require('views/main/admin/security');
-require('views/main/admin/security/disable');
-require('views/main/admin/security/add/menu');
-require('views/main/admin/security/add/step1');
-require('views/main/admin/security/add/step2');
-require('views/main/admin/security/add/step3');
-require('views/main/admin/security/add/step4');
-
require('views/main/dashboard');
require('views/main/dashboard/cluster_metrics/cpu');
require('views/main/dashboard/cluster_metrics/load');
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/views/common/configs/service_configs_by_category_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_configs_by_category_view.js b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
index 47722e1..41e59fd 100644
--- a/ambari-web/app/views/common/configs/service_configs_by_category_view.js
+++ b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
@@ -147,7 +147,7 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
console.log("Unable to load modification handler for ", serviceId);
}
if (serviceConfigModificationHandler != null) {
- var securityEnabled = App.router.get('mainAdminSecurityController.securityEnabled');
+ var securityEnabled = App.router.get('mainAdminKerberosController.securityEnabled');
this.affectedProperties = serviceConfigModificationHandler.getDependentConfigChanges(changedProperty, this.get("controller.selectedServiceNames"), stepConfigs, securityEnabled);
}
changedProperty.set("editDone", false); // Turn off flag
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/views/main/admin/security.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/security.js b/ambari-web/app/views/main/admin/security.js
deleted file mode 100644
index 4dcd0af..0000000
--- a/ambari-web/app/views/main/admin/security.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * 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');
-
-App.MainAdminSecurityView = Em.View.extend({
- templateName: require('templates/main/admin/security'),
- didInsertElement: function() {
- this.set('controller.dataIsLoaded',false);
- this.get('controller').setSecurityStatus();
- },
-
- configProperties: function () {
- var configProperties = [];
- var stepConfigs = this.get('controller.stepConfigs');
- if (stepConfigs) {
- this.get('controller.stepConfigs').mapProperty('configs').forEach(function (_stepProperties) {
- _stepProperties.forEach(function (_stepConfigProperty) {
- configProperties.pushObject(_stepConfigProperty);
- }, this);
- }, this);
- }
- return configProperties;
- }.property('controller.stepConfigs.@each.configs'),
-
- realmName: function () {
- return this.get('configProperties').findProperty('name', 'kerberos_domain');
- }.property('configProperties'),
-
- onRealmNameChange: function () {
- this.get('configProperties').forEach(function (_property) {
- if (/principal_name?$/.test(_property.get('name'))) {
- _property.set('unit', '@' + this.get('realmName.value'));
- }
- }, this);
- }.observes('realmName.value')
-
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/views/main/admin/security/add/menu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/security/add/menu.js b/ambari-web/app/views/main/admin/security/add/menu.js
deleted file mode 100644
index 628c6ed..0000000
--- a/ambari-web/app/views/main/admin/security/add/menu.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * 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');
-
-App.MainAdminSecurityAddMenuView = Em.View.extend(App.WizardMenuMixin, {
-
- templateName: require('templates/main/admin/security/add/menu')
-
-});
-
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/views/main/admin/security/add/step1.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/security/add/step1.js b/ambari-web/app/views/main/admin/security/add/step1.js
deleted file mode 100644
index 6ef6996..0000000
--- a/ambari-web/app/views/main/admin/security/add/step1.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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');
-
-App.MainAdminSecurityAddStep1View = Em.View.extend({
-
- templateName: require('templates/main/admin/security/add/step1'),
- shouldRemoveATS: false,
- didInsertElement: function(){
- var shouldRemoveATS = this.get('controller').shouldRemoveATS();
- this.set('shouldRemoveATS', shouldRemoveATS);
- }
-
-});
-
-
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/views/main/admin/security/add/step2.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/security/add/step2.js b/ambari-web/app/views/main/admin/security/add/step2.js
deleted file mode 100644
index c97203f..0000000
--- a/ambari-web/app/views/main/admin/security/add/step2.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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');
-
-App.MainAdminSecurityAddStep2View = Em.View.extend({
-
- templateName: require('templates/main/admin/security/add/step2'),
-
- configProperties: function () {
- var configProperties = [];
- var stepConfigs = this.get('controller.stepConfigs');
- if (stepConfigs) {
- this.get('controller.stepConfigs').mapProperty('configs').forEach(function (_stepProperties) {
- _stepProperties.forEach(function (_stepConfigProperty) {
- configProperties.pushObject(_stepConfigProperty);
- }, this);
- }, this);
- }
- return configProperties;
- }.property('controller.stepConfigs.@each.configs'),
-
- realmName: function () {
- return this.get('configProperties').findProperty('name', 'kerberos_domain');
- }.property('configProperties'),
-
- onRealmNameChange: function () {
- this.get('configProperties').forEach(function (_property) {
- if (/principal_name?$/.test(_property.get('name')) || _property.get('name') == 'namenode_principal_name_falcon') {
- _property.set('unit', '@' + this.get('realmName.value'));
- }
- }, this);
- }.observes('realmName.value')
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/views/main/admin/security/add/step3.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/security/add/step3.js b/ambari-web/app/views/main/admin/security/add/step3.js
deleted file mode 100644
index b7ad4fc..0000000
--- a/ambari-web/app/views/main/admin/security/add/step3.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * 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');
-
-App.MainAdminSecurityAddStep3View = Em.View.extend({
- templateName: require('templates/main/admin/security/add/step3'),
- didInsertElement: function() {
- this.set('controller.isLoaded', false);
- this.get('controller').loadHosts();
- }
-});
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/views/main/admin/security/add/step4.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/security/add/step4.js b/ambari-web/app/views/main/admin/security/add/step4.js
deleted file mode 100644
index 597814f..0000000
--- a/ambari-web/app/views/main/admin/security/add/step4.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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');
-
-App.MainAdminSecurityAddStep4View = Em.View.extend({
-
- templateName: require('templates/main/admin/security/add/step4'),
- didInsertElement: function () {
- this.get('controller').loadStep();
- },
- msgColor: 'alert-info',
- message: Em.I18n.t('admin.security.step4.body.header'),
- onResult: function () {
- var stopServiceCommand = this.get('controller.commands').findProperty('name', 'STOP_SERVICES');
- var applyConfigCommand = this.get('controller.commands').findProperty('name', 'APPLY_CONFIGURATIONS');
- if (applyConfigCommand && applyConfigCommand.get('isSuccess') === true ) {
- this.set('message', Em.I18n.t('admin.security.step4.body.success.header'));
- this.set('msgColor','alert-success');
- } else if ((stopServiceCommand && stopServiceCommand.get('isError') === true) || (applyConfigCommand && applyConfigCommand.get('isError') === true)) {
- this.set('message', Em.I18n.t('admin.security.step4.body.failure.header'));
- this.set('msgColor','alert-error');
- } else {
- this.set('message', Em.I18n.t('admin.security.step4.body.header'));
- this.set('msgColor','alert-info');
- }
- }.observes('controller.commands.@each.isCompleted')
-
-});
-
-App.StageStatusView = Em.View.extend({
- tagName: 'tr',
- hasStarted: null,
- classNameBindings: ['faintText']
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/views/main/admin/security/disable.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/security/disable.js b/ambari-web/app/views/main/admin/security/disable.js
deleted file mode 100644
index 5d578a1..0000000
--- a/ambari-web/app/views/main/admin/security/disable.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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');
-
-App.MainAdminSecurityDisableView = Em.View.extend({
-
- templateName: require('templates/main/admin/security/disable'),
-
- didInsertElement: function () {
- this.get('controller').loadStep();
- },
- msgColor: 'alert-info',
- message: Em.I18n.t('admin.security.disable.body.header'),
- onResult: function () {
- var stopServiceCommand = this.get('controller.commands').findProperty('name', 'STOP_SERVICES');
- var applyConfigCommand = this.get('controller.commands').findProperty('name', 'APPLY_CONFIGURATIONS');
- if (applyConfigCommand && applyConfigCommand.get('isSuccess') === true ) {
- this.set('message', Em.I18n.t('admin.security.disable.body.success.header'));
- this.set('msgColor', 'alert-success');
- } else if ((stopServiceCommand && stopServiceCommand.get('isError') === true) || (applyConfigCommand && applyConfigCommand.get('isError') === true)) {
- this.set('message', Em.I18n.t('admin.security.disable.body.failure.header'));
- this.set('msgColor', 'alert-error');
- } else {
- this.set('message', Em.I18n.t('admin.security.disable.body.header'));
- this.set('msgColor', 'alert-info');
- }
- }.observes('controller.commands.@each.isCompleted')
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/test/controllers/main/admin/security/add/addSecurity_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/security/add/addSecurity_controller_test.js b/ambari-web/test/controllers/main/admin/security/add/addSecurity_controller_test.js
deleted file mode 100644
index c48760d..0000000
--- a/ambari-web/test/controllers/main/admin/security/add/addSecurity_controller_test.js
+++ /dev/null
@@ -1,256 +0,0 @@
-/**
- * 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('mixins/common/localStorage');
-require('controllers/wizard');
-require('controllers/main/admin/security/add/addSecurity_controller');
-require('models/cluster');
-require('models/service');
-
-describe('App.AddSecurityController', function () {
-
- var controller = App.AddSecurityController.create({
- currentStep: null,
- content: Em.Object.create({
- isATSInstalled: true,
- services: [],
- isNnHa: 'false',
- serviceConfigProperties: null
- })
- });
-
- describe('#installedServices', function () {
-
- afterEach(function () {
- App.Service.find.restore();
- });
-
- it('No installed services', function () {
- sinon.stub(App.Service, 'find', function () {
- return [];
- });
- expect(controller.get('installedServices')).to.eql([]);
- });
- it('One service installed', function () {
- sinon.stub(App.Service, 'find', function () {
- return [Em.Object.create({serviceName: 'HDFS'})];
- });
- Em.propertyDidChange(controller, 'installedServices');
- expect(controller.get('installedServices')).to.eql(['HDFS']);
- });
- });
-
- describe('#loadAllPriorSteps()', function () {
-
- beforeEach(function () {
- sinon.stub(controller, 'loadServiceConfigs', Em.K);
- sinon.stub(controller, 'loadServices', Em.K);
- sinon.stub(controller, 'loadNnHaStatus', Em.K);
- });
- afterEach(function () {
- controller.loadServiceConfigs.restore();
- controller.loadServices.restore();
- controller.loadNnHaStatus.restore();
- });
-
- var commonSteps = ['4', '3', '2'];
- commonSteps.forEach(function (step) {
- it('Current step - ' + step, function () {
- controller.set('currentStep', step);
- controller.loadAllPriorSteps();
- expect(controller.loadServiceConfigs.calledOnce).to.be.true;
- expect(controller.loadServices.calledOnce).to.be.true;
- expect(controller.loadNnHaStatus.calledOnce).to.be.true;
- });
- });
- it('Current step - 1', function () {
- controller.set('currentStep', '1');
- controller.loadAllPriorSteps();
- expect(controller.loadServiceConfigs.called).to.be.false;
- expect(controller.loadServices.calledOnce).to.be.true;
- expect(controller.loadNnHaStatus.calledOnce).to.be.true;
- });
- });
-
- describe('#loadServices()', function () {
- it('No installed services', function () {
- controller.reopen({
- installedServices: [],
- secureServices: [
- {serviceName: 'GENERAL'}
- ]
- });
- controller.loadServices();
- expect(controller.get('content.services').mapProperty('serviceName')).to.eql(['GENERAL']);
- });
- it('Installed service does not match the secure one', function () {
- controller.set('installedServices', ["HDFS"]);
- controller.loadServices();
- expect(controller.get('content.services').mapProperty('serviceName')).to.eql(['GENERAL']);
- });
- it('Installed service matches the secure one', function () {
- controller.set('secureServices', [
- {serviceName: 'GENERAL'},
- {serviceName: 'HDFS'}
- ]);
- controller.loadServices();
- expect(controller.get('content.services').mapProperty('serviceName')).to.eql(['GENERAL', 'HDFS']);
- });
- });
-
- describe('#loadNnHaStatus()', function () {
- afterEach(function () {
- App.db.getIsNameNodeHa.restore();
- });
- it('NameNode HA is off', function () {
- sinon.stub(App.db, 'getIsNameNodeHa', function () {
- return false;
- });
- controller.loadNnHaStatus();
- expect(controller.get('content.isNnHa')).to.be.false;
- });
- it('NameNode HA is on', function () {
- sinon.stub(App.db, 'getIsNameNodeHa', function () {
- return true;
- });
- controller.loadNnHaStatus();
- expect(controller.get('content.isNnHa')).to.be.true;
- });
- });
-
- describe('#loadServiceConfigs()', function () {
- afterEach(function () {
- App.db.getSecureConfigProperties.restore();
- });
- it('SecureConfigProperties is empty', function () {
- sinon.stub(App.db, 'getSecureConfigProperties', function () {
- return [];
- });
- controller.loadServiceConfigs();
- expect(controller.get('content.serviceConfigProperties')).to.eql([]);
- });
- it('SecureConfigProperties has one config', function () {
- sinon.stub(App.db, 'getSecureConfigProperties', function () {
- return [{}];
- });
- controller.loadServiceConfigs();
- expect(controller.get('content.serviceConfigProperties')).to.eql([{}]);
- });
- });
-
- describe('#getConfigOverrides()', function () {
- var testCases = [
- {
- title: 'overrides is null',
- configProperty: Em.Object.create({overrides: null}),
- result: null
- },
- {
- title: 'overrides is empty',
- configProperty: Em.Object.create({overrides: []}),
- result: null
- },
- {
- title: 'overrides has one override',
- configProperty: Em.Object.create({
- overrides: [
- Em.Object.create({
- value: 'value1',
- selectedHostOptions: []
- })
- ]
- }),
- result: [{
- value: 'value1',
- hosts: []
- }]
- },
- {
- title: 'overrides has one override with hosts',
- configProperty: Em.Object.create({
- overrides: [
- Em.Object.create({
- value: 'value1',
- selectedHostOptions: ['host1']
- })
- ]
- }),
- result: [{
- value: 'value1',
- hosts: ['host1']
- }]
- }
- ];
-
- testCases.forEach(function(test){
- it(test.title, function () {
- expect(controller.getConfigOverrides(test.configProperty)).to.eql(test.result);
- });
- });
- });
-
- describe('#saveServiceConfigProperties()', function () {
- var testCases = [
- {
- title: 'stepConfigs is empty',
- stepController: Em.Object.create({
- stepConfigs: []
- }),
- result: []
- },
- {
- title: 'No configs in service',
- stepController: Em.Object.create({
- stepConfigs: [
- Em.Object.create({configs: []})
- ]
- }),
- result: []
- }
- ];
-
- testCases.forEach(function (test) {
- it(test.title, function () {
- sinon.stub(App.db, 'setSecureConfigProperties', Em.K);
- controller.saveServiceConfigProperties(test.stepController);
- expect(App.db.setSecureConfigProperties.calledWith(test.result)).to.be.true;
- expect(controller.get('content.serviceConfigProperties')).to.eql(test.result);
- App.db.setSecureConfigProperties.restore();
- });
- });
- it('Service has config', function () {
- var stepController = Em.Object.create({
- stepConfigs: [
- Em.Object.create({configs: [
- Em.Object.create({
- name: 'config1',
- value: 'value1'
- })
- ]})
- ]
- });
- sinon.stub(App.db, 'setSecureConfigProperties', Em.K);
- controller.saveServiceConfigProperties(stepController);
- expect(App.db.setSecureConfigProperties.calledOnce).to.be.true;
- expect(controller.get('content.serviceConfigProperties').mapProperty('name')).to.eql(['config1']);
- App.db.setSecureConfigProperties.restore();
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/test/controllers/main/admin/security/add/step1_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/security/add/step1_test.js b/ambari-web/test/controllers/main/admin/security/add/step1_test.js
deleted file mode 100644
index 5f836ae..0000000
--- a/ambari-web/test/controllers/main/admin/security/add/step1_test.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * 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('controllers/main/admin/security/add/step1');
-require('models/service');
-var controller;
-describe('App.MainAdminSecurityAddStep1Controller', function () {
-
- beforeEach(function () {
- controller = App.MainAdminSecurityAddStep1Controller.create({
- content: {}
- });
- });
-
- describe('#shouldRemoveATS()', function () {
-
- var tests = Em.A([
- {
- doesATSSupportKerberos: true,
- isATSInstalled: true,
- e: false
- },
- {
- doesATSSupportKerberos: true,
- isATSInstalled: false,
- e: false
- },
- {
- doesATSSupportKerberos: false,
- isATSInstalled: true,
- e: true
- },
- {
- doesATSSupportKerberos: false,
- isATSInstalled: false,
- e: false
- }
- ]);
-
- tests.forEach(function (test) {
- it('', function () {
- controller.set('content.isATSInstalled', test.isATSInstalled);
- sinon.stub(App, 'get', function (k) {
- if ('doesATSSupportKerberos' === k) return test.doesATSSupportKerberos;
- return Em.get(App, k);
- });
- var result = controller.shouldRemoveATS();
- App.get.restore();
- expect(result).to.equal(test.e);
- });
- });
-
- });
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/test/controllers/main/admin/security/add/step2_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/security/add/step2_test.js b/ambari-web/test/controllers/main/admin/security/add/step2_test.js
deleted file mode 100644
index d932392..0000000
--- a/ambari-web/test/controllers/main/admin/security/add/step2_test.js
+++ /dev/null
@@ -1,718 +0,0 @@
-/**
- * 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('controllers/main/admin/security/add/step2');
-require('models/service');
-
-describe('App.MainAdminSecurityAddStep2Controller', function () {
-
- var controller = App.MainAdminSecurityAddStep2Controller.create({
- content: {}
- });
-
- describe('#clearStep()', function () {
- it('Info is empty', function () {
- controller.set('stepConfigs', []);
- controller.set('securityUsers', []);
- controller.clearStep();
- expect(controller.get('stepConfigs')).to.be.empty;
- expect(controller.get('securityUsers')).to.be.empty;
- });
- it('Info filled', function () {
- controller.set('stepConfigs', [1]);
- controller.set('securityUsers', [1]);
- controller.clearStep();
- expect(controller.get('stepConfigs')).to.be.empty;
- expect(controller.get('securityUsers')).to.be.empty;
- });
- });
-
- describe('#isSubmitDisabled', function () {
- var tests = [
- {
- config: [
- {
- showConfig: true,
- errorCount: 0
- }
- ],
- m: 'All show configs, nothing with errors',
- e: false
- },
- {
- config: [
- {
- showConfig: true,
- errorCount: 0
- },
- {
- showConfig: true,
- errorCount: 1
- }
- ],
- m: 'All show configs, 1 with errors',
- e: true
- },
- {
- config: [
- {
- showConfig: true,
- errorCount: 0
- },
- {
- showConfig: false,
- errorCount: 1
- }
- ],
- m: '1 has errors but not visible',
- e: false
- },
- {
- config: [
- {
- showConfig: false,
- errorCount: 0
- },
- {
- showConfig: false,
- errorCount: 1
- }
- ],
- m: '1 has errors, all not visible',
- e: false
- },
- {
- config: [
- {
- showConfig: true,
- errorCount: 1
- },
- {
- showConfig: true,
- errorCount: 1
- }
- ],
- m: 'All has errors, all not visible',
- e: true
- }
- ];
- tests.forEach(function (test) {
- it(test.m, function () {
- controller.set('stepConfigs', test.config);
- expect(controller.get('isSubmitDisabled')).to.equal(test.e);
- });
- });
- });
-
- describe('#loadStep()', function () {
- it('load step', function () {
- controller.set('stepConfigs', [
- {}
- ]);
- controller.set('securityUsers', ['user1']);
- controller.set('content.services', ['service1']);
- controller.set('content.serviceConfigProperties', ['config1']);
- sinon.stub(controller, 'clearStep', Em.K);
- sinon.stub(controller, 'loadUsers', Em.K);
- sinon.stub(controller, 'addUserPrincipals', Em.K);
- sinon.stub(controller, 'renderServiceConfigs', Em.K);
- sinon.stub(controller, 'changeCategoryOnHa', Em.K);
- sinon.stub(controller, 'setStoredConfigsValue', Em.K);
- sinon.stub(controller, 'addHostPrincipals', Em.K);
- sinon.stub(App.Service, 'find', function () {
- return [
- {serviceName: 'HDFS'}
- ];
- });
-
- controller.loadStep();
- expect(controller.get('installedServices')).to.eql(['HDFS']);
- expect(controller.clearStep.calledOnce).to.be.true;
- expect(controller.loadUsers.calledOnce).to.be.true;
- expect(controller.addUserPrincipals.calledWith(['service1'], ['user1'])).to.be.true;
- expect(controller.addHostPrincipals.calledOnce).to.be.true;
- expect(controller.renderServiceConfigs.calledWith(['service1'])).to.be.true;
- expect(controller.changeCategoryOnHa.calledWith(['service1'], [{}])).to.be.true;
- expect(controller.setStoredConfigsValue.calledWith(['config1'])).to.be.true;
-
- controller.clearStep.restore();
- controller.loadUsers.restore();
- controller.addUserPrincipals.restore();
- controller.renderServiceConfigs.restore();
- controller.changeCategoryOnHa.restore();
- controller.setStoredConfigsValue.restore();
- controller.addHostPrincipals.restore();
- App.Service.find.restore();
- });
- });
-
- describe('#setStoredConfigsValue()', function () {
- it('storedConfigProperties is null', function () {
- expect(controller.setStoredConfigsValue(null)).to.be.false;
- });
- it('stepConfigs is empty', function () {
- controller.set('stepConfigs', []);
- expect(controller.setStoredConfigsValue([])).to.be.true;
- expect(controller.get('stepConfigs')).to.be.empty;
- });
- it('stepConfig has no configs', function () {
- controller.set('stepConfigs', [Em.Object.create({
- configs: []
- })]);
- expect(controller.setStoredConfigsValue([])).to.be.true;
- expect(controller.get('stepConfigs')[0].get('configs')).to.be.empty;
- });
- it('stepConfig has no stored configs', function () {
- controller.set('stepConfigs', [Em.Object.create({
- configs: [Em.Object.create({
- name: 'config1',
- value: 'value1'
- })]
- })]);
- var storedConfigProperties = [
- {
- name: 'config2',
- value: "value2"
- }
- ];
- expect(controller.setStoredConfigsValue(storedConfigProperties)).to.be.true;
- expect(controller.get('stepConfigs')[0].get('configs').findProperty('name', 'config1').get('value')).to.equal('value1');
- });
- it('stepConfig has stored configs', function () {
- controller.set('stepConfigs', [Em.Object.create({
- configs: [Em.Object.create({
- name: 'config2',
- value: 'value1'
- })]
- })]);
- var storedConfigProperties = [
- {
- name: 'config2',
- value: "value2"
- }
- ];
- expect(controller.setStoredConfigsValue(storedConfigProperties)).to.be.true;
- expect(controller.get('stepConfigs')[0].get('configs').findProperty('name', 'config2').get('value')).to.equal('value2');
- });
- });
-
- describe('#renderServiceConfigs()', function () {
- it('serviceConfigs and stepConfigs are empty', function () {
- controller.set('stepConfigs', []);
- controller.renderServiceConfigs([]);
- expect(controller.get('selectedService')).to.be.undefined;
- });
- it('serviceConfigs is empty', function () {
- controller.set('stepConfigs', [
- {showConfig: true}
- ]);
- controller.renderServiceConfigs([]);
- expect(controller.get('selectedService')).to.eql({showConfig: true});
- });
- it('serviceConfigs has service', function () {
- var serviceConfigs = [
- {
- serviceName: 'HDFS',
- configs: []
- }
- ];
- sinon.stub(controller, 'wrapConfigProperties', function () {
- return [];
- });
- controller.set('stepConfigs', []);
- controller.renderServiceConfigs(serviceConfigs);
- expect(controller.get('selectedService').get('serviceName')).to.equal('HDFS');
- expect(controller.get('selectedService').get('showConfig')).to.be.true;
- expect(controller.get('selectedService').get('configs')).to.be.empty;
- expect(controller.wrapConfigProperties.calledWith({
- serviceName: 'HDFS',
- configs: []
- })).to.be.true;
- controller.wrapConfigProperties.restore();
- });
- });
-
- describe('#wrapConfigProperties()', function () {
- it('_componentConfig is empty', function () {
- expect(controller.wrapConfigProperties({configs: []})).to.be.empty;
- });
- it('serviceConfigs has service', function () {
- var mock = Em.Object.create({
- validate: Em.K,
- isReconfigurable: true,
- isEditable: false
- });
- var _componentConfig = {configs: [
- {name: 'config1'}
- ]};
- sinon.stub(App.ServiceConfigProperty, 'create', function () {
- return mock;
- });
- sinon.spy(mock, 'validate');
- expect(controller.wrapConfigProperties(_componentConfig)[0].get('isEditable')).to.be.true;
- expect(App.ServiceConfigProperty.create.calledWith({name: 'config1'})).to.be.true;
- expect(mock.validate.calledOnce).to.be.true;
- mock.validate.restore();
- App.ServiceConfigProperty.create.restore();
- });
- });
-
- describe('#setHostsToConfig()', function () {
- it('service is null', function () {
- expect(controller.setHostsToConfig(null)).to.be.false;
- });
- it('service.configs is empty', function () {
- controller.set('content.services', [
- {
- serviceName: 'HDFS',
- configs: []
- }
- ]);
- expect(controller.setHostsToConfig('HDFS')).to.be.false;
- });
- it('No such config name in service.configs', function () {
- controller.set('content.services', [
- {
- serviceName: 'HDFS',
- configs: [
- {
- name: 'config1'
- }
- ]
- }
- ]);
- expect(controller.setHostsToConfig('HDFS', 'config2')).to.be.false;
- });
- it('Correct config in service.configs', function () {
- sinon.stub(App.Service, 'find', function () {
- return Em.Object.create({
- hostComponents: [
- Em.Object.create({
- componentName: 'comp1',
- hostName: 'host1'
- })
- ]
- });
- });
- expect(controller.setHostsToConfig('HDFS', 'config1', ['comp1'])).to.be.true;
- expect(controller.get('content.services')[0].configs[0].defaultValue).to.eql(['host1']);
- App.Service.find.restore();
- });
- });
-
- describe('#setHostToPrincipal()', function () {
- it('service is null', function () {
- expect(controller.setHostToPrincipal(null)).to.be.false;
- });
- it('service.configs is empty', function () {
- controller.set('content.services', [
- {
- serviceName: 'HDFS',
- configs: []
- }
- ]);
- expect(controller.setHostToPrincipal('HDFS')).to.be.false;
- });
- it('No such hostConfigName name in service.configs', function () {
- controller.set('content.services', [
- {
- serviceName: 'HDFS',
- configs: [
- {
- name: 'config1'
- }
- ]
- }
- ]);
- expect(controller.setHostToPrincipal('HDFS', 'config2', 'config1')).to.be.false;
- });
- it('No such principalConfigName name in service.configs', function () {
- expect(controller.setHostToPrincipal('HDFS', 'config1', 'config2')).to.be.false;
- });
- it('Correct config in service.configs', function () {
- controller.set('content.services', [
- {
- serviceName: 'HDFS',
- configs: [
- {
- name: 'config1',
- defaultValue: 'value1'
- },
- {
- name: 'principal1'
- }
- ]
- }
- ]);
- expect(controller.setHostToPrincipal('HDFS', 'config1', 'principal1', 'name1')).to.be.true;
- expect(controller.get('content.services')[0].configs[0].defaultValue).to.equal('value1');
- expect(controller.get('content.services')[0].configs[1].defaultValue).to.equal('name1value1');
- });
- it('Correct config in service.configs, defaultValue is array', function () {
- controller.set('content.services', [
- {
- serviceName: 'HDFS',
- configs: [
- {
- name: 'config1',
- defaultValue: ['Value1']
- },
- {
- name: 'principal1'
- }
- ]
- }
- ]);
- expect(controller.setHostToPrincipal('HDFS', 'config1', 'principal1', 'name1')).to.be.true;
- // expect(controller.get('content.services')[0].configs[0].defaultValue).to.equal('Value1');
- expect(controller.get('content.services')[0].configs[1].defaultValue).to.equal('name1Value1');
- });
- it('stack 2.2 `storm_principal_name` config should be set to `storm`', function() {
- sinon.stub(App, 'get').withArgs('currentStackVersionNumber').returns('2.2');
- controller.set('content.services', [
- {
- serviceName: 'STORM',
- configs: [
- {
- name: 'nimbus_host',
- defaultValue: 'Value1'
- },
- {
- name: 'storm_principal_name'
- }
- ]
- }
- ]);
- controller.setHostToPrincipal('STORM', 'nimbus_host', 'storm_principal_name', 'storm');
- App.get.restore();
- expect(controller.get('content.services')[0].configs[1].defaultValue).to.equal('storm');
- });
- it('stack 2.1 `oozie_http_principal_name` value should contains OOZIE_SERVER host', function() {
- sinon.stub(App, 'get').withArgs('currentStackVersionNumber').returns('2.1');
- controller.set('content.services', [
- {
- serviceName: 'OOZIE',
- configs: [
- {
- name: 'oozie_servername',
- defaultValue: 'host1.com'
- },
- {
- name: 'oozie_http_principal_name'
- }
- ]
- }
- ]);
- controller.setHostToPrincipal('OOZIE', 'oozie_servername', 'oozie_http_principal_name', 'HTTP/');
- App.get.restore();
- expect(controller.get('content.services')[0].configs[1].defaultValue).to.equal('HTTP/host1.com');
- });
- it('stack 2.2 `oozie_http_principal_name` value should be set to HTTP/_HOST', function() {
- sinon.stub(App, 'get').withArgs('currentStackVersionNumber').returns('2.2');
- controller.set('content.services', [
- {
- serviceName: 'OOZIE',
- configs: [
- {
- name: 'oozie_servername',
- defaultValue: 'host1.com'
- },
- {
- name: 'oozie_http_principal_name'
- }
- ]
- }
- ]);
- controller.setHostToPrincipal('OOZIE', 'oozie_servername', 'oozie_http_principal_name', 'HTTP/');
- App.get.restore();
- expect(controller.get('content.services')[0].configs[1].defaultValue).to.equal('HTTP/_HOST');
- });
- });
-
- describe('#loadUsers()', function () {
-
- afterEach(function () {
- App.router.get.restore();
- });
-
- it('serviceUsers is correct', function () {
- sinon.stub(App.router, 'get', function () {
- return Em.Object.create({serviceUsers: [
- {}
- ]})
- });
- controller.loadUsers();
- expect(controller.get('securityUsers')).to.eql([
- {}
- ]);
- });
- it('serviceUsers is null, testMode = true', function () {
- sinon.stub(App.router, 'get', function () {
- return Em.Object.create({serviceUsers: null})
- });
- sinon.stub(App, 'get', function(k) {
- if ('testMode' === k) return true;
- return Em.get(App, k);
- });
- controller.loadUsers();
- expect(controller.get('securityUsers').mapProperty('name')).to.eql(["hdfs_user",
- "mapred_user",
- "hbase_user",
- "hive_user",
- "smokeuser"
- ]);
- App.get.restore();
- });
- it('serviceUsers is empty, testMode = true', function () {
- sinon.stub(App.router, 'get', function () {
- return Em.Object.create({serviceUsers: []})
- });
- sinon.stub(App, 'get', function(k) {
- if ('testMode' === k) return true;
- return Em.get(App, k);
- });
- controller.loadUsers();
- expect(controller.get('securityUsers').mapProperty('name')).to.eql(["hdfs_user",
- "mapred_user",
- "hbase_user",
- "hive_user",
- "smokeuser"
- ]);
- App.get.restore();
- });
- it('serviceUsers is null, testMode = false', function () {
- sinon.stub(App.router, 'get', function () {
- return Em.Object.create({serviceUsers: null})
- });
- sinon.stub(App.db, 'getSecureUserInfo', function () {
- return [
- {}
- ];
- });
- sinon.stub(App, 'get', function(k) {
- if ('testMode' === k) return false;
- return Em.get(App, k);
- });
- controller.loadUsers();
- expect(controller.get('securityUsers')).to.eql([
- {}
- ]);
- expect(App.db.getSecureUserInfo.calledOnce).to.be.true;
- App.db.getSecureUserInfo.restore();
- App.get.restore();
- });
- it('serviceUsers is empty, testMode = false', function () {
- sinon.stub(App.router, 'get', function () {
- return Em.Object.create({serviceUsers: []})
- });
- sinon.stub(App.db, 'getSecureUserInfo', function () {
- return [
- {}
- ];
- });
- sinon.stub(App, 'get', function(k) {
- if ('testMode' === k) return false;
- return Em.get(App, k);
- });
- controller.loadUsers();
- expect(controller.get('securityUsers')).to.eql([
- {}
- ]);
- expect(App.db.getSecureUserInfo.calledOnce).to.be.true;
- App.db.getSecureUserInfo.restore();
- App.get.restore();
- });
- });
-
- describe('#addUserPrincipals()', function () {
- beforeEach(function () {
- sinon.stub(controller, 'setUserPrincipalValue', function () {
- return true;
- });
- });
- afterEach(function () {
- controller.setUserPrincipalValue.restore();
- });
-
- var generalConfigs = [
- {
- serviceName: 'GENERAL',
- configs: [
- {
- name: 'hbase_principal_name',
- isVisible: false
- },
- {
- name: 'hbase_user_keytab',
- isVisible: false
- },
- {
- name: 'hdfs_principal_name',
- isVisible: false
- },
- {
- name: 'hdfs_user_keytab',
- isVisible: false
- }
- ]
- }
- ];
- var securityUsers = [];
-
- it('HBASE or HDFS services are not installed neither', function () {
- var serviceConfigs = generalConfigs.slice(0);
- controller.addUserPrincipals(serviceConfigs, securityUsers);
- expect(serviceConfigs[0].configs.findProperty('name', 'hbase_principal_name').isVisible).to.be.false;
- expect(serviceConfigs[0].configs.findProperty('name', 'hbase_user_keytab').isVisible).to.be.false;
- });
- it('HBASE service is installed', function () {
- var serviceConfigs = generalConfigs.slice(0);
- serviceConfigs.push({serviceName: 'HBASE'});
- controller.addUserPrincipals(serviceConfigs, securityUsers);
- expect(serviceConfigs[0].configs.findProperty('name', 'hbase_principal_name').isVisible).to.be.true;
- expect(serviceConfigs[0].configs.findProperty('name', 'hbase_user_keytab').isVisible).to.be.true;
- });
- it('HDFS service is installed', function () {
- var serviceConfigs = generalConfigs.slice(0);
- serviceConfigs.push({serviceName: 'HDFS'});
- controller.addUserPrincipals(serviceConfigs, securityUsers);
- expect(serviceConfigs[0].configs.findProperty('name', 'hdfs_principal_name').isVisible).to.be.true;
- expect(serviceConfigs[0].configs.findProperty('name', 'hdfs_user_keytab').isVisible).to.be.true;
- });
- it('HDFS and HBASE services are installed', function () {
- var serviceConfigs = generalConfigs.slice(0);
- serviceConfigs.push({serviceName: 'HDFS'});
- serviceConfigs.push({serviceName: 'HBASE'});
- controller.addUserPrincipals(serviceConfigs, securityUsers);
- expect(serviceConfigs[0].configs.findProperty('name', 'hdfs_principal_name').isVisible).to.be.true;
- expect(serviceConfigs[0].configs.findProperty('name', 'hdfs_user_keytab').isVisible).to.be.true;
- expect(serviceConfigs[0].configs.findProperty('name', 'hbase_principal_name').isVisible).to.be.true;
- expect(serviceConfigs[0].configs.findProperty('name', 'hbase_user_keytab').isVisible).to.be.true;
- });
- });
-
- describe('#setUserPrincipalValue()', function () {
- it('user and userPrincipal are null', function () {
- expect(controller.setUserPrincipalValue(null, null)).to.be.false;
- });
- it('user is null', function () {
- expect(controller.setUserPrincipalValue(null, {})).to.be.false;
- });
- it('userPrincipal is null', function () {
- expect(controller.setUserPrincipalValue({}, null)).to.be.false;
- });
- it('user and userPrincipal are correct', function () {
- var user = {value: 'value1'};
- var userPrincipal = {};
- expect(controller.setUserPrincipalValue(user, userPrincipal)).to.be.true;
- expect(userPrincipal.defaultValue).to.equal('value1');
- });
- });
-
- describe('#addHostPrincipals()', function () {
- it('hostToPrincipalMap is empty', function () {
- sinon.stub(controller, 'setHostToPrincipal', Em.K);
- controller.set('hostToPrincipalMap', []);
- controller.addHostPrincipals();
- expect(controller.setHostToPrincipal.called).to.be.false;
- controller.setHostToPrincipal.restore();
- });
- it('Correct data', function () {
- sinon.stub(controller, 'setHostToPrincipal', Em.K);
- controller.set('hostToPrincipalMap', [
- {
- serviceName: 'HDFS',
- configName: 'datanode_hosts',
- principalName: 'principal1',
- primaryName: 'name1'
- }
- ]);
- controller.addHostPrincipals();
- expect(controller.setHostToPrincipal.calledWith('HDFS', 'datanode_hosts', 'principal1', 'name1')).to.be.true;
- controller.setHostToPrincipal.restore();
- });
- });
-
- describe('#changeCategoryOnHa()', function () {
-
- beforeEach(function () {
- sinon.stub(controller, 'removeConfigCategory', Em.K);
- });
- afterEach(function () {
- controller.removeConfigCategory.restore();
- });
-
- var serviceConfigs = [{
- serviceName: 'HDFS',
- configCategories: []
- }];
- var stepConfigs = [Em.Object.create({
- serviceName: 'HDFS',
- configs: []
- })];
-
- it('HDFS service is absent', function () {
- expect(controller.changeCategoryOnHa([], [])).to.be.false;
- });
- it('HDFS service installed, App.testMode and App.testNameNodeHA - true', function () {
- sinon.stub(App, 'get', function(k) {
- if ('testMode' === k) return true;
- if ('testNameNodeHA' === k) return true;
- return Em.get(App, k);
- });
- expect(controller.changeCategoryOnHa(serviceConfigs, stepConfigs)).to.be.true;
- expect(controller.removeConfigCategory.calledWith([], [], 'SNameNode')).to.be.true;
- App.get.restore();
- });
- it('HDFS service installed, content.isNnHa = true', function () {
- controller.set('content.isNnHa', 'true');
- expect(controller.changeCategoryOnHa(serviceConfigs, stepConfigs)).to.be.true;
- expect(controller.removeConfigCategory.calledWith([], [], 'SNameNode')).to.be.true;
- });
- it('HDFS service installed, HA disabled', function () {
- controller.set('content.isNnHa', 'false');
- expect(controller.changeCategoryOnHa(serviceConfigs, stepConfigs)).to.be.true;
- expect(controller.removeConfigCategory.calledWith([], [], 'JournalNode')).to.be.true;
- });
- });
-
- describe('#removeConfigCategory()', function () {
- it('properties should be hidden', function () {
- var properties = [
- Em.Object.create({
- category: 'comp1',
- isVisible: true
- })
- ];
- controller.removeConfigCategory(properties, [], 'comp1');
- expect(properties[0].isVisible).to.be.false;
- });
- it('category should be removed', function () {
- var configCategories = [
- Em.Object.create({
- name: 'comp1'
- })
- ];
- controller.removeConfigCategory([], configCategories, 'comp1');
- expect(configCategories).to.be.empty;
- });
- });
-});