You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2016/02/11 17:17:54 UTC
[1/2] ambari git commit: Revert "AMBARI-14936. Tweaks to reduce build
time (aonishuk)"
Repository: ambari
Updated Branches:
refs/heads/trunk 754d0fad5 -> 58fe67c19
Revert "AMBARI-14936. Tweaks to reduce build time (aonishuk)"
This reverts commit dc8e5c3c68d25e74ab875a87f66959fc86a9631c.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/58fe67c1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/58fe67c1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/58fe67c1
Branch: refs/heads/trunk
Commit: 58fe67c199b9dde7cd0963c9567e728db983def0
Parents: fdb101b
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Feb 11 18:14:51 2016 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Feb 11 18:17:50 2016 +0200
----------------------------------------------------------------------
ambari-agent/pom.xml | 40 +++++++++++------------
ambari-server/pom.xml | 6 ++--
ambari-server/src/main/assemblies/server.xml | 2 +-
ambari-web/pom.xml | 3 +-
pom.xml | 18 +++++++++-
5 files changed, 42 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/58fe67c1/ambari-agent/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml
index c2c993f..23d2969 100644
--- a/ambari-agent/pom.xml
+++ b/ambari-agent/pom.xml
@@ -86,6 +86,24 @@
<version>3.0</version>
</plugin>
<plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <descriptors>
+ <descriptor>src/packages/tarball/all.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>build-tarball</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
@@ -257,24 +275,6 @@
</configuration>
</plugin>
<plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <tarLongFileMode>gnu</tarLongFileMode>
- <descriptors>
- <descriptor>src/packages/tarball/all.xml</descriptor>
- </descriptors>
- </configuration>
- <executions>
- <execution>
- <id>build-tarball</id>
- <phase>${assemblyPhase}</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
@@ -347,7 +347,7 @@
</execution>
<execution>
<id>copy-repo-resources</id>
- <phase>${assemblyPhase}</phase>
+ <phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
@@ -391,7 +391,7 @@
<executions>
<execution>
<id>rename-file</id>
- <phase>${assemblyPhase}</phase>
+ <phase>package</phase>
<goals>
<goal>rename</goal>
</goals>
http://git-wip-us.apache.org/repos/asf/ambari/blob/58fe67c1/ambari-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index 51fd88b..5a95ec4 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -134,7 +134,7 @@
<executions>
<execution>
<id>build-tarball</id>
- <phase>${assemblyPhase}</phase>
+ <phase>package</phase>
<goals>
<goal>single</goal>
</goals>
@@ -173,7 +173,7 @@
</execution>
<execution>
<id>copy-repo-resources</id>
- <phase>${assemblyPhase}</phase>
+ <phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
@@ -217,7 +217,7 @@
<executions>
<execution>
<id>rename-file</id>
- <phase>${assemblyPhase}</phase>
+ <phase>package</phase>
<goals>
<goal>rename</goal>
</goals>
http://git-wip-us.apache.org/repos/asf/ambari/blob/58fe67c1/ambari-server/src/main/assemblies/server.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/assemblies/server.xml b/ambari-server/src/main/assemblies/server.xml
index ca74185..a75de79 100644
--- a/ambari-server/src/main/assemblies/server.xml
+++ b/ambari-server/src/main/assemblies/server.xml
@@ -301,7 +301,7 @@
</file>
<file>
<fileMode>755</fileMode>
- <source>src/main/resources/stacks/stack_advisor.py</source>
+ <source>target/classes/stacks/stack_advisor.py</source>
<outputDirectory>/var/lib/ambari-server/resources/stacks</outputDirectory>
</file>
<file>
http://git-wip-us.apache.org/repos/asf/ambari/blob/58fe67c1/ambari-web/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-web/pom.xml b/ambari-web/pom.xml
index 6304b3d..761a3f0 100644
--- a/ambari-web/pom.xml
+++ b/ambari-web/pom.xml
@@ -32,7 +32,6 @@
<properties>
<ambari.dir>${project.parent.parent.basedir}</ambari.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <nodemodules.dir>node_modules</nodemodules.dir> <!-- specify -Dnodemodules.dir option to reduce ambari-web build time by not re-downloading npm modules -->
</properties>
<build>
<plugins>
@@ -101,7 +100,7 @@
<configuration>
<executable>${executable.rmdir}</executable>
<workingDirectory>${basedir}</workingDirectory>
- <commandlineArgs>${args.rm.clean} public ${nodemodules.dir}</commandlineArgs>
+ <commandlineArgs>${args.rm.clean} public node_modules</commandlineArgs>
<successCodes>
<successCode>0</successCode>
<successCode>1</successCode>
http://git-wip-us.apache.org/repos/asf/ambari/blob/58fe67c1/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8f321fd..57c6de7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,7 +60,6 @@
<distMgmtStagingId>apache.staging.https</distMgmtStagingId>
<distMgmtStagingName>Apache Release Distribution Repository</distMgmtStagingName>
<distMgmtStagingUrl>https://repository.apache.org/service/local/staging/deploy/maven2</distMgmtStagingUrl>
- <assemblyPhase>package</assemblyPhase> <!-- use -DassemblyPhase=none to skip building tarball, useful when you want purely compile jar -->
</properties>
<pluginRepositories>
<pluginRepository>
@@ -204,6 +203,23 @@
</configuration>
</plugin>
<plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>${ambari.dir}/ambari-project/src/main/assemblies/empty.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.0.1</version>
[2/2] ambari git commit: AMBARI-15009. Log Search: Add link to
background operations popup navigate to Host Details Logs tab with pre-set
condition (alexantonenko)
Posted by al...@apache.org.
AMBARI-15009. Log Search: Add link to background operations popup navigate to Host Details Logs tab with pre-set condition (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fdb101bd
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fdb101bd
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fdb101bd
Branch: refs/heads/trunk
Commit: fdb101bdd78a4d6d2626008dc4a146374283e8f3
Parents: 754d0fa
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Feb 11 12:46:33 2016 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Feb 11 18:17:50 2016 +0200
----------------------------------------------------------------------
.../main/admin/kerberos/step7_controller.js | 12 ++--
ambari-web/app/messages.js | 1 +
ambari-web/app/styles/application.less | 12 ++--
.../templates/common/host_progress_popup.hbs | 5 ++
ambari-web/app/utils/ajax/ajax.js | 15 ++++
ambari-web/app/views/application.js | 22 ++----
.../common/host_progress_popup_body_view.js | 75 +++++++++++++++++++-
.../app/views/common/log_file_search_view.js | 2 +-
ambari-web/app/views/common/modal_popup.js | 27 +++++++
.../modal_popups/log_file_search_popup.js | 12 +++-
.../host_progress_popup_body_view_test.js | 54 +++++++++++++-
11 files changed, 204 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/fdb101bd/ambari-web/app/controllers/main/admin/kerberos/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/step7_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step7_controller.js
index 71e94ca..2a4fb90 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/step7_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/step7_controller.js
@@ -48,13 +48,13 @@ App.KerberosWizardStep7Controller = App.KerberosProgressPageController.extend({
}
};
if (isRetry) {
- // on retry we have to unkerberize cluster
- this.unkerberizeCluster().always(function() {
- // clear current request object before start of kerberize process
- self.set('request', kerberizeRequest);
- self.clearStage();
- self.loadStep();
+ // on retry send force update
+ self.set('request', {
+ name: 'KERBERIZE_CLUSTER',
+ ajaxName: 'admin.kerberize.cluster.force'
});
+ self.clearStage();
+ self.loadStep();
} else {
this.set('request', kerberizeRequest);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/fdb101bd/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 59877a5..909f55c 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -313,6 +313,7 @@ Em.I18n.translations = {
'common.keywords': 'Keywods',
'common.levels': 'Levels',
'common.extension': 'Extension',
+ 'common.logs': 'Logs',
'models.alert_instance.tiggered.verbose': "Occurred on {0} <br> Checked on {1}",
'models.alert_definition.triggered.verbose': "Occurred on {0}",
http://git-wip-us.apache.org/repos/asf/ambari/blob/fdb101bd/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 57b7e76..4e2b5d1 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -1861,13 +1861,13 @@ a:focus {
float: right;
a {
cursor: pointer;
- }
- .task-detail-copy {
- margin-right: 12px;
float: left;
- }
- .task-detail-open-dialog {
- float: right;
+ margin-right: 12px;
+
+ &:last-child {
+ margin-right: 0;
+ float: right;
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/fdb101bd/ambari-web/app/templates/common/host_progress_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/host_progress_popup.hbs b/ambari-web/app/templates/common/host_progress_popup.hbs
index 00f2e08..fe330f7 100644
--- a/ambari-web/app/templates/common/host_progress_popup.hbs
+++ b/ambari-web/app/templates/common/host_progress_popup.hbs
@@ -195,6 +195,11 @@
<div class="task-detail-ico-wrap">
<a {{translateAttr title="common.fullLogPopup.clickToCopy"}} {{action "textTrigger" taskInfo target="view"}} class="task-detail-copy"><i
class="icon-copy"></i> {{t common.copy}}</a>
+ {{#if App.supports.logSearch}}
+ <a {{action navigateToHostLogs target="view"}} {{bindAttr class="view.isLogsLinkVisible::hidden"}} href="#">
+ <i class="icon-file"></i> {{t common.logs}}
+ </a>
+ {{/if}}
<a {{translateAttr title="common.openNewWindow"}} {{action openTaskLogInDialog}} class="task-detail-open-dialog"><i
class="icon-external-link"></i> {{t common.open}}</a>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/fdb101bd/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index ce6a196..f2174f3 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1477,6 +1477,21 @@ var urls = {
}
},
+ 'admin.kerberize.cluster.force': {
+ 'type': 'PUT',
+ 'real': '/clusters/{clusterName}?force_toggle_kerberos=true',
+ 'mock': '/data/wizard/kerberos/kerberize_cluster.json',
+ 'format': function (data) {
+ return {
+ data: JSON.stringify({
+ Clusters: {
+ security_type: "KERBEROS"
+ }
+ })
+ }
+ }
+ },
+
'admin.unkerberize.cluster.skip': {
'type': 'PUT',
'real': '/clusters/{clusterName}?manage_kerberos_identities=false',
http://git-wip-us.apache.org/repos/asf/ambari/blob/fdb101bd/ambari-web/app/views/application.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/application.js b/ambari-web/app/views/application.js
index 8a83144..2a8ea00 100644
--- a/ambari-web/app/views/application.js
+++ b/ambari-web/app/views/application.js
@@ -26,28 +26,16 @@ App.ApplicationView = Em.View.extend({
// on 'Enter' pressed, trigger modal window primary button if primary button is enabled(green)
// on 'Esc' pressed, close the modal
$(document).keydown(function(event){
- if (event.which == 13 || event.keyCode == 13 ) {
- var primaryButton = $(document).find('#modal > .modal-footer > .btn-success').last();
- if ((!$("*:focus").is("textarea")) && primaryButton.length > 0 && primaryButton.attr('disabled') != 'disabled') {
- event.preventDefault();
- event.stopPropagation();
- primaryButton.click();
- return false;
- }
+ if (event.which === 13 || event.keyCode === 13 ) {
+ $('#modal').trigger('enter-key-pressed');
}
return true;
});
$(document).keyup(function(event){
- if (event.which == 27 || event.keyCode == 27) {
- var closeButton = $(document).find('#modal > .modal-header > .close').last();
- if (closeButton.length > 0) {
- event.preventDefault();
- event.stopPropagation();
- closeButton.click();
- return false;
- }
+ if (event.which === 27 || event.keyCode === 27) {
+ $('#modal').trigger('escape-key-pressed');
}
return true;
});
}
-});
\ No newline at end of file
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/fdb101bd/ambari-web/app/views/common/host_progress_popup_body_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/host_progress_popup_body_view.js b/ambari-web/app/views/common/host_progress_popup_body_view.js
index cdabc5e..197551f 100644
--- a/ambari-web/app/views/common/host_progress_popup_body_view.js
+++ b/ambari-web/app/views/common/host_progress_popup_body_view.js
@@ -21,6 +21,12 @@ var batchUtils = require('utils/batch_scheduled_requests');
var date = require('utils/date/date');
/**
+ * @typedef {object} TaskRelationObject
+ * @property {string} type relation type 'service', 'component'
+ * @property {string} [value] optional value of relation e.g. name of component or service
+ */
+
+/**
* Option for "filter by state" dropdown
* @typedef {object} progressPopupCategoryObject
* @property {string} value "all|pending|in progress|failed|completed|aborted|timedout"
@@ -576,6 +582,73 @@ App.HostProgressPopupBodyView = App.TableView.extend({
},
/**
+ * Navigate to host details logs tab with preset filter.
+ */
+ navigateToHostLogs: function() {
+ var relationType = this._determineRoleRelation(this.get('openedTask')),
+ hostModel = App.Host.find().findProperty('id', this.get('currentHost.name')),
+ queryParams = [],
+ model;
+
+ if (relationType.type === 'component') {
+ model = App.StackServiceComponent.find().findProperty('componentName', relationType.value);
+ queryParams.push('service_name=' + model.get('serviceName'));
+ queryParams.push('component_name=' + relationType.value);
+ }
+ if (relationType.type === 'service') {
+ queryParams.push('service_name=' + relationType.value);
+ }
+ App.router.transitionTo('main.hosts.hostDetails.logs', hostModel, { query: '?' + queryParams.join('&') });
+ if (this.get('parentView') && typeof this.get('parentView').onClose === 'function') this.get('parentView').onClose();
+ },
+
+ /**
+ /**
+ * Determines if opened task related to service or component.
+ *
+ * @return {boolean} <code>true</code> when relates to service or component
+ */
+ isLogsLinkVisible: function() {
+ if (!this.get('openedTask') || !this.get('openedTask.id')) return false;
+ return !!this._determineRoleRelation(this.get('openedTask'));
+ }.property('openedTask'),
+
+ /**
+ * @param {wrappedTask} taskInfo
+ * @return {boolean|TaskRelationObject}
+ */
+ _determineRoleRelation: function(taskInfo) {
+ var foundComponentName,
+ foundServiceName,
+ componentNames = App.StackServiceComponent.find().mapProperty('componentName'),
+ serviceNames = App.StackService.find().mapProperty('serviceName'),
+ taskLog = this.get('currentHost.logTasks').findProperty('Tasks.id', Em.get(taskInfo, 'id')) || {},
+ role = Em.getWithDefault(taskLog, 'Tasks.role', false),
+ eqlFn = function(compare) {
+ return function(item) {
+ return item === compare;
+ };
+ };
+
+ if (!role) {
+ return false;
+ }
+ // component service check
+ if (role.endsWith('_SERVICE_CHECK')) {
+ role = role.replace('_SERVICE_CHECK', '');
+ }
+ foundComponentName = componentNames.filter(eqlFn(role))[0];
+ foundServiceName = serviceNames.filter(eqlFn(role))[0];
+ if (foundComponentName || foundServiceName) {
+ return {
+ type: foundComponentName ? 'component' : 'service',
+ value: foundComponentName || foundServiceName
+ }
+ }
+ return false;
+ },
+
+ /**
* @type {boolean}
*/
isRequestSchedule: function () {
@@ -745,4 +818,4 @@ App.HostProgressPopupBodyView = App.TableView.extend({
$(".task-detail-log-maintext").css("display", "block");
}
-});
\ No newline at end of file
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/fdb101bd/ambari-web/app/views/common/log_file_search_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/log_file_search_view.js b/ambari-web/app/views/common/log_file_search_view.js
index c242ec8..6d402d1 100644
--- a/ambari-web/app/views/common/log_file_search_view.js
+++ b/ambari-web/app/views/common/log_file_search_view.js
@@ -128,7 +128,7 @@ App.LogFileSearchView = Em.View.extend(App.InfiniteScrollMixin, {
/**
* Make request and get content with applied filters.
*/
- fetchContent: function(params) {
+ fetchContent: function() {
console.debug('Make Request with params:', this.serializeFilters());
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/fdb101bd/ambari-web/app/views/common/modal_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popup.js b/ambari-web/app/views/common/modal_popup.js
index 3402e80..f016fcf 100644
--- a/ambari-web/app/views/common/modal_popup.js
+++ b/ambari-web/app/views/common/modal_popup.js
@@ -65,6 +65,9 @@ App.ModalPopup = Ember.View.extend({
showCloseButton: true,
didInsertElement: function () {
+ this.$().find('#modal')
+ .on('enter-key-pressed', this.enterKeyPressed.bind(this))
+ .on('escape-key-pressed', this.escapeKeyPressed.bind(this));
if (this.autoHeight && !$.mocho) {
var block = this.$().find('#modal > .modal-body').first();
if(block.offset()) {
@@ -76,6 +79,30 @@ App.ModalPopup = Ember.View.extend({
this.focusElement(firstInputElement);
},
+ willDestroyElement: function() {
+ this.$().find('#modal').off('enter-key-pressed').off('escape-key-pressed');
+ },
+
+ escapeKeyPressed: function() {
+ var closeButton = this.$().find('.modal-header > .close').last();
+ if (closeButton.length > 0) {
+ event.preventDefault();
+ event.stopPropagation();
+ closeButton.click();
+ return false;
+ }
+ },
+
+ enterKeyPressed: function() {
+ var primaryButton = this.$().find('.modal-footer > .btn-success').last();
+ if ((!$("*:focus").is("textarea")) && primaryButton.length > 0 && primaryButton.attr('disabled') !== 'disabled') {
+ event.preventDefault();
+ event.stopPropagation();
+ primaryButton.click();
+ return false;
+ }
+ },
+
/**
* If popup is opened from another popup it should be displayed above
* @method fitZIndex
http://git-wip-us.apache.org/repos/asf/ambari/blob/fdb101bd/ambari-web/app/views/common/modal_popups/log_file_search_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popups/log_file_search_popup.js b/ambari-web/app/views/common/modal_popups/log_file_search_popup.js
index 4730a19..4e2032b 100644
--- a/ambari-web/app/views/common/modal_popups/log_file_search_popup.js
+++ b/ambari-web/app/views/common/modal_popups/log_file_search_popup.js
@@ -21,6 +21,16 @@ var App = require('app');
App.LogFileSearchPopup = function(header) {
return App.ModalPopup.show({
classNames: ['modal-full-width', 'sixty-percent-width-modal', 'log-file-search-popup'],
- bodyClass: App.LogFileSearchView.extend({})
+ header: header,
+ bodyView: null,
+ bodyClass: App.LogFileSearchView.extend({
+ didInsertElement: function() {
+ this.set('parentView.bodyView', this);
+ this._super();
+ }
+ }),
+ enterKeyPressed: function() {
+ this.get('bodyView').fetchContent();
+ }
});
};
http://git-wip-us.apache.org/repos/asf/ambari/blob/fdb101bd/ambari-web/test/views/common/host_progress_popup_body_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/host_progress_popup_body_view_test.js b/ambari-web/test/views/common/host_progress_popup_body_view_test.js
index 8642d9b..a14cb26 100644
--- a/ambari-web/test/views/common/host_progress_popup_body_view_test.js
+++ b/ambari-web/test/views/common/host_progress_popup_body_view_test.js
@@ -55,4 +55,56 @@ describe('App.HostProgressPopupBodyView', function () {
});
-});
\ No newline at end of file
+ describe('_determineRoleRelation', function() {
+ var cases;
+
+ beforeEach(function() {
+ sinon.stub(App.StackServiceComponent, 'find').returns([{componentName: 'DATANODE'}])
+ sinon.stub(App.StackService, 'find').returns([{serviceName: 'HDFS'}])
+ });
+
+ afterEach(function() {
+ App.StackServiceComponent.find.restore();
+ App.StackService.find.restore();
+ });
+
+ cases = [
+ {
+ task: { role: 'HDFS_SERVICE_CHECK'},
+ m: 'Role is HDFS_SERVICE_CHECK',
+ e: {
+ type: 'service',
+ value: 'HDFS'
+ }
+ },
+ {
+ task: { role: 'DATANODE'},
+ m: 'Role is DATANODE',
+ e: {
+ type: 'component',
+ value: 'DATANODE'
+ }
+ },
+ {
+ task: { role: 'UNDEFINED'},
+ m: 'Role is UNDEFINED',
+ e: false
+ }
+ ];
+
+ cases.forEach(function(test) {
+ it(test.m, function() {
+ view.reopen({
+ currentHost: Em.Object.create({
+ logTasks: [
+ { Tasks: { id: 1, role: test.task.role }}
+ ]
+ })
+ });
+
+ var ret = view._determineRoleRelation(Em.Object.create({ id: 1 }));
+ expect(ret).to.be.eql(test.e);
+ });
+ });
+ });
+});