admin_test.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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('models/service');
  20. require('models/host_component');
  21. require('controllers/main/admin');
  22. describe('MainAdminController', function () {
  23. var controller = App.MainAdminController.create();
  24. describe('#isAccessAvailable()', function () {
  25. beforeEach(function () {
  26. Em.propertyDidChange(controller, 'isAccessAvailable');
  27. });
  28. it('Services do not match dependencies', function () {
  29. App.Service.find().clear();
  30. App.store.load(App.Service, {
  31. id: 'HDFS',
  32. service_name: 'HDFS'
  33. });
  34. expect(controller.get("isAccessAvailable")).to.be.false;
  35. });
  36. it('APP_TIMELINE_SERVER is absent', function () {
  37. App.Service.find().clear();
  38. App.HostComponent.find().clear();
  39. expect(controller.get("isAccessAvailable")).to.be.false;
  40. });
  41. it('Only one YARN service installed', function () {
  42. App.store.load(App.Service, {
  43. id: 'YARN',
  44. service_name: 'YARN'
  45. });
  46. expect(controller.get("isAccessAvailable")).to.be.false;
  47. });
  48. it('TEZ and YARN services installed', function () {
  49. App.store.load(App.Service, {
  50. id: 'TEZ',
  51. service_name: 'TEZ'
  52. });
  53. expect(controller.get("isAccessAvailable")).to.be.false;
  54. });
  55. it('TEZ and YARN services, APP_TIMELINE_SERVER component installed', function () {
  56. App.store.load(App.HostComponent, {
  57. id: 'APP_TIMELINE_SERVER_host1',
  58. component_name: 'APP_TIMELINE_SERVER'
  59. });
  60. expect(controller.get("isAccessAvailable")).to.be.true;
  61. });
  62. });
  63. });