step14_test.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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('utils/config');
  20. require('controllers/wizard/step14_controller');
  21. describe('App.WizardStep14Controller', function() {
  22. var tasks = [
  23. Em.Object.create({status:''}),
  24. Em.Object.create({status:''}),
  25. Em.Object.create({status:''}),
  26. Em.Object.create({status:''}),
  27. Em.Object.create({status:''}),
  28. Em.Object.create({status:''}),
  29. Em.Object.create({status:''}),
  30. Em.Object.create({status:''})
  31. ];
  32. var tests = [
  33. {
  34. m: 'onStopServiceBeforeSend',
  35. t: 0,
  36. s: 'PENDING'
  37. },
  38. {
  39. m: 'onStopServiceError',
  40. t: 0,
  41. s: 'FAILED'
  42. },
  43. {
  44. m: 'onCreateMasterComponentBeforeSend',
  45. t: 1,
  46. s: 'PENDING'
  47. },
  48. {
  49. m: 'onCreateMasterComponentSuccess',
  50. t: 1,
  51. s: 'COMPLETED'
  52. },
  53. {
  54. m: 'onCreateMasterComponentError',
  55. t: 1,
  56. s: 'FAILED'
  57. },
  58. {
  59. m: 'onCreateConfigsError',
  60. t: 2,
  61. s: 'FAILED'
  62. },
  63. {
  64. m: 'onCheckConfigsError',
  65. t: 3,
  66. s: 'FAILED'
  67. },
  68. {
  69. m: 'onApplyConfigsSuccess',
  70. t: 3,
  71. s: 'COMPLETED'
  72. },
  73. {
  74. m: 'onApplyConfigsError',
  75. t: 3,
  76. s: 'FAILED'
  77. },
  78. {
  79. m: 'onPutInMaintenanceModeBeforeSend',
  80. t: 4,
  81. s: 'PENDING'
  82. },
  83. {
  84. m: 'onPutInMaintenanceModeSuccess',
  85. t: 4,
  86. s: 'COMPLETED'
  87. },
  88. {
  89. m: 'onPutInMaintenanceModeError',
  90. t: 4,
  91. s: 'FAILED'
  92. },
  93. {
  94. m: 'onInstallComponentBeforeSend',
  95. t: 5,
  96. s: 'PENDING'
  97. },
  98. {
  99. m: 'onInstallComponentError',
  100. t: 5,
  101. s: 'FAILED'
  102. },
  103. {
  104. m: 'onStartComponentsBeforeSend',
  105. t: 6,
  106. s: 'PENDING'
  107. },
  108. {
  109. m: 'onStartComponentsError',
  110. t: 6,
  111. s: 'FAILED'
  112. },
  113. {
  114. m: 'onRemoveComponentBeforeSend',
  115. t: 7,
  116. s: 'PENDING'
  117. },
  118. {
  119. m: 'onRemoveComponentSuccess',
  120. t: 7,
  121. s: 'COMPLETED'
  122. },
  123. {
  124. m: 'onRemoveComponentError',
  125. t: 7,
  126. s: 'FAILED'
  127. }
  128. ];
  129. tests.forEach(function(test) {
  130. describe('#' + test.m, function() {
  131. it('Task #'+test.t+' should be '+test.s, function() {
  132. var wizardStep14Controller = App.WizardStep14Controller.create();
  133. wizardStep14Controller.set('tasks', tasks);
  134. wizardStep14Controller[test.m]();
  135. expect(wizardStep14Controller.get('tasks')[test.t].get('status')).to.equal(test.s);
  136. });
  137. });
  138. });
  139. describe('#onGetLogsByRequestError', function() {
  140. it('', function() {
  141. var wizardStep14Controller = App.WizardStep14Controller.create();
  142. wizardStep14Controller.onGetLogsByRequestError();
  143. expect(wizardStep14Controller.get('status')).to.equal('FAILED');
  144. });
  145. });
  146. });