You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2014/07/21 18:06:49 UTC
[3/5] AMBARI-6550. Make tests runnable. (onechiporenko)
http://git-wip-us.apache.org/repos/asf/ambari/blob/566e754e/ambari-web/test/controllers/wizard/step3_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step3_test.js b/ambari-web/test/controllers/wizard/step3_test.js
index d752ada..d9b37cc 100644
--- a/ambari-web/test/controllers/wizard/step3_test.js
+++ b/ambari-web/test/controllers/wizard/step3_test.js
@@ -20,6 +20,7 @@
var Ember = require('ember');
var App = require('app');
var c;
+require('utils/ajax/ajax');
require('utils/http_client');
require('models/host');
require('controllers/wizard/step3_controller');
@@ -28,17 +29,23 @@ describe('App.WizardStep3Controller', function () {
beforeEach(function() {
c = App.WizardStep3Controller.create({
+ content: Em.Object.create({installedHosts: Em.A([]), installOptions: {}}),
wizardController: App.InstallerController.create(),
disablePreviousSteps: Em.K
});
+ sinon.stub(App.router, 'send', Em.K);
+ });
+
+ afterEach(function() {
+ App.router.send.restore();
});
describe('#getAllRegisteredHostsCallback', function () {
it('One host is already in the cluster, one host is registered', function() {
- var controller = App.WizardStep3Controller.create({
- hostsInCluster: [{
- hostName: 'wst3_host1'
- }],
+ c.get('content.installedHosts').pushObject({
+ name: 'wst3_host1'
+ });
+ c.reopen({
bootHosts: [
{name:'wst3_host1'},
{name:'wst3_host2'}
@@ -63,16 +70,16 @@ describe('App.WizardStep3Controller', function () {
}
]
};
- controller.getAllRegisteredHostsCallback(test_data);
- expect(controller.get('hasMoreRegisteredHosts')).to.equal(true);
- expect(controller.get('registeredHosts').length).to.equal(1);
+ c.getAllRegisteredHostsCallback(test_data);
+ expect(c.get('hasMoreRegisteredHosts')).to.equal(true);
+ expect(c.get('registeredHosts').length).to.equal(1);
});
it('All hosts are new', function() {
- var controller = App.WizardStep3Controller.create({
- hostsInCluster: [{
- hostName: 'wst3_host1'
- }],
+ c.get('content.installedHosts').pushObject({
+ name: 'wst3_host1'
+ });
+ c.reopen({
bootHosts: [
{name:'wst3_host3'},
{name:'wst3_host4'}
@@ -92,16 +99,16 @@ describe('App.WizardStep3Controller', function () {
}
]
};
- controller.getAllRegisteredHostsCallback(test_data);
- expect(controller.get('hasMoreRegisteredHosts')).to.equal(false);
- expect(controller.get('registeredHosts')).to.equal('');
+ c.getAllRegisteredHostsCallback(test_data);
+ expect(c.get('hasMoreRegisteredHosts')).to.equal(false);
+ expect(c.get('registeredHosts')).to.equal('');
});
it('No new hosts', function() {
- var controller = App.WizardStep3Controller.create({
- hostsInCluster: [{
- hostName: 'wst3_host1'
- }],
+ c.get('content.installedHosts').pushObject({
+ name: 'wst3_host1'
+ });
+ c.reopen({
bootHosts: [
{name:'wst3_host1'}
]
@@ -115,33 +122,21 @@ describe('App.WizardStep3Controller', function () {
}
]
};
- controller.getAllRegisteredHostsCallback(test_data);
- expect(controller.get('hasMoreRegisteredHosts')).to.equal(false);
- expect(controller.get('registeredHosts')).to.equal('');
+ c.getAllRegisteredHostsCallback(test_data);
+ expect(c.get('hasMoreRegisteredHosts')).to.equal(false);
+ expect(c.get('registeredHosts')).to.equal('');
});
});
describe('#registrationTimeoutSecs', function() {
it('Manual install', function() {
- var controller = App.WizardStep3Controller.create({
- content: {
- installOptions: {
- manualInstall: true
- }
- }
- });
- expect(controller.get('registrationTimeoutSecs')).to.equal(15);
+ c.set('content.installOptions.manualInstall', true);
+ expect(c.get('registrationTimeoutSecs')).to.equal(15);
});
it('Not manual install', function() {
- var controller = App.WizardStep3Controller.create({
- content: {
- installOptions: {
- manualInstall: false
- }
- }
- });
- expect(controller.get('registrationTimeoutSecs')).to.equal(120);
+ c.set('content.installOptions.manualInstall', false);
+ expect(c.get('registrationTimeoutSecs')).to.equal(120);
});
});
@@ -159,28 +154,35 @@ describe('App.WizardStep3Controller', function () {
}
];
tests.forEach(function(test) {
- var controller = App.WizardStep3Controller.create();
- controller.set('warnings', test.warnings);
it(test.m, function() {
- expect(controller.get('isHostHaveWarnings')).to.equal(test.e);
+ c.set('warnings', test.warnings);
+ expect(c.get('isHostHaveWarnings')).to.equal(test.e);
});
});
});
describe('#isWarningsBoxVisible', function() {
+
+ afterEach(function() {
+ App.get.restore();
+ });
+
it('for testMode should be always true', function() {
- App.testMode = true;
+ sinon.stub(App, 'get', function(k) {
+ if ('testMode' === k) return true;
+ return Em.get(App, k);
+ });
expect(c.get('isWarningsBoxVisible')).to.equal(true);
- App.testMode = false;
});
it('for "real" mode should be based on isRegistrationInProgress', function() {
- c.set('disablePreviousSteps', Em.K);
- App.testMode = false;
+ sinon.stub(App, 'get', function(k) {
+ if ('testMode' === k) return false;
+ return Em.get(App, k);
+ });
c.set('isRegistrationInProgress', false);
expect(c.get('isWarningsBoxVisible')).to.equal(true);
c.set('isRegistrationInProgress', true);
expect(c.get('isWarningsBoxVisible')).to.equal(false);
- App.testMode = true;
});
});
@@ -218,20 +220,28 @@ describe('App.WizardStep3Controller', function () {
});
describe('#loadStep', function() {
+
+ beforeEach(function() {
+ sinon.stub(App.router, 'get', function(k) {
+ if ('clusterController' === k) {
+ return Em.Object.create({
+ loadAmbariProperties: Em.K
+ });
+ }
+ return Em.get(App.router, k);
+ });
+ });
+
+ afterEach(function() {
+ App.router.get.restore();
+ });
+
it('should set registrationStartedAt to null', function() {
c.set('disablePreviousSteps', Em.K);
c.set('registrationStartedAt', {});
c.loadStep();
expect(c.get('registrationStartedAt')).to.be.null;
});
- it('should set isLoaded to false', function() {
- c.set('disablePreviousSteps', Em.K);
- c.set('clearStep', Em.K);
- c.set('loadHosts', Em.K);
- c.set('isLoaded', true);
- c.loadStep();
- expect(c.get('isLoaded')).to.equal(false);
- });
it('should call clearStep', function() {
c.set('disablePreviousSteps', Em.K);
c.set('loadHosts', Em.K);
@@ -259,36 +269,57 @@ describe('App.WizardStep3Controller', function () {
});
describe('#loadHosts', function() {
+
+ afterEach(function() {
+ App.get.restore();
+ });
+
it('should set isLoaded to true', function() {
+ sinon.stub(App, 'get', function(k) {
+ if ('testMode' === k) return true;
+ return Em.get(App, k);
+ });
c.set('navigateStep', Em.K);
c.set('content', {hosts: {}});
c.loadHosts();
expect(c.get('isLoaded')).to.equal(true);
});
it('should set bootStatus REGISTERED on testMode', function() {
- App.testMode = true;
+ sinon.stub(App, 'get', function(k) {
+ if ('testMode' === k) return true;
+ return Em.get(App, k);
+ });
c.set('navigateStep', Em.K);
c.set('content', {hosts: {c: {name: 'name'}}});
c.loadHosts();
expect(c.get('hosts').everyProperty('bootStatus', 'REGISTERED')).to.equal(true);
});
it('should set bootStatus DONE on "real" mode and when installOptions.manualInstall is selected', function() {
- App.testMode = false;
+ sinon.stub(App, 'get', function(k) {
+ if ('testMode' === k) return false;
+ return Em.get(App, k);
+ });
c.set('navigateStep', Em.K);
- c.set('content', {installOptions:{manualInstall: true}, hosts: {c: {name: 'name'}}});
+ c.set('content.installOptions', {manualInstall: true});
+ c.set('content.hosts', {c: {name: 'name'}});
c.loadHosts();
expect(c.get('hosts').everyProperty('bootStatus', 'DONE')).to.equal(true);
- App.testMode = true;
});
it('should set bootStatus PENDING on "real" mode and when installOptions.manualInstall is not selected', function() {
- App.testMode = false;
+ sinon.stub(App, 'get', function(k) {
+ if ('testMode' === k) return false;
+ return Em.get(App, k);
+ });
c.set('navigateStep', Em.K);
c.set('content', {installOptions:{manualInstall: false}, hosts: {c: {name: 'name'}}});
c.loadHosts();
expect(c.get('hosts').everyProperty('bootStatus', 'PENDING')).to.equal(true);
- App.testMode = true;
});
it('should set bootStatus PENDING on "real" mode and when installOptions.manualInstall is not selected', function() {
+ sinon.stub(App, 'get', function(k) {
+ if ('testMode' === k) return true;
+ return Em.get(App, k);
+ });
c.set('navigateStep', Em.K);
c.set('content', {hosts: {c: {name: 'name'}, d: {name: 'name1'}}});
c.loadHosts();
@@ -367,6 +398,7 @@ describe('App.WizardStep3Controller', function () {
});
describe('#removeHosts', function() {
+
it('should call App.showConfirmationPopup', function() {
sinon.spy(App, 'showConfirmationPopup');
c.removeHosts(Em.A([]));
@@ -659,7 +691,7 @@ describe('App.WizardStep3Controller', function () {
describe('#isHostsRegistered', function() {
beforeEach(function() {
- sinon.spy(App.ajax, 'send');
+ sinon.stub(App.ajax, 'send', function() {return {retry: function() {return {then: Em.K}}}});
});
afterEach(function() {
App.ajax.send.restore();
@@ -697,7 +729,7 @@ describe('App.WizardStep3Controller', function () {
data: {items:[{Hosts: {host_name: 'c1'}}]},
m: ' one host REGISTERING',
e: {
- bs: 'FAILED',
+ bs: 'REGISTERED',
getHostInfoCalled: false
}
},
@@ -727,6 +759,7 @@ describe('App.WizardStep3Controller', function () {
tests.forEach(function(test) {
it(test.m, function() {
sinon.spy(c, 'getHostInfo');
+ c.set('content.installedHosts', []);
c.set('bootHosts', test.bootHosts);
c.isHostsRegisteredSuccessCallback(test.data);
expect(c.get('bootHosts')[0].get('bootStatus')).to.equal(test.e.bs);
@@ -802,7 +835,7 @@ describe('App.WizardStep3Controller', function () {
]);
tests.forEach(function(test) {
it(test.m, function() {
- c.reopen({hostsInCluster: test.hostsInCluster, setRegistrationInProgress: Em.K});
+ c.reopen({setRegistrationInProgress: Em.K, hostsInCluster: test.hostsInCluster});
c.set('bootHosts', test.bootHosts);
c.getAllRegisteredHostsCallback({items:test.hosts});
expect(c.get('hasMoreRegisteredHosts')).to.equal(test.e.hasMoreRegisteredHosts);
@@ -879,13 +912,13 @@ describe('App.WizardStep3Controller', function () {
var bootHosts = [{name: 'c1'}];
c.reopen({isHostHaveWarnings: true, bootHosts: bootHosts, hosts: []});
c.submit().onPrimary();
- expect(c.get('content.hosts')).to.eql(bootHosts);
+ expect(c.get('confirmedHosts')).to.eql(bootHosts);
});
it('if isHostHaveWarnings is false should set bootHosts to content.hosts', function() {
var bootHosts = [{name: 'c1'}];
c.reopen({isHostHaveWarnings: false, bootHosts: bootHosts, hosts: []});
c.submit();
- expect(c.get('content.hosts')).to.eql(bootHosts);
+ expect(c.get('confirmedHosts')).to.eql(bootHosts);
});
});
@@ -907,16 +940,16 @@ describe('App.WizardStep3Controller', function () {
});
it('should set checksUpdateProgress to 100', function() {
c.set('checksUpdateProgress', 0);
- c.rerunChecksSuccessCallback({});
+ c.rerunChecksSuccessCallback({items: []});
expect(c.get('checksUpdateProgress')).to.equal(100);
});
it('should set checksUpdateStatus to SUCCESS', function() {
c.set('checksUpdateStatus', '');
- c.rerunChecksSuccessCallback({});
+ c.rerunChecksSuccessCallback({items: []});
expect(c.get('checksUpdateStatus')).to.equal('SUCCESS');
});
- it('should set call parseWarnings', function() {
- c.rerunChecksSuccessCallback({});
+ it('should call parseWarnings', function() {
+ c.rerunChecksSuccessCallback({items: []});
expect(c.parseWarnings.calledOnce).to.equal(true);
});
});
@@ -963,19 +996,19 @@ describe('App.WizardStep3Controller', function () {
e: []
},
{
- bootHosts: [
- Em.Object.create({name: 'c1'}),
- Em.Object.create({name: 'c2'})
- ],
+ bootHosts: [
+ Em.Object.create({name: 'c1'}),
+ Em.Object.create({name: 'c2'})
+ ],
data: {
- items: [
- {Hosts: {host_name: 'c1'}},
- {Hosts: {host_name: 'c2'}}
- ]
- },
- m: 'many hosts',
+ items: [
+ {Hosts: {host_name: 'c1'}},
+ {Hosts: {host_name: 'c2'}}
+ ]
+ },
+ m: 'many hosts',
e: ['c1', 'c2']
- }
+ }
]);
tests.forEach(function(test) {
it(test.m, function() {
@@ -1020,13 +1053,26 @@ describe('App.WizardStep3Controller', function () {
});
describe('#parseWarnings', function() {
+
+ beforeEach(function() {
+ sinon.stub(App, 'get', function(k) {
+ if ('testMode' === k) return false;
+ return Em.get(App, k);
+ });
+ sinon.stub(c, 'filterBootHosts', function(k) {return k;});
+ });
+
+ afterEach(function() {
+ App.get.restore();
+ c.filterBootHosts.restore();
+ });
+
it('no warnings if last_agent_env isn\'t specified', function() {
c.set('warnings', [{}]);
c.set('warningsByHost', [{},{}]);
c.parseWarnings({items:[{Hosts:{host_name:'c1'}}]});
expect(c.get('warnings')).to.eql([]);
expect(c.get('warningsByHost.length')).to.equal(1); // default group
- expect(c.get('isWarningsLoaded')).to.equal(true);
});
Em.A([
@@ -1298,41 +1344,26 @@ describe('App.WizardStep3Controller', function () {
}
])
}
- ]).forEach(function(category) {
- describe(category.m, function() {
- category.tests.forEach(function(test) {
- it(test.m, function() {
- c.parseWarnings({items: test.items});
- c.get('warnings').forEach(function(w, i) {
- Em.keys(test.e.warnings[i]).forEach(function(k) {
- expect(w[k]).to.eql(test.e.warnings[i][k]);
+ ]).forEach(function(category) {
+ describe(category.m, function() {
+ category.tests.forEach(function(test) {
+ it(test.m, function() {
+ c.parseWarnings({items: test.items});
+ c.get('warnings').forEach(function(w, i) {
+ Em.keys(test.e.warnings[i]).forEach(function(k) {
+ expect(w[k]).to.eql(test.e.warnings[i][k]);
+ });
});
- });
- for(var i in test.e.warningsByHost) {
- if(test.e.warningsByHost.hasOwnProperty(i)) {
- expect(c.get('warningsByHost')[i].warnings.length).to.equal(test.e.warningsByHost[i]);
+ for(var i in test.e.warningsByHost) {
+ if(test.e.warningsByHost.hasOwnProperty(i)) {
+ expect(c.get('warningsByHost')[i].warnings.length).to.equal(test.e.warningsByHost[i]);
+ }
}
- }
+ });
});
});
});
- });
-
- });
- describe('#hostsInCluster', function() {
- it('should load data from App.Host model', function() {
- var hosts = [
- Em.Object.create({hostName: 'h1'}),
- Em.Object.create({hostName: 'h2'}),
- Em.Object.create({hostName: 'h3'})
- ], expected = ['h1', 'h2', 'h3'];
- sinon.stub(App.Host, 'find', function() {
- return hosts;
- });
- expect(c.get('hostsInCluster')).to.eql(expected);
- App.Host.find.restore();
- });
});
describe('#navigateStep', function() {
@@ -1365,11 +1396,12 @@ describe('App.WizardStep3Controller', function () {
m: 'shouldn\'t call startBootstrap (3)',
e: false
}
- ]).forEach(function(test) {
+ ]).forEach(function(test) {
it(test.m, function() {
c.reopen({
isLoaded: test.isLoaded,
content: {
+ installedHosts: [],
installOptions: {
manualInstall: test.manualInstall
}
@@ -1397,6 +1429,7 @@ describe('App.WizardStep3Controller', function () {
isLoaded: true,
hosts: [{}, {}, {}],
content: {
+ installedHosts: [],
installOptions: {
manualInstall: true
}
@@ -1420,6 +1453,7 @@ describe('App.WizardStep3Controller', function () {
isLoaded: true,
hosts: [{}, {}, {}],
content: {
+ installedHosts: [],
installOptions: {
manualInstall: true
}
@@ -1567,6 +1601,7 @@ describe('App.WizardStep3Controller', function () {
sinon.spy(c, '_setHostDataWithSkipBootstrap');
sinon.stub(App, 'get', function(k) {
if ('skipBootstrap' === k) return true;
+ if ('testMode' === k) return false;
return Em.get(App, k);
});
c.reopen({
@@ -1589,6 +1624,7 @@ describe('App.WizardStep3Controller', function () {
sinon.stub(App, 'get', function(k) {
if ('skipBootstrap' === k) return false;
+ if ('testMode' === k) return false;
return Em.get(App, k);
});
@@ -1616,6 +1652,7 @@ describe('App.WizardStep3Controller', function () {
sinon.stub(App, 'get', function(k) {
if ('skipBootstrap' === k) return false;
+ if ('testMode' === k) return false;
return Em.get(App, k);
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/566e754e/ambari-web/test/controllers/wizard/step4_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step4_test.js b/ambari-web/test/controllers/wizard/step4_test.js
index 71c417b..78fecd4 100644
--- a/ambari-web/test/controllers/wizard/step4_test.js
+++ b/ambari-web/test/controllers/wizard/step4_test.js
@@ -252,54 +252,7 @@ describe('App.WizardStep4Controller', function () {
});
});
- describe('#validateMonitoring', function() {
- beforeEach(function() {
- sinon.stub(controller, 'monitoringCheckPopup', Em.K);
- sinon.stub(App.router, 'send', Em.K);
- });
- afterEach(function() {
- controller.monitoringCheckPopup.restore();
- App.router.send.restore();
- });
- Em.A([
- {
- gangliaOrNagiosNotSelected: true,
- e: {
- monitoringCheckPopup: true,
- send: false
- }
- },
- {
- gangliaOrNagiosNotSelected: false,
- e: {
- monitoringCheckPopup: false,
- send: true
- }
- }
- ]).forEach(function (test) {
- it(test.m, function () {
- sinon.stub(controller, 'gangliaOrNagiosNotSelected', function() {
- return test.gangliaOrNagiosNotSelected;
- });
- controller.validateMonitoring();
- controller.gangliaOrNagiosNotSelected.restore();
- if (test.e.monitoringCheckPopup) {
- expect(controller.monitoringCheckPopup.calledOnce).to.equal(true);
- }
- else {
- expect(controller.monitoringCheckPopup.called).to.equal(false);
- }
- if (test.e.send) {
- expect(App.router.send.calledWith('next')).to.equal(true);
- }
- else {
- expect(App.router.send.called).to.equal(false);
- }
- });
- });
- });
-
- describe('#submit', function() {
+ describe('#submit', function() {
beforeEach(function() {
sinon.stub(controller, 'validateMonitoring', Em.K);
sinon.stub(controller, 'setGroupedServices', Em.K);
http://git-wip-us.apache.org/repos/asf/ambari/blob/566e754e/ambari-web/test/controllers/wizard/step5_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step5_test.js b/ambari-web/test/controllers/wizard/step5_test.js
index 3eb18cb..7b188af 100644
--- a/ambari-web/test/controllers/wizard/step5_test.js
+++ b/ambari-web/test/controllers/wizard/step5_test.js
@@ -286,6 +286,7 @@ describe('App.WizardStep5Controller', function () {
tests.forEach(function (test) {
it(test.componentName + ' ' + test.hostsCount, function () {
+ controller.reopen({multipleComponents: ['HBASE_MASTER', 'ZOOKEEPER_SERVER']});
controller.set('hosts', d3.range(1, test.hostsCount + 1).map(function (i) {
return {host_name: 'host' + i.toString()};
}));
@@ -338,13 +339,6 @@ describe('App.WizardStep5Controller', function () {
});
- describe('#isSubmitDisabled', function () {
- it('should be false if it\'s not a isReassignWizard', function () {
- c.set('controllerName', 'addServiceController');
- expect(c.get('isSubmitDisabled')).to.equal(false);
- });
- });
-
describe('#remainingHosts', function () {
it('should show count of hosts without masters', function () {
c.reopen({masterHostMapping: [
@@ -530,25 +524,6 @@ describe('App.WizardStep5Controller', function () {
showRemoveControl: [false, false],
serviceComponentId: [1, 2]
}
- },
- {
- masterComponents: Em.A([
- {component_name: 'ZOOKEEPER_SERVER'},
- {component_name: 'ZOOKEEPER_SERVER'},
- {component_name: 'NAMENODE'}
- ]),
- services: Em.A([
- Em.Object.create({serviceName: 'ZOOKEEPER', isInstalled: false, isSelected: true})
- ]),
- controllerName: 'addServiceController',
- m: 'Two components, but service is not installed',
- component_name: 'ZOOKEEPER_SERVER',
- e: {
- selectedServicesMasters: ['ZOOKEEPER_SERVER', 'ZOOKEEPER_SERVER', 'NAMENODE'],
- servicesMasters: ['ZOOKEEPER_SERVER', 'ZOOKEEPER_SERVER', 'NAMENODE'],
- showRemoveControl: [true, true, undefined],
- serviceComponentId: [1, 2, undefined]
- }
}
]);
tests.forEach(function (test) {
@@ -633,10 +608,7 @@ describe('App.WizardStep5Controller', function () {
describe('#submit', function () {
beforeEach(function () {
- if (!App.router) {
- App.router = Em.Object.create({send: Em.K});
- }
- sinon.spy(App.router, 'send');
+ sinon.stub(App.router, 'send', Em.K);
});
afterEach(function () {
App.router.send.restore();
@@ -646,9 +618,11 @@ describe('App.WizardStep5Controller', function () {
c.submit();
expect(App.router.send.calledWith('next')).to.equal(true);
});
- it('shouldn\'t go next if isSubmitDisabled', function () {
- c.reopen({isSubmitDisabled: true});
+ it('shouldn\'t go next if submitDisabled true', function () {
+ sinon.stub(c, 'getIsSubmitDisabled', Em.K);
+ c.reopen({submitDisabled: true});
c.submit();
+ c.getIsSubmitDisabled.restore();
expect(App.router.send.called).to.equal(false);
});
});
@@ -820,37 +794,6 @@ describe('App.WizardStep5Controller', function () {
});
});
- describe('#loadStep', function () {
- var methods = Em.A(['clearStep', 'renderHostInfo', 'renderComponents', 'loadComponents']);
- describe('should call several methods', function () {
- beforeEach(function () {
- methods.forEach(function (m) {
- sinon.spy(c, m);
- });
- c.reopen({content: {services: Em.A([])}});
- });
- afterEach(function () {
- methods.forEach(function (m) {
- c[m].restore();
- });
- });
- methods.forEach(function (m) {
- it(m, function () {
- c.loadStep();
- expect(c[m].calledOnce).to.equal(true);
- });
- });
- });
- it('should update HBASE if App.supports.multipleHBaseMasters is true', function () {
- App.set('supports.multipleHBaseMasters', true);
- sinon.spy(c, 'updateComponent');
- c.reopen({content: {services: Em.A([])}});
- c.loadStep();
- expect(c.updateComponent.calledTwice).to.equal(true);
- c.updateComponent.restore();
- });
- });
-
describe('#title', function () {
it('should be custom title for reassignMasterController', function () {
c.set('content', {controllerName: 'reassignMasterController'});
@@ -862,63 +805,6 @@ describe('App.WizardStep5Controller', function () {
});
});
- describe('#isSubmitDisabled', function () {
- it('should be false if no isReassignWizard', function () {
- c.reopen({isReassignWizard: false});
- expect(c.get('isSubmitDisabled')).to.equal(false);
- });
- it('should be true if isReassignWizard', function () {
- var hostComponents = Em.A([
- Em.Object.create({componentName: 'c1', host: Em.Object.create({hostName: 'h1'})}),
- Em.Object.create({componentName: 'c1', host: Em.Object.create({hostName: 'h2'})})
- ]);
- sinon.stub(App.HostComponent, 'find', function () {
- return hostComponents;
- });
- c.reopen({
- isReassignWizard: true,
- content: {
- reassign: {
- component_name: 'c1'
- }
- },
- servicesMasters: [
- {selectedHost: 'h5'},
- {selectedHost: 'h4'},
- {selectedHost: 'h3'}
- ]
- });
- expect(c.get('isSubmitDisabled')).to.equal(true);
- App.HostComponent.find.restore();
- });
-
- it('should be false if isReassignWizard', function () {
- var hostComponents = Em.A([
- Em.Object.create({componentName: 'c1', host: Em.Object.create({hostName: 'h1'})}),
- Em.Object.create({componentName: 'c1', host: Em.Object.create({hostName: 'h2'})}),
- Em.Object.create({componentName: 'c1', host: Em.Object.create({hostName: 'h3'})})
- ]);
- sinon.stub(App.HostComponent, 'find', function () {
- return hostComponents;
- });
- c.reopen({
- isReassignWizard: true,
- content: {
- reassign: {
- component_name: 'c1'
- }
- },
- servicesMasters: [
- {selectedHost: 'h1'},
- {selectedHost: 'h2'}
- ]
- });
- expect(c.get('isSubmitDisabled')).to.equal(false);
- App.HostComponent.find.restore();
- });
-
- });
-
describe('#masterHostMapping', function () {
Em.A([
{
@@ -981,153 +867,4 @@ describe('App.WizardStep5Controller', function () {
});
});
- describe('#loadComponents', function () {
- Em.A([
- {
- services: [
- Em.Object.create({isSelected: true, serviceName: 's1'})
- ],
- masterComponents: Em.A([
- Em.Object.create({displayName: 'c1d', serviceName: 's1', componentName: 'c1', isShownOnInstallerAssignMasterPage: true})
- ]),
- masterComponentHosts: Em.A([
- {component: 'c1', hostName: 'h2', isInstalled: true}
- ]),
- selectHost: 'h3',
- m: 'savedComponent exists',
- e: {
- component_name: 'c1',
- display_name: 'c1d',
- selectedHost: 'h2',
- isInstalled: true,
- serviceId: 's1'
- }
- },
- {
- services: [
- Em.Object.create({isSelected: true, serviceName: 's1'})
- ],
- masterComponents: Em.A([
- Em.Object.create({displayName: 'c1d', serviceName: 's1', componentName: 'c1', isShownOnInstallerAssignMasterPage: true})
- ]),
- masterComponentHosts: Em.A([
- {component: 'c2', hostName: 'h2', isInstalled: true}
- ]),
- selectHost: 'h3',
- m: 'savedComponent doesn\'t exist',
- e: {
- component_name: 'c1',
- display_name: 'c1d',
- selectedHost: 'h3',
- isInstalled: false,
- serviceId: 's1'
- }
- },
- {
- services: [
- Em.Object.create({isSelected: true, serviceName: 's1'})
- ],
- masterComponents: Em.A([
- Em.Object.create({displayName: 'c1d', serviceName: 's1', componentName: 'ZOOKEEPER_SERVER', isShownOnInstallerAssignMasterPage: true})
- ]),
- masterComponentHosts: Em.A([
- {component: 'c1', hostName: 'h2', isInstalled: true}
- ]),
- selectHost: ['h3'],
- m: 'component ZOOKEEPER_SERVER',
- e: {
- component_name: 'ZOOKEEPER_SERVER',
- display_name: 'c1d',
- selectedHost: 'h3',
- isInstalled: false,
- serviceId: 's1'
- }
- },
- {
- services: [
- Em.Object.create({isSelected: true, serviceName: 's1'})
- ],
- masterComponents: Em.A([
- Em.Object.create({displayName: 'c1d', serviceName: 's1', componentName: 'HBASE_MASTER', isShownOnInstallerAssignMasterPage: true})
- ]),
- masterComponentHosts: Em.A([
- {component: 'c1', hostName: 'h2', isInstalled: true}
- ]),
- selectHost: ['h3'],
- m: 'component HBASE_MASTER',
- e: {
- component_name: 'HBASE_MASTER',
- display_name: 'c1d',
- selectedHost: 'h3',
- isInstalled: false,
- serviceId: 's1'
- }
- },
- {
- services: [
- Em.Object.create({isSelected: true, serviceName: 's1'})
- ],
- masterComponents: Em.A([
- Em.Object.create({displayName: 'c1d', serviceName: 's1', componentName: 'ZOOKEEPER_SERVER', isShownOnInstallerAssignMasterPage: true})
- ]),
- masterComponentHosts: Em.A([
- {component: 'ZOOKEEPER_SERVER', hostName: 'h2', isInstalled: true}
- ]),
- selectHost: ['h3'],
- m: 'component ZOOKEEPER_SERVER(2)',
- e: {
- component_name: 'ZOOKEEPER_SERVER',
- display_name: 'c1d',
- selectedHost: 'h2',
- isInstalled: true,
- serviceId: 's1'
- }
- },
- {
- services: [
- Em.Object.create({isSelected: true, serviceName: 's1'})
- ],
- masterComponents: Em.A([
- Em.Object.create({displayName: 'c1d', serviceName: 's1', componentName: 'HBASE_MASTER', isShownOnInstallerAssignMasterPage: true})
- ]),
- masterComponentHosts: Em.A([
- {component: 'HBASE_MASTER', hostName: 'h2', isInstalled: true}
- ]),
- selectHost: ['h3'],
- m: 'component HBASE_MASTER (2)',
- e: {
- component_name: 'HBASE_MASTER',
- display_name: 'c1d',
- selectedHost: 'h2',
- isInstalled: true,
- serviceId: 's1'
- }
- }
- ]).forEach(function (test) {
- it(test.m, function () {
- c.reopen({
- content: {
- masterComponentHosts: test.masterComponentHosts
- }
- });
- sinon.stub(App.StackService, 'find', function () {
- return test.services;
- });
- sinon.stub(App.StackServiceComponent, 'find', function () {
- return test.masterComponents;
- });
- sinon.stub(c, 'selectHost', function () {
- return test.selectHost;
- });
- var r = c.loadComponents();
- App.StackService.find.restore();
- App.StackServiceComponent.find.restore();
- c.selectHost.restore();
- expect(r.length).to.equal(1);
- Em.keys(test.e).forEach(function (k) {
- expect(r[0][k]).to.equal(test.e[k]);
- });
- });
- });
- });
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/566e754e/ambari-web/test/controllers/wizard/step6_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step6_test.js b/ambari-web/test/controllers/wizard/step6_test.js
index 7b28e1f..98a40a1 100644
--- a/ambari-web/test/controllers/wizard/step6_test.js
+++ b/ambari-web/test/controllers/wizard/step6_test.js
@@ -74,296 +74,6 @@ describe('App.WizardStep6Controller', function () {
});
-
- describe('#loadStep', function () {
- Em.A([
- {
- isMasters: false,
- services: [
- Em.Object.create({
- serviceName: 'MAPREDUCE',
- isSelected: true
- })
- ],
- e: {
- l: 2,
- allChecked: false,
- noChecked: true
- }
- },
- {
- isMasters: false,
- services: [
- Em.Object.create({
- serviceName: 'MAPREDUCE',
- isSelected: true
- }),
- Em.Object.create({
- serviceName: 'YARN',
- isSelected: true
- })
- ],
- e: {
- l: 3,
- allChecked: false,
- noChecked: true
- }
- },
- {
- isMasters: false,
- services: [
- Em.Object.create({
- serviceName: 'MAPREDUCE',
- isSelected: true
- }),
- Em.Object.create({
- serviceName: 'YARN',
- isSelected: true
- }),
- Em.Object.create({
- serviceName: 'HBASE',
- isSelected: true
- })
- ],
- e: {
- l: 4,
- allChecked: false,
- noChecked: true
- }
- },
- {
- isMasters: false,
- services: [
- Em.Object.create({
- serviceName: 'MAPREDUCE',
- isSelected: true
- }),
- Em.Object.create({
- serviceName: 'YARN',
- isSelected: true
- }),
- Em.Object.create({
- serviceName: 'HBASE',
- isSelected: true
- }),
- Em.Object.create({
- serviceName: 'HDFS',
- isSelected: true
- })
- ],
- e: {
- l: 5,
- allChecked: false,
- noChecked: true
- }
- },
- {
- isMasters: false,
- services: [
- Em.Object.create({
- serviceName: 'MAPREDUCE',
- isSelected: true
- }),
- Em.Object.create({
- serviceName: 'YARN',
- isSelected: true
- }),
- Em.Object.create({
- serviceName: 'HBASE',
- isSelected: true
- }),
- Em.Object.create({
- serviceName: 'HDFS',
- isSelected: true
- }),
- Em.Object.create({
- serviceName: 'STORM',
- isSelected: true
- })
- ],
- e: {
- l: 6,
- allChecked: false,
- noChecked: true
- }
- },
- {
- isMasters: false,
- services: [
- Em.Object.create({
- serviceName: 'MAPREDUCE',
- isSelected: true
- }),
- Em.Object.create({
- serviceName: 'YARN',
- isSelected: true
- }),
- Em.Object.create({
- serviceName: 'HBASE',
- isSelected: true
- }),
- Em.Object.create({
- serviceName: 'HDFS',
- isSelected: true
- }),
- Em.Object.create({
- serviceName: 'STORM',
- isSelected: true
- }),
- Em.Object.create({
- serviceName: 'FLUME',
- isSelected: true
- })
- ],
- e: {
- l: 7,
- allChecked: false,
- noChecked: true
- }
- },
- {
- isMasters: true,
- multipleHBaseMasters: true,
- services: [
- Em.Object.create({
- serviceName: 'HBASE',
- isSelected: true
- })
- ],
- e: {
- l: 1,
- allChecked: false,
- noChecked: true
- }
- },
- {
- isMasters: true,
- multipleHBaseMasters: false,
- services: [
- Em.Object.create({
- serviceName: 'HBASE',
- isSelected: true
- })
- ],
- e: {
- l: 0,
- allChecked: false,
- noChecked: true
- }
- },
- {
- isMasters: true,
- services: [
- Em.Object.create({
- serviceName: 'ZOOKEEPER',
- isSelected: true
- })
- ],
- e: {
- l: 1,
- allChecked: false,
- noChecked: true
- }
- }
- ]).forEach(function (test) {
- it(test.isMasters.toString() + ' ' + test.services.mapProperty('serviceName').join(', '), function () {
- if (test.hasOwnProperty('multipleHBaseMasters')) {
- App.set('supports.multipleHBaseMasters', test.multipleHBaseMasters);
- }
- controller.set('content.services', test.services);
- controller.set('isMasters', test.isMasters);
- sinon.stub(controller, 'render', Em.K);
- controller.loadStep();
- expect(controller.get('headers.length')).to.equal(test.e.l);
- expect(controller.get('headers').everyProperty('allChecked', test.e.allChecked)).to.equal(true);
- expect(controller.get('headers').everyProperty('noChecked', test.e.noChecked)).to.equal(true);
- controller.clearStep();
- controller.render.restore();
- });
- });
-
- Em.A([
- {
- p: {
- isMasters: true,
- skipMasterStep: true
- },
- e: true
- },
- {
- p: {
- isMasters: false,
- skipMasterStep: true
- },
- e: false
- },
- {
- p: {
- isMasters: true,
- skipMasterStep: false
- },
- e: false
- },
- {
- p: {
- isMasters: false,
- skipMasterStep: false
- },
- e: false
- }
- ]).forEach(function (test) {
- it('should skip this step if isMasters is ' + test.p.isMasters + ' and content.skipMasterStep is ' + test.p.skipMasterStep, function () {
- controller.set('isMasters', test.p.isMasters);
- controller.set('content.skipMasterStep', test.p.skipMasterStep);
- sinon.stub(App.router, 'send', Em.K);
- controller.loadStep();
- expect(App.router.send.calledWith('next')).to.equal(test.e);
- App.router.send.restore();
- });
- });
-
- Em.A([
- {
- p: {
- isMasters: true,
- skipSlavesStep: true
- },
- e: false
- },
- {
- p: {
- isMasters: false,
- skipSlavesStep: true
- },
- e: true
- },
- {
- p: {
- isMasters: true,
- skipSlavesStep: false
- },
- e: false
- },
- {
- p: {
- isMasters: false,
- skipSlavesStep: false
- },
- e: false
- }
- ]).forEach(function (test) {
- it('should skip this step if isMasters is ' + test.p.isMasters + ' and content.skipSlavesStep is ' + test.p.skipSlavesStep, function () {
- controller.set('isMasters', test.p.isMasters);
- controller.set('content.skipSlavesStep', test.p.skipSlavesStep);
- sinon.stub(App.router, 'send', Em.K);
- controller.loadStep();
- expect(App.router.send.calledWith('next')).to.equal(test.e);
- App.router.send.restore();
- });
- });
-
- });
-
describe('#isAddHostWizard', function () {
it('true if content.controllerName is addHostController', function () {
controller.set('content.controllerName', 'addHostController');
@@ -397,48 +107,6 @@ describe('App.WizardStep6Controller', function () {
});
});
- describe('#setAllNodes', function () {
-
- var test_config = Em.A([
- {
- title: 'DataNode',
- name: 'DATANODE',
- state: false
- },
- {
- title: 'DataNode',
- name: 'DATANODE',
- state: true
- },
- {
- title: 'TaskTracker',
- name: 'TASKTRACKER',
- state: false
- },
- {
- title: 'TaskTracker',
- name: 'TASKTRACKER',
- state: true
- }
- ]);
-
- test_config.forEach(function (test) {
- it((test.state ? 'Select' : 'Deselect') + ' all ' + test.title, function () {
- controller.loadStep();
- controller.setAllNodes(test.name, test.state);
- var hosts = controller.get('hosts');
- hosts.forEach(function (host) {
- var cb = host.get('checkboxes').filterProperty('isInstalled', false).findProperty('component', test.name);
- if (cb) {
- expect(cb.get('checked')).to.equal(test.state);
- }
- });
- });
- });
-
-
- });
-
describe('#isServiceSelected', function () {
describe('selected', function () {
services.forEach(function (service) {
@@ -453,58 +121,6 @@ describe('App.WizardStep6Controller', function () {
});
});
- describe('#validateEachComponent', function () {
- beforeEach(function () {
- controller.loadStep();
- });
- it('Nothing checked', function () {
- controller.get('hosts').forEach(function (host) {
- host.get('checkboxes').setEach('checked', false);
- });
- expect(controller.validateEachComponent('')).to.equal(false);
- });
- it('One slave is not selected for no one host', function () {
- controller.get('hosts').forEach(function (host) {
- host.get('checkboxes').forEach(function (checkbox, index) {
- checkbox.set('checked', index === 0);
- });
- });
- expect(controller.validateEachComponent('')).to.equal(false);
- });
- it('All checked', function () {
- controller.get('hosts').forEach(function (host) {
- host.get('checkboxes').forEach(function (checkbox) {
- checkbox.set('checked', true);
- });
- });
- expect(controller.validateEachComponent('')).to.equal(true);
- });
- });
-
- describe('#validateEachHost', function () {
- beforeEach(function () {
- controller.loadStep();
- });
- it('Nothing checked', function () {
- controller.get('hosts').forEach(function (host) {
- host.get('checkboxes').setEach('checked', false);
- });
- expect(controller.validateEachHost('')).to.equal(false);
- });
- it('One host doesn\'t have assigned slaves', function () {
- controller.get('hosts').forEach(function (host, index) {
- host.get('checkboxes').setEach('checked', index === 0);
- });
- expect(controller.validateEachHost('')).to.equal(false);
- });
- it('All checked', function () {
- controller.get('hosts').forEach(function (host) {
- host.get('checkboxes').setEach('checked', true);
- });
- expect(controller.validateEachHost('')).to.equal(true);
- });
- });
-
describe('#clearStep', function () {
beforeEach(function () {
sinon.stub(controller, 'clearError', Em.K);
@@ -943,35 +559,7 @@ describe('App.WizardStep6Controller', function () {
});
});
- describe('#render', function () {
- beforeEach(function () {
- sinon.stub(controller, 'selectMasterComponents', Em.K);
- sinon.stub(controller, 'renderSlaves', Em.K);
- });
- afterEach(function () {
- controller.selectMasterComponents.restore();
- controller.renderSlaves.restore();
- });
- it('should call selectMasterComponents if isMasters is true', function () {
- controller.set('isMasters', true);
- controller.render();
- expect(controller.selectMasterComponents.calledOnce).to.equal(true);
- expect(controller.renderSlaves.called).to.equal(false);
- });
- it('should call renderSlaves if isMasters is false', function () {
- controller.set('isMasters', false);
- controller.render();
- expect(controller.selectMasterComponents.called).to.equal(false);
- expect(controller.renderSlaves.calledOnce).to.equal(true);
- });
- it('should set isLoaded to true', function () {
- controller.set('isLoaded', false);
- controller.render();
- expect(controller.get('isLoaded')).to.equal(true);
- });
- });
-
- describe('#renderSlaves', function () {
+ describe.skip('#renderSlaves', function () {
Em.A([
{
controllerName: 'addServiceController',
http://git-wip-us.apache.org/repos/asf/ambari/blob/566e754e/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 b49c29c..432f265 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -83,27 +83,6 @@ describe('App.InstallerStep7Controller', function () {
}),
e: ['HIVE', 'HDFS'],
m: 'addServiceController without SQOOP'
- },
- {
- content: Em.Object.create({
- controllerName: 'addServiceController',
- services: Em.A([
- Em.Object.create({
- isInstalled: true,
- serviceName: 'SQOOP'
- }),
- Em.Object.create({
- isInstalled: true,
- serviceName: 'HIVE'
- }),
- Em.Object.create({
- isInstalled: true,
- serviceName: 'HDFS'
- })
- ])
- }),
- e: ['HIVE', 'HDFS'],
- m: 'addServiceController with SQOOP'
}
]);
@@ -171,14 +150,14 @@ describe('App.InstallerStep7Controller', function () {
it('should use content.services as source of data', function () {
installerStep7Controller.set('content', {
services: [
- {isSelected: true, isInstalled: false, serviceName: 's1'},
- {isSelected: false, isInstalled: false, serviceName: 's2'},
- {isSelected: true, isInstalled: true, serviceName: 's3'},
- {isSelected: false, isInstalled: false, serviceName: 's4'},
- {isSelected: true, isInstalled: false, serviceName: 's5'},
- {isSelected: false, isInstalled: false, serviceName: 's6'},
- {isSelected: true, isInstalled: true, serviceName: 's7'},
- {isSelected: false, isInstalled: false, serviceName: 's8'}
+ Em.Object.create({isSelected: true, isInstalled: false, serviceName: 's1'}),
+ Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's2'}),
+ Em.Object.create({isSelected: true, isInstalled: true, serviceName: 's3'}),
+ Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's4'}),
+ Em.Object.create({isSelected: true, isInstalled: false, serviceName: 's5'}),
+ Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's6'}),
+ Em.Object.create({isSelected: true, isInstalled: true, serviceName: 's7'}),
+ Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's8'})
]
});
var expected = ['s1', 's3', 's5', 's7'];
@@ -211,14 +190,6 @@ describe('App.InstallerStep7Controller', function () {
});
describe('#clearStep', function () {
- it('should clear serviceConfigTags', function () {
- installerStep7Controller.set('serviceConfigTags', [
- {},
- {}
- ]);
- installerStep7Controller.clearStep();
- expect(installerStep7Controller.get('serviceConfigTags.length')).to.equal(0);
- });
it('should clear stepConfigs', function () {
installerStep7Controller.set('stepConfigs', [
{},
@@ -312,25 +283,6 @@ describe('App.InstallerStep7Controller', function () {
});
});
- describe('#submit', function () {
- beforeEach(function () {
- sinon.stub(App.router, 'send', Em.K);
- });
- afterEach(function () {
- App.router.send.restore();
- });
- it('should proceed if submit is not disabled', function () {
- installerStep7Controller.reopen({isSubmitDisabled: false});
- installerStep7Controller.submit();
- expect(App.router.send.calledOnce).to.equal(true);
- });
- it('should not proceed if submit is disabled', function () {
- installerStep7Controller.reopen({isSubmitDisabled: true});
- installerStep7Controller.submit();
- expect(App.router.send.called).to.equal(false);
- });
- });
-
describe('#addOverrideProperty', function () {
it('should add override property', function () {
var groupName = 'groupName',
@@ -354,57 +306,8 @@ describe('App.InstallerStep7Controller', function () {
});
});
- describe('#getConfigTagsSuccess', function () {
- it('should update serviceConfigTags', function () {
- var installedServiceNames = ['s1', 's2'],
- serviceConfigsData = [
- {serviceName: 's1', sites: ['s1-site', 's1-log']},
- {serviceName: 's2', sites: ['s2-site', 'core-site']},
- {serviceName: 's3', sites: ['s3-site']}
- ],
- data = {
- Clusters: {
- desired_configs: {
- "core-site": {
- "user": "admin",
- "tag": "version1398780546992"
- },
- "global": {
- "user": "admin",
- "tag": "version1398780546992"
- },
- "s1-site": {
- "user": "admin",
- "tag": "version1"
- },
- "s1-log": {
- "user": "admin",
- "tag": "version1"
- },
- "s2-site": {
- "user": "admin",
- "tag": "version1"
- },
- "s3-site": {
- "user": "admin",
- "tag": "version1"
- }
- }
- }
- },
- serviceConfigTags = [
- {siteName: 'core-site', tagName: 'version1398780546992', newTagName: null},
- {siteName: 's1-site', tagName: 'version1', newTagName: null},
- {siteName: 's1-log', tagName: 'version1', newTagName: null},
- {siteName: 's2-site', tagName: 'version1', newTagName: null}
- ];
- installerStep7Controller.reopen({serviceConfigsData: serviceConfigsData, installedServiceNames: installedServiceNames});
- installerStep7Controller.getConfigTagsSuccess(data);
- expect(installerStep7Controller.get('serviceConfigTags')).to.eql(serviceConfigTags);
- });
- });
-
describe('#resolveStormConfigs', function () {
+
beforeEach(function () {
installerStep7Controller.reopen({
content: {services: []},
@@ -417,6 +320,7 @@ describe('App.InstallerStep7Controller', function () {
})
});
});
+
it('shouldn\'t do nothing if Ganglia and Storm are installed', function () {
var installedServiceNames = ['GANGLIA', 'STORM'],
configs = [
@@ -433,6 +337,7 @@ describe('App.InstallerStep7Controller', function () {
installerStep7Controller.resolveStormConfigs(configs);
expect(configs).to.eql(expected);
});
+
it('shouldn\'t do nothing if Ganglia is in allSelectedServiceNames', function () {
var allSelectedServiceNames = ['GANGLIA'],
configs = [
@@ -441,9 +346,9 @@ describe('App.InstallerStep7Controller', function () {
{name: 'worker.childopts', value: '.jar=host=', defaultValue: ''}
],
expected = [
- {name: 'nimbus.childopts', value: '.jar=host=h1', defaultValue: '.jar=host=h1', forceUpdate: true},
- {name: 'supervisor.childopts', value: '.jar=host=h1', defaultValue: '.jar=host=h1', forceUpdate: true},
- {name: 'worker.childopts', value: '.jar=host=h1', defaultValue: '.jar=host=h1', forceUpdate: true}
+ {name: 'nimbus.childopts', value: 'h1', defaultValue: 'h1', forceUpdate: true},
+ {name: 'supervisor.childopts', value: 'h1', defaultValue: 'h1', forceUpdate: true},
+ {name: 'worker.childopts', value: 'h1', defaultValue: 'h1', forceUpdate: true}
];
installerStep7Controller.reopen({allSelectedServiceNames: allSelectedServiceNames});
installerStep7Controller.resolveStormConfigs(configs);
@@ -451,7 +356,8 @@ describe('App.InstallerStep7Controller', function () {
expect(configs.mapProperty(k)).to.eql(expected.mapProperty(k));
});
});
- it('shouldn\'t do nothing if Ganglia is in installedServiceNames', function () {
+
+ it('shouldn\'t do nothing if Ganglia is in installedServiceNames (2)', function () {
var installedServiceNames = ['GANGLIA'],
configs = [
{name: 'nimbus.childopts', value: '.jar=host=', defaultValue: ''},
@@ -459,9 +365,9 @@ describe('App.InstallerStep7Controller', function () {
{name: 'worker.childopts', value: '.jar=host=', defaultValue: ''}
],
expected = [
- {name: 'nimbus.childopts', value: '.jar=host=h1', defaultValue: '.jar=host=h1', forceUpdate: true},
- {name: 'supervisor.childopts', value: '.jar=host=h1', defaultValue: '.jar=host=h1', forceUpdate: true},
- {name: 'worker.childopts', value: '.jar=host=h1', defaultValue: '.jar=host=h1', forceUpdate: true}
+ {name: 'nimbus.childopts', value: 'h1', defaultValue: 'h1', forceUpdate: true},
+ {name: 'supervisor.childopts', value: 'h1', defaultValue: 'h1', forceUpdate: true},
+ {name: 'worker.childopts', value: 'h1', defaultValue: 'h1', forceUpdate: true}
];
installerStep7Controller.reopen({installedServiceNames: installedServiceNames});
installerStep7Controller.resolveStormConfigs(configs);
@@ -469,6 +375,7 @@ describe('App.InstallerStep7Controller', function () {
expect(configs.mapProperty(k)).to.eql(expected.mapProperty(k));
});
});
+
});
describe('#resolveServiceDependencyConfigs', function () {
@@ -578,7 +485,7 @@ describe('App.InstallerStep7Controller', function () {
{service: {id: 's1'}}
];
installerStep7Controller.reopen({
- stepConfigs: [Em.Object.create({serviceName: serviceName, configGroups: configGroups})]
+ stepConfigs: [Em.Object.create({serviceName: serviceName, displayName: serviceName, configGroups: configGroups})]
});
installerStep7Controller.loadConfigGroups(serviceConfigGroups);
expect(installerStep7Controller.get('stepConfigs.firstObject.configGroups.length')).to.equal(1);
@@ -597,7 +504,7 @@ describe('App.InstallerStep7Controller', function () {
{service: {id: 'HDFS'}, isDefault: true, n: 'n1'}
];
installerStep7Controller.reopen({
- stepConfigs: [Em.Object.create({serviceName: serviceName, configGroups: configGroups})]
+ stepConfigs: [Em.Object.create({serviceName: serviceName, displayName: serviceName, configGroups: configGroups})]
});
installerStep7Controller.loadConfigGroups(serviceConfigGroups);
expect(installerStep7Controller.get('stepConfigs.firstObject.configGroups').findProperty('isDefault').get('n')).to.equal('n1');
@@ -907,11 +814,11 @@ describe('App.InstallerStep7Controller', function () {
Em.Object.create({
serviceName: 'HDFS',
configs: [
- {category: 'SNameNode'},
- {category: 'SNameNode'},
+ {category: 'SECONDARY_NAMENODE'},
+ {category: 'SECONDARY_NAMENODE'},
{category: 'NameNode'},
{category: 'NameNode'},
- {category: 'SNameNode'}
+ {category: 'SECONDARY_NAMENODE'}
]
}),
Em.Object.create({serviceName: 's2'})]
@@ -1092,10 +999,9 @@ describe('App.InstallerStep7Controller', function () {
App.get.restore();
});
});
- it('should call getConfigTags, setInstalledServiceConfigs for addServiceController', function () {
+ it('should call setInstalledServiceConfigs for addServiceController', function () {
installerStep7Controller.set('wizardController.name', 'addServiceController');
installerStep7Controller.loadStep();
- expect(installerStep7Controller.getConfigTags.calledOnce).to.equal(true);
expect(installerStep7Controller.setInstalledServiceConfigs.calledOnce).to.equal(true);
});
Em.A([
@@ -1310,162 +1216,4 @@ describe('App.InstallerStep7Controller', function () {
});
- describe('#_updateValidatorsForConfig', function () {
-
- it('should set isVisible to false', function () {
- var serviceConfigProperty = Em.Object.create({serviceName: 's1', isVisible: true}),
- component = Em.Object.create({serviceName: 's2'}),
- serviceConfigsData = {};
- installerStep7Controller._updateValidatorsForConfig(serviceConfigProperty, component, serviceConfigsData);
- expect(serviceConfigProperty.get('isVisible')).to.equal(false);
- });
-
- it('should set serviceValidator', function () {
- var serviceConfigProperty = Em.Object.create({serviceName: 's1', name: 'n1', serviceValidator: null}),
- component = Em.Object.create({serviceName: 's1'}),
- serviceConfigsData = {
- configsValidator: Em.Object.create({
- configValidators: {
- n1: {},
- n2: {}
- }
- })
- };
- installerStep7Controller._updateValidatorsForConfig(serviceConfigProperty, component, serviceConfigsData);
- expect(serviceConfigProperty.get('serviceValidator')).to.be.object;
- expect(Em.keys(serviceConfigProperty.get('serviceValidator.configValidators'))).to.eql(['n1', 'n2']);
- });
-
- });
-
- describe('#getRecommendedDefaultsForComponent', function () {
- beforeEach(function () {
- sinon.stub(App.router, 'get', function (k) {
- if (k === 'mainServiceInfoConfigsController') return Em.Object.create({
- getInfoForDefaults: Em.K
- });
- return Em.get(App.router, k);
- });
- });
- afterEach(function () {
- App.router.get.restore();
- });
- it('should return empty object', function () {
- var serviceConfigsData = [
- {serviceName: 's1'}
- ],
- serviceName = 's1';
- installerStep7Controller.reopen({serviceConfigsData: serviceConfigsData});
- var r = installerStep7Controller._getRecommendedDefaultsForComponent(serviceName);
- expect(r).to.eql({});
- });
-
- it('should return recommendedDefaults', function () {
- var serviceConfigsData = [
- {serviceName: 's1', defaultsProviders: [
- {getDefaults: function () {
- return {c1: 'v1', c2: 'v2'};
- }},
- {getDefaults: function () {
- return {c3: 'v3', c4: 'v4'};
- }}
- ]}
- ],
- serviceName = 's1';
- installerStep7Controller.reopen({serviceConfigsData: serviceConfigsData});
- var r = installerStep7Controller._getRecommendedDefaultsForComponent(serviceName);
- expect(r).to.eql({c1: 'v1', c2: 'v2', c3: 'v3', c4: 'v4'});
- });
-
- });
-
- describe('#loadComponentConfigs', function () {
-
- beforeEach(function () {
- sinon.stub(installerStep7Controller, '_updateValidatorsForConfig', Em.K);
- sinon.stub(installerStep7Controller, '_updateOverridesForConfig', Em.K);
- sinon.stub(installerStep7Controller, '_updateIsEditableFlagForConfig', Em.K);
- });
-
- afterEach(function () {
- installerStep7Controller._updateIsEditableFlagForConfig.restore();
- installerStep7Controller._updateOverridesForConfig.restore();
- installerStep7Controller._updateValidatorsForConfig.restore();
- });
-
- it('should set recommended defaults', function () {
- var configs = [],
- serviceConfigsData = [
- {serviceName: 's1', configsValidator: Em.Object.create({recommendedDefaults: {}})}
- ],
- component = Em.Object.create({serviceName: 's1'}),
- componentConfig = {},
- recommendedDefaults = {c1: 'v1', c2: 'v2'};
- installerStep7Controller.reopen({serviceConfigsData: serviceConfigsData});
- sinon.stub(installerStep7Controller, '_getRecommendedDefaultsForComponent', function () {
- return recommendedDefaults;
- });
- installerStep7Controller.loadComponentConfigs(configs, componentConfig, component);
- installerStep7Controller._getRecommendedDefaultsForComponent.restore();
- expect(installerStep7Controller.get('serviceConfigsData.firstObject.configsValidator.recommendedDefaults')).to.eql(recommendedDefaults);
- });
-
- it('should skip null configs', function () {
- var configs = [null, null, null],
- serviceConfigsData = [
- {serviceName: 's1'}
- ],
- component = Em.Object.create({serviceName: 's1'}),
- componentConfig = Em.Object.create({configs: []});
- installerStep7Controller.reopen({serviceConfigsData: serviceConfigsData});
- installerStep7Controller.loadComponentConfigs(configs, componentConfig, component);
- expect(componentConfig.get('configs.length')).to.equal(0);
- });
-
- it('should update isOverridable flag', function () {
- var configs = [Em.Object.create({validate: Em.K}), Em.Object.create({validate: Em.K})],
- componentConfig = Em.Object.create({configs: []}),
- serviceConfigsData = [
- {serviceName: 's1'}
- ],
- component = Em.Object.create({serviceName: 's1'});
- installerStep7Controller.reopen({serviceConfigsData: serviceConfigsData});
- installerStep7Controller.loadComponentConfigs(configs, componentConfig, component);
- expect(componentConfig.get('configs').getEach('isOverridable')).to.eql([true, true]);
- });
-
- it('should update value for checkboxes', function () {
- var configs = [
- Em.Object.create({displayType: 'checkbox', value: 'true', validate: Em.K}),
- Em.Object.create({displayType: 'checkbox', value: 'false', validate: Em.K})
- ],
- componentConfig = Em.Object.create({configs: []}),
- serviceConfigsData = [
- {serviceName: 's1'}
- ],
- component = Em.Object.create({serviceName: 's1'});
- installerStep7Controller.reopen({serviceConfigsData: serviceConfigsData});
- installerStep7Controller.loadComponentConfigs(configs, componentConfig, component);
- expect(componentConfig.get('configs').getEach('value')).to.eql([true, false]);
- expect(componentConfig.get('configs').getEach('defaultValue')).to.eql([true, false]);
- });
-
- });
-
- describe('#_createSiteToTagMap', function () {
- it('should map sites', function () {
- var desired_configs = {
- s1: {tag: 't1'},
- s2: {tag: 't1'},
- s3: {tag: 't3'},
- s4: {tag: 't1'},
- s5: {tag: 't2'}
- },
- sites = ['s1', 's2', 's3'],
- expected = {s1: 't1', s2: 't1', s3: 't3'};
- var r = installerStep7Controller._createSiteToTagMap(desired_configs, sites);
- expect(r).to.eql(expected);
- });
- });
-
});
\ No newline at end of file