stack_service_component_test.js 9.9 KB

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