stack_service_component_test.js 9.5 KB

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