ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject ambari git commit: AMBARI-9890. Web Client Should Create Alert Target With 'overwriteExisting' Directive (onechiporenko)
Date Tue, 03 Mar 2015 13:21:49 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.0.0 6d2f7c855 -> 9e7040be3


AMBARI-9890. Web Client Should Create Alert Target With 'overwriteExisting' Directive (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9e7040be
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9e7040be
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9e7040be

Branch: refs/heads/branch-2.0.0
Commit: 9e7040be3418b3c3be0dcb9a591ce8ac9f4e73f4
Parents: 6d2f7c8
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Tue Mar 3 14:30:13 2015 +0200
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Tue Mar 3 15:21:38 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/wizard/step8_controller.js   |  1 +
 ambari-web/app/utils/ajax/ajax.js                       |  2 +-
 .../manage_alert_notifications_controller_test.js       | 11 ++++++-----
 ambari-web/test/controllers/wizard/step8_test.js        | 12 +++++++-----
 4 files changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9e7040be/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js
index 4ad1749..5c5889f 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -1853,6 +1853,7 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs,
App.wiz
     this.addRequestToAjaxQueue({
       name: 'alerts.create_alert_notification',
       data: {
+        urlParams: 'overwriteExisting=true',
         data: apiObject
       }
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/9e7040be/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 50f73d8..1321010 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -415,7 +415,7 @@ var urls = {
     'type': 'DELETE'
   },
   'alerts.create_alert_notification': {
-    'real': '/alert_targets',
+    'real': '/alert_targets?{urlParams}',
     'mock': '',
     'format': function (data) {
       return {

http://git-wip-us.apache.org/repos/asf/ambari/blob/9e7040be/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
b/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
index 054dcd5..cacf981 100644
--- a/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
@@ -24,11 +24,11 @@ describe('App.ManageAlertNotificationsController', function () {
 
   beforeEach(function () {
     controller = App.ManageAlertNotificationsController.create({});
-    sinon.stub(App.ajax, 'send');
+    sinon.stub($, 'ajax', Em.K);
   });
 
   afterEach(function () {
-    App.ajax.send.restore();
+    $.ajax.restore();
   });
 
   describe('#alertNotifications', function () {
@@ -572,7 +572,8 @@ describe('App.ManageAlertNotificationsController', function () {
     it("should send ajax request", function () {
 
       controller.createAlertNotification();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      expect($.ajax.calledOnce).to.be.true;
+      expect($.ajax.args[0][0].url.contains('overwriteExisting=true')).to.be.false;
     });
 
   });
@@ -607,7 +608,7 @@ describe('App.ManageAlertNotificationsController', function () {
     it("should send ajax request", function () {
 
       controller.updateAlertNotification();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      expect($.ajax.calledOnce).to.be.true;
     });
 
   });
@@ -653,7 +654,7 @@ describe('App.ManageAlertNotificationsController', function () {
 
       expect(App.showConfirmationPopup.calledOnce).to.be.true;
       popup.onPrimary();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      expect($.ajax.calledOnce).to.be.true;
     });
 
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/9e7040be/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 39a2498..43cd4fc 100644
--- a/ambari-web/test/controllers/wizard/step8_test.js
+++ b/ambari-web/test/controllers/wizard/step8_test.js
@@ -1369,10 +1369,8 @@ describe('App.WizardStep8Controller', function () {
     describe('#createNotification', function () {
 
       beforeEach(function () {
-        sinon.stub(App, 'get', function (k) {
-          if ('testMode' === k) return false;
-          return Em.get(App, k);
-        });
+        var stub = sinon.stub(App, 'get');
+        stub.withArgs('testMode').returns(false);
         installerStep8Controller.clearStep();
         installerStep8Controller.set('content', {controllerName: 'installerController'});
         installerStep8Controller.set('configs', [
@@ -1389,16 +1387,20 @@ describe('App.WizardStep8Controller', function () {
           {name: 'some_p', value: 'some_v', serviceName: 'MISC', filename: 'alert_notification'}
         ]);
         installerStep8Controller.get('ajaxRequestsQueue').clear();
+        sinon.stub($, 'ajax', function () {return {complete: Em.K}});
       });
 
       afterEach(function () {
         App.get.restore();
+        $.ajax.restore();
       });
 
       it('should add request to queue', function () {
         installerStep8Controller.createNotification();
         expect(installerStep8Controller.get('ajaxRequestsQueue.queue.length')).to.equal(1);
-
+        installerStep8Controller.get('ajaxRequestsQueue').runNextRequest();
+        expect($.ajax.calledOnce).to.be.true;
+        expect($.ajax.args[0][0].url.contains('overwriteExisting=true')).to.be.true;
       });
 
       it('sent data should be valid', function () {


Mime
View raw message