ajax.js 72 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302
  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. /**
  20. * Config for each ajax-request
  21. *
  22. * Fields example:
  23. * mock - testMode url
  24. * real - real url (without API prefix)
  25. * type - request type (also may be defined in the format method)
  26. * format - function for processing ajax params after default formatRequest. May be called with one or two parameters (data, opt). Return ajax-params object
  27. * testInProduction - can this request be executed on production tests (used only in tests)
  28. *
  29. * @type {Object}
  30. */
  31. var urls = {
  32. 'alerts.get_by_service': {
  33. 'real': '/clusters/{clusterName}/services/{serviceName}?fields=alerts',
  34. 'mock': '/data/alerts/HDP2/service_alerts.json'
  35. },
  36. 'alerts.get_by_host': {
  37. 'real': '/clusters/{clusterName}/hosts/{hostName}?fields=alerts',
  38. 'mock': '/data/alerts/HDP2/host_alerts.json'
  39. },
  40. 'background_operations.get_most_recent': {
  41. 'real': '/clusters/{clusterName}/requests?to=end&page_size=10&fields=Requests',
  42. 'mock': '/data/background_operations/list_on_start.json',
  43. 'testInProduction': true
  44. },
  45. 'background_operations.get_by_request': {
  46. 'real': '/clusters/{clusterName}/requests/{requestId}?fields=*,tasks/Tasks/command,tasks/Tasks/command_detail,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/exit_code,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,tasks/Tasks/status&minimal_response=true',
  47. 'mock': '/data/background_operations/task_by_request{requestId}.json',
  48. 'testInProduction': true,
  49. 'format': function (data) {
  50. return {
  51. async: !data.sync
  52. };
  53. }
  54. },
  55. 'background_operations.get_by_task': {
  56. 'real': '/clusters/{clusterName}/requests/{requestId}/tasks/{taskId}',
  57. 'mock': '/data/background_operations/list_on_start.json',
  58. 'testInProduction': true,
  59. 'format': function (data) {
  60. return {
  61. async: !data.sync
  62. };
  63. }
  64. },
  65. 'service.item.start_stop': {
  66. 'real': '/clusters/{clusterName}/services/{serviceName}',
  67. 'mock': '/data/wizard/deploy/poll_1.json',
  68. 'format': function (data) {
  69. return {
  70. type: 'PUT',
  71. data: JSON.stringify({
  72. RequestInfo: {
  73. "context": data.requestInfo
  74. },
  75. Body: {
  76. ServiceInfo: {
  77. state: data.state
  78. }
  79. }
  80. })
  81. };
  82. }
  83. },
  84. 'service.item.smoke': {
  85. 'real': '/clusters/{clusterName}/requests',
  86. 'mock': '/data/wizard/deploy/poll_1.json',
  87. 'format': function (data) {
  88. return {
  89. 'type': 'POST',
  90. data: JSON.stringify({
  91. "RequestInfo": {
  92. "context": data.displayName + " Service Check",
  93. "command" : data.actionName
  94. },
  95. "Requests/resource_filters": [{"service_name" : data.serviceName}]
  96. })
  97. };
  98. }
  99. },
  100. 'service.item.passive': {
  101. 'real': '/clusters/{clusterName}/services/{serviceName}',
  102. 'mock': '',
  103. 'format': function (data) {
  104. return {
  105. type: 'PUT',
  106. data: JSON.stringify({
  107. RequestInfo: {
  108. "context": data.requestInfo
  109. },
  110. Body: {
  111. ServiceInfo: {
  112. maintenance_state: data.passive_state
  113. }
  114. }
  115. })
  116. };
  117. }
  118. },
  119. 'service.stale_host_components.start_stop': {
  120. 'real': '/clusters/{clusterName}/host_components?' +
  121. 'HostRoles/stale_configs=true&HostRoles/component_name.in({componentNames})',
  122. 'mock': '/data/wizard/deploy/poll_1.json',
  123. 'format': function (data) {
  124. return {
  125. type: 'PUT',
  126. data: JSON.stringify({
  127. RequestInfo: {
  128. "context": data.requestInfo
  129. },
  130. Body: {
  131. HostRoles: {
  132. state: data.state
  133. }
  134. }
  135. })
  136. };
  137. }
  138. },
  139. 'service.load_config_groups': {
  140. 'real': '/clusters/{clusterName}/config_groups?ConfigGroup/tag={serviceName}&fields=*',
  141. 'mock': '/data/configurations/config_group.json'
  142. },
  143. 'service.flume.agent.command': {
  144. 'real': '/clusters/{clusterName}/hosts/{host}/host_components/FLUME_HANDLER',
  145. 'mock': '',
  146. 'format': function (data) {
  147. return {
  148. type: 'PUT',
  149. data: JSON.stringify({
  150. "RequestInfo": {
  151. "context": data.context,
  152. "flume_handler": data.agentName
  153. },
  154. "Body": {
  155. "HostRoles": {
  156. "state": data.state
  157. }
  158. }
  159. })
  160. }
  161. }
  162. },
  163. 'reassign.stop_services': {
  164. 'real': '/clusters/{clusterName}/services',
  165. 'mock': '',
  166. 'format': function() {
  167. return {
  168. type: 'PUT',
  169. data: JSON.stringify({
  170. "RequestInfo": {
  171. "context": "Stop all services"
  172. },
  173. "Body": {
  174. "ServiceInfo": {
  175. "state": "INSTALLED"
  176. }
  177. }
  178. })
  179. }
  180. }
  181. },
  182. 'reassign.stop_YMR2_services': {
  183. 'real': '/clusters/{clusterName}/services?ServiceInfo/service_name.in({servicesList})',
  184. 'mock': '',
  185. 'format': function() {
  186. return {
  187. type: 'PUT',
  188. data: JSON.stringify({
  189. "RequestInfo": {
  190. "context": "Stop without HDFS"
  191. },
  192. "Body": {
  193. "ServiceInfo": {
  194. "state": "INSTALLED"
  195. }
  196. }
  197. })
  198. }
  199. }
  200. },
  201. 'reassign.start_services': {
  202. 'real': '/clusters/{clusterName}/services?params/run_smoke_test=true',
  203. 'mock': '',
  204. 'format': function() {
  205. return {
  206. type: 'PUT',
  207. data: JSON.stringify({
  208. "RequestInfo": {
  209. "context": "Start all services"
  210. },
  211. "Body": {
  212. "ServiceInfo": {
  213. "state": "STARTED"
  214. }
  215. }
  216. })
  217. }
  218. }
  219. },
  220. 'reassign.start_YMR2_services': {
  221. 'real': '/clusters/{clusterName}/services/?ServiceInfo/service_name.in({servicesList})',
  222. 'mock': '',
  223. 'format': function() {
  224. return {
  225. type: 'PUT',
  226. data: JSON.stringify({
  227. "RequestInfo": {
  228. "context": "Start without HDFS"
  229. },
  230. "Body": {
  231. "ServiceInfo": {
  232. "state": "STARTED"
  233. }
  234. }
  235. })
  236. }
  237. }
  238. },
  239. 'reassign.maintenance_mode': {
  240. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  241. 'mock': '',
  242. 'type': 'PUT',
  243. 'format': function () {
  244. return {
  245. data: JSON.stringify(
  246. {
  247. "HostRoles": {
  248. "state": "DISABLED"
  249. }
  250. }
  251. )
  252. }
  253. }
  254. },
  255. 'reassign.remove_component': {
  256. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  257. 'mock': '',
  258. 'type': 'DELETE'
  259. },
  260. 'reassign.load_configs': {
  261. 'real': '/clusters/{clusterName}/configurations?{urlParams}',
  262. 'mock': ''
  263. },
  264. 'reassign.save_configs': {
  265. 'real': '/clusters/{clusterName}',
  266. 'mock': '',
  267. 'type': 'PUT',
  268. 'format': function (data) {
  269. return {
  270. async: false,
  271. data: JSON.stringify({
  272. Clusters: {
  273. desired_config: {
  274. "type": data.siteName,
  275. "tag": 'version' + (new Date).getTime(),
  276. "properties": data.properties
  277. }
  278. }
  279. })
  280. }
  281. }
  282. },
  283. 'host_component.passive': {
  284. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  285. 'mock': '',
  286. 'type': 'PUT',
  287. 'format': function(data) {
  288. return {
  289. data: JSON.stringify({
  290. RequestInfo: {
  291. "context": data.requestInfo
  292. },
  293. Body: {
  294. HostRoles: {
  295. maintenance_state: data.passive_state
  296. }
  297. }
  298. })
  299. };
  300. }
  301. },
  302. 'config.cluster_configuration.put': {
  303. 'real': '/clusters/{cluster}',
  304. 'mock': '',
  305. 'format': function(data) {
  306. return {
  307. type: 'PUT',
  308. async: false,
  309. dataType: 'text',
  310. data: data.data
  311. }
  312. }
  313. },
  314. 'config.advanced': {
  315. 'real': '{stack2VersionUrl}/stackServices/{serviceName}/configurations?fields=*',
  316. 'mock': '/data/wizard/stack/hdp/version{stackVersion}/{serviceName}.json',
  317. 'format': function (data) {
  318. return {
  319. async: !data.sync
  320. };
  321. }
  322. },
  323. 'config.advanced.global': {
  324. 'real': '{stack2VersionUrl}/stackServices?fields=configurations/StackConfigurations/type',
  325. 'mock': '/data/wizard/stack/hdp/version1.3.0/global.json',
  326. 'format': function() {
  327. return {
  328. async: false
  329. };
  330. }
  331. },
  332. 'config.tags': {
  333. 'real': '/clusters/{clusterName}?fields=Clusters/desired_configs',
  334. 'mock': '/data/clusters/cluster.json'
  335. },
  336. 'config.tags_and_groups': {
  337. 'real': '/clusters/{clusterName}?fields=Clusters/desired_configs,config_groups/*',
  338. 'mock': '/data/clusters/tags_and_groups.json'
  339. },
  340. 'config.tags.sync': {
  341. 'real': '/clusters/{clusterName}?fields=Clusters/desired_configs',
  342. 'mock': '/data/clusters/cluster.json',
  343. 'format': function() {
  344. return {
  345. async: false
  346. };
  347. }
  348. },
  349. 'config_groups.all_fields': {
  350. 'real': '/clusters/{clusterName}/config_groups?fields=*',
  351. 'mock': ''
  352. },
  353. 'config_groups.get_config_group_by_id': {
  354. 'real': '/clusters/{clusterName}/config_groups/{id}',
  355. 'mock': ''
  356. },
  357. 'config_groups.update_config_group': {
  358. 'real': '/clusters/{clusterName}/config_groups/{id}',
  359. 'mock': '',
  360. 'type': 'PUT',
  361. 'format': function (data) {
  362. return {
  363. async: false,
  364. data: JSON.stringify(
  365. [
  366. data.configGroup
  367. ]
  368. )
  369. }
  370. }
  371. },
  372. 'config_groups.delete_config_group': {
  373. 'real': '/clusters/{clusterName}/config_groups/{id}',
  374. 'mock': '',
  375. 'type': 'DELETE'
  376. },
  377. 'config.on_site': {
  378. 'real': '/clusters/{clusterName}/configurations?{params}',
  379. 'mock': '/data/configurations/cluster_level_configs.json?{params}',
  380. 'format': function() {
  381. return {
  382. async: false
  383. };
  384. }
  385. },
  386. 'config.host_overrides': {
  387. 'real': '/clusters/{clusterName}/configurations?{params}',
  388. 'mock': '/data/configurations/host_level_overrides_configs.json?{params}',
  389. 'format': function() {
  390. return {
  391. async: false
  392. };
  393. }
  394. },
  395. 'host.host_component.action': {
  396. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  397. 'mock': '',
  398. 'type': 'PUT',
  399. 'format': function (data) {
  400. return {
  401. data: JSON.stringify({
  402. RequestInfo: {
  403. "context": data.context
  404. },
  405. Body: {
  406. "HostRoles": {
  407. "state": data.state
  408. }
  409. }
  410. })
  411. }
  412. }
  413. },
  414. 'host.host_component.delete': {
  415. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  416. 'mock': '',
  417. 'format': function() {
  418. return {
  419. type: 'DELETE',
  420. async: false
  421. }
  422. }
  423. },
  424. 'host.host_components.delete': {
  425. 'real': '/clusters/{clusterName}/hosts/{hostName}',
  426. 'mock': '',
  427. 'format': function() {
  428. return {
  429. type: 'DELETE',
  430. async: false
  431. }
  432. }
  433. },
  434. 'host.host_component.stop': {
  435. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  436. 'mock': '/data/wizard/deploy/poll_1.json',
  437. 'format': function(data) {
  438. return {
  439. type: 'PUT',
  440. data: data.data
  441. }
  442. }
  443. },
  444. 'host.host_components.stop': {
  445. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components',
  446. 'mock': '/data/wizard/deploy/poll_1.json',
  447. 'format': function(data) {
  448. return {
  449. type: 'PUT',
  450. async: false,
  451. data: data.data
  452. }
  453. }
  454. },
  455. 'host.host_component.start': {
  456. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  457. 'mock': '/data/wizard/deploy/poll_1.json',
  458. 'format': function(data) {
  459. return {
  460. type: 'PUT',
  461. data: data.data
  462. }
  463. }
  464. },
  465. 'host.host_components.start': {
  466. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components',
  467. 'mock': '/data/wizard/deploy/poll_1.json',
  468. 'format': function(data) {
  469. return {
  470. type: 'PUT',
  471. async: false,
  472. data: data.data
  473. }
  474. }
  475. },
  476. 'host.host_component.install': {
  477. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  478. 'mock': '/data/wizard/deploy/poll_1.json',
  479. 'format': function(data) {
  480. return {
  481. type: 'PUT',
  482. data: data.data
  483. }
  484. }
  485. },
  486. 'host.host_component.update': {
  487. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  488. 'mock': '/data/wizard/deploy/poll_1.json',
  489. 'format': function(data) {
  490. return {
  491. type: 'PUT',
  492. data: data.data
  493. }
  494. }
  495. },
  496. 'host.host_component.add_new_component': {
  497. 'real': '/clusters/{clusterName}/hosts?Hosts/host_name={hostName}',
  498. 'mock': '/data/wizard/deploy/poll_1.json',
  499. 'format': function(data) {
  500. return {
  501. type: 'POST',
  502. data: data.data
  503. }
  504. }
  505. },
  506. 'host.host_component.install_new_component': {
  507. 'real': '/clusters/{clusterName}/host_components?HostRoles/host_name={hostName}\&HostRoles/component_name={componentName}\&HostRoles/state=INIT',
  508. 'mock': '/data/wizard/deploy/poll_1.json',
  509. 'format': function(data) {
  510. return {
  511. type: 'PUT',
  512. data: data.data
  513. }
  514. }
  515. },
  516. 'host.host_component.slave_desired_admin_state': {
  517. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}/?fields=HostRoles/desired_admin_state',
  518. 'mock': ''
  519. },
  520. 'host.host_component.decommission_status': {
  521. 'real': '/clusters/{clusterName}/services/{serviceName}/components/{componentName}/?fields=ServiceComponentInfo',
  522. 'mock': ''
  523. },
  524. 'host.host_component.decommission_status_datanode': {
  525. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}?fields=metrics/dfs/namenode',
  526. 'mock': ''
  527. },
  528. 'host.host_component.decommission_slave': {
  529. 'real' : '/clusters/{clusterName}/requests',
  530. 'mock' : '',
  531. 'format' : function(data) {
  532. return {
  533. type : 'POST',
  534. data : JSON.stringify({
  535. RequestInfo: {
  536. 'context': data.context,
  537. 'command': data.command,
  538. 'parameters': {
  539. 'slave_type': data.slaveType,
  540. 'excluded_hosts': data.hostName
  541. }
  542. },
  543. "Requests/resource_filters": [{"service_name" : data.serviceName, "component_name" : data.componentName}]
  544. })
  545. }
  546. }
  547. },
  548. 'host.host_component.recommission_and_restart': {
  549. 'real': '/clusters/{clusterName}/request_schedules',
  550. 'mock': '',
  551. 'format' : function(data) {
  552. return {
  553. type : 'POST',
  554. data : JSON.stringify([ {
  555. "RequestSchedule" : {
  556. "batch" : [ {
  557. "requests" : data.batches
  558. }, {
  559. "batch_settings" : {
  560. "batch_separation_in_seconds" : data.intervalTimeSeconds,
  561. "task_failure_tolerance" : data.tolerateSize
  562. }
  563. } ]
  564. }
  565. } ])
  566. }
  567. }
  568. },
  569. 'host.host_component.recommission_slave' : {
  570. 'real' : '/clusters/{clusterName}/requests',
  571. 'mock' : '',
  572. 'format' : function(data) {
  573. return {
  574. type : 'POST',
  575. data : JSON.stringify({
  576. RequestInfo: {
  577. context: data.context,
  578. command: data.command,
  579. parameters: {
  580. slave_type: data.slaveType,
  581. included_hosts: data.hostName
  582. }
  583. },
  584. "Requests/resource_filters": [{"service_name" : data.serviceName, "component_name" : data.componentName}]
  585. })
  586. }
  587. }
  588. },
  589. 'host.stale_host_components.start_stop': {
  590. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components?HostRoles/stale_configs=true&' +
  591. 'HostRoles/component_name.in({componentNames})',
  592. 'mock': '',
  593. 'type': 'PUT',
  594. 'format': function (data) {
  595. return {
  596. data: JSON.stringify({
  597. RequestInfo: {
  598. "context": data.context
  599. },
  600. Body: {
  601. "HostRoles": {
  602. "state": data.state
  603. }
  604. }
  605. })
  606. }
  607. }
  608. },
  609. 'host.host_component.refresh_configs': {
  610. 'real':'/clusters/{clusterName}/requests',
  611. 'mock':'',
  612. 'format': function(data) {
  613. return {
  614. type : 'POST',
  615. data : JSON.stringify({
  616. "RequestInfo": {
  617. "command": "CONFIGURE",
  618. "context": data.context
  619. },
  620. "Requests/resource_filters": data.resource_filters
  621. })
  622. }
  623. }
  624. },
  625. 'host.delete': {
  626. 'real': '/clusters/{clusterName}/hosts/{hostName}',
  627. 'mock': '',
  628. 'type': 'DELETE',
  629. 'format': function() {
  630. return {
  631. async: false
  632. }
  633. }
  634. },
  635. 'hosts.metrics': {
  636. 'real': '/clusters/{clusterName}/hosts?fields={metricName}',
  637. 'mock': '/data/cluster_metrics/cpu_1hr.json'
  638. },
  639. 'hosts.metrics.host_component': {
  640. 'real': '/clusters/{clusterName}/services/{serviceName}/components/{componentName}?fields=host_components/{metricName}',
  641. 'mock': '/data/cluster_metrics/cpu_1hr.json'
  642. },
  643. 'service.service_component': {
  644. 'real': '/clusters/{clusterName}/services/{serviceName}/components/{componentName}',
  645. 'mock': '',
  646. 'format': function(data) {
  647. return {
  648. async: data.async
  649. };
  650. }
  651. },
  652. 'service.metrics.flume.channel_fill_percent': {
  653. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/flume/flume/CHANNEL/*/ChannelFillPercentage[{fromSeconds},{toSeconds},{stepSeconds}]',
  654. 'mock': '/data/services/metrics/flume/channelFillPct.json',
  655. 'testInProduction': true
  656. },
  657. 'service.metrics.flume.channel_size': {
  658. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/flume/flume/CHANNEL/*/ChannelSize[{fromSeconds},{toSeconds},{stepSeconds}]',
  659. 'mock': '/data/services/metrics/flume/channelSize.json',
  660. 'testInProduction': true
  661. },
  662. 'service.metrics.flume.sink_drain_success': {
  663. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/flume/flume/SINK/*/EventDrainSuccessCount[{fromSeconds},{toSeconds},{stepSeconds}]',
  664. 'mock': '/data/services/metrics/flume/sinkDrainSuccessCount.json',
  665. 'testInProduction': true
  666. },
  667. 'service.metrics.flume.sink_connection_failed': {
  668. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/flume/flume/SINK/*/ConnectionFailedCount[{fromSeconds},{toSeconds},{stepSeconds}]',
  669. 'mock': '/data/services/metrics/flume/sinkConnectionFailedCount.json',
  670. 'testInProduction': true
  671. },
  672. 'service.metrics.flume.gc': {
  673. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/jvm/gcTimeMillis[{fromSeconds},{toSeconds},{stepSeconds}]',
  674. 'mock': '/data/services/metrics/flume/jvmGcTime.json',
  675. 'testInProduction': true
  676. },
  677. 'service.metrics.flume.jvm_heap_used': {
  678. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/jvm/memHeapUsedM[{fromSeconds},{toSeconds},{stepSeconds}]',
  679. 'mock': '/data/services/metrics/flume/jvmMemHeapUsedM.json',
  680. 'testInProduction': true
  681. },
  682. 'service.metrics.flume.jvm_threads_runnable': {
  683. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/jvm/threadsRunnable[{fromSeconds},{toSeconds},{stepSeconds}]',
  684. 'mock': '/data/services/metrics/flume/jvmThreadsRunnable.json',
  685. 'testInProduction': true
  686. },
  687. 'service.metrics.flume.cpu_user': {
  688. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/cpu/cpu_user[{fromSeconds},{toSeconds},{stepSeconds}]',
  689. 'mock': '',
  690. 'testInProduction': true
  691. },
  692. 'service.metrics.flume.source_accepted': {
  693. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/flume/flume/SOURCE/*/EventAcceptedCount[{fromSeconds},{toSeconds},{stepSeconds}]',
  694. 'mock': '/data/services/metrics/flume/sourceEventAccepted.json',
  695. 'testInProduction': true
  696. },
  697. 'service.metrics.hbase.cluster_requests': {
  698. 'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_MASTER?fields=metrics/hbase/master/cluster_requests[{fromSeconds},{toSeconds},{stepSeconds}]',
  699. 'mock': '/data/services/metrics/hbase/cluster_requests.json',
  700. 'testInProduction': true
  701. },
  702. 'service.metrics.hbase.hlog_split_size': {
  703. 'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_MASTER?fields=metrics/hbase/master/splitSize_avg_time[{fromSeconds},{toSeconds},{stepSeconds}]',
  704. 'mock': '/data/services/metrics/hbase/hlog_split_size.json',
  705. 'testInProduction': true
  706. },
  707. 'service.metrics.hbase.hlog_split_time': {
  708. 'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_MASTER?fields=metrics/hbase/master/splitTime_avg_time[{fromSeconds},{toSeconds},{stepSeconds}]',
  709. 'mock': '/data/services/metrics/hbase/hlog_split_time.json',
  710. 'testInProduction': true
  711. },
  712. 'service.metrics.hbase.regionserver_queuesize': {
  713. 'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_REGIONSERVER?fields=metrics/hbase/regionserver/flushQueueSize[{fromSeconds},{toSeconds},{stepSeconds}],metrics/hbase/regionserver/compactionQueueSize[{fromSeconds},{toSeconds},{stepSeconds}]',
  714. 'mock': '/data/services/metrics/hbase/regionserver_queuesize.json',
  715. 'testInProduction': true
  716. },
  717. 'service.metrics.hbase.regionserver_regions': {
  718. 'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_REGIONSERVER?fields=metrics/hbase/regionserver/regions[{fromSeconds},{toSeconds},{stepSeconds}]',
  719. 'mock': '/data/services/metrics/hbase/regionserver_regions.json',
  720. 'testInProduction': true
  721. },
  722. 'service.metrics.hbase.regionserver_rw_requests': {
  723. 'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_REGIONSERVER?fields=metrics/hbase/regionserver/readRequestsCount[{fromSeconds},{toSeconds},{stepSeconds}],metrics/hbase/regionserver/writeRequestsCount[{fromSeconds},{toSeconds},{stepSeconds}]',
  724. 'mock': '/data/services/metrics/hbase/regionserver_rw_requests.json',
  725. 'testInProduction': true
  726. },
  727. 'service.metrics.mapreduce.gc': {
  728. 'real': '/clusters/{clusterName}/hosts/{jobTrackerNode}/host_components/JOBTRACKER?fields=metrics/jvm/gcTimeMillis[{fromSeconds},{toSeconds},{stepSeconds}]',
  729. 'mock': '/data/services/metrics/mapreduce/gc.json',
  730. 'testInProduction': true
  731. },
  732. 'service.metrics.mapreduce.jobs_status': {
  733. 'real': '/clusters/{clusterName}/services/MAPREDUCE/components/JOBTRACKER?fields=metrics/mapred/jobtracker/jobs_completed[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/jobs_preparing[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/jobs_failed[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/jobs_submitted[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/jobs_failed[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/jobs_running[{fromSeconds},{toSeconds},{stepSeconds}]',
  734. 'mock': '/data/services/metrics/mapreduce/jobs_status.json',
  735. 'testInProduction': true
  736. },
  737. 'service.metrics.mapreduce.jobs_heap': {
  738. 'real': '/clusters/{clusterName}/hosts/{jobTrackerNode}/host_components/JOBTRACKER?fields=metrics/jvm/memNonHeapUsedM[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/memNonHeapCommittedM[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/memHeapUsedM[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/memHeapCommittedM[{fromSeconds},{toSeconds},{stepSeconds}]',
  739. 'mock': '/data/services/metrics/mapreduce/jvm_heap.json',
  740. 'testInProduction': true
  741. },
  742. 'service.metrics.mapreduce.jobs_threads': {
  743. 'real': '/clusters/{clusterName}/hosts/{jobTrackerNode}/host_components/JOBTRACKER?fields=metrics/jvm/threadsRunnable[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/threadsBlocked[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/threadsWaiting[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/threadsTimedWaiting[{fromSeconds},{toSeconds},{stepSeconds}]',
  744. 'mock': '/data/services/metrics/mapreduce/jvm_threads.json',
  745. 'testInProduction': true
  746. },
  747. 'service.metrics.mapreduce.map_slots': {
  748. 'real': '/clusters/{clusterName}/services/MAPREDUCE/components/JOBTRACKER?fields=metrics/mapred/jobtracker/occupied_map_slots[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/reserved_map_slots[{fromSeconds},{toSeconds},{stepSeconds}]',
  749. 'mock': '/data/services/metrics/mapreduce/map_slots.json',
  750. 'testInProduction': true
  751. },
  752. 'service.metrics.mapreduce.reduce_slots': {
  753. 'real': '/clusters/{clusterName}/services/MAPREDUCE/components/JOBTRACKER?fields=metrics/mapred/jobtracker/occupied_reduce_slots[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/reserved_reduce_slots[{fromSeconds},{toSeconds},{stepSeconds}]',
  754. 'mock': '/data/services/metrics/mapreduce/reduce_slots.json',
  755. 'testInProduction': true
  756. },
  757. 'service.metrics.mapreduce.rpc': {
  758. 'real': '/clusters/{clusterName}/hosts/{jobTrackerNode}/host_components/JOBTRACKER?fields=metrics/rpc/RpcQueueTime_avg_time[{fromSeconds},{toSeconds},{stepSeconds}]',
  759. 'mock': '/data/services/metrics/mapreduce/rpc.json',
  760. 'testInProduction': true
  761. },
  762. 'service.metrics.mapreduce.tasks_running_waiting': {
  763. 'real': '/clusters/{clusterName}/services/MAPREDUCE/components/JOBTRACKER?fields=metrics/mapred/jobtracker/running_maps[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/running_reduces[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/waiting_maps[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/waiting_reduces[{fromSeconds},{toSeconds},{stepSeconds}]',
  764. 'mock': '/data/services/metrics/mapreduce/tasks_running_waiting.json',
  765. 'testInProduction': true
  766. },
  767. 'service.metrics.hdfs.block_status': {
  768. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/dfs/FSNamesystem/PendingReplicationBlocks[{fromSeconds},{toSeconds},{stepSeconds}],metrics/dfs/FSNamesystem/UnderReplicatedBlocks[{fromSeconds},{toSeconds},{stepSeconds}]',
  769. 'mock': '/data/services/metrics/hdfs/block_status.json',
  770. 'testInProduction': true
  771. },
  772. 'service.metrics.hdfs.file_operations': {
  773. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/dfs/namenode/FileInfoOps[{fromSeconds},{toSeconds},{stepSeconds}],metrics/dfs/namenode/CreateFileOps[{fromSeconds},{toSeconds},{stepSeconds}]',
  774. 'mock': '/data/services/metrics/hdfs/file_operations.json',
  775. 'testInProduction': true
  776. },
  777. 'service.metrics.hdfs.gc': {
  778. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/jvm/gcTimeMillis[{fromSeconds},{toSeconds},{stepSeconds}]',
  779. 'mock': '/data/services/metrics/hdfs/gc.json',
  780. 'testInProduction': true
  781. },
  782. 'service.metrics.hdfs.io': {
  783. 'real': '/clusters/{clusterName}/services/HDFS/components/DATANODE?fields=metrics/dfs/datanode/bytes_written[{fromSeconds},{toSeconds},{stepSeconds}],metrics/dfs/datanode/bytes_read[{fromSeconds},{toSeconds},{stepSeconds}]',
  784. 'mock': '/data/services/metrics/hdfs/io.json',
  785. 'testInProduction': true
  786. },
  787. 'service.metrics.hdfs.jvm_heap': {
  788. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/jvm/memNonHeapUsedM[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/memNonHeapCommittedM[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/memHeapUsedM[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/memHeapCommittedM[{fromSeconds},{toSeconds},{stepSeconds}]',
  789. 'mock': '/data/services/metrics/hdfs/jvm_heap.json',
  790. 'testInProduction': true
  791. },
  792. 'service.metrics.hdfs.jvm_threads': {
  793. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/jvm/threadsRunnable[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/threadsBlocked[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/threadsWaiting[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/threadsTimedWaiting[{fromSeconds},{toSeconds},{stepSeconds}]',
  794. 'mock': '/data/services/metrics/hdfs/jvm_threads.json',
  795. 'testInProduction': true
  796. },
  797. 'service.metrics.hdfs.rpc': {
  798. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/rpc/RpcQueueTime_avg_time[{fromSeconds},{toSeconds},{stepSeconds}]',
  799. 'mock': '/data/services/metrics/hdfs/rpc.json',
  800. 'testInProduction': true
  801. },
  802. 'service.metrics.hdfs.space_utilization': {
  803. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/dfs/FSNamesystem/CapacityRemainingGB[{fromSeconds},{toSeconds},{stepSeconds}],metrics/dfs/FSNamesystem/CapacityUsedGB[{fromSeconds},{toSeconds},{stepSeconds}],metrics/dfs/FSNamesystem/CapacityTotalGB[{fromSeconds},{toSeconds},{stepSeconds}]',
  804. 'mock': '/data/services/metrics/hdfs/space_utilization.json',
  805. 'testInProduction': true
  806. },
  807. 'service.start_stop': {
  808. 'real': '/clusters/{clusterName}/services?params/run_smoke_test=true',
  809. 'mock': '/data/mirroring/poll/poll_6.json',
  810. 'format': function (data) {
  811. return {
  812. type: 'PUT',
  813. async: false,
  814. data: data.data
  815. };
  816. }
  817. },
  818. 'service.metrics.yarn.gc': {
  819. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/jvm/gcTimeMillis[{fromSeconds},{toSeconds},{stepSeconds}]',
  820. 'mock': '/data/services/metrics/yarn/gc.json',
  821. 'testInProduction': true
  822. },
  823. 'service.metrics.yarn.jobs_threads': {
  824. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/jvm/threadsRunnable[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/threadsBlocked[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/threadsWaiting[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/threadsTimedWaiting[{fromSeconds},{toSeconds},{stepSeconds}]',
  825. 'mock': '/data/services/metrics/yarn/jvm_threads.json',
  826. 'testInProduction': true
  827. },
  828. 'service.metrics.yarn.rpc': {
  829. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/rpc/RpcQueueTime_avg_time[{fromSeconds},{toSeconds},{stepSeconds}]',
  830. 'mock': '/data/services/metrics/yarn/rpc.json',
  831. 'testInProduction': true
  832. },
  833. 'service.metrics.yarn.jobs_heap': {
  834. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/jvm/memNonHeapUsedM[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/memNonHeapCommittedM[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/memHeapUsedM[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/memHeapCommittedM[{fromSeconds},{toSeconds},{stepSeconds}]',
  835. 'mock': '/data/services/metrics/yarn/jvm_heap.json',
  836. 'testInProduction': true
  837. },
  838. 'service.metrics.yarn.queue.allocated': {
  839. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/yarn/Queue/root/AvailableMB[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/Queue/root/PendingMB[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/Queue/root/AllocatedMB[{fromSeconds},{toSeconds},{stepSeconds}]',
  840. 'mock': '',
  841. 'testInProduction': true
  842. },
  843. 'service.metrics.yarn.queue.allocated.container': {
  844. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/yarn/Queue/root/AllocatedContainers[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/Queue/root/ReservedContainers[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/Queue/root/PendingContainers[{fromSeconds},{toSeconds},{stepSeconds}]',
  845. 'mock': '',
  846. 'testInProduction': true
  847. },
  848. 'service.metrics.yarn.node.manager.statuses': {
  849. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/yarn/ClusterMetrics/NumActiveNMs[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/ClusterMetrics/NumDecommissionedNMs[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/ClusterMetrics/NumLostNMs[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/ClusterMetrics/NumRebootedNMs[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/ClusterMetrics/NumUnhealthyNMs[{fromSeconds},{toSeconds},{stepSeconds}]',
  850. 'mock': '',
  851. 'testInProduction': true
  852. },
  853. 'service.metrics.yarn.queue.memory.resource': {
  854. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=',
  855. 'mock': '',
  856. 'format': function (data, opt) {
  857. var field1 = 'metrics/yarn/Queue/{queueName}/AllocatedMB[{fromSeconds},{toSeconds},{stepSeconds}]';
  858. var field2 = 'metrics/yarn/Queue/{queueName}/AvailableMB[{fromSeconds},{toSeconds},{stepSeconds}]';
  859. if (opt.url != null && data.queueNames != null && data.queueNames.length > 0) {
  860. data.queueNames.forEach(function (q) {
  861. data.queueName = q;
  862. opt.url += (formatUrl(field1, data) + ",");
  863. opt.url += (formatUrl(field2, data) + ",");
  864. });
  865. } else {
  866. opt.url += (formatUrl(field1, data) + ",");
  867. opt.url += (formatUrl(field2, data) + ",");
  868. }
  869. },
  870. 'testInProduction': true
  871. },
  872. 'service.metrics.yarn.queue.apps.states.current': {
  873. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/yarn/Queue/root/AppsPending[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/Queue/root/AppsRunning[{fromSeconds},{toSeconds},{stepSeconds}]',
  874. 'mock': '',
  875. 'testInProduction': true
  876. },
  877. 'service.metrics.yarn.queue.apps.states.finished': {
  878. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/yarn/Queue/root/AppsKilled[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/Queue/root/AppsFailed[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/Queue/root/AppsSubmitted[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/Queue/root/AppsCompleted[{fromSeconds},{toSeconds},{stepSeconds}]',
  879. 'mock': '',
  880. 'testInProduction': true
  881. },
  882. 'service.metrics.storm.nimbus': {
  883. 'real': '/clusters/{clusterName}/services/STORM/components/NIMBUS?fields={metricsTemplate}',
  884. 'mock': ''
  885. },
  886. 'dashboard.cluster_metrics.cpu': {
  887. 'real': '/clusters/{clusterName}/?fields=metrics/cpu[{fromSeconds},{toSeconds},{stepSeconds}]',
  888. 'mock': '/data/cluster_metrics/cpu_1hr.json',
  889. 'testInProduction': true
  890. },
  891. 'dashboard.cluster_metrics.load': {
  892. 'real': '/clusters/{clusterName}/?fields=metrics/load[{fromSeconds},{toSeconds},{stepSeconds}]',
  893. 'mock': '/data/cluster_metrics/load_1hr.json',
  894. 'testInProduction': true
  895. },
  896. 'dashboard.cluster_metrics.memory': {
  897. 'real': '/clusters/{clusterName}/?fields=metrics/memory[{fromSeconds},{toSeconds},{stepSeconds}]',
  898. 'mock': '/data/cluster_metrics/memory_1hr.json',
  899. 'testInProduction': true
  900. },
  901. 'dashboard.cluster_metrics.network': {
  902. 'real': '/clusters/{clusterName}/?fields=metrics/network[{fromSeconds},{toSeconds},{stepSeconds}]',
  903. 'mock': '/data/cluster_metrics/network_1hr.json',
  904. 'testInProduction': true
  905. },
  906. 'host.metrics.cpu': {
  907. 'real': '/clusters/{clusterName}/hosts/{hostName}?fields=metrics/cpu/cpu_user[{fromSeconds},{toSeconds},{stepSeconds}],metrics/cpu/cpu_wio[{fromSeconds},{toSeconds},{stepSeconds}],metrics/cpu/cpu_nice[{fromSeconds},{toSeconds},{stepSeconds}],metrics/cpu/cpu_aidle[{fromSeconds},{toSeconds},{stepSeconds}],metrics/cpu/cpu_system[{fromSeconds},{toSeconds},{stepSeconds}],metrics/cpu/cpu_idle[{fromSeconds},{toSeconds},{stepSeconds}]',
  908. 'mock': '/data/hosts/metrics/cpu.json',
  909. 'testInProduction': true
  910. },
  911. 'host.metrics.disk': {
  912. 'real': '/clusters/{clusterName}/hosts/{hostName}?fields=metrics/disk/disk_total[{fromSeconds},{toSeconds},{stepSeconds}],metrics/disk/disk_free[{fromSeconds},{toSeconds},{stepSeconds}]',
  913. 'mock': '/data/hosts/metrics/disk.json',
  914. 'testInProduction': true
  915. },
  916. 'host.metrics.load': {
  917. 'real': '/clusters/{clusterName}/hosts/{hostName}?fields=metrics/load/load_fifteen[{fromSeconds},{toSeconds},{stepSeconds}],metrics/load/load_one[{fromSeconds},{toSeconds},{stepSeconds}],metrics/load/load_five[{fromSeconds},{toSeconds},{stepSeconds}]',
  918. 'mock': '/data/hosts/metrics/load.json',
  919. 'testInProduction': true
  920. },
  921. 'host.metrics.memory': {
  922. 'real': '/clusters/{clusterName}/hosts/{hostName}?fields=metrics/memory/swap_free[{fromSeconds},{toSeconds},{stepSeconds}],metrics/memory/mem_shared[{fromSeconds},{toSeconds},{stepSeconds}],metrics/memory/mem_free[{fromSeconds},{toSeconds},{stepSeconds}],metrics/memory/mem_cached[{fromSeconds},{toSeconds},{stepSeconds}],metrics/memory/mem_buffers[{fromSeconds},{toSeconds},{stepSeconds}]',
  923. 'mock': '/data/hosts/metrics/memory.json',
  924. 'testInProduction': true
  925. },
  926. 'host.metrics.network': {
  927. 'real': '/clusters/{clusterName}/hosts/{hostName}?fields=metrics/network/bytes_in[{fromSeconds},{toSeconds},{stepSeconds}],metrics/network/bytes_out[{fromSeconds},{toSeconds},{stepSeconds}],metrics/network/pkts_in[{fromSeconds},{toSeconds},{stepSeconds}],metrics/network/pkts_out[{fromSeconds},{toSeconds},{stepSeconds}]',
  928. 'mock': '/data/hosts/metrics/network.json',
  929. 'testInProduction': true
  930. },
  931. 'host.metrics.processes': {
  932. 'real': '/clusters/{clusterName}/hosts/{hostName}?fields=metrics/process/proc_total[{fromSeconds},{toSeconds},{stepSeconds}],metrics/process/proc_run[{fromSeconds},{toSeconds},{stepSeconds}]',
  933. 'mock': '/data/hosts/metrics/processes.json',
  934. 'testInProduction': true
  935. },
  936. 'host.service_config_hosts_overrides': {
  937. 'real': '/clusters/{clusterName}/configurations?{urlParams}',
  938. 'mock': '',
  939. 'format': function() {
  940. return {
  941. async: false,
  942. timeout: 10000
  943. };
  944. }
  945. },
  946. 'admin.security_status': {
  947. 'real': '/clusters/{clusterName}?fields=Clusters/desired_configs',
  948. 'mock': '',
  949. 'format': function() {
  950. return {
  951. timeout: 10000
  952. };
  953. }
  954. },
  955. 'settings.get.user_pref': {
  956. 'real': '/persist/{key}',
  957. 'mock': '/data/user_settings/{key}.json',
  958. 'format': function(data) {
  959. return {
  960. async: data.async
  961. };
  962. }
  963. },
  964. 'settings.post.user_pref': {
  965. 'real': '/persist',
  966. 'mock': '',
  967. 'type': 'POST',
  968. 'format': function (data) {
  969. return {
  970. async: data.async,
  971. data: JSON.stringify(data.keyValuePair)
  972. }
  973. }
  974. },
  975. 'cluster.load_cluster_name': {
  976. 'real': '/clusters',
  977. 'mock': '/data/clusters/info.json',
  978. 'format': function() {
  979. return {
  980. async: false
  981. };
  982. }
  983. },
  984. 'cluster.update_upgrade_version': {
  985. 'real': '/stacks2/HDP/versions?fields=stackServices/StackServices,Versions',
  986. 'mock': '/data/wizard/stack/stacks.json',
  987. 'format': function() {
  988. return {
  989. async: false
  990. };
  991. }
  992. },
  993. 'cluster.load_repositories': {
  994. 'real': '/stacks2/{stackName}/versions/{stackVersion}/operatingSystems?fields=repositories/*',
  995. 'mock': '',
  996. 'type': 'GET',
  997. 'format': function (data) {
  998. return {
  999. data: data.data
  1000. };
  1001. }
  1002. },
  1003. 'admin.high_availability.stop_all_services': {
  1004. 'real': '/clusters/{clusterName}/services',
  1005. 'mock': '',
  1006. 'format': function() {
  1007. return {
  1008. type: 'PUT',
  1009. data: JSON.stringify({
  1010. "RequestInfo": {
  1011. "context": "Stop all services"
  1012. },
  1013. "Body": {
  1014. "ServiceInfo": {
  1015. "state": "INSTALLED"
  1016. }
  1017. }
  1018. })
  1019. }
  1020. }
  1021. },
  1022. 'admin.high_availability.start_all_services': {
  1023. 'real': '/clusters/{clusterName}/services',
  1024. 'mock': '',
  1025. 'format': function() {
  1026. return {
  1027. type: 'PUT',
  1028. data: JSON.stringify({
  1029. "RequestInfo": {
  1030. "context": "Start all services"
  1031. },
  1032. "Body": {
  1033. "ServiceInfo": {
  1034. "state": "STARTED"
  1035. }
  1036. }
  1037. })
  1038. }
  1039. }
  1040. },
  1041. 'admin.high_availability.polling': {
  1042. 'real': '/clusters/{clusterName}/requests/{requestId}?fields=tasks/*',
  1043. 'mock': '',
  1044. 'type': 'GET'
  1045. },
  1046. 'admin.high_availability.getNnCheckPointStatus': {
  1047. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/NAMENODE',
  1048. 'mock': '',
  1049. 'type': 'GET'
  1050. },
  1051. 'admin.high_availability.getJnCheckPointStatus': {
  1052. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/JOURNALNODE?fields=metrics',
  1053. 'mock': ''
  1054. },
  1055. 'admin.high_availability.getHostComponent': {
  1056. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  1057. 'mock': ''
  1058. },
  1059. 'admin.high_availability.create_component': {
  1060. 'real': '/clusters/{clusterName}/hosts?Hosts/host_name={hostName}',
  1061. 'mock': '',
  1062. 'type': 'POST',
  1063. 'format': function (data) {
  1064. return {
  1065. data: JSON.stringify({
  1066. "host_components": [
  1067. {
  1068. "HostRoles": {
  1069. "component_name": data.componentName
  1070. }
  1071. }
  1072. ]
  1073. })
  1074. }
  1075. }
  1076. },
  1077. 'admin.high_availability.create_journalnode': {
  1078. 'real': '/clusters/{clusterName}/services?ServiceInfo/service_name=HDFS',
  1079. 'mock': '',
  1080. 'type': 'POST',
  1081. 'format': function() {
  1082. return {
  1083. data: JSON.stringify({
  1084. "components": [
  1085. {
  1086. "ServiceComponentInfo": {
  1087. "component_name": "JOURNALNODE"
  1088. }
  1089. }
  1090. ]
  1091. })
  1092. }
  1093. }
  1094. },
  1095. 'admin.high_availability.create_zkfc': {
  1096. 'real': '/clusters/{clusterName}/services?ServiceInfo/service_name=HDFS',
  1097. 'mock': '',
  1098. 'type': 'POST',
  1099. 'format': function() {
  1100. return {
  1101. data: JSON.stringify({
  1102. "components": [
  1103. {
  1104. "ServiceComponentInfo": {
  1105. "component_name": "ZKFC"
  1106. }
  1107. }
  1108. ]
  1109. })
  1110. }
  1111. }
  1112. },
  1113. 'admin.high_availability.install_component': {
  1114. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  1115. 'mock': '',
  1116. 'type': 'PUT',
  1117. 'format': function (data) {
  1118. return {
  1119. data: JSON.stringify({
  1120. RequestInfo: {
  1121. "context": "Install " + data.displayName
  1122. },
  1123. Body: {
  1124. "HostRoles": {
  1125. "state": "INSTALLED"
  1126. }
  1127. }
  1128. })
  1129. }
  1130. }
  1131. },
  1132. 'admin.high_availability.start_component': {
  1133. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  1134. 'mock': '',
  1135. 'type': 'PUT',
  1136. 'format': function (data) {
  1137. return {
  1138. data: JSON.stringify({
  1139. RequestInfo: {
  1140. "context": "Start " + data.displayName
  1141. },
  1142. Body: {
  1143. "HostRoles": {
  1144. "state": "STARTED"
  1145. }
  1146. }
  1147. })
  1148. }
  1149. }
  1150. },
  1151. 'admin.high_availability.maintenance_mode': {
  1152. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  1153. 'mock': '',
  1154. 'type': 'PUT',
  1155. 'format': function () {
  1156. return {
  1157. data: JSON.stringify({
  1158. "HostRoles": {
  1159. "state": "DISABLED"
  1160. }
  1161. })
  1162. }
  1163. }
  1164. },
  1165. 'admin.high_availability.stop_component': {
  1166. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  1167. 'mock': '',
  1168. 'type': 'PUT',
  1169. 'format': function (data) {
  1170. return {
  1171. data: JSON.stringify({
  1172. RequestInfo: {
  1173. "context": "Stop " + data.displayName
  1174. },
  1175. Body: {
  1176. "HostRoles": {
  1177. "state": "INSTALLED"
  1178. }
  1179. }
  1180. })
  1181. }
  1182. }
  1183. },
  1184. 'admin.high_availability.load_configs': {
  1185. 'real': '/clusters/{clusterName}/configurations?(type=core-site&tag={coreSiteTag})|(type=hdfs-site&tag={hdfsSiteTag})',
  1186. 'mock': '',
  1187. 'type': 'GET'
  1188. },
  1189. 'admin.high_availability.save_configs': {
  1190. 'real': '/clusters/{clusterName}',
  1191. 'mock': '',
  1192. 'type': 'PUT',
  1193. 'format': function (data) {
  1194. return {
  1195. async: false,
  1196. data: JSON.stringify({
  1197. Clusters: {
  1198. desired_config: {
  1199. "type": data.siteName,
  1200. "tag": 'version' + (new Date).getTime(),
  1201. "properties": data.properties
  1202. }
  1203. }
  1204. })
  1205. }
  1206. }
  1207. },
  1208. 'admin.high_availability.load_hbase_configs': {
  1209. 'real': '/clusters/{clusterName}/configurations?type=hbase-site&tag={hbaseSiteTag}',
  1210. 'mock': '',
  1211. 'type': 'GET'
  1212. },
  1213. 'admin.delete_component': {
  1214. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  1215. 'mock': '',
  1216. 'type': 'DELETE'
  1217. },
  1218. 'admin.security.cluster_configs': {
  1219. 'real': '/clusters/{clusterName}',
  1220. 'mock': '',
  1221. 'format': function() {
  1222. return {
  1223. timeout: 10000
  1224. };
  1225. }
  1226. },
  1227. 'admin.delete_host': {
  1228. 'real': '/clusters/{clusterName}/hosts/{hostName}',
  1229. 'mock': '',
  1230. 'type': 'DELETE'
  1231. },
  1232. 'admin.get.all_configurations': {
  1233. 'real': '/clusters/{clusterName}/configurations?{urlParams}',
  1234. 'mock': '',
  1235. 'format': function() {
  1236. return {
  1237. timeout: 10000
  1238. };
  1239. }
  1240. },
  1241. 'admin.security.apply_configurations': {
  1242. 'real': '/clusters/{clusterName}',
  1243. 'mock': '',
  1244. 'format': function (data) {
  1245. return {
  1246. type: 'PUT',
  1247. timeout: 10000,
  1248. data: data.configData
  1249. };
  1250. }
  1251. },
  1252. 'admin.security.apply_configuration': {
  1253. 'real': '/clusters/{clusterName}',
  1254. 'mock': '',
  1255. 'format': function(data) {
  1256. return {
  1257. type: 'PUT',
  1258. async: false,
  1259. timeout: 5000,
  1260. data: JSON.stringify(data.clusterData)
  1261. };
  1262. }
  1263. },
  1264. 'admin.security.add.cluster_configs': {
  1265. 'real': '/clusters/{clusterName}' + '?fields=Clusters/desired_configs',
  1266. 'mock': '',
  1267. 'format': function() {
  1268. return {
  1269. timeout: 10000
  1270. };
  1271. }
  1272. },
  1273. 'admin.stack_upgrade.run_upgrade': {
  1274. 'real': '/clusters/{clusterName}',
  1275. 'mock': '',
  1276. 'format': function (data) {
  1277. return {
  1278. type: 'PUT',
  1279. async: false,
  1280. data: data.data
  1281. };
  1282. }
  1283. },
  1284. 'admin.stack_upgrade.stop_services': {
  1285. 'real': '/clusters/{clusterName}/services?ServiceInfo/state=STARTED',
  1286. 'mock': '',
  1287. 'format': function (data) {
  1288. return {
  1289. type: 'PUT',
  1290. async: false,
  1291. data: data.data
  1292. };
  1293. }
  1294. },
  1295. 'admin.user.create': {
  1296. 'real': '/users/{user}',
  1297. 'mock': '/data/users/users.json',
  1298. 'format': function(data) {
  1299. return {
  1300. type: 'POST',
  1301. data: JSON.stringify(data.data)
  1302. }
  1303. }
  1304. },
  1305. 'admin.user.delete': {
  1306. 'real': '/users/{user}',
  1307. 'mock': '/data/users/users.json',
  1308. 'format': function() {
  1309. return {
  1310. type: 'DELETE'
  1311. }
  1312. }
  1313. },
  1314. 'admin.user.edit': {
  1315. 'real': '/users/{user}',
  1316. 'mock':'/data/users/users.json',
  1317. 'format': function(data) {
  1318. return {
  1319. type: 'PUT',
  1320. data: data.data
  1321. }
  1322. }
  1323. },
  1324. 'admin.stack_upgrade.do_poll': {
  1325. 'real': '/clusters/{cluster}/requests/{requestId}?fields=tasks/*',
  1326. 'mock': '/data/wizard/{mock}'
  1327. },
  1328. 'wizard.advanced_repositories.valid_url': {
  1329. 'real': '/stacks2/{stackName}/versions/{stackVersion}/operatingSystems/{osType}/repositories/{nameVersionCombo}',
  1330. 'mock': '',
  1331. 'type': 'PUT',
  1332. 'format': function (data) {
  1333. return {
  1334. async: true,
  1335. data: JSON.stringify(data.data)
  1336. }
  1337. }
  1338. },
  1339. 'wizard.install_services.add_host_controller.is_retry': {
  1340. 'real': '/clusters/{cluster}/host_components',
  1341. 'mock': '',
  1342. 'format': function (data) {
  1343. return {
  1344. type: 'PUT',
  1345. async: false,
  1346. data: data.data
  1347. };
  1348. }
  1349. },
  1350. 'wizard.install_services.add_host_controller.not_is_retry': {
  1351. 'real': '/clusters/{cluster}/host_components',
  1352. 'mock': '',
  1353. 'format': function(data) {
  1354. return {
  1355. type: 'PUT',
  1356. async: false,
  1357. data: data.data
  1358. };
  1359. }
  1360. },
  1361. 'wizard.install_services.installer_controller.is_retry': {
  1362. 'real': '/clusters/{cluster}/host_components?HostRoles/state=INSTALLED',
  1363. 'mock': '/data/wizard/deploy/2_hosts/poll_1.json',
  1364. 'type': 'PUT',
  1365. 'format': function (data) {
  1366. return {
  1367. async: false,
  1368. data: data.data
  1369. };
  1370. }
  1371. },
  1372. 'wizard.install_services.installer_controller.not_is_retry': {
  1373. 'real': '/clusters/{cluster}/services?ServiceInfo/state=INIT',
  1374. 'mock': '/data/wizard/deploy/2_hosts/poll_1.json',
  1375. 'type': 'PUT',
  1376. 'format': function (data) {
  1377. return {
  1378. async: false,
  1379. data: data.data
  1380. };
  1381. }
  1382. },
  1383. 'wizard.install_services.add_service_controller.get_failed_host_components': {
  1384. 'real': '/clusters/{clusterName}/host_components?fields=HostRoles/state,component/ServiceComponentInfo/service_name',
  1385. 'mock': '',
  1386. 'format': function() {
  1387. return {
  1388. async: false
  1389. };
  1390. }
  1391. },
  1392. 'wizard.service_components': {
  1393. 'real': '{stackUrl}/stackServices?fields=StackServices/comments,StackServices/service_version,serviceComponents/*',
  1394. 'mock': '/data/stacks/HDP-2.1/service_components.json',
  1395. 'format': function(data) {
  1396. return {
  1397. timeout: 10000,
  1398. async: !!data.async
  1399. };
  1400. }
  1401. },
  1402. 'wizard.step9.installer.get_host_status': {
  1403. 'real': '/clusters/{cluster}/hosts?fields=Hosts/host_state,host_components/HostRoles/state',
  1404. 'mock': '/data/wizard/deploy/5_hosts/get_host_state.json',
  1405. 'format': function () {
  1406. return {
  1407. async: false
  1408. };
  1409. }
  1410. },
  1411. 'wizard.step9.installer.launch_start_services': {
  1412. 'real': '/clusters/{cluster}/services?ServiceInfo/state=INSTALLED&params/run_smoke_test=true&params/reconfigure_client=false',
  1413. 'mock': '/data/wizard/deploy/5_hosts/poll_6.json',
  1414. 'format': function (data) {
  1415. var d = {
  1416. type: 'PUT',
  1417. async: false,
  1418. data: data.data
  1419. };
  1420. if (App.testMode) {
  1421. d.type = 'GET';
  1422. }
  1423. return d;
  1424. }
  1425. },
  1426. 'wizard.step9.add_host.launch_start_services': {
  1427. 'real': '/clusters/{cluster}/host_components',
  1428. 'mock': '/data/wizard/deploy/5_hosts/poll_6.json',
  1429. 'format': function (data) {
  1430. return {
  1431. type: 'PUT',
  1432. async: false,
  1433. data: data.data
  1434. };
  1435. }
  1436. },
  1437. 'wizard.step9.load_log': {
  1438. 'real': '/clusters/{cluster}/requests/{requestId}?fields=tasks/Tasks/command,tasks/Tasks/exit_code,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,tasks/Tasks/status&minimal_response=true',
  1439. 'mock': '/data/wizard/deploy/5_hosts/poll_{numPolls}.json',
  1440. 'format': function () {
  1441. return {
  1442. type: 'GET',
  1443. async: true,
  1444. dataType: 'text'
  1445. };
  1446. }
  1447. },
  1448. 'wizard.step8.delete_cluster': {
  1449. 'real': '/clusters/{name}',
  1450. 'mock': '',
  1451. 'format': function() {
  1452. return {
  1453. type: 'DELETE',
  1454. async: false
  1455. };
  1456. }
  1457. },
  1458. 'wizard.step8.existing_cluster_names': {
  1459. 'real': '/clusters',
  1460. 'mock': '',
  1461. 'format': function() {
  1462. return {
  1463. async: false
  1464. };
  1465. }
  1466. },
  1467. 'wizard.step8.create_cluster': {
  1468. 'real':'/clusters/{cluster}',
  1469. 'mock':'',
  1470. 'format': function(data) {
  1471. return {
  1472. type: 'POST',
  1473. async: true,
  1474. dataType: 'text',
  1475. data: data.data
  1476. }
  1477. }
  1478. },
  1479. 'wizard.step8.create_selected_services': {
  1480. 'real':'/clusters/{cluster}/services',
  1481. 'mock':'',
  1482. 'format': function(data) {
  1483. return {
  1484. type: 'POST',
  1485. async: true,
  1486. dataType: 'text',
  1487. data: data.data
  1488. }
  1489. }
  1490. },
  1491. 'wizard.step8.create_components': {
  1492. 'real':'/clusters/{cluster}/services?ServiceInfo/service_name={serviceName}',
  1493. 'mock':'',
  1494. 'format': function(data) {
  1495. return {
  1496. type: 'POST',
  1497. async: true,
  1498. dataType: 'text',
  1499. data: data.data
  1500. }
  1501. }
  1502. },
  1503. 'wizard.step8.register_host_to_cluster': {
  1504. 'real':'/clusters/{cluster}/hosts',
  1505. 'mock':'',
  1506. 'format': function(data) {
  1507. return {
  1508. type: 'POST',
  1509. async: true,
  1510. dataType: 'text',
  1511. data: data.data
  1512. }
  1513. }
  1514. },
  1515. 'wizard.step8.register_host_to_component': {
  1516. 'real':'/clusters/{cluster}/hosts',
  1517. 'mock':'',
  1518. 'format': function(data) {
  1519. return {
  1520. type: 'POST',
  1521. async: true,
  1522. dataType: 'text',
  1523. data: data.data
  1524. }
  1525. }
  1526. },
  1527. 'wizard.step8.apply_configuration_to_cluster': {
  1528. 'real':'/clusters/{cluster}',
  1529. 'mock':'',
  1530. 'format': function(data) {
  1531. return {
  1532. type: 'PUT',
  1533. async: true,
  1534. dataType: 'text',
  1535. data: data.data
  1536. }
  1537. }
  1538. },
  1539. 'wizard.step8.apply_configuration_groups': {
  1540. 'real':'/clusters/{cluster}/config_groups',
  1541. 'mock':'',
  1542. 'format': function(data) {
  1543. return {
  1544. type: 'POST',
  1545. async: true,
  1546. dataType: 'text',
  1547. data: data.data
  1548. }
  1549. }
  1550. },
  1551. 'wizard.step8.set_local_repos': {
  1552. 'real':'{stack2VersionURL}/operatingSystems/{osType}/repositories/{name}',
  1553. 'mock':'',
  1554. 'format': function(data) {
  1555. return {
  1556. type: 'PUT',
  1557. async: true,
  1558. dataType: 'text',
  1559. data: data.data
  1560. }
  1561. }
  1562. },
  1563. 'wizard.step3.host_info': {
  1564. 'real': '/hosts?fields=Hosts/total_mem,Hosts/cpu_count,Hosts/disk_info,Hosts/last_agent_env,Hosts/host_name,Hosts/os_type,Hosts/os_arch,Hosts/ip',
  1565. 'mock': '/data/wizard/bootstrap/two_hosts_information.json',
  1566. 'format': function() {
  1567. return {
  1568. contentType: 'application/json'
  1569. };
  1570. }
  1571. },
  1572. 'wizard.step3.rerun_checks': {
  1573. 'real': '/hosts?fields=Hosts/last_agent_env',
  1574. 'mock': '/data/wizard/bootstrap/two_hosts_information.json',
  1575. 'format': function() {
  1576. return {
  1577. contentType: 'application/json'
  1578. };
  1579. }
  1580. },
  1581. 'wizard.step3.bootstrap': {
  1582. 'real': '/bootstrap/{bootRequestId}',
  1583. 'mock': '/data/wizard/bootstrap/poll_{numPolls}.json'
  1584. },
  1585. 'wizard.step3.is_hosts_registered': {
  1586. 'real': '/hosts',
  1587. 'mock': '/data/wizard/bootstrap/single_host_registration.json'
  1588. },
  1589. 'wizard.stacks': {
  1590. 'real': '/stacks2',
  1591. 'mock': '/data/wizard/stack/stacks2.json',
  1592. 'format': function() {
  1593. return {
  1594. async: false
  1595. };
  1596. }
  1597. },
  1598. 'wizard.stacks_versions': {
  1599. 'real': '/stacks2/{stackName}/versions?fields=Versions,operatingSystems/repositories/Repositories',
  1600. 'mock': '/data/wizard/stack/{stackName}_versions.json',
  1601. 'format': function() {
  1602. return {
  1603. async: false
  1604. };
  1605. }
  1606. },
  1607. 'wizard.launch_bootstrap': {
  1608. 'real': '/bootstrap',
  1609. 'mock': '/data/wizard/bootstrap/bootstrap.json',
  1610. 'type': 'POST',
  1611. 'format': function (data) {
  1612. return {
  1613. async: false,
  1614. contentType: 'application/json',
  1615. data: data.bootStrapData
  1616. }
  1617. }
  1618. },
  1619. 'router.login': {
  1620. 'real': '/users/{loginName}',
  1621. 'mock': '/data/users/user_{usr}.json',
  1622. 'format': function (data) {
  1623. var statusCode = jQuery.extend({}, require('data/statusCodes'));
  1624. statusCode['403'] = function () {
  1625. console.log("Error code 403: Forbidden.");
  1626. };
  1627. return {
  1628. statusCode: statusCode
  1629. };
  1630. }
  1631. },
  1632. 'router.login2': {
  1633. 'real': '/clusters',
  1634. 'mock': '/data/clusters/info.json'
  1635. },
  1636. 'router.logoff': {
  1637. 'real': '/logout',
  1638. 'mock': ''
  1639. },
  1640. 'router.set_ambari_stacks': {
  1641. 'real': '/stacks',
  1642. 'mock': '/data/wizard/stack/stacks.json',
  1643. 'format': function() {
  1644. return {
  1645. async: false
  1646. };
  1647. }
  1648. },
  1649. 'router.authentication': {
  1650. 'real': '/clusters',
  1651. 'mock': '/data/clusters/info.json',
  1652. 'format': function() {
  1653. return {
  1654. async: false
  1655. };
  1656. }
  1657. },
  1658. 'ambari.service.load_server_version': {
  1659. 'real': '/services/AMBARI/components/AMBARI_SERVER?fields=RootServiceComponents/component_version',
  1660. 'mock': ''
  1661. },
  1662. 'ambari.service': {
  1663. 'real': '/services/AMBARI/components/AMBARI_SERVER',
  1664. 'mock': '/data/services/ambari_server.json'
  1665. },
  1666. 'ambari.service.load_server_clock': {
  1667. 'real': '/services/AMBARI/components/AMBARI_SERVER?fields=RootServiceComponents/server_clock',
  1668. 'mock': ''
  1669. },
  1670. 'config_groups.create': {
  1671. 'real': '/clusters/{clusterName}/config_groups',
  1672. 'mock': '',
  1673. 'format': function (data) {
  1674. return {
  1675. async: false,
  1676. type: 'POST',
  1677. data: JSON.stringify([{
  1678. "ConfigGroup": {
  1679. "group_name": data.group_name,
  1680. "tag": data.service_id,
  1681. "description": data.description,
  1682. "desired_configs": data.desired_configs,
  1683. "hosts": data.hosts
  1684. }
  1685. }])
  1686. }
  1687. }
  1688. },
  1689. 'config_groups.update': {
  1690. 'real': '/clusters/{clusterName}/config_groups/{id}',
  1691. 'mock': '',
  1692. 'format': function (data) {
  1693. return {
  1694. async: true,
  1695. type: 'PUT',
  1696. data: JSON.stringify(data.data)
  1697. }
  1698. }
  1699. },
  1700. 'rolling_restart.post': {
  1701. 'real': '/clusters/{clusterName}/request_schedules',
  1702. 'mock': '',
  1703. 'format' : function(data) {
  1704. return {
  1705. type : 'POST',
  1706. data : JSON.stringify([ {
  1707. "RequestSchedule" : {
  1708. "batch" : [ {
  1709. "requests" : data.batches
  1710. }, {
  1711. "batch_settings" : {
  1712. "batch_separation_in_seconds" : data.intervalTimeSeconds,
  1713. "task_failure_tolerance" : data.tolerateSize
  1714. }
  1715. } ]
  1716. }
  1717. } ])
  1718. }
  1719. }
  1720. },
  1721. 'request_schedule.delete': {
  1722. 'real': '/clusters/{clusterName}/request_schedules/{request_schedule_id}',
  1723. 'mock': '',
  1724. 'format' : function() {
  1725. return {
  1726. type : 'DELETE'
  1727. }
  1728. }
  1729. },
  1730. 'request_schedule.get': {
  1731. 'real': '/clusters/{clusterName}/request_schedules/{request_schedule_id}',
  1732. 'mock': ''
  1733. },
  1734. 'restart.hostComponents': {
  1735. 'real':'/clusters/{clusterName}/requests',
  1736. 'mock':'',
  1737. 'format': function(data) {
  1738. return {
  1739. type : 'POST',
  1740. data : JSON.stringify({
  1741. "RequestInfo": {
  1742. "command": "RESTART",
  1743. "context": data.context
  1744. },
  1745. "Requests/resource_filters": data.resource_filters
  1746. })
  1747. }
  1748. }
  1749. },
  1750. 'mirroring.get_all_entities': {
  1751. 'real': '/proxy?url=http://{falconServer}:15000/api/entities/list/{type}?fields=status&user.name=ambari-qa',
  1752. 'mock': '/data/mirroring/{type}s.xml',
  1753. 'apiPrefix': '',
  1754. 'format': function () {
  1755. return {
  1756. dataType: 'xml'
  1757. }
  1758. }
  1759. },
  1760. 'mirroring.get_definition': {
  1761. 'real': '/proxy?url=http://{falconServer}:15000/api/entities/definition/{type}/{name}?user.name=ambari-qa',
  1762. 'mock': '/data/mirroring/{name}_definition.xml',
  1763. 'apiPrefix': '',
  1764. 'format': function () {
  1765. return {
  1766. cache: true,
  1767. dataType: 'xml'
  1768. }
  1769. }
  1770. },
  1771. 'mirroring.dataset.get_all_instances': {
  1772. 'real': '/proxy?url=http://{falconServer}:15000/api/instance/status/feed/{dataset}?start={start}&end={end}&user.name=ambari-qa',
  1773. 'mock': '/data/mirroring/{dataset}_instances.json',
  1774. 'apiPrefix': ''
  1775. },
  1776. 'mirroring.create_new_dataset': {
  1777. 'real': '/proxy?url=http://{falconServer}:15000/api/entities/submitAndSchedule/feed?user.name=ambari-qa',
  1778. 'mock': '/data/mirroring/succeeded.json',
  1779. 'apiPrefix': '',
  1780. 'type': 'POST',
  1781. 'format': function (data) {
  1782. return {
  1783. contentType: 'text/xml',
  1784. dataType: 'xml',
  1785. data: data.dataset,
  1786. headers: {
  1787. 'AmbariProxy-Content-Type': 'text/xml'
  1788. }
  1789. }
  1790. }
  1791. },
  1792. 'mirroring.submit_entity': {
  1793. 'real': '/proxy?url=http://{falconServer}:15000/api/entities/submit/{type}?user.name=ambari-qa',
  1794. 'mock': '/data/mirroring/succeeded.json',
  1795. 'apiPrefix': '',
  1796. 'type': 'POST',
  1797. 'format': function (data) {
  1798. return {
  1799. contentType: 'text/xml',
  1800. dataType: 'xml',
  1801. data: data.entity,
  1802. headers: {
  1803. 'AmbariProxy-Content-Type': 'text/xml'
  1804. }
  1805. }
  1806. }
  1807. },
  1808. 'mirroring.update_entity': {
  1809. 'real': '/proxy?url=http://{falconServer}:15000/api/entities/update/{type}/{name}?user.name=ambari-qa',
  1810. 'mock': '/data/mirroring/succeeded.json',
  1811. 'apiPrefix': '',
  1812. 'type': 'POST',
  1813. 'format': function (data) {
  1814. return {
  1815. contentType: 'text/xml',
  1816. dataType: 'xml',
  1817. data: data.entity,
  1818. headers: {
  1819. 'AmbariProxy-Content-Type': 'text/xml'
  1820. }
  1821. }
  1822. }
  1823. },
  1824. 'mirroring.delete_entity': {
  1825. 'real': '/proxy?url=http://{falconServer}:15000/api/entities/delete/{type}/{name}?user.name=ambari-qa',
  1826. 'mock': '/data/mirroring/succeeded.json',
  1827. 'apiPrefix': '',
  1828. 'type': 'DELETE',
  1829. 'format': function () {
  1830. return {
  1831. dataType: 'xml'
  1832. }
  1833. }
  1834. },
  1835. 'mirroring.suspend_entity': {
  1836. 'real': '/proxy?url=http://{falconServer}:15000/api/entities/suspend/{type}/{name}?user.name=ambari-qa',
  1837. 'mock': '/data/mirroring/succeeded.json',
  1838. 'apiPrefix': '',
  1839. 'type': 'POST',
  1840. 'format': function (data) {
  1841. return {
  1842. dataType: 'xml',
  1843. data: data.entity
  1844. }
  1845. }
  1846. },
  1847. 'mirroring.resume_entity': {
  1848. 'real': '/proxy?url=http://{falconServer}:15000/api/entities/resume/{type}/{name}?user.name=ambari-qa',
  1849. 'mock': '/data/mirroring/succeeded.json',
  1850. 'apiPrefix': '',
  1851. 'type': 'POST',
  1852. 'format': function () {
  1853. return {
  1854. dataType: 'xml'
  1855. }
  1856. }
  1857. },
  1858. 'mirroring.schedule_entity': {
  1859. 'real': '/proxy?url=http://{falconServer}:15000/api/entities/schedule/{type}/{name}?user.name=ambari-qa',
  1860. 'mock': '/data/mirroring/succeeded.json',
  1861. 'apiPrefix': '',
  1862. 'type': 'POST',
  1863. 'format': function () {
  1864. return {
  1865. dataType: 'xml'
  1866. }
  1867. }
  1868. },
  1869. 'mirroring.suspend_instance': {
  1870. 'real': '/proxy?url=http://{falconServer}:15000/api/instance/suspend/feed/{feed}?start={name}&user.name=ambari-qa',
  1871. 'mock': '/data/mirroring/succeeded.json',
  1872. 'apiPrefix': '',
  1873. 'type': 'POST'
  1874. },
  1875. 'mirroring.resume_instance': {
  1876. 'real': '/proxy?url=http://{falconServer}:15000/api/instance/resume/feed/{feed}?start={name}&user.name=ambari-qa',
  1877. 'mock': '/data/mirroring/succeeded.json',
  1878. 'apiPrefix': '',
  1879. 'type': 'POST'
  1880. },
  1881. 'mirroring.kill_instance': {
  1882. 'real': '/proxy?url=http://{falconServer}:15000/api/instance/kill/feed/{feed}?start={name}&user.name=ambari-qa',
  1883. 'mock': '/data/mirroring/succeeded.json',
  1884. 'apiPrefix': '',
  1885. 'type': 'POST'
  1886. },
  1887. 'bulk_request.host_components': {
  1888. 'real': '/clusters/{clusterName}/host_components',
  1889. 'mock': '',
  1890. 'format': function(data) {
  1891. return {
  1892. type: 'PUT',
  1893. data: JSON.stringify({
  1894. RequestInfo: {
  1895. context: data.requestInfo,
  1896. query: 'HostRoles/component_name=' + data.componentName + '&HostRoles/host_name.in(' + data.hostNames + ')&HostRoles/maintenance_state=OFF'
  1897. },
  1898. Body: {
  1899. HostRoles: {
  1900. state: data.state
  1901. }
  1902. }
  1903. })
  1904. }
  1905. }
  1906. },
  1907. 'bulk_request.hosts.all_components': {
  1908. 'real': '/clusters/{clusterName}/host_components',
  1909. 'mock': '',
  1910. 'format': function(data) {
  1911. return {
  1912. type: 'PUT',
  1913. data: JSON.stringify({
  1914. RequestInfo: {
  1915. context: data.requestInfo,
  1916. query: data.query
  1917. },
  1918. Body: {
  1919. HostRoles: {
  1920. state: data.state
  1921. }
  1922. }
  1923. })
  1924. }
  1925. }
  1926. },
  1927. 'bulk_request.decommission': {
  1928. 'real' : '/clusters/{clusterName}/requests',
  1929. 'mock' : '',
  1930. 'format': function(data) {
  1931. return {
  1932. type: 'POST',
  1933. data: JSON.stringify({
  1934. 'RequestInfo': {
  1935. 'context': data.context,
  1936. 'command': 'DECOMMISSION',
  1937. 'parameters': data.parameters
  1938. },
  1939. "Requests/resource_filters": [{"service_name" : data.serviceName, "component_name" : data.componentName}]
  1940. })
  1941. }
  1942. }
  1943. },
  1944. 'bulk_request.hosts.passive_state': {
  1945. 'real': '/clusters/{clusterName}/hosts',
  1946. 'mock': '',
  1947. 'format': function(data) {
  1948. return {
  1949. type: 'PUT',
  1950. data: JSON.stringify({
  1951. RequestInfo: {
  1952. context: data.requestInfo,
  1953. query: 'Hosts/host_name.in(' + data.hostNames + ')'
  1954. },
  1955. Body: {
  1956. Hosts: {
  1957. maintenance_state: data.passive_state
  1958. }
  1959. }
  1960. })
  1961. }
  1962. }
  1963. },
  1964. 'bulk_request.hosts.all_components.passive_state': {
  1965. 'real': '/clusters/{clusterName}/host_components',
  1966. 'mock': '',
  1967. 'format': function(data) {
  1968. return {
  1969. type: 'PUT',
  1970. data: JSON.stringify({
  1971. RequestInfo: {
  1972. context: data.requestInfo,
  1973. query: data.query
  1974. },
  1975. Body: {
  1976. HostRoles: {
  1977. maintenance_state: data.passive_state
  1978. }
  1979. }
  1980. })
  1981. }
  1982. }
  1983. },
  1984. 'jobs.lastID': {
  1985. 'real': '/proxy?url=http://{historyServerHostName}:{ahsWebPort}/ws/v1/timeline/HIVE_QUERY_ID?limit=1&secondaryFilter=tez:true',
  1986. 'mock': 'data/jobs/hive-queries.json',
  1987. 'apiPrefix': ''
  1988. },
  1989. 'jobs.tezDag.NametoID': {
  1990. 'real': '/proxy?url=http://{historyServerHostName}:{ahsWebPort}/ws/v1/timeline/TEZ_DAG_ID?primaryFilter=dagName:{tezDagName}',
  1991. 'mock': '/data/jobs/tezDag-name-to-id.json',
  1992. 'apiPrefix': ''
  1993. },
  1994. 'jobs.tezDag.tezDagId': {
  1995. 'real': '/proxy?url=http://{historyServerHostName}:{ahsWebPort}/ws/v1/timeline/TEZ_DAG_ID/{tezDagId}?fields=relatedentities,otherinfo',
  1996. 'mock': '/data/jobs/tezDag.json',
  1997. 'apiPrefix': ''
  1998. },
  1999. 'jobs.tezDag.tezDagVertexId': {
  2000. 'real': '/proxy?url=http://{historyServerHostName}:{ahsWebPort}/ws/v1/timeline/TEZ_VERTEX_ID/{tezDagVertexId}?fields=otherinfo',
  2001. 'mock': '/data/jobs/tezDagVertex.json',
  2002. 'apiPrefix': ''
  2003. },
  2004. 'views.info': {
  2005. 'real': '/views',
  2006. 'mock':''
  2007. },
  2008. 'views.instances': {
  2009. 'real': '/views/{viewName}',
  2010. 'mock':''
  2011. },
  2012. 'host.host_component.flume.metrics': {
  2013. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/FLUME_HANDLER?fields=metrics/flume/flume/{flumeComponent}/*',
  2014. 'mock': '',
  2015. 'format': function(data) {
  2016. return {
  2017. async: data.async
  2018. }
  2019. }
  2020. },
  2021. 'host.host_component.flume.metrics.timeseries': {
  2022. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/FLUME_HANDLER?fields=metrics/flume/flume/{flumeComponent}/*/{flumeComponentMetric}[{fromSeconds},{toSeconds},{stepSeconds}]',
  2023. 'mock': ''
  2024. }
  2025. };
  2026. /**
  2027. * Replace data-placeholders to its values
  2028. *
  2029. * @param {String} url
  2030. * @param {Object} data
  2031. * @return {String}
  2032. */
  2033. var formatUrl = function (url, data) {
  2034. if (!url) return null;
  2035. var keys = url.match(/\{\w+\}/g);
  2036. keys = (keys === null) ? [] : keys;
  2037. if (keys) {
  2038. keys.forEach(function (key) {
  2039. var raw_key = key.substr(1, key.length - 2);
  2040. var replace;
  2041. if (!data || !data[raw_key]) {
  2042. replace = '';
  2043. }
  2044. else {
  2045. replace = data[raw_key];
  2046. }
  2047. url = url.replace(new RegExp(key, 'g'), replace);
  2048. });
  2049. }
  2050. return url;
  2051. };
  2052. /**
  2053. * this = object from config
  2054. * @return {Object}
  2055. */
  2056. var formatRequest = function (data) {
  2057. var opt = {
  2058. type: this.type || 'GET',
  2059. timeout: App.timeout,
  2060. dataType: 'json',
  2061. statusCode: require('data/statusCodes')
  2062. };
  2063. if (App.testMode) {
  2064. opt.url = formatUrl(this.mock ? this.mock : '', data);
  2065. opt.type = 'GET';
  2066. }
  2067. else {
  2068. var prefix = this.apiPrefix != null ? this.apiPrefix : App.apiPrefix;
  2069. opt.url = prefix + formatUrl(this.real, data);
  2070. }
  2071. if (this.format) {
  2072. jQuery.extend(opt, this.format(data, opt));
  2073. }
  2074. return opt;
  2075. };
  2076. /**
  2077. * Wrapper for all ajax requests
  2078. *
  2079. * @type {Object}
  2080. */
  2081. var ajax = Em.Object.extend({
  2082. /**
  2083. * Send ajax request
  2084. *
  2085. * @param {Object} config
  2086. * @return {$.ajax} jquery ajax object
  2087. *
  2088. * config fields:
  2089. * name - url-key in the urls-object *required*
  2090. * sender - object that send request (need for proper callback initialization) *required*
  2091. * data - object with data for url-format
  2092. * beforeSend - method-name for ajax beforeSend response callback
  2093. * success - method-name for ajax success response callback
  2094. * error - method-name for ajax error response callback
  2095. * callback - callback from <code>App.updater.run</code> library
  2096. */
  2097. send: function (config) {
  2098. console.warn('============== ajax ==============', config.name, config.data);
  2099. if (!config.sender) {
  2100. console.warn('Ajax sender should be defined!');
  2101. return null;
  2102. }
  2103. // default parameters
  2104. var params = {
  2105. clusterName: App.get('clusterName')
  2106. };
  2107. // extend default parameters with provided
  2108. if (config.data) {
  2109. jQuery.extend(params, config.data);
  2110. }
  2111. var opt = {};
  2112. if (!urls[config.name]) {
  2113. console.warn('Invalid name provided!');
  2114. return null;
  2115. }
  2116. opt = formatRequest.call(urls[config.name], params);
  2117. opt.context = this;
  2118. // object sender should be provided for processing beforeSend, success and error responses
  2119. opt.beforeSend = function (xhr) {
  2120. if (config.beforeSend) {
  2121. config.sender[config.beforeSend](opt, xhr, params);
  2122. }
  2123. };
  2124. opt.success = function (data) {
  2125. console.log("TRACE: The url is: " + opt.url);
  2126. if (config.success) {
  2127. config.sender[config.success](data, opt, params);
  2128. }
  2129. };
  2130. opt.error = function (request, ajaxOptions, error) {
  2131. if (config.error) {
  2132. config.sender[config.error](request, ajaxOptions, error, opt, params);
  2133. } else {
  2134. this.defaultErrorHandler(request, opt.url, opt.type);
  2135. }
  2136. };
  2137. opt.complete = function () {
  2138. if (config.callback) {
  2139. config.callback();
  2140. }
  2141. };
  2142. if ($.mocho) {
  2143. opt.url = 'http://' + $.hostName + opt.url;
  2144. }
  2145. return $.ajax(opt);
  2146. },
  2147. // A single instance of App.ModalPopup view
  2148. modalPopup: null,
  2149. /**
  2150. * defaultErrorHandler function is referred from App.ajax.send function and App.HttpClient.defaultErrorHandler function
  2151. * @jqXHR {jqXHR Object}
  2152. * @url {string}
  2153. * @method {String} Http method
  2154. * @showStatus {number} HTTP response code which should be shown. Default is 500.
  2155. */
  2156. defaultErrorHandler: function (jqXHR, url, method, showStatus) {
  2157. method = method || 'GET';
  2158. var self = this;
  2159. var api = " received on " + method + " method for API: " + url;
  2160. try {
  2161. var json = $.parseJSON(jqXHR.responseText);
  2162. var message = json.message;
  2163. } catch (err) {
  2164. }
  2165. if (!showStatus) {
  2166. showStatus = 500;
  2167. }
  2168. var statusCode = jqXHR.status + " status code";
  2169. if (jqXHR.status === showStatus && !this.modalPopup) {
  2170. this.modalPopup = App.ModalPopup.show({
  2171. header: jqXHR.statusText,
  2172. secondary: false,
  2173. onPrimary: function () {
  2174. this.hide();
  2175. self.modalPopup = null;
  2176. },
  2177. bodyClass: Ember.View.extend({
  2178. classNames: ['api-error'],
  2179. templateName: require('templates/utils/ajax'),
  2180. api: api,
  2181. statusCode: statusCode,
  2182. message: message,
  2183. showMessage: !!message
  2184. })
  2185. });
  2186. }
  2187. }
  2188. });
  2189. /**
  2190. * Add few access-methods for test purposes
  2191. */
  2192. if ($.mocho) {
  2193. ajax.reopen({
  2194. /**
  2195. * Don't use it anywhere except tests!
  2196. * @returns {Array}
  2197. */
  2198. fakeGetUrlNames: function() {
  2199. return Em.keys(urls);
  2200. },
  2201. /**
  2202. * Don't use it anywhere except tests!
  2203. * @param name
  2204. * @returns {*}
  2205. */
  2206. fakeGetUrl: function(name) {
  2207. return urls[name];
  2208. },
  2209. /**
  2210. * Don't use it anywhere except tests!
  2211. * @param url
  2212. * @param data
  2213. * @returns {String}
  2214. */
  2215. fakeFormatUrl: function(url, data) {
  2216. return formatUrl(url, data);
  2217. },
  2218. /**
  2219. * Don't use it anywhere except tests!
  2220. * @param urlObj
  2221. * @param data
  2222. * @returns {Object}
  2223. */
  2224. fakeFormatRequest: function(urlObj, data) {
  2225. return formatRequest.call(urlObj, data);
  2226. }
  2227. });
  2228. }
  2229. App.ajax = ajax.create({});