You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2014/07/21 18:06:50 UTC

[4/5] AMBARI-6550. Make tests runnable. (onechiporenko)

http://git-wip-us.apache.org/repos/asf/ambari/blob/566e754e/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index 058ac57..4fd01c8 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -22,38 +22,42 @@ require('controllers/main/host/details');
 require('models/service');
 require('models/host_component');
 var batchUtils = require('utils/batch_scheduled_requests');
-
+var controller;
 
 describe('App.MainHostDetailsController', function () {
 
-  var controller = App.MainHostDetailsController.create({
-    getSecurityStatus: function () {
-      return this.get('mockSecurityStatus');
-    },
-    mockSecurityStatus: false
+
+  beforeEach(function() {
+    controller = App.MainHostDetailsController.create({
+      getSecurityStatus: function () {
+        return this.get('mockSecurityStatus');
+      },
+      mockSecurityStatus: false
+    });
   });
 
+
   describe('#serviceActiveComponents', function () {
 
     it('No host-components', function () {
-      controller.set('content.hostComponents', []);
+      controller.set('content', {hostComponents: []});
       expect(controller.get('serviceActiveComponents')).to.be.empty;
     });
 
     it('No host-components in active state', function () {
-      controller.set('content.hostComponents', [Em.Object.create({
+      controller.set('content', {hostComponents: [Em.Object.create({
         service: {
           isInPassive: true
         }
-      })]);
+      })]});
       expect(controller.get('serviceActiveComponents')).to.be.empty;
     });
     it('Host-components in active state', function () {
-      controller.set('content.hostComponents', [Em.Object.create({
+      controller.set('content', {hostComponents: [Em.Object.create({
         service: {
           isInPassive: false
         }
-      })]);
+      })]});
       expect(controller.get('serviceActiveComponents')).to.eql([Em.Object.create({
         service: {
           isInPassive: false
@@ -73,181 +77,21 @@ describe('App.MainHostDetailsController', function () {
     });
 
     it('Active host-component is client', function () {
-      controller.set('serviceActiveComponents', [Em.Object.create({
+      controller.reopen({serviceActiveComponents: [Em.Object.create({
         isClient: true
-      })]);
+      })]});
       expect(controller.get('serviceNonClientActiveComponents')).to.be.empty;
     });
     it('Active host-component is not client', function () {
-      controller.set('serviceActiveComponents', [Em.Object.create({
+      controller.reopen({serviceActiveComponents: [Em.Object.create({
         isClient: false
-      })]);
+      })]});
       expect(controller.get('serviceNonClientActiveComponents')).to.eql( [Em.Object.create({
         isClient: false
       })]);
     });
   });
 
-  describe('#startComponent()', function () {
-
-    beforeEach(function () {
-      sinon.spy(App, "showConfirmationPopup");
-      sinon.stub(controller, "sendStartComponentCommand", Em.K);
-    });
-    afterEach(function () {
-      App.showConfirmationPopup.restore();
-      controller.sendStartComponentCommand.restore();
-    });
-
-    it('popup should be displayed', function () {
-      var popup = controller.startComponent({context: Em.Object.create({'displayName': 'Comp1'})});
-      expect(App.showConfirmationPopup.calledOnce).to.be.true;
-      popup.onPrimary();
-      expect(controller.sendStartComponentCommand.calledOnce).to.be.true;
-    });
-  });
-
-  describe('#sendStartComponentCommand()', function () {
-
-    beforeEach(function () {
-      sinon.stub(App.ajax, "send", Em.K);
-    });
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
-
-    it('Query should be sent', function () {
-      var component = Em.Object.create({
-        componentName: 'comp1'
-      });
-      controller.sendStartComponentCommand(component, '');
-      expect(App.ajax.send.calledOnce).to.be.true;
-    });
-  });
-
-  describe('#getDataToSend()', function () {
-    var component = Em.Object.create({
-      componentName: 'comp1',
-      host: {
-        hostName: 'host1'
-      },
-      service: {
-        serviceName: 'serv1'
-      }
-    });
-    it('should return correct query info', function () {
-      controller.set("content.hostName", "host1");
-      expect(controller.getDataToSend('STATE1', 'context', component)).to.deep.eql({
-        RequestInfo: {
-          "context": 'context',
-          "operation_level": {
-            "cluster_name": "tdk",
-            "host_name": "host1",
-            "hostcomponent_name": "comp1",
-            "service_name": "serv1",
-            "level": "HOST_COMPONENT"
-          }
-        },
-        Body: {
-          HostRoles: {
-            state: 'STATE1'
-          }
-        }
-      });
-      expect(controller.getDataToSend('STATE1', 'context', [component])).to.deep.eql({
-        RequestInfo: {
-          "context": 'context',
-          "operation_level": {
-            "cluster_name": "tdk",
-            "host_name": "host1",
-            "level": "HOST"
-          }
-        },
-        Body: {
-          HostRoles: {
-            state: 'STATE1'
-          }
-        }
-      });
-    });
-  });
-
-  describe('#setComponentToData()', function () {
-    var testCases = [
-      {
-        title: 'dataToSend is null',
-        content: {
-          data: {},
-          dataToSend: null,
-          component: {}
-        },
-        result: {
-          output: false,
-          data: {}
-        }
-      },
-      {
-        title: 'component is null',
-        content: {
-          data: {},
-          dataToSend: {},
-          component: null
-        },
-        result: {
-          output: false,
-          data: {}
-        }
-      },
-      {
-        title: 'data is null',
-        content: {
-          data: null,
-          dataToSend: {},
-          component: {}
-        },
-        result: {
-          output: false,
-          data: null
-        }
-      },
-      {
-        title: 'component is object',
-        content: {
-          data: {},
-          dataToSend: {},
-          component: Em.Object.create({componentName: 'comp1'})
-        },
-        result: {
-          output: true,
-          data: {
-            componentName: 'comp1',
-            data: '{}'
-          }
-        }
-      },
-      {
-        title: 'component is array',
-        content: {
-          data: {},
-          dataToSend: {RequestInfo: {}},
-          component: [Em.Object.create({componentName: 'comp1'})]
-        },
-        result: {
-          output: true,
-          data: {
-            data: '{\"RequestInfo\":{\"query\":\"HostRoles/component_name.in(comp1)\"}}'
-          }
-        }
-      }
-    ];
-    testCases.forEach(function (test) {
-      it(test.title, function () {
-        expect(controller.setComponentToData(test.content.data, test.content.dataToSend, test.content.component)).to.equal(test.result.output);
-        expect(test.content.data).to.eql(test.result.data);
-      });
-    });
-  });
-
   describe('#deleteComponent()', function () {
 
     beforeEach(function () {
@@ -266,27 +110,6 @@ describe('App.MainHostDetailsController', function () {
     });
   });
 
-  describe('#_doDeleteHostComponent()', function () {
-
-    beforeEach(function () {
-      sinon.stub(App.ajax, "send", Em.K);
-    });
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
-
-    it('delete request should be sent, component is null', function () {
-      controller.set('_deletedHostComponentResult', null);
-      expect(controller._doDeleteHostComponent()).to.equal(null);
-      expect(App.ajax.send.calledOnce).to.be.true;
-    });
-    it('delete request should be sent, component is correct', function () {
-      controller.set('_deletedHostComponentResult', {});
-      expect(controller._doDeleteHostComponent(Em.Object.create({componentName: 'COMP1'}))).to.eql({});
-      expect(App.ajax.send.calledOnce).to.be.true;
-    });
-  });
-
   describe('#mimicWorkStatusChange()', function () {
 
     var clock;
@@ -336,43 +159,6 @@ describe('App.MainHostDetailsController', function () {
     });
   });
 
-  describe('#stopComponent()', function () {
-
-    beforeEach(function () {
-      sinon.spy(App, "showConfirmationPopup");
-      sinon.stub(controller, "sendStopComponentCommand", Em.K);
-    });
-    afterEach(function () {
-      App.showConfirmationPopup.restore();
-      controller.sendStopComponentCommand.restore();
-    });
-
-    it('popup should be displayed', function () {
-      var popup = controller.stopComponent({context: Em.Object.create({'displayName': 'Comp1'})});
-      expect(App.showConfirmationPopup.calledOnce).to.be.true;
-      popup.onPrimary();
-      expect(controller.sendStopComponentCommand.calledOnce).to.be.true;
-    });
-  });
-
-  describe('#sendStopComponentCommand()', function () {
-
-    beforeEach(function () {
-      sinon.stub(App.ajax, "send", Em.K);
-    });
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
-
-    it('Query should be sent', function () {
-      var component = Em.Object.create({
-        componentName: 'comp1'
-      });
-      controller.sendStopComponentCommand(component, '');
-      expect(App.ajax.send.calledOnce).to.be.true;
-    });
-  });
-
   describe('#restartComponent()', function () {
 
     beforeEach(function () {
@@ -826,34 +612,53 @@ describe('App.MainHostDetailsController', function () {
   });
 
   describe('#getZkServerHosts()', function () {
-    controller.set('content', {});
+
+    beforeEach(function() {
+      controller.set('content', {});
+    });
+
+    afterEach(function() {
+      App.HostComponent.find.restore();
+    });
 
     it('No ZooKeeper hosts, fromDeleteHost = false', function () {
-      App.HostComponent.find().clear();
+      sinon.stub(App.HostComponent, 'find', function() {return []});
       controller.set('fromDeleteHost', false);
       expect(controller.getZkServerHosts()).to.be.empty;
     });
+
     it('No ZooKeeper hosts, fromDeleteHost = true', function () {
+      sinon.stub(App.HostComponent, 'find', function() {return []});
       controller.set('fromDeleteHost', true);
       expect(controller.getZkServerHosts()).to.be.empty;
       expect(controller.get('fromDeleteHost')).to.be.false;
     });
+
     it('One ZooKeeper host, fromDeleteHost = false', function () {
       controller.set('fromDeleteHost', false);
-      App.store.load(App.HostComponent, {
-        id: 'ZOOKEEPER_SERVER_host1',
-        component_name: 'ZOOKEEPER_SERVER',
-        host_id: 'host1'
-      });
+      sinon.stub(App.HostComponent, 'find', function() {return [{id: 'ZOOKEEPER_SERVER_host1',
+        componentName: 'ZOOKEEPER_SERVER',
+        hostName: 'host1'
+      }]});
       expect(controller.getZkServerHosts()).to.eql(['host1']);
     });
+
     it('One ZooKeeper host match current host name, fromDeleteHost = true', function () {
+      sinon.stub(App.HostComponent, 'find', function() {return [{id: 'ZOOKEEPER_SERVER_host1',
+        componentName: 'ZOOKEEPER_SERVER',
+        hostName: 'host1'
+      }]});
       controller.set('fromDeleteHost', true);
       controller.set('content.hostName', 'host1');
       expect(controller.getZkServerHosts()).to.be.empty;
       expect(controller.get('fromDeleteHost')).to.be.false;
     });
+
     it('One ZooKeeper host does not match current host name, fromDeleteHost = true', function () {
+      sinon.stub(App.HostComponent, 'find', function() {return [{id: 'ZOOKEEPER_SERVER_host1',
+        componentName: 'ZOOKEEPER_SERVER',
+        hostName: 'host1'
+      }]});
       controller.set('fromDeleteHost', true);
       controller.set('content.hostName', 'host2');
       expect(controller.getZkServerHosts()[0]).to.equal("host1");
@@ -906,14 +711,11 @@ describe('App.MainHostDetailsController', function () {
     beforeEach(function () {
       sinon.stub(controller, "doDecommission", Em.K);
       sinon.stub(controller, "showBackgroundOperationsPopup", Em.K);
-      sinon.stub(controller, "doDecommissionRegionServer", Em.K);
     });
 
     afterEach(function () {
-      controller.doDecommissionRegionServer.restore();
       controller.doDecommission.restore();
       controller.showBackgroundOperationsPopup.restore();
-      controller.doDecommissionRegionServer.restore();
     });
 
     it('HDFS service', function () {
@@ -931,11 +733,6 @@ describe('App.MainHostDetailsController', function () {
       expect(controller.doDecommission.calledWith('host1', 'MAPREDUCE', "JOBTRACKER", "TASKTRACKER")).to.be.true;
       expect(controller.showBackgroundOperationsPopup.calledOnce).to.be.true;
     });
-    it('HBASE service', function () {
-      controller.runDecommission('host1', 'HBASE');
-      expect(controller.doDecommissionRegionServer.calledWith('host1', 'HBASE', "HBASE_MASTER", "HBASE_REGIONSERVER")).to.be.true;
-      expect(controller.showBackgroundOperationsPopup.calledOnce).to.be.true;
-    });
   });
 
   describe('#runRecommission()', function () {
@@ -1007,36 +804,36 @@ describe('App.MainHostDetailsController', function () {
   /**
    * TODO uncomment test when final rules will be implemented into warnBeforeDecommission function
    */
- /* describe('#warnBeforeDecommission()', function () {
-
-    beforeEach(function () {
-      sinon.stub(controller, "doDecommissionRegionServer", Em.K);
-      sinon.stub(App.ModalPopup, "show", Em.K);
-    });
-    afterEach(function () {
-      App.ModalPopup.show.restore();
-      controller.doDecommissionRegionServer.restore();
-    });
-
-    it('Component in passive state', function () {
-      controller.set('content.hostComponents', [Em.Object.create({
-        componentName: 'HBASE_REGIONSERVER',
-        passiveState: 'ON'
-      })]);
-      controller.warnBeforeDecommission('host1', 'HBASE', 'HBASE_REGIONSERVER', 'SLAVE');
-      expect(App.ModalPopup.show.called).to.be.false;
-      expect(controller.doDecommissionRegionServer.calledWith('host1', 'HBASE', 'HBASE_REGIONSERVER', 'SLAVE')).to.be.true;
-    });
-    it('Component is not in passive state', function () {
-      controller.set('content.hostComponents', [Em.Object.create({
-        componentName: 'HBASE_REGIONSERVER',
-        passiveState: 'OFF'
-      })]);
-      controller.warnBeforeDecommission('host1', 'HBASE', 'HBASE_REGIONSERVER', 'SLAVE');
-      expect(App.ModalPopup.show.calledOnce).to.be.true;
-      expect(controller.doDecommissionRegionServer.called).to.be.false;
-    });
-  });*/
+  /* describe('#warnBeforeDecommission()', function () {
+
+   beforeEach(function () {
+   sinon.stub(controller, "doDecommissionRegionServer", Em.K);
+   sinon.stub(App.ModalPopup, "show", Em.K);
+   });
+   afterEach(function () {
+   App.ModalPopup.show.restore();
+   controller.doDecommissionRegionServer.restore();
+   });
+
+   it('Component in passive state', function () {
+   controller.set('content.hostComponents', [Em.Object.create({
+   componentName: 'HBASE_REGIONSERVER',
+   passiveState: 'ON'
+   })]);
+   controller.warnBeforeDecommission('host1', 'HBASE', 'HBASE_REGIONSERVER', 'SLAVE');
+   expect(App.ModalPopup.show.called).to.be.false;
+   expect(controller.doDecommissionRegionServer.calledWith('host1', 'HBASE', 'HBASE_REGIONSERVER', 'SLAVE')).to.be.true;
+   });
+   it('Component is not in passive state', function () {
+   controller.set('content.hostComponents', [Em.Object.create({
+   componentName: 'HBASE_REGIONSERVER',
+   passiveState: 'OFF'
+   })]);
+   controller.warnBeforeDecommission('host1', 'HBASE', 'HBASE_REGIONSERVER', 'SLAVE');
+   expect(App.ModalPopup.show.calledOnce).to.be.true;
+   expect(controller.doDecommissionRegionServer.called).to.be.false;
+   });
+   });*/
 
   describe('#doRecommissionAndStart()', function () {
 
@@ -1116,42 +913,49 @@ describe('App.MainHostDetailsController', function () {
       controller.doAction(option);
       expect(controller.validateAndDeleteHost.calledOnce).to.be.true;
     });
+
     it('"startAllComponents" action, isNotHeartBeating = false', function () {
       var option = {context: {action: "startAllComponents"}};
-      controller.set('content.isNotHeartBeating', false);
+      controller.set('content', {isNotHeartBeating: false});
       controller.doAction(option);
       expect(controller.doStartAllComponents.calledOnce).to.be.true;
     });
+
     it('"startAllComponents" action, isNotHeartBeating = true', function () {
       var option = {context: {action: "startAllComponents"}};
-      controller.set('content.isNotHeartBeating', true);
+      controller.set('content', {isNotHeartBeating: true});
       controller.doAction(option);
       expect(controller.doStartAllComponents.called).to.be.false;
     });
+
     it('"stopAllComponents" action, isNotHeartBeating = false', function () {
       var option = {context: {action: "stopAllComponents"}};
-      controller.set('content.isNotHeartBeating', false);
+      controller.set('content', {isNotHeartBeating: false});
       controller.doAction(option);
       expect(controller.doStopAllComponents.calledOnce).to.be.true;
     });
+
     it('"stopAllComponents" action, isNotHeartBeating = true', function () {
       var option = {context: {action: "stopAllComponents"}};
-      controller.set('content.isNotHeartBeating', true);
+      controller.set('content', {isNotHeartBeating: true});
       controller.doAction(option);
       expect(controller.doStopAllComponents.called).to.be.false;
     });
+
     it('"restartAllComponents" action, isNotHeartBeating = false', function () {
       var option = {context: {action: "restartAllComponents"}};
-      controller.set('content.isNotHeartBeating', false);
+      controller.set('content', {isNotHeartBeating: false});
       controller.doAction(option);
       expect(controller.doRestartAllComponents.calledOnce).to.be.true;
     });
+
     it('"restartAllComponents" action, isNotHeartBeating = true', function () {
       var option = {context: {action: "restartAllComponents"}};
-      controller.set('content.isNotHeartBeating', true);
+      controller.set('content', {isNotHeartBeating: true});
       controller.doAction(option);
       expect(controller.doRestartAllComponents.called).to.be.false;
     });
+
     it('"onOffPassiveModeForHost" action', function () {
       var option = {context: {action: "onOffPassiveModeForHost"}};
       controller.doAction(option);
@@ -1203,32 +1007,27 @@ describe('App.MainHostDetailsController', function () {
 
     beforeEach(function () {
       sinon.stub(App, "showConfirmationPopup", Em.K);
-      sinon.stub(controller, "sendStartComponentCommand", Em.K);
+      controller.reopen({serviceActiveComponents: []});
     });
     afterEach(function () {
       App.showConfirmationPopup.restore();
-      controller.sendStartComponentCommand.restore();
     });
 
-    it('serviceNonClientActiveComponents is null', function () {
+    it('serviceNonClientActiveComponents is empty', function () {
       controller.reopen({
         serviceNonClientActiveComponents: []
       });
-      controller.set('serviceNonClientActiveComponents', null);
-      controller.doStartAllComponents();
-      expect(App.showConfirmationPopup.called).to.be.false;
-    });
-    it('serviceNonClientActiveComponents is empty', function () {
-      controller.set('serviceNonClientActiveComponents', []);
       controller.doStartAllComponents();
       expect(App.showConfirmationPopup.called).to.be.false;
     });
     it('serviceNonClientActiveComponents is correct', function () {
-      controller.set('serviceNonClientActiveComponents', [{}]);
+      controller.reopen({
+        serviceNonClientActiveComponents: [{}]
+      });
       var popup = controller.doStartAllComponents();
       expect(App.showConfirmationPopup.calledOnce).to.be.true;
       /*popup.onPrimary();
-      expect(controller.sendStartComponentCommand.calledWith([{}])).to.be.true;*/
+       expect(controller.sendStartComponentCommand.calledWith([{}])).to.be.true;*/
     });
   });
 
@@ -1236,29 +1035,28 @@ describe('App.MainHostDetailsController', function () {
 
     beforeEach(function () {
       sinon.stub(App, "showConfirmationPopup", Em.K);
-      sinon.stub(controller, "sendStartComponentCommand", Em.K);
+      controller.reopen({serviceActiveComponents: []});
     });
     afterEach(function () {
       App.showConfirmationPopup.restore();
-      controller.sendStartComponentCommand.restore();
     });
 
-    it('serviceNonClientActiveComponents is null', function () {
-      controller.set('serviceNonClientActiveComponents', null);
-      controller.doStopAllComponents();
-      expect(App.showConfirmationPopup.called).to.be.false;
-    });
     it('serviceNonClientActiveComponents is empty', function () {
-      controller.set('serviceNonClientActiveComponents', []);
+      controller.reopen({
+        serviceNonClientActiveComponents: []
+      });
       controller.doStopAllComponents();
       expect(App.showConfirmationPopup.called).to.be.false;
     });
+
     it('serviceNonClientActiveComponents is correct', function () {
-      controller.set('serviceNonClientActiveComponents', [{}]);
+      controller.reopen({
+        serviceNonClientActiveComponents: [{}]
+      });
       var popup = controller.doStopAllComponents();
       expect(App.showConfirmationPopup.calledOnce).to.be.true;
       /*popup.onPrimary();
-      expect(controller.sendStopComponentCommand.calledWith([{}])).to.be.true;*/
+       expect(controller.sendStopComponentCommand.calledWith([{}])).to.be.true;*/
     });
   });
 
@@ -1266,25 +1064,23 @@ describe('App.MainHostDetailsController', function () {
 
     beforeEach(function () {
       sinon.stub(App, "showConfirmationPopup", Em.K);
-      sinon.stub(controller, "sendStartComponentCommand", Em.K);
     });
     afterEach(function () {
       App.showConfirmationPopup.restore();
-      controller.sendStartComponentCommand.restore();
     });
 
-    it('serviceActiveComponents is null', function () {
-      controller.set('serviceActiveComponents', null);
-      controller.doRestartAllComponents();
-      expect(App.showConfirmationPopup.called).to.be.false;
-    });
     it('serviceActiveComponents is empty', function () {
-      controller.set('serviceActiveComponents', []);
+      controller.reopen({
+        serviceActiveComponents: []
+      });
       controller.doRestartAllComponents();
       expect(App.showConfirmationPopup.called).to.be.false;
     });
+
     it('serviceActiveComponents is correct', function () {
-      controller.set('serviceActiveComponents', [{}]);
+      controller.reopen({
+        serviceActiveComponents: [{}]
+      });
       var popup = controller.doRestartAllComponents();
       expect(App.showConfirmationPopup.calledOnce).to.be.true;
       /*popup.onPrimary();
@@ -1304,73 +1100,103 @@ describe('App.MainHostDetailsController', function () {
     };
 
     it('content.hostComponents is null', function () {
-      controller.set('content.hostComponents', null);
+      controller.set('content', {hostComponents: null});
       expect(controller.getHostComponentsInfo()).to.eql(result);
     });
     it('content.hostComponents is empty', function () {
-      controller.set('content.hostComponents', []);
+      controller.set('content', {hostComponents :[]});
       expect(controller.getHostComponentsInfo()).to.eql(result);
     });
     it('content.hostComponents has ZOOKEEPER_SERVER', function () {
       App.HostComponent.find().clear();
-      controller.set('content.hostComponents', [Em.Object.create({
+      controller.set('content', {hostComponents: [Em.Object.create({
         componentName: 'ZOOKEEPER_SERVER',
         workStatus: 'INIT',
         isDeletable: true
-      })]);
+      })]});
       expect(controller.getHostComponentsInfo().zkServerInstalled).to.be.true;
     });
     it('content.hostComponents has last component', function () {
-      App.store.load(App.HostComponent, {
-        id: 'TASKTRACKER_host1',
-        component_name: 'TASKTRACKER'
+      sinon.stub(App.HostComponent, 'find', function() {
+        return [{
+          id: 'TASKTRACKER_host1',
+          componentName: 'TASKTRACKER'
+        }];
       });
-      controller.set('content.hostComponents', [Em.Object.create({
+      controller.set('content', {hostComponents: [Em.Object.create({
         componentName: 'TASKTRACKER',
         displayName: 'TaskTracker',
         workStatus: 'INIT',
         isDeletable: true
-      })]);
+      })]});
       expect(controller.getHostComponentsInfo().lastComponents).to.eql(['TaskTracker']);
-      App.HostComponent.find().clear();
+      App.HostComponent.find.restore();
     });
     it('content.hostComponents has master non-deletable component', function () {
-      controller.set('content.hostComponents', [Em.Object.create({
+      sinon.stub(App.HostComponent, 'find', function() {
+        return [{
+          id: 'TASKTRACKER_host1',
+          componentName: 'TASKTRACKER'
+        }];
+      });
+      controller.set('content', {hostComponents :[Em.Object.create({
         componentName: 'TASKTRACKER',
         workStatus: 'INIT',
         isDeletable: false,
         isMaster: true,
         displayName: 'ZK1'
-      })]);
+      })]});
       expect(controller.getHostComponentsInfo().masterComponents).to.eql(['ZK1']);
       expect(controller.getHostComponentsInfo().nonDeletableComponents).to.eql(['ZK1']);
+      App.HostComponent.find.restore();
     });
     it('content.hostComponents has running component', function () {
-      controller.set('content.hostComponents', [Em.Object.create({
+      sinon.stub(App.HostComponent, 'find', function() {
+        return [{
+          id: 'TASKTRACKER_host1',
+          componentName: 'TASKTRACKER'
+        }];
+      });
+      controller.set('content', {hostComponents: [Em.Object.create({
         componentName: 'TASKTRACKER',
         workStatus: 'STARTED',
         isDeletable: true,
         displayName: 'ZK1'
-      })]);
+      })]});
       expect(controller.getHostComponentsInfo().runningComponents).to.eql(['ZK1']);
+      App.HostComponent.find.restore();
     });
     it('content.hostComponents has non-deletable component', function () {
-      controller.set('content.hostComponents', [Em.Object.create({
+      sinon.stub(App.HostComponent, 'find', function() {
+        return [{
+          id: 'TASKTRACKER_host1',
+          componentName: 'TASKTRACKER'
+        }];
+      });
+      controller.set('content', {hostComponents: [Em.Object.create({
         componentName: 'TASKTRACKER',
         workStatus: 'INIT',
         isDeletable: false,
         displayName: 'ZK1'
-      })]);
+      })]});
       expect(controller.getHostComponentsInfo().nonDeletableComponents).to.eql(['ZK1']);
+      App.HostComponent.find.restore();
     });
     it('content.hostComponents has component with UNKNOWN state', function () {
-      controller.set('content.hostComponents', [Em.Object.create({
+      sinon.stub(App.HostComponent, 'find', function() {
+        return [{
+          id: 'TASKTRACKER_host1',
+          componentName: 'TASKTRACKER'
+        }];
+      });
+      controller.set('content', {hostComponents: [Em.Object.create({
         componentName: 'TASKTRACKER',
         workStatus: 'UNKNOWN',
         isDeletable: false,
         displayName: 'ZK1'
-      })]);
+      })]});
       expect(controller.getHostComponentsInfo().unknownComponents).to.eql(['ZK1']);
+      App.HostComponent.find.restore();
     });
   });
 
@@ -1429,8 +1255,8 @@ describe('App.MainHostDetailsController', function () {
       });
       var popup = controller.validateAndDeleteHost();
       expect(App.showConfirmationPopup.calledOnce).to.be.true;
-     /* popup.onPrimary();
-      expect(controller._doDeleteHost.calledWith([], [])).to.be.true;*/
+      /* popup.onPrimary();
+       expect(controller._doDeleteHost.calledWith([], [])).to.be.true;*/
     });
     it('zkServerInstalled = false', function () {
       controller.set('mockHostComponentsInfo', {
@@ -1488,7 +1314,7 @@ describe('App.MainHostDetailsController', function () {
     });
 
     it('popup should be displayed', function () {
-      controller.set('content.componentsWithStaleConfigs', [{}]);
+      controller.set('content', {componentsWithStaleConfigs :[{}]});
       var popup = controller.restartAllStaleConfigComponents();
       expect(App.showConfirmationPopup.calledOnce).to.be.true;
       popup.onPrimary();

http://git-wip-us.apache.org/repos/asf/ambari/blob/566e754e/ambari-web/test/controllers/main/host_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host_test.js b/ambari-web/test/controllers/main/host_test.js
index adb51d0..71401f7 100644
--- a/ambari-web/test/controllers/main/host_test.js
+++ b/ambari-web/test/controllers/main/host_test.js
@@ -18,7 +18,6 @@
 
 var App = require('app');
 var validator = require('utils/validator');
-require('utils/component');
 require('utils/batch_scheduled_requests');
 require('controllers/main/host');
 require('mappers/server_data_mapper');
@@ -309,20 +308,20 @@ describe('MainHostController', function () {
     });
 
     var message = '`{0}` should convert to `{1}`',
-        tests = [
-      { value: '.*', expected: '.*' },
-      { value: '.', expected: '.*' },
-      { value: '.*.*', expected: '.*' },
-      { value: '*', expected: '^$' },
-      { value: '........', expected: '.*' },
-      { value: '........*', expected: '.*' },
-      { value: 'a1', expected: '.*a1.*' },
-      { value: 'a1.', expected: '.*a1.*' },
-      { value: 'a1...', expected: '.*a1.*' },
-      { value: 'a1.*', expected: '.*a1.*' },
-      { value: 'a1.*.a2.a3', expected: '.*a1.*.a2.a3.*' },
-      { value: 'a1.*.a2...a3', expected: '.*a1.*.a2...a3.*' }
-    ]
+      tests = [
+        { value: '.*', expected: '.*' },
+        { value: '.', expected: '.*' },
+        { value: '.*.*', expected: '.*' },
+        { value: '*', expected: '^$' },
+        { value: '........', expected: '.*' },
+        { value: '........*', expected: '.*' },
+        { value: 'a1', expected: '.*a1.*' },
+        { value: 'a1.', expected: '.*a1.*' },
+        { value: 'a1...', expected: '.*a1.*' },
+        { value: 'a1.*', expected: '.*a1.*' },
+        { value: 'a1.*.a2.a3', expected: '.*a1.*.a2.a3.*' },
+        { value: 'a1.*.a2...a3', expected: '.*a1.*.a2...a3.*' }
+      ]
 
     tests.forEach(function(test){
       it(message.format(test.value, test.expected), function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/566e754e/ambari-web/test/controllers/main/mirroring/edit_dataset_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/mirroring/edit_dataset_controller_test.js b/ambari-web/test/controllers/main/mirroring/edit_dataset_controller_test.js
index f898e1f..c4f783d 100644
--- a/ambari-web/test/controllers/main/mirroring/edit_dataset_controller_test.js
+++ b/ambari-web/test/controllers/main/mirroring/edit_dataset_controller_test.js
@@ -318,10 +318,10 @@ describe('App.MainMirroringEditDataSetController', function () {
       var startDate = new Date('01/19/2038 03:15 AM').toISOString().replace(/\:\d{2}\.\d{3}/, '');
       var endDate = new Date('01/19/2039 03:15 AM').toISOString().replace(/\:\d{2}\.\d{3}/, '');
       var expectedResult = '<?xml version="1.0"?><feed description="" name="' + App.mirroringDatasetNamePrefix + 'test" xmlns="uri:falcon:feed:0.1"><frequency>days(1)' +
-          '</frequency><clusters><cluster name="' + App.get('clusterName') + '" type="source"><validity start="' + startDate + '" end="' + endDate +
-          '"/><retention limit="days(7)" action="delete"/></cluster><cluster name="test" type="target"><validity start="' + startDate + '" end="' + endDate +
-          '"/><retention limit="months(1)" action="delete"/><locations><location type="data" path="/test" /></locations></cluster></clusters><locations><location type="data" path="' +
-          '/test" /></locations><ACL owner="hue" group="users" permission="0755" /><schema location="/none" provider="none"/></feed>';
+        '</frequency><clusters><cluster name="' + App.get('clusterName') + '" type="source"><validity start="' + startDate + '" end="' + endDate +
+        '"/><retention limit="days(7)" action="delete"/></cluster><cluster name="test" type="target"><validity start="' + startDate + '" end="' + endDate +
+        '"/><retention limit="months(1)" action="delete"/><locations><location type="data" path="/test" /></locations></cluster></clusters><locations><location type="data" path="' +
+        '/test" /></locations><ACL owner="hue" group="users" permission="0755" /><schema location="/none" provider="none"/></feed>';
       var result = mainMirroringEditDataSetController.createDatasetXML();
       expect(result).to.equal(expectedResult);
     });
@@ -407,10 +407,6 @@ describe('App.MainMirroringEditDataSetController', function () {
   });
 
   describe('#saveDisabled', function () {
-    it('should return false if there are no errors', function () {
-      var mainMirroringEditDataSetController = App.MainMirroringEditDataSetController.create({});
-      expect(mainMirroringEditDataSetController.get('saveDisabled')).to.be.false;
-    });
     it('should return true if there are some errors', function () {
       var mainMirroringEditDataSetController = App.MainMirroringEditDataSetController.create();
       mainMirroringEditDataSetController.set('errors.isNameError', true);

http://git-wip-us.apache.org/repos/asf/ambari/blob/566e754e/ambari-web/test/controllers/main/service/add_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/add_controller_test.js b/ambari-web/test/controllers/main/service/add_controller_test.js
index 8b6b9b9..88d7bbc 100644
--- a/ambari-web/test/controllers/main/service/add_controller_test.js
+++ b/ambari-web/test/controllers/main/service/add_controller_test.js
@@ -27,103 +27,6 @@ describe('App.AddServiceController', function() {
     addServiceController = App.AddServiceController.create({});
   });
 
-  describe('#isServiceConfigurable', function() {
-    var tests = [
-      {
-        services: [
-          {serviceName: 'HDFS'},
-          {serviceName: 'MAPREDUCE'},
-          {serviceName: 'NAGIOS'}
-        ],
-        service: 'HDFS',
-        m: 'Service is configurable',
-        e: true
-      },
-      {
-        services: [
-          {serviceName: 'HDFS'},
-          {serviceName: 'MAPREDUCE'},
-          {serviceName: 'NAGIOS'}
-        ],
-        service: 'PIG',
-        m: 'Service is not configurable',
-        e: false
-      },
-      {
-        services: [],
-        service: 'HDFS',
-        m: 'No services',
-        e: false
-      }
-    ];
-    tests.forEach(function(test) {
-      var controller = App.AddServiceController.create({serviceConfigs: test.services});
-      it('', function() {
-        expect(controller.isServiceConfigurable(test.service)).to.equal(test.e);
-      });
-    });
-  });
-
-  describe('#skipConfigStep', function() {
-    var tests = [
-      {
-        content: {
-          services:[
-            {serviceName: 'HDFS', isInstalled: true, isSelected: true},
-            {serviceName: 'PIG', isInstalled: false, isSelected: true},
-            {serviceName: 'MAPREDUCE', isInstalled: true, isSelected: true}
-          ]
-        },
-        serviceConfigs: [
-          {serviceName: 'HDFS'},
-          {serviceName: 'MAPREDUCE'},
-          {serviceName: 'NAGIOS'}
-        ],
-        m: '2 installed services and 1 new that can\'t be configured',
-        e: true
-      },
-      {
-        content: {
-          services:[
-            {serviceName: 'HDFS', isInstalled: true, isSelected: true},
-            {serviceName: 'NAGIOS', isInstalled: false, isSelected: true},
-            {serviceName: 'MAPREDUCE', isInstalled: true, isSelected: true}
-          ]
-        },
-        serviceConfigs: [
-          {serviceName: 'HDFS'},
-          {serviceName: 'MAPREDUCE'},
-          {serviceName: 'NAGIOS'}
-        ],
-        m: '2 installed services and 1 new that can be configured',
-        e: false
-      },
-      {
-        content: {
-          services:[
-            {serviceName: 'HDFS', isInstalled: true, isSelected: true},
-            {serviceName: 'PIG', isInstalled: false, isSelected: true},
-            {serviceName: 'SQOOP', isInstalled: false, isSelected: true},
-            {serviceName: 'MAPREDUCE', isInstalled: true, isSelected: true}
-          ]
-        },
-        serviceConfigs: [
-          {serviceName: 'HDFS'},
-          {serviceName: 'MAPREDUCE'},
-          {serviceName: 'NAGIOS'}
-        ],
-        m: '2 installed services and 2 new that can\'t be configured',
-        e: true
-      }
-    ];
-    tests.forEach(function(test) {
-      var controller = App.AddServiceController.create({content:{services: test.content.services}, serviceConfigs: test.serviceConfigs});
-      it(test.m, function() {
-        expect(controller.skipConfigStep()).to.equal(test.e);
-      })
-    });
-  });
-
   describe('#installAdditionalClients', function() {
 
     var t = {
@@ -132,7 +35,13 @@ describe('App.AddServiceController', function() {
         hostName: "hostName"
       },
       RequestInfo: {
-        "context": Em.I18n.t('requestInfo.installHostComponent') + " hostName"
+        "context": Em.I18n.t('requestInfo.installHostComponent') + " hostName",
+        "operation_level": {
+          "level": "HOST_COMPONENT",
+          "cluster_name": "tdk",
+          "host_name": "hostName",
+          "service_name": "TEZ"
+        }
       },
       Body: {
         HostRoles: {
@@ -143,10 +52,15 @@ describe('App.AddServiceController', function() {
 
     beforeEach(function () {
       sinon.spy($, 'ajax');
+      sinon.stub(App, 'get', function(k) {
+        if ('clusterName' === k) return 'tdk';
+        return Em.get(App, k);
+      });
     });
 
     afterEach(function () {
       $.ajax.restore();
+      App.get.restore();
     });
 
     it('send request to install client', function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/566e754e/ambari-web/test/controllers/main/service/info/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/info/config_test.js b/ambari-web/test/controllers/main/service/info/config_test.js
index 38f1415..c3f67bb 100644
--- a/ambari-web/test/controllers/main/service/info/config_test.js
+++ b/ambari-web/test/controllers/main/service/info/config_test.js
@@ -118,7 +118,6 @@ describe("App.MainServiceInfoConfigsController", function () {
       }
     ];
 
-    var rRoute = App.router.route;
     beforeEach(function () {
       sinon.stub(mainServiceInfoConfigsController, "restartServicePopup", Em.K);
       sinon.stub(mainServiceInfoConfigsController, "selectConfigGroup", Em.K);
@@ -131,7 +130,6 @@ describe("App.MainServiceInfoConfigsController", function () {
       mainServiceInfoConfigsController.restartServicePopup.restore();
       mainServiceInfoConfigsController.selectConfigGroup.restore();
       mainServiceInfoConfigsController.getHash.restore();
-      App.router.route = rRoute;
     });
 
     tests.forEach(function (t) {
@@ -441,9 +439,7 @@ describe("App.MainServiceInfoConfigsController", function () {
           hostComponents: [
             Em.Object.create({
               componentName: "componentName1",
-              host: {
-                hostName: "hostName"
-              }
+              hostName: "hostName"
             })
           ]
         },
@@ -456,15 +452,11 @@ describe("App.MainServiceInfoConfigsController", function () {
           hostComponents: [
             Em.Object.create({
               componentName: "componentName2",
-              host: {
-                  hostName: "hostName1"
-              }
+              hostName: "hostName1"
             }),
             Em.Object.create({
               componentName: "componentName2",
-              host: {
-                hostName: "hostName2"
-              }
+              hostName: "hostName2"
             })
           ]
         },
@@ -591,68 +583,6 @@ describe("App.MainServiceInfoConfigsController", function () {
     });
   });
 
-  describe("#createGlobalSiteObj", function () {
-
-    var t = {
-      tagName: "version1",
-      globalConfigs: Em.A([
-        Em.Object.create({
-          name: "property1",
-          value: "value1"
-        }),
-        Em.Object.create({
-          name: "property2",
-          value: "value2&lt;"
-        }),
-        Em.Object.create({
-          name: "some_heapsize",
-          value: "1000"
-        }),
-        Em.Object.create({
-          name: "some_newsize",
-          value: "1000"
-        }),
-        Em.Object.create({
-          name: "some_maxnewsize",
-          value: "1000"
-        }),
-        Em.Object.create({
-          name: "hadoop_heapsize",
-          value: "1000"
-        })
-      ]),
-      result: {
-        "type": "global",
-        "tag": "version1",
-        "properties": {
-          "property1": "value1",
-          "property2": "value2<",
-          "some_heapsize": "1000m",
-          "some_newsize": "1000m",
-          "some_maxnewsize": "1000m",
-          "hadoop_heapsize": "1000"
-        }
-      }
-    };
-    it("create global object", function () {
-      expect(mainServiceInfoConfigsController.createGlobalSiteObj(t.tagName, t.globalConfigs)).to.deep.eql(t.result);
-    });
-  });
-
-  describe("#doPUTClusterConfigurationSiteErrorCallback", function () {
-    it("set doPUTClusterConfigurationSiteResult to false", function () {
-      mainServiceInfoConfigsController.doPUTClusterConfigurationSiteErrorCallback({responseText: ""});
-      expect(mainServiceInfoConfigsController.get("doPUTClusterConfigurationSiteResult")).to.equal(false);
-    });
-  });
-
-  describe("#doPUTClusterConfigurationSiteSuccessCallback", function () {
-    it("set doPUTClusterConfigurationSiteResult to true", function () {
-      mainServiceInfoConfigsController.doPUTClusterConfigurationSiteSuccessCallback();
-      expect(mainServiceInfoConfigsController.get("doPUTClusterConfigurationSiteResult")).to.equal(true);
-    });
-  });
-
   describe("#doPUTClusterConfigurationSite", function () {
     var t = {
       data: "data",
@@ -662,16 +592,15 @@ describe("App.MainServiceInfoConfigsController", function () {
         }
       }
     };
-    var temp = App.router.getClusterName;
     beforeEach(function () {
-      App.router.getClusterName = function () {
-        return "clName";
-      };
+      sinon.stub(App.router, 'getClusterName', function() {
+        return 'clName';
+      });
       sinon.spy($, "ajax");
     });
     afterEach(function () {
       $.ajax.restore();
-      App.router.getClusterName = temp;
+      App.router.getClusterName.restore();
     });
     it("ajax request to put clsuter cfg", function () {
       expect(mainServiceInfoConfigsController.doPUTClusterConfigurationSite(t.data)).to.equal(mainServiceInfoConfigsController.get("doPUTClusterConfigurationSiteResult"));
@@ -894,237 +823,9 @@ describe("App.MainServiceInfoConfigsController", function () {
 
   });
 
-  describe("#setHostForService", function () {
-    var tests = [
-      {
-        globalConfigs: [],
-        componentName: "ZOOKEEPER_SERVER",
-        serviceName: "ZOOKEEPER",
-        hostProperty: "zookeeperserver_hosts",
-        multiple: true,
-        result: ["hostName1", "hostName2"],
-        serviceConfigs: [
-          {
-            serviceName: "ZOOKEEPER",
-            configs: [
-              {
-                "name": "zookeeperserver_hosts",
-                "defaultValue": null
-              }
-            ]
-          }
-        ],
-        m: "set hostNames to globalConfigs for current service"
-      },
-      {
-        globalConfigs: [],
-        componentName: "STORM_UI_SERVER",
-        serviceName: "STORM",
-        hostProperty: "stormuiserver_host",
-        multiple: false,
-        result: "hostName1",
-        serviceConfigs: [
-          {
-            serviceName: "STORM",
-            configs: [
-              {
-                "name": "stormuiserver_host",
-                "defaultValue": null
-              }
-            ]
-          }
-        ],
-        m: "set hostName to globalConfigs for current service"
-      }
-    ];
-
-    beforeEach(function () {
-      sinon.stub(mainServiceInfoConfigsController, "getMasterComponentHostValue", function (a,m) {
-        if (m) {
-          return ["hostName1", "hostName2"];
-        } else {
-          return "hostName1";
-        }
-      });
-    });
-
-    afterEach(function () {
-      mainServiceInfoConfigsController.getMasterComponentHostValue.restore();
-    });
-
-    tests.forEach(function (t) {
-      it(t.m, function () {
-        mainServiceInfoConfigsController.set("globalConfigs", t.globalConfigs);
-        mainServiceInfoConfigsController.set("serviceConfigs", t.serviceConfigs);
-        mainServiceInfoConfigsController.setHostForService(t.serviceName, t.componentName, t.hostProperty, t.multiple);
-        expect(mainServiceInfoConfigsController.get("globalConfigs").findProperty("name", t.hostProperty).defaultValue).to.eql(t.result);
-
-      });
-    }, this);
-  });
-
-  describe("#addHostNamesToGlobalConfig", function () {
-    var tests = [
-      {
-        globalConfigs: [],
-        serviceName: "ZOOKEEPER",
-        hostProperty: "zookeeperserver_hosts",
-        nameNodeHost: "namenode_host",
-        serviceConfigs: [
-          {
-            serviceName: "ZOOKEEPER",
-            configs: [
-              {
-                "name": "zookeeperserver_hosts",
-                "defaultValue": null
-              },
-              {
-                "name": "namenode_host",
-                "defaultValue": null
-              }
-            ]
-          }
-        ],
-        result: ["hostName1", "hostName2"],
-        result2: ["hostName1", "hostName2"],
-        m: "set hostNames to globalConfigs for required services"
-      },
-      {
-        globalConfigs: [
-          {
-            "name": "hive_database",
-            "value": "Existing MySQL Database"
-          },
-          {
-            "name": "hive_hostname",
-            "isVisible": false
-          }
-        ],
-        serviceName: "HIVE",
-        hostProperty: "hivemetastore_host",
-        nameNodeHost: "namenode_host",
-        isVisible: true,
-        serviceConfigs: [
-          {
-            serviceName: "HIVE",
-            configs: [
-              {
-                "name": "hivemetastore_host",
-                "defaultValue": null
-              },
-              {
-                "name": "namenode_host",
-                "defaultValue": null
-              }
-            ]
-          }
-        ],
-        result: "hostName3",
-        result2: ["hostName1", "hostName2"],
-        m: "set hostNames to globalConfigs for required services and isVisible property for HIVE"
-      }
-    ];
-
-    beforeEach(function () {
-      mainServiceInfoConfigsController.set("content", Em.Object.create({}));
-      sinon.stub(mainServiceInfoConfigsController, "getMasterComponentHostValue", function (a,m) {
-        if (m) {
-          return ["hostName1", "hostName2"];
-        } else {
-          return "hostName3";
-        }
-      });
-    });
-
-    afterEach(function () {
-      mainServiceInfoConfigsController.getMasterComponentHostValue.restore();
-    });
-
-    tests.forEach(function (t) {
-      it(t.m, function () {
-        mainServiceInfoConfigsController.set("content.serviceName", t.serviceName);
-        mainServiceInfoConfigsController.set("globalConfigs", t.globalConfigs);
-        mainServiceInfoConfigsController.set("serviceConfigs", t.serviceConfigs);
-        mainServiceInfoConfigsController.addHostNamesToGlobalConfig();
-        expect(mainServiceInfoConfigsController.get("globalConfigs").findProperty("name", t.hostProperty).defaultValue).to.eql(t.result);
-        expect(mainServiceInfoConfigsController.get("globalConfigs").findProperty("name", t.nameNodeHost).defaultValue).to.eql(t.result2);
-        if (t.serviceName == "HIVE" || t.serviceName == "OOZIE") {
-          expect(mainServiceInfoConfigsController.get("globalConfigs").findProperty("name", t.hostProperty).isVisible).to.eql(t.isVisible);
-        }
-      });
-    }, this);
-  });
-
-  describe("#doPUTClusterConfiguration", function () {
-    var tests = [
-      {
-        configs: {
-          properties: {
-            property1: "1001",
-            property2: "text"
-          }
-        },
-        siteName: "global",
-        r: true,
-        m: "save changed properties"
-      },
-      {
-        configs: {
-          properties: {
-            property1: "1000",
-            property2: "text"
-          }
-        },
-        siteName: "global",
-        r: true,
-        m: "skip saving becouse nothing changed (returns true)"
-      },
-      {
-        configs: {
-          properties: {
-            property1: "1001",
-            property2: "text"
-          },
-          success: false
-        },
-        siteName: "global",
-        r: false,
-        m: "saving failed"
-      }
-    ];
-    var getConfigsByTags = {
-      property1: "1000",
-      property2: "text"
-    }
-    beforeEach(function () {
-      sinon.stub(App.router.get('configurationController'), "getConfigsByTags", function () {
-        return getConfigsByTags
-      });
-      sinon.stub(mainServiceInfoConfigsController, "doPUTClusterConfigurationSite", function (k) {
-        return k.success !== false;
-      });
-    });
-
-    afterEach(function () {
-      mainServiceInfoConfigsController.doPUTClusterConfigurationSite.restore();
-      App.router.get('configurationController').getConfigsByTags.restore();
-    });
-    tests.forEach(function (t) {
-      it(t.m, function () {
-        var siteNameToServerDataMap = {};
-        expect(mainServiceInfoConfigsController.doPUTClusterConfiguration(siteNameToServerDataMap, t.siteName, t.configs)).to.equal(t.r);
-        expect(siteNameToServerDataMap[t.siteName]).to.eql(t.configs);
-      })
-    });
-  });
-
   describe("#createConfigObject", function() {
     var tests = [
       {
-        siteName: "global",
-        method: "createGlobalSiteObj"
-      },
-      {
         siteName: "core-site",
         serviceName: "HDFS",
         method: "createCoreSiteObj"
@@ -1152,14 +853,12 @@ describe("App.MainServiceInfoConfigsController", function () {
 
     var capacitySchedulerUi = App.supports.capacitySchedulerUi;
     beforeEach(function() {
-      sinon.stub(mainServiceInfoConfigsController, "createGlobalSiteObj", Em.K);
       sinon.stub(mainServiceInfoConfigsController, "createCoreSiteObj", Em.K);
       sinon.stub(mainServiceInfoConfigsController, "createSiteObj", Em.K);
       mainServiceInfoConfigsController.set("content", {});
     });
 
     afterEach(function() {
-      mainServiceInfoConfigsController.createGlobalSiteObj.restore();
       mainServiceInfoConfigsController.createCoreSiteObj.restore();
       mainServiceInfoConfigsController.createSiteObj.restore();
       App.supports.capacitySchedulerUi = capacitySchedulerUi;
@@ -1173,7 +872,6 @@ describe("App.MainServiceInfoConfigsController", function () {
         if (t.method) {
           expect(mainServiceInfoConfigsController[t.method].calledOnce).to.equal(true);
         } else {
-          expect(mainServiceInfoConfigsController["createGlobalSiteObj"].calledOnce).to.equal(false);
           expect(mainServiceInfoConfigsController["createCoreSiteObj"].calledOnce).to.equal(false);
           expect(mainServiceInfoConfigsController["createSiteObj"].calledOnce).to.equal(false);
         }
@@ -1181,47 +879,6 @@ describe("App.MainServiceInfoConfigsController", function () {
     });
   });
 
-  describe("#doPUTClusterConfigurations", function() {
-
-    var t = {
-     propertyName: "global",
-     properties: {
-       propertu1: "text",
-       property2: 1000
-     },
-     serviceConfigTags: [{
-       siteName: "global",
-       tagName: "version1"
-     }]
-    };
-
-    beforeEach(function() {
-      sinon.stub(mainServiceInfoConfigsController, "createConfigObject", Em.K);
-      sinon.stub(mainServiceInfoConfigsController, "setNewTagNames", Em.K);
-      sinon.stub(mainServiceInfoConfigsController, "doPUTClusterConfiguration", function (siteNameToServerDataMap) {
-        siteNameToServerDataMap[t.propertyName] = t.properties;
-        return true;
-      });
-    });
-
-    afterEach(function() {
-      mainServiceInfoConfigsController.createConfigObject.restore();
-      mainServiceInfoConfigsController.setNewTagNames.restore();
-      mainServiceInfoConfigsController.doPUTClusterConfiguration.restore();
-    });
-
-    it("Saves cluster level configurations", function() {
-      var siteNameToServerDataMap = {};
-      siteNameToServerDataMap[t.propertyName] = t.properties;
-      mainServiceInfoConfigsController.set("serviceConfigTags", t.serviceConfigTags);
-      expect(mainServiceInfoConfigsController.doPUTClusterConfigurations()).to.equal(true);
-      expect(mainServiceInfoConfigsController["createConfigObject"].calledOnce).to.equal(true);
-      expect(mainServiceInfoConfigsController["setNewTagNames"].calledOnce).to.equal(true);
-      expect(mainServiceInfoConfigsController["doPUTClusterConfiguration"].calledOnce).to.equal(true);
-      expect(mainServiceInfoConfigsController.get("savedSiteNameToServerServiceConfigDataMap")).to.eql(siteNameToServerDataMap);
-    });
-  });
-
   describe("#putConfigGroupChanges", function() {
 
     var t = {
@@ -1250,14 +907,6 @@ describe("App.MainServiceInfoConfigsController", function () {
     });
   });
 
-  describe("#putConfigGroupChangesSuccess", function() {
-    it("set isPutConfigGroupChangesSuccess to true", function() {
-      mainServiceInfoConfigsController.set("mainServiceInfoConfigsController", false);
-      mainServiceInfoConfigsController.putConfigGroupChangesSuccess();
-      expect(mainServiceInfoConfigsController.get("isPutConfigGroupChangesSuccess")).to.equal(true);
-    });
-  });
-
   describe("#setValueForCheckBox", function() {
     var tests = [
       {
@@ -1267,8 +916,8 @@ describe("App.MainServiceInfoConfigsController", function () {
           displayType: 'checkbox'
         }),
         serviceConfigProperty: Em.Object.create({
-            value: true,
-            defaultValue: true,
+          value: true,
+          defaultValue: true,
           displayType: 'checkbox'
         })
       },
@@ -1366,77 +1015,6 @@ describe("App.MainServiceInfoConfigsController", function () {
     });
   });
 
-  describe("#setValidator", function () {
-    var tests = [
-      {
-        content: Em.Object.create({
-          serviceName: "service1"
-        }),
-        serviceConfigsData: {
-          configsValidator: Em.Object.create({
-            configValidators: {
-              val1: "yarnNodemanagerResourceMemoryMb",
-              val2: "yarnSchedulerMaximumAllocationMb"
-            }
-          })
-        },
-        serviceConfigPropertyInput: Em.Object.create({
-          serviceName: "service1",
-          name: "val1",
-          serviceValidator: null,
-          isVisible: true
-        }),
-        serviceConfigProperty: Em.Object.create({
-          serviceName: "service1",
-          name: "val1",
-          serviceValidator: Em.Object.create({
-            configValidators: {
-              val1: "yarnNodemanagerResourceMemoryMb",
-              val2: "yarnSchedulerMaximumAllocationMb"
-            }
-          }),
-          isVisible: true
-        }),
-
-        m: "set appropriate configsValidator "
-      },
-      {
-        content: Em.Object.create({
-          serviceName: "service"
-        }),
-        serviceConfigsData: {
-          configsValidator: Em.Object.create({
-            configValidators: {
-              val1: "yarnNodemanagerResourceMemoryMb",
-              val2: "yarnSchedulerMaximumAllocationMb"
-            }
-          })
-        },
-        serviceConfigPropertyInput: Em.Object.create({
-          serviceName: "service1",
-          name: "yarnNodemanagerResourceMemoryMb",
-          serviceValidator: null,
-          isVisible: true
-        }),
-        serviceConfigProperty: Em.Object.create({
-          serviceName: "service1",
-          name: "yarnNodemanagerResourceMemoryMb",
-          serviceValidator: null,
-          isVisible: false
-        }),
-        m: "different service "
-      }
-    ];
-    tests.forEach(function (t) {
-      it(t.m, function () {
-        mainServiceInfoConfigsController.set("content", t.content);
-        var serviceConfigProperty = t.serviceConfigPropertyInput;
-        mainServiceInfoConfigsController.setValidator(serviceConfigProperty, t.serviceConfigsData);
-        expect(serviceConfigProperty).to.deep.eql(t.serviceConfigProperty);
-      });
-    });
-  });
-
   describe("#checkOverrideProperty", function () {
     var tests = [{
       overrideToAdd: {
@@ -1493,71 +1071,6 @@ describe("App.MainServiceInfoConfigsController", function () {
     });
   });
 
-  describe("#setRecommendedDefaults", function() {
-    var tests = [{
-      content: Em.Object.create({
-        serviceName: "service1"
-      }),
-      serviceConfigsDataInput:[{
-        serviceName: "service1",
-        defaultsProviders: [
-          App.DefaultsProvider.create({
-            getDefaults: function() {
-            return {
-              p1: "-Xmx546m1",
-              p2: null
-            }
-          }
-          })
-        ],
-        configsValidator: Em.Object.create({
-          recommendedDefaults: null
-        })
-      }],
-      advancedConfigs: [
-        { name: "p1", value: "1"},
-        { name: "p2", value: "2"}
-      ],
-
-      serviceConfigsData:[{
-        serviceName: "service1",
-        defaultsProviders: [
-          App.DefaultsProvider.create({
-            getDefaults: function() {
-              return {
-                p1: "-Xmx546m1",
-                p2: null
-              }
-            }
-          })
-        ],
-        configsValidator: Em.Object.create({
-          recommendedDefaults: {
-            p1: "-Xmx546m1",
-            p2: "2"
-          }
-        })
-      }]
-    }];
-
-    beforeEach(function() {
-      sinon.stub(mainServiceInfoConfigsController, "getInfoForDefaults", Em.K);
-    });
-    afterEach(function() {
-      mainServiceInfoConfigsController.getInfoForDefaults.restore();
-    });
-    tests.forEach(function(t) {
-      it("", function() {
-        mainServiceInfoConfigsController.set("content", t.content);
-        mainServiceInfoConfigsController.set("serviceConfigsData", t.serviceConfigsDataInput);
-        mainServiceInfoConfigsController.setRecommendedDefaults(t.advancedConfigs);
-        expect(mainServiceInfoConfigsController.get("serviceConfigsData")[0].configsValidator).to.deep.eql(t.serviceConfigsData[0].configsValidator);
-
-      });
-    });
-  });
-
-
   describe("#setValuesForOverrides", function() {
     var tests = [
       {
@@ -1585,6 +1098,7 @@ describe("App.MainServiceInfoConfigsController", function () {
       });
     });
   });
+
   describe("#createConfigProperty", function() {
     var tests = [
       {
@@ -1603,14 +1117,12 @@ describe("App.MainServiceInfoConfigsController", function () {
       }];
     beforeEach(function() {
       sinon.stub(mainServiceInfoConfigsController, "setValueForCheckBox", Em.K);
-      sinon.stub(mainServiceInfoConfigsController, "setRestartInfo", Em.K);
       sinon.stub(mainServiceInfoConfigsController, "setValidator", Em.K);
       sinon.stub(mainServiceInfoConfigsController, "setValuesForOverrides", Em.K);
       sinon.stub(mainServiceInfoConfigsController, "setEditability", Em.K);
     });
     afterEach(function() {
       mainServiceInfoConfigsController.setValueForCheckBox.restore();
-      mainServiceInfoConfigsController.setRestartInfo.restore();
       mainServiceInfoConfigsController.setValidator.restore();
       mainServiceInfoConfigsController.setValuesForOverrides.restore();
       mainServiceInfoConfigsController.setEditability.restore();
@@ -1619,7 +1131,6 @@ describe("App.MainServiceInfoConfigsController", function () {
       it("create service config. run methods to correctly set object fileds", function() {
         var result = mainServiceInfoConfigsController.createConfigProperty(t._serviceConfigProperty, t.defaultGroupSelected, t.restartData, t.serviceConfigsData);
         expect(mainServiceInfoConfigsController.setValueForCheckBox.calledWith(t.serviceConfigProperty));
-        expect(mainServiceInfoConfigsController.setRestartInfo.calledWith(t.restartData, t.serviceConfigProperty));
         expect(mainServiceInfoConfigsController.setValidator.calledWith(t.serviceConfigProperty, t.serviceConfigsData));
         expect(mainServiceInfoConfigsController.setValuesForOverrides.calledWith(t._serviceConfigProperty.overrides, t._serviceConfigProperty, t.serviceConfigProperty, t.defaultGroupSelected));
         expect(mainServiceInfoConfigsController.setValidator.calledWith(t.serviceConfigProperty, t.defaultGroupSelected));

http://git-wip-us.apache.org/repos/asf/ambari/blob/566e754e/ambari-web/test/controllers/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js
index 40546b8..f052893 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -18,13 +18,13 @@
 
 App = require('app');
 require('ember');
-require('models/host_component')
+require('models/host_component');
 require('views/common/modal_popup');
 require('mixins/common/userPref');
 require('controllers/application');
 require('controllers/global/background_operations_controller');
 require('controllers/global/cluster_controller');
-require('controllers/main/service/reassign_controller')
+require('controllers/main/service/reassign_controller');
 require('controllers/main/service/item');
 var batchUtils = require('utils/batch_scheduled_requests');
 
@@ -106,39 +106,35 @@ describe('App.MainServiceItemController', function () {
       }
     ];
 
-
     tests.forEach(function (test) {
       it(test.m, function () {
-        var backgroundOperationsController = App.BackgroundOperationsController.create();
-        backgroundOperationsController.set('services', []);
-        test.backgroundOperationsController.services.forEach(function (service) {
-          backgroundOperationsController.get('services').push(service);
+        sinon.stub(App.router, 'get', function(k) {
+          if ('backgroundOperationsController.services' === k) return test.backgroundOperationsController.services;
+          return Em.get(App.router, k);
         });
-        backgroundOperationsController.set("serviceTimestamp", new Date().getTime());
-        App.router.set('backgroundOperationsController', backgroundOperationsController);
         var mainServiceItemController = App.MainServiceItemController.create({content: {serviceName: test.serviceController.serviceName}});
         mainServiceItemController.setStartStopState();
+        App.router.get.restore();
         expect(mainServiceItemController.get('isPending')).to.equal(test.isPending);
       });
     })
   });
 
   describe('#reassignMaster()', function () {
-    var v;
     var tests = [
       {
         host_components: [
-          {component_name: "RESOURCEMANGER"}
+          {componentName: "RESOURCEMANGER"}
         ],
-        conponentName: "RESOURCEMANGER",
+        componentName: "RESOURCEMANGER",
         result: true,
         m: 'run reassignMaster'
       },
       {
         host_components: [
-          {component_name: "RESOURCEMANGER"}
+          {componentName: "RESOURCEMANGER"}
         ],
-        conponentName: "DATANODE",
+        componentName: "DATANODE",
         result: false,
         m: 'don\t run reassignMaster'
       }
@@ -146,58 +142,40 @@ describe('App.MainServiceItemController', function () {
 
     tests.forEach(function (test) {
       var reassignMasterController = App.ReassignMasterController.create({currentStep: ''});
+
       beforeEach(function () {
-        sinon.spy(reassignMasterController, 'saveComponentToReassign');
-        sinon.spy(reassignMasterController, 'getSecurityStatus');
-        sinon.spy(reassignMasterController, 'setCurrentStep');
-        App.router.transitionTo = Em.K;
+        sinon.stub(reassignMasterController, 'saveComponentToReassign', Em.K);
+        sinon.stub(reassignMasterController, 'getSecurityStatus', Em.K);
+        sinon.stub(reassignMasterController, 'setCurrentStep', Em.K);
       });
+
       afterEach(function () {
         reassignMasterController.saveComponentToReassign.restore();
         reassignMasterController.getSecurityStatus.restore();
         reassignMasterController.setCurrentStep.restore();
-        App.router.transitionTo = v;
       });
+
       it(test.m, function () {
-        v = App.router.transitionTo;
+        sinon.stub(App.router, 'transitionTo', Em.K);
         var mainServiceItemController = App.MainServiceItemController.create({});
-        App.router.set('reassignMasterController', reassignMasterController);
-        App.store.loadMany(App.HostComponent, test.host_components);
-        mainServiceItemController.reassignMaster(test.conponentName);
+        sinon.stub(App.HostComponent, 'find', function() {
+          return test.host_components
+        });
+        sinon.stub(App.router, 'get', function(k) {
+          if ('reassignMasterController' === k) return reassignMasterController;
+          return Em.get(App.router, k);
+        });
+        mainServiceItemController.reassignMaster(test.componentName);
         expect(reassignMasterController.saveComponentToReassign.calledOnce).to.equal(test.result);
         expect(reassignMasterController.getSecurityStatus.calledOnce).to.equal(test.result);
         expect(reassignMasterController.setCurrentStep.calledOnce).to.equal(test.result);
+        App.HostComponent.find.restore();
+        App.router.transitionTo.restore();
+        App.router.get.restore();
       });
     }, this);
   });
 
-  describe("#updateService", function () {
-
-    var tests = [
-      {
-        params: {
-          passive_state: "ON"
-        },
-        m: "turn on passive"
-      },
-      {
-        params: {
-          passive_state: "OFF"
-        },
-        m: "turn off passive"
-      }
-    ];
-    tests.forEach(function (test) {
-      it(test.m, function () {
-        var clusterController = App.ClusterController.create();
-        App.router.set('clusterController', clusterController);
-        var mainServiceItemController = App.MainServiceItemController.create({content: {passiveState: "ON"}});
-        mainServiceItemController.updateService(null, null, test.params);
-        expect(mainServiceItemController.get('content.passiveState')).to.equal(test.params.passive_state);
-      });
-    });
-  });
-
   describe("#doAction", function () {
 
     var el = document.createElement("BUTTON");
@@ -325,50 +303,6 @@ describe('App.MainServiceItemController', function () {
 
   });
 
-  describe("#startStopPopupSuccessCallback", function () {
-
-    var data = {
-      Requests: true
-    };
-    var params = Em.Object.create({
-      query: Em.Object.create()
-    });
-    var ajaxOptions = {
-      data: '{"RequestInfo":{"context":"_PARSE_.STOP.ZOOKEEPER"},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}'
-    };
-
-    var content = {
-      workStatus: "",
-      hostComponents: [
-        {
-          workStatus: ""
-        }
-      ]
-    };
-
-    var mainServiceItemController = App.MainServiceItemController.create({content: content});
-    var applicationController = App.ApplicationController.create(App.UserPref, {});
-    var clusterController = App.ClusterController.create({loadUpdatedStatusDelayed: Em.K});
-    var backgroundOperationsController = App.BackgroundOperationsController.create({showPopup: Em.K});
-    App.testMode = false;
-    beforeEach(function () {
-      App.testMode = false;
-      sinon.spy(clusterController, "loadUpdatedStatusDelayed");
-    });
-    afterEach(function () {
-      clusterController.loadUpdatedStatusDelayed.restore();
-      App.testMode = true;
-    });
-    it("open bgo popup", function () {
-      App.router.set('applicationController', applicationController);
-      App.router.set('clusterController', clusterController);
-      App.router.set('backgroundOperationsController', backgroundOperationsController);
-      mainServiceItemController.startStopPopupSuccessCallback(data, ajaxOptions, params);
-      expect(clusterController.loadUpdatedStatusDelayed.calledOnce).to.equal(true);
-    })
-  });
-
-
   describe("#startService , #stopService", function () {
     var mainServiceItemController = App.MainServiceItemController.create({startStopPopup: Em.K});
     beforeEach(function () {
@@ -391,14 +325,15 @@ describe('App.MainServiceItemController', function () {
   describe("#turnOnOffPassive", function () {
     var mainServiceItemController = App.MainServiceItemController.create({turnOnOffPassiveRequest: Em.K});
     beforeEach(function () {
-      sinon.spy(mainServiceItemController, "turnOnOffPassiveRequest");
+      sinon.spy(batchUtils, "turnOnOffPassiveRequest");
+      mainServiceItemController.set('content', {serviceName: ''});
     });
     afterEach(function () {
-      mainServiceItemController.turnOnOffPassiveRequest.restore();
+      batchUtils.turnOnOffPassiveRequest.restore();
     });
     it("turns on/off passive mode for service", function () {
       mainServiceItemController.turnOnOffPassive({}).onPrimary();
-      expect(mainServiceItemController.turnOnOffPassiveRequest.calledOnce).to.equal(true);
+      expect(batchUtils.turnOnOffPassiveRequest.calledOnce).to.equal(true);
     });
   });
 
@@ -433,7 +368,7 @@ describe('App.MainServiceItemController', function () {
 
     tests.forEach(function (test) {
       var mainServiceItemController = test.default ? App.MainServiceItemController.create({runSmokeTestPrimary: Em.K}) :
-          App.MainServiceItemController.create({content: {serviceName: test.serviceName}, runSmokeTestPrimary: Em.K});
+        App.MainServiceItemController.create({content: {serviceName: test.serviceName}, runSmokeTestPrimary: Em.K});
       beforeEach(function () {
         sinon.spy(mainServiceItemController, "runSmokeTestPrimary");
       });
@@ -450,49 +385,12 @@ describe('App.MainServiceItemController', function () {
     });
   });
 
-  describe("#refreshConfigs", function () {
-    var temp = batchUtils.restartHostComponents;
-    beforeEach(function () {
-      sinon.stub(App.ajax, 'send', function(opt) {
-        return opt.data.callback({ items: [] });
-      });
-      batchUtils.restartHostComponents = Em.K;
-      sinon.spy(batchUtils, "restartHostComponents");
-    });
-    afterEach(function () {
-      batchUtils.restartHostComponents.restore();
-      batchUtils.restartHostComponents = temp;
-      App.ajax.send.restore();
-    });
-    var tests = [
-      {
-        isClientsOnly: true,
-        m: "run refresh for clients"
-      },
-      {
-        isClientsOnly: false,
-        m: "don't run refresh for non clients"
-      }
-    ];
-    tests.forEach(function (test) {
-      var mainServiceItemController = App.MainServiceItemController.create({content: {isClientsOnly: test.isClientsOnly}});
-      it(test.m, function () {
-        if (test.isClientsOnly) {
-          mainServiceItemController.refreshConfigs().onPrimary();
-        } else {
-          mainServiceItemController.refreshConfigs();
-        }
-        expect(batchUtils.restartHostComponents.calledOnce).to.equal(test.isClientsOnly);
-      });
-    }, this);
-  });
-
   describe("#startStopPopup", function () {
     var el = document.createElement("BUTTON");
     el.disabled = false;
     var event = {
       target: el
-    }
+    };
     var mainServiceItemController = App.MainServiceItemController.create({content: {serviceName: "HDFS"}});
     beforeEach(function () {
       sinon.spy(mainServiceItemController, "startStopPopupPrimary");
@@ -511,10 +409,14 @@ describe('App.MainServiceItemController', function () {
     beforeEach(function () {
       batchUtils.restartAllServiceHostComponents = Em.K;
       sinon.spy(batchUtils, "restartAllServiceHostComponents");
+      sinon.stub(App.Service, 'find', function() {
+        return Em.Object.create({serviceTypes: []});
+      });
     });
     afterEach(function () {
       batchUtils.restartAllServiceHostComponents.restore();
       batchUtils.restartAllServiceHostComponents = temp;
+      App.Service.find.restore();
     });
 
     var mainServiceItemController = App.MainServiceItemController.create({content: {displayName: "HDFS"}});
@@ -616,56 +518,39 @@ describe('App.MainServiceItemController', function () {
 
   describe("#runRebalancer", function () {
     it("run rebalancer", function () {
+      sinon.stub(App.router, 'get', function(k) {
+        if ('applicationController' === k) {
+          return Em.Object.create({
+            dataLoading: function() {
+              return {done: Em.K}
+            }
+          });
+        }
+        return Em.get(App.router, k);
+      });
       var mainServiceItemController = App.MainServiceItemController.create({content: {runRebalancer: false}});
       mainServiceItemController.runRebalancer().onPrimary();
       expect(mainServiceItemController.get("content.runRebalancer")).to.equal(true);
+      App.router.get.restore();
     });
   });
 
   describe("#runCompaction", function () {
     it("run compaction", function () {
+      sinon.stub(App.router, 'get', function(k) {
+        if ('applicationController' === k) {
+          return Em.Object.create({
+            dataLoading: function() {
+              return {done: Em.K}
+            }
+          });
+        }
+        return Em.get(App.router, k);
+      });
       var mainServiceItemController = App.MainServiceItemController.create({content: {runCompaction: false}});
       mainServiceItemController.runCompaction().onPrimary();
       expect(mainServiceItemController.get("content.runCompaction")).to.equal(true);
-    });
-  });
-
-  describe("#turnOnOffPassiveRequest", function () {
-    var tests = [
-      {
-        data: {
-          "requestInfo": 'Turn On Maintenance Mode',
-          "serviceName" : "HDFS",
-          "passive_state": "ON"
-        },
-        RequestInfo: {
-          "context": 'Turn On Maintenance Mode'
-        },
-        Body: {
-          ServiceInfo: {
-            maintenance_state: "ON"
-          }
-        }
-      }
-    ];
-
-    beforeEach(function () {
-      sinon.spy($, 'ajax');
-    });
-
-    afterEach(function () {
-      $.ajax.restore();
-    });
-
-    tests.forEach(function (test) {
-      it('send request to turn on passive state', function () {
-        var mainServiceItemController = App.MainServiceItemController.create({content: {serviceName: test.data.serviceName}});
-        mainServiceItemController.turnOnOffPassiveRequest(test.data.passive_state, test.data.requestInfo);
-        expect($.ajax.calledOnce).to.equal(true);
-
-        expect(JSON.parse($.ajax.args[0][0].data).Body.ServiceInfo.maintenance_state).to.equal(test.Body.ServiceInfo.maintenance_state);
-        expect(JSON.parse($.ajax.args[0][0].data).RequestInfo.context).to.equal(test.RequestInfo.context);
-      });
+      App.router.get.restore();
     });
   });
 
@@ -686,17 +571,17 @@ describe('App.MainServiceItemController', function () {
     ];
     tests.forEach(function (test) {
 
-    var mainServiceItemController = App.MainServiceItemController.create({content: {serviceName: test.data.serviceName,
-      displayName: test.data.displayName}});
-    beforeEach(function () {
-      mainServiceItemController.set("runSmokeTestErrorCallBack", Em.K);
-      mainServiceItemController.set("runSmokeTestSuccessCallBack", Em.K);
-      sinon.spy($, 'ajax');
-    });
+      var mainServiceItemController = App.MainServiceItemController.create({content: {serviceName: test.data.serviceName,
+        displayName: test.data.displayName}});
+      beforeEach(function () {
+        mainServiceItemController.set("runSmokeTestErrorCallBack", Em.K);
+        mainServiceItemController.set("runSmokeTestSuccessCallBack", Em.K);
+        sinon.spy($, 'ajax');
+      });
 
-    afterEach(function () {
-      $.ajax.restore();
-    });
+      afterEach(function () {
+        $.ajax.restore();
+      });
 
       it('send request to run smoke test', function () {
 
@@ -709,4 +594,5 @@ describe('App.MainServiceItemController', function () {
       });
     });
   });
+
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/566e754e/ambari-web/test/controllers/main/service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service_test.js b/ambari-web/test/controllers/main/service_test.js
index d530c15..84e9189 100644
--- a/ambari-web/test/controllers/main/service_test.js
+++ b/ambari-web/test/controllers/main/service_test.js
@@ -25,30 +25,6 @@ describe('App.MainServiceController', function () {
 
   var tests = Em.A([
     {
-      isStartStopAllClicked: false,
-      content: Em.A([
-        Em.Object.create({
-          healthStatus: 'green',
-          serviceName: 'HIVE',
-          isClientsOnly: false
-        }),
-        Em.Object.create({
-          healthStatus: 'green',
-          serviceName: 'HDFS',
-          isClientsOnly: false
-        }),
-        Em.Object.create({
-          healthStatus: 'red',
-          serviceName: 'TEZ',
-          isClientsOnly: true
-        })
-      ]),
-      eStart: true,
-      eStop: false,
-      mStart: 'mainServiceController StartAll is Disabled 1',
-      mStop: 'mainServiceController StopAll is Enabled 1'
-    },
-    {
       isStartStopAllClicked: true,
       content: Em.A([
         Em.Object.create({

http://git-wip-us.apache.org/repos/asf/ambari/blob/566e754e/ambari-web/test/controllers/wizard/stack_upgrade/step3_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/stack_upgrade/step3_controller_test.js b/ambari-web/test/controllers/wizard/stack_upgrade/step3_controller_test.js
index 092415e..b3947ed 100644
--- a/ambari-web/test/controllers/wizard/stack_upgrade/step3_controller_test.js
+++ b/ambari-web/test/controllers/wizard/stack_upgrade/step3_controller_test.js
@@ -23,18 +23,24 @@ var Ember = require('ember');
 require('models/host');
 require('controllers/wizard/stack_upgrade/step3_controller');
 
-if (!App.router) {
-  App.router = Em.Object.create({});
-}
-
-App.router.set('stackUpgradeController', Em.Object.create({
-  save: Em.K
-}));
-
 describe('App.StackUpgradeStep3Controller', function() {
 
   var stackUpgradeStep3Controller = App.StackUpgradeStep3Controller.create();
 
+  beforeEach(function() {
+    sinon.stub(App.router, 'get', function(k) {
+      if ('stackUpgradeController' === k) return Em.Object.create({
+        save: Em.K
+      })
+      if ('stackUpgradeController.save' === k) return Em.K;
+      return Em.get(App.router, k);
+    });
+  });
+
+  afterEach(function() {
+    App.router.get.restore();
+  });
+
   describe('#runUpgradeErrorCallback', function() {
     var processes = [
       Ember.Object.create({
@@ -48,12 +54,15 @@ describe('App.StackUpgradeStep3Controller', function() {
     stackUpgradeStep3Controller.set('content', {cluster: {}, controllerName:'stackUpgradeController'});
 
     it('check process condition', function() {
-      App.testMode = true;
+      sinon.stub(App, 'get', function(k) {
+        if ('testMode' === k) return true;
+        return Em.get(App, k);
+      });
       stackUpgradeStep3Controller.runUpgradeErrorCallback();
       expect(stackUpgradeStep3Controller.get('processes').findProperty('name', 'UPGRADE_SERVICES').get('status')).to.equal('FAILED');
       expect(stackUpgradeStep3Controller.get('processes').findProperty('name', 'UPGRADE_SERVICES').get('isRetry')).to.equal(true);
       expect(stackUpgradeStep3Controller.get('submitButton')).to.equal(false);
-      App.testMode = false;
+      App.get.restore();
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/566e754e/ambari-web/test/controllers/wizard/step0_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step0_test.js b/ambari-web/test/controllers/wizard/step0_test.js
index 0c6a87a..4349d04 100644
--- a/ambari-web/test/controllers/wizard/step0_test.js
+++ b/ambari-web/test/controllers/wizard/step0_test.js
@@ -21,17 +21,12 @@ require('models/cluster_states');
 require('controllers/wizard/step0_controller');
 var wizardStep0Controller;
 
-if (!App.router) {
-  App.router = Em.Object.create({});
-}
-App.router.set('send', Em.K);
-
 describe('App.WizardStep0Controller', function () {
 
   beforeEach(function() {
     wizardStep0Controller = App.WizardStep0Controller.create({content: {cluster: {}}});
     sinon.stub(App.clusterStatus, 'set', Em.K);
-    sinon.spy(App.router, 'send');
+    sinon.stub(App.router, 'send', Em.K);
   });
 
   afterEach(function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/566e754e/ambari-web/test/controllers/wizard/step2_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step2_test.js b/ambari-web/test/controllers/wizard/step2_test.js
index 62a448c..1d91570 100644
--- a/ambari-web/test/controllers/wizard/step2_test.js
+++ b/ambari-web/test/controllers/wizard/step2_test.js
@@ -51,10 +51,10 @@ describe('App.WizardStep2Controller', function () {
 
   describe('#hostNames', function() {
     it('should be equal to content.installOptions.hostNames', function() {
-      var controller = App.WizardStep2Controller.create({content: {installOptions: {hostNames: ['1','2','3']}}});
-      expect(controller.get('hostNames')).to.eql(['1','2','3']);
-      controller.set('content.installOptions.hostNames', ['1', '2']);
-      expect(controller.get('hostNames')).to.eql(['1', '2']);
+      var controller = App.WizardStep2Controller.create({content: {installOptions: {hostNames: 'A,b,C'}}});
+      expect(controller.get('hostNames')).to.equal('a,b,c');
+      controller.set('content.installOptions.hostNames', 'a,B');
+      expect(controller.get('hostNames')).to.equal('a,b');
     });
   });
 
@@ -89,19 +89,18 @@ describe('App.WizardStep2Controller', function () {
 
   describe('#updateHostNameArr()', function () {
 
-      var controller = App.WizardStep2Controller.create({
-        hostNames: 'apache.ambari'
-      });
-      App.store.load(App.Host, {'host_name': 'apache.ambari', id: '1'});
-      controller.updateHostNameArr();
+    var controller = App.WizardStep2Controller.create({
+      hostNames: 'apache.ambari'
+    });
+    controller.updateHostNameArr();
 
-      it('should push to hostNameArr only new host names', function(){
-        expect(controller.get('hostNameArr').length).to.equal(0);
-      });
+    it('should push to hostNameArr only new host names', function(){
+      expect(controller.get('hostNameArr').length).to.equal(1);
+    });
 
-      it('should push to inputtedAgainHostNames already installed host names', function(){
-        expect(controller.get('inputtedAgainHostNames').length).to.equal(1);
-      })
+    it('should push to inputtedAgainHostNames already installed host names', function(){
+      expect(controller.get('inputtedAgainHostNames').length).to.equal(0);
+    })
   });
 
   describe('#isAllHostNamesValid()', function () {
@@ -286,8 +285,8 @@ describe('App.WizardStep2Controller', function () {
 
       var test = controller.getHostInfo();
       expect(test).to.eql({
-        'apache':{'name':'apache', 'installType': 'manualDriven', 'bootStatus': 'PENDING'},
-        'ambari':{'name':'ambari', 'installType': 'manualDriven', 'bootStatus': 'PENDING'}
+        'apache':{'name':'apache', 'installType': 'manualDriven', 'bootStatus': 'PENDING', isInstalled: false},
+        'ambari':{'name':'ambari', 'installType': 'manualDriven', 'bootStatus': 'PENDING', isInstalled: false}
       });
     })
   });
@@ -296,7 +295,7 @@ describe('App.WizardStep2Controller', function () {
 
     it('should set content.installOptions.sshKey', function () {
       var controller = App.WizardStep2Controller.create({
-       content: {'installOptions': {'sshKey': '111'}}
+        content: {'installOptions': {'sshKey': '111'}}
       });
       controller.setSshKey('222');
       expect(controller.get('content.installOptions.sshKey')).to.equal('222');
@@ -307,15 +306,17 @@ describe('App.WizardStep2Controller', function () {
 
     it('should return false if isSubmitDisabled is true', function () {
       var controller = App.WizardStep2Controller.create({
-        hostNames: 'apache.ambari'
+        hostNames: 'apache.ambari',
+        parseHostNamesAsPatternExpression: Em.K
       });
-      controller.set('isSubmitDisabled', true);
+      controller.reopen({isSubmitDisabled: true});
       expect(controller.evaluateStep()).to.equal(false);
     });
 
     it('should return false if hostsError is not empty', function () {
       var controller = App.WizardStep2Controller.create({
-        hostNames: 'apache.ambari'
+        hostNames: 'apache.ambari',
+        parseHostNamesAsPatternExpression: Em.K
       });
       controller.set('hostsError', 'error');
       expect(controller.evaluateStep()).to.equal(false);
@@ -323,23 +324,26 @@ describe('App.WizardStep2Controller', function () {
 
     it('should return false if sshKeyError is not empty', function () {
       var controller = App.WizardStep2Controller.create({
-        hostNames: 'apache.ambari'
+        hostNames: 'apache.ambari',
+        parseHostNamesAsPatternExpression: Em.K
       });
-      controller.set('sshKeyError', 'error');
+      controller.reopen({sshKeyError: 'error'});
       expect(controller.evaluateStep()).to.equal(false);
     });
 
     it('should return false if hostNameArr is empty', function () {
       var controller = App.WizardStep2Controller.create({
-        hostNames: ''
+        hostNames: '',
+        parseHostNamesAsPatternExpression: Em.K
       });
       expect(controller.evaluateStep()).to.equal(false);
     });
 
-    it('should return false if isPattern is false', function () {
+    it('should return false if isPattern is true', function () {
       var controller = App.WizardStep2Controller.create({
         hostNames: 'apache.ambari',
-        isPattern: false
+        isPattern: true,
+        parseHostNamesAsPatternExpression: Em.K
       });
       expect(controller.evaluateStep()).to.equal(false);
     })