Bladeren bron

AMBARI-14297. Apply common tests for Em.computed macros (onechiporenko)

Oleg Nechiporenko 9 jaren geleden
bovenliggende
commit
43306594ea
57 gewijzigde bestanden met toevoegingen van 569 en 875 verwijderingen
  1. 2 0
      ambari-web/test/controllers/global/cluster_controller_test.js
  2. 2 0
      ambari-web/test/controllers/global/update_controller_test.js
  3. 12 1
      ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js
  4. 8 2
      ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
  5. 4 0
      ambari-web/test/controllers/main/admin/kerberos_test.js
  6. 11 5
      ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js
  7. 8 1
      ambari-web/test/controllers/main/alerts/manage_alert_groups_controller_test.js
  8. 8 0
      ambari-web/test/controllers/main/charts/heatmap_test.js
  9. 15 10
      ambari-web/test/controllers/main/host/details_test.js
  10. 8 1
      ambari-web/test/controllers/main/host/host_alerts_controller_test.js
  11. 16 9
      ambari-web/test/controllers/main/service/info/config_test.js
  12. 0 2
      ambari-web/test/controllers/main/service/item_test.js
  13. 1 12
      ambari-web/test/controllers/main/service/widgets/create/step2_controller_test.js
  14. 6 24
      ambari-web/test/controllers/main/service/widgets/create/step3_controller_test.js
  15. 8 39
      ambari-web/test/controllers/main/service_test.js
  16. 2 22
      ambari-web/test/controllers/main_test.js
  17. 9 2
      ambari-web/test/controllers/wizard/step10_test.js
  18. 17 65
      ambari-web/test/controllers/wizard/step2_test.js
  19. 16 47
      ambari-web/test/controllers/wizard/step3_test.js
  20. 28 48
      ambari-web/test/controllers/wizard/step6_test.js
  21. 15 31
      ambari-web/test/controllers/wizard/step7_test.js
  22. 45 51
      ambari-web/test/controllers/wizard/step8_test.js
  23. 23 27
      ambari-web/test/controllers/wizard/step9_test.js
  24. 4 0
      ambari-web/test/models/authentication_test.js
  25. 1 12
      ambari-web/test/models/cluster_states_test.js
  26. 7 15
      ambari-web/test/models/configs/objects/service_config_category_test.js
  27. 7 1
      ambari-web/test/models/configs/objects/service_config_property_test.js
  28. 6 50
      ambari-web/test/models/configs/section_test.js
  29. 8 55
      ambari-web/test/models/host_component_test.js
  30. 10 0
      ambari-web/test/models/host_test.js
  31. 11 1
      ambari-web/test/models/repository_test.js
  32. 1 12
      ambari-web/test/models/stack_service_test.js
  33. 7 1
      ambari-web/test/models/upgrade_entity_test.js
  34. 13 17
      ambari-web/test/models/user_test.js
  35. 14 0
      ambari-web/test/views/common/configs/config_history_flow_test.js
  36. 19 13
      ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
  37. 3 0
      ambari-web/test/views/common/configs/service_configs_by_category_view_test.js
  38. 13 3
      ambari-web/test/views/common/form/manage_kdc_credentials_form_test.js
  39. 8 0
      ambari-web/test/views/common/table_view_test.js
  40. 2 12
      ambari-web/test/views/main/admin/highAvailability/nameNode/step4_view_test.js
  41. 2 12
      ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js
  42. 7 1
      ambari-web/test/views/main/alert_definitions_view_test.js
  43. 9 5
      ambari-web/test/views/main/alerts/manage_alert_groups_view_test.js
  44. 10 0
      ambari-web/test/views/main/dashboard/widgets/hbase_average_load_test.js
  45. 10 0
      ambari-web/test/views/main/dashboard/widgets/hbase_regions_in_transition_test.js
  46. 8 0
      ambari-web/test/views/main/dashboard/widgets/namenode_rpc_test.js
  47. 8 0
      ambari-web/test/views/main/dashboard/widgets/text_widget_test.js
  48. 25 172
      ambari-web/test/views/main/host/details/host_component_view_test.js
  49. 9 3
      ambari-web/test/views/main/host_test.js
  50. 9 0
      ambari-web/test/views/main/service/info/summary_test.js
  51. 15 0
      ambari-web/test/views/main/service/item_test.js
  52. 5 36
      ambari-web/test/views/wizard/step1_view_test.js
  53. 6 9
      ambari-web/test/views/wizard/step2_view_test.js
  54. 12 12
      ambari-web/test/views/wizard/step3/hostLogPopupBody_view_test.js
  55. 16 8
      ambari-web/test/views/wizard/step3/hostWarningPopupBody_view_test.js
  56. 9 12
      ambari-web/test/views/wizard/step6_view_test.js
  57. 11 14
      ambari-web/test/views/wizard/step9/hostLogPopupBody_view_test.js

+ 2 - 0
ambari-web/test/controllers/global/cluster_controller_test.js

@@ -35,6 +35,8 @@ describe('App.clusterController', function () {
     {service_name: 'GANGLIA'}
   ];
 
+  App.TestAliases.testAsComputedAlias(controller, 'clusterName', 'App.clusterName', 'string');
+
   describe('#updateLoadStatus()', function () {
 
     controller.set('dataLoadList', Em.Object.create({

+ 2 - 0
ambari-web/test/controllers/global/update_controller_test.js

@@ -28,6 +28,8 @@ describe('App.UpdateController', function () {
     updateServiceMetric: function(){}
   });
 
+  App.TestAliases.testAsComputedAlias(App.UpdateController.create(), 'clusterName', 'App.router.clusterController.clusterName', 'string');
+
   describe('#getUrl()', function () {
 
     it('testMode = true', function () {

+ 12 - 1
ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js

@@ -19,14 +19,24 @@
 var App = require('app');
 var setups = require('test/init_model_test');
 
+function getController() {
+  return App.KerberosWizardStep2Controller.create({});
+}
+
 describe('App.KerberosWizardStep2Controller', function() {
 
+  App.TestAliases.testAsComputedAlias(getController(), 'isBackBtnDisabled', 'testConnectionInProgress', 'boolean');
+
+  App.TestAliases.testAsComputedAlias(getController(), 'hostNames', 'App.allHostNames');
+
+  App.TestAliases.testAsComputedAlias(getController(), 'isConfigsLoaded', 'wizardController.stackConfigsLoaded', 'boolean');
+
   describe('#createKerberosSiteObj', function() {
     var controller;
 
     beforeEach(function() {
       setups.setupStackVersion(this, 'HDP-2.3');
-      controller = App.KerberosWizardStep2Controller.create({});
+      controller = getController();
       sinon.stub(controller, 'tweakKdcTypeValue', Em.K);
       sinon.stub(controller, 'tweakManualKdcProperties', Em.K);
     });
@@ -84,4 +94,5 @@ describe('App.KerberosWizardStep2Controller', function() {
       });
     });
   });
+
 });

+ 8 - 2
ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js

@@ -17,9 +17,15 @@
  */
 
 var App = require('app');
-
+var c  = App.KerberosWizardStep4Controller.create({
+  wizardController: Em.Object.create({
+    name: ''
+  })
+});
 describe('App.KerberosWizardStep4Controller', function() {
-  
+
+  App.TestAliases.testAsComputedEqual(c, 'isWithinAddService', 'wizardController.name', 'addServiceController');
+
   describe('#isSubmitDisabled', function() {
     var controller = App.KerberosWizardStep4Controller.create({});
     var configs = Em.A([

+ 4 - 0
ambari-web/test/controllers/main/admin/kerberos_test.js

@@ -22,6 +22,10 @@ describe('App.MainAdminKerberosController', function() {
 
   var controller = App.MainAdminKerberosController.create({});
 
+  App.TestAliases.testAsComputedEqual(controller, 'isManualKerberos', 'kdc_type', 'none');
+
+  App.TestAliases.testAsComputedSomeBy(controller, 'isPropertiesChanged', 'stepConfigs', 'isPropertiesChanged', true);
+
   describe('#prepareConfigProperties', function() {
     beforeEach(function() {
       sinon.stub(App.Service, 'find').returns([

+ 11 - 5
ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js

@@ -20,16 +20,22 @@ var App = require('app');
 
 var controller;
 
+function getController() {
+  return App.MainAlertDefinitionDetailsController.create({
+    content: Em.Object.create({
+      label: 'label'
+    })
+  });
+}
+
 describe('App.MainAlertDefinitionDetailsController', function () {
 
   beforeEach(function () {
-    controller = App.MainAlertDefinitionDetailsController.create({
-      content: Em.Object.create({
-        label: 'label'
-      })
-    });
+    controller = getController();
   });
 
+  App.TestAliases.testAsComputedMapBy(getController(), 'groupsList', 'content.groups', 'displayName');
+
   describe('#labelValidation()', function () {
 
     it('should set editing.label.isError to true', function () {

+ 8 - 1
ambari-web/test/controllers/main/alerts/manage_alert_groups_controller_test.js

@@ -19,12 +19,19 @@
 var App = require('app');
 
 var manageAlertGroupsController;
+
+function getController() {
+  return App.ManageAlertGroupsController.create({});
+}
+
 describe('App.ManageAlertGroupsController', function () {
 
   beforeEach(function () {
-    manageAlertGroupsController = App.ManageAlertGroupsController.create({});
+    manageAlertGroupsController = getController();
   });
 
+  App.TestAliases.testAsComputedFilterBy(getController(), 'alertGlobalNotifications', 'alertNotifications', 'global', true);
+
   describe('#addAlertGroup', function () {
 
     beforeEach(function () {

+ 8 - 0
ambari-web/test/controllers/main/charts/heatmap_test.js

@@ -21,8 +21,16 @@ var App = require('app');
 require('models/rack');
 require('controllers/main/charts/heatmap');
 
+function getController() {
+  return App.MainChartsHeatmapController.create();
+}
+
 describe('MainChartsHeatmapController', function () {
 
+  App.TestAliases.testAsComputedAlias(getController(), 'activeWidget', 'widgets.firstObject', 'object');
+
+  App.TestAliases.testAsComputedAlias(getController(), 'hostToSlotMap', 'selectedMetric.hostToSlotMap', 'object');
+
   describe('#validation()', function () {
     var controller = App.MainChartsHeatmapController.create({
       allMetrics: [],

+ 15 - 10
ambari-web/test/controllers/main/host/details_test.js

@@ -26,24 +26,30 @@ var batchUtils = require('utils/batch_scheduled_requests');
 var hostsManagement = require('utils/hosts');
 var controller;
 
-describe('App.MainHostDetailsController', function () {
+function getController() {
+  return App.MainHostDetailsController.create(App.InstallComponent, {
+    content: Em.Object.create({
+      hostComponents: []
+    })
+  });
+}
 
+describe('App.MainHostDetailsController', function () {
 
   beforeEach(function () {
     sinon.stub(App.ajax, 'send').returns({
       then: Em.K,
       complete: Em.K
     });
-    controller = App.MainHostDetailsController.create(App.InstallComponent, {
-      content: Em.Object.create({
-        hostComponents: []
-      })
-    });
+    controller = getController();
   });
+
   afterEach(function () {
     App.ajax.send.restore();
   });
 
+  App.TestAliases.testAsComputedFilterBy(getController(), 'serviceNonClientActiveComponents', 'serviceActiveComponents', 'isClient', false);
+
   describe('#routeHome()', function () {
     it('transiotion to dashboard', function () {
       sinon.stub(App.router, 'transitionTo', Em.K);
@@ -74,7 +80,7 @@ describe('App.MainHostDetailsController', function () {
     });
   });
 
-describe('#stopComponent()', function () {
+  describe('#stopComponent()', function () {
 
     beforeEach(function () {
       sinon.stub(App, 'showConfirmationPopup', function (callback) {
@@ -295,7 +301,6 @@ describe('#stopComponent()', function () {
     });
   });
 
-
   describe('#serviceActiveComponents', function () {
 
     it('No host-components', function () {
@@ -2105,7 +2110,6 @@ describe('#stopComponent()', function () {
     });
   });
 
-
   describe('#setRackId', function () {
     beforeEach(function () {
       sinon.stub(hostsManagement, 'setRackInfo', Em.K);
@@ -2312,6 +2316,7 @@ describe('#stopComponent()', function () {
       }))).to.equal(0);
     });
   });
+
   describe('#downloadClientConfigsCall', function () {
 
     beforeEach(function () {
@@ -2929,7 +2934,6 @@ describe('#stopComponent()', function () {
     });
   });
 
-
   describe("#installVersion()", function () {
     it("call App.ajax.send", function () {
       controller.set('content.hostName', 'host1');
@@ -3398,4 +3402,5 @@ describe('#stopComponent()', function () {
       expect(controller.checkComponentDependencies('C1', opt)).to.eql(['C3']);
     });
   });
+
 });

+ 8 - 1
ambari-web/test/controllers/main/host/host_alerts_controller_test.js

@@ -22,12 +22,18 @@ require('controllers/main/host/host_alerts_controller');
 
 var controller;
 
+function getController() {
+  return App.MainHostAlertsController.create();
+}
+
 describe('App.MainHostAlertsController', function () {
 
   beforeEach(function() {
-    controller = App.MainHostAlertsController.create();
+    controller = getController();
   });
 
+  App.TestAliases.testAsComputedAlias(getController(), 'selectedHost', 'App.router.mainHostDetailsController.content', 'object');
+
   describe("#routeToAlertDefinition()", function () {
 
     beforeEach(function () {
@@ -45,4 +51,5 @@ describe('App.MainHostAlertsController', function () {
       expect(App.router.transitionTo.calledWith('main.alerts.alertDetails', 'alertDefinition')).to.be.true;
     });
   });
+
 });

+ 16 - 9
ambari-web/test/controllers/main/service/info/config_test.js

@@ -20,21 +20,28 @@ var App = require('app');
 require('controllers/main/service/info/configs');
 var batchUtils = require('utils/batch_scheduled_requests');
 var mainServiceInfoConfigsController = null;
+
+function getController() {
+  return App.MainServiceInfoConfigsController.create({
+    dependentServiceNames: [],
+    loadDependentConfigs: function () {
+      return {done: Em.K}
+    },
+    loadConfigTheme: function () {
+      return $.Deferred().resolve().promise();
+    }
+  });
+}
+
 describe("App.MainServiceInfoConfigsController", function () {
 
   beforeEach(function () {
     sinon.stub(App.themesMapper, 'generateAdvancedTabs').returns(Em.K);
-    mainServiceInfoConfigsController = App.MainServiceInfoConfigsController.create({
-      dependentServiceNames: [],
-      loadDependentConfigs: function () {
-        return {done: Em.K}
-      },
-      loadConfigTheme: function () {
-        return $.Deferred().resolve().promise();
-      }
-    });
+    mainServiceInfoConfigsController = getController();
   });
 
+  App.TestAliases.testAsComputedAlias(getController(), 'serviceConfigs', 'App.config.preDefinedServiceConfigs', 'array');
+
   afterEach(function() {
     App.themesMapper.generateAdvancedTabs.restore();
   });

+ 0 - 2
ambari-web/test/controllers/main/service/item_test.js

@@ -318,7 +318,6 @@ describe('App.MainServiceItemController', function () {
     });
   });
 
-
   describe("#turnOnOffPassive", function () {
     var mainServiceItemController = App.MainServiceItemController.create({turnOnOffPassiveRequest: Em.K});
     beforeEach(function () {
@@ -1058,7 +1057,6 @@ describe('App.MainServiceItemController', function () {
     });
   });
 
-
   describe('#downloadClientConfigs()', function () {
 
     var mainServiceItemController = App.MainServiceItemController.create({

+ 1 - 12
ambari-web/test/controllers/main/service/widgets/create/step2_controller_test.js

@@ -26,18 +26,7 @@ describe('App.WidgetWizardStep2Controller', function () {
     content: Em.Object.create()
   });
 
-  describe("#isEditWidget", function () {
-    it("empty name", function () {
-      controller.set('content.controllerName', '');
-      controller.propertyDidChange('isEditWidget');
-      expect(controller.get('isEditWidget')).to.be.false;
-    });
-    it("correct name", function () {
-      controller.set('content.controllerName', 'widgetEditController');
-      controller.propertyDidChange('isEditWidget');
-      expect(controller.get('isEditWidget')).to.be.true;
-    });
-  });
+  App.TestAliases.testAsComputedEqual(controller, 'isEditWidget', 'content.controllerName', 'widgetEditController');
 
   describe("#filteredMetrics", function () {
     var testCases = [

+ 6 - 24
ambari-web/test/controllers/main/service/widgets/create/step3_controller_test.js

@@ -26,31 +26,13 @@ describe('App.WidgetWizardStep3Controller', function () {
     content: Em.Object.create()
   });
 
-  describe("#isEditController", function () {
-    it("empty name", function () {
-      controller.set('content.controllerName', '');
-      controller.propertyDidChange('isEditController');
-      expect(controller.get('isEditController')).to.be.false;
-    });
-    it("widgetEditController name", function () {
-      controller.set('content.controllerName', 'widgetEditController');
-      controller.propertyDidChange('isEditController');
-      expect(controller.get('isEditController')).to.be.true;
-    });
-  });
+  App.TestAliases.testAsComputedEqual(controller, 'isEditController', 'content.controllerName', 'widgetEditController');
 
-  describe("#widgetScope", function () {
-    it("isSharedChecked - false", function () {
-      controller.set('isSharedChecked', false);
-      controller.propertyDidChange('widgetScope');
-      expect(controller.get('widgetScope')).to.equal('User');
-    });
-    it("isSharedChecked - true", function () {
-      controller.set('isSharedChecked', true);
-      controller.propertyDidChange('widgetScope');
-      expect(controller.get('widgetScope')).to.equal('Cluster');
-    });
-  });
+  App.TestAliases.testAsComputedIfThenElse(controller, 'widgetScope', 'isSharedChecked', 'Cluster', 'User');
+
+  App.TestAliases.testAsComputedGte(controller, 'isNameInvalid', 'widgetName.length', 129);
+
+  App.TestAliases.testAsComputedGte(controller, 'isDescriptionInvalid', 'widgetDescription.length', 2049);
 
   describe("#isSubmitDisabled", function () {
     it("widgetName - null", function () {

+ 8 - 39
ambari-web/test/controllers/main/service_test.js

@@ -21,6 +21,10 @@ require('controllers/main/service');
 
 var mainServiceController;
 
+function getController() {
+  return App.MainServiceController.create({});
+}
+
 describe('App.MainServiceController', function () {
 
   var tests = Em.A([
@@ -74,11 +78,12 @@ describe('App.MainServiceController', function () {
     }
 
   ]);
-
   beforeEach(function() {
-    mainServiceController = App.MainServiceController.create();
+    mainServiceController = getController();
   });
 
+  App.TestAliases.testAsComputedNotEqual(getController(), 'isStartStopAllClicked', 'App.router.backgroundOperationsController.allOperationsCount', 0);
+
   describe('#isStartAllDisabled', function () {
     tests.forEach(function (test) {
       it(test.mStart, function () {
@@ -103,22 +108,6 @@ describe('App.MainServiceController', function () {
     });
   });
 
-  describe('#isStartStopAllClicked', function () {
-
-    beforeEach(function () {
-      sinon.stub(App, 'get').withArgs('router.backgroundOperationsController.allOperationsCount').returns(1);
-    });
-
-    afterEach(function () {
-      App.get.restore();
-    });
-
-    it('should be based on BG ops count', function () {
-      expect(mainServiceController.get('isStartStopAllClicked')).to.be.true;
-    });
-
-  });
-
   describe('#cluster', function() {
 
     var tests = Em.A([
@@ -326,27 +315,7 @@ describe('App.MainServiceController', function () {
 
   });
 
-  describe('#isRestartAllRequiredDisabled', function () {
-
-    it('should be false if there is at least one service with isRestartRequired=true', function () {
-      mainServiceController.reopen({
-        content: [
-          {isRestartRequired: false}, {isRestartRequired: false}, {isRestartRequired: true}
-        ]
-      });
-      expect(mainServiceController.get('isRestartAllRequiredDisabled')).to.be.false;
-    });
-
-    it('should be true if there is no services with isRestartRequired=true', function () {
-      mainServiceController.reopen({
-        content: [
-          {isRestartRequired: false}, {isRestartRequired: false}, {isRestartRequired: false}
-        ]
-      });
-      expect(mainServiceController.get('isRestartAllRequiredDisabled')).to.be.true;
-    });
-
-  });
+  App.TestAliases.testAsComputedEveryBy(getController(), 'isRestartAllRequiredDisabled', 'content', 'isRestartRequired', false);
 
   describe('#restartAllRequired', function () {
 

+ 2 - 22
ambari-web/test/controllers/main_test.js

@@ -56,29 +56,9 @@ describe('App.MainController', function () {
     });
   });
 
-  describe('#isClusterDataLoaded', function() {
-    beforeEach(function () {
-      sinon.stub(App.router, 'get').returns(true);
-    });
-    afterEach(function () {
-      App.router.get.restore();
-    });
-    it ('Should return true', function() {
-      expect(mainController.get('isClusterDataLoaded')).to.be.true;
-    });
-  });
+  App.TestAliases.testAsComputedAlias(mainController, 'isClusterDataLoaded', 'App.router.clusterController.isLoaded', 'boolean');
 
-  describe('#clusterDataLoadedPercent', function() {
-    beforeEach(function () {
-      sinon.stub(App, 'get').withArgs('router.clusterController.clusterDataLoadedPercent').returns(16);
-    });
-    afterEach(function () {
-      App.get.restore();
-    });
-    it ('Should return 16', function() {
-      expect(mainController.get('clusterDataLoadedPercent')).to.be.equal(16);
-    });
-  });
+  App.TestAliases.testAsComputedAlias(mainController, 'clusterDataLoadedPercent', 'App.router.clusterController.clusterDataLoadedPercent', 'string');
 
   describe('#initialize', function() {
     var initialize = false;

+ 9 - 2
ambari-web/test/controllers/wizard/step10_test.js

@@ -23,17 +23,24 @@ require('controllers/wizard/step10_controller');
 
 var controller;
 
+function getController() {
+  return App.WizardStep10Controller.create({
+    content: {cluster: {controllerName: '', status: 'INSTALL COMPLETE'}}
+  });
+}
+
 describe('App.WizardStep10Controller', function () {
 
   beforeEach(function() {
-    controller = App.WizardStep10Controller.create();
-    controller.set('content', {cluster: {status: 'INSTALL COMPLETE'}});
+    controller = getController();
   });
 
   afterEach(function() {
     controller.clearStep();
   });
 
+  App.TestAliases.testAsComputedEqual(getController(), 'isAddServiceWizard', 'content.controllerName', 'addServiceController');
+
   describe('#clearStep', function() {
     it('should clear clusterInfo', function() {
       controller.get('clusterInfo').pushObject({});

+ 17 - 65
ambari-web/test/controllers/wizard/step2_test.js

@@ -23,6 +23,11 @@ require('models/host');
 require('models/host_component');
 require('messages');
 var c;
+
+function getController() {
+  return App.WizardStep2Controller.create({content: {controllerName: ''}});
+}
+
 describe('App.WizardStep2Controller', function () {
 
   var userErrorTests = Em.A([
@@ -54,28 +59,20 @@ describe('App.WizardStep2Controller', function () {
 
 
   beforeEach(function() {
-    c = App.WizardStep2Controller.create();
+    c = getController();
   });
 
-  describe('#isInstaller', function() {
-    it('true if controllerName is installerController', function() {
-      var controller = App.WizardStep2Controller.create({content: {controllerName: 'installerController'}});
-      expect(controller.get('isInstaller')).to.equal(true);
-    });
-    it('false if controllerName isn\'t installerController', function() {
-      var controller = App.WizardStep2Controller.create({content: {controllerName: 'addServiceController'}});
-      expect(controller.get('isInstaller')).to.equal(false);
-    });
-  });
+  App.TestAliases.testAsComputedEqual(getController(), 'isInstaller', 'content.controllerName', 'installerController');
 
-  describe('#manualInstall', function() {
-    it('should be equal to content.installOptions.manualInstall', function() {
-      var controller = App.WizardStep2Controller.create({content: {installOptions: {manualInstall: true}}});
-      expect(controller.get('manualInstall')).to.equal(true);
-      controller.toggleProperty('content.installOptions.manualInstall');
-      expect(controller.get('manualInstall')).to.equal(false);
-    });
-  });
+  App.TestAliases.testAsComputedAlias(getController(), 'manualInstall', 'content.installOptions.manualInstall', 'boolean');
+
+  App.TestAliases.testAsComputedAlias(getController(), 'sshKey', 'content.installOptions.sshKey', 'string');
+
+  App.TestAliases.testAsComputedAlias(getController(), 'sshUser', 'content.installOptions.sshUser', 'string');
+
+  App.TestAliases.testAsComputedAlias(getController(), 'sshPort', 'content.installOptions.sshPort', 'string');
+
+  App.TestAliases.testAsComputedAlias(getController(), 'agentUser', 'content.installOptions.agentUser', 'string');
 
   describe('#hostNames', function() {
     it('should be equal to content.installOptions.hostNames', function() {
@@ -86,52 +83,7 @@ describe('App.WizardStep2Controller', function () {
     });
   });
 
-  describe('#sshKey', function() {
-    it('should be equal to content.installOptions.sshKey', function() {
-      var controller = App.WizardStep2Controller.create({content: {installOptions: {sshKey: '123'}}});
-      expect(controller.get('sshKey')).to.equal('123');
-      controller.set('content.installOptions.sshKey', '321');
-      expect(controller.get('sshKey')).to.equal('321');
-    });
-  });
-
-  describe('#sshUser', function() {
-    it('should be equal to content.installOptions.sshUser', function() {
-      var controller = App.WizardStep2Controller.create({content: {installOptions: {sshUser: '123'}}});
-      expect(controller.get('sshUser')).to.equal('123');
-      controller.set('content.installOptions.sshUser', '321');
-      expect(controller.get('sshUser')).to.equal('321');
-    });
-  });
-
-  describe('#sshPort', function() {
-      it('should be equal to content.installOptions.sshPort', function() {
-          var controller = App.WizardStep2Controller.create({content: {installOptions: {sshPort: '123'}}});
-          expect(controller.get('sshPort')).to.equal('123');
-          controller.set('content.installOptions.sshPort', '321');
-          expect(controller.get('sshPort')).to.equal('321');
-      });
-  });
-
-  describe('#agentUser', function() {
-    it('should be equal to content.installOptions.agentUser', function() {
-      var controller = App.WizardStep2Controller.create({content: {installOptions: {agentUser: '123'}}});
-      expect(controller.get('agentUser')).to.equal('123');
-      controller.set('content.installOptions.agentUser', '321');
-      expect(controller.get('agentUser')).to.equal('321');
-    });
-  });
-
-  describe('#installType', function() {
-    it('should be manualDriven if manualInstall is selected', function() {
-      var controller = App.WizardStep2Controller.create({content: {installOptions: {manualInstall: true}}});
-      expect(controller.get('installType')).to.equal('manualDriven');
-    });
-    it('should be ambariDriven if manualInstall isn\'t selected', function() {
-      var controller = App.WizardStep2Controller.create({content: {installOptions: {manualInstall: false}}});
-      expect(controller.get('installType')).to.equal('ambariDriven');
-    });
-  });
+  App.TestAliases.testAsComputedIfThenElse(getController(), 'installType', 'manualInstall', 'manualDriven', 'ambariDriven');
 
   describe('#updateHostNameArr()', function () {
 

+ 16 - 47
ambari-web/test/controllers/wizard/step3_test.js

@@ -25,16 +25,20 @@ require('utils/http_client');
 require('models/host');
 require('controllers/wizard/step3_controller');
 
+function getController() {
+  return App.WizardStep3Controller.create({
+    content: Em.Object.create({installedHosts: Em.A([]), installOptions: {}, controllerName: ''}),
+    wizardController: App.InstallerController.create(),
+    setRegistrationInProgressOnce: Em.K,
+    disablePreviousSteps: Em.K
+  });
+}
+
 describe('App.WizardStep3Controller', function () {
 
   beforeEach(function () {
 
-    c = App.WizardStep3Controller.create({
-      content: Em.Object.create({installedHosts: Em.A([]), installOptions: {}}),
-      wizardController: App.InstallerController.create(),
-      setRegistrationInProgressOnce: Em.K,
-      disablePreviousSteps: Em.K
-    });
+    c = getController();
 
     sinon.stub(App.db, 'getDisplayLength', Em.K);
     sinon.stub(App.db, 'getFilterConditions').returns([]);
@@ -47,6 +51,12 @@ describe('App.WizardStep3Controller', function () {
     App.db.getFilterConditions.restore();
   });
 
+  App.TestAliases.testAsComputedGt(getController(), 'isHostHaveWarnings', 'warnings.length', 0);
+
+  App.TestAliases.testAsComputedEqual(getController(), 'isAddHostWizard', 'content.controllerName', 'addHostController');
+
+  App.TestAliases.testAsComputedIfThenElse(getController(), 'registrationTimeoutSecs', 'content.installOptions.manualInstall', 15, 120);
+
   describe('#getAllRegisteredHostsCallback', function () {
 
     it('One host is already in the cluster, one host is registered', function () {
@@ -137,47 +147,6 @@ describe('App.WizardStep3Controller', function () {
 
   });
 
-  describe('#registrationTimeoutSecs', function () {
-
-    it('Manual install', function () {
-      c.set('content.installOptions.manualInstall', true);
-      expect(c.get('registrationTimeoutSecs')).to.equal(15);
-    });
-
-    it('Not manual install', function () {
-      c.set('content.installOptions.manualInstall', false);
-      expect(c.get('registrationTimeoutSecs')).to.equal(120);
-    });
-
-  });
-
-  describe('#isHostHaveWarnings', function () {
-
-    var tests = [
-      {
-        warnings: [
-          {},
-          {}
-        ],
-        m: 'Warnings exist',
-        e: true
-      },
-      {
-        warnings: [],
-        m: 'Warnings don\'t exist',
-        e: false
-      }
-    ];
-
-    tests.forEach(function (test) {
-      it(test.m, function () {
-        c.set('warnings', test.warnings);
-        expect(c.get('isHostHaveWarnings')).to.equal(test.e);
-      });
-    });
-
-  });
-
   describe('#isWarningsBoxVisible', function () {
 
     afterEach(function () {

+ 28 - 48
ambari-web/test/controllers/wizard/step6_test.js

@@ -44,44 +44,42 @@ var controller,
       isSelected: true
     })
   ];
-describe('App.WizardStep6Controller', function () {
 
-  beforeEach(function () {
-    controller = App.WizardStep6Controller.create();
-    controller.set('content', Em.Object.create({
+function getController() {
+  var controller = App.WizardStep6Controller.create({
+    content: Em.Object.create({
       hosts: {},
       masterComponentHosts: {},
-      services: services
-    }));
+      services: services,
+      controllerName: ''
+    })
+  });
 
-    var h = {}, m = [];
-    Em.A(['host0', 'host1', 'host2', 'host3']).forEach(function (hostName) {
-      var obj = Em.Object.create({
-        name: hostName,
-        hostName: hostName,
-        bootStatus: 'REGISTERED'
-      });
-      h[hostName] = obj;
-      m.push(obj);
+  var h = {}, m = [];
+  Em.A(['host0', 'host1', 'host2', 'host3']).forEach(function (hostName) {
+    var obj = Em.Object.create({
+      name: hostName,
+      hostName: hostName,
+      bootStatus: 'REGISTERED'
     });
+    h[hostName] = obj;
+    m.push(obj);
+  });
 
-    controller.set('content.hosts', h);
-    controller.set('content.masterComponentHosts', m);
-    controller.set('isMasters', false);
+  controller.set('content.hosts', h);
+  controller.set('content.masterComponentHosts', m);
+  controller.set('isMasters', false);
+  return controller;
+}
 
-  });
+describe('App.WizardStep6Controller', function () {
 
-  describe('#isAddHostWizard', function () {
-    it('true if content.controllerName is addHostController', function () {
-      controller.set('content.controllerName', 'addHostController');
-      expect(controller.get('isAddHostWizard')).to.equal(true);
-    });
-    it('false if content.controllerName is not addHostController', function () {
-      controller.set('content.controllerName', 'mainController');
-      expect(controller.get('isAddHostWizard')).to.equal(false);
-    });
+  beforeEach(function () {
+    controller = getController();
   });
 
+  App.TestAliases.testAsComputedEqual(getController(), 'isAddHostWizard', 'content.controllerName', 'addHostController');
+
   describe('#installedServiceNames', function () {
     it(' should filter content.services by isInstalled property', function () {
       var services = Em.A([]);
@@ -348,27 +346,9 @@ describe('App.WizardStep6Controller', function () {
     });
   });
 
-  describe('#isInstallerWizard', function () {
-    it('true if content.controllerName is addHostController', function () {
-      controller.set('content.controllerName', 'installerController');
-      expect(controller.get('isInstallerWizard')).to.equal(true);
-    });
-    it('false if content.controllerName is not addHostController', function () {
-      controller.set('content.controllerName', 'mainController');
-      expect(controller.get('isInstallerWizard')).to.equal(false);
-    });
-  });
+  App.TestAliases.testAsComputedEqual(getController(), 'isInstallerWizard', 'content.controllerName', 'installerController');
 
-  describe('#isAddServiceWizard', function () {
-    it('true if content.controllerName is addServiceController', function () {
-      controller.set('content.controllerName', 'addServiceController');
-      expect(controller.get('isAddServiceWizard')).to.equal(true);
-    });
-    it('false if content.controllerName is not addServiceController', function () {
-      controller.set('content.controllerName', 'mainController');
-      expect(controller.get('isAddServiceWizard')).to.equal(false);
-    });
-  });
+  App.TestAliases.testAsComputedEqual(getController(), 'isAddServiceWizard', 'content.controllerName', 'addServiceController');
 
   describe('#selectClientHost', function () {
     it('true if isClientsSet false', function () {

+ 15 - 31
ambari-web/test/controllers/wizard/step7_test.js

@@ -96,23 +96,31 @@ var installerStep7Controller,
     controller.get('filterColumns').findProperty('attributeName', 'hasIssues').set('selected', testCase.isIssuesFilterActive);
   };
 
+function getController() {
+  return App.WizardStep7Controller.create({
+    content: Em.Object.create({
+      services: [],
+      advancedServiceConfig: [],
+      serviceConfigProperties: []
+    })
+  });
+}
+
 describe('App.InstallerStep7Controller', function () {
 
   beforeEach(function () {
     sinon.stub(App.config, 'setPreDefinedServiceConfigs', Em.K);
-    installerStep7Controller = App.WizardStep7Controller.create({
-      content: Em.Object.create({
-        services: [],
-        advancedServiceConfig: [],
-        serviceConfigProperties: []
-      })
-    });
+    installerStep7Controller = getController();
   });
 
   afterEach(function() {
     App.config.setPreDefinedServiceConfigs.restore();
   });
 
+  App.TestAliases.testAsComputedAlias(getController(), 'masterComponentHosts', 'content.masterComponentHosts', 'array');
+
+  App.TestAliases.testAsComputedAlias(getController(), 'slaveComponentHosts', 'content.slaveGroupProperties', 'array');
+
   describe('#installedServiceNames', function () {
 
     var tests = Em.A([
@@ -248,30 +256,6 @@ describe('App.InstallerStep7Controller', function () {
     });
   });
 
-  describe('#masterComponentHosts', function () {
-    it('should be equal to content.masterComponentHosts', function () {
-      var masterComponentHosts = [
-        {},
-        {},
-        {}
-      ];
-      installerStep7Controller.reopen({content: {masterComponentHosts: masterComponentHosts}});
-      expect(installerStep7Controller.get('masterComponentHosts')).to.eql(masterComponentHosts);
-    });
-  });
-
-  describe('#slaveComponentHosts', function () {
-    it('should be equal to content.slaveGroupProperties', function () {
-      var slaveGroupProperties = [
-        {},
-        {},
-        {}
-      ];
-      installerStep7Controller.reopen({content: {slaveGroupProperties: slaveGroupProperties}});
-      expect(installerStep7Controller.get('slaveComponentHosts')).to.eql(slaveGroupProperties);
-    });
-  });
-
   describe('#_createSiteToTagMap', function () {
     it('should return filtered map', function () {
       var desired_configs = {

+ 45 - 51
ambari-web/test/controllers/wizard/step8_test.js

@@ -23,42 +23,47 @@ require('controllers/main/service/info/configs');
 require('controllers/wizard/step8_controller');
 var installerStep8Controller, configurationController;
 
-describe('App.WizardStep8Controller', function () {
+var configs = Em.A([
+  Em.Object.create({filename: 'hdfs-site.xml', name: 'p1', value: 'v1'}),
+  Em.Object.create({filename: 'hdfs-site.xml', name: 'p2', value: 'v2'}),
+  Em.Object.create({filename: 'hue-site.xml', name: 'p1', value: 'v1'}),
+  Em.Object.create({filename: 'hue-site.xml', name: 'p2', value: 'v2'}),
+  Em.Object.create({filename: 'mapred-site.xml', name: 'p1', value: 'v1'}),
+  Em.Object.create({filename: 'mapred-site.xml', name: 'p2', value: 'v2'}),
+  Em.Object.create({filename: 'yarn-site.xml', name: 'p1', value: 'v1'}),
+  Em.Object.create({filename: 'yarn-site.xml', name: 'p2', value: 'v2'}),
+  Em.Object.create({filename: 'capacity-scheduler.xml', name: 'p1', value: 'v1'}),
+  Em.Object.create({filename: 'capacity-scheduler.xml', name: 'p2', value: 'v2'}),
+  Em.Object.create({filename: 'mapred-queue-acls.xml', name: 'p1', value: 'v1'}),
+  Em.Object.create({filename: 'mapred-queue-acls.xml', name: 'p2', value: 'v2'}),
+  Em.Object.create({filename: 'hbase-site.xml', name: 'p1', value: 'v1'}),
+  Em.Object.create({filename: 'hbase-site.xml', name: 'p2', value: 'v2'}),
+  Em.Object.create({filename: 'oozie-site.xml', name: 'p1', value: 'v1'}),
+  Em.Object.create({filename: 'oozie-site.xml', name: 'p2', value: 'v2'}),
+  Em.Object.create({filename: 'hive-site.xml', name: 'p1', value: 'v1'}),
+  Em.Object.create({filename: 'hive-site.xml', name: 'p2', value: 'v2'}),
+  Em.Object.create({filename: 'pig-properties.xml', name: 'p1', value: 'v1'}),
+  Em.Object.create({filename: 'webhcat-site.xml', name: 'p1', value: 'v1'}),
+  Em.Object.create({filename: 'webhcat-site.xml', name: 'p2', value: 'v2'}),
+  Em.Object.create({filename: 'tez-site.xml', name: 'p1', value: 'v1'}),
+  Em.Object.create({filename: 'tez-site.xml', name: 'p2', value: 'v2'}),
+  Em.Object.create({filename: 'falcon-startup.properties.xml', name: 'p1', value: 'v1'}),
+  Em.Object.create({filename: 'falcon-startup.properties.xml', name: 'p2', value: 'v2'}),
+  Em.Object.create({filename: 'falcon-runtime.properties.xml', name: 'p1', value: 'v1'}),
+  Em.Object.create({filename: 'falcon-runtime.properties.xml', name: 'p2', value: 'v2'})
+]);
+
+function getController() {
+  return App.WizardStep8Controller.create({
+    configs: configs,
+    content: {controllerName: ''}
+  });
+}
 
-  var configs = Em.A([
-    Em.Object.create({filename: 'hdfs-site.xml', name: 'p1', value: 'v1'}),
-    Em.Object.create({filename: 'hdfs-site.xml', name: 'p2', value: 'v2'}),
-    Em.Object.create({filename: 'hue-site.xml', name: 'p1', value: 'v1'}),
-    Em.Object.create({filename: 'hue-site.xml', name: 'p2', value: 'v2'}),
-    Em.Object.create({filename: 'mapred-site.xml', name: 'p1', value: 'v1'}),
-    Em.Object.create({filename: 'mapred-site.xml', name: 'p2', value: 'v2'}),
-    Em.Object.create({filename: 'yarn-site.xml', name: 'p1', value: 'v1'}),
-    Em.Object.create({filename: 'yarn-site.xml', name: 'p2', value: 'v2'}),
-    Em.Object.create({filename: 'capacity-scheduler.xml', name: 'p1', value: 'v1'}),
-    Em.Object.create({filename: 'capacity-scheduler.xml', name: 'p2', value: 'v2'}),
-    Em.Object.create({filename: 'mapred-queue-acls.xml', name: 'p1', value: 'v1'}),
-    Em.Object.create({filename: 'mapred-queue-acls.xml', name: 'p2', value: 'v2'}),
-    Em.Object.create({filename: 'hbase-site.xml', name: 'p1', value: 'v1'}),
-    Em.Object.create({filename: 'hbase-site.xml', name: 'p2', value: 'v2'}),
-    Em.Object.create({filename: 'oozie-site.xml', name: 'p1', value: 'v1'}),
-    Em.Object.create({filename: 'oozie-site.xml', name: 'p2', value: 'v2'}),
-    Em.Object.create({filename: 'hive-site.xml', name: 'p1', value: 'v1'}),
-    Em.Object.create({filename: 'hive-site.xml', name: 'p2', value: 'v2'}),
-    Em.Object.create({filename: 'pig-properties.xml', name: 'p1', value: 'v1'}),
-    Em.Object.create({filename: 'webhcat-site.xml', name: 'p1', value: 'v1'}),
-    Em.Object.create({filename: 'webhcat-site.xml', name: 'p2', value: 'v2'}),
-    Em.Object.create({filename: 'tez-site.xml', name: 'p1', value: 'v1'}),
-    Em.Object.create({filename: 'tez-site.xml', name: 'p2', value: 'v2'}),
-    Em.Object.create({filename: 'falcon-startup.properties.xml', name: 'p1', value: 'v1'}),
-    Em.Object.create({filename: 'falcon-startup.properties.xml', name: 'p2', value: 'v2'}),
-    Em.Object.create({filename: 'falcon-runtime.properties.xml', name: 'p1', value: 'v1'}),
-    Em.Object.create({filename: 'falcon-runtime.properties.xml', name: 'p2', value: 'v2'})
-  ]);
+describe('App.WizardStep8Controller', function () {
 
   beforeEach(function () {
-    installerStep8Controller = App.WizardStep8Controller.create({
-      configs: configs
-    });
+    installerStep8Controller = getController();
     configurationController = App.MainServiceInfoConfigsController.create({});
   });
 
@@ -92,6 +97,12 @@ describe('App.WizardStep8Controller', function () {
     });
   });
 
+  App.TestAliases.testAsComputedFilterBy(getController(), 'installedServices', 'content.services', 'isInstalled', true);
+
+  App.TestAliases.testAsComputedEqual(getController(), 'isManualKerberos', 'App.router.mainAdminKerberosController.kdc_type', 'none');
+
+  App.TestAliases.testAsComputedAlias(getController(), 'clusterName', 'content.cluster.name', 'string');
+
   describe('#createSelectedServicesData', function () {
 
     var tests = Em.A([
@@ -228,13 +239,6 @@ describe('App.WizardStep8Controller', function () {
 
   });
 
-  describe('#clusterName', function () {
-    it('should be equal to content.cluster.name', function () {
-      installerStep8Controller.set('content', {cluster: {name: 'new_name'}});
-      expect(installerStep8Controller.get('clusterName')).to.equal('new_name');
-    });
-  });
-
   describe('#createCoreSiteObj', function () {
     it('should return config', function () {
       var content = Em.Object.create({
@@ -1887,17 +1891,7 @@ describe('App.WizardStep8Controller', function () {
 
   });
 
-  describe('#isAllClusterDeleteRequestsCompleted', function () {
-    it('should depend on completed cluster delete requests number', function () {
-      installerStep8Controller.setProperties({
-        clusterDeleteRequestsCompleted: 0,
-        clusterNames: ['c0']
-      });
-      expect(installerStep8Controller.get('isAllClusterDeleteRequestsCompleted')).to.be.false;
-      installerStep8Controller.incrementProperty('clusterDeleteRequestsCompleted');
-      expect(installerStep8Controller.get('isAllClusterDeleteRequestsCompleted')).to.be.true;
-    });
-  });
+  App.TestAliases.testAsComputedEqualProperties(getController(), 'isAllClusterDeleteRequestsCompleted', 'clusterDeleteRequestsCompleted', 'clusterNames.length');
 
   describe('#deleteClusterSuccessCallback', function () {
 

+ 23 - 27
ambari-web/test/controllers/wizard/step9_test.js

@@ -29,27 +29,32 @@ require('utils/ajax/ajax');
 
 var modelSetup = require('test/init_model_test');
 var c, obj;
+
+function getController() {
+  return App.WizardStep9Controller.create({
+    content: {controllerName: '', cluster: {status: ''}},
+    saveClusterStatus: Em.K,
+    saveInstalledHosts: Em.K,
+    togglePreviousSteps: Em.K,
+    setFinishState: Em.K,
+    changeParseHostInfo: Em.K,
+    parseHostInfoPolling: Em.K,
+    wizardController: Em.Object.create({
+      requestsId: [],
+      cluster: {oldRequestsId: []},
+      getDBProperty: function(name) {
+        return this.get(name);
+      }
+    })
+  });
+}
+
 describe('App.InstallerStep9Controller', function () {
 
   beforeEach(function () {
     App.set('supports.skipComponentStartAfterInstall', false);
     modelSetup.setupStackServiceComponent();
-    c = App.WizardStep9Controller.create({
-      content: {controllerName: ''},
-      saveClusterStatus: Em.K,
-      saveInstalledHosts: Em.K,
-      togglePreviousSteps: Em.K,
-      setFinishState: Em.K,
-      changeParseHostInfo: Em.K,
-      parseHostInfoPolling: Em.K,
-      wizardController: Em.Object.create({
-        requestsId: [],
-        cluster: {oldRequestsId: []},
-        getDBProperty: function(name) {
-          return this.get(name);
-        }
-      })
-    });
+    c = getController();
     obj = App.InstallerController.create();
     sinon.stub(App.ajax, 'send', function() {
       return {
@@ -72,6 +77,8 @@ describe('App.InstallerStep9Controller', function () {
     App.ajax.send.restore();
   });
 
+  App.TestAliases.testAsComputedEqual(getController(), 'showRetry', 'content.cluster.status', 'INSTALL FAILED');
+
   describe('#isSubmitDisabled', function () {
     var tests = Em.A([
       {controllerName: 'addHostController', state: 'STARTED', e: false},
@@ -181,17 +188,6 @@ describe('App.InstallerStep9Controller', function () {
     });
   });
 
-  describe('#showRetry', function () {
-    it('cluster status is not INSTALL FAILED', function () {
-      c.reopen({content: {cluster: {status: 'INSTALLED'}}});
-      expect(c.get('showRetry')).to.equal(false);
-    });
-    it('cluster status is INSTALL FAILED', function () {
-      c.reopen({content: {cluster: {status: 'INSTALL FAILED'}}});
-      expect(c.get('showRetry')).to.equal(true);
-    });
-  });
-
   describe('#resetHostsForRetry', function () {
     it('All should have status "pending" and message "Waiting"', function () {
       var hosts = {'host1': Em.Object.create({status: 'failed', message: 'Failed'}), 'host2': Em.Object.create({status: 'success', message: 'Success'})};

+ 4 - 0
ambari-web/test/models/authentication_test.js

@@ -63,6 +63,10 @@ describe('App.AuthenticationForm', function () {
     });
   });
 
+  App.TestAliases.testAsComputedIfThenElse(App.AuthenticationForm.create(), 'testConfigurationMessage', 'testResult', Em.I18n.t('admin.authentication.form.test.success'), Em.I18n.t('admin.authentication.form.test.fail'));
+
+  App.TestAliases.testAsComputedIfThenElse(App.AuthenticationForm.create(), 'testConfigurationClass', 'testResult', 'text-success', 'text-error');
+
   describe('#testResult', function () {
     it('should be 0 or 1', function () {
       form.testConfiguration();

+ 1 - 12
ambari-web/test/models/cluster_states_test.js

@@ -45,18 +45,7 @@ var compressedResponse = LZString.compressToBase64(JSON.stringify(response2));
 
 describe('App.clusterStatus', function () {
 
-  describe('#isInstalled', function () {
-    notInstalledStates.forEach(function (item) {
-      it('should be false', function () {
-        status.set('clusterState', item);
-        expect(status.get('isInstalled')).to.be.false;
-      });
-    });
-    it('should be true', function () {
-      status.set('clusterState', 'DEFAULT');
-      expect(status.get('isInstalled')).to.be.true;
-    });
-  });
+  App.TestAliases.testAsComputedNotExistsIn(status, 'isInstalled', 'clusterState', notInstalledStates);
 
   describe('#value', function () {
     it('should be set from properties', function () {

+ 7 - 15
ambari-web/test/models/configs/objects/service_config_category_test.js

@@ -1,4 +1,3 @@
-
 /**
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -104,12 +103,18 @@ var serviceConfigCategory,
     ]
   };
 
+function getCategory() {
+  return App.ServiceConfigCategory.create();
+}
+
 describe('App.ServiceConfigCategory', function () {
 
   beforeEach(function () {
-    serviceConfigCategory = App.ServiceConfigCategory.create();
+    serviceConfigCategory = getCategory();
   });
 
+  App.TestAliases.testAsComputedSumProperties(getCategory(), 'errorCount', ['slaveErrorCount', 'nonSlaveErrorCount']);
+
   describe('#primaryName', function () {
     nameCases.forEach(function (item) {
       it('should return ' + item.primary, function () {
@@ -156,19 +161,6 @@ describe('App.ServiceConfigCategory', function () {
     });
   });
 
-  describe('#errorCount', function () {
-    it('should sum all errors for category', function () {
-      serviceConfigCategory.reopen({
-        slaveErrorCount: 1
-      });
-      expect(serviceConfigCategory.get('errorCount')).to.equal(1);
-      serviceConfigCategory.set('nonSlaveErrorCount', 2);
-      expect(serviceConfigCategory.get('errorCount')).to.equal(3);
-      serviceConfigCategory.set('slaveErrorCount', 0);
-      expect(serviceConfigCategory.get('errorCount')).to.equal(2);
-    });
-  });
-
   describe('#isAdvanced', function () {
     it('should be true', function () {
       serviceConfigCategory.set('name', 'Advanced');

+ 7 - 1
ambari-web/test/models/configs/objects/service_config_property_test.js

@@ -321,12 +321,18 @@ var serviceConfigProperty,
     }
   ];
 
+function getProperty() {
+  return App.ServiceConfigProperty.create();
+}
+
 describe('App.ServiceConfigProperty', function () {
 
   beforeEach(function () {
-    serviceConfigProperty = App.ServiceConfigProperty.create();
+    serviceConfigProperty = getProperty();
   });
 
+  App.TestAliases.testAsComputedFirstNotBlank(getProperty(), 'placeholder', ['placeholderText', 'savedValue']);
+
   describe('#overrideErrorTrigger', function () {
     it('should be an increment', function () {
       serviceConfigProperty.set('overrides', configsData[0].overrides);

+ 6 - 50
ambari-web/test/models/configs/section_test.js

@@ -19,10 +19,14 @@
 var App = require('app');
 var model;
 
+function getModel() {
+  return App.Section.createRecord();
+}
+
 describe('App.Section', function () {
 
   beforeEach(function () {
-    model = App.Section.createRecord();
+    model = getModel();
   });
 
   describe('#errorsCount', function () {
@@ -46,54 +50,6 @@ describe('App.Section', function () {
 
   });
 
-  describe('#isHiddenByFilter', function () {
-
-    Em.A([
-        {
-          subSections: [],
-          m: 'no subsections',
-          e: true
-        },
-        {
-          subSections: [
-            App.SubSection.createRecord({configs: [Em.Object.create({isHiddenByFilter: false, isVisible: true}), Em.Object.create({isHiddenByFilter: false, isVisible: true})]}),
-            App.SubSection.createRecord({configs: [Em.Object.create({isHiddenByFilter: false, isVisible: true}), Em.Object.create({isHiddenByFilter: false, isVisible: true})]})
-          ],
-          m: 'no subsections are hidden',
-          e: false
-        },
-        {
-          subSections: [
-            App.SubSection.createRecord({configs: [Em.Object.create({isHiddenByFilter: true, isVisible: false, hiddenBySection: false}), Em.Object.create({isHiddenByFilter: true, isVisible: true, hiddenBySection: true})]})
-          ],
-          m: 'no subsections are hidden (hiddenBySection)',
-          e: false
-        },
-        {
-          subSections: [
-            App.SubSection.createRecord({configs: [Em.Object.create({isHiddenByFilter: true, isVisible: true}), Em.Object.create({isHiddenByFilter: true, isVisible: true})]}),
-            App.SubSection.createRecord({configs: [Em.Object.create({isHiddenByFilter: false, isVisible: true}), Em.Object.create({isHiddenByFilter: false, isVisible: true})]})
-          ],
-          m: 'one subsection is hidden',
-          e: false
-        },
-        {
-          subSections: [
-            App.SubSection.createRecord({configs: [Em.Object.create({isHiddenByFilter: true, isVisible: true}), Em.Object.create({isHiddenByFilter: true, isVisible: true})]}),
-            App.SubSection.createRecord({configs: [Em.Object.create({isHiddenByFilter: true, isVisible: true}), Em.Object.create({isHiddenByFilter: true, isVisible: true})]})
-          ],
-          m: 'all subsections are hidden',
-          e: true
-        }
-      ]).forEach(function (test) {
-        it(test.m, function () {
-          model.reopen({
-            subSections: test.subSections
-          });
-          expect(model.get('isHiddenByFilter')).to.equal(test.e);
-        });
-      });
-
-  });
+  App.TestAliases.testAsComputedEveryBy(getModel(), 'isHiddenByFilter', 'subSections', 'isSectionVisible', false);
 
 });

+ 8 - 55
ambari-web/test/models/host_component_test.js

@@ -27,15 +27,6 @@ describe('App.HostComponent', function() {
   });
   var hc = App.HostComponent.find('COMP_host');
 
-
-  describe('#getStatusesList', function() {
-    it('allowed statuses', function() {
-      var statuses = ["STARTED","STARTING","INSTALLED","STOPPING","INSTALL_FAILED","INSTALLING","UPGRADE_FAILED","UNKNOWN","DISABLED","INIT"];
-      expect(App.HostComponentStatus.getStatusesList()).to.include.members(statuses);
-      expect(statuses).to.include.members(App.HostComponentStatus.getStatusesList());
-    });
-  });
-
   describe('#getStatusesList', function() {
     it('allowed statuses', function() {
       var statuses = ["STARTED","STARTING","INSTALLED","STOPPING","INSTALL_FAILED","INSTALLING","UPGRADE_FAILED","UNKNOWN","DISABLED","INIT"];
@@ -94,29 +85,9 @@ describe('App.HostComponent', function() {
     });
   });
 
-  describe('#isRunning', function() {
-    var testCases = [
-      {
-        workStatus: 'INSTALLED',
-        result: false
-      },
-      {
-        workStatus: 'STARTING',
-        result: true
-      },
-      {
-        workStatus: 'STARTED',
-        result: true
-      }
-    ];
-    testCases.forEach(function(test){
-      it('workStatus - ' + test.workStatus, function() {
-        hc.set('workStatus', test.workStatus);
-        hc.propertyDidChange('isRunning');
-        expect(hc.get('isRunning')).to.equal(test.result);
-      });
-    });
-  });
+  App.TestAliases.testAsComputedIfThenElse(hc, 'passiveTooltip', 'isActive', '', Em.I18n.t('hosts.component.passive.mode'));
+
+  App.TestAliases.testAsComputedExistsIn(hc, 'isRunning', 'workStatus', ['STARTED', 'STARTING']);
 
   describe('#isDecommissioning', function() {
     var mock = [];
@@ -157,6 +128,10 @@ describe('App.HostComponent', function() {
     });
   });
 
+  App.TestAliases.testAsComputedEqual(hc, 'isActive', 'passiveState', 'OFF');
+
+  App.TestAliases.testAsComputedIfThenElse(hc, 'passiveTooltip', 'isActive', '', Em.I18n.t('hosts.component.passive.mode'));
+
   describe('#isActive', function() {
     it('passiveState is ON', function() {
       hc.set('passiveState', "ON");
@@ -315,28 +290,6 @@ describe('App.HostComponent', function() {
     });
   });
 
-  describe('#isNotInstalled', function () {
-
-    Em.A([
-      {
-        p: {workStatus: 'INIT'},
-        e: true
-      },
-      {
-        p: {workStatus: 'INSTALL_FAILED'},
-        e: true
-      },
-      {
-        p: {workStatus: 'STARTED'},
-        e: false
-      }
-    ]).forEach(function (test, index) {
-      it('#' + (index + 1), function() {
-        hc.setProperties(test.p);
-        expect(hc.get('isNotInstalled')).to.equal(test.e);
-      });
-    });
-
-  });
+  App.TestAliases.testAsComputedExistsIn(hc, 'isNotInstalled', 'workStatus', ['INIT', 'INSTALL_FAILED']);
 
 });

+ 10 - 0
ambari-web/test/models/host_test.js

@@ -52,16 +52,25 @@ describe('App.Host', function () {
       last_heart_beat_time: (new Date()).getTime()
     }
   ];
+
   before(function() {
     App.set('testMode', false);
   });
+
   App.Host.reopen({
     hostComponents: []
   });
+
   App.store.loadMany(App.Host, data);
 
   var host1 = App.Host.find('host1');
 
+  App.TestAliases.testAsComputedAlias(host1, 'componentsInPassiveStateCount', 'componentsInPassiveState.length', 'number');
+
+  App.TestAliases.testAsComputedAlias(host1, 'componentsWithStaleConfigsCount', 'componentsWithStaleConfigs.length', 'number');
+
+  App.TestAliases.testAsComputedAlias(host1, 'disksMounted', 'diskInfo.length', 'number');
+
   describe('#diskUsedFormatted', function () {
 
     it('host1 - 10GB ', function () {
@@ -460,4 +469,5 @@ describe('App.Host', function () {
       });
     });
   });
+
 });

+ 11 - 1
ambari-web/test/models/repository_test.js

@@ -20,14 +20,24 @@ var App = require('app');
 
 require('models/repository');
 
+function getModel() {
+  return App.Repository.createRecord();
+}
+
 describe('App.Repository', function () {
 
   var model;
 
   beforeEach(function () {
-    model = App.Repository.createRecord();
+    model = getModel();
   });
 
+  App.TestAliases.testAsComputedNotEqualProperties(getModel(), 'undo', 'baseUrl', 'latestBaseUrl');
+
+  App.TestAliases.testAsComputedAlias(getModel(), 'isSelected', 'operatingSystem.isSelected', 'boolean');
+
+  App.TestAliases.testAsComputedAlias(getModel(), 'clearAll', 'baseUrl', 'string'); // string??
+
   describe('#invalidFormatError', function () {
 
     var cases = [

+ 1 - 12
ambari-web/test/models/stack_service_test.js

@@ -212,18 +212,7 @@ describe('App.StackService', function () {
     });
   });
 
-  describe('#isClientOnlyService', function () {
-    it('Has not only client serviceComponents', function () {
-      ss.set('serviceComponents', [Em.Object.create({isSlave: true}), Em.Object.create({isClient: true})]);
-      ss.propertyDidChange('isClientOnlyService');
-      expect(ss.get('isClientOnlyService')).to.be.false;
-    });
-    it('Has only client serviceComponents', function () {
-      ss.set('serviceComponents', [Em.Object.create({isClient: true})]);
-      ss.propertyDidChange('isClientOnlyService');
-      expect(ss.get('isClientOnlyService')).to.be.true;
-    });
-  });
+  App.TestAliases.testAsComputedEveryBy(ss, 'isClientOnlyService', 'serviceComponents', 'isClient', true);
 
   describe('#isNoConfigTypes', function () {
     it('configTypes is null', function () {

+ 7 - 1
ambari-web/test/models/upgrade_entity_test.js

@@ -19,13 +19,19 @@
 var App = require('app');
 require('models/upgrade_entity');
 
+function getModel() {
+  return App.upgradeEntity.create();
+}
+
 describe('App.upgradeEntity', function () {
   var model;
 
   beforeEach(function () {
-    model = App.upgradeEntity.create();
+    model = getModel();
   });
 
+  App.TestAliases.testAsComputedNotEqual(getModel(), 'isVisible', 'status', 'PENDING');
+
   describe("#isRunning", function() {
     it("status IN_PROGRESS", function() {
       model.set('status', 'IN_PROGRESS');

+ 13 - 17
ambari-web/test/models/user_test.js

@@ -28,16 +28,22 @@ var user,
     id: 'user'
   };
 
+function getUser() {
+  return App.User.createRecord(userData);
+}
+
 describe('App.User', function () {
 
   beforeEach(function () {
-    user = App.User.createRecord(userData);
+    user = getUser();
   });
 
   afterEach(function () {
     modelSetup.deleteRecord(user);
   });
 
+  App.TestAliases.testAsComputedAlias(getUser(), 'id', 'userName', 'string');
+
   describe('#id', function () {
     it('should take value from userName', function () {
       user.set('userName', 'name');
@@ -57,27 +63,17 @@ describe('App.User', function () {
   });
 });
 
+function getForm() {
+  return App.CreateUserForm.create();
+}
+
 describe('App.CreateUserForm', function () {
 
   beforeEach(function () {
-    form = App.CreateUserForm.create();
+    form = getForm();
   });
 
-  describe('#object', function () {
-
-    before(function () {
-      sinon.stub(App, 'get').withArgs('router.mainAdminUserCreateController.content').returns(userData);
-    });
-
-    after(function () {
-      App.get.restore();
-    });
-
-    it('should take data from controller', function () {
-      expect(form.get('object')).to.eql(userData);
-    });
-
-  });
+  App.TestAliases.testAsComputedAlias(getForm(), 'object', 'App.router.mainAdminUserCreateController.content', 'object');
 
   describe('#field.userName.toLowerCase', function () {
     it('should convert userName into lower case', function () {

+ 14 - 0
ambari-web/test/views/common/configs/config_history_flow_test.js

@@ -31,6 +31,8 @@ describe.skip('App.ConfigHistoryFlowView', function () {
     serviceVersions: []
   });
 
+  App.TestAliases.testAsComputedAlias(view, 'serviceName', 'controller.selectedService.serviceName', 'string');
+
   describe('#isSaveDisabled', function () {
     var testCases = [
       {
@@ -725,3 +727,15 @@ describe.skip('App.ConfigHistoryFlowView', function () {
     });
   });
 });
+
+function getView() {
+  return App.ConfigsServiceVersionBoxView.create();
+}
+
+describe('App.ConfigsServiceVersionBoxView', function () {
+
+  App.TestAliases.testAsComputedAlias(getView(), 'disabledActionAttr', 'serviceVersion.disabledActionAttr', 'object');
+
+  App.TestAliases.testAsComputedAlias(getView(), 'disabledActionMessages', 'serviceVersion.disabledActionMessages', 'object');
+
+});

+ 19 - 13
ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js

@@ -20,24 +20,30 @@ var App = require('app');
 require('views/common/configs/custom_category_views/notification_configs_view');
 var view;
 
+function getView() {
+  return App.NotificationsConfigsView.create({
+    $: function() {
+      return {show: Em.K, hide: Em.K};
+    },
+    category: {
+      name: 'name'
+    },
+    serviceConfigs: [],
+    parentView: Em.View.create({
+      filter: '',
+      columns: []
+    })
+  });
+}
+
 describe('App.NotificationsConfigsView', function () {
 
   beforeEach(function () {
-    view = App.NotificationsConfigsView.create({
-      $: function() {
-        return {show: Em.K, hide: Em.K};
-      },
-      category: {
-        name: 'name'
-      },
-      serviceConfigs: [],
-      parentView: Em.View.create({
-        filter: '',
-        columns: []
-      })
-    });
+    view = getView();
   });
 
+  App.TestAliases.testAsComputedFindBy(getView(), 'useAuthConfig', 'categoryConfigs', 'name', 'smtp_use_auth');
+
   describe('#didInsertElement', function () {
 
     beforeEach(function () {

+ 3 - 0
ambari-web/test/views/common/configs/service_configs_by_category_view_test.js

@@ -94,6 +94,8 @@ describe('App.ServiceConfigsByCategoryView', function () {
     }
   ];
 
+  App.TestAliases.testAsComputedIfThenElse(view, 'isCategoryBodyVisible', 'category.isCollapsed', 'display: none;', 'display: block;');
+
   describe('#sortByIndex', function () {
     testData.forEach(function(_test){
       it(_test.title, function () {
@@ -402,4 +404,5 @@ describe('App.ServiceConfigsByCategoryView', function () {
       });
     });
   });
+
 });

+ 13 - 3
ambari-web/test/views/common/form/manage_kdc_credentials_form_test.js

@@ -21,17 +21,27 @@ var credentialUtils = require('utils/credentials');
 
 var view;
 
+function getView() {
+  return App.ManageCredentialsFormView.create({
+    parentView: Em.Object.create({})
+  });
+}
+
 describe('#App.ManageCredentialsFormView', function() {
   beforeEach(function() {
-    view = App.ManageCredentialsFormView.create({
-      parentView: Em.Object.create({})
-    });
+    view = getView();
   });
 
   afterEach(function() {
     view.destroy();
   });
 
+  App.TestAliases.testAsComputedAlias(getView(), 'storePersisted', 'App.isCredentialStorePersistent', 'boolean');
+
+  App.TestAliases.testAsComputedIfThenElse(getView(), 'formHeader', 'isRemovable', Em.I18n.t('admin.kerberos.credentials.form.header.stored'), Em.I18n.t('admin.kerberos.credentials.form.header.not.stored'));
+
+  App.TestAliases.testAsComputedIfThenElse(getView(), 'hintMessage', 'storePersisted', Em.I18n.t('admin.kerberos.credentials.store.hint.supported'), Em.I18n.t('admin.kerberos.credentials.store.hint.not.supported'));
+
   describe('#prepareContent', function() {
     [
       {

+ 8 - 0
ambari-web/test/views/common/table_view_test.js

@@ -24,6 +24,10 @@ require('mixins');
 require('mixins/common/userPref');
 require('views/common/table_view');
 
+function getView() {
+  return App.TableView.create();
+}
+
 describe('App.TableView', function () {
 
   var view;
@@ -38,6 +42,10 @@ describe('App.TableView', function () {
     App.db.setFilterConditions.restore();
   });
 
+  App.TestAliases.testAsComputedAlias(getView(), 'filteredCount', 'filteredContent.length', 'number');
+
+  App.TestAliases.testAsComputedAlias(getView(), 'totalCount', 'content.length', 'number');
+
   describe('#init', function() {
 
     it('should set filterConditions on instance', function() {

+ 2 - 12
ambari-web/test/views/main/admin/highAvailability/nameNode/step4_view_test.js

@@ -54,16 +54,6 @@ describe('App.HighAvailabilityWizardStep4View', function () {
     });
   });
 
-  describe("#nnCheckPointText", function() {
-    it("isNextEnabled true", function() {
-      view.set('controller.isNextEnabled', true);
-      view.propertyDidChange('nnCheckPointText');
-      expect(view.get('nnCheckPointText')).to.equal(Em.I18n.t('admin.highAvailability.wizard.step4.ckCreated'));
-    });
-    it("isNextEnabled false", function() {
-      view.set('controller.isNextEnabled', false);
-      view.propertyDidChange('nnCheckPointText');
-      expect(view.get('nnCheckPointText')).to.equal(Em.I18n.t('admin.highAvailability.wizard.step4.ckNotCreated'));
-    });
-  });
+  App.TestAliases.testAsComputedIfThenElse(view, 'nnCheckPointText', 'controller.isNextEnabled', Em.I18n.t('admin.highAvailability.wizard.step4.ckCreated'), Em.I18n.t('admin.highAvailability.wizard.step4.ckNotCreated'));
+
 });

+ 2 - 12
ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js

@@ -37,6 +37,8 @@ describe('App.upgradeWizardView', function () {
   });
   view.removeObserver('App.clusterName', view, 'startPolling');
 
+  App.TestAliases.testAsComputedEqualProperties(view, 'isFinalizeItem', 'manualItem.context', 'controller.finalizeContext');
+
   describe("#upgradeGroups", function () {
     it("upgradeGroups is null", function () {
       view.set('controller.upgradeData.upgradeGroups', null);
@@ -434,18 +436,6 @@ describe('App.upgradeWizardView', function () {
     });
   });
 
-  describe("#isFinalizeItem", function () {
-    it("depends of manualItem.context", function () {
-      view.reopen({
-        manualItem: {
-          context: 'Confirm Finalize'
-        }
-      });
-      view.propertyDidChange('isFinalizeItem');
-      expect(view.get('isFinalizeItem')).to.be.true;
-    });
-  });
-
   describe("#toggleDetails()", function () {
     before(function () {
       sinon.stub(view, 'toggleProperty', Em.K);

+ 7 - 1
ambari-web/test/views/main/alert_definitions_view_test.js

@@ -22,10 +22,14 @@ require('views/main/alert_definitions_view');
 
 var view;
 
+function getView() {
+  return App.MainAlertDefinitionsView.create({});
+}
+
 describe('App.MainAlertDefinitionsView', function () {
 
   beforeEach(function () {
-    view = App.MainAlertDefinitionsView.create({});
+    view = getView();
     sinon.stub(App.db, 'setFilterConditions', Em.K);
     sinon.stub(App.db, 'getFilterConditions', Em.K);
     sinon.stub(App.db, 'getDisplayLength', Em.K);
@@ -41,6 +45,8 @@ describe('App.MainAlertDefinitionsView', function () {
     view.initFilters.restore();
   });
 
+  App.TestAliases.testAsComputedAlias(getView(), 'totalCount', 'content.length', 'number');
+
   describe('#serviceFilterView', function () {
     it('Add Ambari service to filters', function () {
       var serviceFilterClass = view.serviceFilterView;

+ 9 - 5
ambari-web/test/views/main/alerts/manage_alert_groups_view_test.js

@@ -20,14 +20,16 @@ var App = require('app');
 
 var view;
 
+function getView() {
+  return App.MainAlertsManageAlertGroupView.create({
+    controller: Em.Object.create()
+  });
+}
+
 describe('App.MainAlertsManageAlertGroupView', function () {
 
   beforeEach(function () {
-
-    view = App.MainAlertsManageAlertGroupView.create({
-      controller: Em.Object.create()
-    });
-
+    view = getView();
   });
 
   it('#buttonObserver', function () {
@@ -89,4 +91,6 @@ describe('App.MainAlertsManageAlertGroupView', function () {
 
   });
 
+  App.TestAliases.testAsComputedIfThenElse(getView(), 'removeButtonTooltip', 'controller.isRemoveButtonDisabled', Em.I18n.t('alerts.actions.manage_alert_groups_popup.removeButtonDisabled'), Em.I18n.t('alerts.actions.manage_alert_groups_popup.removeButton'))
+
 });

+ 10 - 0
ambari-web/test/views/main/dashboard/widgets/hbase_average_load_test.js

@@ -23,6 +23,10 @@ require('views/main/dashboard/widgets/hbase_average_load');
 require('views/main/dashboard/widgets/text_widget');
 require('views/main/dashboard/widget');
 
+function getView() {
+  return App.HBaseAverageLoadView.create({model_type: null});
+}
+
 describe('App.HBaseAverageLoadView', function() {
 
   var tests = [
@@ -100,4 +104,10 @@ describe('App.HBaseAverageLoadView', function() {
     });
   });
 
+  App.TestAliases.testAsComputedAlias(getView(), 'data', 'model.averageLoad', 'number');
+
+  App.TestAliases.testAsComputedGtProperties(getView(), 'isRed', 'data', 'thresh2');
+
+  App.TestAliases.testAsComputedLteProperties(getView(), 'isGreen', 'data', 'thresh1');
+
 });

+ 10 - 0
ambari-web/test/views/main/dashboard/widgets/hbase_regions_in_transition_test.js

@@ -22,6 +22,10 @@ require('views/main/dashboard/widgets/hbase_regions_in_transition');
 require('views/main/dashboard/widgets/text_widget');
 require('views/main/dashboard/widget');
 
+function getView() {
+  return App.HBaseRegionsInTransitionView.create({model_type:null});
+}
+
 describe('App.HBaseRegionsInTransitionView', function() {
 
   var tests = [
@@ -99,4 +103,10 @@ describe('App.HBaseRegionsInTransitionView', function() {
     });
   });
 
+  App.TestAliases.testAsComputedAlias(getView(), 'data', 'model.regionsInTransition', 'number');
+
+  App.TestAliases.testAsComputedGtProperties(getView(), 'isRed', 'data', 'thresh2');
+
+  App.TestAliases.testAsComputedLteProperties(getView(), 'isGreen', 'data', 'thresh1');
+
 });

+ 8 - 0
ambari-web/test/views/main/dashboard/widgets/namenode_rpc_test.js

@@ -23,6 +23,10 @@ require('views/main/dashboard/widgets/namenode_rpc');
 require('views/main/dashboard/widgets/text_widget');
 require('views/main/dashboard/widget');
 
+function getView() {
+  return App.NameNodeRpcView.create({model_type:null});
+}
+
 describe('App.NameNodeRpcView', function() {
 
   var tests = [
@@ -104,4 +108,8 @@ describe('App.NameNodeRpcView', function() {
     });
   });
 
+  App.TestAliases.testAsComputedGtProperties(getView(), 'isRed', 'data', 'thresh2');
+
+  App.TestAliases.testAsComputedLteProperties(getView(), 'isGreen', 'data', 'thresh1');
+
 });

+ 8 - 0
ambari-web/test/views/main/dashboard/widgets/text_widget_test.js

@@ -21,6 +21,10 @@ var App = require('app');
 require('views/main/dashboard/widget');
 require('views/main/dashboard/widgets/text_widget');
 
+function getView() {
+  return App.TextDashboardWidgetView.create({thresh1:40, thresh2:70});
+}
+
 describe('App.TextDashboardWidgetView', function() {
 
   var tests = [
@@ -81,4 +85,8 @@ describe('App.TextDashboardWidgetView', function() {
     });
   });
 
+  App.TestAliases.testAsComputedGtProperties(getView(), 'isGreen', 'data', 'thresh2');
+
+  App.TestAliases.testAsComputedLteProperties(getView(), 'isRed', 'data', 'thresh1');
+
 });

+ 25 - 172
ambari-web/test/views/main/host/details/host_component_view_test.js

@@ -22,20 +22,26 @@ require('views/main/host/details/host_component_view');
 
 var hostComponentView;
 
+function getView() {
+  return App.HostComponentView.create({
+    startBlinking: function(){},
+    doBlinking: function(){},
+    getDesiredAdminState: function(){return $.ajax({});},
+    content: Em.Object.create({
+      componentName: 'component'
+    }),
+    hostComponent: Em.Object.create()
+  });
+}
+
 describe('App.HostComponentView', function() {
 
   beforeEach(function() {
-    hostComponentView = App.HostComponentView.create({
-      startBlinking: function(){},
-      doBlinking: function(){},
-      getDesiredAdminState: function(){return $.ajax({});},
-      content: Em.Object.create({
-        componentName: 'component'
-      }),
-      hostComponent: Em.Object.create()
-    });
+    hostComponentView = getView();
   });
 
+  App.TestAliases.testAsComputedNotEqual(getView(), 'isRestartComponentDisabled', 'workStatus', App.HostComponentStatus.started);
+
   describe('#disabled', function() {
 
     var tests = Em.A([
@@ -80,150 +86,25 @@ describe('App.HostComponentView', function() {
 
   });
 
-  describe('#isUpgradeFailed', function() {
-
-    var tests = ['UPGRADE_FAILED'];
-    var testE = true;
-    var defaultE = false;
-
-    App.HostComponentStatus.getStatusesList().forEach(function(status) {
-      it(status, function() {
-        hostComponentView.get('hostComponent').set('workStatus', status);
-        var e = tests.contains(status) ? testE : defaultE;
-        expect(hostComponentView.get('isUpgradeFailed')).to.equal(e);
-      });
-    });
-
-  });
-
-  describe('#isInstallFailed', function() {
-
-    var tests = ['INSTALL_FAILED'];
-    var testE = true;
-    var defaultE = false;
-
-    App.HostComponentStatus.getStatusesList().forEach(function(status) {
-      it(status, function() {
-        hostComponentView.get('hostComponent').set('workStatus', status);
-        var e = tests.contains(status) ? testE : defaultE;
-        expect(hostComponentView.get('isInstallFailed')).to.equal(e);
-      });
-    });
-
-  });
-
-  describe('#isStart', function() {
-
-    var tests = ['STARTED','STARTING'];
-    var testE = true;
-    var defaultE = false;
-
-    App.HostComponentStatus.getStatusesList().forEach(function(status) {
-      it(status, function() {
-        hostComponentView.get('hostComponent').set('workStatus', status);
-        var e = tests.contains(status) ? testE : defaultE;
-        expect(hostComponentView.get('isStart')).to.equal(e);
-      });
-    });
-
-  });
-
-  describe('#isStop', function() {
-
-    var tests = ['INSTALLED'];
-    var testE = true;
-    var defaultE = false;
-
-    App.HostComponentStatus.getStatusesList().forEach(function(status) {
-      it(status, function() {
-        hostComponentView.get('hostComponent').set('workStatus', status);
-        var e = tests.contains(status) ? testE : defaultE;
-        expect(hostComponentView.get('isStop')).to.equal(e);
-      });
-    });
-
-  });
-
-  describe('#isInstalling', function() {
-
-    var tests = ['INSTALLING'];
-    var testE = true;
-    var defaultE = false;
-
-    App.HostComponentStatus.getStatusesList().forEach(function(status) {
-      it(status, function() {
-        hostComponentView.get('hostComponent').set('workStatus', status);
-        var e = tests.contains(status) ? testE : defaultE;
-        expect(hostComponentView.get('isInstalling')).to.equal(e);
-      });
-    });
-
-  });
-
-  describe('#isInit', function() {
-
-    var tests = ['INIT'];
-    var testE = true;
-    var defaultE = false;
-
-    App.HostComponentStatus.getStatusesList().forEach(function(status) {
-      it(status, function() {
-        hostComponentView.get('hostComponent').set('workStatus', status);
-        var e = tests.contains(status) ? testE : defaultE;
-        expect(hostComponentView.get('isInit')).to.equal(e);
-      });
-    });
-
-  });
-
-  describe('#noActionAvailable', function() {
+  App.TestAliases.testAsComputedEqual(getView(), 'isUpgradeFailed', 'workStatus', App.HostComponentStatus.upgrade_failed);
 
-    var tests = ['STARTING', 'STOPPING', 'UNKNOWN', 'DISABLED'];
-    var testE = 'hidden';
-    var defaultE = '';
+  App.TestAliases.testAsComputedEqual(getView(), 'isInstallFailed', 'workStatus', App.HostComponentStatus.install_failed);
 
-    App.HostComponentStatus.getStatusesList().forEach(function(status) {
-      it(status, function() {
-        hostComponentView.get('hostComponent').set('workStatus', status);
-        var e = tests.contains(status) ? testE : defaultE;
-        expect(hostComponentView.get('noActionAvailable')).to.equal(e);
-      });
-    });
-
-  });
+  App.TestAliases.testAsComputedEqual(getView(), 'isStop', 'workStatus', App.HostComponentStatus.stopped);
 
-  describe('#isActive', function() {
+  App.TestAliases.testAsComputedEqual(getView(), 'isInstalling', 'workStatus', App.HostComponentStatus.installing);
 
-    var tests = Em.A([
-      {passiveState: 'OFF', e: true},
-      {passiveState: 'ON', e: false},
-      {passiveState: 'IMPLIED', e: false}
-    ]);
-
-    tests.forEach(function(test) {
-      it(test.workStatus, function() {
-        hostComponentView.get('content').set('passiveState', test.passiveState);
-        expect(hostComponentView.get('isActive')).to.equal(test.e);
-      });
-    });
+  App.TestAliases.testAsComputedEqual(getView(), 'isInit', 'workStatus', App.HostComponentStatus.init);
 
-  });
+  App.TestAliases.testAsComputedExistsIn(getView(), 'isInProgress', 'workStatus', [App.HostComponentStatus.stopping, App.HostComponentStatus.starting]);
 
-  describe('#isRestartComponentDisabled', function() {
+  App.TestAliases.testAsComputedExistsIn(getView(), 'withoutActions', 'workStatus', [App.HostComponentStatus.starting, App.HostComponentStatus.stopping, App.HostComponentStatus.unknown, App.HostComponentStatus.disabled]);
 
-    var tests = ['STARTED'];
-    var testE = false;
-    var defaultE = true;
+  App.TestAliases.testAsComputedExistsIn(getView(), 'isStart', 'workStatus', [App.HostComponentStatus.started, App.HostComponentStatus.starting]);
 
-    App.HostComponentStatus.getStatusesList().forEach(function(status) {
-      it(status, function() {
-        hostComponentView.get('hostComponent').set('workStatus', status);
-        var e = tests.contains(status) ? testE : defaultE;
-        expect(hostComponentView.get('isRestartComponentDisabled')).to.equal(e);
-      });
-    });
+  App.TestAliases.testAsComputedIfThenElse(getView(), 'noActionAvailable', 'withoutActions', 'hidden', '');
 
-  });
+  App.TestAliases.testAsComputedEqual(getView(), 'isActive', 'content.passiveState', 'OFF');
 
   describe('#isDeleteComponentDisabled', function() {
 
@@ -371,22 +252,6 @@ describe('App.HostComponentView', function() {
 
   });
 
-  describe('#isInProgress', function() {
-
-    var tests = ['STOPPING', 'STARTING'];
-    var testE = true;
-    var defaultE = false;
-
-    App.HostComponentStatus.getStatusesList().forEach(function(status) {
-      it(status, function() {
-        hostComponentView.get('hostComponent').set('workStatus', status);
-        var e = tests.contains(status) ? testE : defaultE;
-        expect(hostComponentView.get('isInProgress')).to.equal(e);
-      });
-    });
-
-  });
-
   describe('#statusIconClass', function() {
     var tests = Em.A([
       {s: 'health-status-started', e: App.healthIconClassGreen},
@@ -634,16 +499,4 @@ describe('App.HostComponentView', function() {
     });
   });
 
-  describe("#isRestartComponentDisabled", function() {
-    it("component is restartable", function() {
-      hostComponentView.get('hostComponent').set('workStatus', 'STARTED');
-      hostComponentView.propertyDidChange('isRestartComponentDisabled');
-      expect(hostComponentView.get('isRestartComponentDisabled')).to.be.false;
-    });
-    it("component is not restartable", function() {
-      hostComponentView.get('hostComponent').set('workStatus', 'INSTALLED');
-      hostComponentView.propertyDidChange('isRestartComponentDisabled');
-      expect(hostComponentView.get('isRestartComponentDisabled')).to.be.true;
-    });
-  });
 });

+ 9 - 3
ambari-web/test/views/main/host_test.js

@@ -20,16 +20,22 @@
 var App = require('app');
 require('views/main/host');
 
+function getView() {
+  return App.MainHostView.create({
+    controller: App.MainHostController.create()
+  });
+}
+
 describe('App.MainHostView', function () {
 
   var view;
 
   beforeEach(function () {
-    view = App.MainHostView.create({
-      controller: App.MainHostController.create()
-    });
+    view = getView();
   });
 
+  App.TestAliases.testAsComputedAlias(getView(), 'colPropAssoc', 'controller.colPropAssoc', 'array');
+
   describe('#didInsertElement', function () {
 
     var cases = [

+ 9 - 0
ambari-web/test/views/main/service/info/summary_test.js

@@ -37,6 +37,14 @@ describe('App.MainServiceInfoSummaryView', function() {
     service: Em.Object.create()
   });
 
+  App.TestAliases.testAsComputedAlias(view, 'servicesHaveClients', 'App.services.hasClient', 'boolean');
+
+  App.TestAliases.testAsComputedAlias(view, 'serviceName', 'service.serviceName', 'string');
+
+  App.TestAliases.testAsComputedAlias(view, 'alertsCount', 'controller.content.alertsCount', 'number');
+
+  App.TestAliases.testAsComputedAlias(view, 'hasCriticalAlerts', 'controller.content.hasCriticalAlerts', 'boolean');
+
   describe('#servers', function () {
     it('services shouldn\'t have servers except FLUME and ZOOKEEPER', function () {
       expect(view.get('servers')).to.be.empty;
@@ -443,4 +451,5 @@ describe('App.MainServiceInfoSummaryView', function() {
       App.router.get.restore();
     });
   });
+
 });

+ 15 - 0
ambari-web/test/views/main/service/item_test.js

@@ -21,8 +21,22 @@ require('views/main/service/item');
 
 var view;
 
+function getView() {
+  return App.MainServiceItemView.create({
+    controller: Em.Object.create({
+      content: Em.Object.create({
+        hostComponents: []
+      })
+    })
+  });
+}
+
 describe('App.MainServiceItemView', function () {
 
+  App.TestAliases.testAsComputedAlias(getView(), 'serviceName', 'controller.content.serviceName', 'string');
+
+  App.TestAliases.testAsComputedAlias(getView(), 'displayName', 'controller.content.displayName', 'string');
+
   describe('#mastersExcludedCommands', function () {
 
     view = App.MainServiceItemView.create({
@@ -564,5 +578,6 @@ describe('App.MainServiceItemView', function () {
       expect(view.get('isMaintenanceSet')).to.be.false;
     });
   });
+
 });
 

+ 5 - 36
ambari-web/test/views/wizard/step1_view_test.js

@@ -22,6 +22,10 @@ require('views/wizard/step1_view');
 var view;
 var controller;
 
+function getView() {
+  return App.WizardStep1View.create();
+}
+
 describe('App.WizardStep1View', function () {
 
   describe('#operatingSystems', function () {
@@ -204,42 +208,7 @@ describe('App.WizardStep1View', function () {
     });
   });
 
-  describe('#isNoOsChecked', function () {
-    view = App.WizardStep1View.create();
-
-    var tests = Em.A([
-      {
-        operatingSystems: [
-          {'isSelected': false},
-          {'isSelected': false}
-        ],
-        e: true
-      },
-      {
-        operatingSystems: [
-          {'isSelected': true},
-          {'isSelected': false}
-        ],
-        e: false
-      },
-      {
-        operatingSystems: [
-          {'isSelected': true},
-          {'isSelected': true}
-        ],
-        e: false
-      }
-    ]);
-
-    tests.forEach(function (test) {
-      it(test.operatingSystems.mapProperty('isSelected').join(', '), function () {
-        var operatingSystems = view.get('operatingSystems');
-        Ember.set(operatingSystems[0], 'isSelected', test.operatingSystems[0].isSelected);
-        Ember.set(operatingSystems[1], 'isSelected', test.operatingSystems[1].isSelected);
-        expect(view.get('isNoOsChecked')).to.equal(test.e);
-      });
-    });
-  });
+  App.TestAliases.testAsComputedEveryBy(getView(), 'isNoOsChecked', 'operatingSystems', 'isSelected', false);
 
   describe('#stacks', function () {
 

+ 6 - 9
ambari-web/test/views/wizard/step2_view_test.js

@@ -23,20 +23,17 @@ var view, controller = Em.Object.create({
   clusterNameError: ''
 });
 
+function getView() {
+  return App.WizardStep2View.create({'controller': controller});
+}
+
 describe('App.WizardStep0View', function () {
 
   beforeEach(function() {
-    view = App.WizardStep2View.create({'controller': controller});
+    view = getView();
   });
 
-  describe('#sshKeyState', function() {
-    it('should be equal to controller.content.installOptions.manualInstall', function() {
-      controller.set('content', {installOptions: {manualInstall: false}});
-      expect(view.get('sshKeyState')).to.equal(false);
-      controller.toggleProperty('content.installOptions.manualInstall');
-      expect(view.get('sshKeyState')).to.equal(true);
-    });
-  });
+  App.TestAliases.testAsComputedAlias(getView(), 'sshKeyState', 'controller.content.installOptions.manualInstall', 'string');
 
   describe('#didInsertElement', function() {
     beforeEach(function () {

+ 12 - 12
ambari-web/test/views/wizard/step3/hostLogPopupBody_view_test.js

@@ -19,14 +19,19 @@
 var App = require('app');
 require('views/wizard/step3/hostLogPopupBody_view');
 var view;
+
+function getView() {
+  return App.WizardStep3HostLogPopupBody.create({
+    parentView: Em.Object.create({
+      host: Em.Object.create()
+    })
+  });
+}
+
 describe('App.WizardStep3HostLogPopupBody', function() {
 
   beforeEach(function() {
-    view = App.WizardStep3HostLogPopupBody.create({
-      parentView: Em.Object.create({
-        host: Em.Object.create()
-      })
-    });
+    view = getView();
   });
 
   describe('#textArea', function() {
@@ -47,12 +52,7 @@ describe('App.WizardStep3HostLogPopupBody', function() {
 
   });
 
-  describe('#bootLog', function() {
-    it('should be equal to parentView.host.bootLog', function() {
-      var log = 'i wanna play a game';
-      view.set('parentView.host.bootLog', log);
-      expect(view.get('bootLog')).to.equal(log);
-    });
-  });
+  App.TestAliases.testAsComputedAlias(getView(), 'bootLog', 'parentView.host.bootLog', 'string');
+
 
 });

+ 16 - 8
ambari-web/test/views/wizard/step3/hostWarningPopupBody_view_test.js

@@ -21,19 +21,27 @@ var lazyloading = require('utils/lazy_loading');
 require('views/wizard/step3/hostWarningPopupBody_view');
 var view;
 
+function getView() {
+  return App.WizardStep3HostWarningPopupBody.create({
+    didInsertElement: Em.K,
+    $: function() {
+      return Em.Object.create({
+        toggle: Em.K
+      })
+    }
+  });
+}
+
 describe('App.WizardStep3HostWarningPopupBody', function() {
 
   beforeEach(function() {
-    view = App.WizardStep3HostWarningPopupBody.create({
-      didInsertElement: Em.K,
-      $: function() {
-        return Em.Object.create({
-          toggle: Em.K
-        })
-      }
-    });
+    view = getView();
   });
 
+  App.TestAliases.testAsComputedAlias(getView(), 'warningsByHost', 'bodyController.warningsByHost', 'array');
+
+  App.TestAliases.testAsComputedAlias(getView(), 'warnings', 'bodyController.warnings', 'array');
+
   describe('#onToggleBlock', function() {
     it('should toggle', function() {
       var context = Em.Object.create({isCollapsed: false});

+ 9 - 12
ambari-web/test/views/wizard/step6_view_test.js

@@ -23,14 +23,20 @@ require('utils/string_utils');
 require('views/wizard/step6_view');
 var view;
 
+function getView() {
+  return App.WizardStep6View.create({
+    controller: App.WizardStep6Controller.create()
+  });
+}
+
 describe('App.WizardStep6View', function() {
 
   beforeEach(function() {
-    view = App.WizardStep6View.create({
-      controller: App.WizardStep6Controller.create()
-    });
+    view = getView();
   });
 
+  App.TestAliases.testAsComputedAlias(getView(), 'filteredContent', 'content', 'array');
+
   describe('#content', function() {
     it('should be same to controller.hosts', function() {
       view.set('content', []);
@@ -40,15 +46,6 @@ describe('App.WizardStep6View', function() {
     });
   });
 
-  describe('#filteredContent', function() {
-    it('should be same to content', function() {
-      view.set('content', []);
-      var d = [{}, {}];
-      view.set('controller.hosts', d);
-      expect(view.get('filteredContent')).to.eql(d);
-    });
-  });
-
   describe('#didInsertElement', function() {
 
     beforeEach(function() {

+ 11 - 14
ambari-web/test/views/wizard/step9/hostLogPopupBody_view_test.js

@@ -20,16 +20,22 @@ var App = require('app');
 require('views/wizard/step9/hostLogPopupBody_view');
 var view;
 
+function getView() {
+  return App.WizardStep9HostLogPopupBodyView.create({
+    parentView: Em.Object.create({
+      host: Em.Object.create()
+    })
+  });
+}
+
 describe('App.WizardStep9HostLogPopupBodyView', function() {
 
   beforeEach(function() {
-    view = App.WizardStep9HostLogPopupBodyView.create({
-      parentView: Em.Object.create({
-        host: Em.Object.create()
-      })
-    });
+    view = getView();
   });
 
+  App.TestAliases.testAsComputedAlias(getView(), 'isNoTasksScheduled', 'parentView.host.isNoTasksForInstall', 'boolean');
+
   describe('#isHeartbeatLost', function() {
     it('should depends on parentView.host.status', function() {
       view.set('parentView.host.status', 'success');
@@ -39,15 +45,6 @@ describe('App.WizardStep9HostLogPopupBodyView', function() {
     });
   });
 
-  describe('#isNoTasksScheduled', function() {
-    it('should be same to parentView.host.isNoTasksForInstall', function() {
-      view.set('parentView.host.isNoTasksForInstall', true);
-      expect(view.get('isNoTasksScheduled')).to.equal(true);
-      view.set('parentView.host.isNoTasksForInstall', false);
-      expect(view.get('isNoTasksScheduled')).to.equal(false);
-    });
-  });
-
   describe('#visibleTasks', function() {
     Em.A([
         {