ajax.js 72 KB

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