Repository: ambari Updated Branches: refs/heads/trunk ec37c603c -> bf9a825fe
http://git-wip-us.apache.org/repos/asf/ambari/blob/3ae9a5c4/ambari-web/test/controllers/main/app_contoller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/app_contoller_test.js b/ambari-web/test/controllers/main/app_contoller_test.js deleted file mode 100644 index 5369f2c..0000000 --- a/ambari-web/test/controllers/main/app_contoller_test.js +++ /dev/null @@ -1,164 +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('utils/helper'); -require('controllers/main/apps_controller'); - -describe('MainAppsController', function () { - - - describe('#iTotalDisplayRecordsObserver()', function () { - it('should set number of filtered jobs when switching to all jobs', function () { - var mainAppsController = App.MainAppsController.create(); - mainAppsController.set("paginationObject.iTotalDisplayRecords", 5); - expect(mainAppsController.get('filterObject.filteredDisplayRecords')).to.equal(5); - }) - }); - - - describe('#filterObject.onRunTypeChange()', function () { - it('should set sSearch_2 of filterObject when changing value of filterObject.runType', function () { - var mainAppsController = App.MainAppsController.create(); - mainAppsController.set("filterObject.runType", "MapReduce"); - expect(mainAppsController.get('filterObject.sSearch_2')).to.equal("mr"); - mainAppsController.set("filterObject.runType", "Hive"); - expect(mainAppsController.get('filterObject.sSearch_2')).to.equal("hive"); - mainAppsController.set("filterObject.runType", "Pig"); - expect(mainAppsController.get('filterObject.sSearch_2')).to.equal("pig"); - }) - }); - - describe('#filterObject.onJobsChange()', function () { - it('should set minJobs,maxJobs of filterObject when changing value of filterObject.jobs', function () { - var mainAppsController = App.MainAppsController.create(); - mainAppsController.set("filterObject.jobs", ">3"); - expect(mainAppsController.get('filterObject.minJobs')).to.equal("3"); - expect(mainAppsController.get('filterObject.maxJobs')).to.equal(""); - mainAppsController.set("filterObject.jobs", "<3"); - expect(mainAppsController.get('filterObject.minJobs')).to.equal(""); - expect(mainAppsController.get('filterObject.maxJobs')).to.equal("3"); - mainAppsController.set("filterObject.jobs", "3"); - expect(mainAppsController.get('filterObject.minJobs')).to.equal("3"); - expect(mainAppsController.get('filterObject.maxJobs')).to.equal("3"); - mainAppsController.set("filterObject.jobs", "=3"); - expect(mainAppsController.get('filterObject.minJobs')).to.equal("3"); - expect(mainAppsController.get('filterObject.maxJobs')).to.equal("3"); - }) - }); - - describe('#filterObject.onDurationChange()', function () { - it('should set minDuration,maxDuration of filterObject when changing value of filterObject.duration', function () { - var mainAppsController = App.MainAppsController.create(); - mainAppsController.set("filterObject.duration", ">3h"); - expect(mainAppsController.get('filterObject.minDuration')).to.equal(10799640); - expect(mainAppsController.get('filterObject.maxDuration')).to.equal(""); - mainAppsController.set("filterObject.duration", "<6m"); - expect(mainAppsController.get('filterObject.minDuration')).to.equal(""); - expect(mainAppsController.get('filterObject.maxDuration')).to.equal(360060); - mainAppsController.set("filterObject.duration", "10s"); - expect(mainAppsController.get('filterObject.minDuration')).to.equal(9990); - expect(mainAppsController.get('filterObject.maxDuration')).to.equal(10010); - mainAppsController.set("filterObject.duration", "1"); - expect(mainAppsController.get('filterObject.minDuration')).to.equal(990); - expect(mainAppsController.get('filterObject.maxDuration')).to.equal(1010); - }) - }); - - describe('#filterObject.onRunDateChange()', function () { - it('should set minStartTime,maxStartTime of filterObject when changing value of filterObject.runDate', function () { - var mainAppsController = App.MainAppsController.create(); - mainAppsController.set("filterObject.runDate", "Any"); - expect(mainAppsController.get('filterObject.minStartTime')).to.equal(""); - mainAppsController.set("filterObject.runDate", "Past 1 Day"); - expect(mainAppsController.get('filterObject.minStartTime')).to.be.within(((new Date().getTime())-86400000)-1000,((new Date().getTime())-86400000)+1000); - mainAppsController.set("filterObject.runDate", "Past 2 Days"); - expect(mainAppsController.get('filterObject.minStartTime')).to.be.within(((new Date().getTime())-172800000)-1000,((new Date().getTime())-172800000)+1000); - mainAppsController.set("filterObject.runDate", "Past 7 Days"); - expect(mainAppsController.get('filterObject.minStartTime')).to.be.within(((new Date().getTime())-604800000)-1000,((new Date().getTime())-604800000)+1000); - mainAppsController.set("filterObject.runDate", "Past 14 Days"); - expect(mainAppsController.get('filterObject.minStartTime')).to.be.within(((new Date().getTime())-1209600000)-1000,((new Date().getTime())-1209600000)+1000); - mainAppsController.set("filterObject.runDate", "Past 30 Days"); - expect(mainAppsController.get('filterObject.minStartTime')).to.be.within(((new Date().getTime())-2592000000)-1000,((new Date().getTime())-2592000000)+1000); - }) - }); - - describe('#filterObject.createAppLink(), #filterObject.valueObserver()', function () { - var mainAppsController = App.MainAppsController.create(); - mainAppsController.set('content.length', 20); - it('should set runUrl of filterObject when changing value for any filter', function () { - mainAppsController.set("filterObject.sSearch_0", "0"); - mainAppsController.set("filterObject.sSearch_1", "workflowName"); - mainAppsController.set("filterObject.sSearch_2", "pig"); - mainAppsController.set("filterObject.sSearch_3", "admin"); - mainAppsController.set("filterObject.minJobs", "1"); - mainAppsController.set("filterObject.maxJobs", "2"); - mainAppsController.set("filterObject.minDuration", "1000"); - mainAppsController.set("filterObject.maxDuration", "2000"); - mainAppsController.set("filterObject.minStartTime", "999"); - mainAppsController.set("filterObject.maxStartTime", "1000"); - mainAppsController.set("filterObject.sSearch", "searchTerm"); - mainAppsController.set("filterObject.iDisplayLength", "10"); - mainAppsController.set("filterObject.iDisplayStart", "10"); - mainAppsController.set("filterObject.iSortCol_0", "1"); - mainAppsController.set("filterObject.sSortDir_0", "ASC"); - expect(mainAppsController.get('runUrl')).to.equal("/jobhistory/datatable?" + - "sSearch_0=0" + - "&sSearch_1=workflowName" + - "&sSearch_2=pig" + - "&sSearch_3=admin" + - "&minJobs=1" + - "&maxJobs=2" + - "&minDuration=1000" + - "&maxDuration=2000" + - "&minStartTime=999" + - "&maxStartTime=1000" + - "&sSearch=searchTerm" + - "&iDisplayLength=10" + - "&iDisplayStart=10" + - "&iSortCol_0=1" + - "&sSortDir_0=ASC"); - expect(mainAppsController.get('filterObject.viewType')).to.equal('filtered'); - }); - - it('should set viewType to "all" when set iDisplayLength, iDisplayStart, iSortCol_0, sSortDir_0', function () { - mainAppsController.set("filterObject.sSearch_0", ""); - mainAppsController.set("filterObject.sSearch_1", ""); - mainAppsController.set("filterObject.sSearch_2", ""); - mainAppsController.set("filterObject.sSearch_3", ""); - mainAppsController.set("filterObject.minJobs", ""); - mainAppsController.set("filterObject.maxJobs", ""); - mainAppsController.set("filterObject.minDuration", ""); - mainAppsController.set("filterObject.maxDuration", ""); - mainAppsController.set("filterObject.minStartTime", ""); - mainAppsController.set("filterObject.maxStartTime", ""); - mainAppsController.set("filterObject.sSearch", ""); - mainAppsController.set("filterObject.iDisplayLength", "10"); - mainAppsController.set("filterObject.iDisplayStart", "10"); - mainAppsController.set("filterObject.iSortCol_0", "1"); - mainAppsController.set("filterObject.sSortDir_0", "ASC"); - expect(mainAppsController.get('filterObject.viewType')).to.equal('all'); - }); - }); - - - - - }); - http://git-wip-us.apache.org/repos/asf/ambari/blob/3ae9a5c4/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 15c7702..7fc0dd0 100644 --- a/ambari-web/test/controllers/main/host/details_test.js +++ b/ambari-web/test/controllers/main/host/details_test.js @@ -634,8 +634,9 @@ describe('App.MainHostDetailsController', function () { }); var data = {Clusters: {desired_configs: {'core-site': {tag: 1}}}}; App.HostComponent.find().clear(); - App.set('currentStackVersion', 'HDP-2.0.2'); + App.set('isStackServicesLoaded', true); expect(controller.constructConfigUrlParams(data)).to.eql(['(type=core-site&tag=1)']); + App.set('isStackServicesLoaded', false); App.store.load(App.HostComponent, { id: 'SECONDARY_NAMENODE_host1', component_name: 'SECONDARY_NAMENODE' @@ -769,7 +770,7 @@ describe('App.MainHostDetailsController', function () { id: 'HDFS', service_name: 'HDFS' }); - App.set('currentStackVersion', 'HDP-2.0.2'); + App.set('isStackServicesLoaded', true); expect(controller.setZKConfigs(configs, 'host1:2181', [])).to.be.true; expect(configs).to.eql({"core-site": { "ha.zookeeper.quorum": "host1:2181" @@ -778,7 +779,7 @@ describe('App.MainHostDetailsController', function () { id: 'SECONDARY_NAMENODE_host1', component_name: 'SECONDARY_NAMENODE' }); - App.set('currentStackVersion', 'HDP-2.0.1'); + App.set('isStackServicesLoaded', false); }); it('hbase-site is present', function () { var configs = {'hbase-site': {}}; http://git-wip-us.apache.org/repos/asf/ambari/blob/3ae9a5c4/ambari-web/test/controllers/main/service/info/config_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/service/info/config_test.js b/ambari-web/test/controllers/main/service/info/config_test.js index 428bfa3..541f4af 100644 --- a/ambari-web/test/controllers/main/service/info/config_test.js +++ b/ambari-web/test/controllers/main/service/info/config_test.js @@ -656,7 +656,7 @@ describe("App.MainServiceInfoConfigsController", function () { mainServiceInfoConfigsController.set('content', Ember.Object.create ({ serviceName: 'HDFS' })); }); - describe("when isHadoop2Stack is true", function() { + describe("for hadoop 2", function() { var tests = [ { @@ -729,80 +729,6 @@ describe("App.MainServiceInfoConfigsController", function () { }) }); }); - - describe("when isHadoop2Stack is false", function() { - - var tests = [ - { - it: "should set dirChanged to false if none of the properties exist", - expect: false, - config: Ember.Object.create ({}) - }, - { - it: "should set dirChanged to true if dfs.name.dir is not default", - expect: true, - config: Ember.Object.create ({ - name: 'dfs.name.dir', - isNotDefaultValue: true - }) - }, - { - it: "should set dirChanged to false if dfs.name.dir is default", - expect: false, - config: Ember.Object.create ({ - name: 'dfs.name.dir', - isNotDefaultValue: false - }) - }, - { - it: "should set dirChanged to true if fs.checkpoint.dir is not default", - expect: true, - config: Ember.Object.create ({ - name: 'fs.checkpoint.dir', - isNotDefaultValue: true - }) - }, - { - it: "should set dirChanged to false if fs.checkpoint.dir is default", - expect: false, - config: Ember.Object.create ({ - name: 'fs.checkpoint.dir', - isNotDefaultValue: false - }) - }, - { - it: "should set dirChanged to true if dfs.data.dir is not default", - expect: true, - config: Ember.Object.create ({ - name: 'dfs.data.dir', - isNotDefaultValue: true - }) - }, - { - it: "should set dirChanged to false if dfs.data.dir is default", - expect: false, - config: Ember.Object.create ({ - name: 'dfs.data.dir', - isNotDefaultValue: false - }) - } - ]; - - beforeEach(function() { - sinon.stub(App, 'get').returns(false); - }); - - afterEach(function() { - App.get.restore(); - }); - - tests.forEach(function(test) { - it(test.it, function() { - mainServiceInfoConfigsController.set('stepConfigs', [Ember.Object.create ({ configs: [test.config], serviceName: 'HDFS' })]); - expect(mainServiceInfoConfigsController.isDirChanged()).to.equal(test.expect); - }) - }); - }); }); describe("when service name is MAPREDUCE", function() { http://git-wip-us.apache.org/repos/asf/ambari/blob/3ae9a5c4/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js index 9cec9c5..9b41a2c 100644 --- a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js +++ b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js @@ -37,17 +37,6 @@ describe('App.ReassignMasterWizardStep4Controller', function () { }); describe('#setAdditionalConfigs()', function () { - var isHadoop2Stack = false; - - beforeEach(function () { - sinon.stub(App, 'get', function () { - return isHadoop2Stack; - }); - }); - afterEach(function () { - App.get.restore(); - }); - it('Component is absent', function () { controller.set('additionalConfigsMap', []); @@ -56,58 +45,8 @@ describe('App.ReassignMasterWizardStep4Controller', function () { expect(controller.setAdditionalConfigs(configs, 'COMP1', '')).to.be.false; expect(configs).to.eql({}); }); - it('Component is present', function () { - controller.set('additionalConfigsMap', [ - { - componentName: 'COMP1', - configs: { - 'test-site': { - 'property1': '<replace-value>:1111' - } - } - } - ]); - var configs = { - 'test-site': {} - }; - expect(controller.setAdditionalConfigs(configs, 'COMP1', 'host1')).to.be.true; - expect(configs).to.eql({ - 'test-site': { - 'property1': 'host1:1111' - } - }); - }); - it('configs_Hadoop2 is present but isHadoop2Stack = false', function () { - isHadoop2Stack = false; - controller.set('additionalConfigsMap', [ - { - componentName: 'COMP1', - configs: { - 'test-site': { - 'property1': '<replace-value>:1111' - } - }, - configs_Hadoop2: { - 'test-site': { - 'property2': '<replace-value>:2222' - } - } - } - ]); - var configs = { - 'test-site': {} - }; - - expect(controller.setAdditionalConfigs(configs, 'COMP1', 'host1')).to.be.true; - expect(configs).to.eql({ - 'test-site': { - 'property1': 'host1:1111' - } - }); - }); - it('configs_Hadoop2 is present but isHadoop2Stack = true', function () { - isHadoop2Stack = true; + it('configs for Hadoop 2 is present', function () { controller.set('additionalConfigsMap', [ { componentName: 'COMP1', @@ -934,16 +873,6 @@ describe('App.ReassignMasterWizardStep4Controller', function () { }); describe('#getComponentDir()', function () { - var isHadoop2Stack = false; - beforeEach(function () { - sinon.stub(App, 'get', function () { - return isHadoop2Stack; - }); - }); - afterEach(function () { - App.get.restore(); - }); - var configs = { 'hdfs-site': { 'dfs.name.dir': 'case1', @@ -958,21 +887,12 @@ describe('App.ReassignMasterWizardStep4Controller', function () { it('unknown component name', function () { expect(controller.getComponentDir(configs, 'COMP1')).to.be.empty; }); - it('NAMENODE component and isHadoop2Stack is false', function () { - expect(controller.getComponentDir(configs, 'NAMENODE')).to.equal('case1'); - }); - it('NAMENODE component and isHadoop2Stack is true', function () { - isHadoop2Stack = true; + it('NAMENODE component', function () { expect(controller.getComponentDir(configs, 'NAMENODE')).to.equal('case2'); }); - it('SECONDARY_NAMENODE component and isHadoop2Stack is true', function () { - isHadoop2Stack = true; + it('SECONDARY_NAMENODE component', function () { expect(controller.getComponentDir(configs, 'SECONDARY_NAMENODE')).to.equal('case3'); }); - it('SECONDARY_NAMENODE component and isHadoop2Stack is false', function () { - isHadoop2Stack = false; - expect(controller.getComponentDir(configs, 'SECONDARY_NAMENODE')).to.equal('case4'); - }); }); describe('#saveClusterStatus()', function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/3ae9a5c4/ambari-web/test/controllers/wizard/step7_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js index 1350dd1..77668d5 100644 --- a/ambari-web/test/controllers/wizard/step7_test.js +++ b/ambari-web/test/controllers/wizard/step7_test.js @@ -1255,7 +1255,7 @@ describe('App.InstallerStep7Controller', function () { ]; sinon.stub(App, 'get', function(key) { - if (['isHadoop22Stack', 'isHadoop2Stack'].contains(key)) return true; + if (['isHadoop22Stack'].contains(key)) return true; else App.get(key); }); var controller = App.WizardStep7Controller.create({}); http://git-wip-us.apache.org/repos/asf/ambari/blob/3ae9a5c4/ambari-web/test/data/secure_mapping_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/data/secure_mapping_test.js b/ambari-web/test/data/secure_mapping_test.js deleted file mode 100644 index 01e623b..0000000 --- a/ambari-web/test/data/secure_mapping_test.js +++ /dev/null @@ -1,37 +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('utils/helper'); -var mappedProperties = require('data/secure_mapping'); - -describe('hdp1SiteMapping', function () { - - // All mapped properties should have value of string type - mappedProperties.forEach(function(mappedProperty){ - it('Value of "' + mappedProperty.name + '"' + ' should be string', function () { - expect(mappedProperty.value).to.be.a('string'); - }); - }); - mappedProperties.forEach(function(mappedProperty){ - it('Value of "' + mappedProperty.name + '"' + ' should have serviceName and filename attribute', function () { - expect(mappedProperty).to.have.property('serviceName'); - expect(mappedProperty).to.have.property('filename'); - }); - }); -}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/3ae9a5c4/ambari-web/test/mappers/runs_mapper_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/mappers/runs_mapper_test.js b/ambari-web/test/mappers/runs_mapper_test.js deleted file mode 100644 index 0e94d09..0000000 --- a/ambari-web/test/mappers/runs_mapper_test.js +++ /dev/null @@ -1,154 +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 Ember = require('ember'); -var App = require('app'); - -require('mappers/server_data_mapper'); -require('mappers/runs_mapper'); - -describe('App.runsMapper', function () { - - var tests = [ - { - i: { - "workflowContext": { - "workflowDag": { - "entries": [ - { - "source": "scope-5", - "targets": [] - } - ] - } - } - }, - index: 0, - e: '{dag: {"scope-5": []}}', - m: 'One entry. Without targets' - }, - { - i: { - "workflowContext": { - "workflowDag": { - "entries": [ - { - "source": "scope-5", - "targets": ['t1'] - } - ] - } - } - }, - index: 0, - e: '{dag: {"scope-5": ["t1"]}}', - m: 'One entry. With one target' - }, - { - i: { - "workflowContext": { - "workflowDag": { - "entries": [ - { - "source": "scope-5", - "targets": ['t1,t2,t3'] - } - ] - } - } - }, - index: 0, - e: '{dag: {"scope-5": ["t1,t2,t3"]}}', - m: 'One entry. With multiple targets' - }, - { - i: { - "workflowContext": { - "workflowDag": { - "entries": [ - { - "source": "scope-5", - "targets": [] - }, - { - "source": "scope-4", - "targets": [] - } - ] - } - } - }, - index: 0, - e: '{dag: {"scope-5": [],"scope-4": []}}', - m: 'Two entries. Without targets' - }, - { - i: { - "workflowContext": { - "workflowDag": { - "entries": [ - { - "source": "scope-5", - "targets": ['t1,t2,t3'] - }, - { - "source": "scope-4", - "targets": ['t1'] - } - ] - } - } - }, - index: 0, - e: '{dag: {"scope-5": ["t1,t2,t3"],"scope-4": ["t1"]}}', - m: 'Two entries. With multiple targets' - }, - { - i: { - "workflowContext": { - "workflowDag": { - "entries": [ - { - "source": "scope-5", - "targets": ['t1,t2,t3'] - }, - { - "source": "scope-4", - "targets": ['t1,t2,t3'] - } - ] - } - } - }, - index: 0, - e: '{dag: {"scope-5": ["t1,t2,t3"],"scope-4": ["t1,t2,t3"]}}', - m: 'Two entries. With multiple targets' - } - ]; - - describe('#generateWorkflow', function() { - tests.forEach(function(test) { - it (test.m, function() { - var result = App.runsMapper.generateWorkflow(test.i, test.index); - expect(result.workflowContext).to.equal(test.e); - expect(result.index).to.equal(test.index + 1); - }); - }); - }); - -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/3ae9a5c4/ambari-web/test/models/run_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/models/run_test.js b/ambari-web/test/models/run_test.js deleted file mode 100644 index 2b971e8..0000000 --- a/ambari-web/test/models/run_test.js +++ /dev/null @@ -1,159 +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'); - -var modelSetup = require('test/init_model_test'); -require('models/run'); - -var run, - job, - runData = { - id: 'run' - }, - jobData = { - id: 'job' - }, - cases = [ - { - id: 'pig_run', - type: 'Pig' - }, - { - id: 'hive_run', - type: 'Hive' - }, - { - id: 'mr_run', - type: 'MapReduce' - }, - { - id: 'run_pig_hive_mr_id', - type: '' - } - ]; - -describe('App.Run', function () { - - beforeEach(function () { - run = App.Run.createRecord(runData); - }); - - afterEach(function () { - modelSetup.deleteRecord(run); - }); - - describe('#idFormatted', function () { - it('should shorten id to 20 characters', function () { - for (var i = 21, name = ''; i--; ) { - name += 'n'; - } - run.set('id', name); - expect(run.get('idFormatted')).to.have.length(20); - }); - }); - - describe('#jobs', function () { - - beforeEach(function () { - job = App.Job.createRecord(jobData); - job.reopen({ - run: runData - }); - }); - - afterEach(function () { - modelSetup.deleteRecord(job); - }); - - it('should load corresponding jobs from the store', function () { - run.set('loadAllJobs', true); - expect(run.get('jobs')).to.have.length(1); - expect(run.get('jobs').objectAt(0).get('run.id')).to.equal('run'); - }); - - }); - - describe('#duration', function () { - it('should convert elapsedTime into time format', function () { - run.set('elapsedTime', 1000); - expect(run.get('duration')).to.equal('1.00 secs'); - }); - }); - - describe('#isRunning', function () { - it('should be true', function () { - run.setProperties({ - numJobsTotal: 5, - numJobsCompleted: 0 - }); - expect(run.get('isRunning')).to.be.true; - }); - it('should be false', function () { - run.setProperties({ - numJobsTotal: 5, - numJobsCompleted: 5 - }); - expect(run.get('isRunning')).to.be.false; - }); - }); - - describe('#inputFormatted', function () { - it('should convert input into bandwidth format', function () { - run.set('input', 1024); - expect(run.get('inputFormatted')).to.equal('1.0KB'); - }); - }); - - describe('#outputFormatted', function () { - it('should convert output into bandwidth format', function () { - run.set('output', 1024); - expect(run.get('outputFormatted')).to.equal('1.0KB'); - }); - }); - - describe('#lastUpdateTime', function () { - it('should sum elapsedTime and startTime', function () { - run.setProperties({ - elapsedTime: 1000, - startTime: 2000 - }); - expect(run.get('lastUpdateTime')).to.equal(3000); - }); - }); - - describe('#lastUpdateTimeFormattedShort', function () { - it('should form date and time from lastUpdateTime', function () { - run.setProperties({ - elapsedTime: 1000, - startTime: 100000000000 - }); - expect(run.get('lastUpdateTimeFormattedShort')).to.equal('Sat Mar 03 1973'); - }); - }); - - describe('#type', function () { - cases.forEach(function (item) { - it('should be ' + (item.type ? item.type : 'empty'), function () { - run.set('id', item.id); - expect(run.get('type')).to.equal(item.type); - }); - }); - }); - -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/3ae9a5c4/ambari-web/test/utils/config_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/utils/config_test.js b/ambari-web/test/utils/config_test.js index 79bc89b..0286884 100644 --- a/ambari-web/test/utils/config_test.js +++ b/ambari-web/test/utils/config_test.js @@ -131,47 +131,6 @@ describe('App.config', function () { }) }); - describe('Stack version < 2.0', function() { - before(function() { - setups.setupStackVersion(this, 'HDP-1.3'); - }); - var tests = [ - { - config: { - name: 'mapred.capacity-scheduler.maximum-system-jobs' - }, - e: false - }, - { - config: { - name: 'yarn.scheduler.capacity.root.capacity' - }, - e: false - }, - { - config: { - name: 'mapred.capacity-scheduler.queue.default.capacity' - }, - e: true - }, - { - config: { - name: 'mapred.queue.default.acl-administer-jobs' - }, - e: true - } - ]; - - tests.forEach(function(test){ - it(testMessage.format( !!test.e ? '' : 'not', test.config.name), function() { - expect(App.config.get('capacitySchedulerFilter')(test.config)).to.eql(test.e); - }); - }); - - after(function() { - setups.restoreStackVersion(this); - }); - }); }); describe('#fileConfigsIntoTextarea', function () { @@ -673,7 +632,7 @@ describe('App.config', function () { }, { key: 'belongsToService', - e: ['HIVE', 'OOZIE'] + e: ['HIVE', 'OOZIE', 'FALCON'] } ] }, http://git-wip-us.apache.org/repos/asf/ambari/blob/3ae9a5c4/ambari-web/test/views/common/quick_link_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/common/quick_link_view_test.js b/ambari-web/test/views/common/quick_link_view_test.js index fedbd9f..d0ae499 100644 --- a/ambari-web/test/views/common/quick_link_view_test.js +++ b/ambari-web/test/views/common/quick_link_view_test.js @@ -31,43 +31,25 @@ describe('App.QuickViewLinks', function () { { serviceName: "NAGIOS", ambariProperties: { 'nagios.https': true }, m: "https for nagios", result: "https" }, { serviceName: "NAGIOS", ambariProperties: { 'nagios.https': false }, m: "http for nagios", result: "http" }, { serviceName: "YARN", configProperties: [ - { type: 'yarn-site', properties: { 'yarn.http.policy': 'HTTPS_ONLY' }}, - { type: 'core-site', properties: { 'hadoop.ssl.enabled': null }} + { type: 'yarn-site', properties: { 'yarn.http.policy': 'HTTPS_ONLY' }} ], m: "https for yarn", result: "https" }, { serviceName: "YARN", configProperties: [ - { type: 'yarn-site', properties: { 'yarn.http.policy': 'HTTP_ONLY' }}, - { type: 'core-site', properties: { 'hadoop.ssl.enabled': null }} + { type: 'yarn-site', properties: { 'yarn.http.policy': 'HTTP_ONLY' }} ], m: "http for yarn", result: "http" }, { serviceName: "YARN", configProperties: [ - { type: 'yarn-site', properties: { 'yarn.http.policy': 'HTTP_ONLY' }}, - { type: 'core-site', properties: { 'hadoop.ssl.enabled': true }} + { type: 'yarn-site', properties: { 'yarn.http.policy': 'HTTP_ONLY' }} ], m: "http for yarn (overrides hadoop.ssl.enabled)", result: "http" }, { serviceName: "YARN", configProperties: [ - { type: 'yarn-site', properties: { 'yarn.http.policy': 'HTTPS_ONLY' }}, - { type: 'core-site', properties: { 'hadoop.ssl.enabled': false }} + { type: 'yarn-site', properties: { 'yarn.http.policy': 'HTTPS_ONLY' }} ], m: "https for yarn (overrides hadoop.ssl.enabled)", result: "https" }, - { serviceName: "YARN", configProperties: [ - { type: 'core-site', properties: { 'hadoop.ssl.enabled': true }} - ], m: "https for yarn by hadoop.ssl.enabled", result: "https" }, { serviceName: "MAPREDUCE2", configProperties: [ - { type: 'mapred-site', properties: { 'mapreduce.jobhistory.http.policy': 'HTTPS_ONLY' }}, - { type: 'core-site', properties: { 'hadoop.ssl.enabled': null }} + { type: 'mapred-site', properties: { 'mapreduce.jobhistory.http.policy': 'HTTPS_ONLY' }} ], m: "https for mapreduce2", result: "https" }, { serviceName: "MAPREDUCE2", configProperties: [ - { type: 'mapred-site', properties: { 'mapreduce.jobhistory.http.policy': 'HTTP_ONLY' }}, - { type: 'core-site', properties: { 'hadoop.ssl.enabled': null }} + { type: 'mapred-site', properties: { 'mapreduce.jobhistory.http.policy': 'HTTP_ONLY' }} ], m: "http for mapreduce2", result: "http" }, - { serviceName: "MAPREDUCE2", configProperties: [ - { type: 'core-site', properties: { 'hadoop.ssl.enabled': true }} - ], m: "https for mapreduce2 by hadoop.ssl.enabled", result: "https" }, - { serviceName: "ANYSERVICE", configProperties: [ - { type: 'core-site', properties: { 'hadoop.ssl.enabled': true }} - ], m: "http for anyservice hadoop.ssl.enabled is true but doesn't support security", servicesSupportsHttps: [], result: "http" }, - { serviceName: "ANYSERVICE", configProperties: [ - { type: 'core-site', properties: { 'hadoop.ssl.enabled': false }} - ], m: "http for anyservice hadoop.ssl.enabled is false", servicesSupportsHttps: ["ANYSERVICE"], result: "http" }, { serviceName: "ANYSERVICE", configProperties: [ - { type: 'core-site', properties: { 'hadoop.ssl.enabled': true }} + { type: 'hdfs-site', properties: { 'dfs.http.policy': 'HTTPS_ONLY' }} ], m: "https for anyservice", servicesSupportsHttps: ["ANYSERVICE"], result: "https" } ]; http://git-wip-us.apache.org/repos/asf/ambari/blob/3ae9a5c4/ambari-web/test/views/main/host/details/host_component_views/datanode_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/host/details/host_component_views/datanode_view_test.js b/ambari-web/test/views/main/host/details/host_component_views/datanode_view_test.js index 06f3ee5..075af15 100644 --- a/ambari-web/test/views/main/host/details/host_component_views/datanode_view_test.js +++ b/ambari-web/test/views/main/host/details/host_component_views/datanode_view_test.js @@ -160,7 +160,6 @@ describe('App.DataNodeComponentView', function () { title: 'No live nodes', data: { curObj: {}, - isHadoop2Stack: true }, result: { getDesiredAdminStateCalled: true, @@ -177,8 +176,7 @@ describe('App.DataNodeComponentView', function () { "adminState": "In Service" } } - }, - isHadoop2Stack: true + } }, result: { getDesiredAdminStateCalled: false, @@ -195,8 +193,7 @@ describe('App.DataNodeComponentView', function () { "adminState": "Decommission In Progress" } } - }, - isHadoop2Stack: true + } }, result: { getDesiredAdminStateCalled: false, @@ -213,79 +210,17 @@ describe('App.DataNodeComponentView', function () { "adminState": "Decommissioned" } } - }, - isHadoop2Stack: true - }, - result: { - getDesiredAdminStateCalled: false, - status: "DECOMMISSIONED", - setStatusAsCalled: true - } - }, - { - title: 'nodes DECOMMISSIONING', - data: { - "curObj": { - "DecomNodes": { - "host1": {} - } - }, - isHadoop2Stack: false - }, - result: { - getDesiredAdminStateCalled: false, - status: "DECOMMISSIONING", - setStatusAsCalled: true - } - }, - { - title: 'nodes DECOMMISSIONED', - data: { - "curObj": { - "DeadNodes": { - "host1": {} - } - }, - isHadoop2Stack: false + } }, result: { getDesiredAdminStateCalled: false, status: "DECOMMISSIONED", setStatusAsCalled: true } - }, - { - title: 'nodes INSERVICE', - data: { - "curObj": { - "LiveNodes": { - "host1": {} - } - }, - isHadoop2Stack: false - }, - result: { - getDesiredAdminStateCalled: false, - status: "INSERVICE", - setStatusAsCalled: true - } - }, - { - title: 'namenode down', - data: { - "curObj": {}, - isHadoop2Stack: false - }, - result: { - getDesiredAdminStateCalled: true, - status: "", - setStatusAsCalled: false - } } ]; testCases.forEach(function (test) { - it(test.title + ", isHadoop2Stack:" + test.data.isHadoop2Stack, function () { - this.stub.withArgs('isHadoop2Stack').returns(test.data.isHadoop2Stack); + it(test.title, function () { view.computeStatus(test.data.curObj); expect(view.getDesiredAdminState.called).to.equal(test.result.getDesiredAdminStateCalled); expect(view.setStatusAs.calledWith(test.result.status)).to.equal(test.result.setStatusAsCalled);
