ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [04/22] ambari git commit: AMBARI-14741. Ambari Web Unit Test failure on trunk (App.WizardStep8Controller) (onechiporenko)
Date Thu, 21 Jan 2016 19:21:03 GMT
http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index a108c8d..51e649c 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -24,6 +24,7 @@ require('models/host_component');
 require('models/host_stack_version');
 var batchUtils = require('utils/batch_scheduled_requests');
 var hostsManagement = require('utils/hosts');
+var testHelpers = require('test/helpers');
 var controller;
 
 function getController() {
@@ -36,17 +37,9 @@ function getController() {
 describe('App.MainHostDetailsController', function () {
 
   beforeEach(function () {
-    sinon.stub(App.ajax, 'send').returns({
-      then: Em.K,
-      complete: Em.K
-    });
     controller = getController();
   });
 
-  afterEach(function () {
-    App.ajax.send.restore();
-  });
-
   App.TestAliases.testAsComputedFilterBy(getController(), 'serviceNonClientActiveComponents', 'serviceActiveComponents', 'isClient', false);
 
   describe('#routeHome()', function () {
@@ -140,14 +133,12 @@ describe('App.MainHostDetailsController', function () {
   describe("#pullNnCheckPointTime()", function() {
     it("valid request is sent", function() {
       controller.pullNnCheckPointTime('host1');
-      expect(App.ajax.send.calledWith({
-        name: 'common.host_component.getNnCheckPointTime',
-        sender: controller,
-        data: {
-          host: 'host1'
-        },
-        success: 'parseNnCheckPointTime'
-      })).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'common.host_component.getNnCheckPointTime');
+      expect(args[0]).to.exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        host: 'host1'
+      });
     });
   });
 
@@ -166,11 +157,14 @@ describe('App.MainHostDetailsController', function () {
       });
 
       it('1st call endpoint is valid', function () {
-        expect(App.ajax.send.getCall(0).args[0].name).to.be.equal('common.host.host_component.update');
+        var args = testHelpers.findAjaxRequest('name', 'common.host.host_component.update');
+        expect(args).to.exists;
       });
 
       it('1st call data is valid', function () {
-        expect(App.ajax.send.getCall(0).args[0].data).to.be.eql({
+        var args = testHelpers.findAjaxRequest('name', 'common.host.host_component.update');
+        expect(args[0]).to.exists;
+        expect(args[0].data).to.be.eql({
           "hostName": "host1",
           "context": {},
           "component": component,
@@ -201,11 +195,14 @@ describe('App.MainHostDetailsController', function () {
       });
 
       it('1st call endpoint is valid', function () {
-        expect(App.ajax.send.getCall(0).args[0].name).to.be.equal('common.host.host_components.update');
+        var args = testHelpers.findAjaxRequest('name', 'common.host.host_components.update');
+        expect(args).exists;
       });
 
       it('1st call data is valid', function () {
-        expect(App.ajax.send.getCall(0).args[0].data).to.be.eql({
+        var args = testHelpers.findAjaxRequest('name', 'common.host.host_components.update');
+        expect(args[0]).exists;
+        expect(args[0].data).to.be.eql({
           "hostName": "host1",
           "context": {},
           "component": component,
@@ -231,14 +228,12 @@ describe('App.MainHostDetailsController', function () {
     beforeEach(function () {
       sinon.stub(controller, 'mimicWorkStatusChange', Em.K);
       sinon.stub(controller, 'showBackgroundOperationsPopup', Em.K);
-      sinon.stub(App, 'get').withArgs('testMode').returns(false);
       controller.sendComponentCommandSuccessCallback({}, {}, params);
     });
 
     afterEach(function () {
       controller.showBackgroundOperationsPopup.restore();
       controller.mimicWorkStatusChange.restore();
-      App.get.restore();
     });
 
     it('mimicWorkStatusChange is not called', function () {
@@ -466,7 +461,8 @@ describe('App.MainHostDetailsController', function () {
       var popup = controller.upgradeComponent({context: Em.Object.create()});
       expect(App.showConfirmationPopup.calledOnce).to.be.true;
       popup.onPrimary();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'host.host_component.upgrade');
+      expect(args).exists;
     });
   });
 
@@ -475,9 +471,7 @@ describe('App.MainHostDetailsController', function () {
     beforeEach(function () {
       sinon.spy(App, "showConfirmationPopup");
       sinon.stub(batchUtils, "restartHostComponents", Em.K);
-      sinon.stub(controller, 'checkNnLastCheckpointTime', function(callback) {
-        callback();
-      });
+      sinon.stub(controller, 'checkNnLastCheckpointTime', Em.clb);
     });
     afterEach(function () {
       App.showConfirmationPopup.restore();
@@ -636,15 +630,12 @@ describe('App.MainHostDetailsController', function () {
           }
         }
       }});
-      expect(App.ajax.send.calledWith({
-        name: 'admin.get.all_configurations',
-        sender: controller,
-        data: {
-          urlParams: '(type=oozie-env&tag=tag)'
-        },
-        success: 'onLoadOozieConfigs',
-        error: 'onLoadConfigsErrorCallback'
-      })).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'admin.get.all_configurations');
+      expect(args[0]).exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        urlParams: '(type=oozie-env&tag=tag)'
+      });
     });
   });
 
@@ -657,14 +648,12 @@ describe('App.MainHostDetailsController', function () {
           }
         }
       }});
-      expect(App.ajax.send.calledWith({
-        name: 'admin.get.all_configurations',
-        sender: controller,
-        data: {
-          urlParams: '(type=storm-site&tag=tag)'
-        },
-        success: 'onLoadStormConfigs'
-      })).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'admin.get.all_configurations');
+      expect(args[0]).exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        urlParams: '(type=storm-site&tag=tag)'
+      });
     });
   });
 
@@ -730,14 +719,12 @@ describe('App.MainHostDetailsController', function () {
           }
         }
       }});
-      expect(App.ajax.send.calledWith({
-        name: 'admin.get.all_configurations',
-        sender: controller,
-        data: {
-          urlParams: '(type=hive-site&tag=tag)|(type=webhcat-site&tag=tag)|(type=hive-env&tag=tag)|(type=core-site&tag=tag)'
-        },
-        success: 'onLoadHiveConfigs'
-      })).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'admin.get.all_configurations');
+      expect(args[0]).exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        urlParams: '(type=hive-site&tag=tag)|(type=webhcat-site&tag=tag)|(type=hive-env&tag=tag)|(type=core-site&tag=tag)'
+      });
     });
   });
 
@@ -756,14 +743,12 @@ describe('App.MainHostDetailsController', function () {
           }
         }
       }});
-      expect(App.ajax.send.calledWith({
-        name: 'admin.get.all_configurations',
-        sender: controller,
-        data: {
-          urlParams: '(type=core-site&tag=tag)|(type=hdfs-site&tag=tag)|(type=kms-env&tag=tag)'
-        },
-        success: 'onLoadRangerConfigs'
-      })).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'admin.get.all_configurations');
+      expect(args[0]).exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        urlParams: '(type=core-site&tag=tag)|(type=hdfs-site&tag=tag)|(type=kms-env&tag=tag)'
+      });
     });
   });
 
@@ -902,14 +887,16 @@ describe('App.MainHostDetailsController', function () {
         host: {}
       });
       controller.sendRefreshComponentConfigsCommand(component, {});
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'host.host_component.refresh_configs');
+      expect(args[0]).exists;
     });
   });
 
   describe('#loadConfigs()', function () {
     it('Query should be sent', function () {
       controller.loadConfigs();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'config.tags');
+      expect(args).exists;
     });
   });
 
@@ -1031,12 +1018,13 @@ describe('App.MainHostDetailsController', function () {
 
     it('url params is empty', function () {
       expect(controller.loadConfigsSuccessCallback()).to.be.false;
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.findAjaxRequest('name', 'reassign.load_configs');
+      expect(args).not.exists;
     });
     it('url params are correct', function () {
       mockUrlParams = ['param1'];
-      expect(controller.loadConfigsSuccessCallback()).to.be.true;
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'reassign.load_configs');
+      expect(args).exists;
     });
   });
 
@@ -1263,15 +1251,18 @@ describe('App.MainHostDetailsController', function () {
   describe("#saveConfigsBatch()", function () {
     it("no groups", function () {
       controller.saveConfigsBatch([]);
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.filterAjaxRequests('name', 'common.service.configurations');
+      expect(args).to.be.empty;
     });
     it("configs is empty", function () {
       controller.saveConfigsBatch([{}]);
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.filterAjaxRequests('name', 'common.service.configurations');
+      expect(args).to.be.empty;
     });
     it("configs is correct", function () {
       controller.saveConfigsBatch([{'properties': {'site': {}}, 'properties_attributes': {'site': {}}}]);
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.filterAjaxRequests('name', 'common.service.configurations');
+      expect(args).to.have.property('length').equal(1);
     });
   });
 
@@ -1582,7 +1573,8 @@ describe('App.MainHostDetailsController', function () {
       var popup = controller.installComponent(event);
       expect(App.ModalPopup.show.calledOnce).to.be.true;
       popup.onPrimary();
-      expect(App.ajax.send.called).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'common.host.host_component.update');
+      expect(args).exists;
     });
   });
 
@@ -1695,14 +1687,16 @@ describe('App.MainHostDetailsController', function () {
   describe('#doDecommission()', function () {
     it('Query should be sent', function () {
       controller.doDecommission('', '', '', '');
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'host.host_component.decommission_slave');
+      expect(args).exists;
     });
   });
 
   describe('#doDecommissionRegionServer()', function () {
     it('Query should be sent', function () {
       controller.doDecommissionRegionServer('', '', '', '');
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'host.host_component.recommission_and_restart');
+      expect(args).exists;
     });
   });
 
@@ -1743,7 +1737,9 @@ describe('App.MainHostDetailsController', function () {
       expect(result).to.be.an('object');
     });
     it('request is sent with correct data', function () {
-      expect(App.ajax.send.getCall(0).args[0].data.hostNames).to.equal('host1');
+      var args = testHelpers.findAjaxRequest('name', 'host.region_servers.in_inservice');
+      expect(args[0]).exists;
+      expect(args[0].data.hostNames).to.be.equal('host1');
     });
   });
 
@@ -1834,7 +1830,8 @@ describe('App.MainHostDetailsController', function () {
   describe('#doRecommissionAndStart()', function () {
     it('Query should be sent', function () {
       controller.doRecommissionAndStart('', '', '', '');
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'host.host_component.recommission_and_restart');
+      expect(args).exists;
     });
   });
 
@@ -1991,7 +1988,8 @@ describe('App.MainHostDetailsController', function () {
   describe('#hostPassiveModeRequest()', function () {
     it('Query should be sent', function () {
       controller.hostPassiveModeRequest('', '');
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'bulk_request.hosts.passive_state');
+      expect(args).exists;
     });
   });
 
@@ -2618,7 +2616,8 @@ describe('App.MainHostDetailsController', function () {
       var popup = controller.executeCustomCommand({context: Em.Object.create()});
       expect(App.showConfirmationPopup.calledOnce).to.be.true;
       popup.onPrimary();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'service.item.executeCustomCommand');
+      expect(args).exists;
     });
   });
 
@@ -2627,8 +2626,9 @@ describe('App.MainHostDetailsController', function () {
       controller.set('content.hostName', 'host1');
       var component = Em.Object.create({componentName: 'COMP'});
       controller._doDeleteHostComponent(component);
-      expect(App.ajax.send.getCall(0).args[0].name).to.be.equal('common.delete.host_component');
-      expect(App.ajax.send.getCall(0).args[0].data).to.be.eql({
+      var args = testHelpers.findAjaxRequest('name', 'common.delete.host_component');
+      expect(args[0]).exists;
+      expect(args[0].data).to.be.eql({
         componentName: 'COMP',
         hostName: 'host1'
       });
@@ -2636,8 +2636,9 @@ describe('App.MainHostDetailsController', function () {
     it('all components', function () {
       controller.set('content.hostName', 'host1');
       controller._doDeleteHostComponent(null);
-      expect(App.ajax.send.getCall(0).args[0].name).to.be.equal('common.delete.host');
-      expect(App.ajax.send.getCall(0).args[0].data).to.be.eql({
+      var args = testHelpers.findAjaxRequest('name', 'common.delete.host');
+      expect(args[0]).exists;
+      expect(args[0].data).to.be.eql({
         componentName: '',
         hostName: 'host1'
       });
@@ -2723,16 +2724,7 @@ describe('App.MainHostDetailsController', function () {
       controller.mimicWorkStatusChange.restore();
       controller.showBackgroundOperationsPopup.restore();
     });
-    it('testMode is true', function () {
-      App.set('testMode', true);
-
-      controller.upgradeComponentSuccessCallback({}, {}, {component: "COMP"});
-      expect(controller.mimicWorkStatusChange.calledWith("COMP", App.HostComponentStatus.starting, App.HostComponentStatus.started)).to.be.true;
-      expect(controller.showBackgroundOperationsPopup.calledOnce).to.be.true;
-    });
     it('testMode is false', function () {
-      App.set('testMode', false);
-
       controller.upgradeComponentSuccessCallback({}, {}, {component: "COMP"});
       expect(controller.mimicWorkStatusChange.called).to.be.false;
       expect(controller.showBackgroundOperationsPopup.calledOnce).to.be.true;
@@ -2822,12 +2814,10 @@ describe('App.MainHostDetailsController', function () {
     beforeEach(function () {
       sinon.stub(controller, 'showBackgroundOperationsPopup', Em.K);
       sinon.stub(controller, 'mimicWorkStatusChange', Em.K);
-      sinon.stub(App, 'get').withArgs('testMode').returns(false);
     });
     afterEach(function () {
       controller.mimicWorkStatusChange.restore();
       controller.showBackgroundOperationsPopup.restore();
-      App.get.restore();
     });
 
     it('testMode is false', function () {
@@ -2877,7 +2867,9 @@ describe('App.MainHostDetailsController', function () {
         componentName: 'COMP1'
       });
       controller.updateComponentPassiveState(component, 'state', 'message');
-      expect(App.ajax.send.getCall(0).args[0].data).to.be.eql({
+      var args = testHelpers.findAjaxRequest('name', 'common.host.host_component.passive');
+      expect(args[0]).exists;
+      expect(args[0].data).to.be.eql({
         "hostName": "host1",
         "componentName": "COMP1",
         "component": component,
@@ -3174,16 +3166,17 @@ describe('App.MainHostDetailsController', function () {
       beforeEach(function () {
         controller.set('content.hostComponents', Em.A([]));
         controller.doDeleteHost(Em.K);
+        this.args = testHelpers.findAjaxRequest('name', 'common.delete.host');
       });
 
       it('fromDeleteHost is true', function () {
         expect(controller.get('fromDeleteHost')).to.be.true;
       });
       it('1st request is to delete host', function () {
-        expect(App.ajax.send.getCall(0).args[0].name).to.be.equal('common.delete.host');
+        expect(this.args[0]).exists;
       });
       it('1st request is done with valid hostName', function () {
-        expect(App.ajax.send.getCall(0).args[0].data.hostName).to.be.equal('host1');
+        expect(this.args[0].data.hostName).to.be.equal('host1');
       });
     });
 
@@ -3205,10 +3198,12 @@ describe('App.MainHostDetailsController', function () {
         expect(controller.get('fromDeleteHost')).to.be.true;
       });
       it('1st request is to delete host', function () {
-        expect(App.ajax.send.getCall(0).args[0].name).to.be.equal('common.delete.host');
+        var args = testHelpers.findAjaxRequest('name', 'common.delete.host');
+        expect(args[0]).exists;
       });
       it('1st request is done with valid hostName', function () {
-        expect(App.ajax.send.getCall(0).args[0].data.hostName).to.be.equal('host1');
+        var args = testHelpers.findAjaxRequest('name', 'common.delete.host');
+        expect(args[0].data.hostName).to.be.equal('host1');
       });
 
     });
@@ -3311,14 +3306,12 @@ describe('App.MainHostDetailsController', function () {
     it("call App.ajax.send", function () {
       controller.set('content.hostName', 'host1');
       controller.installVersion({context: {}});
-      expect(App.ajax.send.getCall(0).args[0]).to.eql({
-        name: 'host.stack_versions.install',
-        sender: controller,
-        data: {
-          hostName: 'host1',
-          version: {}
-        },
-        success: 'installVersionSuccessCallback'
+      var args = testHelpers.findAjaxRequest('name', 'host.stack_versions.install');
+      expect(args[0]).exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        hostName: 'host1',
+        version: {}
       });
     });
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/host_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host_test.js b/ambari-web/test/controllers/main/host_test.js
index 386434b..1242374 100644
--- a/ambari-web/test/controllers/main/host_test.js
+++ b/ambari-web/test/controllers/main/host_test.js
@@ -25,11 +25,15 @@ describe('MainHostController', function () {
 
   var hostController, db;
 
-  describe('#getRegExp()', function() {
-    before(function() {
-      hostController = App.MainHostController.create({});
-    });
+  beforeEach(function () {
+    hostController = App.MainHostController.create({});
+  });
 
+  afterEach(function () {
+    hostController.destroy();
+  });
+
+  describe('#getRegExp()', function() {
     var message = '`{0}` should convert to `{1}`',
       tests = [
         { value: '.*', expected: '.*' },
@@ -55,7 +59,6 @@ describe('MainHostController', function () {
 
   describe('#getQueryParameters', function() {
     beforeEach(function() {
-      hostController = App.MainHostController.create({});
       sinon.spy(hostController, 'getRegExp');
       sinon.stub(App.db, 'getFilterConditions', function() {
         return [{
@@ -88,7 +91,6 @@ describe('MainHostController', function () {
       db = {mainHostController: [
         {name: 'hostName', status: 'sorting'}
       ]};
-      hostController = App.MainHostController.create({});
       sinon.stub(App.db, 'getSortingStatuses', function (k) {
         return db[k];
       });

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/service/add_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/add_controller_test.js b/ambari-web/test/controllers/main/service/add_controller_test.js
index 3c7639c..5621ff4 100644
--- a/ambari-web/test/controllers/main/service/add_controller_test.js
+++ b/ambari-web/test/controllers/main/service/add_controller_test.js
@@ -20,6 +20,7 @@ var App = require('app');
 require('controllers/wizard');
 require('controllers/main/service/add_controller');
 var addServiceController = null;
+var testHelpers = require('test/helpers');
 
 describe('App.AddServiceController', function() {
 
@@ -27,68 +28,6 @@ describe('App.AddServiceController', function() {
     addServiceController = App.AddServiceController.create({});
   });
 
-  describe('#installAdditionalClients', function() {
-
-    var t = {
-      additionalClients: {
-        componentName: "TEZ_CLIENT",
-        hostNames: ["hostName1", "hostName2"]
-      },
-      additionalClientsWithoutHosts: {
-        componentName: "TEZ_CLIENT",
-        hostNames: []
-      },
-      RequestInfo: {
-        "context": Em.I18n.t('requestInfo.installHostComponent') + ' ' + App.format.role("TEZ_CLIENT"),
-        "query": "HostRoles/component_name=TEZ_CLIENT&HostRoles/host_name.in(hostName1,hostName2)"
-      },
-      Body: {
-        HostRoles: {
-          state: 'INSTALLED'
-        }
-      }
-    };
-
-    beforeEach(function () {
-      sinon.spy($, 'ajax');
-      sinon.stub(App, 'get', function(k) {
-        if ('clusterName' === k) return 'tdk';
-        return Em.get(App, k);
-      });
-      addServiceController.set('installClietsQueue', App.ajaxQueue.create())
-    });
-
-    afterEach(function () {
-      $.ajax.restore();
-      App.get.restore();
-    });
-
-    describe('send request to install client', function () {
-
-      beforeEach(function () {
-        addServiceController.set("content.additionalClients", [t.additionalClients]);
-        addServiceController.installAdditionalClients();
-      });
-
-      it('1 request is sent', function () {
-        expect($.ajax.calledOnce).to.equal(true);
-      });
-      it('data.Body is valid', function () {
-        expect(JSON.parse($.ajax.args[0][0].data).Body).to.deep.eql(t.Body);
-      });
-      it('data.RequestInfo is valid', function () {
-        expect(JSON.parse($.ajax.args[0][0].data).RequestInfo).to.eql(t.RequestInfo);
-      });
-
-    });
-
-    it('should not send request to install client', function () {
-      addServiceController.set("content.additionalClients", [t.additionalClientsWithoutHosts]);
-      expect($.ajax.called).to.be.false;
-    });
-
-  });
-
   describe('#generateDataForInstallServices', function() {
     var tests = [{
       selected: ["YARN","HBASE"],
@@ -204,17 +143,8 @@ describe('App.AddServiceController', function() {
       }
     ];
 
-    beforeEach(function () {
-      sinon.stub(App.ajax, 'send', function () {
-        return {
-          promise: Em.K
-        };
-      });
-    });
-
     afterEach(function () {
       addServiceController.getDBProperty.restore();
-      App.ajax.send.restore();
     });
 
     cases.forEach(function (item) {
@@ -223,10 +153,11 @@ describe('App.AddServiceController', function() {
         beforeEach(function () {
           sinon.stub(addServiceController, 'getDBProperty').withArgs('hosts').returns(item.hosts);
           addServiceController.loadHosts();
+          this.args = testHelpers.findAjaxRequest('name', 'hosts.confirmed');
         });
 
         it('request is ' + (item.isAjaxRequestSent ? '' : 'not') + ' sent', function () {
-          expect(App.ajax.send.calledOnce).to.equal(item.isAjaxRequestSent);
+          expect(Em.isNone(this.args)).to.be.equal(!item.isAjaxRequestSent);
         });
       });
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/service/info/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/info/config_test.js b/ambari-web/test/controllers/main/service/info/config_test.js
index 9ebd914..fd7b23a 100644
--- a/ambari-web/test/controllers/main/service/info/config_test.js
+++ b/ambari-web/test/controllers/main/service/info/config_test.js
@@ -20,6 +20,7 @@ var App = require('app');
 require('controllers/main/service/info/configs');
 var batchUtils = require('utils/batch_scheduled_requests');
 var mainServiceInfoConfigsController = null;
+var testHelpers = require('test/helpers');
 
 function getController() {
   return App.MainServiceInfoConfigsController.create({
@@ -471,16 +472,15 @@ describe("App.MainServiceInfoConfigsController", function () {
       sinon.stub(App.router, 'getClusterName', function() {
         return 'clName';
       });
-      sinon.stub(App.ajax, "send", Em.K);
     });
     afterEach(function () {
-      App.ajax.send.restore();
       App.router.getClusterName.restore();
     });
     it("ajax request to put cluster cfg", function () {
       mainServiceInfoConfigsController.set('stepConfigs', sc);
       expect(mainServiceInfoConfigsController.putChangedConfigurations([]));
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'common.across.services.configurations');
+      expect(args[0]).exists;
     });
     it('values should be parsed', function () {
       mainServiceInfoConfigsController.set('stepConfigs', sc);
@@ -624,16 +624,12 @@ describe("App.MainServiceInfoConfigsController", function () {
       }]
     };
 
-    beforeEach(function() {
-      sinon.spy($,"ajax");
-    });
-    afterEach(function() {
-      $.ajax.restore();
-    });
-
     it("updates configs groups", function() {
       mainServiceInfoConfigsController.putConfigGroupChanges(t.data);
-      expect(JSON.parse($.ajax.args[0][0].data)).to.deep.equal(t.request);
+      var args = testHelpers.findAjaxRequest('name', 'config_groups.update_config_group');
+      expect(args[0]).exists;
+      var data = JSON.parse(App.ajax.fakeGetUrl('config_groups.update_config_group').format(args[0].data).data);
+      expect(data).to.deep.equal(t.request);
     });
   });
 
@@ -770,7 +766,6 @@ describe("App.MainServiceInfoConfigsController", function () {
     describe('#bodyClass', function () {
       beforeEach(function() {
         sinon.stub(App.StackService, 'find').returns([{dependentServiceNames: []}]);
-        sinon.stub(App.ajax, 'send', Em.K);
         // default implementation
         bodyView = mainServiceInfoConfigsController.showSaveConfigsPopup().get('bodyClass').create({
           parentView: Em.View.create()
@@ -778,13 +773,13 @@ describe("App.MainServiceInfoConfigsController", function () {
       });
 
       afterEach(function() {
-        App.ajax.send.restore();
         App.StackService.find.restore();
       });
 
       describe('#componentsFilterSuccessCallback', function () {
         it('check components with unknown state', function () {
           bodyView = mainServiceInfoConfigsController.showSaveConfigsPopup('', true, '', {}, '', 'unknown', '').get('bodyClass').create({
+            didInsertElement: Em.K,
             parentView: Em.View.create()
           });
           bodyView.componentsFilterSuccessCallback({

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/service/info/summary_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/info/summary_test.js b/ambari-web/test/controllers/main/service/info/summary_test.js
index 868cf67..51dd595 100644
--- a/ambari-web/test/controllers/main/service/info/summary_test.js
+++ b/ambari-web/test/controllers/main/service/info/summary_test.js
@@ -18,7 +18,7 @@
 
 var App = require('app');
 require('controllers/main/service/info/summary');
-
+var testHelpers = require('test/helpers');
 function getController() {
   return App.MainServiceInfoSummaryController.create();
 }
@@ -134,102 +134,6 @@ App.TestAliases.testAsComputedOr(getController(), 'showTimeRangeControl', ['!isS
 
   });
 
-  describe('#getRangerPluginsStatus', function () {
-
-    var data = {
-        'Clusters': {
-          'desired_configs': {
-            'ranger-hdfs-plugin-properties': {
-              'tag': 'version1'
-            },
-            'hive-env': {
-              'tag': 'version2'
-            },
-            'ranger-hbase-plugin-properties': {
-              'tag': 'version3'
-            }
-          }
-        }
-      },
-      cases = [
-        {
-          isPreviousRangerConfigsCallFailed: false,
-          ajaxRequestSent: true,
-          title: 'initial case'
-        },
-        {
-          isPreviousRangerConfigsCallFailed: true,
-          hdfsTag: 'version1',
-          hiveTag: 'version2',
-          hbaseTag: 'version3',
-          ajaxRequestSent: true,
-          title: 'previous call failed'
-        },
-        {
-          isPreviousRangerConfigsCallFailed: false,
-          hdfsTag: 'version2',
-          hiveTag: 'version2',
-          hbaseTag: 'version3',
-          ajaxRequestSent: true,
-          title: 'configs changed'
-        },
-        {
-          isPreviousRangerConfigsCallFailed: false,
-          hdfsTag: 'version1',
-          hiveTag: 'version2',
-          hbaseTag: 'version3',
-          ajaxRequestSent: false,
-          title: 'configs unchanged'
-        }
-      ];
-
-    beforeEach(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
-      sinon.stub(App.Service, 'find').returns([
-        Em.Object.create({
-          serviceName: 'HDFS'
-        }),
-        Em.Object.create({
-          serviceName: 'HIVE'
-        }),
-        Em.Object.create({
-          serviceName: 'HBASE'
-        }),
-        Em.Object.create({
-          serviceName: 'YARN'
-        })
-      ]);
-    });
-
-    afterEach(function () {
-      App.ajax.send.restore();
-      App.Service.find.restore();
-    });
-
-    cases.forEach(function (item) {
-      describe(item.title, function () {
-
-        beforeEach(function () {
-          controller.set('isPreviousRangerConfigsCallFailed', item.isPreviousRangerConfigsCallFailed);
-          controller.get('rangerPlugins').findProperty('serviceName', 'HDFS').tag = item.hdfsTag;
-          controller.get('rangerPlugins').findProperty('serviceName', 'HBASE').tag = item.hbaseTag;
-          controller.getRangerPluginsStatus(data);
-        });
-
-        it('1 request is ' + item.ajaxRequestSent + ' sent', function () {
-          expect(App.ajax.send.calledOnce).to.equal(item.ajaxRequestSent);
-        });
-
-        if (item.ajaxRequestSent) {
-          it('request does not contains `ranger-yarn-plugin-properties`', function () {
-            expect(App.ajax.send.getCall(0).args[0].data.urlParams.contains('ranger-yarn-plugin-properties')).to.be.false;
-          });
-        }
-      });
-    });
-
-  });
-
   describe('#getRangerPluginsStatusSuccess', function () {
 
     beforeEach(function () {
@@ -281,19 +185,14 @@ App.TestAliases.testAsComputedOr(getController(), 'showTimeRangeControl', ['!isS
   });
 
   describe("#getActiveWidgetLayout() for Enhanced Dashboard", function () {
-    before(function () {
-      sinon.stub(App.ajax, 'send');
-    });
-    after(function () {
-      App.ajax.send.restore();
-    });
+
     it("make GET call", function () {
       var _controller = App.MainServiceInfoSummaryController.create({
         isServiceWithEnhancedWidgets: true,
         content: Em.Object.create({serviceName: 'HDFS'})
       });
       _controller.getActiveWidgetLayout();
-      expect(App.ajax.send.getCall(0).args[0].name).to.equal('widgets.layouts.active.get');
+      expect(testHelpers.findAjaxRequest('name', 'widgets.layouts.active.get')).to.exists;
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js
index 55d27f7..e361bc7 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -27,6 +27,7 @@ require('controllers/global/cluster_controller');
 require('controllers/main/service/reassign_controller');
 require('controllers/main/service/item');
 var batchUtils = require('utils/batch_scheduled_requests');
+var testHelpers = require('test/helpers');
 
 describe('App.MainServiceItemController', function () {
 
@@ -977,12 +978,10 @@ describe('App.MainServiceItemController', function () {
   describe("#runSmokeTestPrimary", function () {
     beforeEach(function () {
       sinon.stub(App, 'get').withArgs('clusterName').returns('myCluster');
-      sinon.spy($, 'ajax');
     });
 
     afterEach(function () {
       App.get.restore();
-      $.ajax.restore();
     });
 
     var tests = [
@@ -1026,11 +1025,13 @@ describe('App.MainServiceItemController', function () {
           mainServiceItemController.set("runSmokeTestErrorCallBack", Em.K);
           mainServiceItemController.set("runSmokeTestSuccessCallBack", Em.K);
           mainServiceItemController.runSmokeTestPrimary(test.data.query);
-          this.data = JSON.parse($.ajax.args[0][0].data);
+          this.args = testHelpers.findAjaxRequest('name', 'service.item.smoke')[0];
+          this.data = this.args.data;
+          this.data = JSON.parse(App.ajax.fakeGetUrl('service.item.smoke').format(this.data).data);
         });
 
         it('ajax request is sent', function () {
-          expect($.ajax.calledOnce).to.equal(true);
+          expect(this.args).exists;
         });
 
         it('RequestInfo.context is valid', function () {
@@ -1284,22 +1285,16 @@ describe('App.MainServiceItemController', function () {
 
     beforeEach(function() {
       mainServiceItemController = App.MainServiceItemController.create({});
-      sinon.stub(App.ajax, 'send');
-    });
-    afterEach(function() {
-      App.ajax.send.restore();
     });
 
     it("App.ajax.send should be called", function() {
       mainServiceItemController.deleteServiceCall('S1');
-      expect(App.ajax.send.getCall(0).args[0]).to.eql({
-        name : 'service.item.delete',
-        sender: mainServiceItemController,
-        data : {
-          serviceName : 'S1'
-        },
-        success : 'deleteServiceCallSuccessCallback'
-      })
+      var args = testHelpers.findAjaxRequest('name', 'service.item.delete');
+      expect(args[0]).exists;
+      expect(args[0].sender).to.be.eql(mainServiceItemController);
+      expect(args[0].data).to.be.eql({
+        serviceName : 'S1'
+      });
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js
index f4a9714..a43d91f 100644
--- a/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js
@@ -20,6 +20,7 @@ var App = require('app');
 
 require('controllers/main/service/reassign/step1_controller');
 require('models/host_component');
+var testHelpers = require('test/helpers');
 
 describe('App.ReassignMasterWizardStep1Controller', function () {
 
@@ -34,19 +35,17 @@ describe('App.ReassignMasterWizardStep1Controller', function () {
 
   describe('#loadConfigTags', function() {
     beforeEach(function() {
-      sinon.stub(App.ajax, 'send', Em.K);
       this.stub = sinon.stub(App.router, 'get');
     });
 
     afterEach(function() {
-      App.ajax.send.restore();
       this.stub.restore();
     });
 
     it('tests loadConfigTags', function() {
       controller.loadConfigsTags();
-
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'config.tags');
+      expect(args).exists;
     });
 
     it('tests saveDatabaseType with type', function() {
@@ -203,29 +202,25 @@ describe('App.ReassignMasterWizardStep1Controller', function () {
   describe("#onLoadConfigsTags()", function () {
     beforeEach(function () {
       this.mock = sinon.stub(controller, 'getConfigUrlParams');
-      sinon.stub(App.ajax, 'send');
     });
     afterEach(function () {
       this.mock.restore();
-      App.ajax.send.restore();
     });
     it("empty params", function () {
       this.mock.returns([]);
       controller.onLoadConfigsTags();
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.findAjaxRequest('name', 'reassign.load_configs');
+      expect(args).not.exists;
     });
     it("correct params", function () {
       this.mock.returns(['p1', 'p2']);
       controller.onLoadConfigsTags();
-      expect(App.ajax.send.calledWith({
-        name: 'reassign.load_configs',
-        sender: controller,
-        data: {
-          urlParams: 'p1|p2'
-        },
-        success: 'onLoadConfigs',
-        error: ''
-      })).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'reassign.load_configs');
+      expect(args[0]).exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        urlParams: 'p1|p2'
+      });
     });
   });
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
index e920ace..945718f 100644
--- a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
@@ -19,6 +19,7 @@
 var App = require('app');
 
 require('controllers/main/service/reassign/step4_controller');
+var testHelpers = require('test/helpers');
 
 describe('App.ReassignMasterWizardStep4Controller', function () {
 
@@ -29,13 +30,6 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
     })
   });
 
-  beforeEach(function () {
-    sinon.stub(App.ajax, 'send', Em.K);
-  });
-  afterEach(function () {
-    App.ajax.send.restore();
-  });
-
   describe('#setAdditionalConfigs()', function () {
 
     beforeEach(function () {
@@ -149,8 +143,8 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
 
     it('tests prepareDBCheckAction', function() {
       controller.prepareDBCheckAction();
-
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'cluster.custom_action.create');
+      expect(args).exists;
     });
 
   });
@@ -427,7 +421,8 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
   describe('#stopServices()', function () {
     it('request is sent', function () {
       controller.stopServices();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'common.services.update');
+      expect(args).exists;
     });
   });
 
@@ -486,13 +481,15 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
     it('No host-components', function () {
       controller.set('hostComponents', []);
       controller.putHostComponentsInMaintenanceMode();
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.findAjaxRequest('name', 'common.host.host_component.passive');
+      expect(args).not.exists;
       expect(controller.get('multiTaskCounter')).to.equal(0);
     });
     it('One host-components', function () {
       controller.set('hostComponents', [{}]);
       controller.putHostComponentsInMaintenanceMode();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'common.host.host_component.passive');
+      expect(args).exists;
       expect(controller.get('multiTaskCounter')).to.equal(0);
     });
   });
@@ -544,7 +541,8 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
   describe('#loadConfigsTags()', function () {
     it('request is sent', function () {
       controller.loadConfigsTags();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'config.tags');
+      expect(args).exists;
     });
   });
 
@@ -700,6 +698,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
       });
       controller.set('content.reassign.component_name', 'COMP1');
       controller.onLoadConfigsTags({});
+      this.args = testHelpers.findAjaxRequest('name', 'reassign.load_configs');
     });
 
     afterEach(function () {
@@ -707,7 +706,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
     });
 
     it('request is sent', function () {
-      expect(App.ajax.send.calledOnce).to.be.true;
+      expect(this.args).exists;
     });
 
     it('getConfigUrlParams is called with correct data', function () {
@@ -770,6 +769,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
     beforeEach(function () {
       sinon.stub(controller, 'getServiceConfigData', Em.K);
       controller.saveConfigsToServer([1]);
+      this.args = testHelpers.findAjaxRequest('name', 'common.across.services.configurations');
     });
     afterEach(function () {
       controller.getServiceConfigData.restore();
@@ -778,7 +778,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
       expect(controller.getServiceConfigData.calledWith([1])).to.be.true;
     });
     it('request is sent', function () {
-      expect(App.ajax.send.calledOnce).to.be.true;
+      expect(this.args).exists;
     });
   });
 
@@ -966,12 +966,13 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
     beforeEach(function () {
       sinon.stub(App.router, 'get').returns({"skip.service.checks": "false"});
       controller.startServices();
+      this.args = testHelpers.findAjaxRequest('name', 'common.services.update');
     });
     afterEach(function () {
       App.router.get.restore();
     });
     it('request is sent', function () {
-      expect(App.ajax.send.calledOnce).to.be.true;
+      expect(this.args).exists;
     });
   });
 
@@ -981,17 +982,20 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
       controller.set('hostComponents', []);
       controller.set('content.reassignHosts.source', 'host1');
       controller.deleteHostComponents();
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.findAjaxRequest('name', 'common.delete.host_component');
+      expect(args).not.exists;
     });
     it('delete two components', function () {
       controller.set('hostComponents', [1, 2]);
       controller.set('content.reassignHosts.source', 'host1');
       controller.deleteHostComponents();
-      expect(App.ajax.send.getCall(0).args[0].data).to.eql({
+      var args = testHelpers.filterAjaxRequests('name', 'common.delete.host_component');
+      expect(args).to.have.property('length').equal(2);
+      expect(args[0][0].data).to.eql({
         "hostName": "host1",
         "componentName": 1
       });
-      expect(App.ajax.send.getCall(1).args[0].data).to.eql({
+      expect(args[1][0].data).to.eql({
         "hostName": "host1",
         "componentName": 2
       });
@@ -1138,30 +1142,24 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
     it('component_name is C1', function () {
       controller.set('content.reassign.component_name', 'C1');
       controller.cleanMySqlServer();
-      expect(App.ajax.send.calledWith({
-        name: 'service.mysql.clean',
-        sender: controller,
-        data: {
-          host: 'host1'
-        },
-        success: 'startPolling',
-        error: 'onTaskError'
-      })).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'service.mysql.clean');
+      expect(args[0]).exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        host: 'host1'
+      });
     });
 
     it('component_name is MYSQL_SERVER', function () {
       controller.set('content.reassign.component_name', 'MYSQL_SERVER');
       controller.set('content.reassignHosts.target', 'host2');
       controller.cleanMySqlServer();
-      expect(App.ajax.send.calledWith({
-        name: 'service.mysql.clean',
-        sender: controller,
-        data: {
-          host: 'host2'
-        },
-        success: 'startPolling',
-        error: 'onTaskError'
-      })).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'service.mysql.clean');
+      expect(args[0]).exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        host: 'host2'
+      });
     });
   });
 
@@ -1183,30 +1181,24 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
     it('component_name is C1', function () {
       controller.set('content.reassign.component_name', 'C1');
       controller.configureMySqlServer();
-      expect(App.ajax.send.calledWith({
-        name: 'service.mysql.configure',
-        sender: controller,
-        data: {
-          host: 'host1'
-        },
-        success: 'startPolling',
-        error: 'onTaskError'
-      })).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'service.mysql.configure');
+      expect(args[0]).exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        host: 'host1'
+      });
     });
 
     it('component_name is MYSQL_SERVER', function () {
       controller.set('content.reassign.component_name', 'MYSQL_SERVER');
       controller.set('content.reassignHosts.target', 'host2');
       controller.configureMySqlServer();
-      expect(App.ajax.send.calledWith({
-        name: 'service.mysql.configure',
-        sender: controller,
-        data: {
-          host: 'host2'
-        },
-        success: 'startPolling',
-        error: 'onTaskError'
-      })).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'service.mysql.configure');
+      expect(args[0]).exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        host: 'host2'
+      });
     });
   });
 
@@ -1243,21 +1235,18 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
     });
     it("valid request is sent", function() {
       controller.startMySqlServer();
-      expect(App.ajax.send.calledWith({
-        name: 'common.host.host_component.update',
-        sender: controller,
-        data: {
-          context: "Start MySQL Server",
-          hostName: 'host1',
-          serviceName: "HIVE",
-          componentName: "MYSQL_SERVER",
-          HostRoles: {
-            state: "STARTED"
-          }
-        },
-        success: 'startPolling',
-        error: 'onTaskError'
-      })).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'common.host.host_component.update');
+      expect(args[0]).exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        context: "Start MySQL Server",
+        hostName: 'host1',
+        serviceName: "HIVE",
+        componentName: "MYSQL_SERVER",
+        HostRoles: {
+          state: "STARTED"
+        }
+      });
     });
   });
 
@@ -1280,26 +1269,23 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
         })
       }));
       controller.restartMySqlServer();
-      expect(App.ajax.send.calledWith({
-        name: 'restart.hostComponents',
-        sender: controller,
-        data: {
-          context: 'Restart MySql Server',
-          resource_filters: [{
-            component_name: "MYSQL_SERVER",
-            hosts: 'host1',
-            service_name: "HIVE"
-          }],
-          operation_level: {
-            level: "HOST_COMPONENT",
-            cluster_name: 'cl1',
-            service_name: "HIVE",
-            hostcomponent_name: "MYSQL_SERVER"
-          }
-        },
-        success: 'startPolling',
-        error: 'onTaskError'
-      })).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'restart.hostComponents');
+      expect(args[0]).exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        context: 'Restart MySql Server',
+        resource_filters: [{
+          component_name: "MYSQL_SERVER",
+          hosts: 'host1',
+          service_name: "HIVE"
+        }],
+        operation_level: {
+          level: "HOST_COMPONENT",
+          cluster_name: 'cl1',
+          service_name: "HIVE",
+          hostcomponent_name: "MYSQL_SERVER"
+        }
+      });
     });
   });
 
@@ -1312,24 +1298,21 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
         })
       }));
       controller.startNewMySqlServer();
+      this.args = testHelpers.findAjaxRequest('name', 'common.host.host_component.update');
     });
 
     it('valid request is sent', function() {
-      expect(App.ajax.send.calledWith({
-        name: 'common.host.host_component.update',
-        sender: controller,
-        data: {
-          context: "Start MySQL Server",
-          hostName: 'host1',
-          serviceName: "HIVE",
-          componentName: "MYSQL_SERVER",
-          HostRoles: {
-            state: "STARTED"
-          }
-        },
-        success: 'startPolling',
-        error: 'onTaskError'
-      })).to.be.true;
+      expect(this.args[0]).exists;
+      expect(this.args[0].sender).to.be.eql(controller);
+      expect(this.args[0].data).to.be.eql({
+        context: "Start MySQL Server",
+        hostName: 'host1',
+        serviceName: "HIVE",
+        componentName: "MYSQL_SERVER",
+        HostRoles: {
+          state: "STARTED"
+        }
+      });
     });
   });
 
@@ -1598,17 +1581,15 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
         preparedDBProperties: {}
       });
       controller.prepareDBCheckAction();
+      this.args = testHelpers.findAjaxRequest('name', 'cluster.custom_action.create');
     });
     afterEach(function () {
       App.router.get.restore();
       controller.getConnectionProperty.restore();
     });
     it('valid request is sent', function () {
-      var callArgs = App.ajax.send.getCall(0).args[0];
-      expect(callArgs.name).to.equal('cluster.custom_action.create');
-      expect(callArgs.success).to.equal('onCreateActionSuccess');
-      expect(callArgs.error).to.equal('onTaskError');
-      expect(callArgs.data).to.eql({
+      expect(this.args[0]).exists;
+      expect(this.args[0].data).to.eql({
         requestInfo: {
           "context": "Check host",
           "action": "check_host",

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js
index 9ab1144..5591347 100644
--- a/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js
@@ -20,6 +20,7 @@ App = require('app');
 
 require('controllers/main/service/reassign/step6_controller');
 var controller;
+var testHelpers = require('test/helpers');
 
 describe('App.ReassignMasterWizardStep6Controller', function () {
 
@@ -31,12 +32,7 @@ describe('App.ReassignMasterWizardStep6Controller', function () {
       }),
       startServices: Em.K
     });
-    sinon.stub(App.ajax, 'send', Em.K);
   });
-  afterEach(function () {
-    App.ajax.send.restore();
-  });
-
 
   describe('#initializeTasks()', function () {
     it('No commands', function () {
@@ -155,17 +151,20 @@ describe('App.ReassignMasterWizardStep6Controller', function () {
       controller.set('hostComponents', []);
       controller.set('content.reassignHosts.source', 'host1');
       controller.deleteHostComponents();
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.findAjaxRequest('name', 'common.delete.host_component');
+      expect(args).not.exists;
     });
     it('delete two components', function () {
       controller.set('hostComponents', [1, 2]);
       controller.set('content.reassignHosts.source', 'host1');
       controller.deleteHostComponents();
-      expect(App.ajax.send.getCall(0).args[0].data).to.eql({
+      var args = testHelpers.filterAjaxRequests('name', 'common.delete.host_component');
+      expect(args).to.have.property('length').equal(2);
+      expect(args[0][0].data).to.eql({
         "hostName": "host1",
         "componentName": 1
       });
-      expect(App.ajax.send.getCall(1).args[0].data).to.eql({
+      expect(args[1][0].data).to.eql({
         "hostName": "host1",
         "componentName": 2
       });
@@ -201,7 +200,8 @@ describe('App.ReassignMasterWizardStep6Controller', function () {
   describe('#stopMysqlService()', function () {
     it('stopMysqlService', function () {
       controller.stopMysqlService();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'common.host.host_component.update');
+      expect(args[0]).exists;
     });
   });
 
@@ -216,13 +216,15 @@ describe('App.ReassignMasterWizardStep6Controller', function () {
     it('No host-components', function () {
       controller.set('hostComponents', []);
       controller.putHostComponentsInMaintenanceMode();
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.findAjaxRequest('name', 'common.host.host_component.passive');
+      expect(args).not.exists;
       expect(controller.get('multiTaskCounter')).to.equal(0);
     });
     it('One host-components', function () {
       controller.set('hostComponents', [{}]);
       controller.putHostComponentsInMaintenanceMode();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'common.host.host_component.passive');
+      expect(args).exists;
       expect(controller.get('multiTaskCounter')).to.equal(0);
     });
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/service/reassign/step7_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign/step7_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step7_controller_test.js
index 238ebea..6f16f0f 100644
--- a/ambari-web/test/controllers/main/service/reassign/step7_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign/step7_controller_test.js
@@ -20,11 +20,11 @@ App = require('app');
 
 require('controllers/main/service/reassign/step7_controller');
 var controller;
+var testHelpers = require('test/helpers');
 
 describe('App.ReassignMasterWizardStep7Controller', function () {
 
   beforeEach(function () {
-    sinon.stub(App.ajax, 'send', Em.K);
     controller = App.ReassignMasterWizardStep7Controller.create({
       content: Em.Object.create({
         reassign: Em.Object.create(),
@@ -32,9 +32,6 @@ describe('App.ReassignMasterWizardStep7Controller', function () {
       })
     });
   });
-  afterEach(function () {
-    App.ajax.send.restore();
-  });
 
   describe('#initializeTasks()', function () {
     it('should set isLoaded to true', function () {
@@ -49,30 +46,29 @@ describe('App.ReassignMasterWizardStep7Controller', function () {
     it("no host-components", function() {
       controller.set('hostComponents', []);
       controller.putHostComponentsInMaintenanceMode();
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.findAjaxRequest('name', 'common.host.host_component.passive');
+      expect(args).not.exists;
       expect(controller.get('multiTaskCounter')).to.equal(0);
     });
     it("one host-component", function() {
       controller.set('hostComponents', ['C1']);
       controller.set('content.reassignHosts.target', 'host1');
       controller.putHostComponentsInMaintenanceMode();
-      expect(App.ajax.send.calledWith({
-        name: 'common.host.host_component.passive',
-        sender: controller,
-        data: {
-          hostName: 'host1',
-          passive_state: "ON",
-          componentName: 'C1'
-        },
-        success: 'onComponentsTasksSuccess',
-        error: 'onTaskError'
-      })).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'common.host.host_component.passive');
+      expect(args[0]).exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        hostName: 'host1',
+        passive_state: "ON",
+        componentName: 'C1'
+      });
       expect(controller.get('multiTaskCounter')).to.equal(0);
     });
     it("two host-components", function() {
       controller.set('hostComponents', ['C1', 'C2']);
       controller.putHostComponentsInMaintenanceMode();
-      expect(App.ajax.send.calledTwice).to.be.true;
+      var args = testHelpers.filterAjaxRequests('name', 'common.host.host_component.passive');
+      expect(args).to.have.property('length').equal(2);
       expect(controller.get('multiTaskCounter')).to.equal(0);
     });
   });
@@ -81,29 +77,28 @@ describe('App.ReassignMasterWizardStep7Controller', function () {
     it("no host-components", function() {
       controller.set('hostComponents', []);
       controller.deleteHostComponents();
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.findAjaxRequest('name', 'common.delete.host_component');
+      expect(args).not.exists;
       expect(controller.get('multiTaskCounter')).to.equal(0);
     });
     it("one host-component", function() {
       controller.set('hostComponents', ['C1']);
       controller.set('content.reassignHosts.target', 'host1');
       controller.deleteHostComponents();
-      expect(App.ajax.send.calledWith({
-        name: 'common.delete.host_component',
-        sender: controller,
-        data: {
-          hostName: 'host1',
-          componentName: 'C1'
-        },
-        success: 'onComponentsTasksSuccess',
-        error: 'onDeleteHostComponentsError'
-      })).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'common.delete.host_component');
+      expect(args[0]).exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        hostName: 'host1',
+        componentName: 'C1'
+      });
       expect(controller.get('multiTaskCounter')).to.equal(0);
     });
     it("two host-components", function() {
       controller.set('hostComponents', ['C1', 'C2']);
       controller.deleteHostComponents();
-      expect(App.ajax.send.calledTwice).to.be.true;
+      var args = testHelpers.filterAjaxRequests('name', 'common.delete.host_component');
+      expect(args).to.have.property('length').equal(2);
       expect(controller.get('multiTaskCounter')).to.equal(0);
     });
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service_test.js b/ambari-web/test/controllers/main/service_test.js
index 0e7f464..60e0e4d 100644
--- a/ambari-web/test/controllers/main/service_test.js
+++ b/ambari-web/test/controllers/main/service_test.js
@@ -19,6 +19,7 @@
 var App = require('app');
 require('controllers/main/service');
 
+var testHelpers = require('test/helpers');
 var mainServiceController;
 
 function getController() {
@@ -82,6 +83,10 @@ describe('App.MainServiceController', function () {
     mainServiceController = getController();
   });
 
+  afterEach(function () {
+    mainServiceController.destroy();
+  });
+
   App.TestAliases.testAsComputedNotEqual(getController(), 'isStartStopAllClicked', 'App.router.backgroundOperationsController.allOperationsCount', 0);
 
   describe('#isStartAllDisabled', function () {
@@ -277,28 +282,23 @@ describe('App.MainServiceController', function () {
       query = 'some query';
 
     beforeEach(function() {
-      sinon.stub($, 'ajax', Em.K);
       sinon.stub(App, 'get', function(k) {
-        if ('testMode' === k) return false;
         if ('clusterName' === k) return 'tdk';
         return Em.get(App, k);
       });
       mainServiceController.allServicesCall(state, query);
-      this.params = $.ajax.args[0][0];
+      var args = testHelpers.findAjaxRequest('name', 'common.services.update');
+      this.params = App.ajax.fakeGetUrl('common.services.update').format(args[0].data);
       this.data = JSON.parse(this.params.data);
     });
 
     afterEach(function() {
-      $.ajax.restore();
       App.get.restore();
     });
 
     it('PUT request is sent', function() {
       expect(this.params.type).to.equal('PUT');
     });
-    it('request is sent to `/services`', function() {
-      expect(this.params.url.contains('/clusters/tdk/services?')).to.be.true;
-    });
     it('Body.ServiceInfo.state is ' + state, function() {
       expect(this.data.Body.ServiceInfo.state).to.equal(state);
     });
@@ -408,21 +408,4 @@ describe('App.MainServiceController', function () {
 
   });
 
-  describe('#restartHostComponents', function () {
-
-    beforeEach(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
-    });
-
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
-
-    it('should send ajax request', function () {
-      mainServiceController.restartHostComponents();
-      expect(App.ajax.send.calledOnce).to.be.true;
-    });
-
-  });
-
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/views_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/views_controller_test.js b/ambari-web/test/controllers/main/views_controller_test.js
index 85c7521..41384d3 100644
--- a/ambari-web/test/controllers/main/views_controller_test.js
+++ b/ambari-web/test/controllers/main/views_controller_test.js
@@ -18,6 +18,7 @@
 
 var App = require('app');
 require('controllers/main/views_controller');
+var testHelpers = require('test/helpers');
 
 var mainViewsController;
 describe('MainViewsController', function () {
@@ -28,24 +29,24 @@ describe('MainViewsController', function () {
 
   describe('#loadAmbariViews()', function () {
     beforeEach(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
       this.stub = sinon.stub(App.router, 'get');
     });
     afterEach(function () {
       App.router.get.restore();
-      App.ajax.send.restore();
     });
 
     it('should load views if the user is logged in', function () {
       this.stub.withArgs('loggedIn').returns(true);
       mainViewsController.loadAmbariViews();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'views.info');
+      expect(args).to.exists;
     });
 
     it('should not load views if the user is not logged in', function () {
       this.stub.withArgs('loggedIn').returns(false);
       mainViewsController.loadAmbariViews();
-      expect(App.ajax.send.notCalled).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'views.info');
+      expect(args).to.not.exists;
     })
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main_test.js b/ambari-web/test/controllers/main_test.js
index 0061695..e367201 100644
--- a/ambari-web/test/controllers/main_test.js
+++ b/ambari-web/test/controllers/main_test.js
@@ -16,8 +16,8 @@
  * limitations under the License.
  */
 
-
 var App = require('app');
+var testHelpers = require('test/helpers');
 
 describe('App.MainController', function () {
   var mainController = App.MainController.create();
@@ -132,26 +132,13 @@ describe('App.MainController', function () {
   });
 
   describe('#getServerVersion', function() {
-    var res;
-    beforeEach(function () {
-      sinon.stub(App.ajax, 'send', function(data) {
-        res = JSON.parse(JSON.stringify(data));
-      });
-    });
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
+
     it ('Should send data', function() {
       mainController.getServerVersion();
-      expect(res).to.be.eql({
-        "name": "ambari.service",
-        "sender": {},
-        "data": {
-          "fields": "?fields=RootServiceComponents/component_version,RootServiceComponents/properties/server.os_family&minimal_response=true"
-        },
-        "success": "getServerVersionSuccessCallback",
-        "error": "getServerVersionErrorCallback"
-      });
+      var args = testHelpers.findAjaxRequest('name', 'ambari.service');
+      expect(args[0]).to.exists;
+      expect(args[0].sender).to.be.eql(mainController);
+      expect(args[0].data.fields).to.be.eql('?fields=RootServiceComponents/component_version,RootServiceComponents/properties/server.os_family&minimal_response=true');
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/wizard/step2_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step2_test.js b/ambari-web/test/controllers/wizard/step2_test.js
index 1a67ca9..63887ab 100644
--- a/ambari-web/test/controllers/wizard/step2_test.js
+++ b/ambari-web/test/controllers/wizard/step2_test.js
@@ -21,6 +21,7 @@ require('controllers/wizard/step2_controller');
 require('models/host');
 require('models/host_component');
 require('messages');
+var testHelpers = require('test/helpers');
 var c;
 
 function getController() {
@@ -582,16 +583,12 @@ describe('App.WizardStep2Controller', function () {
   });
 
   describe('#setAmbariJavaHome', function() {
-    beforeEach(function() {
-      sinon.stub($, 'ajax', Em.K);
-    });
-    afterEach(function() {
-      $.ajax.restore();
-    });
+
     it('should do ajax-request', function() {
       var controller = App.WizardStep2Controller.create({onGetAmbariJavaHomeSuccess: Em.K, onGetAmbariJavaHomeError: Em.K});
       controller.setAmbariJavaHome();
-      expect($.ajax.calledOnce).to.equal(true);
+      var args = testHelpers.findAjaxRequest('name', 'ambari.service');
+      expect(args).exists;
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/wizard/step3_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step3_test.js b/ambari-web/test/controllers/wizard/step3_test.js
index 7b6684f..8c2fb6f 100644
--- a/ambari-web/test/controllers/wizard/step3_test.js
+++ b/ambari-web/test/controllers/wizard/step3_test.js
@@ -22,6 +22,7 @@ require('utils/ajax/ajax');
 require('utils/http_client');
 require('models/host');
 require('controllers/wizard/step3_controller');
+var testHelpers = require('test/helpers');
 
 function getController() {
   return App.WizardStep3Controller.create({
@@ -41,16 +42,12 @@ describe('App.WizardStep3Controller', function () {
     sinon.stub(App.db, 'getDisplayLength', Em.K);
     sinon.stub(App.db, 'getFilterConditions').returns([]);
     sinon.stub(App.router, 'send', Em.K);
-    sinon.stub(App.ajax, 'send', function () {
-      return {done: Em.K}
-    });
   });
 
   afterEach(function () {
     App.db.getDisplayLength.restore();
     App.router.send.restore();
     App.db.getFilterConditions.restore();
-    App.ajax.send.restore();
   });
 
   App.TestAliases.testAsComputedGt(getController(), 'isHostHaveWarnings', 'warnings.length', 0);
@@ -153,14 +150,6 @@ describe('App.WizardStep3Controller', function () {
 
   describe('#isWarningsBoxVisible', function () {
 
-    beforeEach(function () {
-      sinon.stub(App, 'get').withArgs('testMode').returns(false);
-    });
-
-    afterEach(function () {
-      App.get.restore();
-    });
-
     it('for "real" mode should be based on isRegistrationInProgress', function () {
       c.set('isRegistrationInProgress', false);
       expect(c.get('isWarningsBoxVisible')).to.equal(true);
@@ -259,25 +248,9 @@ describe('App.WizardStep3Controller', function () {
 
     afterEach(function () {
       c.navigateStep.restore();
-      App.set('testMode', false);
-    });
-
-    it('should set isLoaded to true', function () {
-      App.set('testMode', true);
-      c.set('content', {hosts: {}});
-      c.loadHosts();
-      expect(c.get('isLoaded')).to.equal(true);
-    });
-
-    it('should set bootStatus REGISTERED on testMode', function () {
-      App.set('testMode', true);
-      c.set('content', {hosts: {c: {name: 'name'}}});
-      c.loadHosts();
-      expect(c.get('hosts').everyProperty('bootStatus', 'REGISTERED')).to.equal(true);
     });
 
     it('should set bootStatus DONE on "real" mode and when installOptions.manualInstall is selected', function () {
-      App.set('testMode', false);
       c.set('content.installOptions', {manualInstall: true});
       c.set('content.hosts', {c: {name: 'name'}});
       c.loadHosts();
@@ -285,14 +258,12 @@ describe('App.WizardStep3Controller', function () {
     });
 
     it('should set bootStatus PENDING on "real" mode and when installOptions.manualInstall is not selected', function () {
-      App.set('testMode', false);
       c.set('content', {installOptions: {manualInstall: false}, hosts: {c: {name: 'name'}}});
       c.loadHosts();
       expect(c.get('hosts').everyProperty('bootStatus', 'PENDING')).to.equal(true);
     });
 
     it('should set bootStatus PENDING on "real" mode and when installOptions.manualInstall is not selected (2)', function () {
-      App.set('testMode', true);
       c.set('content', {hosts: {c: {name: 'name'}, d: {name: 'name1'}}});
       c.loadHosts();
       expect(c.get('hosts').everyProperty('isChecked', false)).to.equal(true);
@@ -754,14 +725,16 @@ describe('App.WizardStep3Controller', function () {
     it('shouldn\'t do nothing if stopBootstrap is true', function () {
       c.set('stopBootstrap', true);
       c.doBootstrap();
-      expect(App.ajax.send.called).to.equal(false);
+      var args = testHelpers.findAjaxRequest('name', 'wizard.step3.bootstrap');
+      expect(args).not.exists;
     });
 
     it('should increment numPolls if stopBootstrap is false', function () {
       c.set('numPolls', 0);
       c.set('stopBootstrap', false);
       c.doBootstrap();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'wizard.step3.bootstrap');
+      expect(args).exists;
       expect(c.get('numPolls')).to.equal(1);
     });
 
@@ -796,13 +769,15 @@ describe('App.WizardStep3Controller', function () {
     it('shouldn\'t do nothing if stopBootstrap is true', function () {
       c.set('stopBootstrap', true);
       c.isHostsRegistered();
-      expect(App.ajax.send.called).to.equal(false);
+      var args = testHelpers.findAjaxRequest('name', 'wizard.step3.is_hosts_registered');
+      expect(args).not.exists;
     });
 
     it('should do ajax call if stopBootstrap is false', function () {
       c.set('stopBootstrap', false);
       c.isHostsRegistered();
-      expect(App.ajax.send.called).to.equal(true);
+      var args = testHelpers.findAjaxRequest('name', 'wizard.step3.is_hosts_registered');
+      expect(args).exists;
 
     });
   });
@@ -905,7 +880,8 @@ describe('App.WizardStep3Controller', function () {
 
     it('should call App.ajax.send', function () {
       c.getAllRegisteredHosts();
-      expect(App.ajax.send.calledOnce).to.equal(true);
+      var args = testHelpers.findAjaxRequest('name', 'wizard.step3.is_hosts_registered');
+      expect(args).exists;
     });
   });
 
@@ -1009,7 +985,8 @@ describe('App.WizardStep3Controller', function () {
 
     it('should do ajax request', function () {
       c.getHostInfo();
-      expect(App.ajax.send.calledOnce).to.equal(true);
+      var args = testHelpers.findAjaxRequest('name', 'wizard.step3.host_info');
+      expect(args).exists;
     });
 
   });
@@ -1277,17 +1254,12 @@ describe('App.WizardStep3Controller', function () {
   describe('#parseHostCheckWarnings', function () {
 
     beforeEach(function () {
-      sinon.stub(App, 'get', function (k) {
-        if ('testMode' === k) return false;
-        return Em.get(App, k);
-      });
       sinon.stub(c, 'filterHostsData', function (k) {
         return k;
       });
     });
 
     afterEach(function () {
-      App.get.restore();
       c.filterHostsData.restore();
     });
 
@@ -1775,17 +1747,12 @@ describe('App.WizardStep3Controller', function () {
   describe('#parseWarnings', function () {
 
     beforeEach(function () {
-      sinon.stub(App, 'get', function (k) {
-        if ('testMode' === k) return false;
-        return Em.get(App, k);
-      });
       sinon.stub(c, 'filterBootHosts', function (k) {
         return k;
       });
     });
 
     afterEach(function () {
-      App.get.restore();
       c.filterBootHosts.restore();
     });
 
@@ -2327,17 +2294,12 @@ describe('App.WizardStep3Controller', function () {
           setRegistrationInProgress: Em.K,
           startRegistration: Em.K
         });
-        sinon.stub(App, 'get', function (k) {
-          if ('testMode' === k) return false;
-          return Em.get(App, k);
-        });
         sinon.spy(c, 'startRegistration');
         c.navigateStep();
       });
 
 
       afterEach(function () {
-        App.get.restore();
         c.startRegistration.restore();
       });
 
@@ -2540,7 +2502,6 @@ describe('App.WizardStep3Controller', function () {
       sinon.spy(c, '_setHostDataWithSkipBootstrap');
       sinon.stub(App, 'get', function (k) {
         if ('skipBootstrap' === k) return skipBootstrap;
-        if ('testMode' === k) return false;
         return Em.get(App, k);
       });
       c.reopen({
@@ -2671,17 +2632,6 @@ describe('App.WizardStep3Controller', function () {
 
   describe('#doCheckJDK', function () {
 
-    beforeEach(function () {
-      sinon.stub(App, 'get', function (k) {
-        if ('testMode' === k) return false;
-        return Em.get(App, k);
-      });
-    });
-
-    afterEach(function () {
-      App.get.restore();
-    });
-
     it('should do request to the ambari-server', function () {
 
       var bootHosts = [
@@ -2696,24 +2646,14 @@ describe('App.WizardStep3Controller', function () {
         jdkLocation: jdkLocation
       });
       c.doCheckJDK();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'wizard.step3.jdk_check');
+      expect(args).exists;
     });
 
   });
 
   describe('#doCheckJDKsuccessCallback', function () {
 
-    beforeEach(function () {
-      sinon.stub(App, 'get', function (k) {
-        if ('testMode' === k) return false;
-        return Em.get(App, k);
-      });
-    });
-
-    afterEach(function () {
-      App.get.restore();
-    });
-
     it('should set jdkRequestIndex if data provided', function () {
 
       var data = {
@@ -2742,7 +2682,8 @@ describe('App.WizardStep3Controller', function () {
       c.set('jdkRequestIndex', jdkRequestIndex);
       c.set('jdkCategoryWarnings', null);
       c.doCheckJDKsuccessCallback(data);
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'wizard.step3.jdk_check.get_results');
+      expect(args).exists;
     });
 
   });
@@ -2834,7 +2775,6 @@ describe('App.WizardStep3Controller', function () {
   describe('#getHostCheckTasksSuccess', function() {
 
     beforeEach(function() {
-      sinon.stub($, 'ajax', Em.K);
       sinon.stub(c, 'getHostInfo', Em.K);
       sinon.stub(c, 'parseHostNameResolution', Em.K);
       sinon.stub(c, 'getGeneralHostCheck', Em.K);
@@ -2843,7 +2783,6 @@ describe('App.WizardStep3Controller', function () {
     });
 
     afterEach(function() {
-      $.ajax.restore();
       c.getHostInfo.restore();
       c.parseHostNameResolution.restore();
       c.getGeneralHostCheck.restore();

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/wizard/step6_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step6_test.js b/ambari-web/test/controllers/wizard/step6_test.js
index 4fdd642..61cf879 100644
--- a/ambari-web/test/controllers/wizard/step6_test.js
+++ b/ambari-web/test/controllers/wizard/step6_test.js
@@ -75,15 +75,6 @@ describe('App.WizardStep6Controller', function () {
 
   beforeEach(function () {
     controller = getController();
-    sinon.stub(App.ajax, 'send', function () {
-      return {
-        then: Em.K
-      };
-    });
-  });
-
-  afterEach(function () {
-    App.ajax.send.restore();
   });
 
   App.TestAliases.testAsComputedEqual(getController(), 'isAddHostWizard', 'content.controllerName', 'addHostController');

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/wizard/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js
index e93d3f7..434a8ba 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -19,6 +19,7 @@
 var App = require('app');
 require('mixins/common/localStorage');
 require('controllers/wizard/step7_controller');
+var testHelpers = require('test/helpers');
 
 var installerStep7Controller,
   issuesFilterCases = [
@@ -108,17 +109,11 @@ function getController() {
 describe('App.InstallerStep7Controller', function () {
 
   beforeEach(function () {
-    sinon.stub(App.ajax, 'send', function () {
-      return {
-        then: Em.K
-      }
-    });
     sinon.stub(App.config, 'setPreDefinedServiceConfigs', Em.K);
     installerStep7Controller = getController();
   });
 
   afterEach(function() {
-    App.ajax.send.restore();
     App.config.setPreDefinedServiceConfigs.restore();
     installerStep7Controller.destroy();
   });
@@ -434,14 +429,16 @@ describe('App.InstallerStep7Controller', function () {
     it('should do ajax request for each received service name', function () {
       var serviceNames = ['s1', 's2', 's3'];
       installerStep7Controller.loadInstalledServicesConfigGroups(serviceNames);
-      expect(App.ajax.send.callCount).to.equal(serviceNames.length);
+      var args = testHelpers.filterAjaxRequests('name', 'config.tags_and_groups');
+      expect(args).to.have.property('length').equal(serviceNames.length);
     });
   });
 
   describe('#getConfigTags', function () {
     it('should do ajax-request', function () {
       installerStep7Controller.getConfigTags();
-      expect(App.ajax.send.calledOnce).to.equal(true);
+      var args = testHelpers.findAjaxRequest('name', 'config.tags');
+      expect(args).exists;
     });
   });
 
@@ -475,7 +472,8 @@ describe('App.InstallerStep7Controller', function () {
   describe('#checkMySQLHost', function () {
     it('should send query', function () {
       installerStep7Controller.checkMySQLHost();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'ambari.service');
+      expect(args).exists;
     });
   });
 
@@ -2179,7 +2177,7 @@ describe('App.InstallerStep7Controller', function () {
 
     beforeEach(function () {
       installerStep7Controller.loadServiceConfigGroupOverrides(serviceConfigs, loadedGroupToOverrideSiteToTagMap, configGroups);
-      this.args = App.ajax.send.args[0][0].data;
+      this.args = testHelpers.findAjaxRequest('name', 'config.host_overrides')[0].data;
     });
 
     it('url params are valid', function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/wizard/step8_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step8_test.js b/ambari-web/test/controllers/wizard/step8_test.js
index 9eb5b1e..b40b91c 100644
--- a/ambari-web/test/controllers/wizard/step8_test.js
+++ b/ambari-web/test/controllers/wizard/step8_test.js
@@ -21,6 +21,7 @@ require('utils/ajax/ajax_queue');
 require('controllers/main/service/info/configs');
 require('controllers/wizard/step8_controller');
 var installerStep8Controller, configurationController;
+var testHelpers = require('test/helpers');
 
 var configs = Em.A([
   Em.Object.create({filename: 'hdfs-site.xml', name: 'p1', value: 'v1'}),
@@ -867,7 +868,6 @@ describe('App.WizardStep8Controller', function () {
 
     beforeEach(function () {
       sinon.stub(App, 'get').withArgs('currentStackName').returns('HDP');
-      sinon.stub(App.ajax, 'send', Em.K);
       sinon.stub(App.StackVersion, 'find', function() {
         return [
           Em.Object.create({state: 'CURRENT', repositoryVersion: {repositoryVersion: '2.3.0.0-2208'}})
@@ -876,14 +876,13 @@ describe('App.WizardStep8Controller', function () {
     });
 
     afterEach(function () {
-      App.ajax.send.restore();
       App.get.restore();
       App.StackVersion.find.restore();
     });
     it('should use current StackVersion', function() {
       installerStep8Controller.loadRepoInfo();
-      var data = App.ajax.send.args[0][0].data;
-      expect(data).to.eql({stackName: 'HDP', repositoryVersion: '2.3.0.0-2208'});
+      var args = testHelpers.findAjaxRequest('name', 'cluster.load_repo_version');
+      expect(args[0].data).to.eql({stackName: 'HDP', repositoryVersion: '2.3.0.0-2208'});
     });
   });
 
@@ -1172,20 +1171,13 @@ describe('App.WizardStep8Controller', function () {
 
   describe('#deleteClusters', function() {
 
-    beforeEach(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
-    });
-
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
-
     it('should call App.ajax.send for each provided clusterName', function() {
       var clusterNames = ['h1', 'h2', 'h3'];
       installerStep8Controller.deleteClusters(clusterNames);
-      expect(App.ajax.send.callCount).to.equal(clusterNames.length);
+      var args = testHelpers.filterAjaxRequests('name', 'common.delete.cluster');
+      expect(args).to.have.property('length').equal(clusterNames.length);
       clusterNames.forEach(function(n, i) {
-        expect(App.ajax.send.getCall(i).args[0].data).to.eql({name: n, isLast: i === clusterNames.length - 1});
+        expect(args[i][0].data).to.eql({name: n, isLast: i === clusterNames.length - 1});
       });
     });
 
@@ -1249,24 +1241,8 @@ describe('App.WizardStep8Controller', function () {
   });
 
   describe('#addRequestToAjaxQueue', function() {
-    describe('testMode = true', function() {
-      before(function() {
-        App.set('testMode', true);
-      });
-      after(function() {
-        App.set('testMode', false);
-      });
-      it('shouldn\'t do nothing', function() {
-        installerStep8Controller.set('ajaxRequestsQueue', App.ajaxQueue.create());
-        installerStep8Controller.get('ajaxRequestsQueue').clear();
-        installerStep8Controller.addRequestToAjaxQueue({});
-        expect(installerStep8Controller.get('ajaxRequestsQueue.queue.length')).to.equal(0);
-      });
-    });
-    describe('testMode = true', function() {
-      before(function() {
-        App.set('testMode', false);
-      });
+
+    describe('testMode = false', function() {
       it('should add request', function() {
         var clusterName = 'c1';
         installerStep8Controller.reopen({clusterName: clusterName});
@@ -1338,39 +1314,27 @@ describe('App.WizardStep8Controller', function () {
 
   describe('#applyInstalledServicesConfigurationGroup', function() {
     beforeEach(function() {
-      sinon.stub($, 'ajax', function () {
-        return {
-          then: Em.K,
-          retry: function () {
-            return {then: Em.K}
-          }
-        }
-      });
       sinon.stub(App.router, 'get', function() {
         return configurationController;
       });
     });
     afterEach(function() {
-      $.ajax.restore();
       App.router.get.restore();
     });
     it('should do ajax request for each config group', function() {
       var configGroups = [{ConfigGroup: {id:''}}, {ConfigGroup: {id:''}}];
       installerStep8Controller.applyInstalledServicesConfigurationGroup(configGroups);
-      expect($.ajax.callCount).to.equal(configGroups.length);
+      var args = testHelpers.filterAjaxRequests('name', 'config_groups.update_config_group');
+      expect(args).to.have.property('length').equal(configGroups.length);
     });
   });
 
   describe('#getExistingClusterNames', function() {
-    beforeEach(function() {
-      sinon.stub(App.ajax, 'send', Em.K);
-    });
-    afterEach(function() {
-      App.ajax.send.restore();
-    });
+
     it('should do ajax request', function() {
       installerStep8Controller.getExistingClusterNames();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'wizard.step8.existing_cluster_names');
+      expect(args).exists;
     });
   });
 
@@ -1892,8 +1856,6 @@ describe('App.WizardStep8Controller', function () {
     describe('#createNotification', function () {
 
       beforeEach(function () {
-        var stub = sinon.stub(App, 'get');
-        stub.withArgs('testMode').returns(false);
         installerStep8Controller.clearStep();
         installerStep8Controller.set('content', {controllerName: 'installerController'});
         installerStep8Controller.set('configs', [
@@ -1910,21 +1872,14 @@ describe('App.WizardStep8Controller', function () {
           {name: 'some_p', value: 'some_v', serviceName: 'MISC', filename: 'alert_notification'}
         ]);
         installerStep8Controller.get('ajaxRequestsQueue').clear();
-        sinon.stub(App.ajax, 'send', function () {
-          return {complete: Em.K}
-        });
-      });
-
-      afterEach(function () {
-        App.get.restore();
-        App.ajax.send.restore();
       });
 
       it('should add request to queue', function () {
         installerStep8Controller.createNotification();
         expect(installerStep8Controller.get('ajaxRequestsQueue.queue.length')).to.equal(1);
         installerStep8Controller.get('ajaxRequestsQueue').runNextRequest();
-        expect(App.ajax.send.calledOnce).to.be.true;
+        var args = testHelpers.findAjaxRequest('name', 'alerts.create_alert_notification');
+        expect(args).exists;
       });
 
       describe('sent data should be valid', function () {
@@ -2443,7 +2398,6 @@ describe('App.WizardStep8Controller', function () {
 
     beforeEach(function () {
       sinon.stub(App.db, 'get').withArgs('KerberosWizard', 'kerberosDescriptorConfigs').returns(1234);
-      sinon.stub(App.ajax, 'send', Em.K);
       sinon.stub(installerStep8Controller, 'addRequestToAjaxQueue', Em.K);
       sinon.stub(installerStep8Controller, 'get').withArgs('wizardController').returns(Em.Object.create({
         getDBProperty: function() { return true; }
@@ -2452,21 +2406,22 @@ describe('App.WizardStep8Controller', function () {
 
     afterEach(function () {
       App.db.get.restore();
-      App.ajax.send.restore();
       installerStep8Controller.addRequestToAjaxQueue.restore();
       installerStep8Controller.get.restore();
     });
 
     it('should send request instantly', function () {
       installerStep8Controller.updateKerberosDescriptor(true);
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'admin.kerberos.cluster.artifact.update');
+      expect(args[0]).exists;
+      expect(args[0].data).to.be.eql(requestData);
       expect(installerStep8Controller.addRequestToAjaxQueue.called).to.be.false;
-      expect(App.ajax.send.args[0][0].data).to.be.eql(requestData);
     });
 
     it('should add request to the queue', function () {
       installerStep8Controller.updateKerberosDescriptor(false);
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.findAjaxRequest('name', 'admin.kerberos.cluster.artifact.update');
+      expect(args).not.exists;
       expect(installerStep8Controller.addRequestToAjaxQueue.calledOnce).to.be.true;
       expect(installerStep8Controller.addRequestToAjaxQueue.args[0][0].data).to.be.eql(requestData);
     });


Mime
View raw message