step7_test.js 63 KB

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