Repository: ambari Updated Branches: refs/heads/trunk e4bfb03c7 -> 8cf83e953
AMBARI-10080 After adding a HS2 instance properties are modifed uncessarily. (atkach) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8cf83e95 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8cf83e95 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8cf83e95 Branch: refs/heads/trunk Commit: 8cf83e953f6297932913ddc568bd31d2188c424c Parents: e4bfb03 Author: Andrii Tkach <[email protected]> Authored: Mon Mar 16 16:10:13 2015 +0200 Committer: Andrii Tkach <[email protected]> Committed: Mon Mar 16 16:10:13 2015 +0200 ---------------------------------------------------------------------- ambari-web/app/controllers/main/host/details.js | 2 +- .../test/controllers/main/host/details_test.js | 78 ++++++++++++++++++++ ambari-web/test/views/main/service/item_test.js | 2 +- 3 files changed, 80 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/8cf83e95/ambari-web/app/controllers/main/host/details.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js index 5c035c4..cb5c5b2 100644 --- a/ambari-web/app/controllers/main/host/details.js +++ b/ambari-web/app/controllers/main/host/details.js @@ -753,7 +753,7 @@ App.MainHostDetailsController = Em.Controller.extend({ this.set('fromDeleteHost', false); return hiveHosts.without(this.get('content.hostName')); } - return hiveHosts; + return hiveHosts.sort(); }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/8cf83e95/ambari-web/test/controllers/main/host/details_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js index b9612e4..76d8de2 100644 --- a/ambari-web/test/controllers/main/host/details_test.js +++ b/ambari-web/test/controllers/main/host/details_test.js @@ -2352,4 +2352,82 @@ describe('App.MainHostDetailsController', function () { expect(App.clusterStatus.setClusterStatus.calledOnce).to.be.true; }); }); + + describe('#getHiveHosts()', function () { + + var cases = [ + { + 'input': { + 'hiveMetastoreHost': '', + 'fromDeleteHost': false, + 'deleteHiveMetaStore': false + }, + 'hiveHosts': ['h1', 'h2'], + 'title': 'adding HiveServer2' + }, + { + 'input': { + 'hiveMetastoreHost': 'h0', + 'fromDeleteHost': false, + 'deleteHiveMetaStore': false + }, + 'hiveHosts': ['h0', 'h1', 'h2'], + 'title': 'adding Hive Metastore' + }, + { + 'input': { + 'hiveMetastoreHost': '', + 'content.hostName': 'h1', + 'fromDeleteHost': false, + 'deleteHiveMetaStore': true + }, + 'hiveHosts': ['h2'], + 'title': 'deleting Hive component' + }, + { + 'input': { + 'hiveMetastoreHost': '', + 'content.hostName': 'h2', + 'fromDeleteHost': true, + 'deleteHiveMetaStore': false + }, + 'hiveHosts': ['h1'], + 'title': 'deleting host with Hive component' + } + ]; + + before(function () { + sinon.stub(App.HostComponent, 'find').returns([ + { + componentName: 'HIVE_METASTORE', + hostName: 'h2' + }, + { + componentName: 'HIVE_METASTORE', + hostName: 'h1' + }, + { + componentName: 'HIVE_SERVER', + hostName: 'h3' + } + ]); + }); + + after(function () { + App.HostComponent.find.restore(); + }); + + cases.forEach(function (item) { + it(item.title, function () { + Em.keys(item.input).forEach(function (key) { + controller.set(key, item.input[key]); + }); + expect(controller.getHiveHosts()).to.eql(item.hiveHosts); + expect(controller.get('hiveMetastoreHost')).to.be.empty; + expect(controller.get('fromDeleteHost')).to.be.false; + expect(controller.get('deleteHiveMetaStore')).to.be.false; + }); + }); + + }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/8cf83e95/ambari-web/test/views/main/service/item_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/service/item_test.js b/ambari-web/test/views/main/service/item_test.js index 6126055..23e6e1c 100644 --- a/ambari-web/test/views/main/service/item_test.js +++ b/ambari-web/test/views/main/service/item_test.js @@ -21,7 +21,7 @@ require('views/main/service/item'); var view; -describe.only('App.MainServiceItemView', function () { +describe('App.MainServiceItemView', function () { describe('#mastersExcludedCommands', function () {
