You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2014/11/26 12:19:00 UTC

ambari git commit: AMBARI-8444 Unable to close Add Host Wizard at step 2. (atkach)

Repository: ambari
Updated Branches:
  refs/heads/trunk a5acc8e57 -> b4753afd1


AMBARI-8444 Unable to close Add Host Wizard at step 2. (atkach)


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

Branch: refs/heads/trunk
Commit: b4753afd17ba454a7323998c9db61ca6398cb6c4
Parents: a5acc8e
Author: Andrii Tkach <at...@hortonworks.com>
Authored: Wed Nov 26 13:18:53 2014 +0200
Committer: Andrii Tkach <at...@hortonworks.com>
Committed: Wed Nov 26 13:18:53 2014 +0200

----------------------------------------------------------------------
 .../app/controllers/main/host/add_controller.js |  8 ---
 ambari-web/app/controllers/wizard.js            |  6 +-
 .../main/host/add_controller_test.js            |  9 ---
 ambari-web/test/controllers/wizard_test.js      | 62 ++++++++++++++++++++
 4 files changed, 65 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b4753afd/ambari-web/app/controllers/main/host/add_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/add_controller.js b/ambari-web/app/controllers/main/host/add_controller.js
index 001175a..9945aa3 100644
--- a/ambari-web/app/controllers/main/host/add_controller.js
+++ b/ambari-web/app/controllers/main/host/add_controller.js
@@ -79,14 +79,6 @@ App.AddHostController = App.WizardController.extend({
   },
 
   /**
-   * return new object extended from installOptionsTemplate
-   * @return Object
-   */
-  getInstallOptions: function () {
-    return jQuery.extend({}, this.get('installOptionsTemplate'));
-  },
-
-  /**
    * Remove host from model. Used at <code>Confirm hosts</code> step
    * @param hosts Array of hosts, which we want to delete
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/b4753afd/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index e87984d..5ac5a92 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -281,7 +281,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, {
    * Remove all data for installOptions step
    */
   clearInstallOptions: function () {
-    var installOptions = this.get('getInstallOptions');
+    var installOptions = this.getInstallOptions();
     this.set('content.installOptions', installOptions);
     this.setDBProperty('installOptions', installOptions);
     this.set('content.hosts', {});
@@ -504,8 +504,8 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, {
   },
 
   getInstallOptions: function() {
-    return jQuery.extend({}, App.get('isHadoopWindowsStack')? this.get('installWindowsOptionsTemplate') : this.get('installOptionsTemplate'));
-  }.property('App.isHadoopWindowsStack'),
+    return jQuery.extend({}, App.get('isHadoopWindowsStack') ? this.get('installWindowsOptionsTemplate') : this.get('installOptionsTemplate'));
+  },
 
   installOptionsTemplate: {
     hostNames: "", //string

http://git-wip-us.apache.org/repos/asf/ambari/blob/b4753afd/ambari-web/test/controllers/main/host/add_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/add_controller_test.js b/ambari-web/test/controllers/main/host/add_controller_test.js
index ea6a017..a16275e 100644
--- a/ambari-web/test/controllers/main/host/add_controller_test.js
+++ b/ambari-web/test/controllers/main/host/add_controller_test.js
@@ -412,15 +412,6 @@ describe('App.AddHostController', function () {
     });
   });
 
-  describe("#getInstallOptions()", function () {
-    it("", function () {
-      controller.set('installOptionsTemplate', {'prop': 'installOptionsTemplate'});
-      expect(controller.getInstallOptions()).to.be.eql({
-        prop: 'installOptionsTemplate'
-      });
-    });
-  });
-
   describe("#loadServices", function () {
     var services = {
       db: null,

http://git-wip-us.apache.org/repos/asf/ambari/blob/b4753afd/ambari-web/test/controllers/wizard_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard_test.js b/ambari-web/test/controllers/wizard_test.js
index 159ae03..6d2c851 100644
--- a/ambari-web/test/controllers/wizard_test.js
+++ b/ambari-web/test/controllers/wizard_test.js
@@ -97,4 +97,66 @@ describe('App.WizardController', function () {
     });
   });
 
+  describe('#getInstallOptions', function () {
+
+    var cases = [
+        {
+          isHadoopWindowsStack: true,
+          expected: {
+            useSsh: false
+          }
+        },
+        {
+          isHadoopWindowsStack: false,
+          expected: {
+            useSsh: true
+          }
+        }
+      ],
+      title = 'should return {0}';
+
+    beforeEach(function () {
+      sinon.stub(wizardController, 'get')
+        .withArgs('installOptionsTemplate').returns({useSsh: true})
+        .withArgs('installWindowsOptionsTemplate').returns({useSsh: false});
+    });
+
+    afterEach(function () {
+      App.get.restore();
+      wizardController.get.restore();
+    });
+
+    cases.forEach(function (item) {
+      it(title.format(item.expected), function () {
+        sinon.stub(App, 'get').withArgs('isHadoopWindowsStack').returns(item.isHadoopWindowsStack);
+        expect(wizardController.getInstallOptions()).to.eql(item.expected);
+      });
+    });
+
+  });
+
+  describe('#clearInstallOptions', function () {
+
+    wizardController.setProperties({
+      content: {},
+      name: 'wizard'
+    });
+
+    beforeEach(function () {
+      sinon.stub(App, 'get').withArgs('isHadoopWindowsStack').returns(false);
+    });
+
+    afterEach(function () {
+      App.get.restore();
+    });
+
+    it('should clear install options', function () {
+      wizardController.clearInstallOptions();
+      expect(wizardController.get('content.installOptions')).to.eql(wizardController.get('installOptionsTemplate'));
+      expect(wizardController.get('content.hosts')).to.eql({});
+      expect(wizardController.getDBProperty('installOptions')).to.eql(wizardController.get('installOptionsTemplate'))
+      expect(wizardController.getDBProperty('hosts')).to.eql({});
+    });
+  });
+
 });