step7_test.js 82 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429
  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. require('mixins/common/localStorage');
  20. require('controllers/wizard/step7_controller');
  21. var installerStep7Controller,
  22. issuesFilterCases = [
  23. {
  24. isSubmitDisabled: true,
  25. submitButtonClicked: true,
  26. isIssuesFilterActive: true,
  27. issuesFilterText: '',
  28. issuesFilterLinkText: Em.I18n.t('installer.step7.showAllProperties'),
  29. title: 'issues filter on, submit button clicked'
  30. },
  31. {
  32. isSubmitDisabled: true,
  33. submitButtonClicked: false,
  34. isIssuesFilterActive: true,
  35. issuesFilterText: Em.I18n.t('installer.step7.showingPropertiesWithIssues'),
  36. issuesFilterLinkText: Em.I18n.t('installer.step7.showAllProperties'),
  37. title: 'issues filter on, submit button disabled'
  38. },
  39. {
  40. isSubmitDisabled: true,
  41. submitButtonClicked: true,
  42. isIssuesFilterActive: false,
  43. issuesFilterText: '',
  44. issuesFilterLinkText: '',
  45. title: 'issues filter off, submit button clicked'
  46. },
  47. {
  48. isSubmitDisabled: true,
  49. submitButtonClicked: false,
  50. isIssuesFilterActive: false,
  51. issuesFilterText: '',
  52. issuesFilterLinkText: Em.I18n.t('installer.step7.showPropertiesWithIssues'),
  53. title: 'issues filter off, submit button disabled'
  54. },
  55. {
  56. isSubmitDisabled: false,
  57. submitButtonClicked: false,
  58. isIssuesFilterActive: true,
  59. issuesFilterText: '',
  60. issuesFilterLinkText: Em.I18n.t('installer.step7.showAllProperties'),
  61. title: 'issues filter on, submit button enabled'
  62. },
  63. {
  64. isSubmitDisabled: false,
  65. submitButtonClicked: false,
  66. isIssuesFilterActive: false,
  67. issuesFilterText: '',
  68. issuesFilterLinkText: '',
  69. title: 'issues filter off, submit button enabled'
  70. },
  71. {
  72. isSubmitDisabled: false,
  73. submitButtonClicked: false,
  74. isIssuesFilterActive: true,
  75. issuesFilterText: '',
  76. issuesFilterLinkText: Em.I18n.t('installer.step7.showAllProperties'),
  77. title: 'issues filter on, submit button not clicked but active'
  78. },
  79. {
  80. isSubmitDisabled: false,
  81. submitButtonClicked: true,
  82. isIssuesFilterActive: true,
  83. issuesFilterText: '',
  84. issuesFilterLinkText: Em.I18n.t('installer.step7.showAllProperties'),
  85. title: 'issues filter on, submit button clicked and active'
  86. }
  87. ],
  88. issuesFilterTestSetup = function (controller, testCase) {
  89. controller.set('submitButtonClicked', testCase.submitButtonClicked);
  90. controller.reopen({
  91. isSubmitDisabled: testCase.isSubmitDisabled
  92. });
  93. controller.get('filterColumns').findProperty('attributeName', 'hasIssues').set('selected', testCase.isIssuesFilterActive);
  94. };
  95. function getController() {
  96. return App.WizardStep7Controller.create({
  97. content: Em.Object.create({
  98. services: [],
  99. advancedServiceConfig: [],
  100. serviceConfigProperties: []
  101. })
  102. });
  103. }
  104. describe('App.InstallerStep7Controller', function () {
  105. beforeEach(function () {
  106. sinon.stub(App.ajax, 'send', Em.K);
  107. sinon.stub(App.config, 'setPreDefinedServiceConfigs', Em.K);
  108. installerStep7Controller = getController();
  109. });
  110. afterEach(function() {
  111. App.ajax.send.restore();
  112. App.config.setPreDefinedServiceConfigs.restore();
  113. installerStep7Controller.destroy();
  114. });
  115. App.TestAliases.testAsComputedAlias(getController(), 'masterComponentHosts', 'content.masterComponentHosts', 'array');
  116. App.TestAliases.testAsComputedAlias(getController(), 'slaveComponentHosts', 'content.slaveGroupProperties', 'array');
  117. App.TestAliases.testAsComputedAnd(getController(), 'isConfigsLoaded', ['wizardController.stackConfigsLoaded', 'isAppliedConfigLoaded']);
  118. describe('#installedServiceNames', function () {
  119. var tests = Em.A([
  120. {
  121. content: Em.Object.create({
  122. controllerName: 'installerController',
  123. services: Em.A([
  124. Em.Object.create({
  125. isInstalled: true,
  126. serviceName: 'SQOOP'
  127. }),
  128. Em.Object.create({
  129. isInstalled: true,
  130. serviceName: 'HDFS'
  131. })
  132. ])
  133. }),
  134. e: ['SQOOP', 'HDFS'],
  135. m: 'installerController with SQOOP'
  136. },
  137. {
  138. content: Em.Object.create({
  139. controllerName: 'installerController',
  140. services: Em.A([
  141. Em.Object.create({
  142. isInstalled: true,
  143. serviceName: 'HIVE'
  144. }),
  145. Em.Object.create({
  146. isInstalled: true,
  147. serviceName: 'HDFS'
  148. })
  149. ])
  150. }),
  151. e: ['HIVE', 'HDFS'],
  152. m: 'installerController without SQOOP'
  153. },
  154. {
  155. content: Em.Object.create({
  156. controllerName: 'addServiceController',
  157. services: Em.A([
  158. Em.Object.create({
  159. isInstalled: true,
  160. serviceName: 'HIVE'
  161. }),
  162. Em.Object.create({
  163. isInstalled: true,
  164. serviceName: 'HDFS'
  165. })
  166. ])
  167. }),
  168. e: ['HIVE', 'HDFS'],
  169. m: 'addServiceController without SQOOP'
  170. }
  171. ]);
  172. tests.forEach(function (test) {
  173. it(test.m, function () {
  174. installerStep7Controller.set('content', test.content);
  175. expect(installerStep7Controller.get('installedServiceNames')).to.include.members(test.e);
  176. expect(test.e).to.include.members(installerStep7Controller.get('installedServiceNames'));
  177. });
  178. });
  179. });
  180. describe('#isSubmitDisabled', function () {
  181. it('should be true if miscModalVisible', function () {
  182. installerStep7Controller.reopen({miscModalVisible: true});
  183. expect(installerStep7Controller.get('isSubmitDisabled')).to.equal(true);
  184. });
  185. it('should be true if some of stepConfigs has errors', function () {
  186. installerStep7Controller.reopen({
  187. miscModalVisible: false,
  188. stepConfigs: [
  189. {
  190. showConfig: true,
  191. errorCount: 1
  192. }
  193. ]
  194. });
  195. expect(installerStep7Controller.get('isSubmitDisabled')).to.equal(true);
  196. });
  197. it('should be false if all of stepConfigs don\'t have errors and miscModalVisible is false', function () {
  198. installerStep7Controller.reopen({
  199. miscModalVisible: false,
  200. stepConfigs: [
  201. {
  202. showConfig: true,
  203. errorCount: 0
  204. }
  205. ]
  206. });
  207. expect(installerStep7Controller.get('isSubmitDisabled')).to.equal(false);
  208. });
  209. });
  210. describe('#selectedServiceNames', function () {
  211. it('should use content.services as source of data', function () {
  212. installerStep7Controller.set('content', {
  213. services: [
  214. {isSelected: true, isInstalled: false, serviceName: 's1'},
  215. {isSelected: false, isInstalled: false, serviceName: 's2'},
  216. {isSelected: true, isInstalled: true, serviceName: 's3'},
  217. {isSelected: false, isInstalled: false, serviceName: 's4'},
  218. {isSelected: true, isInstalled: false, serviceName: 's5'},
  219. {isSelected: false, isInstalled: false, serviceName: 's6'},
  220. {isSelected: true, isInstalled: true, serviceName: 's7'},
  221. {isSelected: false, isInstalled: false, serviceName: 's8'}
  222. ]
  223. });
  224. var expected = ['s1', 's5'];
  225. expect(installerStep7Controller.get('selectedServiceNames')).to.eql(expected);
  226. });
  227. });
  228. describe('#allSelectedServiceNames', function () {
  229. it('should use content.services as source of data', function () {
  230. installerStep7Controller.set('content', {
  231. services: [
  232. Em.Object.create({isSelected: true, isInstalled: false, serviceName: 's1'}),
  233. Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's2'}),
  234. Em.Object.create({isSelected: true, isInstalled: true, serviceName: 's3'}),
  235. Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's4'}),
  236. Em.Object.create({isSelected: true, isInstalled: false, serviceName: 's5'}),
  237. Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's6'}),
  238. Em.Object.create({isSelected: true, isInstalled: true, serviceName: 's7'}),
  239. Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's8'})
  240. ]
  241. });
  242. var expected = ['s1', 's3', 's5', 's7'];
  243. expect(installerStep7Controller.get('allSelectedServiceNames')).to.eql(expected);
  244. });
  245. });
  246. describe('#_createSiteToTagMap', function () {
  247. it('should return filtered map', function () {
  248. var desired_configs = {
  249. site1: {
  250. tag: "tag1"
  251. },
  252. site2: {
  253. tag: "tag2"
  254. },
  255. site3: {
  256. tag: "tag3"
  257. }
  258. };
  259. var sites = {
  260. site1: true,
  261. site3: true
  262. };
  263. var siteToTagMap = installerStep7Controller._createSiteToTagMap(desired_configs,sites);
  264. expect(siteToTagMap).to.eql({
  265. site1: "tag1",
  266. site3: "tag3"
  267. });
  268. });
  269. });
  270. describe('#checkDatabaseConnectionTest', function () {
  271. beforeEach(function () {
  272. installerStep7Controller.set('content', {
  273. services: Em.A([
  274. Em.Object.create({isSelected: true, isInstalled: false, serviceName: 'OOZIE', ignored: []}),
  275. Em.Object.create({isSelected: false, isInstalled: false, serviceName: 'HIVE', ignored: []}),
  276. Em.Object.create({isSelected: true, isInstalled: true, serviceName: 's3', ignored: []}),
  277. Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's4', ignored: []}),
  278. Em.Object.create({isSelected: true, isInstalled: false, serviceName: 's5', ignored: []}),
  279. Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's6', ignored: []}),
  280. Em.Object.create({isSelected: true, isInstalled: true, serviceName: 's7', ignored: []}),
  281. Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's8', ignored: []})
  282. ])
  283. });
  284. var obj = Em.Object.create({name:'oozie_database',value:"aa"});
  285. installerStep7Controller.set('stepConfigs',Em.A([Em.Object.create({serviceName: 'OOZIE', configs: Em.A([obj]) })]));
  286. this.deffer = installerStep7Controller.checkDatabaseConnectionTest();
  287. });
  288. it('should return promise in process', function () {
  289. expect(this.deffer.isResolved()).to.equal(false);
  290. this.deffer.resolve(true);
  291. this.deffer.done(function(data) {
  292. expect(data).to.equal(true);
  293. });
  294. });
  295. });
  296. describe.skip('#submit', function () {
  297. beforeEach(function () {
  298. sinon.stub(App, 'get').withArgs('supports.preInstallChecks').returns(false);
  299. });
  300. afterEach(function () {
  301. App.get.restore();
  302. });
  303. it('should return false if submit disabled', function () {
  304. installerStep7Controller.set('isSubmitDisabled',true);
  305. expect(installerStep7Controller.submit()).to.be.false;
  306. });
  307. it('sumbit button should be unclicked if no configs', function () {
  308. installerStep7Controller.set('isSubmitDisabled',false);
  309. installerStep7Controller.submit();
  310. expect(installerStep7Controller.get('submitButtonClicked')).to.be.false;
  311. });
  312. });
  313. describe('#getConfigTagsSuccess', function () {
  314. beforeEach(function(){
  315. sinon.stub(App.StackService, 'find', function () {
  316. return [
  317. Em.Object.create({
  318. serviceName: 's0',
  319. isInstalled: true,
  320. configTypes: {
  321. site3: true,
  322. site1: true
  323. }
  324. }),
  325. Em.Object.create({
  326. serviceName: 's1',
  327. isInstalled: true,
  328. configTypes: {
  329. site1: true,
  330. site2: true
  331. }
  332. })
  333. ];
  334. });
  335. });
  336. afterEach(function(){
  337. App.StackService.find.restore();
  338. });
  339. it('should return serviceConfigTags', function () {
  340. var desired_configs = {
  341. site1: {
  342. tag: "tag1"
  343. },
  344. site2: {
  345. tag: "tag2"
  346. },
  347. site3: {
  348. tag: "tag3"
  349. }
  350. };
  351. var data = {
  352. Clusters: {
  353. desired_configs: desired_configs
  354. }
  355. };
  356. var siteToTagMap = installerStep7Controller.getConfigTagsSuccess(data);
  357. expect(installerStep7Controller.get('serviceConfigTags')).to.eql([
  358. {
  359. "siteName": "site1",
  360. "tagName": "tag1",
  361. "newTagName": null
  362. },
  363. {
  364. "siteName": "site2",
  365. "tagName": "tag2",
  366. "newTagName": null
  367. },
  368. {
  369. "siteName": "site3",
  370. "tagName": "tag3",
  371. "newTagName": null
  372. }
  373. ]);
  374. expect(installerStep7Controller.get('isAppliedConfigLoaded')).to.equal(true);
  375. });
  376. });
  377. describe('#clearStep', function () {
  378. it('should clear stepConfigs', function () {
  379. installerStep7Controller.set('stepConfigs', [
  380. {},
  381. {}
  382. ]);
  383. installerStep7Controller.clearStep();
  384. expect(installerStep7Controller.get('stepConfigs.length')).to.equal(0);
  385. });
  386. it('should clear filter', function () {
  387. installerStep7Controller.set('filter', 'filter');
  388. installerStep7Controller.clearStep();
  389. expect(installerStep7Controller.get('filter')).to.equal('');
  390. });
  391. it('should set for each filterColumns "selected" false', function () {
  392. installerStep7Controller.set('filterColumns', [
  393. {selected: true},
  394. {selected: false},
  395. {selected: true}
  396. ]);
  397. installerStep7Controller.clearStep();
  398. expect(installerStep7Controller.get('filterColumns').everyProperty('selected', false)).to.equal(true);
  399. });
  400. });
  401. describe('#loadInstalledServicesConfigGroups', function () {
  402. it('should do ajax request for each received service name', function () {
  403. var serviceNames = ['s1', 's2', 's3'];
  404. installerStep7Controller.loadInstalledServicesConfigGroups(serviceNames);
  405. expect(App.ajax.send.callCount).to.equal(serviceNames.length);
  406. });
  407. });
  408. describe('#getConfigTags', function () {
  409. it('should do ajax-request', function () {
  410. installerStep7Controller.getConfigTags();
  411. expect(App.ajax.send.calledOnce).to.equal(true);
  412. });
  413. });
  414. describe('#setGroupsToDelete', function () {
  415. beforeEach(function () {
  416. installerStep7Controller.set('wizardController', Em.Object.create(App.LocalStorage, {name: 'tdk'}));
  417. });
  418. it('should add new groups to groupsToDelete', function () {
  419. var groupsToDelete = [
  420. {id: '1'},
  421. {id: '2'}
  422. ],
  423. groups = [
  424. Em.Object.create({id: '3'}),
  425. Em.Object.create(),
  426. Em.Object.create({id: '5'})
  427. ],
  428. expected = [
  429. {id: "1"},
  430. {id: "2"},
  431. {id: "3"},
  432. {id: "5"}
  433. ];
  434. installerStep7Controller.set('groupsToDelete', groupsToDelete);
  435. installerStep7Controller.setGroupsToDelete(groups);
  436. expect(installerStep7Controller.get('groupsToDelete')).to.eql(expected);
  437. expect(installerStep7Controller.get('wizardController').getDBProperty('groupsToDelete')).to.eql(expected);
  438. });
  439. });
  440. describe('#checkMySQLHost', function () {
  441. it('should send query', function () {
  442. installerStep7Controller.checkMySQLHost();
  443. expect(App.ajax.send.calledOnce).to.be.true;
  444. });
  445. });
  446. describe('#selectConfigGroup', function () {
  447. beforeEach(function () {
  448. installerStep7Controller.reopen({content: {services: []}});
  449. sinon.stub(installerStep7Controller, 'switchConfigGroupConfigs', Em.K);
  450. });
  451. afterEach(function () {
  452. installerStep7Controller.switchConfigGroupConfigs.restore();
  453. });
  454. it('should set selectedConfigGroup', function () {
  455. var group = {':': []};
  456. installerStep7Controller.selectConfigGroup({context: group});
  457. expect(installerStep7Controller.get('selectedConfigGroup')).to.eql(group);
  458. });
  459. });
  460. describe('#selectedServiceObserver', function () {
  461. beforeEach(function () {
  462. installerStep7Controller.reopen({content: {services: []}});
  463. sinon.stub(installerStep7Controller, 'switchConfigGroupConfigs', Em.K);
  464. });
  465. afterEach(function () {
  466. installerStep7Controller.switchConfigGroupConfigs.restore();
  467. });
  468. it('shouldn\'t do nothing if App.supports.hostOverridesInstaller is false', function () {
  469. App.set('supports.hostOverridesInstaller', false);
  470. var configGroups = [
  471. {},
  472. {}
  473. ],
  474. selectedConfigGroup = {};
  475. installerStep7Controller.reopen({configGroups: configGroups, selectedConfigGroup: selectedConfigGroup});
  476. installerStep7Controller.selectedServiceObserver();
  477. expect(installerStep7Controller.get('configGroups')).to.eql(configGroups);
  478. expect(installerStep7Controller.get('selectedConfigGroup')).to.eql(selectedConfigGroup);
  479. });
  480. it('shouldn\'t do nothing if selectedService is null', function () {
  481. App.set('supports.hostOverridesInstaller', true);
  482. var configGroups = [
  483. {},
  484. {}
  485. ],
  486. selectedConfigGroup = {};
  487. installerStep7Controller.reopen({selectedService: null, configGroups: configGroups, selectedConfigGroup: selectedConfigGroup});
  488. installerStep7Controller.selectedServiceObserver();
  489. expect(installerStep7Controller.get('configGroups')).to.eql(configGroups);
  490. expect(installerStep7Controller.get('selectedConfigGroup')).to.eql(selectedConfigGroup);
  491. });
  492. it('shouldn\'t do nothing if selectedService.serviceName is MISC', function () {
  493. App.set('supports.hostOverridesInstaller', true);
  494. var configGroups = [
  495. {},
  496. {}
  497. ],
  498. selectedConfigGroup = {};
  499. installerStep7Controller.reopen({selectedService: {serviceName: 'MISC'}, configGroups: configGroups, selectedConfigGroup: selectedConfigGroup});
  500. installerStep7Controller.selectedServiceObserver();
  501. expect(installerStep7Controller.get('configGroups')).to.eql(configGroups);
  502. expect(installerStep7Controller.get('selectedConfigGroup')).to.eql(selectedConfigGroup);
  503. });
  504. it('should update configGroups and selectedConfigGroup', function () {
  505. App.set('supports.hostOverridesInstaller', true);
  506. var defaultGroup = {isDefault: true, n: 'n2'},
  507. configGroups = [
  508. {isDefault: false, n: 'n1'},
  509. defaultGroup,
  510. {n: 'n3'}
  511. ],
  512. selectedConfigGroup = {};
  513. installerStep7Controller.reopen({selectedService: {serviceName: 's1', configGroups: configGroups}});
  514. installerStep7Controller.selectedServiceObserver();
  515. expect(installerStep7Controller.get('configGroups').mapProperty('n')).to.eql(['n2', 'n1', 'n3']);
  516. expect(installerStep7Controller.get('selectedConfigGroup')).to.eql(defaultGroup);
  517. });
  518. });
  519. describe('#loadConfigGroups', function () {
  520. beforeEach(function () {
  521. installerStep7Controller.reopen({
  522. wizardController: Em.Object.create({
  523. allHosts: [
  524. {hostName: 'h1'},
  525. {hostName: 'h2'},
  526. {hostName: 'h3'}
  527. ]
  528. })
  529. });
  530. });
  531. afterEach(function () {
  532. App.ServiceConfigGroup.find().clear();
  533. });
  534. it('shouldn\'t do nothing if only MISC available', function () {
  535. var configGroups = [
  536. {}
  537. ];
  538. installerStep7Controller.reopen({
  539. stepConfigs: [Em.Object.create({serviceName: 'MISC', configGroups: configGroups})]
  540. });
  541. installerStep7Controller.loadConfigGroups([]);
  542. expect(installerStep7Controller.get('stepConfigs.firstObject.configGroups')).to.eql(configGroups);
  543. });
  544. });
  545. describe('#_getDisplayedConfigGroups', function () {
  546. it('should return [] if no selected group', function () {
  547. installerStep7Controller.reopen({
  548. content: {services: []},
  549. selectedConfigGroup: null
  550. });
  551. expect(installerStep7Controller._getDisplayedConfigGroups()).to.eql([]);
  552. });
  553. it('should return default config group if another selected', function () {
  554. var defaultGroup = Em.Object.create({isDefault: false});
  555. installerStep7Controller.reopen({
  556. content: {services: []},
  557. selectedConfigGroup: defaultGroup
  558. });
  559. expect(installerStep7Controller._getDisplayedConfigGroups()).to.eql([defaultGroup]);
  560. });
  561. it('should return other groups if default selected', function () {
  562. var defaultGroup = Em.Object.create({isDefault: true}),
  563. cfgG = Em.Object.create({isDefault: true}),
  564. configGroups = Em.A([
  565. Em.Object.create({isDefault: false}),
  566. Em.Object.create({isDefault: false}),
  567. cfgG,
  568. Em.Object.create({isDefault: false})
  569. ]);
  570. installerStep7Controller.reopen({
  571. content: {services: []},
  572. selectedConfigGroup: defaultGroup,
  573. selectedService: {configGroups: configGroups}
  574. });
  575. expect(installerStep7Controller._getDisplayedConfigGroups()).to.eql(configGroups.without(cfgG));
  576. });
  577. });
  578. describe('#_setEditableValue', function () {
  579. it('shouldn\'t update config if no selectedConfigGroup', function () {
  580. installerStep7Controller.reopen({
  581. selectedConfigGroup: null
  582. });
  583. var config = Em.Object.create({isEditable: null});
  584. var updatedConfig = installerStep7Controller._setEditableValue(config);
  585. expect(updatedConfig.get('isEditable')).to.be.null;
  586. });
  587. it('should set isEditable equal to selectedGroup.isDefault if service not installed', function () {
  588. var isDefault = true;
  589. installerStep7Controller.reopen({
  590. installedServiceNames: [],
  591. selectedService: {serviceName: 'abc'},
  592. selectedConfigGroup: Em.Object.create({isDefault: isDefault})
  593. });
  594. var config = Em.Object.create({isEditable: null});
  595. var updatedConfig = installerStep7Controller._setEditableValue(config);
  596. expect(updatedConfig.get('isEditable')).to.equal(isDefault);
  597. installerStep7Controller.toggleProperty('selectedConfigGroup.isDefault');
  598. updatedConfig = installerStep7Controller._setEditableValue(config);
  599. expect(updatedConfig.get('isEditable')).to.equal(!isDefault);
  600. });
  601. Em.A([
  602. {
  603. isEditable: false,
  604. isReconfigurable: false,
  605. isDefault: true,
  606. e: false
  607. },
  608. {
  609. isEditable: true,
  610. isReconfigurable: true,
  611. isDefault: true,
  612. e: true
  613. },
  614. {
  615. isEditable: false,
  616. isReconfigurable: true,
  617. isDefault: false,
  618. e: false
  619. },
  620. {
  621. isEditable: true,
  622. isReconfigurable: false,
  623. isDefault: false,
  624. e: false
  625. }
  626. ]).forEach(function (test) {
  627. it('service installed, isEditable = ' + test.isEditable.toString() + ', isReconfigurable = ' + test.isReconfigurable.toString(), function () {
  628. var config = Em.Object.create({
  629. isReconfigurable: test.isReconfigurable,
  630. isEditable: test.isEditable
  631. });
  632. installerStep7Controller.reopen({
  633. installedServiceNames: Em.A(['a']),
  634. selectedService: Em.Object.create({serviceName: 'a'}),
  635. selectedConfigGroup: Em.Object.create({isDefault: test.isDefault})
  636. });
  637. var updateConfig = installerStep7Controller._setEditableValue(config);
  638. expect(updateConfig.get('isEditable')).to.equal(test.e);
  639. });
  640. });
  641. });
  642. describe('#_setOverrides', function () {
  643. it('shouldn\'t update config if no selectedConfigGroup', function () {
  644. installerStep7Controller.reopen({
  645. selectedConfigGroup: null
  646. });
  647. var config = Em.Object.create({overrides: null});
  648. var updatedConfig = installerStep7Controller._setOverrides(config, []);
  649. expect(updatedConfig.get('overrides')).to.be.null;
  650. });
  651. describe('no overrideToAdd', function () {
  652. var isDefault;
  653. beforeEach(function () {
  654. isDefault = true;
  655. var name = 'n1',
  656. config = Em.Object.create({overrides: null, name: name, flag: 'flag'}),
  657. overrides = Em.A([
  658. Em.Object.create({name: name, value: 'v1'}),
  659. Em.Object.create({name: name, value: 'v2'}),
  660. Em.Object.create({name: 'n2', value: 'v3'})
  661. ]);
  662. installerStep7Controller.reopen({
  663. overrideToAdd: null,
  664. selectedConfigGroup: Em.Object.create({
  665. isDefault: isDefault
  666. })
  667. });
  668. this.updatedConfig = installerStep7Controller._setOverrides(config, overrides);
  669. });
  670. it('2 overrides', function () {
  671. expect(this.updatedConfig.get('overrides.length')).to.equal(2);
  672. });
  673. it('each isEditable is ' + !isDefault, function () {
  674. expect(this.updatedConfig.get('overrides').everyProperty('isEditable', !isDefault)).to.equal(true);
  675. });
  676. it('each parentSCP.flag is `flag`', function () {
  677. expect(this.updatedConfig.get('overrides').everyProperty('parentSCP.flag', 'flag')).to.equal(true);
  678. });
  679. });
  680. describe('overrideToAdd exists', function () {
  681. var isDefault = true;
  682. beforeEach(function () {
  683. var name = 'n1',
  684. config = Em.Object.create({overrides: null, name: name, flag: 'flag'}),
  685. overrides = Em.A([
  686. Em.Object.create({name: name, value: 'v1'}),
  687. Em.Object.create({name: name, value: 'v2'}),
  688. Em.Object.create({name: 'n2', value: 'v3'})
  689. ]);
  690. installerStep7Controller.reopen({
  691. overrideToAdd: Em.Object.create({name: name}),
  692. selectedService: {configGroups: [Em.Object.create({name: 'n', properties: []})]},
  693. selectedConfigGroup: Em.Object.create({
  694. isDefault: isDefault,
  695. name: 'n'
  696. })
  697. });
  698. this.updatedConfig = installerStep7Controller._setOverrides(config, overrides);
  699. });
  700. it('3 overrides', function () {
  701. expect(this.updatedConfig.get('overrides.length')).to.equal(3);
  702. });
  703. it('each isEditable is ' + !isDefault, function () {
  704. expect(this.updatedConfig.get('overrides').everyProperty('isEditable', !isDefault)).to.equal(true);
  705. });
  706. it('each parentSCP.flag is `flag`', function () {
  707. expect(this.updatedConfig.get('overrides').everyProperty('parentSCP.flag', 'flag')).to.equal(true);
  708. });
  709. });
  710. });
  711. describe('#switchConfigGroupConfigs', function () {
  712. it('if selectedConfigGroup is null, serviceConfigs shouldn\'t be changed', function () {
  713. installerStep7Controller.reopen({
  714. selectedConfigGroup: null,
  715. content: {services: []},
  716. serviceConfigs: {configs: [
  717. {overrides: []},
  718. {overrides: []}
  719. ]}
  720. });
  721. installerStep7Controller.switchConfigGroupConfigs();
  722. expect(installerStep7Controller.get('serviceConfigs.configs').everyProperty('overrides.length', 0)).to.equal(true);
  723. });
  724. describe('should set configs for serviceConfigs', function () {
  725. var configGroups = [
  726. Em.Object.create({
  727. properties: [
  728. {name: 'g1', value: 'v1'},
  729. {name: 'g2', value: 'v2'}
  730. ]
  731. })
  732. ];
  733. beforeEach(function () {
  734. sinon.stub(installerStep7Controller, '_getDisplayedConfigGroups', function () {
  735. return configGroups;
  736. });
  737. sinon.stub(installerStep7Controller, '_setEditableValue', function (config) {
  738. config.set('isEditable', true);
  739. return config;
  740. });
  741. installerStep7Controller.reopen({
  742. selectedConfigGroup: Em.Object.create({isDefault: true, name: 'g1'}),
  743. content: {services: []},
  744. selectedService: {configs: Em.A([Em.Object.create({name: 'g1', overrides: [], properties: []}), Em.Object.create({name: 'g2', overrides: []})])},
  745. serviceConfigs: {configs: [Em.Object.create({name: 'g1'})]}
  746. });
  747. installerStep7Controller.switchConfigGroupConfigs();
  748. this.configs = installerStep7Controller.get('selectedService.configs');
  749. });
  750. afterEach(function () {
  751. installerStep7Controller._getDisplayedConfigGroups.restore();
  752. installerStep7Controller._setEditableValue.restore();
  753. });
  754. it('g1 has 1 override', function () {
  755. expect(this.configs.findProperty('name', 'g1').get('overrides').length).to.equal(1);
  756. });
  757. it('g2 has 1 override', function () {
  758. expect(this.configs.findProperty('name', 'g2').get('overrides').length).to.equal(1);
  759. });
  760. it('all configs are editable', function () {
  761. expect(this.configs.everyProperty('isEditable', true)).to.equal(true);
  762. });
  763. });
  764. });
  765. describe('#selectProperService', function () {
  766. Em.A([
  767. {
  768. name: 'addServiceController',
  769. stepConfigs: [
  770. {selected: false, name: 'n1'},
  771. {selected: true, name: 'n2'},
  772. {selected: true, name: 'n3'}
  773. ],
  774. e: 'n2'
  775. },
  776. {
  777. name: 'installerController',
  778. stepConfigs: [
  779. {showConfig: false, name: 'n1'},
  780. {showConfig: false, name: 'n2'},
  781. {showConfig: true, name: 'n3'}
  782. ],
  783. e: 'n3'
  784. }
  785. ]).forEach(function (test) {
  786. describe(test.name, function () {
  787. beforeEach(function () {
  788. sinon.stub(installerStep7Controller, 'selectedServiceObserver', Em.K);
  789. installerStep7Controller.reopen({
  790. wizardController: Em.Object.create({
  791. name: test.name
  792. }),
  793. stepConfigs: test.stepConfigs
  794. });
  795. installerStep7Controller.selectProperService();
  796. });
  797. afterEach(function () {
  798. installerStep7Controller.selectedServiceObserver.restore();
  799. });
  800. it('selected service name is valid', function () {
  801. expect(installerStep7Controller.get('selectedService.name')).to.equal(test.e);
  802. });
  803. });
  804. });
  805. });
  806. describe.skip('#setStepConfigs', function () {
  807. var serviceConfigs;
  808. beforeEach(function () {
  809. installerStep7Controller.reopen({
  810. content: {services: []},
  811. wizardController: Em.Object.create({
  812. getDBProperty: function (key) {
  813. return this.get(key);
  814. }
  815. })
  816. });
  817. sinon.stub(installerStep7Controller, 'renderConfigs', function () {
  818. return serviceConfigs;
  819. });
  820. this.stub = sinon.stub(App, 'get');
  821. });
  822. afterEach(function () {
  823. installerStep7Controller.renderConfigs.restore();
  824. App.get.restore();
  825. });
  826. it('if wizard isn\'t addService, should set output of installerStep7Controller.renderConfigs', function () {
  827. serviceConfigs = Em.A([
  828. {serviceName:'HDFS', configs: []},
  829. {}
  830. ]);
  831. installerStep7Controller.set('wizardController.name', 'installerController');
  832. installerStep7Controller.setStepConfigs([], []);
  833. expect(installerStep7Controller.get('stepConfigs')).to.eql(serviceConfigs);
  834. });
  835. it('addServiceWizard used', function () {
  836. serviceConfigs = Em.A([Em.Object.create({serviceName: 'HDFS', configs: []}), Em.Object.create({serviceName: 's2'})]);
  837. installerStep7Controller.set('wizardController.name', 'addServiceController');
  838. installerStep7Controller.reopen({selectedServiceNames: ['s2']});
  839. installerStep7Controller.setStepConfigs([], []);
  840. expect(installerStep7Controller.get('stepConfigs').everyProperty('showConfig', true)).to.equal(true);
  841. expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 's2').get('selected')).to.equal(true);
  842. });
  843. it('addServiceWizard used, HA enabled', function () {
  844. this.stub.withArgs('isHaEnabled').returns(true);
  845. serviceConfigs = Em.A([
  846. Em.Object.create({
  847. serviceName: 'HDFS',
  848. configs: [
  849. Em.Object.create({category: 'SECONDARY_NAMENODE'}),
  850. Em.Object.create({category: 'SECONDARY_NAMENODE'}),
  851. Em.Object.create({category: 'NameNode'}),
  852. Em.Object.create({category: 'NameNode'}),
  853. Em.Object.create({category: 'SECONDARY_NAMENODE'})
  854. ]
  855. }),
  856. Em.Object.create({serviceName: 's2'})]
  857. );
  858. installerStep7Controller.set('wizardController.name', 'addServiceController');
  859. installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
  860. installerStep7Controller.setStepConfigs([], []);
  861. expect(installerStep7Controller.get('stepConfigs').everyProperty('showConfig', true)).to.equal(true);
  862. expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 'HDFS').get('selected')).to.equal(true);
  863. expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 'HDFS').get('configs').length).to.equal(5);
  864. });
  865. it('not windows stack', function () {
  866. this.stub.withArgs('isHadoopWindowsStack').returns(false);
  867. this.stub.withArgs('isHaEnabled').returns(false);
  868. serviceConfigs = Em.A([
  869. Em.Object.create({
  870. serviceName: 'HDFS',
  871. configs: [
  872. {category: 'NameNode'},
  873. {category: 'NameNode'}
  874. ]
  875. }),
  876. Em.Object.create({serviceName: 's2'})]
  877. );
  878. installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
  879. installerStep7Controller.setStepConfigs([], []);
  880. expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 'HDFS').get('configs').length).to.equal(2);
  881. });
  882. it('windows stack', function () {
  883. this.stub.withArgs('isHadoopWindowsStack').returns(true);
  884. this.stub.withArgs('isHaEnabled').returns(false);
  885. serviceConfigs = Em.A([
  886. Em.Object.create({
  887. serviceName: 'HDFS',
  888. configs: [
  889. {category: 'NameNode'},
  890. {category: 'NameNode'}
  891. ]
  892. }),
  893. Em.Object.create({serviceName: 's2'})]
  894. );
  895. installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
  896. installerStep7Controller.set('installedServiceNames',['HDFS', 's2', 's3']);
  897. installerStep7Controller.setStepConfigs([], []);
  898. expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 'HDFS').get('configs').length).to.equal(2);
  899. });
  900. });
  901. describe('#checkHostOverrideInstaller', function () {
  902. beforeEach(function () {
  903. sinon.stub(installerStep7Controller, 'loadConfigGroups', Em.K);
  904. sinon.stub(installerStep7Controller, 'loadInstalledServicesConfigGroups', Em.K);
  905. sinon.stub(App, 'get', function (k) {
  906. if (k === 'supports.hostOverridesInstaller') return false;
  907. return Em.get(App, k);
  908. });
  909. });
  910. afterEach(function () {
  911. installerStep7Controller.loadConfigGroups.restore();
  912. installerStep7Controller.loadInstalledServicesConfigGroups.restore();
  913. App.get.restore();
  914. });
  915. Em.A([
  916. {
  917. installedServiceNames: [],
  918. m: 'installedServiceNames is empty',
  919. e: {
  920. loadConfigGroups: true,
  921. loadInstalledServicesConfigGroups: false
  922. }
  923. },
  924. {
  925. installedServiceNames: ['s1', 's2', 's3'],
  926. areInstalledConfigGroupsLoaded: false,
  927. m: 'installedServiceNames isn\'t empty, config groups not yet loaded',
  928. e: {
  929. loadConfigGroups: true,
  930. loadInstalledServicesConfigGroups: true
  931. }
  932. },
  933. {
  934. installedServiceNames: ['s1', 's2', 's3'],
  935. areInstalledConfigGroupsLoaded: true,
  936. m: 'installedServiceNames isn\'t empty, config groups already loaded',
  937. e: {
  938. loadConfigGroups: true,
  939. loadInstalledServicesConfigGroups: false
  940. }
  941. }
  942. ]).forEach(function (test) {
  943. describe(test.m, function () {
  944. beforeEach(function () {
  945. installerStep7Controller.reopen({
  946. installedServiceNames: test.installedServiceNames,
  947. wizardController: {
  948. areInstalledConfigGroupsLoaded: test.areInstalledConfigGroupsLoaded
  949. }
  950. });
  951. installerStep7Controller.checkHostOverrideInstaller();
  952. });
  953. if (test.e.loadConfigGroups) {
  954. it('loadConfigGroups is called once', function () {
  955. expect(installerStep7Controller.loadConfigGroups.calledOnce).to.equal(true);
  956. });
  957. }
  958. else {
  959. it('loadConfigGroups is not called', function () {
  960. expect(installerStep7Controller.loadConfigGroups.called).to.equal(false);
  961. });
  962. }
  963. if (test.e.loadInstalledServicesConfigGroups) {
  964. it('loadInstalledServicesConfigGroups is called once', function () {
  965. expect(installerStep7Controller.loadInstalledServicesConfigGroups.calledOnce).to.equal(true);
  966. });
  967. }
  968. else {
  969. it('loadInstalledServicesConfigGroups is not called', function () {
  970. expect(installerStep7Controller.loadInstalledServicesConfigGroups.called).to.equal(false);
  971. });
  972. }
  973. });
  974. });
  975. });
  976. describe('#loadStep', function () {
  977. beforeEach(function () {
  978. installerStep7Controller.reopen({
  979. content: {services: []},
  980. wizardController: Em.Object.create({
  981. getDBProperty: function (k) {
  982. return this.get(k);
  983. },
  984. stackConfigsLoaded: true
  985. })
  986. });
  987. sinon.stub(App.config, 'fileConfigsIntoTextarea', Em.K);
  988. sinon.stub(installerStep7Controller, 'clearStep', Em.K);
  989. sinon.stub(installerStep7Controller, 'getConfigTags', Em.K);
  990. sinon.stub(installerStep7Controller, 'setInstalledServiceConfigs', Em.K);
  991. sinon.stub(installerStep7Controller, 'checkHostOverrideInstaller', Em.K);
  992. sinon.stub(installerStep7Controller, 'selectProperService', Em.K);
  993. sinon.stub(installerStep7Controller, 'applyServicesConfigs', Em.K);
  994. sinon.stub(App.router, 'send', Em.K);
  995. });
  996. afterEach(function () {
  997. App.config.fileConfigsIntoTextarea.restore();
  998. installerStep7Controller.clearStep.restore();
  999. installerStep7Controller.getConfigTags.restore();
  1000. installerStep7Controller.setInstalledServiceConfigs.restore();
  1001. installerStep7Controller.checkHostOverrideInstaller.restore();
  1002. installerStep7Controller.selectProperService.restore();
  1003. installerStep7Controller.applyServicesConfigs.restore();
  1004. App.router.send.restore();
  1005. });
  1006. it('should call clearStep', function () {
  1007. installerStep7Controller.loadStep();
  1008. expect(installerStep7Controller.clearStep.calledOnce).to.equal(true);
  1009. });
  1010. it('shouldn\'t do nothing if isAdvancedConfigLoaded is false', function () {
  1011. installerStep7Controller.set('wizardController.stackConfigsLoaded', false);
  1012. installerStep7Controller.loadStep();
  1013. expect(installerStep7Controller.clearStep.called).to.equal(false);
  1014. });
  1015. it('should call setInstalledServiceConfigs for addServiceController', function () {
  1016. installerStep7Controller.set('wizardController.name', 'addServiceController');
  1017. installerStep7Controller.loadStep();
  1018. expect(installerStep7Controller.setInstalledServiceConfigs.calledOnce).to.equal(true);
  1019. });
  1020. });
  1021. describe('#applyServicesConfigs', function() {
  1022. beforeEach(function() {
  1023. installerStep7Controller.reopen({
  1024. allSelectedServiceNames: []
  1025. });
  1026. sinon.stub(App.config, 'fileConfigsIntoTextarea', function(configs) {
  1027. return configs;
  1028. });
  1029. sinon.stub(installerStep7Controller, 'loadConfigRecommendations', function(c, callback) {
  1030. return callback();
  1031. });
  1032. sinon.stub(installerStep7Controller, 'checkHostOverrideInstaller', Em.K);
  1033. sinon.stub(installerStep7Controller, 'selectProperService', Em.K);
  1034. sinon.stub(App.router, 'send', Em.K);
  1035. sinon.stub(App.StackService, 'find', function () {
  1036. return {
  1037. findProperty: function () {
  1038. return Em.Object.create({
  1039. isInstalled: true,
  1040. isSelected: false
  1041. });
  1042. },
  1043. filterProperty: function () {
  1044. return [];
  1045. }
  1046. }
  1047. });
  1048. installerStep7Controller.applyServicesConfigs([{name: 'configs'}]);
  1049. });
  1050. afterEach(function () {
  1051. App.config.fileConfigsIntoTextarea.restore();
  1052. installerStep7Controller.loadConfigRecommendations.restore();
  1053. installerStep7Controller.checkHostOverrideInstaller.restore();
  1054. installerStep7Controller.selectProperService.restore();
  1055. App.router.send.restore();
  1056. App.StackService.find.restore();
  1057. });
  1058. it('loadConfigRecommendations is called once' , function () {
  1059. expect(installerStep7Controller.loadConfigRecommendations.calledOnce).to.equal(true);
  1060. });
  1061. it('isRecommendedLoaded is true' , function () {
  1062. expect(installerStep7Controller.get('isRecommendedLoaded')).to.equal(true);
  1063. });
  1064. it('checkHostOverrideInstalleris called once' , function () {
  1065. expect(installerStep7Controller.checkHostOverrideInstaller.calledOnce).to.equal(true);
  1066. });
  1067. it('selectProperServiceis called once' , function () {
  1068. expect(installerStep7Controller.selectProperService.calledOnce).to.equal(true);
  1069. });
  1070. Em.A([
  1071. {
  1072. allSelectedServiceNames: ['YARN'],
  1073. fileConfigsIntoTextarea: true,
  1074. m: 'should run fileConfigsIntoTextarea'
  1075. }
  1076. ]).forEach(function(t) {
  1077. it(t.m, function () {
  1078. installerStep7Controller.reopen({
  1079. allSelectedServiceNames: t.allSelectedServiceNames
  1080. });
  1081. installerStep7Controller.applyServicesConfigs([{name: 'configs'}]);
  1082. if (t.fileConfigsIntoTextarea) {
  1083. expect(App.config.fileConfigsIntoTextarea.calledWith([{name: 'configs'}], 'capacity-scheduler.xml')).to.equal(true);
  1084. } else {
  1085. expect(App.config.fileConfigsIntoTextarea.calledOnce).to.equal(false);
  1086. }
  1087. });
  1088. });
  1089. });
  1090. describe('#_updateIsEditableFlagForConfig', function () {
  1091. Em.A([
  1092. {
  1093. isAdmin: false,
  1094. isReconfigurable: false,
  1095. isHostsConfigsPage: true,
  1096. defaultGroupSelected: false,
  1097. m: 'false for non-admin users',
  1098. e: false
  1099. },
  1100. {
  1101. isAdmin: true,
  1102. isReconfigurable: false,
  1103. isHostsConfigsPage: true,
  1104. defaultGroupSelected: false,
  1105. m: 'false if defaultGroupSelected is false and isHostsConfigsPage is true',
  1106. e: false
  1107. },
  1108. {
  1109. isAdmin: true,
  1110. isReconfigurable: false,
  1111. isHostsConfigsPage: true,
  1112. defaultGroupSelected: true,
  1113. m: 'false if defaultGroupSelected is true and isHostsConfigsPage is true',
  1114. e: false
  1115. },
  1116. {
  1117. isAdmin: true,
  1118. isReconfigurable: false,
  1119. isHostsConfigsPage: false,
  1120. defaultGroupSelected: false,
  1121. m: 'false if defaultGroupSelected is false and isHostsConfigsPage is false',
  1122. e: false
  1123. }
  1124. ]).forEach(function (test) {
  1125. it(test.m, function () {
  1126. installerStep7Controller.reopen({isHostsConfigsPage: test.isHostsConfigsPage});
  1127. var serviceConfigProperty = Em.Object.create({
  1128. isReconfigurable: test.isReconfigurable
  1129. });
  1130. installerStep7Controller._updateIsEditableFlagForConfig(serviceConfigProperty, test.defaultGroupSelected);
  1131. expect(serviceConfigProperty.get('isEditable')).to.equal(test.e);
  1132. });
  1133. });
  1134. });
  1135. describe('#_updateOverridesForConfig', function () {
  1136. it('should set empty array', function () {
  1137. var serviceConfigProperty = Em.Object.create({
  1138. overrides: null
  1139. }), component = Em.Object.create();
  1140. installerStep7Controller._updateOverridesForConfig(serviceConfigProperty, component);
  1141. expect(serviceConfigProperty.get('overrides')).to.eql(Em.A([]));
  1142. });
  1143. describe('host overrides not supported', function () {
  1144. var serviceConfigProperty = Em.Object.create({
  1145. overrides: [
  1146. {value: 'new value'}
  1147. ]
  1148. });
  1149. var component = Em.Object.create({selectedConfigGroup: {isDefault: false}});
  1150. beforeEach(function () {
  1151. installerStep7Controller._updateOverridesForConfig(serviceConfigProperty, component);
  1152. });
  1153. it('there is 1 override', function () {
  1154. expect(serviceConfigProperty.get('overrides').length).to.equal(1);
  1155. });
  1156. it('override value is valid', function () {
  1157. expect(serviceConfigProperty.get('overrides.firstObject.value')).to.equal('new value');
  1158. });
  1159. it('override is not original SCP', function () {
  1160. expect(serviceConfigProperty.get('overrides.firstObject.isOriginalSCP')).to.equal(false);
  1161. });
  1162. it('override is linked to parent', function () {
  1163. expect(serviceConfigProperty.get('overrides.firstObject.parentSCP')).to.eql(serviceConfigProperty);
  1164. });
  1165. });
  1166. describe('host overrides supported', function () {
  1167. var serviceConfigProperty;
  1168. var component;
  1169. beforeEach(function () {
  1170. sinon.stub(App, 'get', function (k) {
  1171. if (k === 'supports.hostOverrides') return true;
  1172. return Em.get(App, k);
  1173. });
  1174. serviceConfigProperty = Em.Object.create({
  1175. overrides: [
  1176. {value: 'new value', group: Em.Object.create({name: 'n1'})}
  1177. ]
  1178. });
  1179. component = Em.Object.create({
  1180. selectedConfigGroup: {isDefault: true},
  1181. configGroups: Em.A([
  1182. Em.Object.create({name: 'n1', properties: []})
  1183. ])
  1184. });
  1185. installerStep7Controller._updateOverridesForConfig(serviceConfigProperty, component);
  1186. });
  1187. afterEach(function () {
  1188. App.get.restore();
  1189. });
  1190. it('there is 1 override', function () {
  1191. expect(serviceConfigProperty.get('overrides').length).to.equal(1);
  1192. });
  1193. it('override.value is valid', function () {
  1194. expect(serviceConfigProperty.get('overrides.firstObject.value')).to.equal('new value');
  1195. });
  1196. it('override is not original SCP', function () {
  1197. expect(serviceConfigProperty.get('overrides.firstObject.isOriginalSCP')).to.equal(false);
  1198. });
  1199. it('override.parentSCP is valid', function () {
  1200. expect(serviceConfigProperty.get('overrides.firstObject.parentSCP')).to.eql(serviceConfigProperty);
  1201. });
  1202. it('there is 1 property in the config group', function () {
  1203. expect(component.get('configGroups.firstObject.properties').length).to.equal(1);
  1204. });
  1205. it('property in the config group is not editable', function () {
  1206. expect(component.get('configGroups.firstObject.properties.firstObject.isEditable')).to.equal(false);
  1207. });
  1208. it('property in the config group is linked to it', function () {
  1209. expect(component.get('configGroups.firstObject.properties.firstObject.group')).to.be.object;
  1210. });
  1211. });
  1212. });
  1213. describe('#setInstalledServiceConfigs', function () {
  1214. var controller = App.WizardStep7Controller.create({
  1215. installedServiceNames: ['HBASE', 'AMBARI_METRICS']
  1216. }),
  1217. configs = [
  1218. {
  1219. name: 'hbase.client.scanner.caching',
  1220. value: '1000',
  1221. serviceName: 'HBASE',
  1222. filename: 'hbase-site.xml'
  1223. },
  1224. {
  1225. name: 'hbase.client.scanner.caching',
  1226. value: '2000',
  1227. serviceName: 'AMBARI_METRICS',
  1228. filename: 'ams-hbase-site.xml'
  1229. }
  1230. ],
  1231. configsByTags = [
  1232. {
  1233. type: 'hbase-site',
  1234. tag: 'version2',
  1235. properties: {
  1236. 'hbase.client.scanner.caching': '1500'
  1237. }
  1238. },
  1239. {
  1240. type: 'ams-hbase-site',
  1241. tag: 'version2',
  1242. properties: {
  1243. 'hbase.client.scanner.caching': '2500'
  1244. }
  1245. },
  1246. {
  1247. type: 'site-without-properties',
  1248. tag: 'version1'
  1249. }
  1250. ],
  1251. installedServiceNames = ['HBASE', 'AMBARI_METRICS'];
  1252. describe('should handle properties with the same name', function () {
  1253. var properties;
  1254. beforeEach(function () {
  1255. controller.setInstalledServiceConfigs(configs, configsByTags, installedServiceNames);
  1256. properties = configs.filterProperty('name', 'hbase.client.scanner.caching');
  1257. });
  1258. it('there are 2 properties', function () {
  1259. expect(properties).to.have.length(2);
  1260. });
  1261. it('hbase-site/ value is valid', function () {
  1262. expect(properties.findProperty('filename', 'hbase-site.xml').value).to.equal('1500');
  1263. });
  1264. it('hbase-site/ savedValue is valid', function () {
  1265. expect(properties.findProperty('filename', 'hbase-site.xml').savedValue).to.equal('1500');
  1266. });
  1267. it('ams-hbase-site/ value is valid', function () {
  1268. expect(properties.findProperty('filename', 'ams-hbase-site.xml').value).to.equal('2500');
  1269. });
  1270. it('ams-hbase-site/ savedValue is valid', function () {
  1271. expect(properties.findProperty('filename', 'ams-hbase-site.xml').savedValue).to.equal('2500');
  1272. });
  1273. });
  1274. });
  1275. describe('#getAmbariDatabaseSuccess', function () {
  1276. var controller = App.WizardStep7Controller.create({
  1277. stepConfigs: [
  1278. {
  1279. serviceName: 'HIVE',
  1280. configs: [
  1281. {
  1282. name: 'hive_hostname',
  1283. value: 'h0'
  1284. }
  1285. ]
  1286. }
  1287. ]
  1288. }),
  1289. cases = [
  1290. {
  1291. data: {
  1292. hostComponents: []
  1293. },
  1294. mySQLServerConflict: false,
  1295. title: 'no Ambari Server host components'
  1296. },
  1297. {
  1298. data: {
  1299. hostComponents: [
  1300. {
  1301. RootServiceHostComponents: {
  1302. properties: {
  1303. 'server.jdbc.url': 'jdbc:mysql://h0/db0?createDatabaseIfNotExist=true'
  1304. }
  1305. }
  1306. }
  1307. ]
  1308. },
  1309. mySQLServerConflict: true,
  1310. title: 'Ambari MySQL Server and Hive Server are on the same host'
  1311. },
  1312. {
  1313. data: {
  1314. hostComponents: [
  1315. {
  1316. RootServiceHostComponents: {
  1317. properties: {
  1318. 'server.jdbc.url': 'jdbc:mysql://h1/db1?createDatabaseIfNotExist=true'
  1319. }
  1320. }
  1321. }
  1322. ]
  1323. },
  1324. mySQLServerConflict: false,
  1325. title: 'Ambari MySQL Server and Hive Server are on different hosts'
  1326. }
  1327. ];
  1328. cases.forEach(function (item) {
  1329. it(item.title, function () {
  1330. controller.getAmbariDatabaseSuccess(item.data);
  1331. expect(controller.get('mySQLServerConflict')).to.equal(item.mySQLServerConflict);
  1332. });
  1333. });
  1334. });
  1335. describe('#showDatabaseConnectionWarningPopup', function () {
  1336. var cases = [
  1337. {
  1338. method: 'onSecondary',
  1339. submitButtonClicked: false,
  1340. isRejected: true,
  1341. title: 'Cancel button clicked'
  1342. },
  1343. {
  1344. method: 'onPrimary',
  1345. submitButtonClicked: true,
  1346. isResolved: true,
  1347. title: 'Proceed Anyway button clicked'
  1348. }
  1349. ],
  1350. dfd,
  1351. testObject,
  1352. serviceNames = ['HIVE', 'OOZIE'],
  1353. bodyMessage = 'HIVE, OOZIE';
  1354. beforeEach(function () {
  1355. installerStep7Controller.set('submitButtonClicked', true);
  1356. dfd = $.Deferred(function (d) {
  1357. d.done(function () {
  1358. testObject.isResolved = true;
  1359. });
  1360. d.fail(function () {
  1361. testObject.isRejected = true;
  1362. })
  1363. });
  1364. testObject = {};
  1365. });
  1366. cases.forEach(function (item) {
  1367. describe(item.title, function () {
  1368. var popup;
  1369. beforeEach(function () {
  1370. popup = installerStep7Controller.showDatabaseConnectionWarningPopup(serviceNames, dfd);
  1371. });
  1372. it('popup body is valid', function () {
  1373. expect(popup.get('body')).to.equal(Em.I18n.t('installer.step7.popup.database.connection.body').format(bodyMessage));
  1374. });
  1375. it('after ' + item.method + ' execution', function () {
  1376. popup[item.method]();
  1377. expect(testObject.isResolved).to.equal(item.isResolved);
  1378. expect(testObject.isRejected).to.equal(item.isRejected);
  1379. expect(installerStep7Controller.get('submitButtonClicked')).to.equal(item.submitButtonClicked);
  1380. });
  1381. });
  1382. });
  1383. });
  1384. describe('#issuesFilterText', function () {
  1385. issuesFilterCases.forEach(function (item) {
  1386. it(item.title, function () {
  1387. issuesFilterTestSetup(installerStep7Controller, item);
  1388. expect(installerStep7Controller.get('issuesFilterText')).to.equal(item.issuesFilterText);
  1389. })
  1390. });
  1391. });
  1392. describe.skip('#loadServiceTagsSuccess', function () {
  1393. it('should create ClusterSiteToTagMap', function () {
  1394. var params = Em.Object.create({
  1395. serviceName: "OOZIE",
  1396. serviceConfigsDef: Em.Object.create({
  1397. configTypes: Em.Object.create({
  1398. site3: true,
  1399. site2: true,
  1400. site1: true
  1401. })
  1402. })
  1403. });
  1404. var wizardController = Em.Object.create({
  1405. allHosts: [
  1406. {hostName: 'h1'},
  1407. {hostName: 'h2'},
  1408. {hostName: 'h3'}
  1409. ]
  1410. });
  1411. installerStep7Controller.set('wizardController', wizardController);
  1412. installerStep7Controller.set('stepConfigs', Em.A([Em.Object.create({serviceName: 'OOZIE', configs: Em.A([]) })]));
  1413. var desired_configs = {
  1414. site1: {
  1415. tag: "tag1"
  1416. },
  1417. site2: {
  1418. tag: "tag2"
  1419. },
  1420. site3: {
  1421. tag: "tag3"
  1422. }
  1423. };
  1424. var data = {
  1425. config_groups: Em.A([Em.Object.create({
  1426. ConfigGroup: Em.Object.create({
  1427. tag: 'OOZIE',
  1428. hosts: Em.A([Em.Object.create({host_name: 'h1'})]),
  1429. id: 1,
  1430. group_name: "",
  1431. description: "",
  1432. desired_configs: Em.A([Em.Object.create({
  1433. type: '1',
  1434. tag: 'h1'
  1435. })])
  1436. })
  1437. })]),
  1438. Clusters: {
  1439. desired_configs: desired_configs
  1440. }
  1441. };
  1442. installerStep7Controller.loadServiceTagsSuccess(data, {}, params);
  1443. var result = installerStep7Controller.get("loadedClusterSiteToTagMap");
  1444. expect(JSON.parse(JSON.stringify(result))).to.eql(JSON.parse(JSON.stringify({"site1":"tag1","site2":"tag2","site3":"tag3"})));
  1445. })
  1446. });
  1447. describe('#issuesFilterLinkText', function () {
  1448. issuesFilterCases.forEach(function (item) {
  1449. it(item.title, function () {
  1450. issuesFilterTestSetup(installerStep7Controller, item);
  1451. expect(installerStep7Controller.get('issuesFilterLinkText')).to.equal(item.issuesFilterLinkText);
  1452. })
  1453. });
  1454. });
  1455. describe('#toggleIssuesFilter', function () {
  1456. it('should toggle issues filter', function () {
  1457. var issuesFilter = installerStep7Controller.get('filterColumns').findProperty('attributeName', 'hasIssues');
  1458. issuesFilter.set('selected', false);
  1459. installerStep7Controller.toggleIssuesFilter();
  1460. expect(issuesFilter.get('selected')).to.be.true;
  1461. installerStep7Controller.toggleIssuesFilter();
  1462. expect(issuesFilter.get('selected')).to.be.false;
  1463. });
  1464. it('selected service should be changed', function () {
  1465. installerStep7Controller.setProperties({
  1466. selectedService: {
  1467. errorCount: 0,
  1468. configGroups: []
  1469. },
  1470. stepConfigs: [
  1471. {
  1472. errorCount: 1,
  1473. configGroups: []
  1474. },
  1475. {
  1476. errorCount: 2,
  1477. configGroups: []
  1478. }
  1479. ]
  1480. });
  1481. installerStep7Controller.toggleIssuesFilter();
  1482. expect(installerStep7Controller.get('selectedService')).to.eql({
  1483. errorCount: 1,
  1484. configGroups: []
  1485. });
  1486. });
  1487. });
  1488. describe('#addKerberosDescriptorConfigs', function() {
  1489. var configs = [
  1490. { name: 'prop1', displayName: 'Prop1' },
  1491. { name: 'prop2', displayName: 'Prop2' },
  1492. { name: 'prop3', displayName: 'Prop3' }
  1493. ];
  1494. var descriptor = [
  1495. Em.Object.create({ name: 'prop4', filename: 'file-1'}),
  1496. Em.Object.create({ name: 'prop1', filename: 'file-1'})
  1497. ];
  1498. var propertiesAttrTests = [
  1499. {
  1500. attr: 'isUserProperty', val: false,
  1501. m: 'descriptor properties should not be marked as custom'
  1502. },
  1503. {
  1504. attr: 'category', val: 'Advanced file-1',
  1505. m: 'descriptor properties should be added to Advanced category'
  1506. },
  1507. {
  1508. attr: 'isOverridable', val: false,
  1509. m: 'descriptor properties should not be overriden'
  1510. }
  1511. ];
  1512. propertiesAttrTests.forEach(function(test) {
  1513. it(test.m, function() {
  1514. installerStep7Controller.addKerberosDescriptorConfigs(configs, descriptor);
  1515. expect(configs.findProperty('name', 'prop1')[test.attr]).to.be.eql(test.val);
  1516. });
  1517. });
  1518. });
  1519. describe('#addHawqConfigsOnNnHa', function () {
  1520. var configs = [
  1521. {
  1522. id: 'dfs.nameservices__hdfs-site',
  1523. description: 'dfs.nameservices__hdfs-site',
  1524. displayName: 'dfs.nameservices',
  1525. displayType: 'string',
  1526. name: 'dfs.nameservices',
  1527. value: 'haservice',
  1528. recommendedValue: 'haservice'
  1529. },
  1530. {
  1531. id: 'dfs.ha.namenodes.haservice__hdfs-site',
  1532. description: 'dfs.ha.namenodes.haservice__hdfs-site',
  1533. displayName: 'dfs.ha.namenodes.haservice',
  1534. displayType: 'string',
  1535. name: 'dfs.ha.namenodes.haservice',
  1536. value: 'nn1,nn2',
  1537. recommendedValue: 'nn1,nn2'
  1538. },
  1539. {
  1540. id: 'dfs.namenode.rpc-address.haservice.nn1__hdfs-site',
  1541. description: 'dfs.namenode.rpc-address.haservice.nn1__hdfs-site',
  1542. displayName: 'dfs.namenode.rpc-address.haservice.nn1',
  1543. displayType: 'string',
  1544. name: 'dfs.namenode.rpc-address.haservice.nn1',
  1545. value: 'c6401.ambari.apache.org:8020',
  1546. recommendedValue: 'c6401.ambari.apache.org:8020'
  1547. },
  1548. {
  1549. id: 'dfs.namenode.rpc-address.haservice.nn2__hdfs-site',
  1550. description: 'dfs.namenode.rpc-address.haservice.nn2__hdfs-site',
  1551. displayName: 'dfs.namenode.rpc-address.haservice.nn2',
  1552. displayType: 'string',
  1553. name: 'dfs.namenode.rpc-address.haservice.nn2',
  1554. value: 'c6402.ambari.apache.org:8020',
  1555. recommendedValue: 'c6402.ambari.apache.org:8020'
  1556. },
  1557. {
  1558. id: 'dfs.namenode.http-address.haservice.nn1__hdfs-site',
  1559. description: 'dfs.namenode.http-address.haservice.nn1__hdfs-site',
  1560. displayName: 'dfs.namenode.http-address.haservice.nn1',
  1561. displayType: 'string',
  1562. name: 'dfs.namenode.http-address.haservice.nn1',
  1563. value: 'c6401.ambari.apache.org:50070',
  1564. recommendedValue: 'c6401.ambari.apache.org:50070'
  1565. },
  1566. {
  1567. id: 'dfs.namenode.http-address.haservice.nn2__hdfs-site',
  1568. description: 'dfs.namenode.http-address.haservice.nn2__hdfs-site',
  1569. displayName: 'dfs.namenode.http-address.haservice.nn2',
  1570. displayType: 'string',
  1571. name: 'dfs.namenode.http-address.haservice.nn2',
  1572. value: 'c6402.ambari.apache.org:50070',
  1573. recommendedValue: 'c6402.ambari.apache.org:50070'
  1574. }
  1575. ];
  1576. it('should copy properties from hdfs-site to hdfs-client for HAWQ', function() {
  1577. var oldConfigs = configs.slice();
  1578. installerStep7Controller.addHawqConfigsOnNnHa(configs);
  1579. oldConfigs.forEach(function(property){
  1580. // find the same property in hdfs-client for HAWQ and see if attribute value matches with the corresponding property's attribute value in hdfs-site
  1581. expect(configs.findProperty('id', property.name + '__hdfs-client').description).to.be.eql(property.description);
  1582. expect(configs.findProperty('id', property.name + '__hdfs-client').displayName).to.be.eql(property.displayName);
  1583. expect(configs.findProperty('id', property.name + '__hdfs-client').value).to.be.eql(property.value);
  1584. expect(configs.findProperty('id', property.name + '__hdfs-client').recommendedValue).to.be.eql(property.recommendedValue);
  1585. });
  1586. });
  1587. });
  1588. describe('#addHawqConfigsOnRMHa', function () {
  1589. var configs = [
  1590. {
  1591. id: 'yarn.resourcemanager.hostname.rm1__yarn-site',
  1592. name: 'yarn.resourcemanager.hostname.rm1',
  1593. value: 'c6401.ambari.apache.org',
  1594. recommendedValue: 'c6401.ambari.apache.org'
  1595. },
  1596. {
  1597. id: 'yarn.resourcemanager.hostname.rm2__yarn-site',
  1598. name: 'yarn.resourcemanager.hostname.rm2',
  1599. value: 'c6402.ambari.apache.org',
  1600. recommendedValue: 'c6402.ambari.apache.org'
  1601. }
  1602. ];
  1603. it('should update properties in yarn-client for HAWQ if yarn ha is enabled', function() {
  1604. var inputConfigsCount = configs.length;
  1605. installerStep7Controller.addHawqConfigsOnRMHa(configs);
  1606. var yarnRmDetails = configs.findProperty('id', 'yarn.resourcemanager.ha__yarn-client');
  1607. var yarnRmSchedulerDetails = configs.findProperty('id', 'yarn.resourcemanager.scheduler.ha__yarn-client');
  1608. var expectedYarnRmHaValue = 'c6401.ambari.apache.org:8032,c6402.ambari.apache.org:8032';
  1609. expect(yarnRmDetails.value).to.be.eql(expectedYarnRmHaValue);
  1610. expect(yarnRmDetails.recommendedValue).to.be.eql(expectedYarnRmHaValue);
  1611. expect(yarnRmDetails.displayName).to.be.eql('yarn.resourcemanager.ha');
  1612. expect(yarnRmDetails.description).to.be.eql('Comma separated yarn resourcemanager host addresses with port');
  1613. var expectedYarnRmSchedulerValue = 'c6401.ambari.apache.org:8030,c6402.ambari.apache.org:8030';
  1614. expect(yarnRmSchedulerDetails.value).to.be.eql(expectedYarnRmSchedulerValue);
  1615. expect(yarnRmSchedulerDetails.recommendedValue).to.be.eql(expectedYarnRmSchedulerValue);
  1616. expect(yarnRmSchedulerDetails.displayName).to.be.eql('yarn.resourcemanager.scheduler.ha');
  1617. expect(yarnRmSchedulerDetails.description).to.be.eql('Comma separated yarn resourcemanager scheduler addresses with port');
  1618. var noOfConfigsAdded = 2;
  1619. expect(configs.length).to.be.eql(inputConfigsCount + noOfConfigsAdded) ;
  1620. });
  1621. });
  1622. describe('#errorsCount', function () {
  1623. it('should ignore configs with widgets (enhanced configs)', function () {
  1624. installerStep7Controller.reopen({selectedService: Em.Object.create({
  1625. configsWithErrors: Em.A([
  1626. Em.Object.create({widget: {}}),
  1627. Em.Object.create({widget: null})
  1628. ])
  1629. })
  1630. });
  1631. expect(installerStep7Controller.get('errorsCount')).to.equal(1);
  1632. });
  1633. });
  1634. describe('#_reconfigureServicesOnNnHa', function () {
  1635. var dfsNameservices = 'some_cluster';
  1636. Em.A([
  1637. {
  1638. serviceName: 'HBASE',
  1639. configToUpdate: 'hbase.rootdir',
  1640. oldValue: 'hdfs://nameserv:8020/apps/hbase/data',
  1641. expectedNewValue: 'hdfs://' + dfsNameservices + '/apps/hbase/data'
  1642. },
  1643. {
  1644. serviceName: 'ACCUMULO',
  1645. configToUpdate: 'instance.volumes',
  1646. oldValue: 'hdfs://localhost:8020/apps/accumulo/data',
  1647. expectedNewValue: 'hdfs://' + dfsNameservices + '/apps/accumulo/data'
  1648. },
  1649. {
  1650. serviceName: 'HAWQ',
  1651. configToUpdate: 'hawq_dfs_url',
  1652. oldValue: 'localhost:8020/hawq_data',
  1653. expectedNewValue: dfsNameservices + '/hawq_data'
  1654. }
  1655. ]).forEach(function (test) {
  1656. var serviceConfigs = [App.ServiceConfig.create({
  1657. serviceName: test.serviceName,
  1658. configs: [
  1659. Em.Object.create({
  1660. name: test.configToUpdate,
  1661. value: test.oldValue
  1662. })
  1663. ]
  1664. }),
  1665. App.ServiceConfig.create({
  1666. serviceName: 'HDFS',
  1667. configs: [
  1668. Em.Object.create({
  1669. name: 'dfs.nameservices',
  1670. value: dfsNameservices
  1671. })
  1672. ]
  1673. })];
  1674. it(test.serviceName + ' ' + test.configToUpdate, function () {
  1675. installerStep7Controller.reopen({
  1676. selectedServiceNames: [test.serviceName, 'HDFS']
  1677. });
  1678. serviceConfigs = installerStep7Controller._reconfigureServicesOnNnHa(serviceConfigs);
  1679. expect(serviceConfigs.findProperty('serviceName', test.serviceName).configs.findProperty('name', test.configToUpdate).get('value')).to.equal(test.expectedNewValue);
  1680. });
  1681. });
  1682. });
  1683. describe('#showOozieDerbyWarning', function() {
  1684. var controller;
  1685. beforeEach(function() {
  1686. controller = App.WizardStep7Controller.create({});
  1687. sinon.stub(App.ModalPopup, 'show', Em.K);
  1688. });
  1689. afterEach(function() {
  1690. App.ModalPopup.show.restore();
  1691. });
  1692. Em.A([
  1693. {
  1694. selectedServiceNames: ['HDFS', 'OOZIE'],
  1695. databaseType: Em.I18n.t('installer.step7.oozie.database.new'),
  1696. e: true,
  1697. m: 'Oozie selected with derby database, warning popup should be shown'
  1698. },
  1699. {
  1700. selectedServiceNames: ['HDFS'],
  1701. databaseType: Em.I18n.t('installer.step7.oozie.database.new'),
  1702. e: false,
  1703. m: 'Oozie not selected warning popup should be skipped'
  1704. },
  1705. {
  1706. selectedServiceNames: ['HDFS', 'OOZIE'],
  1707. databaseType: 'New Mysql Database',
  1708. e: false,
  1709. m: 'Oozie selected, mysql database used, warning popup should be sk'
  1710. }
  1711. ]).forEach(function(test) {
  1712. describe(test.m, function() {
  1713. beforeEach(function () {
  1714. sinon.stub(App.config, 'findConfigProperty').returns(Em.Object.create({ value: test.databaseType}));
  1715. controller.reopen({
  1716. selectedServiceNames: test.selectedServiceNames
  1717. });
  1718. controller.showOozieDerbyWarningPopup(Em.K);
  1719. });
  1720. afterEach(function () {
  1721. App.config.findConfigProperty.restore();
  1722. });
  1723. it('modal popup is shown needed number of times', function () {
  1724. expect(App.ModalPopup.show.calledOnce).to.equal(test.e);
  1725. });
  1726. });
  1727. });
  1728. });
  1729. describe('#addHostNamesToConfigs', function() {
  1730. beforeEach(function () {
  1731. sinon.stub(App.StackServiceComponent, 'find', function () {
  1732. return Em.Object.create({
  1733. id: 'NAMENODE',
  1734. displayName: 'NameNode'
  1735. });
  1736. });
  1737. });
  1738. afterEach(function () {
  1739. App.StackServiceComponent.find.restore();
  1740. });
  1741. it('should not create duplicate configs', function () {
  1742. var serviceConfig = Em.Object.create({
  1743. configs: [],
  1744. serviceName: 'HDFS',
  1745. configCategories: [
  1746. {
  1747. showHost: true,
  1748. name: 'NAMENODE'
  1749. }
  1750. ]
  1751. });
  1752. var masterComponents = [
  1753. {component: 'NAMENODE', hostName: 'h1'}
  1754. ];
  1755. var slaveComponents = [];
  1756. installerStep7Controller.addHostNamesToConfigs(serviceConfig, masterComponents, slaveComponents);
  1757. expect(serviceConfig.get('configs').filterProperty('name', 'namenode_host').length).to.equal(1);
  1758. installerStep7Controller.addHostNamesToConfigs(serviceConfig, masterComponents, slaveComponents);
  1759. expect(serviceConfig.get('configs').filterProperty('name', 'namenode_host').length).to.equal(1);
  1760. });
  1761. });
  1762. describe('#resolveHiveMysqlDatabase', function () {
  1763. beforeEach(function () {
  1764. installerStep7Controller.get('content').setProperties({
  1765. services: Em.A([
  1766. Em.Object.create({serviceName: 'HIVE', isSelected: true, isInstalled: false})
  1767. ])
  1768. });
  1769. installerStep7Controller.setProperties({
  1770. stepConfigs: Em.A([
  1771. Em.Object.create({serviceName: 'HIVE', configs: [{name: 'hive_database', value: 'New MySQL Database'}]})
  1772. ]),
  1773. mySQLServerConflict: true
  1774. });
  1775. sinon.stub(installerStep7Controller, 'moveNext', Em.K);
  1776. sinon.stub(installerStep7Controller, 'checkMySQLHost', function () {
  1777. return $.Deferred().resolve();
  1778. });
  1779. sinon.spy(App.ModalPopup, 'show');
  1780. });
  1781. afterEach(function () {
  1782. installerStep7Controller.moveNext.restore();
  1783. installerStep7Controller.checkMySQLHost.restore();
  1784. App.ModalPopup.show.restore();
  1785. });
  1786. it('no HIVE service', function () {
  1787. installerStep7Controller.set('content.services', Em.A([]));
  1788. installerStep7Controller.resolveHiveMysqlDatabase();
  1789. expect(installerStep7Controller.moveNext.calledOnce).to.be.true;
  1790. expect(App.ModalPopup.show.called).to.be.false;
  1791. });
  1792. it('if mySQLServerConflict, popup is shown', function () {
  1793. installerStep7Controller.resolveHiveMysqlDatabase();
  1794. expect(installerStep7Controller.moveNext.called).to.be.false;
  1795. expect(App.ModalPopup.show.calledOnce).to.be.true;
  1796. });
  1797. });
  1798. describe('#mySQLWarningHandler', function () {
  1799. beforeEach(function () {
  1800. installerStep7Controller.set('mySQLServerConflict', true);
  1801. sinon.spy(App.ModalPopup, 'show');
  1802. sinon.stub(App.router, 'get').returns({gotoStep: Em.K});
  1803. sinon.stub(App.router.get(), 'gotoStep', Em.K);
  1804. });
  1805. afterEach(function () {
  1806. App.ModalPopup.show.restore();
  1807. App.router.get().gotoStep.restore();
  1808. App.router.get.restore();
  1809. });
  1810. it('warning popup is shown', function () {
  1811. installerStep7Controller.mySQLWarningHandler();
  1812. expect(App.ModalPopup.show.calledOnce).to.be.true;
  1813. });
  1814. it('submitButtonClicked is set to false on primary click', function () {
  1815. installerStep7Controller.mySQLWarningHandler().onPrimary();
  1816. expect(installerStep7Controller.get('submitButtonClicked')).to.be.false;
  1817. });
  1818. it('second popup is shown on secondary click', function () {
  1819. installerStep7Controller.mySQLWarningHandler().onSecondary();
  1820. expect(App.ModalPopup.show.calledTwice).to.be.true;
  1821. });
  1822. it('submitButtonClicked is set to false on secondary click on the second popup', function () {
  1823. installerStep7Controller.mySQLWarningHandler().onSecondary().onSecondary();
  1824. expect(installerStep7Controller.get('submitButtonClicked')).to.be.false;
  1825. });
  1826. it('user is moved to step5 on primary click on the second popup (installerController)', function () {
  1827. installerStep7Controller.set('content.controllerName', 'installerController');
  1828. installerStep7Controller.mySQLWarningHandler().onSecondary().onPrimary();
  1829. expect(App.router.get('installerController').gotoStep.calledWith(5, true)).to.be.true;
  1830. });
  1831. it('user is moved to step2 on primary click on the second popup (addSeviceController)', function () {
  1832. installerStep7Controller.set('content.controllerName', 'addServiceController');
  1833. installerStep7Controller.mySQLWarningHandler().onSecondary().onPrimary();
  1834. expect(App.router.get('addSeviceController').gotoStep.calledWith(2, true)).to.be.true;
  1835. });
  1836. });
  1837. describe('#supportsPreInstallChecks', function () {
  1838. beforeEach(function () {
  1839. this.stub = sinon.stub(App, 'get');
  1840. });
  1841. afterEach(function () {
  1842. this.stub.restore();
  1843. });
  1844. Em.A([
  1845. {preInstallChecks: true, controllerName: 'installerController', e: true},
  1846. {preInstallChecks: true, controllerName: '', e: false},
  1847. {preInstallChecks: false, controllerName: 'installerController', e: false},
  1848. {preInstallChecks: false, controllerName: '', e: false}
  1849. ]).forEach(function (test) {
  1850. it(JSON.stringify(test), function () {
  1851. this.stub.withArgs('supports.preInstallChecks').returns(test.preInstallChecks);
  1852. installerStep7Controller.set('content', {controllerName: test.controllerName});
  1853. installerStep7Controller.propertyDidChange('supportsPreInstallChecks');
  1854. expect(installerStep7Controller.get('supportsPreInstallChecks')).to.be.equal(test.e);
  1855. });
  1856. });
  1857. });
  1858. describe('#getHash', function () {
  1859. var stepConfigs = [
  1860. {
  1861. configs: [
  1862. Em.Object.create({name: 's1c1', isFinal: true, value: 'v11'}),
  1863. Em.Object.create({name: 's1c2', isFinal: false, value: 'v12', overrides: []}),
  1864. Em.Object.create({name: 's1c3', isFinal: true, value: 'v13', overrides: [
  1865. Em.Object.create({value: 'v131'})
  1866. ]})
  1867. ]
  1868. },
  1869. {
  1870. configs: [
  1871. Em.Object.create({name: 's2c1', isFinal: true, value: 'v21'}),
  1872. Em.Object.create({name: 's2c2', isFinal: false, value: 'v22', overrides: []}),
  1873. Em.Object.create({name: 's2c3', isFinal: true, value: 'v23', overrides: [
  1874. Em.Object.create({value: 'v231'})
  1875. ]})
  1876. ]
  1877. }
  1878. ];
  1879. beforeEach(function () {
  1880. installerStep7Controller.set('stepConfigs', stepConfigs);
  1881. this.hash = installerStep7Controller.getHash();
  1882. });
  1883. it('should map value, isFinal and overrides values', function () {
  1884. var expected = JSON.stringify({
  1885. s1c1: {
  1886. value: 'v11',
  1887. overrides: [],
  1888. isFinal: true
  1889. },
  1890. s1c2: {
  1891. value: 'v12',
  1892. overrides: [],
  1893. isFinal: false
  1894. },
  1895. s1c3: {
  1896. value: 'v13',
  1897. overrides: ['v131'],
  1898. isFinal: true
  1899. },
  1900. s2c1: {
  1901. value: 'v21',
  1902. overrides: [],
  1903. isFinal: true
  1904. },
  1905. s2c2: {
  1906. value: 'v22',
  1907. overrides: [],
  1908. isFinal: false
  1909. },
  1910. s2c3: {
  1911. value: 'v23',
  1912. overrides: ['v231'],
  1913. isFinal: true
  1914. }
  1915. });
  1916. expect(this.hash).to.be.equal(expected);
  1917. });
  1918. });
  1919. describe('#loadServiceConfigGroupOverrides', function () {
  1920. var serviceConfigs = [
  1921. {filename: 'f1', name: 'n1'}
  1922. ];
  1923. var configGroups = [
  1924. {
  1925. "name": "Default",
  1926. "description": "desc",
  1927. "isDefault": true,
  1928. "hosts": ['h1', 'h2', 'h3'],
  1929. "parentConfigGroup": null,
  1930. "service": {"id": "YARN"},
  1931. "serviceName": "YARN",
  1932. "configSiteTags": [],
  1933. "clusterHosts": []
  1934. }
  1935. ];
  1936. var loadedGroupToOverrideSiteToTagMap = {
  1937. Default: {
  1938. type1: 'tag1',
  1939. type2: 'tag2',
  1940. type3: 'tag3'
  1941. }
  1942. };
  1943. beforeEach(function () {
  1944. installerStep7Controller.loadServiceConfigGroupOverrides(serviceConfigs, loadedGroupToOverrideSiteToTagMap, configGroups);
  1945. this.args = App.ajax.send.args[0][0].data;
  1946. });
  1947. it('url params are valid', function () {
  1948. expect(this.args.params).to.be.equal('(type=type1&tag=tag1)|(type=type2&tag=tag2)|(type=type3&tag=tag3)');
  1949. });
  1950. it('configKeyToConfigMap is valid', function () {
  1951. var expected = {
  1952. "f1": {
  1953. "n1": {
  1954. "filename": "f1",
  1955. "name": "n1"
  1956. }
  1957. }
  1958. };
  1959. expect(this.args.configKeyToConfigMap).to.be.eql(expected);
  1960. });
  1961. describe('typeTagToGroupMap is valid', function () {
  1962. it('type1///tag1', function () {
  1963. var expected = {
  1964. "name": "Default",
  1965. "description": "desc",
  1966. "isDefault": true,
  1967. "hosts": [
  1968. "h1",
  1969. "h2",
  1970. "h3"
  1971. ],
  1972. "parentConfigGroup": null,
  1973. "service": {
  1974. "id": "YARN"
  1975. },
  1976. "serviceName": "YARN",
  1977. "configSiteTags": [],
  1978. "clusterHosts": []
  1979. };
  1980. expect(this.args.typeTagToGroupMap['type1///tag1']).to.be.eql(expected);
  1981. });
  1982. it('type2///tag2', function () {
  1983. var expected = {
  1984. "name": "Default",
  1985. "description": "desc",
  1986. "isDefault": true,
  1987. "hosts": [
  1988. "h1",
  1989. "h2",
  1990. "h3"
  1991. ],
  1992. "parentConfigGroup": null,
  1993. "service": {
  1994. "id": "YARN"
  1995. },
  1996. "serviceName": "YARN",
  1997. "configSiteTags": [],
  1998. "clusterHosts": []
  1999. };
  2000. expect(this.args.typeTagToGroupMap['type2///tag2']).to.be.eql(expected);
  2001. });
  2002. it('type3///tag3', function () {
  2003. var expected = {
  2004. "name": "Default",
  2005. "description": "desc",
  2006. "isDefault": true,
  2007. "hosts": [
  2008. "h1",
  2009. "h2",
  2010. "h3"
  2011. ],
  2012. "parentConfigGroup": null,
  2013. "service": {
  2014. "id": "YARN"
  2015. },
  2016. "serviceName": "YARN",
  2017. "configSiteTags": [],
  2018. "clusterHosts": []
  2019. };
  2020. expect(this.args.typeTagToGroupMap['type3///tag3']).to.be.eql(expected);
  2021. });
  2022. });
  2023. it('serviceConfigs is valid', function () {
  2024. var expected = [
  2025. {
  2026. "filename": "f1",
  2027. "name": "n1"
  2028. }
  2029. ];
  2030. expect(this.args.serviceConfigs).to.be.eql(expected);
  2031. });
  2032. });
  2033. describe('#updateHostOverrides', function () {
  2034. var configProperty;
  2035. var storedConfigProperty;
  2036. beforeEach(function () {
  2037. configProperty = Em.Object.create({});
  2038. storedConfigProperty = {
  2039. overrides: [
  2040. {value: 'v1'}
  2041. ]
  2042. };
  2043. installerStep7Controller.updateHostOverrides(configProperty, storedConfigProperty);
  2044. });
  2045. it('override is valid', function () {
  2046. var override = configProperty.get('overrides.0');
  2047. expect(override.get('value')).to.be.equal('v1');
  2048. expect(override.get('isOriginalSCP')).to.be.false;
  2049. expect(override.get('parentSCP')).to.be.eql(configProperty);
  2050. });
  2051. });
  2052. describe('#allowUpdateProperty', function () {
  2053. it('true if it is installer', function () {
  2054. installerStep7Controller.set('wizardController', {name: 'installerController'});
  2055. expect(installerStep7Controller.allowUpdateProperty([], '', '')).to.be.true;
  2056. });
  2057. it('true if it is parentProperties are not empty', function () {
  2058. installerStep7Controller.set('wizardController', {name: 'some'});
  2059. expect(installerStep7Controller.allowUpdateProperty([{}], '', '')).to.be.true;
  2060. });
  2061. describe('#addServiceController', function () {
  2062. var installedServices = [];
  2063. beforeEach(function () {
  2064. installerStep7Controller.set('wizardController', {name: 'addServiceController'});
  2065. this.stub = sinon.stub(App.configsCollection, 'getConfigByName');
  2066. sinon.stub(App.config, 'getServiceByConfigType', function (type) {
  2067. return Em.Object.create({serviceName: type === 't1' ? 's1' : 's2'});
  2068. })
  2069. });
  2070. afterEach(function () {
  2071. App.configsCollection.getConfigByName.restore();
  2072. App.config.getServiceByConfigType.restore();
  2073. });
  2074. it('stackProperty does not exist', function () {
  2075. this.stub.returns(null);
  2076. expect(installerStep7Controller.allowUpdateProperty([], '', '')).to.be.true;
  2077. });
  2078. it('installedServices does not contain stackProperty.serviceName', function () {
  2079. this.stub.returns({serviceName: 's1'});
  2080. installerStep7Controller.set('installedServices', {});
  2081. expect(installerStep7Controller.allowUpdateProperty([], '', '')).to.be.true;
  2082. });
  2083. it('stackProperty.propertyDependsOn is empty', function () {
  2084. installerStep7Controller.reopen({installedServices: {s1: true}});
  2085. this.stub.returns({serviceName: 's1', propertyDependsOn: []});
  2086. expect(installerStep7Controller.allowUpdateProperty([], '', '')).to.be.false;
  2087. });
  2088. it('stackProperty.propertyDependsOn is not empty', function () {
  2089. installerStep7Controller.reopen({installedServices: {s1: true}});
  2090. this.stub.returns({serviceName: 's1', propertyDependsOn: [
  2091. {type: 't1'},
  2092. {type: 't2'}
  2093. ]});
  2094. expect(installerStep7Controller.allowUpdateProperty([], '', '')).to.be.true;
  2095. });
  2096. it('stackProperty.propertyDependsOn is not empty (2)', function () {
  2097. installerStep7Controller.reopen({installedServices: {s1: true}});
  2098. this.stub.returns({serviceName: 's1', propertyDependsOn: [
  2099. {type: 't1'},
  2100. {type: 't1'}
  2101. ]});
  2102. expect(installerStep7Controller.allowUpdateProperty([], '', '')).to.be.false;
  2103. });
  2104. });
  2105. it('true if it is not installer or addService', function () {
  2106. installerStep7Controller.set('wizardController', {name: 'some'});
  2107. expect(installerStep7Controller.allowUpdateProperty([], '', '')).to.be.true;
  2108. });
  2109. });
  2110. describe('#loadServiceConfigGroupOverridesSuccess', function () {
  2111. var data = {
  2112. items: [
  2113. {
  2114. type: 'type1',
  2115. tag: 'tag1',
  2116. properties: {
  2117. p1: 'v1',
  2118. p3: 'v3'
  2119. },
  2120. properties_attributes: {
  2121. final: {
  2122. p1: true,
  2123. p3: true
  2124. }
  2125. }
  2126. },
  2127. {
  2128. type: 'type2',
  2129. tag: 'tag1',
  2130. properties: {
  2131. p2: 'v2',
  2132. p4: 'v4'
  2133. },
  2134. properties_attributes: {}
  2135. }
  2136. ]
  2137. };
  2138. var params;
  2139. beforeEach(function () {
  2140. params = {
  2141. serviceConfigs: [],
  2142. typeTagToGroupMap: {
  2143. 'type1///tag1': Em.Object.create({
  2144. name: 't1t1'
  2145. }),
  2146. 'type2///tag1': Em.Object.create({
  2147. name: 't2t1'
  2148. })
  2149. },
  2150. configKeyToConfigMap: {
  2151. type1: {},
  2152. type2: {
  2153. p4: {}
  2154. }
  2155. }
  2156. };
  2157. sinon.stub(installerStep7Controller, 'onLoadOverrides', Em.K);
  2158. sinon.stub(App.config, 'getOriginalFileName', function (type) {return type;});
  2159. sinon.stub(App.config, 'formatPropertyValue', function (serviceConfigProperty, originalValue) {
  2160. return Em.isNone(originalValue) ? Em.get(serviceConfigProperty, 'value') : originalValue;
  2161. });
  2162. installerStep7Controller.loadServiceConfigGroupOverridesSuccess(data, {}, params);
  2163. this.serviceConfigs = installerStep7Controller.onLoadOverrides.args[0][0];
  2164. });
  2165. afterEach(function () {
  2166. installerStep7Controller.onLoadOverrides.restore();
  2167. App.config.getOriginalFileName.restore();
  2168. App.config.formatPropertyValue.restore();
  2169. });
  2170. it('type2/p4 is mapped to the params.configKeyToConfigMap', function () {
  2171. expect(params).to.have.deep.property('configKeyToConfigMap.type2.p4').that.is.an('object').with.deep.property('overrides');
  2172. });
  2173. it('type2/p4 has 1 override', function () {
  2174. expect(params.configKeyToConfigMap.type2.p4.overrides).to.have.property('length').equal(1);
  2175. });
  2176. it('type2/p4 override is valid', function () {
  2177. var override = params.configKeyToConfigMap.type2.p4.overrides[0];
  2178. expect(override.value).to.be.equal('v4');
  2179. expect(override.group.name).to.be.equal('t2t1');
  2180. expect(override.isFinal).to.be.false;
  2181. });
  2182. it('onLoadOverrides is called for 3 configs', function () {
  2183. expect(this.serviceConfigs).to.have.property('length').equal(3);
  2184. });
  2185. it('serviceConfigs ids are valid', function () {
  2186. expect(this.serviceConfigs.mapProperty('id')).to.be.eql(['p1__type1', 'p3__type1', 'p2__type2']);
  2187. });
  2188. it('serviceConfigs groups are valid', function () {
  2189. expect(this.serviceConfigs.mapProperty('group.name')).to.be.eql(['t1t1', 't1t1', 't2t1']);
  2190. });
  2191. it('serviceConfigs filenames are valid', function () {
  2192. expect(this.serviceConfigs.mapProperty('filename')).to.be.eql(['type1', 'type1', 'type2']);
  2193. });
  2194. });
  2195. });