stack_service_component_test.js 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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. var modelSetup = require('test/init_model_test');
  20. require('models/stack_service_component');
  21. /**
  22. Component properties template:
  23. {
  24. componentName: 'SUPERVISOR',
  25. expected: {
  26. displayName: 'Supervisor',
  27. minToInstall: 1,
  28. maxToInstall: Infinity,
  29. isRequired: true,
  30. isMultipleAllowed: true,
  31. isSlave: true,
  32. isMaster: false,
  33. isClient: false,
  34. isRestartable: true,
  35. isReassignable: false,
  36. isDeletable: true,
  37. isRollinRestartAllowed: true,
  38. isDecommissionAllowed: false,
  39. isRefreshConfigsAllowed: false,
  40. isAddableToHost: true,
  41. isShownOnInstallerAssignMasterPage: false,
  42. isShownOnInstallerSlaveClientPage: true,
  43. isShownOnAddServiceAssignMasterPage: false,
  44. isMasterWithMultipleInstances: false,
  45. isMasterAddableInstallerWizard: false,
  46. isHAComponentOnly: false,
  47. isRequiredOnAllHosts: false,
  48. isNotPreferableOnAmbariServerHost: false,
  49. defaultNoOfMasterHosts: 1,
  50. coHostedComponents: [],
  51. isOtherComponentCoHosted: false,
  52. isCoHostedComponent: false,
  53. selectionSchemeForMasterComponent: {"else": 0}
  54. }
  55. }
  56. **/
  57. var componentPropertiesValidationTests = [
  58. {
  59. componentName: 'SUPERVISOR',
  60. expected: {
  61. displayName: 'Supervisor',
  62. minToInstall: 1,
  63. maxToInstall: Infinity,
  64. isRequired: true,
  65. isMultipleAllowed: true,
  66. isSlave: true,
  67. isRestartable: true,
  68. isReassignable: false,
  69. isDeletable: true,
  70. isRollinRestartAllowed: true,
  71. isRefreshConfigsAllowed: false,
  72. isAddableToHost: true,
  73. isShownOnInstallerSlaveClientPage: true,
  74. isHAComponentOnly: false,
  75. isRequiredOnAllHosts: false,
  76. isCoHostedComponent: false
  77. }
  78. },
  79. {
  80. componentName: 'ZOOKEEPER_SERVER',
  81. expected: {
  82. minToInstall: 1,
  83. maxToInstall: Infinity,
  84. isRequired: true,
  85. isMultipleAllowed: true,
  86. isMaster: true,
  87. isRestartable: true,
  88. isReassignable: false,
  89. isDeletable: true,
  90. isRollinRestartAllowed: false,
  91. isDecommissionAllowed: false,
  92. isRefreshConfigsAllowed: false,
  93. isAddableToHost: true,
  94. isShownOnInstallerAssignMasterPage: true,
  95. isShownOnInstallerSlaveClientPage: false,
  96. isShownOnAddServiceAssignMasterPage: true,
  97. isMasterWithMultipleInstances: true,
  98. isMasterAddableInstallerWizard: true,
  99. isHAComponentOnly: false,
  100. isRequiredOnAllHosts: false,
  101. isNotPreferableOnAmbariServerHost: false,
  102. defaultNoOfMasterHosts: 3,
  103. coHostedComponents: [],
  104. isOtherComponentCoHosted: false,
  105. isCoHostedComponent: false
  106. }
  107. },
  108. {
  109. componentName: 'APP_TIMELINE_SERVER',
  110. expected: {
  111. displayName: 'App Timeline Server',
  112. minToInstall: 0,
  113. maxToInstall: 1,
  114. isRequired: false,
  115. isMultipleAllowed: false,
  116. isSlave: false,
  117. isMaster: true,
  118. isRestartable: true,
  119. isReassignable: false,
  120. isDeletable: false,
  121. isRollinRestartAllowed: false,
  122. isDecommissionAllowed: false,
  123. isRefreshConfigsAllowed: false,
  124. isAddableToHost: false,
  125. isShownOnInstallerAssignMasterPage: true,
  126. isShownOnInstallerSlaveClientPage: false,
  127. isShownOnAddServiceAssignMasterPage: true,
  128. isMasterWithMultipleInstances: false,
  129. isMasterAddableInstallerWizard: false,
  130. isHAComponentOnly: false,
  131. isRequiredOnAllHosts: false,
  132. isNotPreferableOnAmbariServerHost: false,
  133. coHostedComponents: [],
  134. isOtherComponentCoHosted: false,
  135. isCoHostedComponent: false
  136. }
  137. },
  138. {
  139. componentName: 'GANGLIA_MONITOR',
  140. expected: {
  141. displayName: 'Ganglia Monitor',
  142. minToInstall: Infinity,
  143. maxToInstall: Infinity,
  144. isRequired: true,
  145. isMultipleAllowed: true,
  146. isSlave: true,
  147. isMaster: false,
  148. isRestartable: true,
  149. isReassignable: false,
  150. isDeletable: true,
  151. isRollinRestartAllowed: true,
  152. isDecommissionAllowed: false,
  153. isRefreshConfigsAllowed: false,
  154. isAddableToHost: true,
  155. isShownOnInstallerAssignMasterPage: false,
  156. isShownOnInstallerSlaveClientPage: false,
  157. isShownOnAddServiceAssignMasterPage: false,
  158. isMasterWithMultipleInstances: false,
  159. isMasterAddableInstallerWizard: false,
  160. isHAComponentOnly: false,
  161. isRequiredOnAllHosts: true,
  162. isNotPreferableOnAmbariServerHost: false,
  163. coHostedComponents: [],
  164. isOtherComponentCoHosted: false,
  165. isCoHostedComponent: false
  166. }
  167. },
  168. {
  169. componentName: 'FLUME_HANDLER',
  170. expected: {
  171. displayName: 'Flume',
  172. minToInstall: 0,
  173. maxToInstall: Infinity,
  174. isRequired: false,
  175. isMultipleAllowed: true,
  176. isSlave: true,
  177. isMaster: false,
  178. isRestartable: true,
  179. isReassignable: false,
  180. isDeletable: true,
  181. isRollinRestartAllowed: true,
  182. isDecommissionAllowed: false,
  183. isRefreshConfigsAllowed: true,
  184. isAddableToHost: true,
  185. isShownOnInstallerAssignMasterPage: false,
  186. isShownOnInstallerSlaveClientPage: true,
  187. isShownOnAddServiceAssignMasterPage: false,
  188. isMasterWithMultipleInstances: false,
  189. isMasterAddableInstallerWizard: false,
  190. isHAComponentOnly: false,
  191. isRequiredOnAllHosts: false,
  192. isNotPreferableOnAmbariServerHost: false,
  193. coHostedComponents: [],
  194. isOtherComponentCoHosted: false,
  195. isCoHostedComponent: false
  196. }
  197. },
  198. {
  199. componentName: 'HIVE_METASTORE',
  200. expected: {
  201. displayName: 'Hive Metastore',
  202. minToInstall: 1,
  203. maxToInstall: 1,
  204. isRequired: true,
  205. isMultipleAllowed: false,
  206. isSlave: false,
  207. isMaster: true,
  208. isRestartable: true,
  209. isReassignable: false,
  210. isDeletable: false,
  211. isRollinRestartAllowed: false,
  212. isDecommissionAllowed: false,
  213. isRefreshConfigsAllowed: false,
  214. isAddableToHost: false,
  215. isShownOnInstallerAssignMasterPage: true,
  216. isShownOnInstallerSlaveClientPage: false,
  217. isShownOnAddServiceAssignMasterPage: true,
  218. isMasterWithMultipleInstances: false,
  219. isMasterAddableInstallerWizard: false,
  220. isHAComponentOnly: false,
  221. isRequiredOnAllHosts: false,
  222. isNotPreferableOnAmbariServerHost: false,
  223. coHostedComponents: [],
  224. isOtherComponentCoHosted: false,
  225. isCoHostedComponent: true
  226. }
  227. },
  228. {
  229. componentName: 'HIVE_SERVER',
  230. expected: {
  231. displayName: 'HiveServer2',
  232. minToInstall: 1,
  233. maxToInstall: 1,
  234. isRequired: true,
  235. isMultipleAllowed: false,
  236. isSlave: false,
  237. isMaster: true,
  238. isRestartable: true,
  239. isReassignable: false,
  240. isDeletable: false,
  241. isRollinRestartAllowed: false,
  242. isDecommissionAllowed: false,
  243. isRefreshConfigsAllowed: false,
  244. isAddableToHost: false,
  245. isShownOnInstallerAssignMasterPage: true,
  246. isShownOnInstallerSlaveClientPage: false,
  247. isShownOnAddServiceAssignMasterPage: true,
  248. isMasterWithMultipleInstances: false,
  249. isMasterAddableInstallerWizard: false,
  250. isHAComponentOnly: false,
  251. isRequiredOnAllHosts: false,
  252. isNotPreferableOnAmbariServerHost: false,
  253. coHostedComponents: ['HIVE_METASTORE','WEBHCAT_SERVER'],
  254. isOtherComponentCoHosted: true,
  255. isCoHostedComponent: false
  256. }
  257. },
  258. {
  259. componentName: 'DATANODE',
  260. expected: {
  261. displayName: 'DataNode',
  262. minToInstall: 1,
  263. maxToInstall: Infinity,
  264. isRequired: true,
  265. isMultipleAllowed: true,
  266. isSlave: true,
  267. isMaster: false,
  268. isRestartable: true,
  269. isReassignable: false,
  270. isDeletable: true,
  271. isRollinRestartAllowed: true,
  272. isDecommissionAllowed: true,
  273. isRefreshConfigsAllowed: false,
  274. isAddableToHost: true,
  275. isShownOnInstallerAssignMasterPage: false,
  276. isShownOnInstallerSlaveClientPage: true,
  277. isShownOnAddServiceAssignMasterPage: false,
  278. isMasterWithMultipleInstances: false,
  279. isMasterAddableInstallerWizard: false,
  280. isHAComponentOnly: false,
  281. isRequiredOnAllHosts: false,
  282. isNotPreferableOnAmbariServerHost: false,
  283. coHostedComponents: [],
  284. isOtherComponentCoHosted: false,
  285. isCoHostedComponent: false
  286. }
  287. }
  288. ];
  289. describe('App.StackServiceComponent', function() {
  290. before(function() {
  291. modelSetup.setupStackServiceComponent();
  292. });
  293. describe('component properties validation', function() {
  294. componentPropertiesValidationTests.forEach(function(test) {
  295. describe('properties validation for ' + test.componentName + ' component', function() {
  296. var component = App.StackServiceComponent.find(test.componentName);
  297. var properties = Em.keys(test.expected);
  298. properties.forEach(function(property) {
  299. it('#{0} should be {1}'.format(property, JSON.stringify(test.expected[property])), function() {
  300. expect(component.get(property)).to.be.eql(test.expected[property]);
  301. })
  302. });
  303. });
  304. });
  305. });
  306. after(function() {
  307. modelSetup.cleanStackServiceComponent();
  308. });
  309. });