ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject git commit: AMBARI-5520. Fix UI Unit tests. (onechiporenko)
Date Tue, 22 Apr 2014 11:24:27 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 0740b4da1 -> 0e01b1807


AMBARI-5520. Fix UI Unit tests. (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 0e01b1807d76bd66eb7a30c1baf00cc2e7e63384
Parents: 0740b4d
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Tue Apr 22 14:21:30 2014 +0300
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Tue Apr 22 14:21:30 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |   1 +
 .../global/update_controller_test.js            |   3 +-
 .../test/views/main/dashboard/widgets_test.js   | 127 +++++++++++++++++++
 ambari-web/test/views/main/dashboard_test.js    |  99 +--------------
 4 files changed, 134 insertions(+), 96 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0e01b180/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index 385d76f..b51575e 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -103,6 +103,7 @@ require('test/views/common/quick_link_view_test');
 require('test/views/common/rolling_restart_view_test');
 require('test/views/main/dashboard_test');
 require('test/views/main/dashboard/widget_test');
+require('test/views/main/dashboard/widgets_test');1
 require('test/views/main/dashboard/widgets/text_widget_test');
 require('test/views/main/dashboard/widgets/uptime_text_widget_test');
 require('test/views/main/dashboard/widgets/node_managers_live_test');

http://git-wip-us.apache.org/repos/asf/ambari/blob/0e01b180/ambari-web/test/controllers/global/update_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/update_controller_test.js b/ambari-web/test/controllers/global/update_controller_test.js
index 79374c5..3f4119e 100644
--- a/ambari-web/test/controllers/global/update_controller_test.js
+++ b/ambari-web/test/controllers/global/update_controller_test.js
@@ -189,7 +189,8 @@ describe('App.UpdateController', function () {
             }
           }
         ],
-        result: ["host_components/metrics/flume/flume"]
+        result: ["host_components/metrics/flume/flume,"+
+          "host_components/processes/HostComponentProcess"]
       },
       {
         title: 'YARN service',

http://git-wip-us.apache.org/repos/asf/ambari/blob/0e01b180/ambari-web/test/views/main/dashboard/widgets_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets_test.js b/ambari-web/test/views/main/dashboard/widgets_test.js
new file mode 100644
index 0000000..11b5292
--- /dev/null
+++ b/ambari-web/test/views/main/dashboard/widgets_test.js
@@ -0,0 +1,127 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+var App = require('app');
+require('messages');
+var filters = require('views/common/filter_view');
+require('mixins/common/userPref');
+require('mixins/common/localStorage');
+require('views/main/dashboard/widgets');
+var mainDashboardWidgetsView;
+
+describe('App.MainDashboardWidgetsView', function() {
+
+  beforeEach(function() {
+    mainDashboardWidgetsView = App.MainDashboardWidgetsView.create();
+  });
+
+  describe('#setInitPrefObject', function() {
+    var hdfs_widgets_count = 7;
+    var mapreduce_widgets_count = 7;
+    var hbase_widgets_count = 4;
+    var yarn_widgets_count = 4;
+    var total_widgets_count = 27;
+    var tests = Em.A([
+      {
+        models: {
+          hdfs_model: null,
+          mapreduce_model: null,
+          hbase_model: null,
+          yarn_model: null
+        },
+        e: {
+          visibleL: total_widgets_count - hdfs_widgets_count - mapreduce_widgets_count -
hbase_widgets_count - yarn_widgets_count - 1,
+          hiddenL: 0
+        },
+        m: 'All models are null'
+      },
+      {
+        models: {
+          hdfs_model: {},
+          mapreduce_model: null,
+          hbase_model: null,
+          yarn_model: null
+        },
+        e: {
+          visibleL: total_widgets_count  - mapreduce_widgets_count - hbase_widgets_count
- yarn_widgets_count - 1,
+          hiddenL: 0
+        },
+        m: 'mapreduce_model, hbase_model, yarn_model are null'
+      },
+      {
+        models: {
+          hdfs_model: {},
+          mapreduce_model: {},
+          hbase_model: null,
+          yarn_model: null
+        },
+        e: {
+          visibleL: total_widgets_count - hbase_widgets_count - yarn_widgets_count - 1,
+          hiddenL: 0
+        },
+        m: 'hbase_model and yarn_model are null'
+      },
+      {
+        models: {
+          hdfs_model: {},
+          mapreduce_model: {},
+          hbase_model: {},
+          yarn_model: null
+        },
+        e: {
+          visibleL: total_widgets_count - yarn_widgets_count - 1,
+          hiddenL: 1
+        },
+        m: 'yarn_model is null'
+      },
+      {
+        models: {
+          hdfs_model: {},
+          mapreduce_model: {},
+          hbase_model: {},
+          yarn_model: {}
+        },
+        e: {
+          visibleL: total_widgets_count - 1,
+          hiddenL: 1
+        },
+        m: 'All models are not null'
+      }
+    ]);
+    tests.forEach(function(test) {
+      it(test.m, function() {
+        mainDashboardWidgetsView.set('hdfs_model', test.models.hdfs_model);
+        mainDashboardWidgetsView.set('mapreduce_model', test.models.mapreduce_model);
+        mainDashboardWidgetsView.set('hbase_model', test.models.hbase_model);
+        mainDashboardWidgetsView.set('yarn_model', test.models.yarn_model);
+        mainDashboardWidgetsView.setInitPrefObject();
+        expect(mainDashboardWidgetsView.get('initPrefObject.visible.length')).to.equal(test.e.visibleL);
+        expect(mainDashboardWidgetsView.get('initPrefObject.hidden.length')).to.equal(test.e.hiddenL);
+      });
+    });
+  });
+
+  describe('#persistKey', function() {
+    App.router.set('loginName', 'tdk');
+    it('Check it', function() {
+      expect(mainDashboardWidgetsView.get('persistKey')).to.equal('user-pref-tdk-dashboard');
+    });
+  });
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/0e01b180/ambari-web/test/views/main/dashboard_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard_test.js b/ambari-web/test/views/main/dashboard_test.js
index 18acf67..1236e2d 100644
--- a/ambari-web/test/views/main/dashboard_test.js
+++ b/ambari-web/test/views/main/dashboard_test.js
@@ -21,102 +21,11 @@ var App = require('app');
 require('messages');
 var filters = require('views/common/filter_view');
 require('views/main/dashboard');
-
+var mainDashboardView;
 describe('App.MainDashboardView', function() {
 
-  var mainDashboardView = App.MainDashboardView.create();
-
-  describe('#setInitPrefObject', function() {
-    var hdfs_widgets_count = 7;
-    var mapreduce_widgets_count = 7;
-    var hbase_widgets_count = 4;
-    var yarn_widgets_count = 4;
-    var total_widgets_count = 27;
-    var tests = [
-      {
-        models: {
-          hdfs_model: null,
-          mapreduce_model: null,
-          hbase_model: null,
-          yarn_model: null
-        },
-        e: {
-          visibleL: total_widgets_count - hdfs_widgets_count - mapreduce_widgets_count -
hbase_widgets_count - yarn_widgets_count - 1,
-          hiddenL: 0
-        },
-        m: 'All models are null'
-      },
-      {
-        models: {
-          hdfs_model: {},
-          mapreduce_model: null,
-          hbase_model: null,
-          yarn_model: null
-        },
-        e: {
-          visibleL: total_widgets_count  - mapreduce_widgets_count - hbase_widgets_count
- yarn_widgets_count - 1,
-          hiddenL: 0
-        },
-        m: 'mapreduce_model, hbase_model, yarn_model are null'
-      },
-      {
-        models: {
-          hdfs_model: {},
-          mapreduce_model: {},
-          hbase_model: null,
-          yarn_model: null
-        },
-        e: {
-          visibleL: total_widgets_count - hbase_widgets_count - yarn_widgets_count - 1,
-          hiddenL: 0
-        },
-        m: 'hbase_model and yarn_model are null'
-      },
-      {
-        models: {
-          hdfs_model: {},
-          mapreduce_model: {},
-          hbase_model: {},
-          yarn_model: null
-        },
-        e: {
-          visibleL: total_widgets_count - yarn_widgets_count - 1,
-          hiddenL: 1
-        },
-        m: 'yarn_model is null'
-      },
-      {
-        models: {
-          hdfs_model: {},
-          mapreduce_model: {},
-          hbase_model: {},
-          yarn_model: {}
-        },
-        e: {
-          visibleL: total_widgets_count - 1,
-          hiddenL: 1
-        },
-        m: 'All models are not null'
-      }
-    ];
-    tests.forEach(function(test) {
-      it(test.m, function() {
-        mainDashboardView.set('hdfs_model', test.models.hdfs_model);
-        mainDashboardView.set('mapreduce_model', test.models.mapreduce_model);
-        mainDashboardView.set('hbase_model', test.models.hbase_model);
-        mainDashboardView.set('yarn_model', test.models.yarn_model);
-        mainDashboardView.setInitPrefObject();
-        expect(mainDashboardView.get('initPrefObject.visible.length')).to.equal(test.e.visibleL);
-        expect(mainDashboardView.get('initPrefObject.hidden.length')).to.equal(test.e.hiddenL);
-      });
-    });
-  });
-
-  describe('#persistKey', function() {
-    App.router.set('loginName', 'tdk');
-    it('Check it', function() {
-      expect(mainDashboardView.get('persistKey')).to.equal('user-pref-tdk-dashboard');
-    });
-  });
+   beforeEach(function() {
+     mainDashboardView = App.MainDashboardView.create();
+   });
 
 });


Mime
View raw message