config_test.js 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366
  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('config');
  20. require('utils/config');
  21. require('models/service/hdfs');
  22. var setups = require('test/init_model_test');
  23. var modelSetup = setups.configs;
  24. describe('App.config', function () {
  25. var loadServiceSpecificConfigs = function(context, serviceName) {
  26. context.configGroups = modelSetup.setupConfigGroupsObject(serviceName);
  27. context.advancedConfigs = modelSetup.setupAdvancedConfigsObject();
  28. context.tags = modelSetup.setupServiceConfigTagsObject(serviceName);
  29. context.result = App.config.mergePreDefinedWithLoaded(context.configGroups, context.advancedConfigs, context.tags, App.Service.find().findProperty('id', serviceName).get('serviceName'));
  30. };
  31. var loadAllServicesConfigs = function(context, serviceNames) {
  32. context.configGroups = modelSetup.setupConfigGroupsObject();
  33. };
  34. var loadServiceModelsData = function(serviceNames) {
  35. serviceNames.forEach(function(serviceName) {
  36. App.store.load(App.Service, {
  37. id: serviceName,
  38. service_name: serviceName
  39. });
  40. });
  41. };
  42. describe('#handleSpecialProperties', function () {
  43. var config = {};
  44. it('value should be transformed to "1024" from "1024m"', function () {
  45. config = {
  46. displayType: 'int',
  47. value: '1024m',
  48. savedValue: '1024m'
  49. };
  50. App.config.handleSpecialProperties(config);
  51. expect(config.value).to.equal('1024');
  52. expect(config.savedValue).to.equal('1024');
  53. });
  54. });
  55. describe('#fileConfigsIntoTextarea', function () {
  56. var filename = 'capacity-scheduler.xml';
  57. var configs = [
  58. {
  59. name: 'config1',
  60. value: 'value1',
  61. recommendedValue: 'value1',
  62. filename: 'capacity-scheduler.xml'
  63. },
  64. {
  65. name: 'config2',
  66. value: 'value2',
  67. recommendedValue: 'value2',
  68. filename: 'capacity-scheduler.xml'
  69. }
  70. ];
  71. it('two configs into textarea', function () {
  72. var result = App.config.fileConfigsIntoTextarea.call(App.config, configs, filename);
  73. expect(result.length).to.equal(1);
  74. expect(result[0].value).to.equal('config1=value1\nconfig2=value2\n');
  75. expect(result[0].recommendedValue).to.equal('config1=value1\nconfig2=value2\n');
  76. });
  77. it('three config into textarea', function () {
  78. configs.push({
  79. name: 'config3',
  80. value: 'value3',
  81. recommendedValue: 'value3',
  82. filename: 'capacity-scheduler.xml'
  83. });
  84. var result = App.config.fileConfigsIntoTextarea.call(App.config, configs, filename);
  85. expect(result.length).to.equal(1);
  86. expect(result[0].value).to.equal('config1=value1\nconfig2=value2\nconfig3=value3\n');
  87. expect(result[0].recommendedValue).to.equal('config1=value1\nconfig2=value2\nconfig3=value3\n');
  88. });
  89. it('one of three configs has different filename', function () {
  90. configs[1].filename = 'another filename';
  91. var result = App.config.fileConfigsIntoTextarea.call(App.config, configs, filename);
  92. //result contains two configs: one with different filename and one textarea config
  93. expect(result.length).to.equal(2);
  94. expect(result[1].value).to.equal('config1=value1\nconfig3=value3\n');
  95. expect(result[1].recommendedValue).to.equal('config1=value1\nconfig3=value3\n');
  96. });
  97. it('none configs into empty textarea', function () {
  98. filename = 'capacity-scheduler.xml';
  99. configs.clear();
  100. var result = App.config.fileConfigsIntoTextarea.call(App.config, configs, filename);
  101. expect(result.length).to.equal(1);
  102. expect(result[0].value).to.equal('');
  103. expect(Em.isNone(result[0].recommendedValue)).to.be.true;
  104. expect(Em.isNone(result[0].savedValue)).to.be.true;
  105. });
  106. it("filename has configs that shouldn't be included in textarea", function () {
  107. var configs = [
  108. {
  109. name: 'config1',
  110. value: 'value1',
  111. recommendedValue: 'value1',
  112. filename: filename
  113. },
  114. {
  115. name: 'config2',
  116. value: 'value2',
  117. recommendedValue: 'value2',
  118. filename: filename
  119. }
  120. ];
  121. var cfg = {
  122. name: 'config3',
  123. value: 'value3',
  124. recommendedValue: 'value3',
  125. filename: filename
  126. };
  127. configs.push(cfg);
  128. var result = App.config.fileConfigsIntoTextarea.call(App.config, configs, filename, [cfg]);
  129. expect(result.length).to.equal(2);
  130. expect(result[1].value).to.equal('config1=value1\nconfig2=value2\n');
  131. expect(result[1].recommendedValue).to.equal('config1=value1\nconfig2=value2\n');
  132. expect(configs.findProperty('name', 'config3')).to.eql(cfg);
  133. });
  134. });
  135. describe('#textareaIntoFileConfigs', function () {
  136. var filename = 'capacity-scheduler.xml';
  137. var testData = [
  138. {
  139. configs: [Em.Object.create({
  140. "name": "capacity-scheduler",
  141. "value": "config1=value1",
  142. "filename": "capacity-scheduler.xml",
  143. "isRequiredByAgent": true
  144. })]
  145. },
  146. {
  147. configs: [Em.Object.create({
  148. "name": "capacity-scheduler",
  149. "value": "config1=value1\nconfig2=value2\n",
  150. "filename": "capacity-scheduler.xml",
  151. "isRequiredByAgent": false
  152. })]
  153. },
  154. {
  155. configs: [Em.Object.create({
  156. "name": "capacity-scheduler",
  157. "value": "config1=value1,value2\n",
  158. "filename": "capacity-scheduler.xml",
  159. "isRequiredByAgent": true
  160. })]
  161. },
  162. {
  163. configs: [Em.Object.create({
  164. "name": "capacity-scheduler",
  165. "value": "config1=value1 config2=value2\n",
  166. "filename": "capacity-scheduler.xml",
  167. "isRequiredByAgent": false
  168. })]
  169. }
  170. ];
  171. it('config1=value1 to one config', function () {
  172. var result = App.config.textareaIntoFileConfigs.call(App.config, testData[0].configs, filename);
  173. expect(result.length).to.equal(1);
  174. expect(result[0].value).to.equal('value1');
  175. expect(result[0].name).to.equal('config1');
  176. expect(result[0].isRequiredByAgent).to.be.true;
  177. });
  178. it('config1=value1\\nconfig2=value2\\n to two configs', function () {
  179. var result = App.config.textareaIntoFileConfigs.call(App.config, testData[1].configs, filename);
  180. expect(result.length).to.equal(2);
  181. expect(result[0].value).to.equal('value1');
  182. expect(result[0].name).to.equal('config1');
  183. expect(result[1].value).to.equal('value2');
  184. expect(result[1].name).to.equal('config2');
  185. expect(result[0].isRequiredByAgent).to.be.false;
  186. expect(result[1].isRequiredByAgent).to.be.false;
  187. });
  188. it('config1=value1,value2\n to one config', function () {
  189. var result = App.config.textareaIntoFileConfigs.call(App.config, testData[2].configs, filename);
  190. expect(result.length).to.equal(1);
  191. expect(result[0].value).to.equal('value1,value2');
  192. expect(result[0].name).to.equal('config1');
  193. expect(result[0].isRequiredByAgent).to.be.true;
  194. });
  195. it('config1=value1 config2=value2 to two configs', function () {
  196. var result = App.config.textareaIntoFileConfigs.call(App.config, testData[3].configs, filename);
  197. expect(result.length).to.equal(1);
  198. expect(result[0].isRequiredByAgent).to.be.false;
  199. });
  200. });
  201. describe('#trimProperty',function() {
  202. var testMessage = 'displayType `{0}`, value `{1}`{3} should return `{2}`';
  203. var tests = [
  204. {
  205. config: {
  206. displayType: 'directory',
  207. value: ' /a /b /c'
  208. },
  209. e: '/a,/b,/c'
  210. },
  211. {
  212. config: {
  213. displayType: 'directories',
  214. value: ' /a /b '
  215. },
  216. e: '/a,/b'
  217. },
  218. {
  219. config: {
  220. displayType: 'datanodedirs',
  221. value: ' [DISK]/a [SSD]/b '
  222. },
  223. e: '[DISK]/a,[SSD]/b'
  224. },
  225. {
  226. config: {
  227. displayType: 'datanodedirs',
  228. value: '/a,/b, /c\n/d,\n/e /f'
  229. },
  230. e: '/a,/b,/c,/d,/e,/f'
  231. },
  232. {
  233. config: {
  234. displayType: 'host',
  235. value: ' localhost '
  236. },
  237. e: 'localhost'
  238. },
  239. {
  240. config: {
  241. displayType: 'password',
  242. value: ' passw ord '
  243. },
  244. e: ' passw ord '
  245. },
  246. {
  247. config: {
  248. displayType: 'advanced',
  249. value: ' value'
  250. },
  251. e: ' value'
  252. },
  253. {
  254. config: {
  255. displayType: 'advanced',
  256. value: ' value'
  257. },
  258. e: ' value'
  259. },
  260. {
  261. config: {
  262. displayType: 'advanced',
  263. value: 'http://localhost ',
  264. name: 'javax.jdo.option.ConnectionURL'
  265. },
  266. e: 'http://localhost'
  267. },
  268. {
  269. config: {
  270. displayType: 'advanced',
  271. value: 'http://localhost ',
  272. name: 'oozie.service.JPAService.jdbc.url'
  273. },
  274. e: 'http://localhost'
  275. },
  276. {
  277. config: {
  278. displayType: 'custom',
  279. value: ' custom value '
  280. },
  281. e: ' custom value'
  282. },
  283. {
  284. config: {
  285. displayType: 'masterHosts',
  286. value: ['host1.com', 'host2.com']
  287. },
  288. e: ['host1.com', 'host2.com']
  289. }
  290. ];
  291. tests.forEach(function(test) {
  292. it(testMessage.format(test.config.displayType, test.config.value, test.e, !!test.config.name ? ', name `' + test.config.name + '`' : ''), function() {
  293. expect(App.config.trimProperty(test.config)).to.eql(test.e);
  294. expect(App.config.trimProperty(Em.Object.create(test.config), true)).to.eql(test.e);
  295. });
  296. });
  297. });
  298. describe('#preDefinedConfigFile', function() {
  299. before(function() {
  300. setups.setupStackVersion(this, 'BIGTOP-0.8');
  301. });
  302. it('bigtop site properties should be ok.', function() {
  303. var bigtopSiteProperties = App.config.preDefinedConfigFile('site_properties');
  304. expect(bigtopSiteProperties).to.be.ok;
  305. });
  306. it('a non-existing file should not be ok.', function () {
  307. var notExistingSiteProperty = App.config.preDefinedConfigFile('notExisting');
  308. expect(notExistingSiteProperty).to.not.be.ok;
  309. });
  310. after(function() {
  311. setups.restoreStackVersion(this);
  312. });
  313. });
  314. describe('#preDefinedSiteProperties-bigtop', function () {
  315. before(function() {
  316. setups.setupStackVersion(this, 'BIGTOP-0.8');
  317. });
  318. it('bigtop should use New PostgreSQL Database as its default hive metastore database', function () {
  319. App.StackService.createRecord({serviceName: 'HIVE'});
  320. expect(App.config.get('preDefinedSiteProperties').findProperty('recommendedValue', 'New PostgreSQL Database')).to.be.ok;
  321. });
  322. after(function() {
  323. setups.restoreStackVersion(this);
  324. });
  325. });
  326. describe('#preDefinedSiteProperties-hdp2', function () {
  327. before(function() {
  328. setups.setupStackVersion(this, 'HDP-2.0');
  329. });
  330. it('HDP2 should use New MySQL Database as its default hive metastore database', function () {
  331. App.StackService.createRecord({serviceName: 'HIVE'});
  332. expect(App.config.get('preDefinedSiteProperties').findProperty('recommendedValue', 'New MySQL Database')).to.be.ok;
  333. });
  334. after(function() {
  335. setups.restoreStackVersion(this);
  336. });
  337. });
  338. describe('#generateConfigPropertiesByName', function() {
  339. var tests = [
  340. {
  341. names: ['property_1', 'property_2'],
  342. properties: undefined,
  343. e: {
  344. keys: ['name', 'displayName', 'isVisible', 'isReconfigurable']
  345. },
  346. m: 'Should generate base property object without additional fields'
  347. },
  348. {
  349. names: ['property_1', 'property_2'],
  350. properties: { category: 'SomeCat', serviceName: 'SERVICE_NAME' },
  351. e: {
  352. keys: ['name', 'displayName', 'isVisible', 'isReconfigurable', 'category', 'serviceName']
  353. },
  354. m: 'Should generate base property object without additional fields'
  355. }
  356. ];
  357. tests.forEach(function(test) {
  358. it(test.m, function() {
  359. expect(App.config.generateConfigPropertiesByName(test.names, test.properties).length).to.eql(test.names.length);
  360. expect(App.config.generateConfigPropertiesByName(test.names, test.properties).map(function(property) {
  361. return Em.keys(property);
  362. }).reduce(function(p, c) {
  363. return p.concat(c);
  364. }).uniq()).to.eql(test.e.keys);
  365. });
  366. });
  367. });
  368. describe('#setPreDefinedServiceConfigs', function() {
  369. beforeEach(function() {
  370. sinon.stub(App.StackService, 'find', function() {
  371. return [
  372. Em.Object.create({
  373. id: 'HDFS',
  374. serviceName: 'HDFS',
  375. configTypes: {
  376. 'hadoop-env': {},
  377. 'hdfs-site': {}
  378. }
  379. }),
  380. Em.Object.create({
  381. id: 'OOZIE',
  382. serviceName: 'OOZIE',
  383. configTypes: {
  384. 'oozie-env': {},
  385. 'oozie-site': {}
  386. }
  387. })
  388. ];
  389. });
  390. App.config.setPreDefinedServiceConfigs(true);
  391. });
  392. afterEach(function() {
  393. App.StackService.find.restore();
  394. });
  395. it('should include service MISC', function() {
  396. expect(App.config.get('preDefinedServiceConfigs').findProperty('serviceName', 'MISC')).to.be.ok;
  397. });
  398. it('should include -env config types according to stack services', function() {
  399. var miscCategory = App.config.get('preDefinedServiceConfigs').findProperty('serviceName', 'MISC');
  400. expect(Em.keys(miscCategory.get('configTypes'))).to.eql(['cluster-env', 'hadoop-env', 'oozie-env']);
  401. });
  402. it('should not load configs for missed config types', function() {
  403. var hdfsService = App.config.get('preDefinedServiceConfigs').findProperty('serviceName', 'HDFS');
  404. var rangerRelatedConfigs = hdfsService.get('configs').filterProperty('filename', 'ranger-hdfs-plugin-properties.xml');
  405. expect(rangerRelatedConfigs.length).to.be.eql(0);
  406. expect(hdfsService.get('configs.length') > 0).to.be.true;
  407. });
  408. });
  409. describe('#isManagedMySQLForHiveAllowed', function () {
  410. var cases = [
  411. {
  412. osFamily: 'redhat5',
  413. expected: false
  414. },
  415. {
  416. osFamily: 'redhat6',
  417. expected: true
  418. },
  419. {
  420. osFamily: 'suse11',
  421. expected: false
  422. }
  423. ],
  424. title = 'should be {0} for {1}';
  425. cases.forEach(function (item) {
  426. it(title.format(item.expected, item.osFamily), function () {
  427. expect(App.config.isManagedMySQLForHiveAllowed(item.osFamily)).to.equal(item.expected);
  428. });
  429. });
  430. });
  431. describe('#replaceConfigValues', function () {
  432. var cases = [
  433. {
  434. name: 'name',
  435. express: '<templateName[0]>',
  436. value: '<templateName[0]>',
  437. globValue: 'v',
  438. expected: 'v',
  439. title: 'default case'
  440. },
  441. {
  442. name: 'templeton.hive.properties',
  443. express: '<templateName[0]>',
  444. value: 'hive.matestore.uris=<templateName[0]>',
  445. globValue: 'thrift://h0:9933,thrift://h1:9933,thrift://h2:9933',
  446. expected: 'hive.matestore.uris=thrift://h0:9933\\,thrift://h1:9933\\,thrift://h2:9933',
  447. title: 'should escape commas for templeton.hive.properties'
  448. }
  449. ];
  450. cases.forEach(function (item) {
  451. it(item.title, function () {
  452. expect(App.config.replaceConfigValues(item.name, item.express, item.value, item.globValue)).to.equal(item.expected);
  453. });
  454. });
  455. });
  456. describe('#advancedConfigIdentityData', function () {
  457. var configs = [
  458. {
  459. input: {
  460. property_type: ['USER'],
  461. property_name: 'hdfs_user'
  462. },
  463. output: {
  464. id: 'puppet var',
  465. category: 'Users and Groups',
  466. isVisible: true,
  467. serviceName: 'MISC',
  468. isOverridable: false,
  469. isReconfigurable: false,
  470. displayName: 'HDFS User',
  471. displayType: 'user',
  472. index: 30
  473. },
  474. title: 'user, no service name specified, default display name behaviour'
  475. },
  476. {
  477. input: {
  478. property_type: ['GROUP'],
  479. property_name: 'knox_group',
  480. service_name: 'KNOX'
  481. },
  482. output: {
  483. id: 'puppet var',
  484. category: 'Users and Groups',
  485. isVisible: true,
  486. serviceName: 'MISC',
  487. isOverridable: false,
  488. isReconfigurable: false,
  489. displayName: 'Knox Group',
  490. displayType: 'user',
  491. index: 0
  492. },
  493. title: 'group, service_name = KNOX, default display name behaviour'
  494. },
  495. {
  496. input: {
  497. property_type: ['USER']
  498. },
  499. output: {
  500. isVisible: false
  501. },
  502. isHDPWIN: true,
  503. title: 'HDPWIN stack'
  504. },
  505. {
  506. input: {
  507. property_type: ['USER'],
  508. property_name: 'smokeuser',
  509. service_name: 'MISC'
  510. },
  511. output: {
  512. displayName: 'Smoke Test User',
  513. serviceName: 'MISC',
  514. belongsToService: ['MISC'],
  515. index: 30
  516. },
  517. title: 'smokeuser, service_name = MISC'
  518. },
  519. {
  520. input: {
  521. property_type: ['GROUP'],
  522. property_name: 'user_group'
  523. },
  524. output: {
  525. displayName: 'Hadoop Group'
  526. },
  527. title: 'user_group'
  528. },
  529. {
  530. input: {
  531. property_type: ['USER'],
  532. property_name: 'mapred_user'
  533. },
  534. output: {
  535. displayName: 'MapReduce User'
  536. },
  537. title: 'mapred_user'
  538. },
  539. {
  540. input: {
  541. property_type: ['USER'],
  542. property_name: 'zk_user'
  543. },
  544. output: {
  545. displayName: 'ZooKeeper User'
  546. },
  547. title: 'zk_user'
  548. },
  549. {
  550. input: {
  551. property_type: ['USER'],
  552. property_name: 'ignore_groupsusers_create'
  553. },
  554. output: {
  555. displayName: 'Skip group modifications during install',
  556. displayType: 'checkbox'
  557. },
  558. title: 'ignore_groupsusers_create'
  559. },
  560. {
  561. input: {
  562. property_type: ['GROUP'],
  563. property_name: 'proxyuser_group'
  564. },
  565. output: {
  566. belongsToService: ['HIVE', 'OOZIE', 'FALCON']
  567. },
  568. title: 'proxyuser_group'
  569. },
  570. {
  571. input: {
  572. property_type: ['PASSWORD'],
  573. property_name: 'javax.jdo.option.ConnectionPassword'
  574. },
  575. output: {
  576. displayType: 'password'
  577. },
  578. title: 'password'
  579. }
  580. ];
  581. before(function () {
  582. sinon.stub(App.StackService, 'find').returns([
  583. {
  584. serviceName: 'KNOX'
  585. }
  586. ]);
  587. });
  588. afterEach(function () {
  589. App.get.restore();
  590. });
  591. after(function () {
  592. App.StackService.find.restore();
  593. });
  594. configs.forEach(function (item) {
  595. it(item.title, function () {
  596. sinon.stub(App, 'get').withArgs('isHadoopWindowsStack').returns(Boolean(item.isHDPWIN));
  597. var propertyData = App.config.advancedConfigIdentityData(item.input);
  598. Em.keys(item.output).forEach(function (key) {
  599. expect(propertyData[key]).to.eql(item.output[key]);
  600. });
  601. });
  602. });
  603. });
  604. describe('#setConfigValue', function () {
  605. Em.A([
  606. {
  607. mappedConfigs: [
  608. {
  609. name: 'falcon_user',
  610. value: 'fu'
  611. }
  612. ],
  613. allConfigs: [],
  614. m: 'in mapped, value used',
  615. e: {
  616. _name: 'hadoop.proxyuser.fu.groups',
  617. value: 'fu',
  618. noMatchSoSkipThisConfig: false
  619. }
  620. },
  621. {
  622. mappedConfigs: [],
  623. allConfigs: [
  624. {
  625. name: 'falcon_user',
  626. value: 'fu'
  627. }
  628. ],
  629. m: 'in all, value used',
  630. e: {
  631. _name: 'hadoop.proxyuser.fu.groups',
  632. value: 'fu',
  633. noMatchSoSkipThisConfig: false
  634. }
  635. },
  636. {
  637. mappedConfigs: [],
  638. allConfigs: [
  639. {
  640. name: 'falcon_user',
  641. value: '',
  642. recommendedValue: 'fu'
  643. }
  644. ],
  645. m: 'in all, default value used',
  646. e: {
  647. _name: 'hadoop.proxyuser.fu.groups',
  648. value: 'fu',
  649. noMatchSoSkipThisConfig: false
  650. }
  651. },
  652. {
  653. mappedConfigs: [],
  654. allConfigs: [],
  655. m: 'not found',
  656. e: {
  657. _name: 'hadoop.proxyuser.<foreignKey[0]>.groups',
  658. value: '<foreignKey[0]>',
  659. noMatchSoSkipThisConfig: true
  660. }
  661. }
  662. ]).forEach(function (test) {
  663. it(test.m, function () {
  664. var config = {
  665. name: "hadoop.proxyuser.<foreignKey[0]>.groups",
  666. templateName: ["proxyuser_group"],
  667. foreignKey: ["falcon_user"],
  668. noMatchSoSkipThisConfig: false,
  669. value: "<foreignKey[0]>"
  670. };
  671. App.config.setConfigValue(test.mappedConfigs, test.allConfigs, config);
  672. expect(config.value).to.equal(test.e.value);
  673. if(test.e.noMatchSoSkipThisConfig) {
  674. expect(Em.isNone(config._name)).to.be.true;
  675. }
  676. else {
  677. expect(config._name).to.equal(test.e._name);
  678. }
  679. expect(config.noMatchSoSkipThisConfig).to.equal(test.e.noMatchSoSkipThisConfig);
  680. });
  681. Em.A([
  682. {
  683. mappedConfigs: [],
  684. allConfigs: [
  685. {
  686. name: 'falcon_user',
  687. value: 'fu'
  688. },
  689. {
  690. name: 'proxyuser_group',
  691. value: 'pg'
  692. }
  693. ],
  694. m: 'in all, template in all',
  695. e: {
  696. _name: 'hadoop.proxyuser.fu.groups',
  697. value: 'fupg'
  698. }
  699. },
  700. {
  701. mappedConfigs: [
  702. {
  703. name: 'falcon_user',
  704. value: 'fu'
  705. },
  706. {
  707. name: 'proxyuser_group',
  708. value: 'pg'
  709. }
  710. ],
  711. allConfigs: [],
  712. m: 'in mapped, template in mapped',
  713. e: {
  714. _name: 'hadoop.proxyuser.fu.groups',
  715. value: 'fupg'
  716. }
  717. },
  718. {
  719. mappedConfigs: [],
  720. allConfigs: [],
  721. m: 'not found (template not found too)',
  722. e: {
  723. _name: 'hadoop.proxyuser.<foreignKey[0]>.groups',
  724. value: null
  725. }
  726. }
  727. ]).forEach(function (test) {
  728. it(test.m, function () {
  729. var config = {
  730. name: "hadoop.proxyuser.<foreignKey[0]>.groups",
  731. templateName: ["proxyuser_group"],
  732. foreignKey: ["falcon_user"],
  733. noMatchSoSkipThisConfig: false,
  734. value: "<foreignKey[0]><templateName[0]>"
  735. };
  736. App.config.setConfigValue(test.mappedConfigs, test.allConfigs, config);
  737. });
  738. });
  739. });
  740. });
  741. describe('#shouldSupportFinal', function () {
  742. var cases = [
  743. {
  744. shouldSupportFinal: false,
  745. title: 'no service name specified'
  746. },
  747. {
  748. serviceName: 's0',
  749. shouldSupportFinal: false,
  750. title: 'no filename specified'
  751. },
  752. {
  753. serviceName: 'MISC',
  754. shouldSupportFinal: false,
  755. title: 'MISC'
  756. },
  757. {
  758. serviceName: 's0',
  759. filename: 's0-site',
  760. shouldSupportFinal: true,
  761. title: 'final attribute supported'
  762. },
  763. {
  764. serviceName: 's0',
  765. filename: 's0-env',
  766. shouldSupportFinal: false,
  767. title: 'final attribute not supported'
  768. }
  769. ];
  770. beforeEach(function () {
  771. sinon.stub(App.StackService, 'find').returns([
  772. {
  773. serviceName: 's0'
  774. }
  775. ]);
  776. sinon.stub(App.config, 'getConfigTypesInfoFromService').returns({
  777. supportsFinal: ['s0-site']
  778. });
  779. });
  780. afterEach(function () {
  781. App.StackService.find.restore();
  782. App.config.getConfigTypesInfoFromService.restore();
  783. });
  784. cases.forEach(function (item) {
  785. it(item.title, function () {
  786. expect(App.config.shouldSupportFinal(item.serviceName, item.filename)).to.equal(item.shouldSupportFinal);
  787. });
  788. });
  789. });
  790. describe('#removeRangerConfigs', function () {
  791. it('should remove ranger configs and categories', function () {
  792. var configs = [
  793. Em.Object.create({
  794. configs: [
  795. Em.Object.create({filename: 'filename'}),
  796. Em.Object.create({filename: 'ranger-filename'})
  797. ],
  798. configCategories: [
  799. Em.Object.create({name: 'ranger-name'}),
  800. Em.Object.create({name: 'name'}),
  801. Em.Object.create({name: 'also-ranger-name'})
  802. ]
  803. })
  804. ];
  805. App.config.removeRangerConfigs(configs);
  806. expect(configs).eql(
  807. [
  808. Em.Object.create({
  809. configs: [
  810. Em.Object.create({filename: 'filename'})
  811. ],
  812. configCategories: [
  813. Em.Object.create({name: 'name'})
  814. ]
  815. })
  816. ]
  817. );
  818. });
  819. });
  820. describe("#createOverride", function() {
  821. var template = {
  822. name: "p1",
  823. filename: "f1",
  824. value: "v1",
  825. recommendedValue: "rv1",
  826. savedValue: "sv1",
  827. isFinal: true,
  828. recommendedIsFinal: false,
  829. savedIsFinal: true
  830. };
  831. var configProperty = App.ServiceConfigProperty.create(template);
  832. var group = App.ConfigGroup.create({name: "group1"});
  833. it('creates override with save properties as original config', function() {
  834. var override = App.config.createOverride(configProperty, {}, group);
  835. for (var key in template) {
  836. expect(override.get(key)).to.eql(template[key]);
  837. }
  838. });
  839. it('overrides some values that should be different for override', function() {
  840. var override = App.config.createOverride(configProperty, {}, group);
  841. expect(override.get('isOriginalSCP')).to.be.false;
  842. expect(override.get('overrides')).to.be.null;
  843. expect(override.get('group')).to.eql(group);
  844. expect(override.get('parentSCP')).to.eql(configProperty);
  845. });
  846. it('overrides some specific values', function() {
  847. var overridenTemplate = {
  848. value: "v2",
  849. recommendedValue: "rv2",
  850. savedValue: "sv2",
  851. isFinal: true,
  852. recommendedIsFinal: false,
  853. savedIsFinal: true
  854. };
  855. var override = App.config.createOverride(configProperty, overridenTemplate, group);
  856. for (var key in overridenTemplate) {
  857. expect(override.get(key)).to.eql(overridenTemplate[key]);
  858. }
  859. });
  860. it('throws error due to undefined configGroup', function() {
  861. expect(App.config.createOverride.bind(App.config, configProperty, {}, null)).to.throw(Error, 'configGroup can\' be null');
  862. });
  863. it('throws error due to undefined originalSCP', function() {
  864. expect(App.config.createOverride.bind(App.config, null, {}, group)).to.throw(Error, 'serviceConfigProperty can\' be null');
  865. });
  866. it('updates originalSCP object ', function() {
  867. configProperty.set('overrides', null);
  868. configProperty.set('overrideValues', []);
  869. configProperty.set('overrideIsFinalValues', []);
  870. var overridenTemplate2 = {
  871. value: "v12",
  872. recommendedValue: "rv12",
  873. savedValue: "sv12",
  874. isFinal: true,
  875. recommendedIsFinal: false,
  876. savedIsFinal: false
  877. };
  878. var override = App.config.createOverride(configProperty, overridenTemplate2, group);
  879. expect(configProperty.get('overrides')[0]).to.be.eql(override);
  880. expect(configProperty.get('overrideValues')).to.be.eql([overridenTemplate2.value]);
  881. expect(configProperty.get('overrideIsFinalValues')).to.be.eql([overridenTemplate2.isFinal]);
  882. });
  883. });
  884. describe('#getIsEditable', function() {
  885. [{
  886. isDefaultGroup: true,
  887. isReconfigurable: true,
  888. canEdit: true,
  889. res: true,
  890. m: "isEditable is true"
  891. },
  892. {
  893. isDefaultGroup: false,
  894. isReconfigurable: true,
  895. canEdit: true,
  896. res: false,
  897. m: "isEditable is false; config group is not default"
  898. },
  899. {
  900. isDefaultGroup: true,
  901. isReconfigurable: false,
  902. canEdit: true,
  903. res: false,
  904. m: "isEditable is true; config is not reconfigurable"
  905. },
  906. {
  907. isDefaultGroup: true,
  908. isReconfigurable: true,
  909. canEdit: false,
  910. res: false,
  911. m: "isEditable is true; edition restricted by controller state"
  912. }].forEach(function(t) {
  913. it(t.m, function() {
  914. var configProperty = Ember.Object.create({isReconfigurable: t.isReconfigurable});
  915. var configGroup = Ember.Object.create({isDefault: t.isDefaultGroup});
  916. var isEditable = App.config.getIsEditable(configProperty, configGroup, t.canEdit);
  917. expect(isEditable).to.equal(t.res);
  918. })
  919. });
  920. });
  921. describe('#getIsSecure', function() {
  922. var secureConfigs = App.config.get('secureConfigs');
  923. before(function() {
  924. App.config.set('secureConfigs', [{name: 'secureConfig'}]);
  925. });
  926. after(function() {
  927. App.config.set('secureConfigs', secureConfigs);
  928. });
  929. it('config is secure', function() {
  930. expect(App.config.getIsSecure('secureConfig')).to.equal(true);
  931. });
  932. it('config is not secure', function() {
  933. expect(App.config.getIsSecure('NotSecureConfig')).to.equal(false);
  934. });
  935. });
  936. describe('#getDefaultCategory', function() {
  937. it('returns custom category', function() {
  938. expect(App.config.getDefaultCategory(null, 'filename.xml')).to.equal('Custom filename');
  939. });
  940. it('returns advanced category', function() {
  941. expect(App.config.getDefaultCategory(Em.Object.create, 'filename.xml')).to.equal('Advanced filename');
  942. });
  943. });
  944. describe('#getDefaultDisplayType', function() {
  945. it('returns content displayType', function() {
  946. sinon.stub(App.config, 'isContentProperty', function () {return true});
  947. expect(App.config.getDefaultDisplayType('content','f1','anything')).to.equal('content');
  948. App.config.isContentProperty.restore();
  949. });
  950. it('returns singleLine displayType', function() {
  951. sinon.stub(App.config, 'isContentProperty', function () {return false});
  952. expect(App.config.getDefaultDisplayType('n1','f1','v1')).to.equal('advanced');
  953. App.config.isContentProperty.restore();
  954. });
  955. it('returns multiLine displayType', function() {
  956. sinon.stub(App.config, 'isContentProperty', function () {return false});
  957. expect(App.config.getDefaultDisplayType('n2', 'f2', 'v1\nv2')).to.equal('multiLine');
  958. App.config.isContentProperty.restore();
  959. });
  960. });
  961. describe('#getDefaultDisplayName', function() {
  962. beforeEach(function() {
  963. sinon.stub(App.config, 'getConfigTagFromFileName', function(fName) {return fName} );
  964. });
  965. afterEach(function() {
  966. App.config.getConfigTagFromFileName.restore();
  967. });
  968. it('returns name', function() {
  969. sinon.stub(App.config, 'isContentProperty', function() {return false} );
  970. expect(App.config.getDefaultDisplayName('name')).to.equal('name');
  971. App.config.isContentProperty.restore();
  972. });
  973. it('returns name for env content', function() {
  974. sinon.stub(App.config, 'isContentProperty', function() {return true} );
  975. expect(App.config.getDefaultDisplayName('name', 'fileName')).to.equal('fileName template');
  976. App.config.isContentProperty.restore();
  977. });
  978. });
  979. describe('#isContentProperty', function() {
  980. beforeEach(function() {
  981. sinon.stub(App.config, 'getConfigTagFromFileName', function(fName) {return fName} );
  982. });
  983. afterEach(function() {
  984. App.config.getConfigTagFromFileName.restore();
  985. });
  986. var tests = [
  987. {
  988. name: 'content',
  989. fileName: 'something-env',
  990. tagEnds: null,
  991. res: true,
  992. m: 'returns true as it\'s content property'
  993. },
  994. {
  995. name: 'content',
  996. fileName: 'something-any-end',
  997. tagEnds: ['-any-end'],
  998. res: true,
  999. m: 'returns true as it\'s content property with specific fileName ending'
  1000. },
  1001. {
  1002. name: 'notContent',
  1003. fileName: 'something-env',
  1004. tagEnds: ['-env'],
  1005. res: false,
  1006. m: 'returns false as name is not content'
  1007. },
  1008. {
  1009. name: 'content',
  1010. fileName: 'something-env1',
  1011. tagEnds: ['-env'],
  1012. res: false,
  1013. m: 'returns false as fileName is not correct'
  1014. }
  1015. ].forEach(function(t) {
  1016. it(t.m, function() {
  1017. expect(App.config.isContentProperty(t.name, t.fileName, t.tagEnds)).to.equal(t.res);
  1018. });
  1019. });
  1020. });
  1021. describe('#formatValue', function() {
  1022. it('formatValue for masterHosts', function () {
  1023. var serviceConfigProperty = Em.Object.create({'displayType': 'masterHosts', value: "['h1','h2']"});
  1024. expect(App.config.formatPropertyValue(serviceConfigProperty)).to.eql(['h1','h2']);
  1025. });
  1026. it('formatValue for int', function () {
  1027. var serviceConfigProperty = Em.Object.create({'displayType': 'int', value: '4.0'});
  1028. expect(App.config.formatPropertyValue(serviceConfigProperty)).to.equal('4');
  1029. });
  1030. it('formatValue for int with m', function () {
  1031. var serviceConfigProperty = Em.Object.create({'displayType': 'int', value: '4m'});
  1032. expect(App.config.formatPropertyValue(serviceConfigProperty)).to.equal('4');
  1033. });
  1034. it('formatValue for float', function () {
  1035. var serviceConfigProperty = Em.Object.create({'displayType': 'float', value: '0.40'});
  1036. expect(App.config.formatPropertyValue(serviceConfigProperty)).to.equal('0.4');
  1037. });
  1038. it('formatValue for kdc_type', function () {
  1039. var serviceConfigProperty = Em.Object.create({'name': 'kdc_type', value: 'mit-kdc'});
  1040. expect(App.config.formatPropertyValue(serviceConfigProperty)).to.equal(Em.I18n.t('admin.kerberos.wizard.step1.option.kdc'));
  1041. });
  1042. it('don\'t format value', function () {
  1043. var serviceConfigProperty = Em.Object.create({'name': 'any', displayType: 'any', value: 'any'});
  1044. expect(App.config.formatPropertyValue(serviceConfigProperty)).to.equal('any');
  1045. });
  1046. });
  1047. describe('#getPropertyIfExists', function() {
  1048. [
  1049. {
  1050. propertyName: 'someProperty',
  1051. defaultValue: 'default',
  1052. firstObject: { someProperty: '1' },
  1053. secondObject: { someProperty: '2' },
  1054. res: '1',
  1055. m: 'use value from first object'
  1056. },
  1057. {
  1058. propertyName: 'someProperty',
  1059. defaultValue: 'default',
  1060. firstObject: { someOtherProperty: '1' },
  1061. secondObject: { someProperty: '2' },
  1062. res: '2',
  1063. m: 'use value from second object'
  1064. },
  1065. {
  1066. propertyName: 'someProperty',
  1067. defaultValue: 'default',
  1068. firstObject: { someOtherProperty: '1' },
  1069. secondObject: { someOtherProperty: '2' },
  1070. res: 'default',
  1071. m: 'use default value'
  1072. },
  1073. {
  1074. propertyName: 'someProperty',
  1075. defaultValue: 'default',
  1076. res: 'default',
  1077. m: 'use default value'
  1078. },
  1079. {
  1080. propertyName: 'someProperty',
  1081. defaultValue: true,
  1082. firstObject: { someProperty: false },
  1083. secondObject: { someProperty: true },
  1084. res: false,
  1085. m: 'use value from first object, check booleans'
  1086. },
  1087. {
  1088. propertyName: 'someProperty',
  1089. defaultValue: true,
  1090. firstObject: { someProperty: 0 },
  1091. secondObject: { someProperty: 1 },
  1092. res: 0,
  1093. m: 'use value from first object, check 0'
  1094. },
  1095. {
  1096. propertyName: 'someProperty',
  1097. defaultValue: true,
  1098. firstObject: { someProperty: '' },
  1099. secondObject: { someProperty: '1' },
  1100. res: '',
  1101. m: 'use value from first object, check empty string'
  1102. }
  1103. ].forEach(function (t) {
  1104. it(t.m, function () {
  1105. expect(App.config.getPropertyIfExists(t.propertyName, t.defaultValue, t.firstObject, t.secondObject)).to.equal(t.res);
  1106. })
  1107. });
  1108. });
  1109. describe('#createDefaultConfig', function() {
  1110. before(function() {
  1111. sinon.stub(App.config, 'getDefaultDisplayName', function() {
  1112. return 'pDisplayName';
  1113. });
  1114. sinon.stub(App.config, 'getDefaultDisplayType', function() {
  1115. return 'pDisplayType';
  1116. });
  1117. sinon.stub(App.config, 'getDefaultCategory', function() {
  1118. return 'pCategory';
  1119. });
  1120. sinon.stub(App.config, 'getIsSecure', function() {
  1121. return false;
  1122. });
  1123. sinon.stub(App.config, 'getDefaultIsShowLabel', function() {
  1124. return true;
  1125. });
  1126. });
  1127. after(function() {
  1128. App.config.getDefaultDisplayName.restore();
  1129. App.config.getDefaultDisplayType.restore();
  1130. App.config.getDefaultCategory.restore();
  1131. App.config.getIsSecure.restore();
  1132. App.config.getDefaultIsShowLabel.restore();
  1133. });
  1134. var res = {
  1135. /** core properties **/
  1136. name: 'pName',
  1137. filename: 'pFileName',
  1138. value: '',
  1139. savedValue: null,
  1140. isFinal: false,
  1141. savedIsFinal: null,
  1142. /** UI and Stack properties **/
  1143. recommendedValue: null,
  1144. recommendedIsFinal: null,
  1145. supportsFinal: false,
  1146. serviceName: 'MISC',
  1147. defaultDirectory: '',
  1148. displayName: 'pDisplayName',
  1149. displayType: 'pDisplayType',
  1150. description: null,
  1151. category: 'pCategory',
  1152. isSecureConfig: false,
  1153. showLabel: true,
  1154. isVisible: true,
  1155. isUserProperty: false,
  1156. isRequired: true,
  1157. group: null,
  1158. id: 'site property',
  1159. isRequiredByAgent: true,
  1160. isReconfigurable: true,
  1161. isObserved: false,
  1162. unit: null,
  1163. hasInitialValue: false,
  1164. isOverridable: true,
  1165. index: null,
  1166. dependentConfigPattern: null,
  1167. options: null,
  1168. radioName: null,
  1169. belongsToService: []
  1170. };
  1171. it('create default config object', function() {
  1172. expect(App.config.createDefaultConfig('pName','pFileName', true)).to.eql(res);
  1173. });
  1174. it('runs proper methods', function() {
  1175. expect(App.config.getDefaultDisplayName.calledWith('pName','pFileName')).to.be.true;
  1176. expect(App.config.getDefaultDisplayType.calledWith('pName', 'pFileName', '')).to.be.true;
  1177. expect(App.config.getDefaultCategory.calledWith(true, 'pFileName')).to.be.true;
  1178. expect(App.config.getIsSecure.calledWith('pName')).to.be.true;
  1179. expect(App.config.getDefaultIsShowLabel.calledWith('pName', 'pFileName')).to.be.true;
  1180. });
  1181. });
  1182. describe('#mergeStackConfigsWithUI', function() {
  1183. beforeEach(function() {
  1184. sinon.stub(App.config, 'getPropertyIfExists', function(key, value) {return 'res_' + value});
  1185. });
  1186. afterEach(function() {
  1187. App.config.getPropertyIfExists.restore();
  1188. });
  1189. var template = {
  1190. name: 'pName',
  1191. filename: 'pFileName',
  1192. value: 'pValue',
  1193. savedValue: 'pValue',
  1194. isFinal: true,
  1195. savedIsFinal: true,
  1196. serviceName: 'pServiceName',
  1197. displayName: 'pDisplayName',
  1198. displayType: 'pDisplayType',
  1199. category: 'pCategory'
  1200. };
  1201. var result = {
  1202. name: 'pName',
  1203. filename: 'pFileName',
  1204. value: 'pValue',
  1205. savedValue: 'pValue',
  1206. isFinal: true,
  1207. savedIsFinal: true,
  1208. serviceName: 'res_pServiceName',
  1209. displayName: 'res_pDisplayName',
  1210. displayType: 'res_pDisplayType',
  1211. category: 'res_pCategory'
  1212. };
  1213. it('called generate property object', function () {
  1214. expect(App.config.mergeStaticProperties(template, {}, {})).to.eql(result);
  1215. });
  1216. });
  1217. describe('#updateHostsListValue', function() {
  1218. var tests = [
  1219. {
  1220. siteConfigs: {
  1221. 'hadoop.registry.zk.quorum': 'host1,host2'
  1222. },
  1223. propertyName: 'hadoop.registry.zk.quorum',
  1224. hostsList: 'host1',
  1225. e: 'host1'
  1226. },
  1227. {
  1228. siteConfigs: {
  1229. 'hadoop.registry.zk.quorum': 'host1:10,host2:10'
  1230. },
  1231. propertyName: 'hadoop.registry.zk.quorum',
  1232. hostsList: 'host2:10,host1:10',
  1233. e: 'host1:10,host2:10'
  1234. },
  1235. {
  1236. siteConfigs: {
  1237. 'hadoop.registry.zk.quorum': 'host1:10,host2:10,host3:10'
  1238. },
  1239. propertyName: 'hadoop.registry.zk.quorum',
  1240. hostsList: 'host2:10,host1:10',
  1241. e: 'host2:10,host1:10'
  1242. },
  1243. {
  1244. siteConfigs: {
  1245. 'hadoop.registry.zk.quorum': 'host1:10,host2:10,host3:10'
  1246. },
  1247. propertyName: 'hadoop.registry.zk.quorum',
  1248. hostsList: 'host2:10,host1:10,host3:10,host4:11',
  1249. e: 'host2:10,host1:10,host3:10,host4:11'
  1250. },
  1251. {
  1252. siteConfigs: {
  1253. 'hive.zookeeper.quorum': 'host1'
  1254. },
  1255. propertyName: 'some.new.property',
  1256. hostsList: 'host2,host1:10',
  1257. e: 'host2,host1:10'
  1258. }
  1259. ];
  1260. tests.forEach(function(test) {
  1261. it('ZK located on {0}, current prop value is "{1}" "{2}" value should be "{3}"'.format(test.hostsList, ''+test.siteConfigs[test.propertyName], test.propertyName, test.e), function() {
  1262. var result = App.config.updateHostsListValue(test.siteConfigs, test.propertyName, test.hostsList);
  1263. expect(result).to.be.eql(test.e);
  1264. expect(test.siteConfigs[test.propertyName]).to.be.eql(test.e);
  1265. });
  1266. });
  1267. });
  1268. });