service_test.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  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('controllers/main/service');
  20. var testHelpers = require('test/helpers');
  21. var mainServiceController;
  22. function getController() {
  23. return App.MainServiceController.create({});
  24. }
  25. describe('App.MainServiceController', function () {
  26. var tests = Em.A([
  27. {
  28. isStartStopAllClicked: true,
  29. content: Em.A([
  30. Em.Object.create({
  31. healthStatus: 'red',
  32. serviceName: 'HIVE',
  33. isClientsOnly: false
  34. }),
  35. Em.Object.create({
  36. healthStatus: 'red',
  37. serviceName: 'HDFS',
  38. isClientsOnly: false
  39. }),
  40. Em.Object.create({
  41. healthStatus: 'red',
  42. serviceName: 'TEZ',
  43. isClientsOnly: true
  44. })
  45. ]),
  46. eStart: true,
  47. eStop: true,
  48. mStart: 'mainServiceController StartAll is Disabled 2',
  49. mStop: 'mainServiceController StopAll is Disabled 2'
  50. },
  51. {
  52. isStartStopAllClicked: false,
  53. content: Em.A([
  54. Em.Object.create({
  55. healthStatus: 'green',
  56. serviceName: 'HIVE',
  57. isClientsOnly: false
  58. }),
  59. Em.Object.create({
  60. healthStatus: 'red',
  61. serviceName: 'HDFS',
  62. isClientsOnly: false
  63. }),
  64. Em.Object.create({
  65. healthStatus: 'red',
  66. serviceName: 'TEZ',
  67. isClientsOnly: true
  68. })
  69. ]),
  70. eStart: false,
  71. eStop: false,
  72. mStart: 'mainServiceController StartAll is Enabled 3',
  73. mStop: 'mainServiceController StopAll is Enabled 3'
  74. }
  75. ]);
  76. beforeEach(function() {
  77. mainServiceController = getController();
  78. });
  79. afterEach(function () {
  80. mainServiceController.destroy();
  81. });
  82. App.TestAliases.testAsComputedNotEqual(getController(), 'isStartStopAllClicked', 'App.router.backgroundOperationsController.allOperationsCount', 0);
  83. describe('#isStartAllDisabled', function () {
  84. tests.forEach(function (test) {
  85. it(test.mStart, function () {
  86. mainServiceController = App.MainServiceController.create({
  87. content: test.content,
  88. isStartStopAllClicked: test.isStartStopAllClicked
  89. });
  90. expect(mainServiceController.get('isStartAllDisabled')).to.equals(test.eStart);
  91. });
  92. });
  93. });
  94. describe('#isStopAllDisabled', function () {
  95. tests.forEach(function (test) {
  96. it(test.mStop, function () {
  97. mainServiceController = App.MainServiceController.create({
  98. content: test.content,
  99. isStartStopAllClicked: test.isStartStopAllClicked
  100. });
  101. expect(mainServiceController.get('isStopAllDisabled')).to.equals(test.eStop);
  102. });
  103. });
  104. });
  105. describe("#isAllServicesInstalled", function() {
  106. beforeEach(function() {
  107. this.mock = sinon.stub(App.ServiceSimple, 'find');
  108. });
  109. afterEach(function() {
  110. App.ServiceSimple.find.restore();
  111. });
  112. it("content is null", function() {
  113. mainServiceController.reopen({
  114. 'content': null
  115. });
  116. this.mock.returns([]);
  117. mainServiceController.propertyDidChange('isAllServicesInstalled');
  118. expect(mainServiceController.get('isAllServicesInstalled')).to.be.false;
  119. });
  120. it("content is empty", function() {
  121. mainServiceController.reopen({
  122. 'content': []
  123. });
  124. this.mock.returns([
  125. {serviceName: 'S1', doNotShowAndInstall: false}
  126. ]);
  127. mainServiceController.propertyDidChange('isAllServicesInstalled');
  128. expect(mainServiceController.get('isAllServicesInstalled')).to.be.false;
  129. });
  130. it("content match stack services", function() {
  131. mainServiceController.reopen({
  132. 'content': [Em.Object.create({serviceName: 'S1'})]
  133. });
  134. this.mock.returns([
  135. {serviceName: 'S1', doNotShowAndInstall: false}
  136. ]);
  137. mainServiceController.propertyDidChange('isAllServicesInstalled');
  138. expect(mainServiceController.get('isAllServicesInstalled')).to.be.true;
  139. });
  140. it("content doesn't match stack services", function() {
  141. mainServiceController.reopen({
  142. 'content': [Em.Object.create({serviceName: 'S1'})]
  143. });
  144. this.mock.returns([
  145. {serviceName: 'S1', doNotShowAndInstall: false},
  146. {serviceName: 'S1', doNotShowAndInstall: false}
  147. ]);
  148. mainServiceController.propertyDidChange('isAllServicesInstalled');
  149. expect(mainServiceController.get('isAllServicesInstalled')).to.be.false;
  150. });
  151. });
  152. describe('#cluster', function() {
  153. Em.A([
  154. {
  155. isLoaded: true,
  156. cluster: [],
  157. m: 'cluster is loaded',
  158. e: {name: 'c1'}
  159. },
  160. {
  161. isLoaded: false,
  162. cluster: [],
  163. m: 'cluster is not loaded',
  164. e: null
  165. }
  166. ]).forEach(function(test) {
  167. describe(test.m, function() {
  168. beforeEach(function () {
  169. sinon.stub(App.router, 'get', function(k) {
  170. if ('clusterController.isClusterDataLoaded' === k) return test.isLoaded;
  171. return Em.get(App.router, k);
  172. });
  173. sinon.stub(App.Cluster, 'find', function() {
  174. return [test.e];
  175. });
  176. });
  177. afterEach(function () {
  178. App.router.get.restore();
  179. App.Cluster.find.restore();
  180. });
  181. it('cluster is valid', function () {
  182. var c = mainServiceController.get('cluster');
  183. expect(c).to.eql(test.e);
  184. });
  185. });
  186. });
  187. });
  188. describe('#startAllService', function() {
  189. beforeEach(function() {
  190. sinon.stub(mainServiceController, 'allServicesCall', Em.K);
  191. });
  192. afterEach(function() {
  193. mainServiceController.allServicesCall.restore();
  194. });
  195. it('target is disabled', function() {
  196. var event = {target: {className: 'disabled', nodeType: 1}};
  197. var r = mainServiceController.startAllService(event);
  198. expect(r).to.be.null;
  199. });
  200. it('parent is disabled', function() {
  201. var event = {target: {parentElement: {className: 'disabled', nodeType: 1}}};
  202. var r = mainServiceController.startAllService(event);
  203. expect(r).to.be.null;
  204. });
  205. });
  206. describe('#stopAllService', function() {
  207. beforeEach(function() {
  208. sinon.stub(mainServiceController, 'allServicesCall', Em.K);
  209. });
  210. afterEach(function() {
  211. mainServiceController.allServicesCall.restore();
  212. });
  213. it('target is disabled', function() {
  214. var event = {target: {className: 'disabled', nodeType: 1}};
  215. var r = mainServiceController.stopAllService(event);
  216. expect(r).to.be.null;
  217. });
  218. it('parent is disabled', function() {
  219. var event = {target: {parentElement: {className: 'disabled', nodeType: 1}}};
  220. var r = mainServiceController.stopAllService(event);
  221. expect(r).to.be.null;
  222. });
  223. });
  224. describe('#startStopAllService', function() {
  225. var event = { target: document.createElement("BUTTON") };
  226. beforeEach(function() {
  227. sinon.stub(mainServiceController, 'allServicesCall', Em.K);
  228. sinon.spy(Em.I18n, "t");
  229. });
  230. afterEach(function() {
  231. mainServiceController.allServicesCall.restore();
  232. Em.I18n.t.restore();
  233. });
  234. it ("should confirm stop if state is INSTALLED", function() {
  235. mainServiceController.startStopAllService(event, "INSTALLED");
  236. expect(Em.I18n.t.calledWith('services.service.stopAll.confirmMsg')).to.be.ok;
  237. expect(Em.I18n.t.calledWith('services.service.stop.confirmButton')).to.be.ok;
  238. });
  239. describe("should check last checkpoint for NN before confirming stop", function() {
  240. var mainServiceItemController;
  241. beforeEach(function() {
  242. mainServiceItemController = App.MainServiceItemController.create({});
  243. sinon.stub(mainServiceItemController, 'checkNnLastCheckpointTime', function() {
  244. return true;
  245. });
  246. sinon.stub(App.router, 'get', function(k) {
  247. if ('mainServiceItemController' === k) {
  248. return mainServiceItemController;
  249. }
  250. return Em.get(App.router, k);
  251. });
  252. sinon.stub(App.Service, 'find', function() {
  253. return [{
  254. serviceName: "HDFS",
  255. workStatus: "STARTED"
  256. }];
  257. });
  258. });
  259. afterEach(function () {
  260. mainServiceItemController.checkNnLastCheckpointTime.restore();
  261. App.router.get.restore();
  262. App.Service.find.restore();
  263. });
  264. it('checkNnLastCheckpointTime is called once', function () {
  265. mainServiceController.startStopAllService(event, "INSTALLED");
  266. expect(mainServiceItemController.checkNnLastCheckpointTime.calledOnce).to.equal(true);
  267. });
  268. });
  269. it ("should confirm start if state is not INSTALLED", function() {
  270. mainServiceController.startStopAllService(event, "STARTED");
  271. expect(Em.I18n.t.calledWith('services.service.startAll.confirmMsg')).to.be.ok;
  272. expect(Em.I18n.t.calledWith('services.service.start.confirmButton')).to.be.ok;
  273. });
  274. });
  275. describe('#allServicesCall', function() {
  276. var state = 'STARTED',
  277. query = 'some query';
  278. beforeEach(function() {
  279. sinon.stub(App, 'get', function(k) {
  280. if ('clusterName' === k) return 'tdk';
  281. return Em.get(App, k);
  282. });
  283. mainServiceController.allServicesCall(state, query);
  284. var args = testHelpers.findAjaxRequest('name', 'common.services.update');
  285. this.params = App.ajax.fakeGetUrl('common.services.update').format(args[0].data);
  286. this.data = JSON.parse(this.params.data);
  287. });
  288. afterEach(function() {
  289. App.get.restore();
  290. });
  291. it('PUT request is sent', function() {
  292. expect(this.params.type).to.equal('PUT');
  293. });
  294. it('Body.ServiceInfo.state is ' + state, function() {
  295. expect(this.data.Body.ServiceInfo.state).to.equal(state);
  296. });
  297. it('RequestInfo.context is ' + query, function() {
  298. expect(this.data.RequestInfo.context).to.equal(App.BackgroundOperationsController.CommandContexts.START_ALL_SERVICES);
  299. });
  300. });
  301. describe('#allServicesCallErrorCallback', function() {
  302. it('should set status to FAIL', function() {
  303. var params = {query: Em.Object.create({status: ''})};
  304. mainServiceController.allServicesCallErrorCallback({}, {}, '', {}, params);
  305. expect(params.query.get('status')).to.equal('FAIL');
  306. });
  307. });
  308. describe('#gotoAddService', function() {
  309. beforeEach(function() {
  310. sinon.stub(App.router, 'transitionTo', Em.K);
  311. });
  312. afterEach(function() {
  313. App.router.transitionTo.restore();
  314. });
  315. it('should not go to wizard', function() {
  316. mainServiceController.reopen({isAllServicesInstalled: true});
  317. mainServiceController.gotoAddService();
  318. expect(App.router.transitionTo.called).to.be.false;
  319. });
  320. it('should go to wizard', function() {
  321. mainServiceController.reopen({isAllServicesInstalled: false});
  322. mainServiceController.gotoAddService();
  323. expect(App.router.transitionTo.calledWith('main.serviceAdd')).to.be.true;
  324. });
  325. });
  326. App.TestAliases.testAsComputedEveryBy(getController(), 'isRestartAllRequiredDisabled', 'content', 'isRestartRequired', false);
  327. describe('#restartAllRequired', function () {
  328. beforeEach(function () {
  329. sinon.spy(App, 'showConfirmationPopup');
  330. sinon.spy(mainServiceController, 'restartHostComponents');
  331. sinon.stub(App.HostComponent, 'find', function() {
  332. return [
  333. Em.Object.create({
  334. componentName: 'componentName1',
  335. hostName: 'hostName1',
  336. service: {
  337. serviceName: 'serviceName1',
  338. displayName: 'displayName1'
  339. },
  340. staleConfigs: true
  341. }),
  342. Em.Object.create({
  343. componentName: 'componentName2',
  344. hostName: 'hostName2',
  345. service: {
  346. serviceName: 'serviceName2',
  347. displayName: 'displayName2'
  348. },
  349. staleConfigs: true
  350. }),
  351. Em.Object.create({
  352. componentName: 'componentName3',
  353. hostName: 'hostName3',
  354. service: {
  355. serviceName: 'serviceName3',
  356. displayName: 'displayName3'
  357. },
  358. staleConfigs: false
  359. })
  360. ];
  361. });
  362. });
  363. afterEach(function () {
  364. App.HostComponent.find.restore();
  365. App.showConfirmationPopup.restore();
  366. mainServiceController.restartHostComponents.restore();
  367. });
  368. it('should show confirmation popup with list of services and call restartHostComponents after confirmation', function () {
  369. var popup;
  370. mainServiceController.reopen({
  371. isRestartAllRequiredDisabled: false
  372. });
  373. popup = mainServiceController.restartAllRequired();
  374. popup.onPrimary();
  375. expect(App.showConfirmationPopup.args[0][1]).to.equal(Em.I18n.t('services.service.refreshAll.confirmMsg').format('displayName1, displayName2'));
  376. expect(mainServiceController.restartHostComponents.calledOnce).to.be.true;
  377. });
  378. it('should not open popup if isRestartAllRequiredDisabled is true', function(){
  379. mainServiceController.reopen({
  380. isRestartAllRequiredDisabled: true
  381. });
  382. expect(mainServiceController.restartAllRequired()).to.be.null;
  383. });
  384. });
  385. describe("#restartAllServices()", function() {
  386. beforeEach(function() {
  387. sinon.stub(mainServiceController, 'silentStopAllServices');
  388. });
  389. afterEach(function() {
  390. mainServiceController.silentStopAllServices.restore();
  391. });
  392. it("silentStopAllServices should be called", function() {
  393. mainServiceController.restartAllServices();
  394. expect(mainServiceController.silentStopAllServices.calledOnce).to.be.true;
  395. });
  396. });
  397. describe("#silentStopAllServices()", function() {
  398. it("App.ajax.send should be called", function() {
  399. mainServiceController.silentStopAllServices();
  400. var args = testHelpers.filterAjaxRequests('name', 'common.services.update');
  401. expect(args[0][0]).to.eql({
  402. name: 'common.services.update',
  403. sender: mainServiceController,
  404. data: {
  405. context: App.BackgroundOperationsController.CommandContexts.STOP_ALL_SERVICES,
  406. ServiceInfo: {
  407. state: 'INSTALLED'
  408. }
  409. },
  410. success: 'silentStopSuccess'
  411. });
  412. });
  413. });
  414. describe("#isStopAllServicesFailed()", function() {
  415. beforeEach(function() {
  416. this.mock = sinon.stub(App.Service, 'find');
  417. });
  418. afterEach(function() {
  419. this.mock.restore();
  420. });
  421. it("one INSTALLED service", function() {
  422. this.mock.returns([
  423. Em.Object.create({workStatus: 'INSTALLED'})
  424. ]);
  425. expect(mainServiceController.isStopAllServicesFailed()).to.be.false;
  426. });
  427. it("one STOPPING service", function() {
  428. this.mock.returns([
  429. Em.Object.create({workStatus: 'STOPPING'})
  430. ]);
  431. expect(mainServiceController.isStopAllServicesFailed()).to.be.false;
  432. });
  433. it("one STARTED service and one INSTALLED", function() {
  434. this.mock.returns([
  435. Em.Object.create({workStatus: 'STARTED'}),
  436. Em.Object.create({workStatus: 'INSTALLED'})
  437. ]);
  438. expect(mainServiceController.isStopAllServicesFailed()).to.be.true;
  439. });
  440. it("one STARTED service", function() {
  441. this.mock.returns([
  442. Em.Object.create({workStatus: 'STARTED'})
  443. ]);
  444. expect(mainServiceController.isStopAllServicesFailed()).to.be.true;
  445. });
  446. });
  447. describe("#silentStopSuccess()", function() {
  448. var mock = {
  449. dataLoading: function() {
  450. return {
  451. done: function(callback) {
  452. callback(true);
  453. }
  454. }
  455. },
  456. showPopup: Em.K
  457. };
  458. beforeEach(function() {
  459. sinon.stub(App.router, 'get').returns(mock);
  460. sinon.stub(Em.run, 'later', Em.clb);
  461. sinon.spy(mock, 'showPopup');
  462. sinon.stub(mainServiceController, 'silentStartAllServices');
  463. mainServiceController.silentStopSuccess();
  464. });
  465. afterEach(function() {
  466. App.router.get.restore();
  467. Em.run.later.restore();
  468. mock.showPopup.restore();
  469. mainServiceController.silentStartAllServices.restore();
  470. });
  471. it("showPopup should be called", function() {
  472. expect(mock.showPopup.calledOnce).to.be.true;
  473. });
  474. it("Em.run.later should be called", function() {
  475. expect(Em.run.later.calledOnce).to.be.true;
  476. expect(mainServiceController.get('shouldStart')).to.be.true;
  477. });
  478. });
  479. describe("#silentStartAllServices()", function() {
  480. beforeEach(function() {
  481. this.mockRouter = sinon.stub(App.router, 'get');
  482. this.mock = sinon.stub(mainServiceController, 'isStopAllServicesFailed');
  483. mainServiceController.removeObserver('shouldStart', mainServiceController, 'silentStartAllServices');
  484. });
  485. afterEach(function() {
  486. this.mockRouter.restore();
  487. this.mock.restore();
  488. });
  489. it("allOperationsCount is 1", function() {
  490. this.mockRouter.returns(Em.Object.create({
  491. allOperationsCount: 1
  492. }));
  493. mainServiceController.silentStartAllServices();
  494. expect(testHelpers.findAjaxRequest('name', 'common.services.update')).to.be.undefined;
  495. });
  496. it("shouldStart is false", function() {
  497. this.mockRouter.returns(Em.Object.create({
  498. allOperationsCount: 0
  499. }));
  500. mainServiceController.set('shouldStart', false);
  501. mainServiceController.silentStartAllServices();
  502. expect(testHelpers.findAjaxRequest('name', 'common.services.update')).to.be.undefined;
  503. });
  504. it("isStopAllServicesFailed returns true", function() {
  505. this.mockRouter.returns(Em.Object.create({
  506. allOperationsCount: 0
  507. }));
  508. mainServiceController.set('shouldStart', true);
  509. this.mock.returns(true);
  510. mainServiceController.silentStartAllServices();
  511. expect(testHelpers.findAjaxRequest('name', 'common.services.update')).to.be.undefined;
  512. });
  513. it("App.ajax.send should be called", function() {
  514. this.mockRouter.returns(Em.Object.create({
  515. allOperationsCount: 0
  516. }));
  517. mainServiceController.set('shouldStart', true);
  518. this.mock.returns(false);
  519. mainServiceController.silentStartAllServices();
  520. var args = testHelpers.filterAjaxRequests('name', 'common.services.update');
  521. expect(args[0][0]).to.be.eql({
  522. name: 'common.services.update',
  523. sender: mainServiceController,
  524. data: {
  525. context: App.BackgroundOperationsController.CommandContexts.START_ALL_SERVICES,
  526. ServiceInfo: {
  527. state: 'STARTED'
  528. }
  529. },
  530. success: 'silentCallSuccessCallback'
  531. });
  532. expect(mainServiceController.get('shouldStart')).to.be.false;
  533. });
  534. });
  535. describe("#silentCallSuccessCallback()", function () {
  536. var mock = {
  537. dataLoading: function () {
  538. return {
  539. done: function (callback) {
  540. callback(true);
  541. }
  542. }
  543. },
  544. showPopup: Em.K
  545. };
  546. beforeEach(function () {
  547. sinon.stub(App.router, 'get').returns(mock);
  548. sinon.spy(mock, 'showPopup');
  549. });
  550. afterEach(function () {
  551. App.router.get.restore();
  552. mock.showPopup.restore();
  553. });
  554. it("showPopup should be called", function () {
  555. mainServiceController.silentCallSuccessCallback();
  556. expect(mock.showPopup.calledOnce).to.be.true;
  557. });
  558. });
  559. describe("#allServicesCallSuccessCallback()", function () {
  560. var mock = {
  561. dataLoading: function () {
  562. return {
  563. done: function (callback) {
  564. callback(true);
  565. }
  566. }
  567. },
  568. showPopup: Em.K
  569. };
  570. beforeEach(function () {
  571. sinon.stub(App.router, 'get').returns(mock);
  572. sinon.spy(mock, 'showPopup');
  573. });
  574. afterEach(function () {
  575. App.router.get.restore();
  576. mock.showPopup.restore();
  577. });
  578. it("showPopup should be called", function () {
  579. var params = {
  580. query: Em.Object.create()
  581. };
  582. mainServiceController.allServicesCallSuccessCallback({}, {}, params);
  583. expect(mock.showPopup.calledOnce).to.be.true;
  584. expect(params.query.get('status')).to.be.equal('SUCCESS');
  585. });
  586. });
  587. describe("#restartAllRequiredSuccessCallback()", function () {
  588. var mock = {
  589. dataLoading: function () {
  590. return {
  591. done: function (callback) {
  592. callback(true);
  593. }
  594. }
  595. },
  596. showPopup: Em.K
  597. };
  598. beforeEach(function () {
  599. sinon.stub(App.router, 'get').returns(mock);
  600. sinon.spy(mock, 'showPopup');
  601. });
  602. afterEach(function () {
  603. App.router.get.restore();
  604. mock.showPopup.restore();
  605. });
  606. it("showPopup should be called", function () {
  607. mainServiceController.restartAllRequiredSuccessCallback();
  608. expect(mock.showPopup.calledOnce).to.be.true;
  609. });
  610. });
  611. describe('#restartHostComponents', function () {
  612. beforeEach(function () {
  613. this.mock = sinon.stub(App.HostComponent, 'find');
  614. });
  615. afterEach(function () {
  616. App.HostComponent.find.restore();
  617. });
  618. it('should make batch request to refresh YARN queues', function () {
  619. this.mock.returns([Em.Object.create({componentName: 'HIVE_SERVER_INTERACTIVE', staleConfigs: true}), Em.Object.create({componentName: 'RESOURCEMANAGER', staleConfigs: false})]);
  620. mainServiceController.restartHostComponents();
  621. expect(testHelpers.findAjaxRequest('name', 'common.batch.request_schedules')).not.to.be.undefined;
  622. });
  623. it('should make single request without refresh YARN queues', function () {
  624. this.mock.returns([Em.Object.create({componentName: 'HIVE_SERVER_INTERACTIVE', staleConfigs: false}), Em.Object.create({componentName: 'RESOURCEMANAGER', staleConfigs: false})]);
  625. mainServiceController.restartHostComponents();
  626. expect(testHelpers.findAjaxRequest('name', 'request.post')).not.to.be.undefined;
  627. });
  628. });
  629. });