You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2013/06/11 23:35:04 UTC

svn commit: r1491975 - in /incubator/ambari/trunk/ambari-web: app/ app/assets/test/ app/mappers/ app/routes/ app/views/common/ test/controllers/global/ test/controllers/main/ test/controllers/main/admin/ test/installer/ test/main/ test/main/app/ test/m...

Author: yusaku
Date: Tue Jun 11 21:35:02 2013
New Revision: 1491975

URL: http://svn.apache.org/r1491975
Log:
AMBARI-2354. Add unit tests for mappers. (Oleg Nechiporenko via yusaku)

Added:
    incubator/ambari/trunk/ambari-web/test/controllers/main/dashboard_test.js
    incubator/ambari/trunk/ambari-web/test/controllers/main/host_test.js
    incubator/ambari/trunk/ambari-web/test/controllers/main/item_test.js
    incubator/ambari/trunk/ambari-web/test/mappers/
    incubator/ambari/trunk/ambari-web/test/mappers/dataset_mapper_test.js
    incubator/ambari/trunk/ambari-web/test/mappers/hosts_mapper_test.js
    incubator/ambari/trunk/ambari-web/test/mappers/jobs_mapper_test.js
    incubator/ambari/trunk/ambari-web/test/mappers/runs_mapper_test.js
    incubator/ambari/trunk/ambari-web/test/mappers/server_data_mapper_test.js
    incubator/ambari/trunk/ambari-web/test/mappers/status_mapper_test.js
    incubator/ambari/trunk/ambari-web/test/mappers/users_mapper_test.js
Removed:
    incubator/ambari/trunk/ambari-web/test/main/app/app_contoller_test.js
    incubator/ambari/trunk/ambari-web/test/main/dashboard_test.js
    incubator/ambari/trunk/ambari-web/test/main/host/details_test.js
    incubator/ambari/trunk/ambari-web/test/main/host_test.js
    incubator/ambari/trunk/ambari-web/test/main/item_test.js
    incubator/ambari/trunk/ambari-web/test/utils/ajax_test.js
Modified:
    incubator/ambari/trunk/ambari-web/app/assets/test/tests.js
    incubator/ambari/trunk/ambari-web/app/mappers/dataset_mapper.js
    incubator/ambari/trunk/ambari-web/app/mappers/hosts_mapper.js
    incubator/ambari/trunk/ambari-web/app/mappers/runs_mapper.js
    incubator/ambari/trunk/ambari-web/app/mappers/server_data_mapper.js
    incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js
    incubator/ambari/trunk/ambari-web/app/mappers/status_mapper.js
    incubator/ambari/trunk/ambari-web/app/mappers/users_mapper.js
    incubator/ambari/trunk/ambari-web/app/messages.js
    incubator/ambari/trunk/ambari-web/app/routes/add_security.js
    incubator/ambari/trunk/ambari-web/app/routes/main.js
    incubator/ambari/trunk/ambari-web/app/views/common/modal_popup.js
    incubator/ambari/trunk/ambari-web/test/controllers/global/background_operations_test.js
    incubator/ambari/trunk/ambari-web/test/controllers/global/cluster_controller_test.js
    incubator/ambari/trunk/ambari-web/test/controllers/main/admin/cluster_test.js
    incubator/ambari/trunk/ambari-web/test/controllers/main/app_contoller_test.js
    incubator/ambari/trunk/ambari-web/test/installer/step4_test.js
    incubator/ambari/trunk/ambari-web/test/installer/step6_test.js
    incubator/ambari/trunk/ambari-web/test/utils/config_test.js
    incubator/ambari/trunk/ambari-web/test/utils/date_test.js
    incubator/ambari/trunk/ambari-web/test/utils/host_progress_popup_test.js

Modified: incubator/ambari/trunk/ambari-web/app/assets/test/tests.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/assets/test/tests.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/assets/test/tests.js (original)
+++ incubator/ambari/trunk/ambari-web/app/assets/test/tests.js Tue Jun 11 21:35:02 2013
@@ -16,12 +16,15 @@
  * limitations under the License.
  */
 
-require('test/utils/ajax_test');
 require('test/controllers/global/background_operations_test');
 require('test/controllers/global/cluster_controller_test');
 require('test/controllers/main/app_contoller_test');
-require('test/controllers/main/charts/heatmap_metrics/heatmap_metric_test');
 require('test/controllers/main/admin/cluster_test');
+require('test/controllers/main/charts/heatmap_metrics/heatmap_metric_test');
+require('test/controllers/main/host/details_test');
+require('test/controllers/main/dashboard_test');
+require('test/controllers/main/host_test');
+require('test/controllers/main/item_test');
 require('test/installer/step0_test');
 require('test/installer/step2_test');
 require('test/installer/step3_test');
@@ -29,13 +32,16 @@ require('test/installer/step4_test');
 require('test/installer/step5_test');
 require('test/installer/step6_test');
 require('test/installer/step7_test');
-require('test/installer/step9_test');
 require('test/login_test');
-require('test/main/app/app_contoller_test');
-require('test/main/dashboard_test');
-require('test/main/host/details_test');
-require('test/main/host_test');
-require('test/main/item_test');
+require('test/mappers/server_data_mapper_test');
+require('test/mappers/dataset_mapper_test');
+require('test/mappers/hosts_mapper_test');
+require('test/mappers/jobs_mapper_test');
+require('test/mappers/runs_mapper_test');
+require('test/mappers/status_mapper_test');
+require('test/mappers/users_mapper_test');
+require('test/utils/config_test');
+require('test/utils/date_test');
 require('test/utils/config_test');
 require('test/utils/date_test');
 require('test/utils/form_field_test');
@@ -43,4 +49,4 @@ require('test/utils/host_progress_popup_
 require('test/utils/misc_test');
 require('test/utils/validator_test');
 require('test/utils/string_utils_test');
-require('test/views/common/chart/linear_time_test');
+require('test/views/common/chart/linear_time_test');
\ No newline at end of file

Modified: incubator/ambari/trunk/ambari-web/app/mappers/dataset_mapper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/mappers/dataset_mapper.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/mappers/dataset_mapper.js (original)
+++ incubator/ambari/trunk/ambari-web/app/mappers/dataset_mapper.js Tue Jun 11 21:35:02 2013
@@ -16,6 +16,8 @@
  * limitations under the License.
  */
 
+var App = require('app');
+
 App.dataSetMapper = App.QuickDataMapper.create({
   model: App.Dataset,
   Jobs_model: App.DataSetJob,
@@ -60,6 +62,10 @@ App.dataSetMapper = App.QuickDataMapper.
   },
 
   loadSchedule: function (datasetItemFromJson) {
+    App.store.load(App.Dataset.Schedule, this.parseSchedule(datasetItemFromJson));
+  },
+
+  parseSchedule: function(datasetItemFromJson) {
     var schedule = {};
     schedule.id = datasetItemFromJson.id;
     var source_cluster = datasetItemFromJson.Feeds.clusters.cluster.findProperty("type", "source");
@@ -67,7 +73,6 @@ App.dataSetMapper = App.QuickDataMapper.
     var end_date = new Date(source_cluster.validity.end);
 
     var d = new Date();
-    console.debug(d.toString());
     var start_mm = start_date.getMonth() + 1; // In future may consider using getUTCMonth()
     var start_dd = start_date.getDay();
     var start_yyyy = start_date.getFullYear();
@@ -99,9 +104,9 @@ App.dataSetMapper = App.QuickDataMapper.
     schedule.frequency = datasetItemFromJson.Feeds.frequency;
     schedule.timezone = datasetItemFromJson.Feeds.timezone;
     schedule.dataset_id = datasetItemFromJson.id;
-
-    App.store.load(App.Dataset.Schedule, schedule);
+    return schedule;
   },
+
   map: function (json) {
     if (!this.get('model')) {
       return;
@@ -112,8 +117,7 @@ App.dataSetMapper = App.QuickDataMapper.
 
         try {
           // TBC1
-          var re = new RegExp(" ", "g");
-          item.id = item.Feeds.name.replace(re, "_");
+          item.id = this.getId(item.Feeds.name);
 
           // TBC3
           item.dataset_jobs = [];
@@ -164,9 +168,8 @@ App.dataSetMapper = App.QuickDataMapper.
           // TBC2 - but shd be loaded after parsing
           var target_cluster_name = (item.Feeds.clusters.cluster.findProperty("type", "target")).name;
           var target_cluster_id = (item.Feeds.clusters.cluster.findProperty("type", "target")).name;
-          var re = new RegExp(" ","g");
 
-          newitem.target_cluster_id = target_cluster_id.replace(re,"_");
+          newitem.target_cluster_id = this.getId(target_cluster_id);
 
           newitem.schedule_id = newitem.id;
 
@@ -204,10 +207,16 @@ App.dataSetMapper = App.QuickDataMapper.
         console.debug('Before load: App.DataSetJob.find().content : ' + App.DataSetJob.find().content);
         App.store.loadMany(this.get('Jobs_model'), dataset_job_results);
         console.debug('After load: App.DataSetJob.find().content : ' + App.DataSetJob.find().content);
-      } catch (ex) {
+      }
+      catch (ex) {
         console.debug('Exception occured : ' + ex);
       }
     }
+  },
+
+  getId: function(n) {
+    var re = new RegExp(" ", "g");
+    return n.replace(re, "_");
   }
 
 });

Modified: incubator/ambari/trunk/ambari-web/app/mappers/hosts_mapper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/mappers/hosts_mapper.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/mappers/hosts_mapper.js (original)
+++ incubator/ambari/trunk/ambari-web/app/mappers/hosts_mapper.js Tue Jun 11 21:35:02 2013
@@ -5,9 +5,9 @@
  * 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
@@ -45,42 +45,46 @@ App.hostsMapper = App.QuickDataMapper.cr
     last_heart_beat_time: "Hosts.last_heartbeat_time",
     os_arch: 'Hosts.os_arch',
     os_type: 'Hosts.os_type',
-    ip: 'Hosts.ip'
+    ip: 'Hosts.ip',
+    disk_usage: 'disk_usage'
   },
   map: function (json) {
-
     if (json.items) {
+      var result = this.parse(json.items);
+      App.store.loadMany(this.get('model'), result);
+    }
+  },
 
-      var result = [];
-      json.items.forEach(function (item) {
-
-        // Disk Usage
-        if (item.metrics && item.metrics.disk && item.metrics.disk.disk_total && item.metrics.disk.disk_free) {
-          var diskUsed = item.metrics.disk.disk_total - item.metrics.disk.disk_free;
-          var diskUsedPercent = (100 * diskUsed) / item.metrics.disk.disk_total;
-          item.disk_usage = diskUsedPercent.toFixed(1);
-        }
-        // CPU Usage
-        if (item.metrics && item.metrics.cpu && item.metrics.cpu.cpu_system && item.metrics.cpu.cpu_user) {
-          var cpuUsedPercent = item.metrics.cpu.cpu_system + item.metrics.cpu.cpu_user;
-          item.cpu_usage = cpuUsedPercent.toFixed(1);
-        }
-        // Memory Usage
-        if (item.metrics && item.metrics.memory && item.metrics.memory.mem_free && item.metrics.memory.mem_total) {
-          var memUsed = item.metrics.memory.mem_total - item.metrics.memory.mem_free;
-          var memUsedPercent = (100 * memUsed) / item.metrics.memory.mem_total;
-          item.memory_usage = memUsedPercent.toFixed(1);
-        }
-
-        item.host_components.forEach(function (host_component) {
-          host_component.id = host_component.HostRoles.component_name + "_" + host_component.HostRoles.host_name;
-        }, this);
-        result.push(this.parseIt(item, this.config));
+  parse: function(items) {
+    var result = [];
+    items.forEach(function (item) {
+
+      // Disk Usage
+      if (item.metrics && item.metrics.disk && item.metrics.disk.disk_total && item.metrics.disk.disk_free) {
+        var diskUsed = item.metrics.disk.disk_total - item.metrics.disk.disk_free;
+        var diskUsedPercent = (100 * diskUsed) / item.metrics.disk.disk_total;
+        item.disk_usage = diskUsedPercent.toFixed(1);
+      }
+      // CPU Usage
+      if (item.metrics && item.metrics.cpu && item.metrics.cpu.cpu_system && item.metrics.cpu.cpu_user) {
+        var cpuUsedPercent = item.metrics.cpu.cpu_system + item.metrics.cpu.cpu_user;
+        item.cpu_usage = cpuUsedPercent.toFixed(1);
+      }
+      // Memory Usage
+      if (item.metrics && item.metrics.memory && item.metrics.memory.mem_free && item.metrics.memory.mem_total) {
+        var memUsed = item.metrics.memory.mem_total - item.metrics.memory.mem_free;
+        var memUsedPercent = (100 * memUsed) / item.metrics.memory.mem_total;
+        item.memory_usage = memUsedPercent.toFixed(1);
+      }
 
+      item.host_components.forEach(function (host_component) {
+        host_component.id = host_component.HostRoles.component_name + "_" + host_component.HostRoles.host_name;
       }, this);
-      result = this.sortByPublicHostName(result);
-      App.store.loadMany(this.get('model'), result);
-    }
+      result.push(this.parseIt(item, this.config));
+
+    }, this);
+    result = this.sortByPublicHostName(result);
+    return result;
   },
   /**
    * Default data sorting by public_host_name field

Modified: incubator/ambari/trunk/ambari-web/app/mappers/runs_mapper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/mappers/runs_mapper.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/mappers/runs_mapper.js (original)
+++ incubator/ambari/trunk/ambari-web/app/mappers/runs_mapper.js Tue Jun 11 21:35:02 2013
@@ -35,29 +35,7 @@ App.runsMapper = App.QuickDataMapper.cre
       }
 
       json.aaData.forEach(function(item, index) {
-        var o = this.parseIt(item, this.config);
-
-        var r = '{dag: {';
-        item.workflowContext.workflowDag.entries.forEach(function(item) {
-          r += '"' + item.source + '": [';
-          // if a standalone MapReduce job, there won't be any targets
-          if (item.targets) {
-            item.targets.forEach(function(target) {
-              r += '"' + target + '",';
-            });
-            if(item.targets.length){
-              r = r.substr(0, r.length - 1);
-            }
-          } else {
-            r += item.source;
-          }
-          r += '],';
-        });
-        r = r.substr(0, r.length - 1);
-        r += '}}';
-        o.workflowContext = r;
-        o.index = index + 1;
-        result.push(o);
+        result.push(this.generateWorkflow(item, index));
       }, this);
 
       var r = [];
@@ -72,6 +50,34 @@ App.runsMapper = App.QuickDataMapper.cre
 
 
   },
+
+  generateWorkflow: function(item, index) {
+    var o = this.parseIt(item, this.config);
+
+    var r = '{dag: {';
+    item.workflowContext.workflowDag.entries.forEach(function(item) {
+      r += '"' + item.source + '": [';
+      // if a standalone MapReduce job, there won't be any targets
+      if (item.targets) {
+        item.targets.forEach(function(target) {
+          r += '"' + target + '",';
+        });
+        if(item.targets.length){
+          r = r.substr(0, r.length - 1);
+        }
+      }
+      else {
+        r += item.source;
+      }
+      r += '],';
+    });
+    r = r.substr(0, r.length - 1);
+    r += '}}';
+    o.workflowContext = r;
+    o.index = index + 1;
+    return o;
+  },
+
   config : {
     id: 'workflowId',
     appName: 'workflowName',

Modified: incubator/ambari/trunk/ambari-web/app/mappers/server_data_mapper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/mappers/server_data_mapper.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/mappers/server_data_mapper.js (original)
+++ incubator/ambari/trunk/ambari-web/app/mappers/server_data_mapper.js Tue Jun 11 21:35:02 2013
@@ -50,9 +50,8 @@ App.QuickDataMapper = App.ServerDataMapp
 
       json.items.forEach(function (item) {
         result.push(this.parseIt(item, this.config));
-      }, this)
+      }, this);
 
-      //console.log(this.get('model'), result);
       App.store.loadMany(this.get('model'), result);
     }
   },

Modified: incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js (original)
+++ incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js Tue Jun 11 21:35:02 2013
@@ -249,7 +249,6 @@ App.servicesMapper = App.QuickDataMapper
   },
 
   hdfsMapper: function (item) {
-    var result = [];
     var finalConfig = jQuery.extend({}, this.config);
     // Change the JSON so that it is easy to map
     var hdfsConfig = this.hdfsConfig;

Modified: incubator/ambari/trunk/ambari-web/app/mappers/status_mapper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/mappers/status_mapper.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/mappers/status_mapper.js (original)
+++ incubator/ambari/trunk/ambari-web/app/mappers/status_mapper.js Tue Jun 11 21:35:02 2013
@@ -15,6 +15,8 @@
  * the License.
  */
 
+var App = require('app');
+
 App.statusMapper = App.QuickDataMapper.create({
 
   config:{
@@ -48,15 +50,7 @@ App.statusMapper = App.QuickDataMapper.c
       });
 
       //host_components
-      result = {};
-      json.items.forEach(function (item) {
-        item.components.forEach(function (component) {
-          component.host_components.forEach(function (host_component) {
-            host_component.id = host_component.HostRoles.component_name + "_" + host_component.HostRoles.host_name;
-            result[host_component.id] = this.parseIt(host_component, this.config3);
-          }, this)
-        }, this)
-      }, this);
+      result = this.parse_host_components(json);
 
       // console.profile("App.statusMapper.map() profile");
 
@@ -73,5 +67,19 @@ App.statusMapper = App.QuickDataMapper.c
 
       console.log('out status mapper.  Took ' + (new Date().getTime() - start) + 'ms');
     }
+  },
+
+  parse_host_components: function(json) {
+    var result = {};
+    json.items.forEach(function (item) {
+      item.components.forEach(function (component) {
+        component.host_components.forEach(function (host_component) {
+          host_component.id = host_component.HostRoles.component_name + "_" + host_component.HostRoles.host_name;
+          result[host_component.id] = this.parseIt(host_component, this.config3);
+        }, this)
+      }, this)
+    }, this);
+    return result;
   }
+
 });

Modified: incubator/ambari/trunk/ambari-web/app/mappers/users_mapper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/mappers/users_mapper.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/mappers/users_mapper.js (original)
+++ incubator/ambari/trunk/ambari-web/app/mappers/users_mapper.js Tue Jun 11 21:35:02 2013
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 
+var App = require('app');
 
 App.usersMapper = App.QuickDataMapper.create({
   model : App.User,
@@ -29,17 +30,15 @@ App.usersMapper = App.QuickDataMapper.cr
   map: function (json) {
     var self = this;
     json.items.forEach(function (item) {
-      var result= [] ;
-      if(!App.User.find().someProperty("userName", item.Users.user_name))
-      {
-        if(item.Users.roles.indexOf("admin") >= 0){
-          item.Users.admin = true;
-        }else{
-          item.Users.admin = false;
-        }
+      var result= [];
+      if(!App.User.find().someProperty("userName", item.Users.user_name)) {
+        item.Users.admin = self.isAdmin(item.Users.roles);
         result.push(self.parseIt(item, self.config));
         App.store.loadMany(self.get('model'), result);
       }
     });
+  },
+  isAdmin: function(roles) {
+    return (roles.indexOf("admin") >= 0);
   }
 });

Modified: incubator/ambari/trunk/ambari-web/app/messages.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/messages.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/messages.js (original)
+++ incubator/ambari/trunk/ambari-web/app/messages.js Tue Jun 11 21:35:02 2013
@@ -606,6 +606,12 @@ Em.I18n.translations = {
   'admin.addSecurity.apply.stage3': '2. Save Configurations',
   'admin.addSecurity.apply.stage4': '3. Start Services',
   'admin.addSecurity.apply.stage5': '5. Smoke Test',
+  'admin.addSecurity.enable.onClose': 'You are in the process of enabling security on your cluster. ' +
+    'Are you sure you want to navigate away? If you navigate away, ' +
+    'you may have to re-run the security wizard from the beginning to enable security.',
+  'admin.addSecurity.disable.onClose': 'You are in the process of disabling security on your cluster. ' +
+    'Are you sure you want to navigate away? If you navigate away, ' +
+    'you may have to re-run the security wizard from the beginning to disable security.',
   'admin.removeSecurity.header': 'Disable Security',
   'admin.security.status.error' : 'Error in retrieving cluster security status from Ambari server',
   'admin.users.ldapAuthUsed':'LDAP Authentication is being used to authenticate users',

Modified: incubator/ambari/trunk/ambari-web/app/routes/add_security.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/routes/add_security.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/routes/add_security.js (original)
+++ incubator/ambari/trunk/ambari-web/app/routes/add_security.js Tue Jun 11 21:35:02 2013
@@ -59,17 +59,20 @@ module.exports = Em.Route.extend({
           showFooter: false,
 
           onClose: function () {
+            var self = this;
             if (router.get('addSecurityController.currentStep') == 3) {
               var applyingConfigStage = router.get('mainAdminSecurityAddStep3Controller.stages').findProperty('stage', 'stage3');
-              if (applyingConfigStage) {
-                var applyingConfig = (applyingConfigStage.get('isStarted')) && (!applyingConfigStage.get('isCompleted'));
-                if (applyingConfig) {
-                  return;
-                } else {
+              if (applyingConfigStage && !applyingConfigStage.get('isCompleted')) {
+                App.showConfirmationPopup(function () {
                   router.get('mainAdminSecurityAddStep3Controller').clearStep();
-                }
+                  self.proceedOnClose();
+                }, Em.I18n.t('admin.addSecurity.enable.onClose'));
+                return;
               }
             }
+            this.proceedOnClose();
+          },
+          proceedOnClose: function(){
             this.hide();
             App.router.get('updateController').set('isWorking', true);
             mainAdminSecurityController.setAddSecurityWizardStatus(null);

Modified: incubator/ambari/trunk/ambari-web/app/routes/main.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/routes/main.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/routes/main.js (original)
+++ incubator/ambari/trunk/ambari-web/app/routes/main.js Tue Jun 11 21:35:02 2013
@@ -705,15 +705,18 @@ module.exports = Em.Route.extend({
                 showFooter: false,
 
                 onClose: function () {
+                  var self = this;
                   var applyingConfigStage = router.get('mainAdminSecurityDisableController.stages').findProperty('stage', 'stage3');
-                  if (applyingConfigStage) {
-                    var applyingConfig = (applyingConfigStage.get('isStarted')) && (!applyingConfigStage.get('isCompleted'));
-                    if (applyingConfig) {
-                      return;
-                    } else {
-                      router.get('mainAdminSecurityDisableController').clearStep();
-                    }
+                  if (applyingConfigStage && !applyingConfigStage.get('isCompleted')) {
+                    App.showConfirmationPopup(function () {
+                      router.get('mainAdminSecurityAddStep3Controller').clearStep();
+                      self.proceedOnClose();
+                    }, Em.I18n.t('admin.addSecurity.disable.onClose'));
+                    return;
                   }
+                  this.proceedOnClose();
+                },
+                proceedOnClose: function(){
                   this.hide();
                   App.db.setSecurityDeployStages(undefined);
                   router.get('mainAdminSecurityController').setDisableSecurityStatus(undefined);

Modified: incubator/ambari/trunk/ambari-web/app/views/common/modal_popup.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/common/modal_popup.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/common/modal_popup.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/common/modal_popup.js Tue Jun 11 21:35:02 2013
@@ -134,10 +134,10 @@ App.showConfirmationPopup = function(pri
     return false;
   }
   return App.ModalPopup.show({
-    primary: Em.I18n.t('yes'),
-    secondary: Em.I18n.t('no'),
+    primary: Em.I18n.t('ok'),
+    secondary: Em.I18n.t('common.cancel'),
     header: Em.I18n.t('popup.confirmation.commonHeader'),
-    body: body || 'Are you sure?',
+    body: body || Em.I18n.t('question.sure'),
     onPrimary: function() {
       this.hide();
       primary();

Modified: incubator/ambari/trunk/ambari-web/test/controllers/global/background_operations_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/controllers/global/background_operations_test.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/controllers/global/background_operations_test.js (original)
+++ incubator/ambari/trunk/ambari-web/test/controllers/global/background_operations_test.js Tue Jun 11 21:35:02 2013
@@ -23,14 +23,12 @@ require('config');
 require('utils/updater');
 require('utils/ajax');
 
+require('models/host_component');
+
 require('controllers/global/background_operations_controller');
 require('views/common/modal_popup');
 require('utils/host_progress_popup');
 
-/*window.console.log = function(text){
-  console.log(text);
-}*/
-
 describe('App.BackgroundOperationsController', function () {
 
   /**

Modified: incubator/ambari/trunk/ambari-web/test/controllers/global/cluster_controller_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/controllers/global/cluster_controller_test.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/controllers/global/cluster_controller_test.js (original)
+++ incubator/ambari/trunk/ambari-web/test/controllers/global/cluster_controller_test.js Tue Jun 11 21:35:02 2013
@@ -23,12 +23,9 @@ require('utils/http_client');
 
 describe('App.clusterController', function () {
 
-  /**
-   * Test object
-   */
-  var controller = App.ClusterController.create();
   describe('#updateLoadStatus()', function () {
     it('all items are loaded', function(){
+      var controller = App.ClusterController.create();
       controller.set('dataLoadList', Em.Object.create({
         'item1':true,
         'item2':false
@@ -38,6 +35,7 @@ describe('App.clusterController', functi
       expect(controller.get('clusterDataLoadedPercent')).to.equal('width:100%');
     })
     it('one item of two is loaded', function(){
+      var controller = App.ClusterController.create();
       controller.set('dataLoadList', Em.Object.create({
         'item1':false,
         'item2':false
@@ -45,6 +43,6 @@ describe('App.clusterController', functi
       controller.updateLoadStatus.call(controller, 'item1');
       expect(controller.get('isLoaded')).to.equal(false);
       expect(controller.get('clusterDataLoadedPercent')).to.equal('width:50%');
-    })
-  })
-})
+    });
+  });
+});

Modified: incubator/ambari/trunk/ambari-web/test/controllers/main/admin/cluster_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/controllers/main/admin/cluster_test.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/controllers/main/admin/cluster_test.js (original)
+++ incubator/ambari/trunk/ambari-web/test/controllers/main/admin/cluster_test.js Tue Jun 11 21:35:02 2013
@@ -23,22 +23,18 @@ require('controllers/main/admin/cluster'
 
 describe('App.MainAdminClusterController', function () {
 
-  /**
-   * Predefined data
-   *
-   */
   App.set('currentStackVersion', 'HDP-1.2.2');
   App.set('defaultStackVersion', 'HDP-1.2.2');
-  /**
-   * Test object
-   */
-  var controller = App.MainAdminClusterController.create({
-    parseServicesInfo:function(){}
-  });
   var data = {
     "items" : [
       {
         "Versions" : {
+          "stack_version" : "1.3.1",
+          "min_upgrade_version" : "1.2.0"
+        }
+      },               
+      {
+        "Versions" : {
           "stack_version" : "1.3.0",
           "min_upgrade_version" : "1.2.0"
         }
@@ -60,11 +56,17 @@ describe('App.MainAdminClusterController
 
   describe('#updateUpgradeVersionSuccessCallback()', function () {
     it('upgrade version of stack should be "HDP-1.3.0"', function(){
+      var controller = App.MainAdminClusterController.create({
+        parseServicesInfo:function(){}
+      });
       controller.updateUpgradeVersionSuccessCallback.call(controller, data);
-      expect(controller.get('upgradeVersion')).to.equal('HDP-1.3.0');
+      expect(controller.get('upgradeVersion')).to.equal('HDP-1.3.1');
     })
     it('if min upgrade version less then current then upgrade version equal current', function(){
       data.items[0].Versions.min_upgrade_version = "1.2.3";
+      var controller = App.MainAdminClusterController.create({
+        parseServicesInfo:function(){}
+      });
       controller.updateUpgradeVersionSuccessCallback.call(controller, data);
       expect(controller.get('upgradeVersion')).to.equal('HDP-1.2.2');
     })

Modified: incubator/ambari/trunk/ambari-web/test/controllers/main/app_contoller_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/controllers/main/app_contoller_test.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/controllers/main/app_contoller_test.js (original)
+++ incubator/ambari/trunk/ambari-web/test/controllers/main/app_contoller_test.js Tue Jun 11 21:35:02 2013
@@ -17,14 +17,10 @@
  */
 
 
- var App = require('app');
-  require('controllers/main/apps_controller');
-/* require('models/cluster');
- require('models/service');
- require('models/pagination');
- require('controllers/main/host');*/
+var App = require('app');
+require('controllers/main/apps_controller');
 
- describe('MainAppsController', function () {
+describe('MainAppsController', function () {
 
 
    describe('#iTotalDisplayRecordsObserver()', function () {
@@ -139,8 +135,9 @@
    });
 
    describe('#filterObject.createAppLink(), #filterObject.valueObserver()', function () {
+     var mainAppsController = App.MainAppsController.create();
+     mainAppsController.set('content.length', 20);
      it('should set runUrl of filterObject when changing value for any filter', function () {
-       var mainAppsController = App.MainAppsController.create();
        mainAppsController.set("filterObject.sSearch_0", "0");
        mainAppsController.set("filterObject.sSearch_1", "workflowName");
        mainAppsController.set("filterObject.sSearch_2", "pig");

Added: incubator/ambari/trunk/ambari-web/test/controllers/main/dashboard_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/controllers/main/dashboard_test.js?rev=1491975&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/controllers/main/dashboard_test.js (added)
+++ incubator/ambari/trunk/ambari-web/test/controllers/main/dashboard_test.js Tue Jun 11 21:35:02 2013
@@ -0,0 +1,36 @@
+/**
+ * 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('models/alert'); 
+App.Alert.FIXTURES = [{ status: 'ok' }, { status: 'corrupt' }, { status: 'corrupt',}];
+require('controllers/main/dashboard');
+ 
+describe('MainDashboard', function () {
+ 
+  var controller = App.MainDashboardController.create();
+  
+  describe('#alertsCount', function () {
+    it('should return 2 if 2 alerts has status corrupt', function () {
+        expect(controller.get('alertsCount')).to.equal(2);
+    })
+  })
+})
+*/
\ No newline at end of file

Added: incubator/ambari/trunk/ambari-web/test/controllers/main/host_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/controllers/main/host_test.js?rev=1491975&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/controllers/main/host_test.js (added)
+++ incubator/ambari/trunk/ambari-web/test/controllers/main/host_test.js Tue Jun 11 21:35:02 2013
@@ -0,0 +1,85 @@
+/**
+ * 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('models/cluster');
+require('models/service');
+require('models/pagination');
+require('controllers/main/host');
+
+describe('MainHostController', function () {
+    describe('#sortByName()', function () {
+        it('should change isSort value to true', function () {
+            var mainHostController = App.MainHostController.create();
+            mainHostController.set('isSort', false);
+            mainHostController.sortByName();
+            expect(mainHostController.get('isSort')).to.equal(true);
+        });
+
+
+        it('should inverse sortingAsc ', function () {
+            var mainHostController = App.MainHostController.create();
+            mainHostController.set('sortingAsc', false);
+            mainHostController.sortByName();
+            expect(mainHostController.get('sortingAsc')).to.equal(true);
+            mainHostController.sortByName();
+            expect(mainHostController.get('sortingAsc')).to.equal(false);
+        })
+    });
+
+
+    describe('#showNextPage, #showPreviousPage()', function () {
+        it('should change rangeStart according to page', function () {
+            var mainHostController = App.MainHostController.create();
+            mainHostController.set('pageSize', 3);
+            mainHostController.showNextPage();
+            expect(mainHostController.get('rangeStart')).to.equal(3);
+            mainHostController.showPreviousPage();
+            expect(mainHostController.get('rangeStart')).to.equal(0);
+        })
+    });
+
+
+    describe('#sortClass()', function () {
+        it('should return \'icon-arrow-down\' if sortingAsc is true', function () {
+            var mainHostController = App.MainHostController.create({});
+            mainHostController.set('sortingAsc', true);
+            expect(mainHostController.get('sortClass')).to.equal('icon-arrow-down');
+        });
+        it('should return \'icon-arrow-up\' if sortingAsc is false', function () {
+            var mainHostController = App.MainHostController.create({});
+            mainHostController.set('sortingAsc', false);
+            expect(mainHostController.get('sortClass')).to.equal('icon-arrow-up');
+        })
+    });
+
+
+    describe('#allChecked', function () {
+        it('should fill selectedhostsids array', function () {
+            var mainHostController = App.MainHostController.create();
+            mainHostController.set('allChecked', false);
+            expect(mainHostController.get('selectedHostsIds').length).to.equal(0);
+            mainHostController.set('allChecked', true);
+            expect(!!(mainHostController.get('selectedHostsIds').length)).to.equal(true);
+        })
+    });
+
+
+});
+*/

Added: incubator/ambari/trunk/ambari-web/test/controllers/main/item_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/controllers/main/item_test.js?rev=1491975&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/controllers/main/item_test.js (added)
+++ incubator/ambari/trunk/ambari-web/test/controllers/main/item_test.js Tue Jun 11 21:35:02 2013
@@ -0,0 +1,35 @@
+/**
+ * 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('views/common/modal_popup');
+require('controllers/main/service/item');
+
+describe('App.MainServiceItemController', function () {
+
+    describe('#showRebalancer', function () {
+        it('should return true if serviceName is hdfs', function () {
+            var mainServiceItemController = App.MainServiceItemController.create({
+            });
+            mainServiceItemController.content.set('serviceName', 'hdfs');
+            expect(mainServiceItemController.get('showRebalancer')).to.equal(true);
+        })
+    })
+})
+*/

Modified: incubator/ambari/trunk/ambari-web/test/installer/step4_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/installer/step4_test.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/installer/step4_test.js (original)
+++ incubator/ambari/trunk/ambari-web/test/installer/step4_test.js Tue Jun 11 21:35:02 2013
@@ -79,7 +79,6 @@ describe('App.WizardStep4Controller', fu
       controller.setEach('isSelected', false);
       controller.findProperty('serviceName', 'HIVE').set('isSelected', true);
       controller.checkDependencies();
-      expect(controller.findProperty('serviceName', 'ZOOKEEPER').get('isSelected')).to.equal(true);
       expect(controller.findProperty('serviceName', 'HCATALOG').get('isSelected')).to.equal(true);
       expect(controller.findProperty('serviceName', 'WEBHCAT').get('isSelected')).to.equal(true);
     })

Modified: incubator/ambari/trunk/ambari-web/test/installer/step6_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/installer/step6_test.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/installer/step6_test.js (original)
+++ incubator/ambari/trunk/ambari-web/test/installer/step6_test.js Tue Jun 11 21:35:02 2013
@@ -39,6 +39,10 @@ describe('App.WizardStep6Controller', fu
       Em.Object.create({
         serviceName: 'HBASE',
         isSelected: true
+      }),
+      Em.Object.create({
+        serviceName: 'HDFS',
+        isSelected: true
       })
     ]
   });

Added: incubator/ambari/trunk/ambari-web/test/mappers/dataset_mapper_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/mappers/dataset_mapper_test.js?rev=1491975&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/mappers/dataset_mapper_test.js (added)
+++ incubator/ambari/trunk/ambari-web/test/mappers/dataset_mapper_test.js Tue Jun 11 21:35:02 2013
@@ -0,0 +1,109 @@
+/**
+ * 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 Ember = require('ember');
+var App = require('app');
+
+require('mappers/server_data_mapper');
+require('mappers/dataset_mapper');
+
+describe('App.dataSetMapper', function () {
+
+  describe('#getId', function() {
+    var tests = [
+      {i:'My Name',e:'My_Name'},
+      {i:'MyName',e:'MyName'},
+      {i:'My  Name',e:'My__Name'},
+      {i:'My Big Name',e:'My_Big_Name'}
+    ];
+    it('Replace spaces with _', function() {
+      tests.forEach(function(test) {
+        expect(App.dataSetMapper.getId(test.i)).to.equal(test.e);
+      });
+    });
+  });
+
+  describe('#parseSchedule', function() {
+    var tests = [
+      {
+        "Feeds":{
+          "frequency":"minutes(1)",
+          "timezone":"UTC",
+          "clusters":{
+            "cluster":[
+              {
+                "name":"drsource3",
+                "type":"source",
+                "validity":{
+                  "start":"2010-01-01T00:00Z",
+                  "end":"2015-01-01T02:00Z"
+                }
+              }
+            ]
+          }
+        },
+        "results": {
+          start_time: '3:0:AM',
+          end_time: '5:0:AM',
+          frequency: 'minutes(1)',
+          timezone: 'UTC',
+          start_date: '1/5/2010',
+          end_date: '1/4/2015'
+        }
+      },
+      {
+        "Feeds":{
+          "frequency":"minutes(5)",
+          "timezone":"UTC",
+          "clusters":{
+            "cluster":[
+              {
+                "name":"drsource3",
+                "type":"source",
+                "validity":{
+                  "start":"2013-01-01T15:00Z",
+                  "end":"2014-01-01T12:00Z"
+                }
+              }
+            ]
+          }
+        },
+        "results": {
+          start_time: '6:0:PM',
+          end_time: '3:0:PM',
+          frequency: 'minutes(5)',
+          timezone: 'UTC',
+          start_date: '1/2/2013',
+          end_date: '1/3/2014'
+        }
+      }
+    ];
+    tests.forEach(function(test) {
+      it('parse valid data', function() {
+        var schedule = App.dataSetMapper.parseSchedule(test);
+        expect(schedule.start_time).to.equal(test.results.start_time);
+        expect(schedule.end_time).to.equal(test.results.end_time);
+        expect(schedule.frequency).to.equal(test.results.frequency);
+        expect(schedule.timezone).to.equal(test.results.timezone);
+        expect(schedule.start_date).to.equal(test.results.start_date);
+        expect(schedule.end_date).to.equal(test.results.end_date);
+      });
+    });
+  });
+
+});

Added: incubator/ambari/trunk/ambari-web/test/mappers/hosts_mapper_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/mappers/hosts_mapper_test.js?rev=1491975&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/mappers/hosts_mapper_test.js (added)
+++ incubator/ambari/trunk/ambari-web/test/mappers/hosts_mapper_test.js Tue Jun 11 21:35:02 2013
@@ -0,0 +1,375 @@
+/**
+ * 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 Ember = require('ember');
+var App = require('app');
+
+require('models/host');
+require('models/host_component');
+require('mappers/server_data_mapper');
+require('mappers/hosts_mapper');
+
+describe('App.hostsMapper', function () {
+
+  describe('#sortByPublicHostName()', function () {
+    var tests = [
+      {
+        i: [
+          {public_host_name: 'host0'},
+          {public_host_name: 'host1'},
+          {public_host_name: 'host2'},
+          {public_host_name: 'host3'}
+        ],
+        m: 'Sorted array',
+        e: ['host0','host1','host2','host3']
+      },
+      {
+        i: [
+          {public_host_name: 'host3'},
+          {public_host_name: 'host2'},
+          {public_host_name: 'host1'},
+          {public_host_name: 'host0'}
+        ],
+        m: 'Reverse sorted array',
+        e: ['host0','host1','host2','host3']
+      },
+      {
+        i: [
+          {public_host_name: 'host2'},
+          {public_host_name: 'host3'},
+          {public_host_name: 'host0'},
+          {public_host_name: 'host1'}
+        ],
+        m: 'Shuffled array',
+        e: ['host0','host1','host2','host3']
+      }
+    ];
+    tests.forEach(function(test) {
+      it(test.m, function() {
+        expect(App.hostsMapper.sortByPublicHostName(test.i).mapProperty('public_host_name')).to.eql(test.e);
+      });
+    });
+  });
+
+  var hosts = {
+    "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts?fields=Hosts/host_name,Hosts/public_host_name,Hosts/disk_info,Hosts/cpu_count,Hosts/total_mem,Hosts/host_status,Hosts/last_heartbeat_time,Hosts/os_arch,Hosts/os_type,Hosts/ip,host_components,metrics/disk,metrics/load/load_one",
+    "items" : [
+      {
+        "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal",
+        "metrics" : {
+          "disk" : {
+            "disk_total" : 896.17,
+            "disk_free" : 846.304936111
+          },
+          "load" : {
+            "load_one" : 0.786194444444
+          },
+          "memory" : {
+            "mem_total" : 7514116.0,
+            "swap_free" : 0.0,
+            "mem_buffers" : 114389.877778,
+            "mem_shared" : 0.0,
+            "mem_free" : 4320263.07778,
+            "swap_total" : 0.0,
+            "mem_cached" : 2229920.77778
+          },
+          "cpu" : {
+            "cpu_speed" : 2266.0,
+            "cpu_num" : 2.0,
+            "cpu_wio" : 0.393055555556,
+            "cpu_idle" : 85.9025,
+            "cpu_nice" : 0.0,
+            "cpu_aidle" : 0.0,
+            "cpu_system" : 2.75111111111,
+            "cpu_user" : 10.9405555556
+          }
+        },
+        "Hosts" : {
+          "host_status" : "HEALTHY",
+          "cluster_name" : "tdk",
+          "public_host_name" : "ec2-107-21-192-172.compute-1.amazonaws.com",
+          "cpu_count" : 2,
+          "total_mem" : 7518289,
+          "os_arch" : "x86_64",
+          "host_name" : "ip-10-83-54-214.ec2.internal",
+          "disk_info" : [
+            {
+              "available" : "5431780",
+              "used" : "2403168",
+              "percent" : "31%",
+              "size" : "8254240",
+              "type" : "ext4",
+              "mountpoint" : "/"
+            },
+            {
+              "available" : "3757056",
+              "used" : "0",
+              "percent" : "0%",
+              "size" : "3757056",
+              "type" : "tmpfs",
+              "mountpoint" : "/dev/shm"
+            },
+            {
+              "available" : "411234588",
+              "used" : "203012",
+              "percent" : "1%",
+              "size" : "433455904",
+              "type" : "ext3",
+              "mountpoint" : "/grid/0"
+            },
+            {
+              "available" : "411234588",
+              "used" : "203012",
+              "percent" : "1%",
+              "size" : "433455904",
+              "type" : "ext3",
+              "mountpoint" : "/grid/1"
+            }
+          ],
+          "ip" : "10.83.54.214",
+          "os_type" : "centos6",
+          "last_heartbeat_time" : 1369829865123
+        },
+        "host_components" : [
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/HDFS_CLIENT",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "HDFS_CLIENT",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/HBASE_REGIONSERVER",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "HBASE_REGIONSERVER",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/HIVE_METASTORE",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "HIVE_METASTORE",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/DATANODE",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "DATANODE",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/HIVE_SERVER",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "HIVE_SERVER",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/HBASE_MASTER",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "ha_status" : "passive",
+              "component_name" : "HBASE_MASTER",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/MYSQL_SERVER",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "MYSQL_SERVER",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/ZOOKEEPER_SERVER",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "ZOOKEEPER_SERVER",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/OOZIE_SERVER",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "OOZIE_SERVER",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/MAPREDUCE_CLIENT",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "MAPREDUCE_CLIENT",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/NAMENODE",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "NAMENODE",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/GANGLIA_SERVER",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "GANGLIA_SERVER",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/TASKTRACKER",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "TASKTRACKER",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/SQOOP",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "SQOOP",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/GANGLIA_MONITOR",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "GANGLIA_MONITOR",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/HIVE_CLIENT",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "HIVE_CLIENT",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/JOBTRACKER",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "JOBTRACKER",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/ZOOKEEPER_CLIENT",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "ZOOKEEPER_CLIENT",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/SECONDARY_NAMENODE",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "SECONDARY_NAMENODE",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/HBASE_CLIENT",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "HBASE_CLIENT",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/OOZIE_CLIENT",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "OOZIE_CLIENT",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/WEBHCAT_SERVER",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "WEBHCAT_SERVER",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/HCAT",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "HCAT",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/PIG",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "PIG",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          },
+          {
+            "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/NAGIOS_SERVER",
+            "HostRoles" : {
+              "cluster_name" : "tdk",
+              "component_name" : "NAGIOS_SERVER",
+              "host_name" : "ip-10-83-54-214.ec2.internal"
+            }
+          }
+        ]
+      }
+    ]
+  };
+
+  describe('#parse', function() {
+    var result = App.hostsMapper.parse(hosts.items);
+    it('Hosts are loaded', function() {
+      expect(result.length).to.equal(1);
+    });
+    var host = result[0];
+    it('Disk Usage calculated', function() {
+      expect(host.disk_usage).to.equal('5.6');
+    });
+    it('CPU Usage calculated', function() {
+      expect(host.cpu_usage).to.equal('13.7');
+    });
+    it('Memory Usage calculated', function() {
+      expect(host.memory_usage).to.equal('42.5');
+    });
+    it('Host Complonents loaded', function() {
+      expect(host.host_components.length).to.equal(hosts.items[0].host_components.length);
+    });
+  });
+
+});

Added: incubator/ambari/trunk/ambari-web/test/mappers/jobs_mapper_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/mappers/jobs_mapper_test.js?rev=1491975&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/mappers/jobs_mapper_test.js (added)
+++ incubator/ambari/trunk/ambari-web/test/mappers/jobs_mapper_test.js Tue Jun 11 21:35:02 2013
@@ -0,0 +1,111 @@
+/**
+ * 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 Ember = require('ember');
+var App = require('app');
+
+require('views/main/apps/item/dag_view');
+require('mappers/server_data_mapper');
+require('mappers/jobs_mapper');
+
+describe('App.jobTimeLineMapper', function () {
+
+  var test_input = {
+    "map": [
+      {
+        "x": 1369394950,
+        "y": 0
+      },
+      {
+        "x": 1369394951,
+        "y": 1
+      },
+      {
+        "x": 1369394952,
+        "y": 1
+      },
+      {
+        "x": 1369394953,
+        "y": 0
+      }
+    ],
+    "shuffle": [
+      {
+        "x": 1369394950,
+        "y": 0
+      },
+      {
+        "x": 1369394951,
+        "y": 0
+      },
+      {
+        "x": 1369394952,
+        "y": 1
+      },
+      {
+        "x": 1369394953,
+        "y": 1
+      }
+    ],
+    "reduce": [
+      {
+        "x": 1369394950,
+        "y": 0
+      },
+      {
+        "x": 1369394951,
+        "y": 0
+      },
+      {
+        "x": 1369394952,
+        "y": 0
+      },
+      {
+        "x": 1369394953,
+        "y": 0
+      }
+    ]
+  };
+
+  describe('#coordinatesModify()', function () {
+    it('map', function() {
+      var new_map = App.jobTimeLineMapper.coordinatesModify(test_input.map);
+      expect(new_map.length).to.equal(6);
+
+      expect(new_map[1].y).to.equal(new_map[0].y);
+      expect(new_map[2].x).to.equal(new_map[1].x);
+
+      expect(new_map[4].y).to.equal(new_map[5].y);
+      expect(new_map[3].x).to.equal(new_map[4].x);
+    });
+    it('shuffle', function() {
+      var new_shuffle = App.jobTimeLineMapper.coordinatesModify(test_input.shuffle);
+      expect(new_shuffle.length).to.equal(6);
+
+      expect(new_shuffle[2].y).to.equal(new_shuffle[1].y);
+      expect(new_shuffle[3].x).to.equal(new_shuffle[2].x);
+
+      expect(new_shuffle[3].y).to.equal(new_shuffle[4].y);
+      expect(new_shuffle[4].x).to.equal(new_shuffle[5].x);
+    });
+    it('reduce', function() {
+      var new_reduce = App.jobTimeLineMapper.coordinatesModify(test_input.reduce);
+      expect(new_reduce.length).to.equal(4);
+    });
+  });
+});

Added: incubator/ambari/trunk/ambari-web/test/mappers/runs_mapper_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/mappers/runs_mapper_test.js?rev=1491975&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/mappers/runs_mapper_test.js (added)
+++ incubator/ambari/trunk/ambari-web/test/mappers/runs_mapper_test.js Tue Jun 11 21:35:02 2013
@@ -0,0 +1,154 @@
+/**
+ * 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 Ember = require('ember');
+var App = require('app');
+
+require('mappers/server_data_mapper');
+require('mappers/runs_mapper');
+
+describe('App.runsMapper', function () {
+
+  var tests = [
+    {
+      i: {
+        "workflowContext": {
+          "workflowDag": {
+            "entries": [
+              {
+                "source": "scope-5",
+                "targets": []
+              }
+            ]
+          }
+        }
+      },
+      index: 0,
+      e: '{dag: {"scope-5": []}}',
+      m: 'One entry. Without targets'
+    },
+    {
+      i: {
+        "workflowContext": {
+          "workflowDag": {
+            "entries": [
+              {
+                "source": "scope-5",
+                "targets": ['t1']
+              }
+            ]
+          }
+        }
+      },
+      index: 0,
+      e: '{dag: {"scope-5": ["t1"]}}',
+      m: 'One entry. With one target'
+    },
+    {
+      i: {
+        "workflowContext": {
+          "workflowDag": {
+            "entries": [
+              {
+                "source": "scope-5",
+                "targets": ['t1,t2,t3']
+              }
+            ]
+          }
+        }
+      },
+      index: 0,
+      e: '{dag: {"scope-5": ["t1,t2,t3"]}}',
+      m: 'One entry. With multiple targets'
+    },
+    {
+      i: {
+        "workflowContext": {
+          "workflowDag": {
+            "entries": [
+              {
+                "source": "scope-5",
+                "targets": []
+              },
+              {
+                "source": "scope-4",
+                "targets": []
+              }
+            ]
+          }
+        }
+      },
+      index: 0,
+      e: '{dag: {"scope-5": [],"scope-4": []}}',
+      m: 'Two entries. Without targets'
+    },
+    {
+      i: {
+        "workflowContext": {
+          "workflowDag": {
+            "entries": [
+              {
+                "source": "scope-5",
+                "targets": ['t1,t2,t3']
+              },
+              {
+                "source": "scope-4",
+                "targets": ['t1']
+              }
+            ]
+          }
+        }
+      },
+      index: 0,
+      e: '{dag: {"scope-5": ["t1,t2,t3"],"scope-4": ["t1"]}}',
+      m: 'Two entries. With multiple targets'
+    },
+    {
+      i: {
+        "workflowContext": {
+          "workflowDag": {
+            "entries": [
+              {
+                "source": "scope-5",
+                "targets": ['t1,t2,t3']
+              },
+              {
+                "source": "scope-4",
+                "targets": ['t1,t2,t3']
+              }
+            ]
+          }
+        }
+      },
+      index: 0,
+      e: '{dag: {"scope-5": ["t1,t2,t3"],"scope-4": ["t1,t2,t3"]}}',
+      m: 'Two entries. With multiple targets'
+    }
+  ];
+
+  describe('#generateWorkflow', function() {
+    tests.forEach(function(test) {
+      it (test.m, function() {
+        var result = App.runsMapper.generateWorkflow(test.i, test.index);
+        expect(result.workflowContext).to.equal(test.e);
+        expect(result.index).to.equal(test.index + 1);
+      });
+    });
+  });
+
+});

Added: incubator/ambari/trunk/ambari-web/test/mappers/server_data_mapper_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/mappers/server_data_mapper_test.js?rev=1491975&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/mappers/server_data_mapper_test.js (added)
+++ incubator/ambari/trunk/ambari-web/test/mappers/server_data_mapper_test.js Tue Jun 11 21:35:02 2013
@@ -0,0 +1,94 @@
+/**
+ * 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 Ember = require('ember');
+var App = require('app');
+
+require('mappers/server_data_mapper');
+
+describe('App.QuickDataMapper', function () {
+
+  var test_json = {
+    a1: {
+      b1: {
+        c1: 'val1'
+      },
+      b2: 'val2',
+      b3: [
+        {
+          c2: 'val4'
+        },
+        {
+          c2: 'val5'
+        },
+        {
+          c2: 'val1'
+        }
+      ]
+    },
+    a2: 'val3'
+  };
+
+  describe('#getJsonProperty', function() {
+    var tests = [
+      {i:'a1.b1.c1',e:'val1'},
+      {i:'a1.b2',e:'val2'},
+      {i:'a2',e:'val3'},
+      {i:'a1.b3[0].c2',e:'val4'},
+      {i:'a1.b3[1].c2',e:'val5'}
+    ];
+    tests.forEach(function(test) {
+      it(test.i, function() {
+        var mapper = App.QuickDataMapper.create();
+        expect(mapper.getJsonProperty(test_json, test.i)).to.equal(test.e);
+      });
+    });
+  });
+
+  describe('#parseIt', function() {
+    var config = {
+      $a2: 'a2',
+      f1: 'a1.b1.c1',
+      f2: 'a1.b3[0].c2',
+      f3: 'a1.b3',
+      f4_key: 'a1.b3',
+      f4_type: 'array',
+      f4: {
+        item: 'c2'
+      }
+    };
+    var mapper = App.QuickDataMapper.create();
+    var result = mapper.parseIt(test_json, config);
+    it('Property starts with $', function() {
+      expect(result.a2).to.equal('a2');
+    });
+    it('Multi-components path', function() {
+      expect(result.f1).to.equal('val1');
+    });
+    it('Path with array index', function() {
+      expect(result.f2).to.equal('val4');
+    });
+    it('Path returns array', function() {
+      expect(result.f3.length).to.equal(3);
+    });
+    it('Generate array of json fields', function() {
+      expect(result.f4).to.eql(['val1','val4','val5']);
+    });
+  });
+
+});

Added: incubator/ambari/trunk/ambari-web/test/mappers/status_mapper_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/mappers/status_mapper_test.js?rev=1491975&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/mappers/status_mapper_test.js (added)
+++ incubator/ambari/trunk/ambari-web/test/mappers/status_mapper_test.js Tue Jun 11 21:35:02 2013
@@ -0,0 +1,53 @@
+/**
+ * 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 Ember = require('ember');
+var App = require('app');
+
+require('mappers/server_data_mapper');
+require('mappers/status_mapper');
+
+describe('App.statusMapper', function () {
+
+  describe('#parse_host_components', function() {
+    var test_data = {
+      items: [
+        {
+          components: [
+            {
+              host_components: [
+                {
+                  HostRoles : {
+                    component_name: "OOZIE_CLIENT",
+                    host_name: "ip-10-40-35-199.ec2.internal"
+                  }
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    };
+    var result = App.statusMapper.parse_host_components(test_data);
+    var e = 'OOZIE_CLIENT_ip-10-40-35-199.ec2.internal';
+    it('get host_component id', function() {
+      expect(result[e].id).to.equal(e);
+    });
+  });
+
+});

Added: incubator/ambari/trunk/ambari-web/test/mappers/users_mapper_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/mappers/users_mapper_test.js?rev=1491975&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/mappers/users_mapper_test.js (added)
+++ incubator/ambari/trunk/ambari-web/test/mappers/users_mapper_test.js Tue Jun 11 21:35:02 2013
@@ -0,0 +1,40 @@
+/**
+ * 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 Ember = require('ember');
+var App = require('app');
+
+require('mappers/server_data_mapper');
+require('mappers/users_mapper');
+
+describe('App.usersMapper', function () {
+
+  describe('#isAdmin', function() {
+    var tests = [
+      {i:'user,admin',e:true,m:'has admin role'},
+      {i:'admin,user',e:true,m:'has admin role'},
+      {i:'user',e:false,m:'doesn\'t have admin role'}
+    ];
+    tests.forEach(function(test) {
+      it(test.m, function() {
+        expect(App.usersMapper.isAdmin(test.i)).to.equal(test.e);
+      });
+    });
+  });
+
+});

Modified: incubator/ambari/trunk/ambari-web/test/utils/config_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/utils/config_test.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/utils/config_test.js (original)
+++ incubator/ambari/trunk/ambari-web/test/utils/config_test.js Tue Jun 11 21:35:02 2013
@@ -17,6 +17,7 @@
  */
 
 var App = require('app');
+require('config');
 require('utils/config');
 
 describe('App.config', function () {

Modified: incubator/ambari/trunk/ambari-web/test/utils/date_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/utils/date_test.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/utils/date_test.js (original)
+++ incubator/ambari/trunk/ambari-web/test/utils/date_test.js Tue Jun 11 21:35:02 2013
@@ -22,20 +22,12 @@ var App = require('app');
 var validator = require('utils/validator');
 var date = require('utils/date');
 
-require('views/common/modal_popup');
-require('controllers/global/background_operations_controller');
-require('utils/helper');
-require('utils/host_progress_popup');
-
 describe('date', function () {
 
   var correct_tests = [
-    {t: 1349752195000, e: 'Tue, Oct 09, 2012 07:09', e2: 'Tue Oct 09 2012'},
-    {t: 1367752195000, e: 'Sun, May 05, 2013 15:09', e2: 'Sun May 05 2013'},
-    {t: 1369952195000, e: 'Fri, May 31, 2013 02:16', e2: 'Fri May 31 2013'},
-    {t: 1369052195000, e: 'Mon, May 20, 2013 16:16', e2: 'Mon May 20 2013'},
-    {t: 1369792195000, e: 'Wed, May 29, 2013 05:49', e2: 'Wed May 29 2013'},
-    {t: 1389752195000, e: 'Wed, Jan 15, 2014 05:16', e2: 'Wed Jan 15 2014'}
+    {t: 1349752195000, e: 'Tue, Oct 09, 2012 06:09', e2: 'Tue Oct 09 2012'},
+    {t: 1367752195000, e: 'Sun, May 05, 2013 14:09', e2: 'Sun May 05 2013'},
+    {t: 1369952195000, e: 'Fri, May 31, 2013 01:16', e2: 'Fri May 31 2013'}
   ];
 
   var incorrect_tests = [

Modified: incubator/ambari/trunk/ambari-web/test/utils/host_progress_popup_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/test/utils/host_progress_popup_test.js?rev=1491975&r1=1491974&r2=1491975&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/test/utils/host_progress_popup_test.js (original)
+++ incubator/ambari/trunk/ambari-web/test/utils/host_progress_popup_test.js Tue Jun 11 21:35:02 2013
@@ -19,8 +19,8 @@
 var Ember = require('ember');
 var App = require('app');
 
-require('views/common/modal_popup');
 require('controllers/global/background_operations_controller');
+require('views/common/modal_popup');
 require('utils/helper');
 require('utils/host_progress_popup');
 
@@ -50,7 +50,7 @@ describe('App.HostPopup', function () {
       isRunning: false
     },
     {
-      displayName: "Start service Hive",
+      displayName: "Start service Hive/HCat",
       hosts: [
         {
           logTasks: [
@@ -65,7 +65,7 @@ describe('App.HostPopup', function () {
           ],
           name: "ip-10-12-123-90.ec2.internal",
           publicName: "ip-10-12-123-90.ec2.internal",
-          serviceName: "Start service Hive"
+          serviceName: "Start service Hive/HCat"
         },
         {
           logTasks: [
@@ -88,7 +88,7 @@ describe('App.HostPopup', function () {
           ],
           name: "ip-10-33-7-23.ec2.internal",
           publicName: "ip-10-33-7-23.ec2.internal",
-          serviceName: "Start service Hive"
+          serviceName: "Start service Hive/HCat"
         }
       ],
       isRunning: false