ajax.js 72 KB

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