ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject ambari git commit: AMBARI-16865 While deleting a service from UI, the confirmation popup does not appear sometimes. (atkach)
Date Wed, 25 May 2016 09:48:18 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 69eb80b75 -> a8e876762


AMBARI-16865 While deleting a service from UI, the confirmation popup does not appear sometimes.
(atkach)


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

Branch: refs/heads/branch-2.4
Commit: a8e876762399fd03d101f3006865ff9e225bf068
Parents: 69eb80b
Author: Andrii Tkach <atkach@apache.org>
Authored: Wed May 25 12:19:01 2016 +0300
Committer: Andrii Tkach <atkach@apache.org>
Committed: Wed May 25 12:47:10 2016 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/service/item.js |   2 +-
 .../test/controllers/main/service/item_test.js  | 100 ++++++++++++-------
 2 files changed, 67 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a8e87676/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index 8396a48..4f8d900 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -1468,7 +1468,7 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
     }, this);
 
     if (Em.isArray(data) && data.length) {
-      this.putChangedConfigurations(data, 'onSaveConfigs');
+      this.putChangedConfigurations(data, 'confirmServiceDeletion');
     } else {
       this.confirmServiceDeletion();
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/a8e87676/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 cfaf321..4176b3d 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -1601,41 +1601,73 @@ describe('App.MainServiceItemController', function () {
     });
   });
 
-  [
-    {
-      m: 'should call only restartLLAPRequest',
-      isRestartRequired: false,
-      toCall: 'restartLLAPRequest'
-    },
-    {
-      m: 'should call only restartLLAPAndRefreshQueueRequest',
-      isRestartRequired: true,
-      toCall: 'restartLLAPAndRefreshQueueRequest'
-    }
-  ].forEach(function (test) {
-        describe("#restartLLAP()", function () {
-          var mainServiceItemController;
-
-          beforeEach(function () {
-            mainServiceItemController = App.MainServiceItemController.create();
-            sinon.stub(mainServiceItemController, 'restartLLAPAndRefreshQueueRequest', Em.K);
-            sinon.stub(mainServiceItemController, 'restartLLAPRequest', Em.K);
-            sinon.stub(App.Service, 'find').returns([Em.Object.create({
-                serviceName: 'YARN',
-                isRestartRequired: test.isRestartRequired
-              })]);
-          });
-          afterEach(function () {
-            mainServiceItemController.restartLLAPAndRefreshQueueRequest.restore();
-            mainServiceItemController.restartLLAPRequest.restore();
-            App.Service.find.restore();
-          });
+  describe("#restartLLAP()", function () {
+    var mainServiceItemController;
 
-          it(test.m, function () {
-            var confirmationPopup = mainServiceItemController.restartLLAP();
-            confirmationPopup.onPrimary();
-            expect(mainServiceItemController[test.toCall].calledOnce).to.be.true;
-          });
+    beforeEach(function () {
+      mainServiceItemController = App.MainServiceItemController.create();
+      sinon.stub(mainServiceItemController, 'restartLLAPAndRefreshQueueRequest', Em.K);
+      sinon.stub(mainServiceItemController, 'restartLLAPRequest', Em.K);
+      this.mockService = sinon.stub(App.Service, 'find');
+    });
+    afterEach(function () {
+      mainServiceItemController.restartLLAPAndRefreshQueueRequest.restore();
+      mainServiceItemController.restartLLAPRequest.restore();
+      this.mockService.restore();
+    });
+
+    [
+      {
+        m: 'should call only restartLLAPRequest',
+        isRestartRequired: false,
+        toCall: 'restartLLAPRequest'
+      },
+      {
+        m: 'should call only restartLLAPAndRefreshQueueRequest',
+        isRestartRequired: true,
+        toCall: 'restartLLAPAndRefreshQueueRequest'
+      }
+    ].forEach(function (test) {
+        it(test.m, function () {
+          this.mockService.returns([Em.Object.create({
+            serviceName: 'YARN',
+            isRestartRequired: test.isRestartRequired
+          })]);
+          var confirmationPopup = mainServiceItemController.restartLLAP();
+          confirmationPopup.onPrimary();
+          expect(mainServiceItemController[test.toCall].calledOnce).to.be.true;
         });
       });
+  });
+
+  describe("#saveConfigs()", function () {
+    var mainServiceItemController;
+
+    beforeEach(function () {
+      mainServiceItemController = App.MainServiceItemController.create();
+      sinon.stub(mainServiceItemController, 'getServiceConfigToSave').returns({});
+      sinon.stub(mainServiceItemController, 'putChangedConfigurations');
+      sinon.stub(mainServiceItemController, 'confirmServiceDeletion');
+    });
+
+    afterEach(function () {
+      mainServiceItemController.getServiceConfigToSave.restore();
+      mainServiceItemController.putChangedConfigurations.restore();
+      mainServiceItemController.confirmServiceDeletion.restore();
+    });
+
+    it("empty stepConfigs", function() {
+      mainServiceItemController.set('stepConfigs', []);
+      mainServiceItemController.saveConfigs();
+      expect(mainServiceItemController.confirmServiceDeletion.calledOnce).to.be.true;
+      expect(mainServiceItemController.putChangedConfigurations.called).to.be.false;
+    });
+
+    it("stepConfigs has configs", function() {
+      mainServiceItemController.set('stepConfigs', [Em.Object.create({serviceName: 'S1'})]);
+      mainServiceItemController.saveConfigs();
+      expect(mainServiceItemController.putChangedConfigurations.calledWith([{}], 'confirmServiceDeletion')).to.be.true;
+      expect(mainServiceItemController.confirmServiceDeletion.called).to.be.false;
+    });
+  });
 });


Mime
View raw message