step7_test.js 63 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. var numberUtils = require('utils/number_utils');
  20. require('mixins/common/localStorage');
  21. require('controllers/wizard/step7_controller');
  22. var installerStep7Controller,
  23. issuesFilterCases = [
  24. {
  25. isSubmitDisabled: true,
  26. submitButtonClicked: true,
  27. isIssuesFilterActive: true,
  28. issuesFilterText: '',
  29. issuesFilterLinkText: Em.I18n.t('installer.step7.showAllProperties'),
  30. title: 'issues filter on, submit button clicked'
  31. },
  32. {
  33. isSubmitDisabled: true,
  34. submitButtonClicked: false,
  35. isIssuesFilterActive: true,
  36. issuesFilterText: Em.I18n.t('installer.step7.showingPropertiesWithIssues'),
  37. issuesFilterLinkText: Em.I18n.t('installer.step7.showAllProperties'),
  38. title: 'issues filter on, submit button disabled'
  39. },
  40. {
  41. isSubmitDisabled: true,
  42. submitButtonClicked: true,
  43. isIssuesFilterActive: false,
  44. issuesFilterText: '',
  45. issuesFilterLinkText: '',
  46. title: 'issues filter off, submit button clicked'
  47. },
  48. {
  49. isSubmitDisabled: true,
  50. submitButtonClicked: false,
  51. isIssuesFilterActive: false,
  52. issuesFilterText: '',
  53. issuesFilterLinkText: Em.I18n.t('installer.step7.showPropertiesWithIssues'),
  54. title: 'issues filter off, submit button disabled'
  55. },
  56. {
  57. isSubmitDisabled: false,
  58. submitButtonClicked: false,
  59. isIssuesFilterActive: true,
  60. issuesFilterText: '',
  61. issuesFilterLinkText: Em.I18n.t('installer.step7.showAllProperties'),
  62. title: 'issues filter on, submit button enabled'
  63. },
  64. {
  65. isSubmitDisabled: false,
  66. submitButtonClicked: false,
  67. isIssuesFilterActive: false,
  68. issuesFilterText: '',
  69. issuesFilterLinkText: '',
  70. title: 'issues filter off, submit button enabled'
  71. },
  72. {
  73. isSubmitDisabled: false,
  74. submitButtonClicked: false,
  75. isIssuesFilterActive: true,
  76. issuesFilterText: '',
  77. issuesFilterLinkText: Em.I18n.t('installer.step7.showAllProperties'),
  78. title: 'issues filter on, submit button not clicked but active'
  79. },
  80. {
  81. isSubmitDisabled: false,
  82. submitButtonClicked: true,
  83. isIssuesFilterActive: true,
  84. issuesFilterText: '',
  85. issuesFilterLinkText: Em.I18n.t('installer.step7.showAllProperties'),
  86. title: 'issues filter on, submit button clicked and active'
  87. }
  88. ],
  89. issuesFilterTestSetup = function (controller, testCase) {
  90. controller.set('submitButtonClicked', testCase.submitButtonClicked);
  91. controller.reopen({
  92. isSubmitDisabled: testCase.isSubmitDisabled
  93. });
  94. controller.get('filterColumns').findProperty('attributeName', 'hasIssues').set('selected', testCase.isIssuesFilterActive);
  95. };
  96. function getController() {
  97. return App.WizardStep7Controller.create({
  98. content: Em.Object.create({
  99. services: [],
  100. advancedServiceConfig: [],
  101. serviceConfigProperties: []
  102. })
  103. });
  104. }
  105. describe('App.InstallerStep7Controller', function () {
  106. beforeEach(function () {
  107. sinon.stub(App.config, 'setPreDefinedServiceConfigs', Em.K);
  108. installerStep7Controller = getController();
  109. });
  110. afterEach(function() {
  111. App.config.setPreDefinedServiceConfigs.restore();
  112. });
  113. App.TestAliases.testAsComputedAlias(getController(), 'masterComponentHosts', 'content.masterComponentHosts', 'array');
  114. App.TestAliases.testAsComputedAlias(getController(), 'slaveComponentHosts', 'content.slaveGroupProperties', 'array');
  115. App.TestAliases.testAsComputedAnd(getController(), 'isConfigsLoaded', ['wizardController.stackConfigsLoaded', 'isAppliedConfigLoaded']);
  116. describe('#installedServiceNames', function () {
  117. var tests = Em.A([
  118. {
  119. content: Em.Object.create({
  120. controllerName: 'installerController',
  121. services: Em.A([
  122. Em.Object.create({
  123. isInstalled: true,
  124. serviceName: 'SQOOP'
  125. }),
  126. Em.Object.create({
  127. isInstalled: true,
  128. serviceName: 'HDFS'
  129. })
  130. ])
  131. }),
  132. e: ['SQOOP', 'HDFS'],
  133. m: 'installerController with SQOOP'
  134. },
  135. {
  136. content: Em.Object.create({
  137. controllerName: 'installerController',
  138. services: Em.A([
  139. Em.Object.create({
  140. isInstalled: true,
  141. serviceName: 'HIVE'
  142. }),
  143. Em.Object.create({
  144. isInstalled: true,
  145. serviceName: 'HDFS'
  146. })
  147. ])
  148. }),
  149. e: ['HIVE', 'HDFS'],
  150. m: 'installerController without SQOOP'
  151. },
  152. {
  153. content: Em.Object.create({
  154. controllerName: 'addServiceController',
  155. services: Em.A([
  156. Em.Object.create({
  157. isInstalled: true,
  158. serviceName: 'HIVE'
  159. }),
  160. Em.Object.create({
  161. isInstalled: true,
  162. serviceName: 'HDFS'
  163. })
  164. ])
  165. }),
  166. e: ['HIVE', 'HDFS'],
  167. m: 'addServiceController without SQOOP'
  168. }
  169. ]);
  170. tests.forEach(function (test) {
  171. it(test.m, function () {
  172. installerStep7Controller.set('content', test.content);
  173. expect(installerStep7Controller.get('installedServiceNames')).to.include.members(test.e);
  174. expect(test.e).to.include.members(installerStep7Controller.get('installedServiceNames'));
  175. });
  176. });
  177. });
  178. describe('#isSubmitDisabled', function () {
  179. it('should be true if miscModalVisible', function () {
  180. installerStep7Controller.reopen({miscModalVisible: true});
  181. expect(installerStep7Controller.get('isSubmitDisabled')).to.equal(true);
  182. });
  183. it('should be true if some of stepConfigs has errors', function () {
  184. installerStep7Controller.reopen({
  185. miscModalVisible: false,
  186. stepConfigs: [
  187. {
  188. showConfig: true,
  189. errorCount: 1
  190. }
  191. ]
  192. });
  193. expect(installerStep7Controller.get('isSubmitDisabled')).to.equal(true);
  194. });
  195. it('should be false if all of stepConfigs don\'t have errors and miscModalVisible is false', function () {
  196. installerStep7Controller.reopen({
  197. miscModalVisible: false,
  198. stepConfigs: [
  199. {
  200. showConfig: true,
  201. errorCount: 0
  202. }
  203. ]
  204. });
  205. expect(installerStep7Controller.get('isSubmitDisabled')).to.equal(false);
  206. });
  207. });
  208. describe('#selectedServiceNames', function () {
  209. it('should use content.services as source of data', function () {
  210. installerStep7Controller.set('content', {
  211. services: [
  212. {isSelected: true, isInstalled: false, serviceName: 's1'},
  213. {isSelected: false, isInstalled: false, serviceName: 's2'},
  214. {isSelected: true, isInstalled: true, serviceName: 's3'},
  215. {isSelected: false, isInstalled: false, serviceName: 's4'},
  216. {isSelected: true, isInstalled: false, serviceName: 's5'},
  217. {isSelected: false, isInstalled: false, serviceName: 's6'},
  218. {isSelected: true, isInstalled: true, serviceName: 's7'},
  219. {isSelected: false, isInstalled: false, serviceName: 's8'}
  220. ]
  221. });
  222. var expected = ['s1', 's5'];
  223. expect(installerStep7Controller.get('selectedServiceNames')).to.eql(expected);
  224. });
  225. });
  226. describe('#allSelectedServiceNames', function () {
  227. it('should use content.services as source of data', function () {
  228. installerStep7Controller.set('content', {
  229. services: [
  230. Em.Object.create({isSelected: true, isInstalled: false, serviceName: 's1'}),
  231. Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's2'}),
  232. Em.Object.create({isSelected: true, isInstalled: true, serviceName: 's3'}),
  233. Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's4'}),
  234. Em.Object.create({isSelected: true, isInstalled: false, serviceName: 's5'}),
  235. Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's6'}),
  236. Em.Object.create({isSelected: true, isInstalled: true, serviceName: 's7'}),
  237. Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's8'})
  238. ]
  239. });
  240. var expected = ['s1', 's3', 's5', 's7'];
  241. expect(installerStep7Controller.get('allSelectedServiceNames')).to.eql(expected);
  242. });
  243. });
  244. describe('#_createSiteToTagMap', function () {
  245. it('should return filtered map', function () {
  246. var desired_configs = {
  247. site1: {
  248. tag: "tag1"
  249. },
  250. site2: {
  251. tag: "tag2"
  252. },
  253. site3: {
  254. tag: "tag3"
  255. }
  256. };
  257. var sites = {
  258. site1: true,
  259. site3: true
  260. };
  261. var siteToTagMap = installerStep7Controller._createSiteToTagMap(desired_configs,sites);
  262. expect(siteToTagMap).to.eql({
  263. site1: "tag1",
  264. site3: "tag3"
  265. });
  266. });
  267. });
  268. describe('#checkDatabaseConnectionTest', function () {
  269. it('should return promise in process', function () {
  270. installerStep7Controller.set('content', {
  271. services: Em.A([
  272. Em.Object.create({isSelected: true, isInstalled: false, serviceName: 'OOZIE', ignored: []}),
  273. Em.Object.create({isSelected: false, isInstalled: false, serviceName: 'HIVE', ignored: []}),
  274. Em.Object.create({isSelected: true, isInstalled: true, serviceName: 's3', ignored: []}),
  275. Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's4', ignored: []}),
  276. Em.Object.create({isSelected: true, isInstalled: false, serviceName: 's5', ignored: []}),
  277. Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's6', ignored: []}),
  278. Em.Object.create({isSelected: true, isInstalled: true, serviceName: 's7', ignored: []}),
  279. Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's8', ignored: []})
  280. ])
  281. });
  282. var obj = Em.Object.create({name:'oozie_database',value:"aa"});
  283. installerStep7Controller.set('stepConfigs',Em.A([Em.Object.create({serviceName: 'OOZIE', configs: Em.A([obj]) })]));
  284. var deffer = installerStep7Controller.checkDatabaseConnectionTest();
  285. expect(deffer.isResolved()).to.equal(false);
  286. deffer.resolve(true);
  287. deffer.done(function(data) {
  288. expect(data).to.equal(true);
  289. });
  290. });
  291. });
  292. describe.skip('#submit', function () {
  293. beforeEach(function () {
  294. sinon.stub(App, 'get').withArgs('supports.preInstallChecks').returns(false);
  295. });
  296. afterEach(function () {
  297. App.get.restore();
  298. });
  299. it('should return false if submit disabled', function () {
  300. installerStep7Controller.set('isSubmitDisabled',true);
  301. expect(installerStep7Controller.submit()).to.be.false;
  302. });
  303. it('sumbit button should be unclicked if no configs', function () {
  304. installerStep7Controller.set('isSubmitDisabled',false);
  305. installerStep7Controller.submit();
  306. expect(installerStep7Controller.get('submitButtonClicked')).to.be.false;
  307. });
  308. });
  309. describe('#getConfigTagsSuccess', function () {
  310. beforeEach(function(){
  311. sinon.stub(App.StackService, 'find', function () {
  312. return [
  313. Em.Object.create({
  314. serviceName: 's0',
  315. isInstalled: true,
  316. configTypes: {
  317. site3: true,
  318. site1: true
  319. }
  320. }),
  321. Em.Object.create({
  322. serviceName: 's1',
  323. isInstalled: true,
  324. configTypes: {
  325. site1: true,
  326. site2: true
  327. }
  328. })
  329. ];
  330. });
  331. });
  332. afterEach(function(){
  333. App.StackService.find.restore();
  334. });
  335. it('should return serviceConfigTags', function () {
  336. var desired_configs = {
  337. site1: {
  338. tag: "tag1"
  339. },
  340. site2: {
  341. tag: "tag2"
  342. },
  343. site3: {
  344. tag: "tag3"
  345. }
  346. };
  347. var data = {
  348. Clusters: {
  349. desired_configs: desired_configs
  350. }
  351. };
  352. var siteToTagMap = installerStep7Controller.getConfigTagsSuccess(data);
  353. expect(installerStep7Controller.get('serviceConfigTags')).to.eql([
  354. {
  355. "siteName": "site1",
  356. "tagName": "tag1",
  357. "newTagName": null
  358. },
  359. {
  360. "siteName": "site2",
  361. "tagName": "tag2",
  362. "newTagName": null
  363. },
  364. {
  365. "siteName": "site3",
  366. "tagName": "tag3",
  367. "newTagName": null
  368. }
  369. ]);
  370. expect(installerStep7Controller.get('isAppliedConfigLoaded')).to.equal(true);
  371. });
  372. });
  373. describe('#clearStep', function () {
  374. it('should clear stepConfigs', function () {
  375. installerStep7Controller.set('stepConfigs', [
  376. {},
  377. {}
  378. ]);
  379. installerStep7Controller.clearStep();
  380. expect(installerStep7Controller.get('stepConfigs.length')).to.equal(0);
  381. });
  382. it('should clear filter', function () {
  383. installerStep7Controller.set('filter', 'filter');
  384. installerStep7Controller.clearStep();
  385. expect(installerStep7Controller.get('filter')).to.equal('');
  386. });
  387. it('should set for each filterColumns "selected" false', function () {
  388. installerStep7Controller.set('filterColumns', [
  389. {selected: true},
  390. {selected: false},
  391. {selected: true}
  392. ]);
  393. installerStep7Controller.clearStep();
  394. expect(installerStep7Controller.get('filterColumns').everyProperty('selected', false)).to.equal(true);
  395. });
  396. });
  397. describe('#loadInstalledServicesConfigGroups', function () {
  398. before(function () {
  399. sinon.stub(App.ajax, 'send', Em.K);
  400. });
  401. after(function () {
  402. App.ajax.send.restore();
  403. });
  404. it('should do ajax request for each received service name', function () {
  405. var serviceNames = ['s1', 's2', 's3'];
  406. installerStep7Controller.loadInstalledServicesConfigGroups(serviceNames);
  407. expect(App.ajax.send.callCount).to.equal(serviceNames.length);
  408. });
  409. });
  410. describe('#getConfigTags', function () {
  411. before(function () {
  412. sinon.stub(App.ajax, 'send', Em.K);
  413. });
  414. after(function () {
  415. App.ajax.send.restore();
  416. });
  417. it('should do ajax-request', function () {
  418. installerStep7Controller.getConfigTags();
  419. expect(App.ajax.send.calledOnce).to.equal(true);
  420. });
  421. });
  422. describe('#setGroupsToDelete', function () {
  423. beforeEach(function () {
  424. installerStep7Controller.set('wizardController', Em.Object.create(App.LocalStorage, {name: 'tdk'}));
  425. });
  426. it('should add new groups to groupsToDelete', function () {
  427. var groupsToDelete = [
  428. {id: '1'},
  429. {id: '2'}
  430. ],
  431. groups = [
  432. Em.Object.create({id: '3'}),
  433. Em.Object.create(),
  434. Em.Object.create({id: '5'})
  435. ],
  436. expected = [
  437. {id: "1"},
  438. {id: "2"},
  439. {id: "3"},
  440. {id: "5"}
  441. ];
  442. installerStep7Controller.set('groupsToDelete', groupsToDelete);
  443. installerStep7Controller.setGroupsToDelete(groups);
  444. expect(installerStep7Controller.get('groupsToDelete')).to.eql(expected);
  445. expect(installerStep7Controller.get('wizardController').getDBProperty('groupsToDelete')).to.eql(expected);
  446. });
  447. });
  448. describe('#checkMySQLHost', function () {
  449. it('should send query', function () {
  450. expect(installerStep7Controller.checkMySQLHost().readyState).to.equal(1);
  451. });
  452. });
  453. describe('#selectConfigGroup', function () {
  454. beforeEach(function () {
  455. installerStep7Controller.reopen({content: {services: []}});
  456. sinon.stub(installerStep7Controller, 'switchConfigGroupConfigs', Em.K);
  457. });
  458. afterEach(function () {
  459. installerStep7Controller.switchConfigGroupConfigs.restore();
  460. });
  461. it('should set selectedConfigGroup', function () {
  462. var group = {':': []};
  463. installerStep7Controller.selectConfigGroup({context: group});
  464. expect(installerStep7Controller.get('selectedConfigGroup')).to.eql(group);
  465. });
  466. });
  467. describe('#selectedServiceObserver', function () {
  468. beforeEach(function () {
  469. installerStep7Controller.reopen({content: {services: []}});
  470. sinon.stub(installerStep7Controller, 'switchConfigGroupConfigs', Em.K);
  471. });
  472. afterEach(function () {
  473. installerStep7Controller.switchConfigGroupConfigs.restore();
  474. });
  475. it('shouldn\'t do nothing if App.supports.hostOverridesInstaller is false', function () {
  476. App.set('supports.hostOverridesInstaller', false);
  477. var configGroups = [
  478. {},
  479. {}
  480. ],
  481. selectedConfigGroup = {};
  482. installerStep7Controller.reopen({configGroups: configGroups, selectedConfigGroup: selectedConfigGroup});
  483. installerStep7Controller.selectedServiceObserver();
  484. expect(installerStep7Controller.get('configGroups')).to.eql(configGroups);
  485. expect(installerStep7Controller.get('selectedConfigGroup')).to.eql(selectedConfigGroup);
  486. });
  487. it('shouldn\'t do nothing if selectedService is null', function () {
  488. App.set('supports.hostOverridesInstaller', true);
  489. var configGroups = [
  490. {},
  491. {}
  492. ],
  493. selectedConfigGroup = {};
  494. installerStep7Controller.reopen({selectedService: null, configGroups: configGroups, selectedConfigGroup: selectedConfigGroup});
  495. installerStep7Controller.selectedServiceObserver();
  496. expect(installerStep7Controller.get('configGroups')).to.eql(configGroups);
  497. expect(installerStep7Controller.get('selectedConfigGroup')).to.eql(selectedConfigGroup);
  498. });
  499. it('shouldn\'t do nothing if selectedService.serviceName is MISC', function () {
  500. App.set('supports.hostOverridesInstaller', true);
  501. var configGroups = [
  502. {},
  503. {}
  504. ],
  505. selectedConfigGroup = {};
  506. installerStep7Controller.reopen({selectedService: {serviceName: 'MISC'}, configGroups: configGroups, selectedConfigGroup: selectedConfigGroup});
  507. installerStep7Controller.selectedServiceObserver();
  508. expect(installerStep7Controller.get('configGroups')).to.eql(configGroups);
  509. expect(installerStep7Controller.get('selectedConfigGroup')).to.eql(selectedConfigGroup);
  510. });
  511. it('should update configGroups and selectedConfigGroup', function () {
  512. App.set('supports.hostOverridesInstaller', true);
  513. var defaultGroup = {isDefault: true, n: 'n2'},
  514. configGroups = [
  515. {isDefault: false, n: 'n1'},
  516. defaultGroup,
  517. {n: 'n3'}
  518. ],
  519. selectedConfigGroup = {};
  520. installerStep7Controller.reopen({selectedService: {serviceName: 's1', configGroups: configGroups}});
  521. installerStep7Controller.selectedServiceObserver();
  522. expect(installerStep7Controller.get('configGroups').mapProperty('n')).to.eql(['n2', 'n1', 'n3']);
  523. expect(installerStep7Controller.get('selectedConfigGroup')).to.eql(defaultGroup);
  524. });
  525. });
  526. describe('#loadConfigGroups', function () {
  527. beforeEach(function () {
  528. installerStep7Controller.reopen({
  529. wizardController: Em.Object.create({
  530. allHosts: [
  531. {hostName: 'h1'},
  532. {hostName: 'h2'},
  533. {hostName: 'h3'}
  534. ]
  535. })
  536. });
  537. });
  538. afterEach(function () {
  539. App.ServiceConfigGroup.find().clear();
  540. });
  541. it('shouldn\'t do nothing if only MISC available', function () {
  542. var configGroups = [
  543. {}
  544. ];
  545. installerStep7Controller.reopen({
  546. stepConfigs: [Em.Object.create({serviceName: 'MISC', configGroups: configGroups})]
  547. });
  548. installerStep7Controller.loadConfigGroups([]);
  549. expect(installerStep7Controller.get('stepConfigs.firstObject.configGroups')).to.eql(configGroups);
  550. });
  551. });
  552. describe('#_getDisplayedConfigGroups', function () {
  553. it('should return [] if no selected group', function () {
  554. installerStep7Controller.reopen({
  555. content: {services: []},
  556. selectedConfigGroup: null
  557. });
  558. expect(installerStep7Controller._getDisplayedConfigGroups()).to.eql([]);
  559. });
  560. it('should return default config group if another selected', function () {
  561. var defaultGroup = Em.Object.create({isDefault: false});
  562. installerStep7Controller.reopen({
  563. content: {services: []},
  564. selectedConfigGroup: defaultGroup
  565. });
  566. expect(installerStep7Controller._getDisplayedConfigGroups()).to.eql([defaultGroup]);
  567. });
  568. it('should return other groups if default selected', function () {
  569. var defaultGroup = Em.Object.create({isDefault: true}),
  570. cfgG = Em.Object.create({isDefault: true}),
  571. configGroups = Em.A([
  572. Em.Object.create({isDefault: false}),
  573. Em.Object.create({isDefault: false}),
  574. cfgG,
  575. Em.Object.create({isDefault: false})
  576. ]);
  577. installerStep7Controller.reopen({
  578. content: {services: []},
  579. selectedConfigGroup: defaultGroup,
  580. selectedService: {configGroups: configGroups}
  581. });
  582. expect(installerStep7Controller._getDisplayedConfigGroups()).to.eql(configGroups.without(cfgG));
  583. });
  584. });
  585. describe('#_setEditableValue', function () {
  586. it('shouldn\'t update config if no selectedConfigGroup', function () {
  587. installerStep7Controller.reopen({
  588. selectedConfigGroup: null
  589. });
  590. var config = Em.Object.create({isEditable: null});
  591. var updatedConfig = installerStep7Controller._setEditableValue(config);
  592. expect(updatedConfig.get('isEditable')).to.be.null;
  593. });
  594. it('should set isEditable equal to selectedGroup.isDefault if service not installed', function () {
  595. var isDefault = true;
  596. installerStep7Controller.reopen({
  597. installedServiceNames: [],
  598. selectedService: {serviceName: 'abc'},
  599. selectedConfigGroup: Em.Object.create({isDefault: isDefault})
  600. });
  601. var config = Em.Object.create({isEditable: null});
  602. var updatedConfig = installerStep7Controller._setEditableValue(config);
  603. expect(updatedConfig.get('isEditable')).to.equal(isDefault);
  604. installerStep7Controller.toggleProperty('selectedConfigGroup.isDefault');
  605. updatedConfig = installerStep7Controller._setEditableValue(config);
  606. expect(updatedConfig.get('isEditable')).to.equal(!isDefault);
  607. });
  608. Em.A([
  609. {
  610. isEditable: false,
  611. isReconfigurable: false,
  612. isDefault: true,
  613. e: false
  614. },
  615. {
  616. isEditable: true,
  617. isReconfigurable: true,
  618. isDefault: true,
  619. e: true
  620. },
  621. {
  622. isEditable: false,
  623. isReconfigurable: true,
  624. isDefault: false,
  625. e: false
  626. },
  627. {
  628. isEditable: true,
  629. isReconfigurable: false,
  630. isDefault: false,
  631. e: false
  632. }
  633. ]).forEach(function (test) {
  634. it('service installed, isEditable = ' + test.isEditable.toString() + ', isReconfigurable = ' + test.isReconfigurable.toString(), function () {
  635. var config = Em.Object.create({
  636. isReconfigurable: test.isReconfigurable,
  637. isEditable: test.isEditable
  638. });
  639. installerStep7Controller.reopen({
  640. installedServiceNames: Em.A(['a']),
  641. selectedService: Em.Object.create({serviceName: 'a'}),
  642. selectedConfigGroup: Em.Object.create({isDefault: test.isDefault})
  643. });
  644. var updateConfig = installerStep7Controller._setEditableValue(config);
  645. expect(updateConfig.get('isEditable')).to.equal(test.e);
  646. });
  647. });
  648. });
  649. describe('#_setOverrides', function () {
  650. it('shouldn\'t update config if no selectedConfigGroup', function () {
  651. installerStep7Controller.reopen({
  652. selectedConfigGroup: null
  653. });
  654. var config = Em.Object.create({overrides: null});
  655. var updatedConfig = installerStep7Controller._setOverrides(config, []);
  656. expect(updatedConfig.get('overrides')).to.be.null;
  657. });
  658. it('no overrideToAdd', function () {
  659. var isDefault = true,
  660. name = 'n1',
  661. config = Em.Object.create({overrides: null, name: name, flag: 'flag'}),
  662. overrides = Em.A([
  663. Em.Object.create({name: name, value: 'v1'}),
  664. Em.Object.create({name: name, value: 'v2'}),
  665. Em.Object.create({name: 'n2', value: 'v3'})
  666. ]);
  667. installerStep7Controller.reopen({
  668. overrideToAdd: null,
  669. selectedConfigGroup: Em.Object.create({
  670. isDefault: isDefault
  671. })
  672. });
  673. var updatedConfig = installerStep7Controller._setOverrides(config, overrides);
  674. expect(updatedConfig.get('overrides.length')).to.equal(2);
  675. expect(updatedConfig.get('overrides').everyProperty('isEditable', !isDefault)).to.equal(true);
  676. expect(updatedConfig.get('overrides').everyProperty('parentSCP.flag', 'flag')).to.equal(true);
  677. });
  678. it('overrideToAdd exists', function () {
  679. var isDefault = true,
  680. name = 'n1',
  681. config = Em.Object.create({overrides: null, name: name, flag: 'flag'}),
  682. overrides = Em.A([
  683. Em.Object.create({name: name, value: 'v1'}),
  684. Em.Object.create({name: name, value: 'v2'}),
  685. Em.Object.create({name: 'n2', value: 'v3'})
  686. ]);
  687. installerStep7Controller.reopen({
  688. overrideToAdd: Em.Object.create({name: name}),
  689. selectedService: {configGroups: [Em.Object.create({name: 'n', properties: []})]},
  690. selectedConfigGroup: Em.Object.create({
  691. isDefault: isDefault,
  692. name: 'n'
  693. })
  694. });
  695. var updatedConfig = installerStep7Controller._setOverrides(config, overrides);
  696. expect(updatedConfig.get('overrides.length')).to.equal(3);
  697. expect(updatedConfig.get('overrides').everyProperty('isEditable', !isDefault)).to.equal(true);
  698. expect(updatedConfig.get('overrides').everyProperty('parentSCP.flag', 'flag')).to.equal(true);
  699. });
  700. });
  701. describe('#switchConfigGroupConfigs', function () {
  702. it('if selectedConfigGroup is null, serviceConfigs shouldn\'t be changed', function () {
  703. installerStep7Controller.reopen({
  704. selectedConfigGroup: null,
  705. content: {services: []},
  706. serviceConfigs: {configs: [
  707. {overrides: []},
  708. {overrides: []}
  709. ]}
  710. });
  711. installerStep7Controller.switchConfigGroupConfigs();
  712. expect(installerStep7Controller.get('serviceConfigs.configs').everyProperty('overrides.length', 0)).to.equal(true);
  713. });
  714. it('should set configs for serviceConfigs', function () {
  715. var configGroups = [
  716. Em.Object.create({
  717. properties: [
  718. {name: 'g1', value: 'v1'},
  719. {name: 'g2', value: 'v2'}
  720. ]
  721. })
  722. ];
  723. sinon.stub(installerStep7Controller, '_getDisplayedConfigGroups', function () {
  724. return configGroups;
  725. });
  726. sinon.stub(installerStep7Controller, '_setEditableValue', function (config) {
  727. config.set('isEditable', true);
  728. return config;
  729. });
  730. installerStep7Controller.reopen({
  731. selectedConfigGroup: Em.Object.create({isDefault: true, name: 'g1'}),
  732. content: {services: []},
  733. selectedService: {configs: Em.A([Em.Object.create({name: 'g1', overrides: [], properties: []}), Em.Object.create({name: 'g2', overrides: []})])},
  734. serviceConfigs: {configs: [Em.Object.create({name: 'g1'})]}
  735. });
  736. installerStep7Controller.switchConfigGroupConfigs();
  737. var configs = installerStep7Controller.get('selectedService.configs');
  738. expect(configs.findProperty('name', 'g1').get('overrides').length).to.equal(1);
  739. expect(configs.findProperty('name', 'g2').get('overrides').length).to.equal(1);
  740. expect(configs.everyProperty('isEditable', true)).to.equal(true);
  741. installerStep7Controller._getDisplayedConfigGroups.restore();
  742. installerStep7Controller._setEditableValue.restore();
  743. });
  744. });
  745. describe('#selectProperService', function () {
  746. Em.A([
  747. {
  748. name: 'addServiceController',
  749. stepConfigs: [
  750. {selected: false, name: 'n1'},
  751. {selected: true, name: 'n2'},
  752. {selected: true, name: 'n3'}
  753. ],
  754. e: 'n2'
  755. },
  756. {
  757. name: 'installerController',
  758. stepConfigs: [
  759. {showConfig: false, name: 'n1'},
  760. {showConfig: false, name: 'n2'},
  761. {showConfig: true, name: 'n3'}
  762. ],
  763. e: 'n3'
  764. }
  765. ]).forEach(function (test) {
  766. it(test.name, function () {
  767. sinon.stub(installerStep7Controller, 'selectedServiceObserver', Em.K);
  768. installerStep7Controller.reopen({
  769. wizardController: Em.Object.create({
  770. name: test.name
  771. }),
  772. stepConfigs: test.stepConfigs
  773. });
  774. installerStep7Controller.selectProperService();
  775. expect(installerStep7Controller.get('selectedService.name')).to.equal(test.e);
  776. installerStep7Controller.selectedServiceObserver.restore();
  777. });
  778. });
  779. });
  780. describe.skip('#setStepConfigs', function () {
  781. beforeEach(function () {
  782. installerStep7Controller.reopen({
  783. content: {services: []},
  784. wizardController: Em.Object.create({
  785. getDBProperty: function (key) {
  786. return this.get(key);
  787. }
  788. })
  789. });
  790. });
  791. afterEach(function () {
  792. installerStep7Controller.renderConfigs.restore();
  793. });
  794. it('if wizard isn\'t addService, should set output of installerStep7Controller.renderConfigs', function () {
  795. var serviceConfigs = Em.A([
  796. {serviceName:'HDFS', configs: []},
  797. {}
  798. ]);
  799. sinon.stub(installerStep7Controller, 'renderConfigs', function () {
  800. return serviceConfigs;
  801. });
  802. installerStep7Controller.set('wizardController.name', 'installerController');
  803. installerStep7Controller.setStepConfigs([], []);
  804. expect(installerStep7Controller.get('stepConfigs')).to.eql(serviceConfigs);
  805. });
  806. it('addServiceWizard used', function () {
  807. var serviceConfigs = Em.A([Em.Object.create({serviceName: 'HDFS', configs: []}), Em.Object.create({serviceName: 's2'})]);
  808. installerStep7Controller.set('wizardController.name', 'addServiceController');
  809. installerStep7Controller.reopen({selectedServiceNames: ['s2']});
  810. sinon.stub(installerStep7Controller, 'renderConfigs', function () {
  811. return serviceConfigs;
  812. });
  813. installerStep7Controller.setStepConfigs([], []);
  814. expect(installerStep7Controller.get('stepConfigs').everyProperty('showConfig', true)).to.equal(true);
  815. expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 's2').get('selected')).to.equal(true);
  816. });
  817. it('addServiceWizard used, HA enabled', function () {
  818. sinon.stub(App, 'get', function (k) {
  819. if (k === 'isHaEnabled') {
  820. return true;
  821. }
  822. return Em.get(App, k);
  823. });
  824. var serviceConfigs = Em.A([
  825. Em.Object.create({
  826. serviceName: 'HDFS',
  827. configs: [
  828. Em.Object.create({category: 'SECONDARY_NAMENODE'}),
  829. Em.Object.create({category: 'SECONDARY_NAMENODE'}),
  830. Em.Object.create({category: 'NameNode'}),
  831. Em.Object.create({category: 'NameNode'}),
  832. Em.Object.create({category: 'SECONDARY_NAMENODE'})
  833. ]
  834. }),
  835. Em.Object.create({serviceName: 's2'})]
  836. );
  837. installerStep7Controller.set('wizardController.name', 'addServiceController');
  838. installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
  839. sinon.stub(installerStep7Controller, 'renderConfigs', function () {
  840. return serviceConfigs;
  841. });
  842. installerStep7Controller.setStepConfigs([], []);
  843. expect(installerStep7Controller.get('stepConfigs').everyProperty('showConfig', true)).to.equal(true);
  844. expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 'HDFS').get('selected')).to.equal(true);
  845. expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 'HDFS').get('configs').length).to.equal(5);
  846. App.get.restore();
  847. });
  848. it('not windows stack', function () {
  849. var s = sinon.stub(App, 'get');
  850. s.withArgs('isHadoopWindowsStack').returns(false);
  851. s.withArgs('isHaEnabled').returns(false);
  852. var serviceConfigs = Em.A([
  853. Em.Object.create({
  854. serviceName: 'HDFS',
  855. configs: [
  856. {category: 'NameNode'},
  857. {category: 'NameNode'}
  858. ]
  859. }),
  860. Em.Object.create({serviceName: 's2'})]
  861. );
  862. installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
  863. sinon.stub(installerStep7Controller, 'renderConfigs', function () {
  864. return serviceConfigs;
  865. });
  866. installerStep7Controller.setStepConfigs([], []);
  867. expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 'HDFS').get('configs').length).to.equal(2);
  868. s.restore();
  869. });
  870. it('windows stack', function () {
  871. var s = sinon.stub(App, 'get');
  872. s.withArgs('isHadoopWindowsStack').returns(true);
  873. s.withArgs('isHaEnabled').returns(false);
  874. var serviceConfigs = Em.A([
  875. Em.Object.create({
  876. serviceName: 'HDFS',
  877. configs: [
  878. {category: 'NameNode'},
  879. {category: 'NameNode'}
  880. ]
  881. }),
  882. Em.Object.create({serviceName: 's2'})]
  883. );
  884. installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
  885. installerStep7Controller.set('installedServiceNames',['HDFS', 's2', 's3']);
  886. sinon.stub(installerStep7Controller, 'renderConfigs', function () {
  887. return serviceConfigs;
  888. });
  889. installerStep7Controller.setStepConfigs([], []);
  890. expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 'HDFS').get('configs').length).to.equal(2);
  891. s.restore();
  892. });
  893. });
  894. describe('#checkHostOverrideInstaller', function () {
  895. beforeEach(function () {
  896. sinon.stub(installerStep7Controller, 'loadConfigGroups', Em.K);
  897. sinon.stub(installerStep7Controller, 'loadInstalledServicesConfigGroups', Em.K);
  898. });
  899. afterEach(function () {
  900. installerStep7Controller.loadConfigGroups.restore();
  901. installerStep7Controller.loadInstalledServicesConfigGroups.restore();
  902. App.get.restore();
  903. });
  904. Em.A([
  905. {
  906. installedServiceNames: [],
  907. m: 'installedServiceNames is empty',
  908. e: {
  909. loadConfigGroups: true,
  910. loadInstalledServicesConfigGroups: false
  911. }
  912. },
  913. {
  914. installedServiceNames: ['s1', 's2', 's3'],
  915. areInstalledConfigGroupsLoaded: false,
  916. m: 'installedServiceNames isn\'t empty, config groups not yet loaded',
  917. e: {
  918. loadConfigGroups: true,
  919. loadInstalledServicesConfigGroups: true
  920. }
  921. },
  922. {
  923. installedServiceNames: ['s1', 's2', 's3'],
  924. areInstalledConfigGroupsLoaded: true,
  925. m: 'installedServiceNames isn\'t empty, config groups already loaded',
  926. e: {
  927. loadConfigGroups: true,
  928. loadInstalledServicesConfigGroups: false
  929. }
  930. }
  931. ]).forEach(function (test) {
  932. it(test.m, function () {
  933. sinon.stub(App, 'get', function (k) {
  934. if (k === 'supports.hostOverridesInstaller') return test.hostOverridesInstaller;
  935. return Em.get(App, k);
  936. });
  937. installerStep7Controller.reopen({
  938. installedServiceNames: test.installedServiceNames,
  939. wizardController: {
  940. areInstalledConfigGroupsLoaded: test.areInstalledConfigGroupsLoaded
  941. }
  942. });
  943. installerStep7Controller.checkHostOverrideInstaller();
  944. if (test.e.loadConfigGroups) {
  945. expect(installerStep7Controller.loadConfigGroups.calledOnce).to.equal(true);
  946. }
  947. else {
  948. expect(installerStep7Controller.loadConfigGroups.called).to.equal(false);
  949. }
  950. if (test.e.loadInstalledServicesConfigGroups) {
  951. expect(installerStep7Controller.loadInstalledServicesConfigGroups.calledOnce).to.equal(true);
  952. }
  953. else {
  954. expect(installerStep7Controller.loadInstalledServicesConfigGroups.called).to.equal(false);
  955. }
  956. });
  957. });
  958. });
  959. describe('#loadStep', function () {
  960. beforeEach(function () {
  961. installerStep7Controller.reopen({
  962. content: {services: []},
  963. wizardController: Em.Object.create({
  964. getDBProperty: function (k) {
  965. return this.get(k);
  966. },
  967. stackConfigsLoaded: true
  968. })
  969. });
  970. sinon.stub(App.config, 'fileConfigsIntoTextarea', Em.K);
  971. sinon.stub(installerStep7Controller, 'clearStep', Em.K);
  972. sinon.stub(installerStep7Controller, 'getConfigTags', Em.K);
  973. sinon.stub(installerStep7Controller, 'setInstalledServiceConfigs', Em.K);
  974. sinon.stub(installerStep7Controller, 'checkHostOverrideInstaller', Em.K);
  975. sinon.stub(installerStep7Controller, 'selectProperService', Em.K);
  976. sinon.stub(installerStep7Controller, 'applyServicesConfigs', Em.K);
  977. sinon.stub(App.router, 'send', Em.K);
  978. });
  979. afterEach(function () {
  980. App.config.fileConfigsIntoTextarea.restore();
  981. installerStep7Controller.clearStep.restore();
  982. installerStep7Controller.getConfigTags.restore();
  983. installerStep7Controller.setInstalledServiceConfigs.restore();
  984. installerStep7Controller.checkHostOverrideInstaller.restore();
  985. installerStep7Controller.selectProperService.restore();
  986. installerStep7Controller.applyServicesConfigs.restore();
  987. App.router.send.restore();
  988. });
  989. it('should call clearStep', function () {
  990. installerStep7Controller.loadStep();
  991. expect(installerStep7Controller.clearStep.calledOnce).to.equal(true);
  992. });
  993. it('shouldn\'t do nothing if isAdvancedConfigLoaded is false', function () {
  994. installerStep7Controller.set('wizardController.stackConfigsLoaded', false);
  995. installerStep7Controller.loadStep();
  996. expect(installerStep7Controller.clearStep.called).to.equal(false);
  997. });
  998. it('should call setInstalledServiceConfigs for addServiceController', function () {
  999. installerStep7Controller.set('wizardController.name', 'addServiceController');
  1000. installerStep7Controller.loadStep();
  1001. expect(installerStep7Controller.setInstalledServiceConfigs.calledOnce).to.equal(true);
  1002. });
  1003. });
  1004. describe('#applyServicesConfigs', function() {
  1005. beforeEach(function() {
  1006. installerStep7Controller.reopen({
  1007. allSelectedServiceNames: []
  1008. });
  1009. sinon.stub(App.config, 'fileConfigsIntoTextarea', function(configs) {
  1010. return configs;
  1011. });
  1012. sinon.stub(installerStep7Controller, 'loadServerSideConfigsRecommendations', function() {
  1013. return $.Deferred().resolve();
  1014. });
  1015. sinon.stub(installerStep7Controller, 'checkHostOverrideInstaller', Em.K);
  1016. sinon.stub(installerStep7Controller, 'selectProperService', Em.K);
  1017. sinon.stub(App.router, 'send', Em.K);
  1018. sinon.stub(App.StackService, 'find', function () {
  1019. return {
  1020. findProperty: function () {
  1021. return Em.Object.create({
  1022. isInstalled: true,
  1023. isSelected: false
  1024. });
  1025. },
  1026. filterProperty: function () {
  1027. return [];
  1028. }
  1029. }
  1030. });
  1031. });
  1032. afterEach(function () {
  1033. App.config.fileConfigsIntoTextarea.restore();
  1034. installerStep7Controller.loadServerSideConfigsRecommendations.restore();
  1035. installerStep7Controller.checkHostOverrideInstaller.restore();
  1036. installerStep7Controller.selectProperService.restore();
  1037. App.router.send.restore();
  1038. App.StackService.find.restore();
  1039. });
  1040. it('should run some methods' , function () {
  1041. installerStep7Controller.applyServicesConfigs([{name: 'configs'}]);
  1042. expect(installerStep7Controller.loadServerSideConfigsRecommendations.calledOnce).to.equal(true);
  1043. expect(installerStep7Controller.get('isRecommendedLoaded')).to.equal(true);
  1044. expect(installerStep7Controller.checkHostOverrideInstaller.calledOnce).to.equal(true);
  1045. expect(installerStep7Controller.selectProperService.calledOnce).to.equal(true);
  1046. });
  1047. Em.A([
  1048. {
  1049. allSelectedServiceNames: ['YARN'],
  1050. fileConfigsIntoTextarea: true,
  1051. m: 'should run fileConfigsIntoTextarea'
  1052. }
  1053. ]).forEach(function(t) {
  1054. it(t.m, function () {
  1055. installerStep7Controller.reopen({
  1056. allSelectedServiceNames: t.allSelectedServiceNames
  1057. });
  1058. installerStep7Controller.applyServicesConfigs([{name: 'configs'}]);
  1059. if (t.fileConfigsIntoTextarea) {
  1060. expect(App.config.fileConfigsIntoTextarea.calledWith([{name: 'configs'}], 'capacity-scheduler.xml')).to.equal(true);
  1061. } else {
  1062. expect(App.config.fileConfigsIntoTextarea.calledOnce).to.equal(false);
  1063. }
  1064. });
  1065. });
  1066. });
  1067. describe('#_updateIsEditableFlagForConfig', function () {
  1068. Em.A([
  1069. {
  1070. isAdmin: false,
  1071. isReconfigurable: false,
  1072. isHostsConfigsPage: true,
  1073. defaultGroupSelected: false,
  1074. m: 'false for non-admin users',
  1075. e: false
  1076. },
  1077. {
  1078. isAdmin: true,
  1079. isReconfigurable: false,
  1080. isHostsConfigsPage: true,
  1081. defaultGroupSelected: false,
  1082. m: 'false if defaultGroupSelected is false and isHostsConfigsPage is true',
  1083. e: false
  1084. },
  1085. {
  1086. isAdmin: true,
  1087. isReconfigurable: false,
  1088. isHostsConfigsPage: true,
  1089. defaultGroupSelected: true,
  1090. m: 'false if defaultGroupSelected is true and isHostsConfigsPage is true',
  1091. e: false
  1092. },
  1093. {
  1094. isAdmin: true,
  1095. isReconfigurable: false,
  1096. isHostsConfigsPage: false,
  1097. defaultGroupSelected: false,
  1098. m: 'false if defaultGroupSelected is false and isHostsConfigsPage is false',
  1099. e: false
  1100. }
  1101. ]).forEach(function (test) {
  1102. it(test.m, function () {
  1103. installerStep7Controller.reopen({isHostsConfigsPage: test.isHostsConfigsPage});
  1104. var serviceConfigProperty = Em.Object.create({
  1105. isReconfigurable: test.isReconfigurable
  1106. });
  1107. installerStep7Controller._updateIsEditableFlagForConfig(serviceConfigProperty, test.defaultGroupSelected);
  1108. expect(serviceConfigProperty.get('isEditable')).to.equal(test.e);
  1109. });
  1110. });
  1111. });
  1112. describe('#_updateOverridesForConfig', function () {
  1113. it('should set empty array', function () {
  1114. var serviceConfigProperty = Em.Object.create({
  1115. overrides: null
  1116. }), component = Em.Object.create();
  1117. installerStep7Controller._updateOverridesForConfig(serviceConfigProperty, component);
  1118. expect(serviceConfigProperty.get('overrides')).to.eql(Em.A([]));
  1119. });
  1120. it('host overrides not supported', function () {
  1121. var serviceConfigProperty = Em.Object.create({
  1122. overrides: [
  1123. {value: 'new value'}
  1124. ]
  1125. }), component = Em.Object.create({selectedConfigGroup: {isDefault: false}});
  1126. installerStep7Controller._updateOverridesForConfig(serviceConfigProperty, component);
  1127. expect(serviceConfigProperty.get('overrides').length).to.equal(1);
  1128. expect(serviceConfigProperty.get('overrides.firstObject.value')).to.equal('new value');
  1129. expect(serviceConfigProperty.get('overrides.firstObject.isOriginalSCP')).to.equal(false);
  1130. expect(serviceConfigProperty.get('overrides.firstObject.parentSCP')).to.eql(serviceConfigProperty);
  1131. });
  1132. it('host overrides supported', function () {
  1133. sinon.stub(App, 'get', function (k) {
  1134. if (k === 'supports.hostOverrides') return true;
  1135. return Em.get(App, k);
  1136. });
  1137. var serviceConfigProperty = Em.Object.create({
  1138. overrides: [
  1139. {value: 'new value', group: Em.Object.create({name: 'n1'})}
  1140. ]
  1141. }),
  1142. component = Em.Object.create({
  1143. selectedConfigGroup: {isDefault: true},
  1144. configGroups: Em.A([
  1145. Em.Object.create({name: 'n1', properties: []})
  1146. ])
  1147. });
  1148. installerStep7Controller._updateOverridesForConfig(serviceConfigProperty, component);
  1149. App.get.restore();
  1150. expect(serviceConfigProperty.get('overrides').length).to.equal(1);
  1151. expect(serviceConfigProperty.get('overrides.firstObject.value')).to.equal('new value');
  1152. expect(serviceConfigProperty.get('overrides.firstObject.isOriginalSCP')).to.equal(false);
  1153. expect(serviceConfigProperty.get('overrides.firstObject.parentSCP')).to.eql(serviceConfigProperty);
  1154. expect(component.get('configGroups.firstObject.properties').length).to.equal(1);
  1155. expect(component.get('configGroups.firstObject.properties.firstObject.isEditable')).to.equal(false);
  1156. expect(component.get('configGroups.firstObject.properties.firstObject.group')).to.be.object;
  1157. });
  1158. });
  1159. describe('#setInstalledServiceConfigs', function () {
  1160. var controller = App.WizardStep7Controller.create({
  1161. installedServiceNames: ['HBASE', 'AMBARI_METRICS']
  1162. }),
  1163. configs = [
  1164. {
  1165. name: 'hbase.client.scanner.caching',
  1166. value: '1000',
  1167. serviceName: 'HBASE',
  1168. filename: 'hbase-site.xml'
  1169. },
  1170. {
  1171. name: 'hbase.client.scanner.caching',
  1172. value: '2000',
  1173. serviceName: 'AMBARI_METRICS',
  1174. filename: 'ams-hbase-site.xml'
  1175. }
  1176. ],
  1177. configsByTags = [
  1178. {
  1179. type: 'hbase-site',
  1180. tag: 'version2',
  1181. properties: {
  1182. 'hbase.client.scanner.caching': '1500'
  1183. }
  1184. },
  1185. {
  1186. type: 'ams-hbase-site',
  1187. tag: 'version2',
  1188. properties: {
  1189. 'hbase.client.scanner.caching': '2500'
  1190. }
  1191. },
  1192. {
  1193. type: 'site-without-properties',
  1194. tag: 'version1'
  1195. }
  1196. ],
  1197. installedServiceNames = ['HBASE', 'AMBARI_METRICS'];
  1198. it('should handle properties with the same name', function () {
  1199. controller.setInstalledServiceConfigs(configs, configsByTags, installedServiceNames);
  1200. var properties = configs.filterProperty('name', 'hbase.client.scanner.caching');
  1201. expect(properties).to.have.length(2);
  1202. expect(properties.findProperty('filename', 'hbase-site.xml').value).to.equal('1500');
  1203. expect(properties.findProperty('filename', 'hbase-site.xml').savedValue).to.equal('1500');
  1204. expect(properties.findProperty('filename', 'ams-hbase-site.xml').value).to.equal('2500');
  1205. expect(properties.findProperty('filename', 'ams-hbase-site.xml').savedValue).to.equal('2500');
  1206. });
  1207. });
  1208. describe('#getAmbariDatabaseSuccess', function () {
  1209. var controller = App.WizardStep7Controller.create({
  1210. stepConfigs: [
  1211. {
  1212. serviceName: 'HIVE',
  1213. configs: [
  1214. {
  1215. name: 'hive_hostname',
  1216. value: 'h0'
  1217. }
  1218. ]
  1219. }
  1220. ]
  1221. }),
  1222. cases = [
  1223. {
  1224. data: {
  1225. hostComponents: []
  1226. },
  1227. mySQLServerConflict: false,
  1228. title: 'no Ambari Server host components'
  1229. },
  1230. {
  1231. data: {
  1232. hostComponents: [
  1233. {
  1234. RootServiceHostComponents: {
  1235. properties: {
  1236. 'server.jdbc.url': 'jdbc:mysql://h0/db0?createDatabaseIfNotExist=true'
  1237. }
  1238. }
  1239. }
  1240. ]
  1241. },
  1242. mySQLServerConflict: true,
  1243. title: 'Ambari MySQL Server and Hive Server are on the same host'
  1244. },
  1245. {
  1246. data: {
  1247. hostComponents: [
  1248. {
  1249. RootServiceHostComponents: {
  1250. properties: {
  1251. 'server.jdbc.url': 'jdbc:mysql://h1/db1?createDatabaseIfNotExist=true'
  1252. }
  1253. }
  1254. }
  1255. ]
  1256. },
  1257. mySQLServerConflict: false,
  1258. title: 'Ambari MySQL Server and Hive Server are on different hosts'
  1259. }
  1260. ];
  1261. cases.forEach(function (item) {
  1262. it(item.title, function () {
  1263. controller.getAmbariDatabaseSuccess(item.data);
  1264. expect(controller.get('mySQLServerConflict')).to.equal(item.mySQLServerConflict);
  1265. });
  1266. });
  1267. });
  1268. describe('#showDatabaseConnectionWarningPopup', function () {
  1269. var cases = [
  1270. {
  1271. method: 'onSecondary',
  1272. submitButtonClicked: false,
  1273. isRejected: true,
  1274. title: 'Cancel button clicked'
  1275. },
  1276. {
  1277. method: 'onPrimary',
  1278. submitButtonClicked: true,
  1279. isResolved: true,
  1280. title: 'Proceed Anyway button clicked'
  1281. }
  1282. ],
  1283. dfd,
  1284. testObject,
  1285. serviceNames = ['HIVE', 'OOZIE'],
  1286. bodyMessage = 'HIVE, OOZIE';
  1287. beforeEach(function () {
  1288. installerStep7Controller.set('submitButtonClicked', true);
  1289. dfd = $.Deferred(function (d) {
  1290. d.done(function () {
  1291. testObject.isResolved = true;
  1292. });
  1293. d.fail(function () {
  1294. testObject.isRejected = true;
  1295. })
  1296. });
  1297. testObject = {};
  1298. });
  1299. cases.forEach(function (item) {
  1300. it(item.title, function () {
  1301. var popup = installerStep7Controller.showDatabaseConnectionWarningPopup(serviceNames, dfd);
  1302. expect(popup.get('body')).to.equal(Em.I18n.t('installer.step7.popup.database.connection.body').format(bodyMessage));
  1303. popup[item.method]();
  1304. expect(testObject.isResolved).to.equal(item.isResolved);
  1305. expect(testObject.isRejected).to.equal(item.isRejected);
  1306. expect(installerStep7Controller.get('submitButtonClicked')).to.equal(item.submitButtonClicked);
  1307. });
  1308. });
  1309. });
  1310. describe('#issuesFilterText', function () {
  1311. issuesFilterCases.forEach(function (item) {
  1312. it(item.title, function () {
  1313. issuesFilterTestSetup(installerStep7Controller, item);
  1314. expect(installerStep7Controller.get('issuesFilterText')).to.equal(item.issuesFilterText);
  1315. })
  1316. });
  1317. });
  1318. describe.skip('#loadServiceTagsSuccess', function () {
  1319. it('should create ClusterSiteToTagMap', function () {
  1320. var params = Em.Object.create({
  1321. serviceName: "OOZIE",
  1322. serviceConfigsDef: Em.Object.create({
  1323. configTypes: Em.Object.create({
  1324. site3: true,
  1325. site2: true,
  1326. site1: true
  1327. })
  1328. })
  1329. });
  1330. var wizardController = Em.Object.create({
  1331. allHosts: [
  1332. {hostName: 'h1'},
  1333. {hostName: 'h2'},
  1334. {hostName: 'h3'}
  1335. ]
  1336. });
  1337. installerStep7Controller.set('wizardController', wizardController);
  1338. installerStep7Controller.set('stepConfigs', Em.A([Em.Object.create({serviceName: 'OOZIE', configs: Em.A([]) })]));
  1339. var desired_configs = {
  1340. site1: {
  1341. tag: "tag1"
  1342. },
  1343. site2: {
  1344. tag: "tag2"
  1345. },
  1346. site3: {
  1347. tag: "tag3"
  1348. }
  1349. };
  1350. var data = {
  1351. config_groups: Em.A([Em.Object.create({
  1352. ConfigGroup: Em.Object.create({
  1353. tag: 'OOZIE',
  1354. hosts: Em.A([Em.Object.create({host_name: 'h1'})]),
  1355. id: 1,
  1356. group_name: "",
  1357. description: "",
  1358. desired_configs: Em.A([Em.Object.create({
  1359. type: '1',
  1360. tag: 'h1'
  1361. })])
  1362. })
  1363. })]),
  1364. Clusters: {
  1365. desired_configs: desired_configs
  1366. }
  1367. };
  1368. installerStep7Controller.loadServiceTagsSuccess(data, {}, params);
  1369. var result = installerStep7Controller.get("loadedClusterSiteToTagMap");
  1370. expect(JSON.parse(JSON.stringify(result))).to.eql(JSON.parse(JSON.stringify({"site1":"tag1","site2":"tag2","site3":"tag3"})));
  1371. })
  1372. });
  1373. describe('#issuesFilterLinkText', function () {
  1374. issuesFilterCases.forEach(function (item) {
  1375. it(item.title, function () {
  1376. issuesFilterTestSetup(installerStep7Controller, item);
  1377. expect(installerStep7Controller.get('issuesFilterLinkText')).to.equal(item.issuesFilterLinkText);
  1378. })
  1379. });
  1380. });
  1381. describe('#toggleIssuesFilter', function () {
  1382. it('should toggle issues filter', function () {
  1383. var issuesFilter = installerStep7Controller.get('filterColumns').findProperty('attributeName', 'hasIssues');
  1384. issuesFilter.set('selected', false);
  1385. installerStep7Controller.toggleIssuesFilter();
  1386. expect(issuesFilter.get('selected')).to.be.true;
  1387. installerStep7Controller.toggleIssuesFilter();
  1388. expect(issuesFilter.get('selected')).to.be.false;
  1389. });
  1390. it('selected service should be changed', function () {
  1391. installerStep7Controller.setProperties({
  1392. selectedService: {
  1393. errorCount: 0,
  1394. configGroups: []
  1395. },
  1396. stepConfigs: [
  1397. {
  1398. errorCount: 1,
  1399. configGroups: []
  1400. },
  1401. {
  1402. errorCount: 2,
  1403. configGroups: []
  1404. }
  1405. ]
  1406. });
  1407. installerStep7Controller.toggleIssuesFilter();
  1408. expect(installerStep7Controller.get('selectedService')).to.eql({
  1409. errorCount: 1,
  1410. configGroups: []
  1411. });
  1412. });
  1413. });
  1414. describe('#addKerberosDescriptorConfigs', function() {
  1415. var configs = [
  1416. { name: 'prop1', displayName: 'Prop1' },
  1417. { name: 'prop2', displayName: 'Prop2' },
  1418. { name: 'prop3', displayName: 'Prop3' }
  1419. ];
  1420. var descriptor = [
  1421. Em.Object.create({ name: 'prop4', filename: 'file-1'}),
  1422. Em.Object.create({ name: 'prop1', filename: 'file-1'})
  1423. ];
  1424. var propertiesAttrTests = [
  1425. {
  1426. attr: 'isUserProperty', val: false,
  1427. m: 'descriptor properties should not be marked as custom'
  1428. },
  1429. {
  1430. attr: 'category', val: 'Advanced file-1',
  1431. m: 'descriptor properties should be added to Advanced category'
  1432. },
  1433. {
  1434. attr: 'isOverridable', val: false,
  1435. m: 'descriptor properties should not be overriden'
  1436. }
  1437. ];
  1438. propertiesAttrTests.forEach(function(test) {
  1439. it(test.m, function() {
  1440. installerStep7Controller.addKerberosDescriptorConfigs(configs, descriptor);
  1441. expect(configs.findProperty('name', 'prop1')[test.attr]).to.be.eql(test.val);
  1442. });
  1443. });
  1444. });
  1445. describe('#errorsCount', function () {
  1446. it('should ignore configs with widgets (enhanced configs)', function () {
  1447. installerStep7Controller.reopen({selectedService: {
  1448. configs: [
  1449. Em.Object.create({isVisible: true, widgetType: 'type', isValid: false}),
  1450. Em.Object.create({isVisible: true, widgetType: 'type', isValid: true}),
  1451. Em.Object.create({isVisible: true, isValid: true}),
  1452. Em.Object.create({isVisible: true, isValid: false})
  1453. ]
  1454. }});
  1455. expect(installerStep7Controller.get('errorsCount')).to.equal(1);
  1456. });
  1457. it('should ignore configs with widgets (enhanced configs) and hidden configs', function () {
  1458. installerStep7Controller.reopen({selectedService: {
  1459. configs: [
  1460. Em.Object.create({isVisible: true, widgetType: 'type', isValid: false}),
  1461. Em.Object.create({isVisible: true, widgetType: 'type', isValid: true}),
  1462. Em.Object.create({isVisible: false, isValid: false}),
  1463. Em.Object.create({isVisible: true, isValid: true}),
  1464. Em.Object.create({isVisible: true, isValid: false})
  1465. ]
  1466. }});
  1467. expect(installerStep7Controller.get('errorsCount')).to.equal(1);
  1468. });
  1469. });
  1470. describe('#_reconfigureServicesOnNnHa', function () {
  1471. var dfsNameservices = 'some_cluster';
  1472. Em.A([
  1473. {
  1474. serviceName: 'HBASE',
  1475. configToUpdate: 'hbase.rootdir',
  1476. oldValue: 'hdfs://nameserv:8020/apps/hbase/data',
  1477. expectedNewValue: 'hdfs://' + dfsNameservices + '/apps/hbase/data'
  1478. },
  1479. {
  1480. serviceName: 'ACCUMULO',
  1481. configToUpdate: 'instance.volumes',
  1482. oldValue: 'hdfs://localhost:8020/apps/accumulo/data',
  1483. expectedNewValue: 'hdfs://' + dfsNameservices + '/apps/accumulo/data'
  1484. },
  1485. {
  1486. serviceName: 'HAWQ',
  1487. configToUpdate: 'hawq_dfs_url',
  1488. oldValue: 'localhost:8020/hawq_data',
  1489. expectedNewValue: dfsNameservices + '/hawq_data'
  1490. }
  1491. ]).forEach(function (test) {
  1492. it(test.serviceName + ' ' + test.configToUpdate, function () {
  1493. var serviceConfigs = [App.ServiceConfig.create({
  1494. serviceName: test.serviceName,
  1495. configs: [
  1496. Em.Object.create({
  1497. name: test.configToUpdate,
  1498. value: test.oldValue
  1499. })
  1500. ]
  1501. }),
  1502. App.ServiceConfig.create({
  1503. serviceName: 'HDFS',
  1504. configs: [
  1505. Em.Object.create({
  1506. name: 'dfs.nameservices',
  1507. value: dfsNameservices
  1508. })
  1509. ]
  1510. })];
  1511. installerStep7Controller.reopen({
  1512. selectedServiceNames: [test.serviceName, 'HDFS']
  1513. });
  1514. serviceConfigs = installerStep7Controller._reconfigureServicesOnNnHa(serviceConfigs);
  1515. expect(serviceConfigs.findProperty('serviceName', test.serviceName).configs.findProperty('name', test.configToUpdate).get('value')).to.equal(test.expectedNewValue);
  1516. });
  1517. });
  1518. });
  1519. describe('#showOozieDerbyWarning', function() {
  1520. var controller;
  1521. beforeEach(function() {
  1522. controller = App.WizardStep7Controller.create({});
  1523. sinon.stub(App.ModalPopup, 'show', Em.K);
  1524. });
  1525. afterEach(function() {
  1526. App.ModalPopup.show.restore();
  1527. });
  1528. Em.A([
  1529. {
  1530. selectedServiceNames: ['HDFS', 'OOZIE'],
  1531. databaseType: Em.I18n.t('installer.step7.oozie.database.new'),
  1532. e: true,
  1533. m: 'Oozie selected with derby database, warning popup should be shown'
  1534. },
  1535. {
  1536. selectedServiceNames: ['HDFS'],
  1537. databaseType: Em.I18n.t('installer.step7.oozie.database.new'),
  1538. e: false,
  1539. m: 'Oozie not selected warning popup should be skipped'
  1540. },
  1541. {
  1542. selectedServiceNames: ['HDFS', 'OOZIE'],
  1543. databaseType: 'New Mysql Database',
  1544. e: false,
  1545. m: 'Oozie selected, mysql database used, warning popup should be sk'
  1546. }
  1547. ]).forEach(function(test) {
  1548. it(test.m, function() {
  1549. var callback = sinon.spy();
  1550. sinon.stub(controller, 'findConfigProperty').returns(Em.Object.create({ value: test.databaseType}));
  1551. controller.reopen({
  1552. selectedServiceNames: test.selectedServiceNames
  1553. });
  1554. controller.showOozieDerbyWarningPopup(callback);
  1555. controller.findConfigProperty.restore();
  1556. expect(App.ModalPopup.show.calledOnce).to.equal(test.e);
  1557. });
  1558. });
  1559. });
  1560. describe('#addHostNamesToConfigs', function() {
  1561. beforeEach(function () {
  1562. sinon.stub(App.StackServiceComponent, 'find', function () {
  1563. return Em.Object.create({
  1564. id: 'NAMENODE',
  1565. displayName: 'NameNode'
  1566. });
  1567. });
  1568. });
  1569. afterEach(function () {
  1570. App.StackServiceComponent.find.restore();
  1571. });
  1572. it('should not create duplicate configs', function () {
  1573. var serviceConfig = Em.Object.create({
  1574. configs: [],
  1575. serviceName: 'HDFS',
  1576. configCategories: [
  1577. {
  1578. showHost: true,
  1579. name: 'NAMENODE'
  1580. }
  1581. ]
  1582. });
  1583. var masterComponents = [
  1584. {component: 'NAMENODE', hostName: 'h1'}
  1585. ];
  1586. var slaveComponents = [];
  1587. installerStep7Controller.addHostNamesToConfigs(serviceConfig, masterComponents, slaveComponents);
  1588. expect(serviceConfig.get('configs').filterProperty('name', 'namenode_host').length).to.equal(1);
  1589. installerStep7Controller.addHostNamesToConfigs(serviceConfig, masterComponents, slaveComponents);
  1590. expect(serviceConfig.get('configs').filterProperty('name', 'namenode_host').length).to.equal(1);
  1591. });
  1592. });
  1593. describe('#resolveHiveMysqlDatabase', function () {
  1594. beforeEach(function () {
  1595. installerStep7Controller.get('content').setProperties({
  1596. services: Em.A([
  1597. Em.Object.create({serviceName: 'HIVE', isSelected: true, isInstalled: false})
  1598. ])
  1599. });
  1600. installerStep7Controller.setProperties({
  1601. stepConfigs: Em.A([
  1602. Em.Object.create({serviceName: 'HIVE', configs: [{name: 'hive_database', value: 'New MySQL Database'}]})
  1603. ]),
  1604. mySQLServerConflict: true
  1605. });
  1606. sinon.stub(installerStep7Controller, 'moveNext', Em.K);
  1607. sinon.stub(installerStep7Controller, 'checkMySQLHost', function () {
  1608. return $.Deferred().resolve();
  1609. });
  1610. sinon.spy(App.ModalPopup, 'show');
  1611. });
  1612. afterEach(function () {
  1613. installerStep7Controller.moveNext.restore();
  1614. installerStep7Controller.checkMySQLHost.restore();
  1615. App.ModalPopup.show.restore();
  1616. });
  1617. it('no HIVE service', function () {
  1618. installerStep7Controller.set('content.services', Em.A([]));
  1619. installerStep7Controller.resolveHiveMysqlDatabase();
  1620. expect(installerStep7Controller.moveNext.calledOnce).to.be.true;
  1621. expect(App.ModalPopup.show.called).to.be.false;
  1622. });
  1623. it('if mySQLServerConflict, popup is shown', function () {
  1624. installerStep7Controller.resolveHiveMysqlDatabase();
  1625. expect(installerStep7Controller.moveNext.called).to.be.false;
  1626. expect(App.ModalPopup.show.calledOnce).to.be.true;
  1627. });
  1628. });
  1629. describe('#mySQLWarningHandler', function () {
  1630. beforeEach(function () {
  1631. installerStep7Controller.set('mySQLServerConflict', true);
  1632. sinon.spy(App.ModalPopup, 'show');
  1633. sinon.stub(App.router, 'get').returns({gotoStep: Em.K});
  1634. sinon.stub(App.router.get(), 'gotoStep', Em.K);
  1635. });
  1636. afterEach(function () {
  1637. App.ModalPopup.show.restore();
  1638. App.router.get().gotoStep.restore();
  1639. App.router.get.restore();
  1640. });
  1641. it('warning popup is shown', function () {
  1642. installerStep7Controller.mySQLWarningHandler();
  1643. expect(App.ModalPopup.show.calledOnce).to.be.true;
  1644. });
  1645. it('submitButtonClicked is set to false on primary click', function () {
  1646. installerStep7Controller.mySQLWarningHandler().onPrimary();
  1647. expect(installerStep7Controller.get('submitButtonClicked')).to.be.false;
  1648. });
  1649. it('second popup is shown on secondary click', function () {
  1650. installerStep7Controller.mySQLWarningHandler().onSecondary();
  1651. expect(App.ModalPopup.show.calledTwice).to.be.true;
  1652. });
  1653. it('submitButtonClicked is set to false on secondary click on the second popup', function () {
  1654. installerStep7Controller.mySQLWarningHandler().onSecondary().onSecondary();
  1655. expect(installerStep7Controller.get('submitButtonClicked')).to.be.false;
  1656. });
  1657. it('user is moved to step5 on primary click on the second popup (installerController)', function () {
  1658. installerStep7Controller.set('content.controllerName', 'installerController');
  1659. installerStep7Controller.mySQLWarningHandler().onSecondary().onPrimary();
  1660. expect(App.router.get('installerController').gotoStep.calledWith(5, true)).to.be.true;
  1661. });
  1662. it('user is moved to step2 on primary click on the second popup (addSeviceController)', function () {
  1663. installerStep7Controller.set('content.controllerName', 'addServiceController');
  1664. installerStep7Controller.mySQLWarningHandler().onSecondary().onPrimary();
  1665. expect(App.router.get('addSeviceController').gotoStep.calledWith(2, true)).to.be.true;
  1666. });
  1667. });
  1668. });