You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2017/06/23 13:49:00 UTC

ambari git commit: AMBARI-21331 Integrate Services status with websocket events. (atkach)

Repository: ambari
Updated Branches:
  refs/heads/branch-3.0-perf 421ac2776 -> 51b1a14d7


AMBARI-21331 Integrate Services status with websocket events. (atkach)


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

Branch: refs/heads/branch-3.0-perf
Commit: 51b1a14d7318391572e9059f1e7615be12577199
Parents: 421ac27
Author: Andrii Tkach <at...@apache.org>
Authored: Fri Jun 23 16:09:35 2017 +0300
Committer: Andrii Tkach <at...@apache.org>
Committed: Fri Jun 23 16:09:35 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |  4 +-
 .../app/controllers/global/update_controller.js |  8 +--
 ambari-web/app/mappers.js                       |  4 +-
 ambari-web/app/mappers/server_data_mapper.js    | 16 +++++
 .../app/mappers/socket/alert_summary_mapper.js  | 34 +++++++++
 .../socket/host_component_status_mapper.js      | 31 ++++++++
 .../app/mappers/socket/service_state_mapper.js  | 38 ++++++++++
 ambari-web/app/mappers/socket_events_mapper.js  | 44 ------------
 .../global/update_controller_test.js            |  4 +-
 .../test/mappers/server_data_mapper_test.js     | 20 ++++++
 .../mappers/socket/alert_summary_mapper_test.js | 51 ++++++++++++++
 .../socket/host_component_status_mapper_test.js | 47 +++++++++++++
 .../mappers/socket/service_state_mapper_test.js | 44 ++++++++++++
 .../test/mappers/socket_events_mapper_test.js   | 74 --------------------
 14 files changed, 294 insertions(+), 125 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/51b1a14d/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index 567539b..11ab702 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -166,8 +166,10 @@ var files = [
   'test/mappers/configs/config_groups_mapper_test',
   'test/mappers/configs/service_config_version_mapper_test',
   'test/mappers/configs/themes_mapper_test',
-  'test/mappers/socket_events_mapper_test',
   'test/mappers/socket/topology_mapper_test',
+  'test/mappers/socket/alert_summary_mapper_test',
+  'test/mappers/socket/host_component_status_mapper_test',
+  'test/mappers/socket/service_state_mapper_test',
   'test/mixins/common/configs/enhanced_configs_test',
   'test/mixins/common/configs/config_recommendations_test',
   'test/mixins/common/configs/config_recommendation_parser_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/51b1a14d/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index 5063db3..109b266 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -186,14 +186,13 @@ App.UpdateController = Em.Controller.extend({
    * Start polling, when <code>isWorking</code> become true
    */
   updateAll: function () {
-    var socket = App.socketEventsMapper;
     if (this.get('isWorking') && !App.get('isOnlyViewUser')) {
-      App.StompClient.subscribe('/events/hostcomponents', socket.applyHostComponentStatusEvents.bind(socket));
-      App.StompClient.subscribe('/events/alerts', socket.applyAlertDefinitionSummaryEvents.bind(socket));
+      App.StompClient.subscribe('/events/hostcomponents', App.hostComponentStatusMapper.map.bind(App.hostComponentStatusMapper));
+      App.StompClient.subscribe('/events/alerts', App.alertSummaryMapper.map.bind(App.alertSummaryMapper));
       App.StompClient.subscribe('/events/topologies', App.topologyMapper.map.bind(App.topologyMapper));
       App.StompClient.subscribe('/events/configs', this.makeCallForClusterEnv.bind(this));
+      App.StompClient.subscribe('/events/services', App.serviceStateMapper.map.bind(App.serviceStateMapper));
 
-      App.updater.run(this, 'updateServices', 'isWorking');
       App.updater.run(this, 'updateHost', 'isWorking');
       App.updater.run(this, 'updateServiceMetric', 'isWorking', App.componentsUpdateInterval, '\/main\/(dashboard|services).*');
       App.updater.run(this, 'updateComponentsState', 'isWorking', App.componentsUpdateInterval, '\/main\/(dashboard|services|hosts).*');
@@ -212,6 +211,7 @@ App.UpdateController = Em.Controller.extend({
       App.StompClient.unsubscribe('/events/alerts');
       App.StompClient.unsubscribe('/events/topologies');
       App.StompClient.unsubscribe('/events/configs');
+      App.StompClient.unsubscribe('/events/services');
     }
   }.observes('isWorking', 'App.router.mainAlertInstancesController.isUpdating'),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/51b1a14d/ambari-web/app/mappers.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers.js b/ambari-web/app/mappers.js
index 6cba547..aca5291 100644
--- a/ambari-web/app/mappers.js
+++ b/ambari-web/app/mappers.js
@@ -45,5 +45,7 @@ require('mappers/root_service_mapper');
 require('mappers/widget_mapper');
 require('mappers/widget_layout_mapper');
 require('mappers/stack_upgrade_history_mapper');
-require('mappers/socket_events_mapper');
 require('mappers/socket/topology_mapper');
+require('mappers/socket/service_state_mapper');
+require('mappers/socket/host_component_status_mapper');
+require('mappers/socket/alert_summary_mapper');

http://git-wip-us.apache.org/repos/asf/ambari/blob/51b1a14d/ambari-web/app/mappers/server_data_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/server_data_mapper.js b/ambari-web/app/mappers/server_data_mapper.js
index 8a32eb0..e31881d 100644
--- a/ambari-web/app/mappers/server_data_mapper.js
+++ b/ambari-web/app/mappers/server_data_mapper.js
@@ -243,6 +243,22 @@ App.QuickDataMapper = App.ServerDataMapper.extend({
     }
 
     return ~maxIndex;
+  },
+
+  /**
+   * @param {Em.Object} record
+   * @param {object} event
+   * @param {object} config
+   */
+  updatePropertiesByConfig: function(record, event, config) {
+    if (record.get('isLoaded')) {
+      for (var internalProp in config) {
+        let externalProp = config[internalProp];
+        if (!Em.isNone(event[externalProp])) {
+          record.set(internalProp, event[externalProp]);
+        }
+      }
+    }
   }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/51b1a14d/ambari-web/app/mappers/socket/alert_summary_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/socket/alert_summary_mapper.js b/ambari-web/app/mappers/socket/alert_summary_mapper.js
new file mode 100644
index 0000000..704c156
--- /dev/null
+++ b/ambari-web/app/mappers/socket/alert_summary_mapper.js
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+var App = require('app');
+
+App.alertSummaryMapper = App.QuickDataMapper.create({
+
+  /**
+   * @param {object} event
+   */
+  map: function(event) {
+    const data = {
+      alerts_summary_grouped: []
+    };
+    for (let name in event.summaries) {
+      data.alerts_summary_grouped.push(event.summaries[name]);
+    }
+    App.alertDefinitionSummaryMapper.map(data);
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/51b1a14d/ambari-web/app/mappers/socket/host_component_status_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/socket/host_component_status_mapper.js b/ambari-web/app/mappers/socket/host_component_status_mapper.js
new file mode 100644
index 0000000..6069cbc
--- /dev/null
+++ b/ambari-web/app/mappers/socket/host_component_status_mapper.js
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+var App = require('app');
+
+App.hostComponentStatusMapper = App.QuickDataMapper.create({
+
+  /**
+   * @param {object} event
+   */
+  map: function (event) {
+    const hostComponent = App.HostComponent.find(event.componentName + '_' + event.hostName);
+    if (hostComponent.get('isLoaded')) {
+      hostComponent.set('workStatus', event.currentState);
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/51b1a14d/ambari-web/app/mappers/socket/service_state_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/socket/service_state_mapper.js b/ambari-web/app/mappers/socket/service_state_mapper.js
new file mode 100644
index 0000000..062be6d
--- /dev/null
+++ b/ambari-web/app/mappers/socket/service_state_mapper.js
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+var App = require('app');
+
+App.serviceStateMapper = App.QuickDataMapper.create({
+
+  config: {
+    passiveState: 'maintenance_state',
+    workStatus: 'state'
+  },
+
+  /**
+   * @param {object} event
+   */
+  map: function(event) {
+    //TODO event should have properties named in CamelCase format
+    this.updatePropertiesByConfig(App.Service.find(event.service_name), event, this.config);
+    const cachedService = App.cache['services'].findProperty('ServiceInfo.service_name', event.service_name);
+    if (event.state && cachedService) {
+      cachedService.ServiceInfo.state = event.state;
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/51b1a14d/ambari-web/app/mappers/socket_events_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/socket_events_mapper.js b/ambari-web/app/mappers/socket_events_mapper.js
deleted file mode 100644
index df2c1cd..0000000
--- a/ambari-web/app/mappers/socket_events_mapper.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-var App = require('app');
-
-App.socketEventsMapper = App.QuickDataMapper.create({
-
-  /**
-   * @param {object} event
-   */
-  applyAlertDefinitionSummaryEvents: function(event) {
-    const data = {
-      alerts_summary_grouped: []
-    };
-    for (let name in event.summaries) {
-      data.alerts_summary_grouped.push(event.summaries[name]);
-    }
-    App.alertDefinitionSummaryMapper.map(data);
-  },
-
-  /**
-   * @param {object} event
-   */
-  applyHostComponentStatusEvents: function (event) {
-    const hostComponent = App.HostComponent.find(event.componentName + '_' + event.hostName);
-    if (hostComponent.get('isLoaded')) {
-      hostComponent.set('workStatus', event.currentState);
-    }
-  }
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/51b1a14d/ambari-web/test/controllers/global/update_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/update_controller_test.js b/ambari-web/test/controllers/global/update_controller_test.js
index efacf3a..c793750 100644
--- a/ambari-web/test/controllers/global/update_controller_test.js
+++ b/ambari-web/test/controllers/global/update_controller_test.js
@@ -73,15 +73,17 @@ describe('App.UpdateController', function () {
       expect(App.StompClient.unsubscribe.calledWith('/events/alerts')).to.be.true;
       expect(App.StompClient.unsubscribe.calledWith('/events/topologies')).to.be.true;
       expect(App.StompClient.unsubscribe.calledWith('/events/configs')).to.be.true;
+      expect(App.StompClient.unsubscribe.calledWith('/events/services')).to.be.true;
     });
 
     it('isWorking = true', function () {
       controller.set('isWorking', true);
-      expect(App.updater.run.callCount).to.equal(11);
+      expect(App.updater.run.callCount).to.equal(10);
       expect(App.StompClient.subscribe.calledWith('/events/hostcomponents')).to.be.true;
       expect(App.StompClient.subscribe.calledWith('/events/alerts')).to.be.true;
       expect(App.StompClient.subscribe.calledWith('/events/topologies')).to.be.true;
       expect(App.StompClient.subscribe.calledWith('/events/configs')).to.be.true;
+      expect(App.StompClient.subscribe.calledWith('/events/services')).to.be.true;
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/51b1a14d/ambari-web/test/mappers/server_data_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/server_data_mapper_test.js b/ambari-web/test/mappers/server_data_mapper_test.js
index 077cd20..902e89a 100644
--- a/ambari-web/test/mappers/server_data_mapper_test.js
+++ b/ambari-web/test/mappers/server_data_mapper_test.js
@@ -136,4 +136,24 @@ describe('App.QuickDataMapper', function () {
 
   });
 
+  describe('#updatePropertiesByConfig', function() {
+
+    it('should update properties of record', function() {
+      const record = Em.Object.create({
+        isLoaded: true,
+        prop1: 'v1',
+        prop2: 'v2'
+      });
+      const config = {
+        prop1: 'ext1',
+        prop2: 'ext2',
+        prop3: 'ext3'
+      };
+      mapper.updatePropertiesByConfig(record, {ext1: 'v11', ext3: 'v31'}, config);
+      expect(record.get('prop1')).to.be.equal('v11');
+      expect(record.get('prop2')).to.be.equal('v2');
+      expect(record.get('prop3')).to.be.equal('v31');
+    });
+  });
+
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/51b1a14d/ambari-web/test/mappers/socket/alert_summary_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/socket/alert_summary_mapper_test.js b/ambari-web/test/mappers/socket/alert_summary_mapper_test.js
new file mode 100644
index 0000000..3c3f606
--- /dev/null
+++ b/ambari-web/test/mappers/socket/alert_summary_mapper_test.js
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+require('mappers/socket/alert_summary_mapper');
+
+describe('App.alertSummaryMapper', function () {
+
+  describe('#map', function() {
+    beforeEach(function() {
+      sinon.stub(App.alertDefinitionSummaryMapper, 'map');
+    });
+    afterEach(function() {
+      App.alertDefinitionSummaryMapper.map.restore();
+    });
+
+    it('App.alertDefinitionSummaryMapper.map should be called', function() {
+      const event = {
+        summaries: {
+          d1: {
+            definition_name: 'd1'
+          }
+        }
+      };
+      App.alertSummaryMapper.map(event);
+      expect(App.alertDefinitionSummaryMapper.map.calledWith({
+        alerts_summary_grouped: [
+          {
+            definition_name: 'd1'
+          }
+        ]
+      })).to.be.true;
+    });
+  });
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/51b1a14d/ambari-web/test/mappers/socket/host_component_status_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/socket/host_component_status_mapper_test.js b/ambari-web/test/mappers/socket/host_component_status_mapper_test.js
new file mode 100644
index 0000000..0de9846
--- /dev/null
+++ b/ambari-web/test/mappers/socket/host_component_status_mapper_test.js
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+require('mappers/socket/host_component_status_mapper');
+
+describe('App.hostComponentStatusMapper', function () {
+
+  describe('#map', function() {
+    var hc = Em.Object.create({
+      workStatus: 'INSTALLED',
+      isLoaded: true
+    });
+    beforeEach(function() {
+      sinon.stub(App.HostComponent, 'find').returns(hc);
+    });
+    afterEach(function() {
+      App.HostComponent.find.restore();
+    });
+
+    it('host-component should have STARTED status', function() {
+      const event = {
+        componentName: 'C1',
+        hostName: 'host1',
+        currentState: 'STARTED'
+      };
+      App.hostComponentStatusMapper.map(event);
+      expect(hc.get('workStatus')).to.be.equal('STARTED');
+    });
+  });
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/51b1a14d/ambari-web/test/mappers/socket/service_state_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/socket/service_state_mapper_test.js b/ambari-web/test/mappers/socket/service_state_mapper_test.js
new file mode 100644
index 0000000..f51c694
--- /dev/null
+++ b/ambari-web/test/mappers/socket/service_state_mapper_test.js
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+require('mappers/socket/service_state_mapper');
+
+describe('App.serviceStateMapper', function () {
+
+  describe('#map', function() {
+    beforeEach(function() {
+      sinon.stub(App.Service, 'find');
+      sinon.stub(App.serviceStateMapper, 'updatePropertiesByConfig');
+    });
+    afterEach(function() {
+      App.Service.find.restore();
+      App.serviceStateMapper.updatePropertiesByConfig.restore();
+    });
+
+    it('updatePropertiesByConfig should be called', function() {
+      const event = {
+        service_name: 'S1',
+        state: 'INSTALLED'
+      };
+      App.serviceStateMapper.map(event);
+      expect(App.serviceStateMapper.updatePropertiesByConfig.calledOnce).to.be.true;
+    });
+  });
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/51b1a14d/ambari-web/test/mappers/socket_events_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/socket_events_mapper_test.js b/ambari-web/test/mappers/socket_events_mapper_test.js
deleted file mode 100644
index d7391d6..0000000
--- a/ambari-web/test/mappers/socket_events_mapper_test.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var App = require('app');
-
-require('mappers/socket_events_mapper');
-
-describe('App.socketEventsMapper', function () {
-
-  describe('#applyHostComponentStatusEvents', function() {
-    var hc = Em.Object.create({
-      workStatus: 'INSTALLED',
-      isLoaded: true
-    });
-    beforeEach(function() {
-      sinon.stub(App.HostComponent, 'find').returns(hc);
-    });
-    afterEach(function() {
-      App.HostComponent.find.restore();
-    });
-
-    it('host-component should have STARTED status', function() {
-      const event = {
-        componentName: 'C1',
-        hostName: 'host1',
-        currentState: 'STARTED'
-      };
-      App.socketEventsMapper.applyHostComponentStatusEvents(event);
-      expect(hc.get('workStatus')).to.be.equal('STARTED');
-    });
-  });
-
-  describe('#applyAlertDefinitionSummaryEvents', function() {
-    beforeEach(function() {
-      sinon.stub(App.alertDefinitionSummaryMapper, 'map');
-    });
-    afterEach(function() {
-      App.alertDefinitionSummaryMapper.map.restore();
-    });
-
-    it('App.alertDefinitionSummaryMapper.map should be called', function() {
-      const event = {
-        summaries: {
-          d1: {
-            definition_name: 'd1'
-          }
-        }
-      };
-      App.socketEventsMapper.applyAlertDefinitionSummaryEvents(event);
-      expect(App.alertDefinitionSummaryMapper.map.calledWith({
-        alerts_summary_grouped: [
-          {
-            definition_name: 'd1'
-          }
-        ]
-      })).to.be.true;
-    });
-  });
-});