Repository: ambari Updated Branches: refs/heads/trunk 667df41cf -> 78c0bbb5a
AMBARI-9728. Security : When Test Kerberos has failed, retry button does not work. (akovalenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/78c0bbb5 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/78c0bbb5 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/78c0bbb5 Branch: refs/heads/trunk Commit: 78c0bbb5a4f29fb95c2ed148769710d607dc2b1f Parents: 667df41 Author: Aleksandr Kovalenko <[email protected]> Authored: Fri Feb 20 17:26:08 2015 +0200 Committer: Aleksandr Kovalenko <[email protected]> Committed: Fri Feb 20 18:24:25 2015 +0200 ---------------------------------------------------------------------- ambari-web/app/assets/test/tests.js | 1 + .../main/admin/kerberos/step3_controller.js | 7 +++- .../admin/kerberos/step3_controller_test.js | 43 ++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/78c0bbb5/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 048f2e5..cfd519f 100644 --- a/ambari-web/app/assets/test/tests.js +++ b/ambari-web/app/assets/test/tests.js @@ -51,6 +51,7 @@ var files = ['test/init_model_test', 'test/controllers/main/alerts/manage_alert_notifications_controller_test', 'test/controllers/main/admin/kerberos_test', 'test/controllers/main/admin/kerberos/kerberos_wizard_controler_test', + 'test/controllers/main/admin/kerberos/step3_controller_test', 'test/controllers/main/admin/kerberos/step4_controller_test', 'test/controllers/main/admin/kerberos/step5_controller_test', 'test/controllers/main/admin/stack_and_upgrade_controller_test', http://git-wip-us.apache.org/repos/asf/ambari/blob/78c0bbb5/ambari-web/app/controllers/main/admin/kerberos/step3_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/kerberos/step3_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step3_controller.js index 3b7bbef..689ec4f 100644 --- a/ambari-web/app/controllers/main/admin/kerberos/step3_controller.js +++ b/ambari-web/app/controllers/main/admin/kerberos/step3_controller.js @@ -73,7 +73,7 @@ App.KerberosWizardStep3Controller = App.KerberosProgressPageController.extend({ 'name': 'service.item.smoke', 'sender': this, 'success': 'startPolling', - 'error': 'onTaskError', + 'error': 'onTestKerberosError', 'kdcCancelHandler': 'onKDCCancel', 'data': { 'serviceName': this.serviceName, @@ -83,6 +83,11 @@ App.KerberosWizardStep3Controller = App.KerberosProgressPageController.extend({ }); }, + onTestKerberosError: function (jqXHR, ajaxOptions, error, opt) { + App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.type, jqXHR.status); + this.onTaskError(jqXHR, ajaxOptions, error, opt); + }, + /** * Enable or disable previous steps according to tasks statuses */ http://git-wip-us.apache.org/repos/asf/ambari/blob/78c0bbb5/ambari-web/test/controllers/main/admin/kerberos/step3_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/admin/kerberos/step3_controller_test.js b/ambari-web/test/controllers/main/admin/kerberos/step3_controller_test.js new file mode 100644 index 0000000..cd149f1 --- /dev/null +++ b/ambari-web/test/controllers/main/admin/kerberos/step3_controller_test.js @@ -0,0 +1,43 @@ +/** + * 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'); + +describe('App.KerberosWizardStep3Controller', function() { + + describe('#onTestKerberosError', function() { + var controller = App.KerberosWizardStep3Controller.create({}); + + beforeEach(function(){ + sinon.stub(App.ajax, 'defaultErrorHandler', Em.K); + sinon.stub(controller, 'onTaskError', Em.K); + }); + + afterEach(function(){ + App.ajax.defaultErrorHandler.restore(); + controller.onTaskError.restore(); + }); + + it('should call App.ajax.defaultErrorHandler and onTaskError', function () { + controller.onTestKerberosError({status: 3}, null, null, {url: 1, type: 2}); + expect(App.ajax.defaultErrorHandler.calledWith({status: 3}, 1, 2, 3)).to.be.true; + expect(controller.onTaskError.calledOnce).to.be.true; + }); + }); + +}); \ No newline at end of file
