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/02 17:50:41 UTC

git commit: AMBARI-8106 Ambari not showing HDFS Block status metrics of active namenode after a failover. (atkach)

Repository: ambari
Updated Branches:
  refs/heads/branch-1.7.0 0e07a4de4 -> ef47f5179


AMBARI-8106 Ambari not showing HDFS Block status metrics of active namenode after a failover. (atkach)


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

Branch: refs/heads/branch-1.7.0
Commit: ef47f5179289cf157cdda4c10a0b6f205149225c
Parents: 0e07a4d
Author: atkach <at...@hortonworks.com>
Authored: Sun Nov 2 18:49:51 2014 +0200
Committer: atkach <at...@hortonworks.com>
Committed: Sun Nov 2 18:49:51 2014 +0200

----------------------------------------------------------------------
 .../app/views/common/chart/linear_time.js       |   5 +-
 .../test/views/common/chart/linear_time_test.js | 107 ++++++++++++++++++-
 2 files changed, 110 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ef47f517/ambari-web/app/views/common/chart/linear_time.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/chart/linear_time.js b/ambari-web/app/views/common/chart/linear_time.js
index d26bcc6..f76bc72 100644
--- a/ambari-web/app/views/common/chart/linear_time.js
+++ b/ambari-web/app/views/common/chart/linear_time.js
@@ -166,12 +166,15 @@ App.ChartLinearTimeView = Ember.View.extend({
     var hostName = (this.get('content')) ? this.get('content.hostName') : "";
 
     var HDFSService = App.HDFSService.find().objectAt(0);
-    var nameNodeName = HDFSService ? HDFSService.get('nameNode.hostName') : "";
+    var nameNodeName = "";
     var MapReduceService = App.MapReduceService.find().objectAt(0);
     var jobTrackerNode = MapReduceService ? MapReduceService.get('jobTracker.hostName') : "";
     var YARNService = App.YARNService.find().objectAt(0);
     var resourceManager = YARNService ? YARNService.get('resourceManager.hostName') : "";
     var timeUnit = this.get('timeUnitSeconds');
+    if (HDFSService) {
+      nameNodeName = (HDFSService.get('activeNameNode')) ? HDFSService.get('activeNameNode.hostName') : HDFSService.get('nameNode.hostName');
+    }
     return {
       toSeconds: toSeconds,
       fromSeconds: toSeconds - timeUnit,

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef47f517/ambari-web/test/views/common/chart/linear_time_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/chart/linear_time_test.js b/ambari-web/test/views/common/chart/linear_time_test.js
index 989118e..15a0d9a 100644
--- a/ambari-web/test/views/common/chart/linear_time_test.js
+++ b/ambari-web/test/views/common/chart/linear_time_test.js
@@ -127,5 +127,110 @@ describe('App.ChartLinearTimeView', function () {
         expect(App.ChartLinearTimeView.TimeElapsedFormatter(test.i)).to.equal(test.e);
       });
     });
-  })
+  });
+
+  describe("#getDataForAjaxRequest()", function() {
+    var services = {
+      yarnService: [],
+      hdfsService: [],
+      mapreduceService: []
+    };
+    beforeEach(function(){
+      sinon.stub(App.HDFSService, 'find', function(){return services.hdfsService});
+      sinon.stub(App.YARNService, 'find', function(){return services.yarnService});
+      sinon.stub(App.MapReduceService, 'find', function(){return services.mapreduceService});
+      sinon.stub(App, 'dateTime').returns(1000);
+      chartLinearTimeView.set('timeUnitSeconds', 1);
+      chartLinearTimeView.set('content', null);
+    });
+    afterEach(function(){
+      App.HDFSService.find.restore();
+      App.YARNService.find.restore();
+      App.MapReduceService.find.restore();
+      App.dateTime.restore();
+    });
+
+    it("content has hostName", function() {
+      chartLinearTimeView.set('content', Em.Object.create({
+        hostName: 'host1'
+      }));
+      expect(chartLinearTimeView.getDataForAjaxRequest()).to.be.eql({
+        toSeconds: 1,
+        fromSeconds: 0,
+        stepSeconds: 15,
+        hostName: 'host1',
+        nameNodeName: '',
+        jobTrackerNode: '',
+        resourceManager: ''
+      });
+    });
+    it("get Namenode host", function() {
+      services.hdfsService = [
+        Em.Object.create({
+          nameNode: {hostName: 'host1'}
+        })
+      ];
+      expect(chartLinearTimeView.getDataForAjaxRequest()).to.be.eql({
+        toSeconds: 1,
+        fromSeconds: 0,
+        stepSeconds: 15,
+        hostName: '',
+        nameNodeName: 'host1',
+        jobTrackerNode: '',
+        resourceManager: ''
+      });
+      services.hdfsService = [];
+    });
+    it("get Namenode host HA", function() {
+      services.hdfsService = [
+        Em.Object.create({
+          activeNameNode: {hostName: 'host1'}
+        })
+      ];
+      expect(chartLinearTimeView.getDataForAjaxRequest()).to.be.eql({
+        toSeconds: 1,
+        fromSeconds: 0,
+        stepSeconds: 15,
+        hostName: '',
+        nameNodeName: 'host1',
+        jobTrackerNode: '',
+        resourceManager: ''
+      });
+      services.hdfsService = [];
+    });
+    it("get jobTracker host", function() {
+      services.mapreduceService = [
+        Em.Object.create({
+          jobTracker: {hostName: 'host1'}
+        })
+      ];
+      expect(chartLinearTimeView.getDataForAjaxRequest()).to.be.eql({
+        toSeconds: 1,
+        fromSeconds: 0,
+        stepSeconds: 15,
+        hostName: '',
+        nameNodeName: '',
+        jobTrackerNode: 'host1',
+        resourceManager: ''
+      });
+      services.mapreduceService = [];
+    });
+    it("get resourceManager host", function() {
+      services.yarnService = [
+        Em.Object.create({
+          resourceManager: {hostName: 'host1'}
+        })
+      ];
+      expect(chartLinearTimeView.getDataForAjaxRequest()).to.be.eql({
+        toSeconds: 1,
+        fromSeconds: 0,
+        stepSeconds: 15,
+        hostName: '',
+        nameNodeName: '',
+        jobTrackerNode: '',
+        resourceManager: 'host1'
+      });
+      services.yarnService = [];
+    });
+  });
 });