This is an automated email from the ASF dual-hosted git repository. ishanbha pushed a commit to branch branch-feature-AMBARI-14714 in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by this push: new 58381cf [AMBARI-23629] Review calls GET, PUT, DELETE for Host components and … (#1055) 58381cf is described below commit 58381cfe4c1f81d92e9bb79e8669c6a3b71ffd49 Author: Ishan Bhatt <ishanbhatt.1...@gmail.com> AuthorDate: Tue Apr 24 14:22:38 2018 -0400 [AMBARI-23629] Review calls GET, PUT, DELETE for Host components and … (#1055) * [AMBARI-23629] Review calls GET, PUT, DELETE for Host components and make sure that we call them with ID as endpoint instead of name. * Fixed all the test failures caused by this change --- .../app/controllers/global/update_controller.js | 1 + .../nameNode/rollbackHA/step2_controller.js | 3 ++- .../nameNode/rollback_controller.js | 6 ++--- .../highAvailability/nameNode/step4_controller.js | 3 ++- .../highAvailability/nameNode/step5_controller.js | 2 +- .../highAvailability/nameNode/step6_controller.js | 3 ++- .../highAvailability/nameNode/step9_controller.js | 2 +- .../main/admin/kerberos/step6_controller.js | 2 +- ambari-web/app/controllers/main/host/details.js | 12 +++++---- .../app/controllers/main/service/info/summary.js | 3 ++- .../main/service/reassign/step4_controller.js | 31 ++++++++++++---------- .../main/service/reassign/step6_controller.js | 29 +++++++++++--------- .../main/service/reassign/step7_controller.js | 4 +-- ambari-web/app/mappers/service_metrics_mapper.js | 1 + .../details/host_components/decommissionable.js | 2 +- .../details/host_components/install_component.js | 2 +- .../details/support_client_configs_download.js | 3 ++- .../configs/component_actions_by_configs.js | 3 ++- .../mixins/wizard/wizardProgressPageController.js | 4 +-- ambari-web/app/models/host_component.js | 1 + ambari-web/app/utils/ajax/ajax.js | 22 +++++++-------- .../details/host_component_views/datanode_view.js | 3 ++- .../info/metrics/flume/flume_metric_graph.js | 4 +-- .../info/metrics/flume/flume_metric_graphs.js | 3 ++- .../nameNode/step4_controller_test.js | 5 +++- .../nameNode/step5_controller_test.js | 4 ++- .../nameNode/step6_controller_test.js | 5 +++- .../nameNode/step9_controller_test.js | 4 ++- .../main/admin/kerberos/step6_controller_test.js | 3 ++- .../test/controllers/main/host/details_test.js | 24 +++++++++++++---- .../main/service/reassign/step4_controller_test.js | 20 ++++++++++---- .../main/service/reassign/step6_controller_test.js | 13 ++++++--- .../main/service/reassign/step7_controller_test.js | 22 +++++++++++++-- .../host_components/install_component_test.js | 4 +-- .../configs/component_actions_by_configs_test.js | 4 ++- .../host_component_views/datanode_view_test.js | 8 +++--- .../host_component_views/decommissionable_test.js | 4 +-- 37 files changed, 176 insertions(+), 93 deletions(-) diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js index 6c3b0eb..8bf96ed 100644 --- a/ambari-web/app/controllers/global/update_controller.js +++ b/ambari-web/app/controllers/global/update_controller.js @@ -485,6 +485,7 @@ App.UpdateController = Em.Controller.extend({ 'host_components/HostRoles/display_name,' + 'host_components/HostRoles/host_name,' + 'host_components/HostRoles/public_host_name,' + + 'host_components/HostRoles/component_name,' + 'host_components/HostRoles/state,' + 'host_components/HostRoles/maintenance_state,' + 'host_components/HostRoles/stale_configs,' + diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollbackHA/step2_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollbackHA/step2_controller.js index 6aa8274..60d2876 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollbackHA/step2_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollbackHA/step2_controller.js @@ -27,7 +27,8 @@ App.RollbackHighAvailabilityWizardStep2Controller = App.HighAvailabilityWizardSt name: 'admin.high_availability.getNnCheckPointStatus', sender: this, data: { - hostName: hostName + hostName: hostName, + nameNodeId: App.HostComponent.find().findProperty('componentName', 'NAMENODE').get('compId') }, success: 'checkNnCheckPointStatus' }); diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js index 262a3e6..c9d3b00 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js @@ -480,7 +480,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl sender: this, data: { hostName: hostName[i], - componentName: componentName, + componentId: App.HostComponent.find().findProperty('componentName', componentName).get('compId'), passive_state: "ON", taskNum: hostName.length, callback: 'checkBeforeDelete' @@ -501,7 +501,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl name: 'admin.high_availability.getHostComponent', sender: this, data: { - componentName: componentName, + componentId: App.HostComponent.find().findProperty('componentName', componentName).get('compId'), hostName: hostName[i], taskNum: hostName.length, callback: 'deleteComponent' @@ -550,7 +550,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl name: 'common.delete.host_component', sender: this, data: { - componentName: componentName, + componentId: App.HostComponent.find().findProperty('componentName', componentName).get('compId'), hostName: hostName[i] }, success: 'onDeleteComplete', diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step4_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step4_controller.js index 5cf3880..e444548 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step4_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step4_controller.js @@ -38,7 +38,8 @@ App.HighAvailabilityWizardStep4Controller = Em.Controller.extend({ name: 'admin.high_availability.getNnCheckPointStatus', sender: this, data: { - hostName: hostName + hostName: hostName, + nameNodeId: App.HostComponent.find().findProperty('componentName', 'NAMENODE').get('compId') }, success: 'checkNnCheckPointStatus' }); diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step5_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step5_controller.js index f1f81d1..1dcc44e 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step5_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step5_controller.js @@ -54,7 +54,7 @@ App.HighAvailabilityWizardStep5Controller = App.HighAvailabilityProgressPageCont data: { hostName: hostName, passive_state: "ON", - componentName: 'SECONDARY_NAMENODE' + componentId: App.HostComponent.find().findProperty('componentName', 'SECONDARY_NAMENODE').get('compId'), }, success: 'onTaskCompleted', error: 'onTaskError' diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step6_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step6_controller.js index 1240576..1122f44 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step6_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step6_controller.js @@ -80,7 +80,8 @@ App.HighAvailabilityWizardStep6Controller = Em.Controller.extend({ name: 'admin.high_availability.getJnCheckPointStatus', sender: this, data: { - hostName: hostName + hostName: hostName, + jnId: App.HostComponent.find().findProperty('componentName', 'JOURNALNODE').get('compId') }, success: 'checkJnCheckPointStatus' }); diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js index 5dd419b..f56f166 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js @@ -310,7 +310,7 @@ App.HighAvailabilityWizardStep9Controller = App.HighAvailabilityProgressPageCont name: 'common.delete.host_component', sender: this, data: { - componentName: 'SECONDARY_NAMENODE', + componentId: App.HostComponent.find().findProperty('componentName', 'SECONDARY_NAMENODE').get('compId'), hostName: hostName }, success: 'onTaskCompleted', diff --git a/ambari-web/app/controllers/main/admin/kerberos/step6_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step6_controller.js index eab98af..1e81c3e 100644 --- a/ambari-web/app/controllers/main/admin/kerberos/step6_controller.js +++ b/ambari-web/app/controllers/main/admin/kerberos/step6_controller.js @@ -60,7 +60,7 @@ App.KerberosWizardStep6Controller = App.KerberosProgressPageController.extend({ name: 'common.delete.host_component', sender: this, data: { - componentName: 'APP_TIMELINE_SERVER', + componentId: App.HostComponent.find().findProperty('componentName', 'APP_TIMELINE_SERVER').get('compId'), hostName: App.HostComponent.find().findProperty('componentName', 'APP_TIMELINE_SERVER').get('hostName') }, success: 'onDeleteATSSuccess', diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js index 69b9bfe..2c3fc88 100644 --- a/ambari-web/app/controllers/main/host/details.js +++ b/ambari-web/app/controllers/main/host/details.js @@ -421,7 +421,8 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow name: 'common.host_component.getNnCheckPointTime', sender: this, data: { - host: hostName || this.get('content.hostName') + host: hostName || this.get('content.hostName'), + nameNodeId: App.HostComponent.find().findProperty('componentName', 'NAMENODE').get('compId') }, success: 'parseNnCheckPointTime' }); @@ -602,11 +603,12 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow * @method _doDeleteHostComponent */ _doDeleteHostComponent: function (componentName) { + var hostComponent = App.HostComponent.find().findProperty('componentName', componentName); return App.ajax.send({ name: (Em.isNone(componentName)) ? 'common.delete.host' : 'common.delete.host_component', sender: this, data: { - componentName: componentName || '', + componentId: hostComponent ? hostComponent.get('compId') : '', hostName: this.get('content.hostName') }, success: '_doDeleteHostComponentSuccessCallback', @@ -1763,7 +1765,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow installComponent: function (event) { var self = this; var component = event.context; - var componentName = component.get('componentName'); + var componentId = component.get('compId'); var displayName = component.get('displayName'); return App.ModalPopup.show({ @@ -1785,7 +1787,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow data: { hostName: self.get('content.hostName'), serviceName: component.get('service.serviceName'), - componentName: componentName, + componentId: componentId, component: component, context: Em.I18n.t('requestInfo.installHostComponent') + " " + displayName, HostRoles: { @@ -2310,7 +2312,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow sender: this, data: { hostName: this.get('content.hostName'), - componentName: component.get('componentName'), + componentId: component.get('compId'), component: component, passive_state: state, context: message diff --git a/ambari-web/app/controllers/main/service/info/summary.js b/ambari-web/app/controllers/main/service/info/summary.js index 3d7483a..710688a 100644 --- a/ambari-web/app/controllers/main/service/info/summary.js +++ b/ambari-web/app/controllers/main/service/info/summary.js @@ -324,7 +324,8 @@ App.MainServiceInfoSummaryController = Em.Controller.extend({ state: state, context: context, agentName: agent.get('name'), - host: agent.get('hostName') + host: agent.get('hostName'), + componentId: App.HostComponent.find().findProperty('componentName', 'FLUME_HANDLER').get('compId') }, success: 'commandSuccessCallback' }); diff --git a/ambari-web/app/controllers/main/service/reassign/step4_controller.js b/ambari-web/app/controllers/main/service/reassign/step4_controller.js index 21e4f0f..8195b67 100644 --- a/ambari-web/app/controllers/main/service/reassign/step4_controller.js +++ b/ambari-web/app/controllers/main/service/reassign/step4_controller.js @@ -265,17 +265,20 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro var hostName = this.get('content.reassignHosts.source'); this.set('multiTaskCounter', hostComponents.length); for (var i = 0; i < hostComponents.length; i++) { - App.ajax.send({ - name: 'common.host.host_component.passive', - sender: this, - data: { - hostName: hostName, - passive_state: "ON", - componentName: hostComponents[i] - }, - success: 'onComponentsTasksSuccess', - error: 'onTaskError' - }); + var hostComponent = App.HostComponent.find().findProperty('componentName', hostComponents[i]); + if(hostComponent) { + App.ajax.send({ + name: 'common.host.host_component.passive', + sender: this, + data: { + hostName: hostName, + passive_state: "ON", + componentId: hostComponent.get('compId') + }, + success: 'onComponentsTasksSuccess', + error: 'onTaskError' + }); + } } }, @@ -457,7 +460,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro sender: this, data: { hostName: hostName, - componentName: hostComponents[i] + componentId: App.HostComponent.find().findProperty('componentName', hostComponents[i]).get('compId') }, success: 'onComponentsTasksSuccess', error: 'onDeleteHostComponentsError' @@ -534,7 +537,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro context: "Start MySQL Server", hostName: App.HostComponent.find().findProperty('componentName', 'MYSQL_SERVER').get('hostName'), serviceName: "HIVE", - componentName: "MYSQL_SERVER", + componentId: App.HostComponent.find().findProperty('componentName', 'MYSQL_SERVER').get('compId'), HostRoles: { state: "STARTED" } @@ -581,7 +584,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro context: "Start MySQL Server", hostName: this.get('content.reassignHosts.target'), serviceName: "HIVE", - componentName: "MYSQL_SERVER", + componentId: App.HostComponent.find().findProperty('componentName', 'MYSQL_SERVER').get('compId'), HostRoles: { state: "STARTED" } diff --git a/ambari-web/app/controllers/main/service/reassign/step6_controller.js b/ambari-web/app/controllers/main/service/reassign/step6_controller.js index 05494d4..36d83ed 100644 --- a/ambari-web/app/controllers/main/service/reassign/step6_controller.js +++ b/ambari-web/app/controllers/main/service/reassign/step6_controller.js @@ -135,7 +135,7 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro sender: this, data: { hostName: hostName, - componentName: hostComponents[i] + componentId: App.HostComponent.find().findProperty('componentName', hostComponents[i]).get('compId') }, success: 'onComponentsTasksSuccess', error: 'onDeleteHostComponentsError' @@ -156,17 +156,20 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro var hostName = this.get('content.reassignHosts.source'); this.set('multiTaskCounter', hostComponents.length); for (var i = 0; i < hostComponents.length; i++) { - App.ajax.send({ - name: 'common.host.host_component.passive', - sender: this, - data: { - hostName: hostName, - passive_state: "ON", - componentName: hostComponents[i] - }, - success: 'onComponentsTasksSuccess', - error: 'onTaskError' - }); + var hostComponent = App.HostComponent.find().findProperty('componentName', hostComponents[i]); + if(hostComponent) { + App.ajax.send({ + name: 'common.host.host_component.passive', + sender: this, + data: { + hostName: hostName, + passive_state: "ON", + componentId: hostComponent.get('compId') + }, + success: 'onComponentsTasksSuccess', + error: 'onTaskError' + }); + } } }, @@ -195,7 +198,7 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro data.hostName = this.get('content.reassignHosts.source'); data.serviceName = 'HIVE'; data.HostRoles = { "state": "INSTALLED" }; - data.componentName = "MYSQL_SERVER"; + data.componentId = App.HostComponent.find().findProperty('componentName', 'MYSQL_SERVER').get('compId'); App.ajax.send({ name: 'common.host.host_component.update', diff --git a/ambari-web/app/controllers/main/service/reassign/step7_controller.js b/ambari-web/app/controllers/main/service/reassign/step7_controller.js index b36f17c..1782e0a 100644 --- a/ambari-web/app/controllers/main/service/reassign/step7_controller.js +++ b/ambari-web/app/controllers/main/service/reassign/step7_controller.js @@ -68,7 +68,7 @@ App.ReassignMasterWizardStep7Controller = App.ReassignMasterWizardStep4Controlle data: { hostName: hostName, passive_state: "ON", - componentName: hostComponents[i] + componentId: App.HostComponent.find().findProperty('componentName', hostComponents[i]).get('compId') }, success: 'onComponentsTasksSuccess', error: 'onTaskError' @@ -86,7 +86,7 @@ App.ReassignMasterWizardStep7Controller = App.ReassignMasterWizardStep4Controlle sender: this, data: { hostName: hostName, - componentName: hostComponents[i] + componentId: App.HostComponent.find().findProperty('componentName', hostComponents[i]).get('compId') }, success: 'onComponentsTasksSuccess', error: 'onDeleteHostComponentsError' diff --git a/ambari-web/app/mappers/service_metrics_mapper.js b/ambari-web/app/mappers/service_metrics_mapper.js index 9b47a80..96f2196 100644 --- a/ambari-web/app/mappers/service_metrics_mapper.js +++ b/ambari-web/app/mappers/service_metrics_mapper.js @@ -192,6 +192,7 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({ work_status: 'HostRoles.state', passive_state: 'HostRoles.maintenance_state', display_name: 'HostRoles.display_name', + comp_id: 'HostRoles.id', component_name: 'HostRoles.component_name', host_id: 'HostRoles.host_name', host_name: 'HostRoles.host_name', diff --git a/ambari-web/app/mixins/main/host/details/host_components/decommissionable.js b/ambari-web/app/mixins/main/host/details/host_components/decommissionable.js index d3eb0c5..bb05d39 100644 --- a/ambari-web/app/mixins/main/host/details/host_components/decommissionable.js +++ b/ambari-web/app/mixins/main/host/details/host_components/decommissionable.js @@ -151,7 +151,7 @@ App.Decommissionable = Em.Mixin.create({ sender: this, data: { hostName: this.get('content.hostName'), - componentName: this.get('content.componentName') + componentId: this.get('content.compId') }, success: 'getDesiredAdminStateSuccessCallback', error: 'getDesiredAdminStateErrorCallback' diff --git a/ambari-web/app/mixins/main/host/details/host_components/install_component.js b/ambari-web/app/mixins/main/host/details/host_components/install_component.js index bfbf3b2..59b7d43 100644 --- a/ambari-web/app/mixins/main/host/details/host_components/install_component.js +++ b/ambari-web/app/mixins/main/host/details/host_components/install_component.js @@ -68,7 +68,7 @@ App.InstallComponent = Em.Mixin.create({ sender: App.router.get('mainHostDetailsController'), data: { hostName: params.hostName, - componentName: params.component.get('componentName'), + componentId: params.component.get('compId'), serviceName: params.component.get('serviceName'), component: params.component, "context": Em.I18n.t('requestInfo.installNewHostComponent') + " " + params.component.get('displayName'), diff --git a/ambari-web/app/mixins/main/host/details/support_client_configs_download.js b/ambari-web/app/mixins/main/host/details/support_client_configs_download.js index 0b880b4..1430cde 100644 --- a/ambari-web/app/mixins/main/host/details/support_client_configs_download.js +++ b/ambari-web/app/mixins/main/host/details/support_client_configs_download.js @@ -52,13 +52,14 @@ App.SupportClientConfigsDownload = Em.Mixin.create({ _getUrl: function (hostName, serviceName, componentName, resourceType) { var result; var prefix = App.get('apiPrefix') + '/clusters/' + App.router.getClusterName() + '/'; + var componentId = App.HostComponent.find().findProperty('componentName', componentName).get('compId'); switch (resourceType) { case this.resourceTypeEnum.SERVICE_COMPONENT: result = prefix + 'services/' + serviceName + '/components/' + componentName; break; case this.resourceTypeEnum.HOST_COMPONENT: - result = prefix + 'hosts/' + hostName + '/host_components/' + componentName; + result = prefix + 'hosts/' + hostName + '/host_components/' + componentId; break; case this.resourceTypeEnum.HOST: result = prefix + 'hosts/' + hostName + '/host_components'; diff --git a/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js b/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js index 4656c2e..9c4dd05 100644 --- a/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js +++ b/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js @@ -401,9 +401,10 @@ App.ComponentActionsByConfigs = Em.Mixin.create({ * @return {Object} */ getDeleteHostComponentRequest: function (hostName, component) { + let componentId = App.HostComponent.find().findProperty('componentName', component).get('compId') return { "type": 'DELETE', - "uri": "/clusters/" + App.get('clusterName') + "/hosts/" + hostName + "/host_components/" + component + "uri": "/clusters/" + App.get('clusterName') + "/hosts/" + hostName + "/host_components/" + componentId } }, diff --git a/ambari-web/app/mixins/wizard/wizardProgressPageController.js b/ambari-web/app/mixins/wizard/wizardProgressPageController.js index 3dcde74..fb39d47 100644 --- a/ambari-web/app/mixins/wizard/wizardProgressPageController.js +++ b/ambari-web/app/mixins/wizard/wizardProgressPageController.js @@ -654,7 +654,7 @@ App.wizardProgressPageControllerMixin = Em.Mixin.create(App.InstallComponent, { data: { hostName: component.hostName, serviceName: component.serviceName, - componentName: component.componentName, + componentId: component.id, HostRoles: { state: state }, @@ -768,7 +768,7 @@ App.wizardProgressPageControllerMixin = Em.Mixin.create(App.InstallComponent, { name: 'common.delete.host_component', sender: this, data: { - componentName: componentName, + componentId: App.HostComponent.find().findProperty('componentName', componentName).get('compId'), hostName: hostName }, success: 'onTaskCompleted', diff --git a/ambari-web/app/models/host_component.js b/ambari-web/app/models/host_component.js index 9e01c4d..255a929 100644 --- a/ambari-web/app/models/host_component.js +++ b/ambari-web/app/models/host_component.js @@ -21,6 +21,7 @@ var App = require('app'); App.HostComponent = DS.Model.extend({ workStatus: DS.attr('string'), passiveState: DS.attr('string'), + compId: DS.attr('string'), componentName: DS.attr('string'), displayName: DS.attr('string'), haStatus: DS.attr('string'), diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js index 8b1522b..a296ca9 100644 --- a/ambari-web/app/utils/ajax/ajax.js +++ b/ambari-web/app/utils/ajax/ajax.js @@ -112,7 +112,7 @@ var urls = { }, 'common.host_component.getNnCheckPointTime': { - 'real': '/clusters/{clusterName}/hosts/{host}/host_components/NAMENODE?fields=metrics/dfs/FSNamesystem/HAState,metrics/dfs/FSNamesystem/LastCheckpointTime', + 'real': '/clusters/{clusterName}/hosts/{host}/host_components/{nameNodeId}?fields=metrics/dfs/FSNamesystem/HAState,metrics/dfs/FSNamesystem/LastCheckpointTime', 'mock': '' }, @@ -178,7 +178,7 @@ var urls = { }, 'common.host.host_component.update': { - 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}?{urlParams}', + 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentId}?{urlParams}', 'mock': '/data/wizard/deploy/2_hosts/poll_9.json', 'type': 'PUT', 'format': function (data) { @@ -273,7 +273,7 @@ var urls = { 'service.flume.agent.command': { - 'real': '/clusters/{clusterName}/hosts/{host}/host_components/FLUME_HANDLER', + 'real': '/clusters/{clusterName}/hosts/{host}/host_components/{componentId}', 'mock': '', 'format': function (data) { return { @@ -357,7 +357,7 @@ var urls = { }, 'common.host.host_component.passive': { - 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}', + 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentId}', 'mock': '', 'type': 'PUT', 'format': function (data) { @@ -412,7 +412,7 @@ var urls = { 'type': 'DELETE' }, 'common.delete.host_component': { - 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}', + 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentId}', 'type': 'DELETE' }, 'common.delete.user': { @@ -973,7 +973,7 @@ var urls = { }, 'host.host_component.slave_desired_admin_state': { - 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}/?fields=HostRoles/desired_admin_state', + 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentId}/?fields=HostRoles/desired_admin_state', 'mock': '/data/hosts/HDP2/decommission_state.json' }, 'host.host_component.decommission_status': { @@ -985,7 +985,7 @@ var urls = { 'mock': '' }, 'host.host_component.decommission_status_datanode': { - 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}?fields=metrics/dfs/namenode', + 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentId}?fields=metrics/dfs/namenode', 'mock': '/data/hosts/HDP2/decommission_state.json' }, 'host.region_servers.in_inservice': { @@ -1437,15 +1437,15 @@ var urls = { 'mock': '/data/background_operations/host_upgrade_tasks.json' }, 'admin.high_availability.getNnCheckPointStatus': { - 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/NAMENODE', + 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{nameNodeId}', 'mock': '' }, 'admin.high_availability.getJnCheckPointStatus': { - 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/JOURNALNODE?fields=metrics', + 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{jnId}?fields=metrics', 'mock': '' }, 'admin.high_availability.getHostComponent': { - 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}', + 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentId}', 'mock': '' }, 'common.create_component': { @@ -2596,7 +2596,7 @@ var urls = { 'mock': '/data/views/instances.json' }, 'host.host_component.flume.metrics': { - 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/FLUME_HANDLER?fields=metrics/flume/flume/{flumeComponent}/*', + 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{flumeId}?fields=metrics/flume/flume/{flumeComponent}/*', 'mock': '' }, 'host.host_component.flume.metrics.timeseries': { diff --git a/ambari-web/app/views/main/host/details/host_component_views/datanode_view.js b/ambari-web/app/views/main/host/details/host_component_views/datanode_view.js index f0fe97f..25bf36e 100644 --- a/ambari-web/app/views/main/host/details/host_component_views/datanode_view.js +++ b/ambari-web/app/views/main/host/details/host_component_views/datanode_view.js @@ -31,12 +31,13 @@ App.DataNodeComponentView = App.HostComponentView.extend(App.Decommissionable, { var hdfs = App.HDFSService.find().objectAt(0); // TODO rewrite considering federation case and using activeNameNodes array var activeNNHostName = (!hdfs.get('snameNode') && hdfs.get('activeNameNode')) ? hdfs.get('activeNameNode.hostName') : hdfs.get('nameNode.hostName'); + var componentForCheckDecommission = this.get('componentForCheckDecommission'); return App.ajax.send({ name: 'host.host_component.decommission_status_datanode', sender: this, data: { hostName: activeNNHostName, - componentName: this.get('componentForCheckDecommission') + componentId: App.HostComponent.find().findProperty('componentName', componentForCheckDecommission).get('compId') }, success: 'getDNDecommissionStatusSuccessCallback', error: 'getDNDecommissionStatusErrorCallback' diff --git a/ambari-web/app/views/main/service/info/metrics/flume/flume_metric_graph.js b/ambari-web/app/views/main/service/info/metrics/flume/flume_metric_graph.js index bb028f5..692d94d 100644 --- a/ambari-web/app/views/main/service/info/metrics/flume/flume_metric_graph.js +++ b/ambari-web/app/views/main/service/info/metrics/flume/flume_metric_graph.js @@ -43,7 +43,7 @@ App.ChartServiceFlumeMetricGraph = App.ChartLinearTimeView.extend({ getDataForAjaxRequest: function() { var data = this._super(); - + var flumeId = App.HostComponent.find().findProperty('componentName', 'FLUME_HANDLER').get('compId'); var urlFields = ''; this.get('metricItems').forEach(function (metricItem, index) { urlFields += index === 0 ? '' : ','; @@ -51,7 +51,7 @@ App.ChartServiceFlumeMetricGraph = App.ChartLinearTimeView.extend({ '[' + data.fromSeconds + ',' + data.toSeconds + ',' + data.stepSeconds + ']' }, this); - data.url = App.get('apiPrefix') + '/clusters/' + App.get('clusterName') + '/hosts/' + this.get('hostName') + '/host_components/FLUME_HANDLER?fields=' + urlFields; + data.url = App.get('apiPrefix') + '/clusters/' + App.get('clusterName') + '/hosts/' + this.get('hostName') + '/host_components/' + flumeId + '?fields=' + urlFields; return data; }, diff --git a/ambari-web/app/views/main/service/info/metrics/flume/flume_metric_graphs.js b/ambari-web/app/views/main/service/info/metrics/flume/flume_metric_graphs.js index 415d423..2c9c428 100644 --- a/ambari-web/app/views/main/service/info/metrics/flume/flume_metric_graphs.js +++ b/ambari-web/app/views/main/service/info/metrics/flume/flume_metric_graphs.js @@ -34,7 +34,8 @@ App.MainServiceInfoFlumeGraphsView = App.MainServiceInfoSummaryMetricGraphsView. 'success': 'onLoadMetricsSuccess', 'data': { hostName: hostName, - flumeComponent: metricType + flumeComponent: metricType, + flumeId: App.HostComponent.find().findProperty('componentName', 'FLUME_HANDLER').get('compId') } }); } diff --git a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step4_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step4_controller_test.js index bfc991f..199dd41 100644 --- a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step4_controller_test.js +++ b/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step4_controller_test.js @@ -123,6 +123,7 @@ describe('App.HighAvailabilityWizardStep4Controller', function() { describe('#pullCheckPointStatus', function() { it('App.ajax.send should be called', function() { + sinon.stub(App.HostComponent, 'find').returns([Em.Object.create({'componentName': 'NAMENODE', 'compId': '1'})]); controller.set('content.masterComponentHosts', [ { component: 'NAMENODE', @@ -136,10 +137,12 @@ describe('App.HighAvailabilityWizardStep4Controller', function() { name: 'admin.high_availability.getNnCheckPointStatus', sender: controller, data: { - hostName: 'host1' + hostName: 'host1', + nameNodeId: '1' }, success: 'checkNnCheckPointStatus' }); + App.HostComponent.find.restore(); }); }); diff --git a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step5_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step5_controller_test.js index ecc513d..177d460 100644 --- a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step5_controller_test.js +++ b/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step5_controller_test.js @@ -87,6 +87,7 @@ describe('App.HighAvailabilityWizardStep5Controller', function() { describe('#disableSNameNode', function() { it('App.ajax.send should be called', function() { + sinon.stub(App.HostComponent, 'find').returns([Em.Object.create({'componentName': 'SECONDARY_NAMENODE', 'compId': '1'})]); controller.set('content.masterComponentHosts', [ { component: 'SECONDARY_NAMENODE', @@ -101,11 +102,12 @@ describe('App.HighAvailabilityWizardStep5Controller', function() { data: { hostName: 'host1', passive_state: "ON", - componentName: 'SECONDARY_NAMENODE' + componentId: '1' }, success: 'onTaskCompleted', error: 'onTaskError' }); + App.HostComponent.find.restore(); }); }); diff --git a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step6_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step6_controller_test.js index f66c4df..2a453ee 100644 --- a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step6_controller_test.js +++ b/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step6_controller_test.js @@ -90,16 +90,19 @@ describe('App.HighAvailabilityWizardStep6Controller', function() { describe('#pullEachJnStatus', function() { it('App.ajax.send should be called', function() { + sinon.stub(App.HostComponent, 'find').returns([Em.Object.create({'componentName': 'JOURNALNODE', 'compId': '1'})]); controller.pullEachJnStatus('host1'); var args = testHelpers.findAjaxRequest('name', 'admin.high_availability.getJnCheckPointStatus'); expect(args[0]).to.be.eql({ name: 'admin.high_availability.getJnCheckPointStatus', sender: controller, data: { - hostName: 'host1' + hostName: 'host1', + jnId: '1' }, success: 'checkJnCheckPointStatus' }); + App.HostComponent.find.restore(); }); }); diff --git a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step9_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step9_controller_test.js index 246fa9e..9468c79 100644 --- a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step9_controller_test.js +++ b/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step9_controller_test.js @@ -319,6 +319,7 @@ describe('App.HighAvailabilityWizardStep9Controller', function() { describe('#deleteSNameNode', function() { it('App.ajax.send should be called', function() { + sinon.stub(App.HostComponent, 'find').returns([Em.Object.create({'componentName': 'SECONDARY_NAMENODE', 'compId': '1'})]); controller.set('content.masterComponentHosts', [ { component: 'SECONDARY_NAMENODE', @@ -331,12 +332,13 @@ describe('App.HighAvailabilityWizardStep9Controller', function() { name: 'common.delete.host_component', sender: controller, data: { - componentName: 'SECONDARY_NAMENODE', + componentId: '1', hostName: 'host1' }, success: 'onTaskCompleted', error: 'onTaskError' }); + App.HostComponent.find.restore(); }); }); }); diff --git a/ambari-web/test/controllers/main/admin/kerberos/step6_controller_test.js b/ambari-web/test/controllers/main/admin/kerberos/step6_controller_test.js index b89a91f..8b17772 100644 --- a/ambari-web/test/controllers/main/admin/kerberos/step6_controller_test.js +++ b/ambari-web/test/controllers/main/admin/kerberos/step6_controller_test.js @@ -103,6 +103,7 @@ describe('App.KerberosWizardStep6Controller', function() { beforeEach(function() { sinon.stub(App.HostComponent, 'find').returns([Em.Object.create({ componentName: 'APP_TIMELINE_SERVER', + compId: '1', hostName: 'host1' })]); }); @@ -118,7 +119,7 @@ describe('App.KerberosWizardStep6Controller', function() { name: 'common.delete.host_component', sender: controller, data: { - componentName: 'APP_TIMELINE_SERVER', + componentId: '1', hostName: 'host1' }, success: 'onDeleteATSSuccess', diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js index a619270..f3f3b9d 100644 --- a/ambari-web/test/controllers/main/host/details_test.js +++ b/ambari-web/test/controllers/main/host/details_test.js @@ -133,13 +133,16 @@ describe('App.MainHostDetailsController', function () { describe("#pullNnCheckPointTime()", function() { it("valid request is sent", function() { + sinon.stub(App.HostComponent, 'find').returns([Em.Object.create({'componentName': 'NAMENODE', 'compId': '1'})]); controller.pullNnCheckPointTime('host1'); var args = testHelpers.findAjaxRequest('name', 'common.host_component.getNnCheckPointTime'); expect(args[0]).to.exists; expect(args[0].sender).to.be.eql(controller); expect(args[0].data).to.be.eql({ - host: 'host1' + host: 'host1', + nameNodeId: '1' }); + App.HostComponent.find.restore(); }); }); @@ -2696,24 +2699,35 @@ describe('App.MainHostDetailsController', function () { }); describe('#_doDeleteHostComponent()', function () { + + beforeEach(function () { + this.mock = sinon.stub(App.HostComponent, 'find'); + }); + + afterEach(function () { + this.mock.restore(); + }); + it('single component', function () { + this.mock.returns([Em.Object.create({'componentName': 'COMP', 'compId': '1'})]); controller.set('content.hostName', 'host1'); var componentName = 'COMP'; controller._doDeleteHostComponent(componentName); var args = testHelpers.findAjaxRequest('name', 'common.delete.host_component'); expect(args[0]).exists; expect(args[0].data).to.be.eql({ - componentName: 'COMP', + componentId: '1', hostName: 'host1' }); }); it('all components', function () { + this.mock.returns([]); controller.set('content.hostName', 'host1'); controller._doDeleteHostComponent(null); var args = testHelpers.findAjaxRequest('name', 'common.delete.host'); expect(args[0]).exists; expect(args[0].data).to.be.eql({ - componentName: '', + componentId: '', hostName: 'host1' }); }); @@ -2828,14 +2842,14 @@ describe('App.MainHostDetailsController', function () { it('popup should be displayed', function () { controller.set('content.hostName', 'host1'); var component = Em.Object.create({ - componentName: 'COMP1' + compId: '1' }); controller.updateComponentPassiveState(component, 'state', 'message'); var args = testHelpers.findAjaxRequest('name', 'common.host.host_component.passive'); expect(args[0]).exists; expect(args[0].data).to.be.eql({ "hostName": "host1", - "componentName": "COMP1", + "componentId": "1", "component": component, "passive_state": "state", "context": "message" diff --git a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js index 42f6f91..c7ba3b7 100644 --- a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js +++ b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js @@ -711,19 +711,24 @@ describe('App.ReassignMasterWizardStep4Controller', function () { expect(args).not.exists; }); it('delete two components', function () { - controller.set('hostComponents', [1, 2]); + sinon.stub(App.HostComponent, 'find').returns([ + Em.Object.create({'componentName': 'COMP1', 'compId': '1'}), + Em.Object.create({'componentName': 'COMP2', 'compId': '2'}) + ]); + controller.set('hostComponents', ["COMP1", "COMP2"]); controller.set('content.reassignHosts.source', 'host1'); controller.deleteHostComponents(); var args = testHelpers.filterAjaxRequests('name', 'common.delete.host_component'); expect(args).to.have.property('length').equal(2); expect(args[0][0].data).to.eql({ "hostName": "host1", - "componentName": 1 + "componentId": "1" }); expect(args[1][0].data).to.eql({ "hostName": "host1", - "componentName": 2 + "componentId": "2" }); + App.HostComponent.find.restore(); }); }); @@ -951,6 +956,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () { sinon.stub(App.HostComponent, 'find').returns([ Em.Object.create({ componentName: 'MYSQL_SERVER', + compId: '1', hostName: 'host1' }) ]); @@ -967,7 +973,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () { context: "Start MySQL Server", hostName: 'host1', serviceName: "HIVE", - componentName: "MYSQL_SERVER", + componentId: "1", HostRoles: { state: "STARTED" } @@ -1017,6 +1023,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () { describe("#startNewMySqlServer()", function() { beforeEach(function () { + sinon.stub(App.HostComponent, 'find').returns([Em.Object.create({'componentName': 'MYSQL_SERVER', 'compId': '1'})]); controller.set('content', Em.Object.create({ reassignHosts: Em.Object.create({ target: 'host1' @@ -1025,6 +1032,9 @@ describe('App.ReassignMasterWizardStep4Controller', function () { controller.startNewMySqlServer(); this.args = testHelpers.findAjaxRequest('name', 'common.host.host_component.update'); }); + afterEach(function () { + App.HostComponent.find.restore(); + }); it('valid request is sent', function() { expect(this.args[0]).exists; @@ -1033,7 +1043,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () { context: "Start MySQL Server", hostName: 'host1', serviceName: "HIVE", - componentName: "MYSQL_SERVER", + componentId: "1", HostRoles: { state: "STARTED" } diff --git a/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js index c901bf6..64f17f8 100644 --- a/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js +++ b/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js @@ -244,19 +244,24 @@ describe('App.ReassignMasterWizardStep6Controller', function () { expect(args).not.exists; }); it('delete two components', function () { - controller.set('hostComponents', [1, 2]); + sinon.stub(App.HostComponent, 'find').returns([ + Em.Object.create({'componentName': 'COMP1', 'compId': '1'}), + Em.Object.create({'componentName': 'COMP2', 'compId': '2'}) + ]); + controller.set('hostComponents', ['COMP1', 'COMP2']); controller.set('content.reassignHosts.source', 'host1'); controller.deleteHostComponents(); var args = testHelpers.filterAjaxRequests('name', 'common.delete.host_component'); expect(args).to.have.property('length').equal(2); expect(args[0][0].data).to.eql({ "hostName": "host1", - "componentName": 1 + "componentId": "1" }); expect(args[1][0].data).to.eql({ "hostName": "host1", - "componentName": 2 + "componentId": "2" }); + App.HostComponent.find.restore(); }); }); @@ -288,9 +293,11 @@ describe('App.ReassignMasterWizardStep6Controller', function () { describe('#stopMysqlService()', function () { it('stopMysqlService', function () { + sinon.stub(App.HostComponent, 'find').returns([Em.Object.create({'componentName': 'MYSQL_SERVER', 'compId': '1'})]); controller.stopMysqlService(); var args = testHelpers.findAjaxRequest('name', 'common.host.host_component.update'); expect(args[0]).exists; + App.HostComponent.find.restore(); }); }); diff --git a/ambari-web/test/controllers/main/service/reassign/step7_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step7_controller_test.js index 6f16f0f..0257f59 100644 --- a/ambari-web/test/controllers/main/service/reassign/step7_controller_test.js +++ b/ambari-web/test/controllers/main/service/reassign/step7_controller_test.js @@ -43,6 +43,15 @@ describe('App.ReassignMasterWizardStep7Controller', function () { }); describe("#putHostComponentsInMaintenanceMode()", function() { + beforeEach(function(){ + sinon.stub(App.HostComponent, 'find').returns([ + Em.Object.create({'componentName': 'C1', 'compId': '1'}), + Em.Object.create({'componentName': 'C2', 'compId': '2'}) + ]); + }); + afterEach(function(){ + App.HostComponent.find.restore(); + }); it("no host-components", function() { controller.set('hostComponents', []); controller.putHostComponentsInMaintenanceMode(); @@ -60,7 +69,7 @@ describe('App.ReassignMasterWizardStep7Controller', function () { expect(args[0].data).to.be.eql({ hostName: 'host1', passive_state: "ON", - componentName: 'C1' + componentId: '1' }); expect(controller.get('multiTaskCounter')).to.equal(0); }); @@ -74,6 +83,15 @@ describe('App.ReassignMasterWizardStep7Controller', function () { }); describe("#deleteHostComponents()", function() { + beforeEach(function(){ + sinon.stub(App.HostComponent, 'find').returns([ + Em.Object.create({'componentName': 'C1', 'compId': '1'}), + Em.Object.create({'componentName': 'C2', 'compId': '2'}) + ]); + }); + afterEach(function(){ + App.HostComponent.find.restore(); + }); it("no host-components", function() { controller.set('hostComponents', []); controller.deleteHostComponents(); @@ -90,7 +108,7 @@ describe('App.ReassignMasterWizardStep7Controller', function () { expect(args[0].sender).to.be.eql(controller); expect(args[0].data).to.be.eql({ hostName: 'host1', - componentName: 'C1' + componentId: '1' }); expect(controller.get('multiTaskCounter')).to.equal(0); }); diff --git a/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js b/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js index 234468e..054a07f 100644 --- a/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js +++ b/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js @@ -74,7 +74,7 @@ describe('App.InstallComponent', function () { var params = { hostName: 'host1', component: Em.Object.create({ - componentName: 'C1', + compId: '1', serviceName: 'S1', displayName: 'c1' }) @@ -86,7 +86,7 @@ describe('App.InstallComponent', function () { expect(args[0]).exists; expect(args[0].data).to.be.eql({ hostName: 'host1', - componentName: 'C1', + componentId: '1', serviceName: 'S1', component: params.component, "context": Em.I18n.t('requestInfo.installNewHostComponent') + ' c1', diff --git a/ambari-web/test/mixins/main/service/configs/component_actions_by_configs_test.js b/ambari-web/test/mixins/main/service/configs/component_actions_by_configs_test.js index a926ac2..a1f7619 100644 --- a/ambari-web/test/mixins/main/service/configs/component_actions_by_configs_test.js +++ b/ambari-web/test/mixins/main/service/configs/component_actions_by_configs_test.js @@ -430,10 +430,12 @@ describe('App.ComponentActionsByConfigs', function () { describe("#getDeleteHostComponentRequest()", function () { it("should return request object", function() { + sinon.stub(App.HostComponent, 'find').returns([Em.Object.create({'componentName': 'C1', 'compId': '1'})]); expect(mixin.getDeleteHostComponentRequest('host1', 'C1')).to.be.eql({ "type": 'DELETE', - "uri": "/clusters/mycluster/hosts/host1/host_components/C1" + "uri": "/clusters/mycluster/hosts/host1/host_components/1" }); + App.HostComponent.find.restore(); }); }); diff --git a/ambari-web/test/views/main/host/details/host_component_views/datanode_view_test.js b/ambari-web/test/views/main/host/details/host_component_views/datanode_view_test.js index e7b7eef..d924a35 100644 --- a/ambari-web/test/views/main/host/details/host_component_views/datanode_view_test.js +++ b/ambari-web/test/views/main/host/details/host_component_views/datanode_view_test.js @@ -30,11 +30,13 @@ describe('App.DataNodeComponentView', function () { describe("#getDNDecommissionStatus()", function () { beforeEach(function () { + sinon.stub(App.HostComponent, 'find').returns([Em.Object.create({'componentName': 'NAMENODE', 'compId': '1'})]); this.stub = sinon.stub(App.HDFSService, 'find'); }); afterEach(function () { this.stub.restore(); + App.HostComponent.find.restore(); }); it("snameNode absent and no activeNameNode", function () { @@ -50,7 +52,7 @@ describe('App.DataNodeComponentView', function () { expect(args[0]).exists; expect(args[0].data).to.be.eql({ "hostName": "host1", - "componentName": "NAMENODE" + "componentId": "1" }); }); @@ -67,7 +69,7 @@ describe('App.DataNodeComponentView', function () { expect(args[0]).exists; expect(args[0].data).to.be.eql({ "hostName": "host1", - "componentName": "NAMENODE" + "componentId": "1" }); }); @@ -84,7 +86,7 @@ describe('App.DataNodeComponentView', function () { expect(args[0]).exists; expect(args[0].data).to.be.eql({ "hostName": "host2", - "componentName": "NAMENODE" + "componentId": "1" }); }); diff --git a/ambari-web/test/views/main/host/details/host_component_views/decommissionable_test.js b/ambari-web/test/views/main/host/details/host_component_views/decommissionable_test.js index bc3c280..2b286e7 100644 --- a/ambari-web/test/views/main/host/details/host_component_views/decommissionable_test.js +++ b/ambari-web/test/views/main/host/details/host_component_views/decommissionable_test.js @@ -237,7 +237,7 @@ describe('App.Decommissionable', function() { hostComponentView = Em.View.create(App.Decommissionable, { content: Em.Object.create({ hostName: 'host1', - componentName: 'C1' + compId: '1' }) }); hostComponentView.getDesiredAdminState(); @@ -246,7 +246,7 @@ describe('App.Decommissionable', function() { expect(args[0].sender).to.be.eql(hostComponentView); expect(args[0].data).to.be.eql({ hostName: 'host1', - componentName: 'C1' + componentId: '1' }); }); }); -- To stop receiving notification emails like this one, please contact ishan...@apache.org.