You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/01/04 22:37:54 UTC
[01/50] [abbrv] ambari git commit: AMBARI-14495. Improve Ambari UI UT
(p.2) (onechiporenko)
Repository: ambari
Updated Branches:
refs/heads/branch-dev-patch-upgrade 99ce30771 -> 5310b95e6
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/mappers/configs/themes_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/configs/themes_mapper_test.js b/ambari-web/test/mappers/configs/themes_mapper_test.js
index a958335..bc25d1d 100644
--- a/ambari-web/test/mappers/configs/themes_mapper_test.js
+++ b/ambari-web/test/mappers/configs/themes_mapper_test.js
@@ -92,45 +92,45 @@ describe('App.themeMapper', function () {
}
],
"widgets": [
- {
- "config": "c1/p1",
- "widget": {
- "type": "slider",
- "units": [
- {
- "unit-name": "MB"
- },
- {
- "unit-name": "GB"
- }
- ]
- }
- },
- {
- "config": "c1/p2",
- "widget": {
- "type": "slider",
- "units": [
- {
- "unit-name": "percent"
- }
- ]
- }
- }
- ],
- "placement": {
- "configuration-layout": "default",
- "configs": [
- {
- "config": "c1/p1",
- "subsection-name": "subsection1"
- },
- {
- "config": "c1/p2",
- "subsection-name": "subsection1"
- }
- ]
- }
+ {
+ "config": "c1/p1",
+ "widget": {
+ "type": "slider",
+ "units": [
+ {
+ "unit-name": "MB"
+ },
+ {
+ "unit-name": "GB"
+ }
+ ]
+ }
+ },
+ {
+ "config": "c1/p2",
+ "widget": {
+ "type": "slider",
+ "units": [
+ {
+ "unit-name": "percent"
+ }
+ ]
+ }
+ }
+ ],
+ "placement": {
+ "configuration-layout": "default",
+ "configs": [
+ {
+ "config": "c1/p1",
+ "subsection-name": "subsection1"
+ },
+ {
+ "config": "c1/p2",
+ "subsection-name": "subsection1"
+ }
+ ]
+ }
}
}
}
@@ -139,56 +139,72 @@ describe('App.themeMapper', function () {
]
};
- it('should map theme data', function () {
+ describe('should map theme data', function () {
- App.themesMapper.map(json);
+ beforeEach(function () {
+ App.themesMapper.map(json);
+ });
- expect(App.Tab.find().get('length')).to.equal(1);
- expect(App.Section.find().get('length')).to.equal(2);
- expect(App.SubSection.find().get('length')).to.equal(1);
+ it('1 Tab is mapped', function () {
+ expect(App.Tab.find().get('length')).to.equal(1);
+ });
- //checking tab
- expect(App.Tab.find('HDFS_settings').toJSON()).to.eql({
- id: 'HDFS_settings',
- name: 'settings',
- display_name: 'Settings',
- columns: "2",
- rows: "1",
- is_advanced: false,
- service_name: 'HDFS',
- is_advanced_hidden: false,
- is_rendered: false,
- is_configs_prepared: false
+ it('2 Sections are mapped', function () {
+ expect(App.Section.find().get('length')).to.equal(2);
+ });
+
+ it('1 SubSection is mapped', function () {
+ expect(App.SubSection.find().get('length')).to.equal(1);
+ });
+
+ it('HDFS_settings tab is mapped correctly', function () {
+ //checking tab
+ expect(App.Tab.find('HDFS_settings').toJSON()).to.eql({
+ id: 'HDFS_settings',
+ name: 'settings',
+ display_name: 'Settings',
+ columns: "2",
+ rows: "1",
+ is_advanced: false,
+ service_name: 'HDFS',
+ is_advanced_hidden: false,
+ is_rendered: false,
+ is_configs_prepared: false
+ });
});
- //checking section
- expect(App.Tab.find('HDFS_settings').get('sections').objectAt(0).toJSON()).to.eql({
- "id": "Section-1",
- "name": "Section-1",
- "display_name": "Section One",
- "row_index": "0",
- "row_span": "1",
- "column_index": "0",
- "column_span": "1",
- "section_columns": "2",
- "section_rows": "3",
- "tab_id": "HDFS_settings"
+ it('HDFS_settings section is mapped correctly', function () {
+ //checking section
+ expect(App.Tab.find('HDFS_settings').get('sections').objectAt(0).toJSON()).to.eql({
+ "id": "Section-1",
+ "name": "Section-1",
+ "display_name": "Section One",
+ "row_index": "0",
+ "row_span": "1",
+ "column_index": "0",
+ "column_span": "1",
+ "section_columns": "2",
+ "section_rows": "3",
+ "tab_id": "HDFS_settings"
+ });
});
- //checking subsection
- expect(App.Tab.find('HDFS_settings').get('sections').objectAt(0).get('subSections').objectAt(0).toJSON()).to.eql({
- "id": "subsection1",
- "name": "subsection1",
- "display_name": "Storage",
- "border": "false",
- "row_index": "0",
- "row_span": "1",
- "column_index": "0",
- "depends_on": [],
- "config_properties": [],
- "left_vertical_splitter": true,
- "column_span": "1",
- "section_id": "Section-1"
+ it('HDFS_settings section subsection is mapped correctly', function () {
+ //checking subsection
+ expect(App.Tab.find('HDFS_settings').get('sections').objectAt(0).get('subSections').objectAt(0).toJSON()).to.eql({
+ "id": "subsection1",
+ "name": "subsection1",
+ "display_name": "Storage",
+ "border": "false",
+ "row_index": "0",
+ "row_span": "1",
+ "column_index": "0",
+ "depends_on": [],
+ "config_properties": [],
+ "left_vertical_splitter": true,
+ "column_span": "1",
+ "section_id": "Section-1"
+ });
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/mappers/service_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/service_mapper_test.js b/ambari-web/test/mappers/service_mapper_test.js
index 5091c0f..270147a 100644
--- a/ambari-web/test/mappers/service_mapper_test.js
+++ b/ambari-web/test/mappers/service_mapper_test.js
@@ -255,16 +255,19 @@ describe('App.serviceMetricsMapper', function () {
}
];
+ beforeEach(function () {
+ this.stub = sinon.stub(App, 'get');
+ });
+
+ afterEach(function () {
+ App.get.restore();
+ });
+
tests.forEach(function(test) {
it(test.message, function() {
- sinon.stub(App, 'get', function(key) {
- if (key == 'currentStackVersionNumber') {
- return test.stackVersionNumber;
- }
- });
+ this.stub.withArgs('currentStackVersionNumber').returns(test.stackVersionNumber);
var result = App.serviceMetricsMapper.stormMapper(test);
expect(result).to.include(test.expectedValues);
- App.get.restore();
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/mappers/stack_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/stack_mapper_test.js b/ambari-web/test/mappers/stack_mapper_test.js
index d67098c..7b124af 100644
--- a/ambari-web/test/mappers/stack_mapper_test.js
+++ b/ambari-web/test/mappers/stack_mapper_test.js
@@ -261,29 +261,41 @@ describe('App.stackMapper', function () {
App.resetDsStoreTypeMap(App.OperatingSystem);
App.resetDsStoreTypeMap(App.Stack);
sinon.stub(App.store, 'commit', Em.K);
+ App.stackMapper.map(test_data);
});
afterEach(function(){
App.store.commit.restore();
});
-
it ('should map active Stack data', function() {
- App.stackMapper.map(test_data);
expect(App.Stack.find().get('length')).to.equal(2);
+ });
+
+ it ('all stacks are active', function() {
expect(App.Stack.find().everyProperty('active')).to.equal(true);
+ });
+
+ it ('no one stack is selected', function() {
expect(App.Stack.find().everyProperty('isSelected')).to.equal(false);
+ });
+
+ it ('stack ids are valid', function() {
expect(App.Stack.find().mapProperty('id')).to.eql(['HDP-2.1','HDP-1.3']);
});
- it ('should map Operating System data', function() {
- App.stackMapper.map(test_data);
+ it ('4 OSes are mapped', function() {
expect(App.OperatingSystem.find().get('length')).to.equal(4);
+ });
+
+ it ('OSes have valid ids', function() {
expect(App.OperatingSystem.find().mapProperty('id')).to.eql(['HDP-2.1-redhat5', 'HDP-2.1-redhat6', 'HDP-1.3-redhat5', 'HDP-1.3-redhat6']);
});
- it ('should map Repository data', function() {
- App.stackMapper.map(test_data);
+ it ('8 repositories are mapped', function() {
expect(App.Repository.find().get('length')).to.equal(8);
+ });
+
+ it ('Repositories ids are valid', function() {
expect(App.Repository.find().mapProperty('id')).to.eql(["HDP-2.1-redhat5-HDP-2.1", "HDP-2.1-redhat5-HDP-UTILS-1.1.0.17", "HDP-2.1-redhat6-HDP-2.1", "HDP-2.1-redhat6-HDP-UTILS-1.1.0.17", "HDP-1.3-redhat5-HDP-1.3", "HDP-1.3-redhat5-HDP-UTILS-1.1.0.16", "HDP-1.3-redhat6-HDP-1.3", "HDP-1.3-redhat6-HDP-UTILS-1.1.0.16"]);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/utils/blueprint_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/blueprint_test.js b/ambari-web/test/utils/blueprint_test.js
index 7d4f2de..d7b7e9b 100644
--- a/ambari-web/test/utils/blueprint_test.js
+++ b/ambari-web/test/utils/blueprint_test.js
@@ -441,12 +441,10 @@ describe('utils/blueprint', function() {
expect(blueprintUtils._generateHostMap({}, [],'c1')).to.eql({});
});
- it('skip throws error when data is wrong', function() {
- it('should assert error if no data returned from server', function () {
- expect(function () {
- blueprintUtils._generateHostMap();
- }).to.throw(Error);
- });
+ it('skip throws error when data is wrong (should assert error if no data returned from server)', function() {
+ expect(function () {
+ blueprintUtils._generateHostMap();
+ }).to.throw(Error);
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/utils/helper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/helper_test.js b/ambari-web/test/utils/helper_test.js
index 173ea5f..910cc9f 100644
--- a/ambari-web/test/utils/helper_test.js
+++ b/ambari-web/test/utils/helper_test.js
@@ -239,10 +239,7 @@ describe('utils/helper', function() {
expect(App.isEmptyObject({ a: 1 })).to.eql(false);
});
});
- describe('#parseJSON()', function(){
- var testable = '{"hello": "world"}';
- expect(App.parseJSON(testable).hello).to.eql('world');
- });
+
describe('#tooltip()', function() {
beforeEach(appendDiv);
afterEach(removeDiv);
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/views/main/alerts/manage_alert_groups_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/alerts/manage_alert_groups_view_test.js b/ambari-web/test/views/main/alerts/manage_alert_groups_view_test.js
index 3c91949..5bb005d 100644
--- a/ambari-web/test/views/main/alerts/manage_alert_groups_view_test.js
+++ b/ambari-web/test/views/main/alerts/manage_alert_groups_view_test.js
@@ -32,65 +32,6 @@ describe('App.MainAlertsManageAlertGroupView', function () {
view = getView();
});
- it('#buttonObserver', function () {
-
- Em.A([
- {
- p: {
- isRemoveButtonDisabled: false,
- isRenameButtonDisabled: false,
- isDuplicateButtonDisabled: true
- },
- selectedAlertGroup: {default: true},
- m: 'selected alert group is default',
- e: {
- isRemoveButtonDisabled: true,
- isRenameButtonDisabled: true,
- isDuplicateButtonDisabled: false
- }
- },
- {
- p: {
- isRemoveButtonDisabled: true,
- isRenameButtonDisabled: true,
- isDuplicateButtonDisabled: true
- },
- selectedAlertGroup: {default: false},
- m: 'selected alert group is not default',
- e: {
- isRemoveButtonDisabled: false,
- isRenameButtonDisabled: false,
- isDuplicateButtonDisabled: false
- }
- },
- {
- p: {
- isRemoveButtonDisabled: true,
- isRenameButtonDisabled: true,
- isDuplicateButtonDisabled: true
- },
- selectedAlertGroup: null,
- m: 'not one alert group is selected',
- e: {
- isRemoveButtonDisabled: false,
- isRenameButtonDisabled: false,
- isDuplicateButtonDisabled: false
- }
- }
- ]).forEach(function (test) {
- it(test.m, function () {
- Em.keys(test.p).forEach(function (k) {
- view.set(k, test.p[k]);
- });
- view.set('controller.selectedAlertGroup', test.selectedAlertGroup);
- Em.keys(test.e).forEach(function (k) {
- expect(view.get(k)).to.equal(test.e[k]);
- });
- });
- });
-
- });
-
App.TestAliases.testAsComputedIfThenElse(getView(), 'removeButtonTooltip', 'controller.isRemoveButtonDisabled', Em.I18n.t('alerts.actions.manage_alert_groups_popup.removeButtonDisabled'), Em.I18n.t('alerts.actions.manage_alert_groups_popup.removeButton'))
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/views/main/service/info/summary_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/info/summary_test.js b/ambari-web/test/views/main/service/info/summary_test.js
index 170eb41..df3aa24 100644
--- a/ambari-web/test/views/main/service/info/summary_test.js
+++ b/ambari-web/test/views/main/service/info/summary_test.js
@@ -185,14 +185,15 @@ describe('App.MainServiceInfoSummaryView', function() {
serviceName: 'HDFS'
}));
expect(view.get('hasAlertDefinitions')).to.be.true;
+ });
+
+ it('should return false if there is no alert definition for this service', function () {
+ view.set('controller.content', Em.Object.create({
+ serviceName: 'ZOOKEEPER'
+ }));
+ expect(view.get('hasAlertDefinitions')).to.be.false;
+ });
- it('should return false if there is no alert definition for this service', function () {
- view.set('controller.content', Em.Object.create({
- serviceName: 'ZOOKEEPER'
- }));
- expect(view.get('hasAlertDefinitions')).to.be.false;
- });
- })
});
describe('#didInsertElement', function () {
[04/50] [abbrv] ambari git commit: AMBARI-14492 Copy Ranger config
files to Ranger conf directory
Posted by nc...@apache.org.
AMBARI-14492 Copy Ranger config files to Ranger conf directory
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2a7ccf4d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2a7ccf4d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2a7ccf4d
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 2a7ccf4d6fb1c4e3a7cb674cc99fcad67e920a8b
Parents: f8213ed
Author: Gautam Borad <ga...@apache.org>
Authored: Thu Dec 24 13:54:46 2015 +0530
Committer: Gautam Borad <ga...@apache.org>
Committed: Mon Dec 28 10:47:09 2015 +0530
----------------------------------------------------------------------
.../RANGER/0.4.0/package/scripts/setup_ranger_xml.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2a7ccf4d/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
index 81f93a1..5e9f394 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
@@ -108,9 +108,21 @@ def setup_ranger_admin(upgrade_type=None):
if os.path.isfile(params.ranger_admin_default_file):
File(params.ranger_admin_default_file, owner=params.unix_user, group=params.unix_group)
+ else:
+ Logger.warning('Required file {0} does not exist, copying the file to {1} path'.format(params.ranger_admin_default_file, ranger_conf))
+ src_file = format('{ranger_home}/ews/webapp/WEB-INF/classes/conf.dist/ranger-admin-default-site.xml')
+ dst_file = format('{ranger_home}/conf/ranger-admin-default-site.xml')
+ Execute(('cp', '-f', src_file, dst_file), sudo=True)
+ File(params.ranger_admin_default_file, owner=params.unix_user, group=params.unix_group)
if os.path.isfile(params.security_app_context_file):
File(params.security_app_context_file, owner=params.unix_user, group=params.unix_group)
+ else:
+ Logger.warning('Required file {0} does not exist, copying the file to {1} path'.format(params.security_app_context_file, ranger_conf))
+ src_file = format('{ranger_home}/ews/webapp/WEB-INF/classes/conf.dist/security-applicationContext.xml')
+ dst_file = format('{ranger_home}/conf/security-applicationContext.xml')
+ Execute(('cp', '-f', src_file, dst_file), sudo=True)
+ File(params.security_app_context_file, owner=params.unix_user, group=params.unix_group)
Execute(('ln','-sf', format('{ranger_home}/ews/ranger-admin-services.sh'),'/usr/bin/ranger-admin'),
not_if=format("ls /usr/bin/ranger-admin"),
[47/50] [abbrv] ambari git commit: AMBARI-14408: common-services
folder needs to be backed up upon ambari-server RPM upgrade (dili)
Posted by nc...@apache.org.
AMBARI-14408: common-services folder needs to be backed up upon ambari-server RPM upgrade (dili)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1d76f957
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1d76f957
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1d76f957
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 1d76f9571e77978205054b143233480e1075b51e
Parents: e8deead
Author: Di Li <di...@apache.org>
Authored: Mon Jan 4 13:25:22 2016 -0500
Committer: Di Li <di...@apache.org>
Committed: Mon Jan 4 13:25:22 2016 -0500
----------------------------------------------------------------------
ambari-server/src/main/package/deb/control/preinst | 2 +-
ambari-server/src/main/package/rpm/preinstall.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/1d76f957/ambari-server/src/main/package/deb/control/preinst
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/package/deb/control/preinst b/ambari-server/src/main/package/deb/control/preinst
index f640adb..7bf7365 100644
--- a/ambari-server/src/main/package/deb/control/preinst
+++ b/ambari-server/src/main/package/deb/control/preinst
@@ -57,7 +57,7 @@ then
mv -f "$STACKS_FOLDER" "$STACKS_FOLDER_OLD"
fi
-if [ -d "$COMMON_SERVICES_FOLDER_OLD" ]
+if [ -d "$COMMON_SERVICES_FOLDER" ]
then
mv -f "$COMMON_SERVICES_FOLDER" "$COMMON_SERVICES_FOLDER_OLD"
fi
http://git-wip-us.apache.org/repos/asf/ambari/blob/1d76f957/ambari-server/src/main/package/rpm/preinstall.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/package/rpm/preinstall.sh b/ambari-server/src/main/package/rpm/preinstall.sh
index 313a169..9533964 100644
--- a/ambari-server/src/main/package/rpm/preinstall.sh
+++ b/ambari-server/src/main/package/rpm/preinstall.sh
@@ -32,7 +32,7 @@ then
mv -f "$STACKS_FOLDER" "$STACKS_FOLDER_OLD"
fi
-if [ -d "$COMMON_SERVICES_FOLDER_OLD" ]
+if [ -d "$COMMON_SERVICES_FOLDER" ]
then
mv -f "$COMMON_SERVICES_FOLDER" "$COMMON_SERVICES_FOLDER_OLD"
fi
[37/50] [abbrv] ambari git commit: AMBARI-14412. Recommend PXF
component to be collocated with NAMENODE and DATANODE (mithmatt via
odiachenko).
Posted by nc...@apache.org.
AMBARI-14412. Recommend PXF component to be collocated with NAMENODE and DATANODE (mithmatt via odiachenko).
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c96a9e41
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c96a9e41
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c96a9e41
Branch: refs/heads/branch-dev-patch-upgrade
Commit: c96a9e4170564e9eafc6781443d7bbd0aecd4e75
Parents: 746e90d
Author: Oleksandr Diachenko <od...@pivotal.io>
Authored: Wed Dec 30 11:35:39 2015 -0800
Committer: Oleksandr Diachenko <od...@pivotal.io>
Committed: Wed Dec 30 11:35:39 2015 -0800
----------------------------------------------------------------------
.../stacks/HDP/2.3/services/stack_advisor.py | 22 +-
.../stacks/2.3/common/services-pxf-hdfs.json | 3490 ++++++++++++++++++
.../stacks/2.3/common/test_stack_advisor.py | 13 +
3 files changed, 3518 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/c96a9e41/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
index f57debb..e52db2c 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
@@ -25,14 +25,22 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
def createComponentLayoutRecommendations(self, services, hosts):
parentComponentLayoutRecommendations = super(HDP23StackAdvisor, self).createComponentLayoutRecommendations(services, hosts)
- # remove HAWQSTANDBY on a single node
hostsList = [host["Hosts"]["host_name"] for host in hosts["items"]]
- if len(hostsList) == 1:
- servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
- if "HAWQ" in servicesList:
- components = parentComponentLayoutRecommendations["blueprint"]["host_groups"][0]["components"]
- components = [ component for component in components if component["name"] != 'HAWQSTANDBY' ]
- parentComponentLayoutRecommendations["blueprint"]["host_groups"][0]["components"] = components
+ servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
+
+ # remove HAWQSTANDBY on a single node
+ if len(hostsList) == 1 and "HAWQ" in servicesList:
+ components = parentComponentLayoutRecommendations["blueprint"]["host_groups"][0]["components"]
+ components = [ component for component in components if component["name"] != 'HAWQSTANDBY' ]
+ parentComponentLayoutRecommendations["blueprint"]["host_groups"][0]["components"] = components
+
+ # co-locate PXF with NAMENODE and DATANODE
+ if "PXF" in servicesList:
+ host_groups = parentComponentLayoutRecommendations["blueprint"]["host_groups"]
+ for host_group in host_groups:
+ if ({"name": "NAMENODE"} in host_group["components"] or {"name": "DATANODE"} in host_group["components"]) \
+ and {"name": "PXF"} not in host_group["components"]:
+ host_group["components"].append({"name": "PXF"})
return parentComponentLayoutRecommendations
[11/50] [abbrv] ambari git commit: AMBARI-14443. In the Move Master
Wizard,
manual commands text scroll outside the frame when the message is long
(alexantonenko)
Posted by nc...@apache.org.
AMBARI-14443. In the Move Master Wizard, manual commands text scroll outside the frame when the message is long (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c763570f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c763570f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c763570f
Branch: refs/heads/branch-dev-patch-upgrade
Commit: c763570f4cbe1a41f00cfec77d599a1fdcdbb778
Parents: 4a58cd4
Author: Alex Antonenko <hi...@gmail.com>
Authored: Mon Dec 28 21:04:53 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Mon Dec 28 21:17:57 2015 +0200
----------------------------------------------------------------------
ambari-web/app/styles/application.less | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/c763570f/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index d80278c..381459a 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -4930,7 +4930,7 @@ i.icon-asterisks {
font-family: Courier;
font-size: 12px;
padding: 4px;
- white-space: nowrap;
+ white-space: normal;
}
@installer-container-width: 1236px;
[46/50] [abbrv] ambari git commit: AMBARI-14539 Disable Kerberos link
in Config History table if Kerberos is not enabled (akovalenko)
Posted by nc...@apache.org.
AMBARI-14539 Disable Kerberos link in Config History table if Kerberos is not enabled (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e8deead6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e8deead6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e8deead6
Branch: refs/heads/branch-dev-patch-upgrade
Commit: e8deead668a09affd94374f3bd3f9d95a6501eb4
Parents: d6883af
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Mon Jan 4 19:34:38 2016 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Mon Jan 4 19:34:38 2016 +0200
----------------------------------------------------------------------
ambari-web/app/templates/main/dashboard/config_history.hbs | 8 ++++++--
ambari-web/app/views/main/dashboard/config_history_view.js | 9 +++++++--
.../test/views/main/dashboard/config_history_view_test.js | 4 ++--
3 files changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8deead6/ambari-web/app/templates/main/dashboard/config_history.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/dashboard/config_history.hbs b/ambari-web/app/templates/main/dashboard/config_history.hbs
index d20c514..e189e62 100644
--- a/ambari-web/app/templates/main/dashboard/config_history.hbs
+++ b/ambari-web/app/templates/main/dashboard/config_history.hbs
@@ -42,9 +42,13 @@
{{#view view.ConfigVersionView contentBinding="item"}}
<td class="first">
<span class="label label-info">{{item.versionText}}</span>
- <a {{action goToServiceConfigs item}} class="service-name">
+ {{#if view.isServiceLinkDisabled}}
{{item.displayName}}
- </a>
+ {{else}}
+ <a {{action goToServiceConfigs item}} class="service-name">
+ {{item.displayName}}
+ </a>
+ {{/if}}
<i {{bindAttr class=":icon-refresh :restart-required-service item.isRestartRequired::hidden"}}
rel="Tooltip" {{translateAttr data-original-title="dashboard.configHistory.table.restart.tooltip"}}></i>
</td>
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8deead6/ambari-web/app/views/main/dashboard/config_history_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/config_history_view.js b/ambari-web/app/views/main/dashboard/config_history_view.js
index a0737c4..88f9025 100644
--- a/ambari-web/app/views/main/dashboard/config_history_view.js
+++ b/ambari-web/app/views/main/dashboard/config_history_view.js
@@ -115,7 +115,7 @@ App.MainConfigHistoryView = App.TableView.extend(App.TableServerViewMixin, {
value: '',
label: Em.I18n.t('common.all')
}
- ].concat(App.Service.find().map(function (service) {
+ ].concat(App.StackService.find().map(function (service) {
return {
value: service.get('serviceName'),
label: service.get('displayName')
@@ -188,7 +188,12 @@ App.MainConfigHistoryView = App.TableView.extend(App.TableServerViewMixin, {
},
didInsertElement: function () {
App.tooltip(this.$("[rel='Tooltip']"), {html: false});
- }
+ },
+
+ // Define if show plain text label or link
+ isServiceLinkDisabled: function () {
+ return this.get('content.serviceName') === 'KERBEROS' && !App.Service.find().someProperty('serviceName', 'KERBEROS');
+ }.property('content.serviceName')
}),
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8deead6/ambari-web/test/views/main/dashboard/config_history_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/config_history_view_test.js b/ambari-web/test/views/main/dashboard/config_history_view_test.js
index 4ac8401..af1733d 100644
--- a/ambari-web/test/views/main/dashboard/config_history_view_test.js
+++ b/ambari-web/test/views/main/dashboard/config_history_view_test.js
@@ -60,13 +60,13 @@ describe('App.MainConfigHistoryView', function() {
});
before(function () {
- sinon.stub(App.Service, 'find').returns([Em.Object.create({
+ sinon.stub(App.StackService, 'find').returns([Em.Object.create({
serviceName: 'S1',
displayName: 's1'
})])
});
after(function () {
- App.Service.find.restore();
+ App.StackService.find.restore();
});
it("content", function () {
expect(subView.get('content')).to.eql([
[40/50] [abbrv] ambari git commit: AMBARI-14531. Improve Ambari UI UT
(p.4) (onechiporenko)
Posted by nc...@apache.org.
AMBARI-14531. Improve Ambari UI UT (p.4) (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b8aede2a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b8aede2a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b8aede2a
Branch: refs/heads/branch-dev-patch-upgrade
Commit: b8aede2a8e57cff8bb981064dbec13951a969679
Parents: 09406ac
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Thu Dec 31 15:24:20 2015 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Thu Dec 31 15:24:20 2015 +0200
----------------------------------------------------------------------
.../global/update_controller_test.js | 28 +-
ambari-web/test/controllers/installer_test.js | 248 ++++++------
.../nameNode/step3_controller_test.js | 28 +-
.../nameNode/step4_controller_test.js | 23 +-
.../admin/stack_and_upgrade_controller_test.js | 64 +--
.../definitions_configs_controller_test.js | 86 ++--
.../heatmap_metrics/heatmap_metric_test.js | 56 ++-
.../controllers/main/charts/heatmap_test.js | 40 +-
.../main/host/add_controller_test.js | 246 +++++++-----
.../test/controllers/main/host/details_test.js | 155 +++++---
.../main/service/add_controller_test.js | 22 +-
.../main/service/info/summary_test.js | 35 +-
.../test/controllers/main/service/item_test.js | 111 +++---
.../manage_config_groups_controller_test.js | 109 +++--
.../service/reassign/step4_controller_test.js | 18 +-
.../test/controllers/main/service_test.js | 27 +-
.../test/controllers/wizard/step10_test.js | 34 +-
.../test/controllers/wizard/step3_test.js | 71 +++-
.../test/controllers/wizard/step4_test.js | 106 ++---
.../test/controllers/wizard/step5_test.js | 29 +-
.../test/controllers/wizard/step6_test.js | 194 +++++----
.../test/controllers/wizard/step7_test.js | 141 ++++---
.../test/controllers/wizard/step8_test.js | 397 +++++++++++--------
.../test/controllers/wizard/step9_test.js | 145 ++++---
ambari-web/test/controllers/wizard_test.js | 7 +-
ambari-web/test/helpers.js | 2 +
.../test/mappers/stack_service_mapper_test.js | 2 +
.../test/mixins/common/serverValidator_test.js | 29 +-
ambari-web/test/models/form_test.js | 3 +-
ambari-web/test/utils/config_test.js | 45 ++-
.../utils/configs/config_initializer_test.js | 63 ++-
.../configs/widgets/config_widget_view_test.js | 83 ++--
.../widgets/list_config_widget_view_test.js | 16 +-
.../widgets/slider_config_widget_view_test.js | 45 ++-
.../widgets/toggle_config_widget_view_test.js | 4 +-
.../test/views/common/controls_view_test.js | 35 +-
.../views/common/rolling_restart_view_test.js | 27 +-
.../stack_upgrade/upgrade_wizard_view_test.js | 28 +-
.../select_definitions_popup_body_view_test.js | 26 +-
.../test/views/main/dashboard/widget_test.js | 57 ++-
.../test/views/main/dashboard/widgets_test.js | 26 +-
ambari-web/test/views/main/host/details_test.js | 8 +-
ambari-web/test/views/wizard/step5_view_test.js | 19 +-
43 files changed, 1773 insertions(+), 1165 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/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 010e30a..6a95871 100644
--- a/ambari-web/test/controllers/global/update_controller_test.js
+++ b/ambari-web/test/controllers/global/update_controller_test.js
@@ -427,16 +427,24 @@ describe('App.UpdateController', function () {
});
cases.forEach(function (item) {
- it(item.title, function () {
- appGetMock.withArgs('router.mainAdminStackAndUpgradeController').returns(Em.Object.create({
- loadUpgradeData: mock.loadUpgradeData,
- isLoadUpgradeDataPending: item.isLoadUpgradeDataPending
- })).withArgs('wizardIsNotFinished').returns(item.wizardIsNotFinished)
- .withArgs('router.currentState.name').returns(item.currentStateName)
- .withArgs('router.currentState.parentState.name').returns(item.parentStateName);;
- controller.updateUpgradeState(mock.callback);
- expect(mock.loadUpgradeData.callCount).to.equal(item.loadUpgradeDataCallCount);
- expect(mock.callback.callCount).to.equal(item.callbackCallCount);
+ describe(item.title, function () {
+
+ beforeEach(function () {
+ appGetMock.withArgs('router.mainAdminStackAndUpgradeController').returns(Em.Object.create({
+ loadUpgradeData: mock.loadUpgradeData,
+ isLoadUpgradeDataPending: item.isLoadUpgradeDataPending
+ })).withArgs('wizardIsNotFinished').returns(item.wizardIsNotFinished)
+ .withArgs('router.currentState.name').returns(item.currentStateName)
+ .withArgs('router.currentState.parentState.name').returns(item.parentStateName);
+ controller.updateUpgradeState(mock.callback);
+ });
+ it('loadUpgradeData is called ' + item.loadUpgradeDataCallCount + ' times', function () {
+ expect(mock.loadUpgradeData.callCount).to.equal(item.loadUpgradeDataCallCount);
+ });
+ it('callback is called ' + item.callbackCallCount + ' times', function () {
+ expect(mock.callback.callCount).to.equal(item.callbackCallCount);
+ });
+
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/installer_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/installer_test.js b/ambari-web/test/controllers/installer_test.js
index 65b911c..65b19ab 100644
--- a/ambari-web/test/controllers/installer_test.js
+++ b/ambari-web/test/controllers/installer_test.js
@@ -94,38 +94,38 @@ describe('App.InstallerController', function () {
});
describe('#checkRepoURL', function() {
-
+ var stacks = Em.A([
+ Em.Object.create({
+ isSelected: false
+ }),
+ Em.Object.create({
+ isSelected: true,
+ reload: false,
+ id: 'nn-cc',
+ repositories: Em.A([
+ Em.Object.create({
+ isSelected: true
+ })
+ ]),
+ operatingSystems: Em.A([
+ Em.Object.create({
+ isSelected: true,
+ repositories: Em.A([
+ Em.Object.create({
+ errorTitle: '1',
+ errorContent: '1',
+ validation: ''
+ })
+ ])
+ })
+ ])
+ })
+ ]);
+ var wizard = Em.Object.create({
+ skipValidationChecked: true
+ });
it ('Should reload installed stacks', function() {
- var stacks = Em.A([
- Em.Object.create({
- isSelected: false
- }),
- Em.Object.create({
- isSelected: true,
- reload: false,
- id: 'nn-cc',
- repositories: Em.A([
- Em.Object.create({
- isSelected: true
- })
- ]),
- operatingSystems: Em.A([
- Em.Object.create({
- isSelected: true,
- repositories: Em.A([
- Em.Object.create({
- errorTitle: '1',
- errorContent: '1',
- validation: ''
- })
- ])
- })
- ])
- })
- ]);
- var wizard = Em.Object.create({
- skipValidationChecked: true
- });
+
installerController.set('content.stacks', stacks);
installerController.checkRepoURL(wizard);
@@ -164,47 +164,48 @@ describe('App.InstallerController', function () {
});
describe('#checkRepoURLSuccessCallback', function() {
- it ('Should check stacks for sucess', function() {
- var stacks = Em.A([
- Em.Object.create({
- isSelected: false
- }),
- Em.Object.create({
- isSelected: true,
- reload: false,
- id: 'nn-cc',
- repositories: Em.A([
- Em.Object.create({
- repoId: 11,
- isSelected: true
- })
- ]),
- operatingSystems: Em.A([
- Em.Object.create({
- isSelected: true,
- id: 1,
- repositories: Em.A([
- Em.Object.create({
- repoId: 11,
- errorTitle: '1',
- errorContent: '1',
- validation: ''
- })
- ])
- })
- ])
- })
- ]);
- var resolve = false;
- var data = {
- osId: 1,
- repoId: 11,
- dfd: {
- resolve: function() {
- resolve = true;
- }
+ var stacks = Em.A([
+ Em.Object.create({
+ isSelected: false
+ }),
+ Em.Object.create({
+ isSelected: true,
+ reload: false,
+ id: 'nn-cc',
+ repositories: Em.A([
+ Em.Object.create({
+ repoId: 11,
+ isSelected: true
+ })
+ ]),
+ operatingSystems: Em.A([
+ Em.Object.create({
+ isSelected: true,
+ id: 1,
+ repositories: Em.A([
+ Em.Object.create({
+ repoId: 11,
+ errorTitle: '1',
+ errorContent: '1',
+ validation: ''
+ })
+ ])
+ })
+ ])
+ })
+ ]);
+ var data = {
+ osId: 1,
+ repoId: 11,
+ dfd: {
+ resolve: function() {
+ resolve = true;
}
- };
+ }
+ };
+ var resolve = false;
+ it ('Should check stacks for sucess', function() {
+
installerController.set('content.stacks', stacks);
installerController.checkRepoURLSuccessCallback(null,null,data);
@@ -246,47 +247,48 @@ describe('App.InstallerController', function () {
});
describe('#checkRepoURLErrorCallback', function() {
- it ('Should check stacks for error', function() {
- var stacks = Em.A([
- Em.Object.create({
- isSelected: false
- }),
- Em.Object.create({
- isSelected: true,
- reload: false,
- id: 'nn-cc',
- repositories: Em.A([
- Em.Object.create({
- repoId: 11,
- isSelected: true
- })
- ]),
- operatingSystems: Em.A([
- Em.Object.create({
- isSelected: true,
- id: 1,
- repositories: Em.A([
- Em.Object.create({
- repoId: 11,
- errorTitle: '1',
- errorContent: '1',
- validation: ''
- })
- ])
- })
- ])
- })
- ]);
- var resolve = false;
- var data = {
- osId: 1,
- repoId: 11,
- dfd: {
- reject: function() {
- resolve = true;
- }
+ var stacks = Em.A([
+ Em.Object.create({
+ isSelected: false
+ }),
+ Em.Object.create({
+ isSelected: true,
+ reload: false,
+ id: 'nn-cc',
+ repositories: Em.A([
+ Em.Object.create({
+ repoId: 11,
+ isSelected: true
+ })
+ ]),
+ operatingSystems: Em.A([
+ Em.Object.create({
+ isSelected: true,
+ id: 1,
+ repositories: Em.A([
+ Em.Object.create({
+ repoId: 11,
+ errorTitle: '1',
+ errorContent: '1',
+ validation: ''
+ })
+ ])
+ })
+ ])
+ })
+ ]);
+ var data = {
+ osId: 1,
+ repoId: 11,
+ dfd: {
+ reject: function() {
+ resolve = true;
}
- };
+ }
+ };
+ var resolve = false;
+ it ('Should check stacks for error', function() {
+
var req = {
status: 500,
statusText: 'error'
@@ -351,7 +353,8 @@ describe('App.InstallerController', function () {
});
describe('#setLowerStepsDisable', function() {
- it ('Should disable lower steps', function() {
+
+ beforeEach(function () {
var steps = Em.A([
Em.Object.create({
step: 0,
@@ -376,6 +379,9 @@ describe('App.InstallerController', function () {
]);
installerController.set('isStepDisabled', steps);
installerController.setLowerStepsDisable(3);
+ });
+
+ it ('Should disable lower steps', function() {
var expected = [
{
"step": 0,
@@ -398,15 +404,14 @@ describe('App.InstallerController', function () {
"value": false
}
];
-
var res = JSON.parse(JSON.stringify(installerController.get('isStepDisabled')));
-
expect(res).to.eql(expected);
});
});
describe('#setStepsEnable', function() {
- it ('Should enable next steps', function() {
+
+ beforeEach(function () {
var steps = Em.A([
Em.Object.create({
step: 0,
@@ -432,6 +437,9 @@ describe('App.InstallerController', function () {
installerController.set('isStepDisabled', steps);
installerController.totalSteps = steps.length - 1;
installerController.set('currentStep',2);
+ });
+
+ it ('Should enable next steps', function() {
var expected = [
{
"step": 0,
@@ -454,9 +462,7 @@ describe('App.InstallerController', function () {
"value": true
}
];
-
var res = JSON.parse(JSON.stringify(installerController.get('isStepDisabled')));
-
expect(res).to.eql(expected);
});
});
@@ -827,8 +833,10 @@ describe('App.InstallerController', function () {
});
describe('#saveClients', function() {
- it ('Should return correct clients names', function() {
- var stepController = Em.Object.create({
+ var stepController;
+
+ beforeEach(function () {
+ stepController = Em.Object.create({
content: Em.A([
Em.Object.create({
isInstalled: true,
@@ -864,6 +872,8 @@ describe('App.InstallerController', function () {
})
])
});
+ });
+ it ('Should return correct clients names', function() {
installerController.saveClients(stepController);
var res = JSON.parse(JSON.stringify(installerController.get('content.clients')));
expect(res).to.eql([
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js
index aff4413..1b0fe31 100644
--- a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js
@@ -329,15 +329,27 @@ describe('App.HighAvailabilityWizardStep3Controller', function() {
value: nameServiceId + '/hawq_default'
}
]).forEach(function (test) {
- it(test.config.name, function () {
- test.config.displayName = test.config.name;
- var configs = [test.config];
- configs = controller.tweakServiceConfigs(configs);
- expect(configs[0].value).to.equal(test.value);
- expect(configs[0].recommendedValue).to.equal(test.value);
+ describe(test.config.name, function () {
+ var configs;
+ beforeEach(function () {
+ test.config.displayName = test.config.name;
+ configs = controller.tweakServiceConfigs([test.config]);
+ });
+
+ it('value is ' + test.value, function () {
+ expect(configs[0].value).to.equal(test.value);
+ });
+ it('recommendedValue is ' + test.value, function () {
+ expect(configs[0].recommendedValue).to.equal(test.value);
+ });
+
if(test.name) {
- expect(configs[0].name).to.equal(test.name);
- expect(configs[0].displayName).to.equal(test.name);
+ it('name is ' + test.name, function () {
+ expect(configs[0].name).to.equal(test.name);
+ });
+ it('displayNamr is' + test.name, function () {
+ expect(configs[0].displayName).to.equal(test.name);
+ });
}
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step4_controller_test.js
----------------------------------------------------------------------
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 1136052..d5ab8d2 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
@@ -92,13 +92,22 @@ describe('App.HighAvailabilityWizardStep4Controller', function() {
];
tests.forEach(function(test) {
- it(test.m, function() {
- this.controller.set('isNameNodeStarted', !test.e.isNameNodeStarted);
- this.controller.checkNnCheckPointStatus(test.responseData);
- this.clock.tick(this.controller.get('POLL_INTERVAL'));
- expect(this.controller.get('isNameNodeStarted')).to.be.eql(test.e.isNameNodeStarted);
- expect(this.controller.get('isNextEnabled')).to.be.eql(test.e.isNextEnabled);
- expect(this.controller.pullCheckPointStatus.called).to.be.eql(test.e.isPollingCalled);
+ describe(test.m, function() {
+
+ beforeEach(function () {
+ this.controller.set('isNameNodeStarted', !test.e.isNameNodeStarted);
+ this.controller.checkNnCheckPointStatus(test.responseData);
+ this.clock.tick(this.controller.get('POLL_INTERVAL'));
+ });
+ it('isNameNodeStarted is ' + test.e.isNameNodeStarted, function () {
+ expect(this.controller.get('isNameNodeStarted')).to.be.equal(test.e.isNameNodeStarted);
+ });
+ it('isNextEnabled is ' + test.e.isNextEnabled, function () {
+ expect(this.controller.get('isNextEnabled')).to.be.equal(test.e.isNextEnabled);
+ });
+ it('pullCheckPointStatus is ' + (test.e.isPollingCalled ? '' : 'not') + ' called', function () {
+ expect(this.controller.pullCheckPointStatus.called).to.be.equal(test.e.isPollingCalled);
+ });
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
index 2651437..23652ed 100644
--- a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
@@ -2088,20 +2088,12 @@ describe('App.MainAdminStackAndUpgradeController', function() {
focus: function () {}
};
- before(function(){
+ beforeEach(function(){
sinon.stub(window, 'open', function () {
return mock;
});
sinon.spy(mock.document, 'write');
sinon.spy(mock, 'focus');
- });
-
- after(function(){
- window.open.restore();
- });
-
- it("should open window and write table to it", function () {
-
controller.openConfigsInNewWindow({
context: [
{
@@ -2120,29 +2112,43 @@ describe('App.MainAdminStackAndUpgradeController', function() {
}
]
});
+ });
+
+ afterEach(function(){
+ window.open.restore();
+ mock.document.write.restore();
+ mock.focus.restore();
+ });
+ it('new window is open', function () {
expect(window.open.calledOnce).to.be.true;
+ });
+
+ it('new window content is valid', function () {
expect(mock.document.write.calledWith('<table style="text-align: left;"><thead><tr>' +
- '<th>' + Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.configType') + '</th>' +
- '<th>' + Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.propertyName') + '</th>' +
- '<th>' + Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.currentValue') + '</th>' +
- '<th>' + Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.recommendedValue') + '</th>' +
- '<th>' + Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.resultingValue') + '</th>' +
- '</tr></thead><tbody>' +
- '<tr>' +
- '<td>' + 'type1' + '</td>' +
- '<td>' + 'name1' + '</td>' +
- '<td>' + 'currentValue1' + '</td>' +
- '<td>' + 'recommendedValue1' + '</td>' +
- '<td>' + 'resultingValue1' + '</td>' +
- '</tr>' +
- '<tr>' +
- '<td>' + 'type2' + '</td>' +
- '<td>' + 'name2' + '</td>' +
- '<td>' + 'currentValue2' + '</td>' +
- '<td>' + 'recommendedValue2' + '</td>' +
- '<td>' + 'resultingValue2' + '</td>' +
- '</tr></tbody></table>')).to.be.true;
+ '<th>' + Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.configType') + '</th>' +
+ '<th>' + Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.propertyName') + '</th>' +
+ '<th>' + Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.currentValue') + '</th>' +
+ '<th>' + Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.recommendedValue') + '</th>' +
+ '<th>' + Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.resultingValue') + '</th>' +
+ '</tr></thead><tbody>' +
+ '<tr>' +
+ '<td>' + 'type1' + '</td>' +
+ '<td>' + 'name1' + '</td>' +
+ '<td>' + 'currentValue1' + '</td>' +
+ '<td>' + 'recommendedValue1' + '</td>' +
+ '<td>' + 'resultingValue1' + '</td>' +
+ '</tr>' +
+ '<tr>' +
+ '<td>' + 'type2' + '</td>' +
+ '<td>' + 'name2' + '</td>' +
+ '<td>' + 'currentValue2' + '</td>' +
+ '<td>' + 'recommendedValue2' + '</td>' +
+ '<td>' + 'resultingValue2' + '</td>' +
+ '</tr></tbody></table>')).to.be.true;
+ });
+
+ it('document.focus is called once', function () {
expect(mock.focus.calledOnce).to.be.true;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js b/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
index f39f7bf..f2f77aa 100644
--- a/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
@@ -93,8 +93,7 @@ describe('App.MainAlertDefinitionConfigsController', function () {
describe('#renderPortConfigs()', function () {
- it('should render array of configs with correct values', function () {
-
+ beforeEach(function () {
controller.set('content', Em.Object.create({
name: 'alertDefinitionName',
service: {displayName: 'alertDefinitionService'},
@@ -119,15 +118,17 @@ describe('App.MainAlertDefinitionConfigsController', function () {
uri: 'alertDefinitionUri',
defaultPort: '777'
}));
+ });
+ it('isWizard = true', function () {
controller.set('isWizard', true);
var result = controller.renderPortConfigs();
-
expect(result.length).to.equal(11);
+ });
+ it('isWizard = false', function () {
controller.set('isWizard', false);
- result = controller.renderPortConfigs();
-
+ var result = controller.renderPortConfigs();
expect(result.length).to.equal(5);
});
@@ -135,8 +136,7 @@ describe('App.MainAlertDefinitionConfigsController', function () {
describe('#renderMetricConfigs()', function () {
- it('should render array of configs with correct values', function () {
-
+ beforeEach(function () {
controller.set('content', Em.Object.create({
name: 'alertDefinitionName',
service: {displayName: 'alertDefinitionService'},
@@ -174,15 +174,17 @@ describe('App.MainAlertDefinitionConfigsController', function () {
value: null
}
}));
+ });
+ it('isWizard = true', function () {
controller.set('isWizard', true);
var result = controller.renderMetricConfigs();
-
expect(result.length).to.equal(11);
+ });
+ it('isWizard = false', function () {
controller.set('isWizard', false);
- result = controller.renderMetricConfigs();
-
+ var result = controller.renderMetricConfigs();
expect(result.length).to.equal(5);
});
@@ -190,8 +192,7 @@ describe('App.MainAlertDefinitionConfigsController', function () {
describe('#renderWebConfigs()', function () {
- it('should render array of configs with correct values', function () {
-
+ beforeEach(function () {
controller.set('content', Em.Object.create({
name: 'alertDefinitionName',
service: {displayName: 'alertDefinitionService'},
@@ -221,15 +222,17 @@ describe('App.MainAlertDefinitionConfigsController', function () {
"default_port": 0.0
}
}));
+ });
+ it('isWizard = true', function () {
controller.set('isWizard', true);
var result = controller.renderWebConfigs();
-
expect(result.length).to.equal(11);
+ });
+ it('isWizard = false', function () {
controller.set('isWizard', false);
- result = controller.renderWebConfigs();
-
+ var result = controller.renderWebConfigs();
expect(result.length).to.equal(5);
});
@@ -237,8 +240,7 @@ describe('App.MainAlertDefinitionConfigsController', function () {
describe('#renderScriptConfigs()', function () {
- it('should render array of configs with correct values', function () {
-
+ beforeEach(function () {
controller.set('content', Em.Object.create({
name: 'alertDefinitionName',
service: {displayName: 'alertDefinitionService'},
@@ -262,15 +264,17 @@ describe('App.MainAlertDefinitionConfigsController', function () {
],
location: 'path to script'
}));
+ });
+ it('isWizard = true', function () {
controller.set('isWizard', true);
var result = controller.renderScriptConfigs();
-
expect(result.length).to.equal(8);
+ });
+ it('isWizard = false', function () {
controller.set('isWizard', false);
- result = controller.renderScriptConfigs();
-
+ var result = controller.renderScriptConfigs();
expect(result.length).to.equal(2);
});
@@ -309,20 +313,23 @@ describe('App.MainAlertDefinitionConfigsController', function () {
describe('#editConfigs()', function () {
- it('should set previousValue, isDisabled for each config and change canEdit flag', function () {
-
+ beforeEach(function () {
controller.set('configs', [
Em.Object.create({value: 'value1', previousValue: '', isDisabled: true}),
Em.Object.create({value: 'value2', previousValue: '', isDisabled: true}),
Em.Object.create({value: 'value3', previousValue: '', isDisabled: true})
]);
-
controller.set('canEdit', false);
-
controller.editConfigs();
+ });
+ it('should set previousValue', function () {
expect(controller.get('configs').mapProperty('previousValue')).to.eql(['value1', 'value2', 'value3']);
+ });
+ it('should set isDisabled for each config', function () {
expect(controller.get('configs').someProperty('isDisabled', true)).to.be.false;
+ });
+ it('should change canEdit flag', function () {
expect(controller.get('canEdit')).to.be.true;
});
@@ -330,20 +337,23 @@ describe('App.MainAlertDefinitionConfigsController', function () {
describe('#cancelEditConfigs()', function () {
- it('should set previousValue, isDisabled for each config and change canEdit flag', function () {
-
+ beforeEach(function () {
controller.set('configs', [
Em.Object.create({value: '', previousValue: 'value1', isDisabled: false}),
Em.Object.create({value: '', previousValue: 'value2', isDisabled: false}),
Em.Object.create({value: '', previousValue: 'value3', isDisabled: false})
]);
-
controller.set('canEdit', true);
-
controller.cancelEditConfigs();
+ });
+ it('should set previousValue', function () {
expect(controller.get('configs').mapProperty('value')).to.eql(['value1', 'value2', 'value3']);
+ });
+ it('should set isDisabled for each config', function () {
expect(controller.get('configs').someProperty('isDisabled', false)).to.be.false;
+ });
+ it('should change canEdit flag', function () {
expect(controller.get('canEdit')).to.be.false;
});
@@ -353,26 +363,26 @@ describe('App.MainAlertDefinitionConfigsController', function () {
beforeEach(function () {
sinon.spy(App.ajax, 'send');
- });
-
- afterEach(function () {
- App.ajax.send.restore();
- });
-
- it('should set previousValue, isDisabled for each config and change canEdit flag', function () {
-
controller.set('configs', [
Em.Object.create({isDisabled: true}),
Em.Object.create({isDisabled: true}),
Em.Object.create({isDisabled: true})
]);
-
controller.set('canEdit', true);
-
controller.saveConfigs();
+ });
+ afterEach(function () {
+ App.ajax.send.restore();
+ });
+
+ it('should set isDisabled for each config', function () {
expect(controller.get('configs').someProperty('isDisabled', false)).to.be.false;
+ });
+ it('should change canEdit flag', function () {
expect(controller.get('canEdit')).to.be.false;
+ });
+ it('should sent 1 request', function () {
expect(App.ajax.send.calledOnce).to.be.true;
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_test.js b/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_test.js
index 2babb01..8d724d2 100644
--- a/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_test.js
+++ b/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_test.js
@@ -47,32 +47,54 @@ describe('MainChartHeatmapMetric', function () {
describe('#slotDefinitions', function () {
beforeEach(function () {
sinon.stub(mainChartHeatmapMetric, 'generateSlot', Em.K);
+ mainChartHeatmapMetric.set('maximumValue', 100);
+ mainChartHeatmapMetric.set('minimumValue', 0);
});
afterEach(function () {
mainChartHeatmapMetric.generateSlot.restore();
});
- it('one slot', function () {
- mainChartHeatmapMetric.set('numberOfSlots', 1);
- mainChartHeatmapMetric.set('maximumValue', 100);
- mainChartHeatmapMetric.set('minimumValue', 0);
- mainChartHeatmapMetric.propertyDidChange('slotDefinitions');
+ describe('one slot', function () {
+
+ beforeEach(function () {
+ mainChartHeatmapMetric.set('numberOfSlots', 1);
+ mainChartHeatmapMetric.propertyDidChange('slotDefinitions');
+ this.slotDefinitions = mainChartHeatmapMetric.get('slotDefinitions');
+ });
+
+ it('3 slotDefinitions', function () {
+ expect(this.slotDefinitions.length).to.equal(3);
+ });
+ it('generateSlot is called 1 time', function () {
+ expect(mainChartHeatmapMetric.generateSlot.callCount).to.be.equal(1);
+ });
+ it('generateSlot is called with correct arguments', function () {
+ expect(mainChartHeatmapMetric.generateSlot.getCall(0).args).to.eql([0, 100, '', {r: 0, g: 204, b: 0}]);
+ });
- expect(mainChartHeatmapMetric.get('slotDefinitions').length).to.equal(3);
- expect(mainChartHeatmapMetric.generateSlot.getCall(0).args).to.eql([0, 100, '', {r: 0, g: 204, b: 0}]);
- expect(mainChartHeatmapMetric.generateSlot.callCount).to.be.equal(1);
});
- it('two slots', function () {
- mainChartHeatmapMetric.set('numberOfSlots', 2);
- mainChartHeatmapMetric.set('maximumValue', 100);
- mainChartHeatmapMetric.set('minimumValue', 0);
- mainChartHeatmapMetric.propertyDidChange('slotDefinitions');
+ describe('two slots', function () {
+
+ beforeEach(function () {
+ mainChartHeatmapMetric.set('numberOfSlots', 2);
+ mainChartHeatmapMetric.propertyDidChange('slotDefinitions');
+ this.slotDefinitions = mainChartHeatmapMetric.get('slotDefinitions');
+ });
+
+ it('4 slotDefinitions', function () {
+ expect(this.slotDefinitions.length).to.equal(4);
+ });
+ it('generateSlot is called 2 times', function () {
+ expect(mainChartHeatmapMetric.generateSlot.callCount).to.be.equal(2);
+ });
+ it('generateSlot 1st call has valid arguments', function () {
+ expect(mainChartHeatmapMetric.generateSlot.getCall(0).args).to.eql([0, 50, '', {r: 0, g: 204, b: 0}]);
+ });
+ it('generateSlot 2nd call has valid arguments', function () {
+ expect(mainChartHeatmapMetric.generateSlot.getCall(1).args).to.eql([50, 100, '', {r: 159, g: 238, b: 0}]);
+ });
- expect(mainChartHeatmapMetric.get('slotDefinitions').length).to.equal(4);
- expect(mainChartHeatmapMetric.generateSlot.getCall(0).args).to.eql([0, 50, '', {r: 0, g: 204, b: 0}]);
- expect(mainChartHeatmapMetric.generateSlot.getCall(1).args).to.eql([50, 100, '', {r: 159, g: 238, b: 0}]);
- expect(mainChartHeatmapMetric.generateSlot.callCount).to.be.equal(2);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/main/charts/heatmap_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/charts/heatmap_test.js b/ambari-web/test/controllers/main/charts/heatmap_test.js
index 2e3f9de..ec87ace 100644
--- a/ambari-web/test/controllers/main/charts/heatmap_test.js
+++ b/ambari-web/test/controllers/main/charts/heatmap_test.js
@@ -206,20 +206,32 @@ describe('MainChartsHeatmapController', function () {
expect(categories[0].get('heatmaps')).to.eql(allHeatmaps);
});
- it("two categories", function() {
- var allHeatmaps = [
- {
- metrics: JSON.stringify([{service_name: 'S1'}])
- },
- {
- metrics: JSON.stringify([{service_name: 'S1'}])
- }
- ];
- var categories = controller.categorizeByServiceName(allHeatmaps);
- expect(categories[0].get('serviceName')).to.equal('S1');
- expect(categories[0].get('displayName')).to.equal('S1');
- expect(categories[0].get('heatmaps')[0]).to.eql(allHeatmaps[0]);
- expect(categories[0].get('heatmaps')[1]).to.eql(allHeatmaps[1]);
+ describe("two categories", function() {
+ var allHeatmaps;
+ beforeEach(function () {
+ allHeatmaps = [
+ {
+ metrics: JSON.stringify([{service_name: 'S1'}])
+ },
+ {
+ metrics: JSON.stringify([{service_name: 'S1'}])
+ }
+ ];
+ this.categories = controller.categorizeByServiceName(allHeatmaps);
+ });
+
+ it('serviceName is S1', function () {
+ expect(this.categories[0].get('serviceName')).to.equal('S1');
+ });
+ it('displayName is S1', function () {
+ expect(this.categories[0].get('displayName')).to.equal('S1');
+ });
+ it('heatmaps.0 is valid', function () {
+ expect(this.categories[0].get('heatmaps')[0]).to.eql(allHeatmaps[0]);
+ });
+ it('heatmaps.1 is valid', function () {
+ expect(this.categories[0].get('heatmaps')[1]).to.eql(allHeatmaps[1]);
+ });
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/main/host/add_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/add_controller_test.js b/ambari-web/test/controllers/main/host/add_controller_test.js
index ea9d032..6dcb2c9 100644
--- a/ambari-web/test/controllers/main/host/add_controller_test.js
+++ b/ambari-web/test/controllers/main/host/add_controller_test.js
@@ -418,6 +418,7 @@ describe('App.AddHostController', function () {
stack: [],
model: []
};
+
beforeEach(function () {
sinon.stub(controller, 'getDBProperty', function () {
return services.db;
@@ -430,111 +431,164 @@ describe('App.AddHostController', function () {
});
sinon.stub(controller, 'setDBProperty', Em.K);
});
+
afterEach(function () {
controller.getDBProperty.restore();
App.StackService.find.restore();
App.Service.find.restore();
controller.setDBProperty.restore();
});
- it("No services in db, no installed services", function () {
- services.stack = [Em.Object.create({
- serviceName: 'S1'
- })];
- controller.loadServices();
- expect(controller.setDBProperty.getCall(0).args).to.eql(['services',
- {
- selectedServices: [],
- installedServices: []
+
+ Em.A([
+ {
+ m: 'No services in db, no installed services',
+ service: {
+ db: null,
+ stack: [Em.Object.create({
+ serviceName: 'S1'
+ })],
+ model: []
+ },
+ e: {
+
+ db: ['services',
+ {
+ selectedServices: [],
+ installedServices: []
+ }
+ ],
+ services: [
+ Em.Object.create({
+ serviceName: 'S1',
+ isInstalled: false,
+ isSelected: false
+ })
+ ]
}
- ]);
- expect(controller.get('content.services')).to.eql([
- Em.Object.create({
- serviceName: 'S1',
- isInstalled: false,
- isSelected: false
- })
- ])
- });
- it("No services in db, installed service present", function () {
- services.stack = [
- Em.Object.create({
- serviceName: 'S1'
- }),
- Em.Object.create({
- serviceName: 'S2'
- })
- ];
- services.model = [
- Em.Object.create({
- serviceName: 'S1'
- })
- ];
- controller.loadServices();
- expect(controller.setDBProperty.getCall(0).args).to.eql(['services',
- {
- selectedServices: ['S1'],
- installedServices: ['S1']
+ },
+ {
+ m: 'No services in db, installed service present',
+ service: {
+ db: null,
+ stack: [
+ Em.Object.create({
+ serviceName: 'S1'
+ }),
+ Em.Object.create({
+ serviceName: 'S2'
+ })
+ ],
+ model: [
+ Em.Object.create({
+ serviceName: 'S1'
+ })
+ ]
+ },
+ e: {
+ db: ['services',
+ {
+ selectedServices: ['S1'],
+ installedServices: ['S1']
+ }
+ ],
+ services: [
+ Em.Object.create({
+ serviceName: 'S1',
+ isInstalled: true,
+ isSelected: true
+ }),
+ Em.Object.create({
+ serviceName: 'S2',
+ isInstalled: false,
+ isSelected: false
+ })
+ ]
}
- ]);
- expect(controller.get('content.services')).to.eql([
- Em.Object.create({
- serviceName: 'S1',
- isInstalled: true,
- isSelected: true
- }),
- Em.Object.create({
- serviceName: 'S2',
- isInstalled: false,
- isSelected: false
- })
- ]);
- });
- it("DB is empty", function () {
- services.stack = [Em.Object.create({
- serviceName: 'S1'
- })];
- services.db = {
- selectedServices: [],
- installedServices: []
- };
- controller.loadServices();
- expect(controller.setDBProperty.called).to.be.false;
- expect(controller.get('content.services')).to.eql([
- Em.Object.create({
- serviceName: 'S1',
- isSelected: false,
- isInstalled: false
- })
- ]);
- });
- it("DB has selected and installed services", function () {
- services.stack = [
- Em.Object.create({
- serviceName: 'S1'
- }),
- Em.Object.create({
- serviceName: 'S2'
- })
- ];
- services.db = {
- selectedServices: ['S1'],
- installedServices: ['S2']
- };
- controller.loadServices();
- expect(controller.setDBProperty.called).to.be.false;
- expect(controller.get('content.services')).to.eql([
- Em.Object.create({
- serviceName: 'S1',
- isInstalled: false,
- isSelected: true
- }),
- Em.Object.create({
- serviceName: 'S2',
- isInstalled: true,
- isSelected: false
- })
- ]);
+ },
+ {
+ m: 'DB is empty',
+ service: {
+ db: {
+ selectedServices: [],
+ installedServices: []
+ },
+ stack: [Em.Object.create({
+ serviceName: 'S1'
+ })],
+ model: []
+ },
+ e: {
+ db: false,
+ services: [
+ Em.Object.create({
+ serviceName: 'S1',
+ isSelected: false,
+ isInstalled: false
+ })
+ ]
+ }
+ },
+ {
+ m: 'DB has selected and installed services',
+ service: {
+ db: {
+ selectedServices: ['S1'],
+ installedServices: ['S2']
+ },
+ stack: [
+ Em.Object.create({
+ serviceName: 'S1'
+ }),
+ Em.Object.create({
+ serviceName: 'S2'
+ })
+ ],
+ model: []
+ },
+ e: {
+ db: false,
+ services: [
+ Em.Object.create({
+ serviceName: 'S1',
+ isInstalled: false,
+ isSelected: true
+ }),
+ Em.Object.create({
+ serviceName: 'S2',
+ isInstalled: true,
+ isSelected: false
+ })
+ ]
+ }
+ }
+ ]).forEach(function (test) {
+
+ describe(test.m, function () {
+
+ beforeEach(function () {
+ services = test.service;
+ controller.loadServices();
+ });
+
+ it('services are valid', function () {
+ expect(controller.get('content.services')).to.be.eql(test.e.services);
+ });
+
+ if (test.e.db) {
+ it('setDBProperty is called with valid arguments', function () {
+ expect(controller.setDBProperty.getCall(0).args).to.eql(test.e.db);
+ });
+ }
+ else {
+ it('setDBProperty is not called', function () {
+ expect(controller.setDBProperty.called).to.be.false;
+ });
+ }
+
+ });
+
});
+
});
describe("#loadSlaveComponentHosts()", function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index 27bd38f..2aaa35f 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -152,51 +152,71 @@ describe('App.MainHostDetailsController', function () {
});
describe('#sendComponentCommand()', function () {
- it('single component', function () {
- controller.set('content.hostName', 'host1');
- var component = Em.Object.create({
- service: {serviceName: 'S1'},
- componentName: 'COMP1'
+
+ describe('single component', function () {
+ var component;
+ beforeEach(function () {
+ controller.set('content.hostName', 'host1');
+ component = Em.Object.create({
+ service: {serviceName: 'S1'},
+ componentName: 'COMP1'
+ });
+
+ controller.sendComponentCommand(component, {}, 'state');
});
- controller.sendComponentCommand(component, {}, 'state');
- expect(App.ajax.send.getCall(0).args[0].name).to.be.equal('common.host.host_component.update');
- expect(App.ajax.send.getCall(0).args[0].data).to.be.eql({
- "hostName": "host1",
- "context": {},
- "component": component,
- "HostRoles": {
- "state": "state"
- },
- "componentName": "COMP1",
- "serviceName": "S1"
+ it('1st call endpoint is valid', function () {
+ expect(App.ajax.send.getCall(0).args[0].name).to.be.equal('common.host.host_component.update');
+ });
+
+ it('1st call data is valid', function () {
+ expect(App.ajax.send.getCall(0).args[0].data).to.be.eql({
+ "hostName": "host1",
+ "context": {},
+ "component": component,
+ "HostRoles": {
+ "state": "state"
+ },
+ "componentName": "COMP1",
+ "serviceName": "S1"
+ });
});
});
- it('multiple component', function () {
- controller.set('content.hostName', 'host1');
- var component = [
- Em.Object.create({
- service: {serviceName: 'S1'},
- componentName: 'COMP1'
- }),
- Em.Object.create({
- service: {serviceName: 'S1'},
- componentName: 'COMP2'
- })
- ];
- controller.sendComponentCommand(component, {}, 'state');
- expect(App.ajax.send.getCall(0).args[0].name).to.be.equal('common.host.host_components.update');
- expect(App.ajax.send.getCall(0).args[0].data).to.be.eql({
- "hostName": "host1",
- "context": {},
- "component": component,
- "HostRoles": {
- "state": "state"
- },
- "query": "HostRoles/component_name.in(COMP1,COMP2)"
+ describe('multiple component', function () {
+ var component;
+ beforeEach(function () {
+ controller.set('content.hostName', 'host1');
+ component = [
+ Em.Object.create({
+ service: {serviceName: 'S1'},
+ componentName: 'COMP1'
+ }),
+ Em.Object.create({
+ service: {serviceName: 'S1'},
+ componentName: 'COMP2'
+ })
+ ];
+ controller.sendComponentCommand(component, {}, 'state');
+ });
+
+ it('1st call endpoint is valid', function () {
+ expect(App.ajax.send.getCall(0).args[0].name).to.be.equal('common.host.host_components.update');
+ });
+
+ it('1st call data is valid', function () {
+ expect(App.ajax.send.getCall(0).args[0].data).to.be.eql({
+ "hostName": "host1",
+ "context": {},
+ "component": component,
+ "HostRoles": {
+ "state": "state"
+ },
+ "query": "HostRoles/component_name.in(COMP1,COMP2)"
+ });
});
});
+
});
describe('#sendComponentCommandSuccessCallback()', function () {
@@ -3013,24 +3033,49 @@ describe('App.MainHostDetailsController', function () {
afterEach(function () {
controller._doDeleteHostComponent.restore();
});
- it("Host has no components", function () {
- controller.set('content.hostComponents', Em.A([]));
- controller.doDeleteHost(Em.K);
- expect(controller.get('fromDeleteHost')).to.be.true;
- expect(App.ajax.send.getCall(0).args[0].data.hostName).to.be.equal('host1');
- expect(App.ajax.send.getCall(0).args[0].name).to.be.equal('common.delete.host');
+
+ describe("Host has no components", function () {
+
+ beforeEach(function () {
+ controller.set('content.hostComponents', Em.A([]));
+ controller.doDeleteHost(Em.K);
+ });
+
+ it('fromDeleteHost is true', function () {
+ expect(controller.get('fromDeleteHost')).to.be.true;
+ });
+ it('1st request is to delete host', function () {
+ expect(App.ajax.send.getCall(0).args[0].name).to.be.equal('common.delete.host');
+ });
+ it('1st request is done with valid hostName', function () {
+ expect(App.ajax.send.getCall(0).args[0].data.hostName).to.be.equal('host1');
+ });
});
- it("Host has components", function () {
- controller.set('content.hostComponents', Em.A([Em.Object.create({
- componentName: 'COMP1'
- })]));
- controller.doDeleteHost(Em.K);
- expect(controller._doDeleteHostComponent.calledWith(Em.Object.create({
- componentName: 'COMP1'
- }))).to.be.true;
- expect(controller.get('fromDeleteHost')).to.be.true;
- expect(App.ajax.send.getCall(0).args[0].data.hostName).to.be.equal('host1');
- expect(App.ajax.send.getCall(0).args[0].name).to.be.equal('common.delete.host');
+
+ describe("Host has components", function () {
+
+ beforeEach(function () {
+ controller.set('content.hostComponents', Em.A([Em.Object.create({
+ componentName: 'COMP1'
+ })]));
+ controller.doDeleteHost(Em.K);
+ });
+
+ it('_doDeleteHostComponent is called with correct arguments', function () {
+ expect(controller._doDeleteHostComponent.calledWith(Em.Object.create({
+ componentName: 'COMP1'
+ }))).to.be.true;
+ });
+ it('fromDeleteHost is true', function () {
+ expect(controller.get('fromDeleteHost')).to.be.true;
+ });
+ it('1st request is to delete host', function () {
+ expect(App.ajax.send.getCall(0).args[0].name).to.be.equal('common.delete.host');
+ });
+ it('1st request is done with valid hostName', function () {
+ expect(App.ajax.send.getCall(0).args[0].data.hostName).to.be.equal('host1');
+ });
+
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/main/service/add_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/add_controller_test.js b/ambari-web/test/controllers/main/service/add_controller_test.js
index 1ec367e..601d7d8 100644
--- a/ambari-web/test/controllers/main/service/add_controller_test.js
+++ b/ambari-web/test/controllers/main/service/add_controller_test.js
@@ -63,13 +63,23 @@ describe('App.AddServiceController', function() {
App.get.restore();
});
- it('send request to install client', function () {
- addServiceController.set("content.additionalClients", [t.additionalClients]);
- addServiceController.installAdditionalClients();
- expect($.ajax.calledOnce).to.equal(true);
+ describe('send request to install client', function () {
+
+ beforeEach(function () {
+ addServiceController.set("content.additionalClients", [t.additionalClients]);
+ addServiceController.installAdditionalClients();
+ });
+
+ it('1 request is sent', function () {
+ expect($.ajax.calledOnce).to.equal(true);
+ });
+ it('data.Body is valid', function () {
+ expect(JSON.parse($.ajax.args[0][0].data).Body).to.deep.eql(t.Body);
+ });
+ it('data.RequestInfo is valid', function () {
+ expect(JSON.parse($.ajax.args[0][0].data).RequestInfo).to.eql(t.RequestInfo);
+ });
- expect(JSON.parse($.ajax.args[0][0].data).Body).to.deep.eql(t.Body);
- expect(JSON.parse($.ajax.args[0][0].data).RequestInfo).to.eql(t.RequestInfo);
});
it('should not send request to install client', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/main/service/info/summary_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/info/summary_test.js b/ambari-web/test/controllers/main/service/info/summary_test.js
index 28c13e3..3db7239 100644
--- a/ambari-web/test/controllers/main/service/info/summary_test.js
+++ b/ambari-web/test/controllers/main/service/info/summary_test.js
@@ -207,14 +207,23 @@ App.TestAliases.testAsComputedOr(getController(), 'showTimeRangeControl', ['!isS
});
cases.forEach(function (item) {
- it(item.title, function () {
- controller.set('isPreviousRangerConfigsCallFailed', item.isPreviousRangerConfigsCallFailed);
- controller.get('rangerPlugins').findProperty('serviceName', 'HDFS').tag = item.hdfsTag;
- controller.get('rangerPlugins').findProperty('serviceName', 'HBASE').tag = item.hbaseTag;
- controller.getRangerPluginsStatus(data);
- expect(App.ajax.send.calledOnce).to.equal(item.ajaxRequestSent);
+ describe(item.title, function () {
+
+ beforeEach(function () {
+ controller.set('isPreviousRangerConfigsCallFailed', item.isPreviousRangerConfigsCallFailed);
+ controller.get('rangerPlugins').findProperty('serviceName', 'HDFS').tag = item.hdfsTag;
+ controller.get('rangerPlugins').findProperty('serviceName', 'HBASE').tag = item.hbaseTag;
+ controller.getRangerPluginsStatus(data);
+ });
+
+ it('1 request is ' + item.ajaxRequestSent + ' sent', function () {
+ expect(App.ajax.send.calledOnce).to.equal(item.ajaxRequestSent);
+ });
+
if (item.ajaxRequestSent) {
- expect(App.ajax.send.getCall(0).args[0].data.urlParams.contains('ranger-yarn-plugin-properties')).to.be.false;
+ it('request does not contains `ranger-yarn-plugin-properties`', function () {
+ expect(App.ajax.send.getCall(0).args[0].data.urlParams.contains('ranger-yarn-plugin-properties')).to.be.false;
+ });
}
});
});
@@ -222,7 +231,8 @@ App.TestAliases.testAsComputedOr(getController(), 'showTimeRangeControl', ['!isS
});
describe('#getRangerPluginsStatusSuccess', function () {
- it('relevant plugin statuses are set', function () {
+
+ beforeEach(function () {
controller.getRangerPluginsStatusSuccess({
'items': [
{
@@ -245,9 +255,18 @@ App.TestAliases.testAsComputedOr(getController(), 'showTimeRangeControl', ['!isS
}
]
});
+ });
+
+ it('isPreviousRangerConfigsCallFailed is false', function () {
expect(controller.get('isPreviousRangerConfigsCallFailed')).to.be.false;
+ });
+ it('rangerPlugins.HDFS status is valid', function () {
expect(controller.get('rangerPlugins').findProperty('serviceName', 'HDFS').status).to.equal(Em.I18n.t('alerts.table.state.enabled'));
+ });
+ it('rangerPlugins.HIVE status is valid', function () {
expect(controller.get('rangerPlugins').findProperty('serviceName', 'HIVE').status).to.equal(Em.I18n.t('alerts.table.state.enabled'));
+ });
+ it('rangerPlugins.HBASE status is valid', function () {
expect(controller.get('rangerPlugins').findProperty('serviceName', 'HBASE').status).to.equal(Em.I18n.t('common.unknown'));
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js
index 4be23c9..8b2f24e 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -304,25 +304,30 @@ describe('App.MainServiceItemController', function () {
tests.forEach(function (test, index) {
- function setupWithTestData() {
- mainServiceItemController = App.MainServiceItemController.create({content: {serviceName: test.data.serviceName}});
- mainServiceItemController.startStopPopupPrimary(test.data.state, test.data.query);
- }
+ describe('case #' + (index + 1), function () {
+
+ beforeEach(function () {
+ mainServiceItemController = App.MainServiceItemController.create({content: {serviceName: test.data.serviceName}});
+ mainServiceItemController.startStopPopupPrimary(test.data.state, test.data.query);
+ this.data = JSON.parse($.ajax.args[0][0].data);
+ });
+
+ it('request is sent with valid data ' + (index + 1), function () {
+ expect($.ajax.calledOnce).to.equal(true);
+ expect(this.data.Body.ServiceInfo.state).to.equal(test.request.Body.ServiceInfo.state);
+ expect(this.data.RequestInfo.context).to.equal(test.request.RequestInfo.context);
+ });
+
+ it('isStopDisabled is true ' + (index + 1), function () {
+ expect(mainServiceItemController.get('isStopDisabled')).to.equal(true);
+ });
+
+ it('isStartDisabled is true ' + (index + 1), function () {
+ expect(mainServiceItemController.get('isStartDisabled')).to.equal(true);
+ });
- it('request is sent with valid data ' + (index + 1), function () {
- setupWithTestData();
- expect($.ajax.calledOnce).to.equal(true);
- expect(JSON.parse($.ajax.args[0][0].data).Body.ServiceInfo.state).to.equal(test.request.Body.ServiceInfo.state);
- expect(JSON.parse($.ajax.args[0][0].data).RequestInfo.context).to.equal(test.request.RequestInfo.context);
- });
- it('isStopDisabled is true ' + (index + 1), function () {
- setupWithTestData();
- expect(mainServiceItemController.get('isStopDisabled')).to.equal(true);
- });
- it('isStartDisabled is true ' + (index + 1), function () {
- setupWithTestData();
- expect(mainServiceItemController.get('isStartDisabled')).to.equal(true);
});
+
});
@@ -517,37 +522,53 @@ describe('App.MainServiceItemController', function () {
expect(Em.I18n.t.calledWith('services.service.stop.warningMsg.dependent.services')).to.not.be.ok;
});
- it ("should display dependent list if other services depend on the one to be stopped", function() {
- var mainServiceItemController = App.MainServiceItemController.create(
- {content: {
- serviceName: "HDFS",
- passiveState:'OFF',
- hostComponents: [{
- componentName: 'NAMENODE',
- workStatus: 'INSTALLED'
- }]
- }}
- );
- mainServiceItemController.startStopPopup(event, "INSTALLED");
- expect(Em.I18n.t.calledWith('services.service.stop.warningMsg.turnOnMM')).to.be.ok;
- expect(Em.I18n.t.calledWith('services.service.stop.warningMsg.dependent.services')).to.be.ok;
-
- var dependencies = Em.I18n.t('services.service.stop.warningMsg.dependent.services').format("HDFS", "HBase,YARN")
- var msg = Em.I18n.t('services.service.stop.warningMsg.turnOnMM').format("HDFS");
- var fullMsg = mainServiceItemController.addAdditionalWarningMessage("INSTALLED", msg, "HDFS");
- expect(fullMsg).to.be.equal(msg + " " + dependencies);
+ describe ("should display dependent list if other services depend on the one to be stopped", function() {
+ var mainServiceItemController;
+ beforeEach(function () {
+ mainServiceItemController = App.MainServiceItemController.create(
+ {content: {
+ serviceName: "HDFS",
+ passiveState:'OFF',
+ hostComponents: [{
+ componentName: 'NAMENODE',
+ workStatus: 'INSTALLED'
+ }]
+ }}
+ );
+ mainServiceItemController.startStopPopup(event, "INSTALLED");
+ this.dependencies = Em.I18n.t('services.service.stop.warningMsg.dependent.services').format("HDFS", "HBase,YARN");
+ this.msg = Em.I18n.t('services.service.stop.warningMsg.turnOnMM').format("HDFS");
+ this.fullMsg = mainServiceItemController.addAdditionalWarningMessage("INSTALLED", this.msg, "HDFS");
+ });
+
+ it('turnOnMM message is shown', function () {
+ expect(Em.I18n.t.calledWith('services.service.stop.warningMsg.turnOnMM')).to.be.ok;
+ });
+ it('message about dependent services is shown', function () {
+ expect(Em.I18n.t.calledWith('services.service.stop.warningMsg.dependent.services')).to.be.ok;
+ });
+ it('full message is valid', function () {
+ expect(this.fullMsg).to.be.equal(this.msg + " " + this.dependencies);
+ });
});
- it ("should display the dependent service if another service depends on the one to be stopped", function() {
- var mainServiceItemController = App.MainServiceItemController.create(
+ describe("should display the dependent service if another service depends on the one to be stopped", function() {
+
+ beforeEach(function () {
+ var mainServiceItemController = App.MainServiceItemController.create(
{content: {serviceName: "HIVE", passiveState:'OFF'}});
- mainServiceItemController.startStopPopup(event, "INSTALLED");
- expect(Em.I18n.t.calledWith('services.service.stop.warningMsg.dependent.services')).to.be.ok;
-
- var dependencies = Em.I18n.t('services.service.stop.warningMsg.dependent.services').format("HIVE", "Spark")
- var msg = Em.I18n.t('services.service.stop.warningMsg.turnOnMM').format("HIVE");
- var fullMsg = mainServiceItemController.addAdditionalWarningMessage("INSTALLED", msg, "HIVE");
- expect(fullMsg).to.be.equal(msg + " " + dependencies);
+ mainServiceItemController.startStopPopup(event, "INSTALLED");
+ this.dependencies = Em.I18n.t('services.service.stop.warningMsg.dependent.services').format("HIVE", "Spark");
+ this.msg = Em.I18n.t('services.service.stop.warningMsg.turnOnMM').format("HIVE");
+ this.fullMsg = mainServiceItemController.addAdditionalWarningMessage("INSTALLED", this.msg, "HIVE");
+ });
+
+ it('message about dependent services is shown', function () {
+ expect(Em.I18n.t.calledWith('services.service.stop.warningMsg.dependent.services')).to.be.ok;
+ });
+ it('full message is valid', function () {
+ expect(this.fullMsg).to.be.equal(this.msg + " " + this.dependencies);
+ });
});
afterEach(function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js b/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js
index 699f0a2..0cc0f5f 100644
--- a/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js
+++ b/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js
@@ -442,6 +442,58 @@ describe('App.ManageConfigGroupsController', function() {
describe('#_onLoadPropertiesSuccess', function () {
+ var data = {
+ items: [
+ {
+ type: 'type1',
+ tag: 'tag1',
+ properties: {
+ prop1: 'val1',
+ prop2: 'val2'
+ }
+ },
+ {
+ type: 'type1',
+ tag: 'tag2',
+ properties: {
+ prop3: 'val3'
+ }
+ },
+ {
+ type: 'type2',
+ tag: 'tag1',
+ properties: {
+ prop4: 'val4'
+ }
+ }
+ ]
+ };
+ var params = {
+ typeTagToGroupMap: {
+ 'type1///tag1': 'group1',
+ 'type1///tag2': 'group2',
+ 'type2///tag1': 'group3'
+ }
+ };
+ var configGroups = [
+ Em.Object.create({
+ name: 'group1',
+ properties: []
+ }),
+ Em.Object.create({
+ name: 'group2',
+ properties: []
+ }),
+ Em.Object.create({
+ name: 'group3',
+ properties: []
+ }),
+ Em.Object.create({
+ name: 'group4',
+ properties: []
+ })
+ ];
+
beforeEach(function () {
sinon.stub(c, 'resortConfigGroup', Em.K);
});
@@ -451,63 +503,8 @@ describe('App.ManageConfigGroupsController', function() {
});
it('should set properties to config groups', function () {
-
- c.set('configGroups', [
- Em.Object.create({
- name: 'group1',
- properties: []
- }),
- Em.Object.create({
- name: 'group2',
- properties: []
- }),
- Em.Object.create({
- name: 'group3',
- properties: []
- }),
- Em.Object.create({
- name: 'group4',
- properties: []
- })
- ]);
-
- var data = {
- items: [
- {
- type: 'type1',
- tag: 'tag1',
- properties: {
- prop1: 'val1',
- prop2: 'val2'
- }
- },
- {
- type: 'type1',
- tag: 'tag2',
- properties: {
- prop3: 'val3'
- }
- },
- {
- type: 'type2',
- tag: 'tag1',
- properties: {
- prop4: 'val4'
- }
- }
- ]
- };
-
- var params = {
- typeTagToGroupMap: {
- 'type1///tag1': 'group1',
- 'type1///tag2': 'group2',
- 'type2///tag1': 'group3'
- }
- };
-
+ c.set('configGroups', configGroups);
c._onLoadPropertiesSuccess(data, null, params);
-
expect(JSON.stringify(c.get('configGroups'))).to.equal(JSON.stringify([
Em.Object.create({
properties: [
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
----------------------------------------------------------------------
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 19d9201..7ea47c6 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
@@ -934,28 +934,22 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
describe('#startNameNode()', function () {
beforeEach(function () {
sinon.stub(controller, 'updateComponent', Em.K);
+ controller.set('content.masterComponentHosts', [{
+ component: 'NAMENODE',
+ hostName: 'host1'
+ }]);
});
afterEach(function () {
controller.updateComponent.restore();
});
it('reassign host does not match current', function () {
- controller.set('content.masterComponentHosts', [{
- component: 'NAMENODE',
- hostName: 'host1'
- }]);
controller.set('content.reassignHosts.source', 'host2');
controller.startNameNode();
- expect(controller.updateComponent.getCall(0).args[1][0]).to.equal('host1');
- expect(controller.updateComponent.getCall(0).args[0]).to.equal('NAMENODE');
- expect(controller.updateComponent.getCall(0).args[2]).to.equal('HDFS');
- expect(controller.updateComponent.getCall(0).args[3]).to.equal('Start');
+ expect(controller.updateComponent.calledWith('NAMENODE', ['host1'], 'HDFS', 'Start')).to.be.true;
});
+
it('reassign host matches current', function () {
- controller.set('content.masterComponentHosts', [{
- component: 'NAMENODE',
- hostName: 'host1'
- }]);
controller.set('content.reassignHosts.source', 'host1');
controller.startNameNode();
expect(controller.updateComponent.calledWith('NAMENODE', [], 'HDFS', 'Start')).to.be.true;
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/main/service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service_test.js b/ambari-web/test/controllers/main/service_test.js
index 4a3d329..3c90b9d 100644
--- a/ambari-web/test/controllers/main/service_test.js
+++ b/ambari-web/test/controllers/main/service_test.js
@@ -273,6 +273,9 @@ describe('App.MainServiceController', function () {
describe('#allServicesCall', function() {
+ var state = 'STARTED',
+ query = 'some query';
+
beforeEach(function() {
sinon.stub($, 'ajax', Em.K);
sinon.stub(App, 'get', function(k) {
@@ -280,6 +283,9 @@ describe('App.MainServiceController', function () {
if ('clusterName' === k) return 'tdk';
return Em.get(App, k);
});
+ mainServiceController.allServicesCall(state, query);
+ this.params = $.ajax.args[0][0];
+ this.data = JSON.parse(this.params.data);
});
afterEach(function() {
@@ -287,16 +293,17 @@ describe('App.MainServiceController', function () {
App.get.restore();
});
- it('should do ajax-request', function() {
- var state = 'STARTED',
- query = 'some query';
- mainServiceController.allServicesCall(state, query);
- var params = $.ajax.args[0][0];
- expect(params.type).to.equal('PUT');
- expect(params.url.contains('/clusters/tdk/services?')).to.be.true;
- var data = JSON.parse(params.data);
- expect(data.Body.ServiceInfo.state).to.equal(state);
- expect(data.RequestInfo.context).to.equal(App.BackgroundOperationsController.CommandContexts.START_ALL_SERVICES);
+ it('PUT request is sent', function() {
+ expect(this.params.type).to.equal('PUT');
+ });
+ it('request is sent to `/services`', function() {
+ expect(this.params.url.contains('/clusters/tdk/services?')).to.be.true;
+ });
+ it('Body.ServiceInfo.state is ' + state, function() {
+ expect(this.data.Body.ServiceInfo.state).to.equal(state);
+ });
+ it('RequestInfo.context is ' + query, function() {
+ expect(this.data.RequestInfo.context).to.equal(App.BackgroundOperationsController.CommandContexts.START_ALL_SERVICES);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/wizard/step10_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step10_test.js b/ambari-web/test/controllers/wizard/step10_test.js
index d6ce4b4..92743c3 100644
--- a/ambari-web/test/controllers/wizard/step10_test.js
+++ b/ambari-web/test/controllers/wizard/step10_test.js
@@ -158,12 +158,19 @@ describe('App.WizardStep10Controller', function () {
}
]);
tests.forEach(function(test) {
- it(test.m, function() {
- controller.set('content.hosts', test.hosts);
- controller.set('clusterInfo', Em.A([Em.Object.create({id: 1, status: []})]));
- controller.loadInstalledHosts();
+ describe(test.m, function() {
+
+ beforeEach(function () {
+ controller.set('content.hosts', test.hosts);
+ controller.set('clusterInfo', Em.A([Em.Object.create({id: 1, status: []})]));
+ controller.loadInstalledHosts();
+ });
+
test.e.forEach(function(ex) {
- expect(controller.get('clusterInfo').findProperty('id', 1).get('status').findProperty('id', ex.id).get('displayStatement').contains(ex.l)).to.equal(true);
+ it(JSON.stringify(test.e), function () {
+ var displayStatement = controller.get('clusterInfo').findProperty('id', 1).get('status').findProperty('id', ex.id).get('displayStatement');
+ expect(displayStatement.contains(ex.l)).to.equal(true);
+ });
});
})
});
@@ -314,12 +321,19 @@ describe('App.WizardStep10Controller', function () {
}
]);
testsForFailedTasks.forEach(function(test) {
- it(test.m, function() {
- controller.set('content.hosts', test.hosts);
- controller.set('clusterInfo', Em.A([Em.Object.create({id: 1, status: []})]));
- controller.loadInstalledHosts();
+ describe(test.m, function() {
+
+ beforeEach(function () {
+ controller.set('content.hosts', test.hosts);
+ controller.set('clusterInfo', Em.A([Em.Object.create({id: 1, status: []})]));
+ controller.loadInstalledHosts();
+ });
+
test.e.forEach(function(ex) {
- expect(controller.get('clusterInfo').findProperty('id', 1).get('status').findProperty('id', 2).get('statements').mapProperty('status', ex.st).length).to.equal(ex.l);
+ it(JSON.stringify(test.e), function () {
+ var tasksWithNeededStatements = controller.get('clusterInfo').findProperty('id', 1).get('status').findProperty('id', 2).get('statements').filterProperty('status', ex.st);
+ expect(tasksWithNeededStatements.length).to.equal(ex.l);
+ });
});
})
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/wizard/step3_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step3_test.js b/ambari-web/test/controllers/wizard/step3_test.js
index 309d658..692d292 100644
--- a/ambari-web/test/controllers/wizard/step3_test.js
+++ b/ambari-web/test/controllers/wizard/step3_test.js
@@ -355,17 +355,28 @@ describe('App.WizardStep3Controller', function () {
]);
tests.forEach(function (test) {
- it(test.m, function () {
- c.set('bootHosts', test.bootHosts);
- var r = c.parseHostInfo(test.hostsStatusFromServer);
- expect(r).to.equal(test.e.r);
+ describe(test.m, function () {
+ var r;
+ beforeEach(function () {
+ c.set('bootHosts', test.bootHosts);
+ r = c.parseHostInfo(test.hostsStatusFromServer);
+ });
+
+ it('parsed hosts info is valid', function () {
+ expect(r).to.equal(test.e.r);
+ });
+
if (test.e.c) {
test.hostsStatusFromServer.forEach(function (h) {
- var r = c.get('bootHosts').findProperty('name', h.hostName);
- if (!['REGISTERED', 'REGISTERING'].contains(r.get('bootStatus'))) {
- expect(r.get('bootStatus')).to.equal(h.status);
- expect(r.get('bootLog')).to.equal(h.log);
- }
+
+ it('bootStatus and bootLog are valid', function () {
+ var bootHosts = c.get('bootHosts').findProperty('name', h.hostName);
+ if (!['REGISTERED', 'REGISTERING'].contains(bootHosts.get('bootStatus'))) {
+ expect(bootHosts.get('bootStatus')).to.equal(h.status);
+ expect(bootHosts.get('bootLog')).to.equal(h.log);
+ }
+ });
+
});
}
});
@@ -1617,15 +1628,24 @@ describe('App.WizardStep3Controller', function () {
])
}
]).forEach(function (category) {
- describe(category.m, function () {
- category.tests.forEach(function (test) {
- it(test.m, function () {
+ describe(category.m, function () {
+ category.tests.forEach(function (test) {
+
+ describe(test.m, function () {
+
+ beforeEach(function () {
c.parseHostCheckWarnings({tasks: test.tasks});
+ });
+
+ it('warnings', function () {
c.get('warnings').forEach(function (w, i) {
Em.keys(test.e.warnings[i]).forEach(function (k) {
expect(w[k]).to.eql(test.e.warnings[i][k]);
});
});
+ });
+
+ it('warningsByHost', function () {
for (var i in test.e.warningsByHost) {
if (test.e.warningsByHost.hasOwnProperty(i)) {
expect(c.get('warningsByHost')[i].warnings.length).to.equal(test.e.warningsByHost[i]);
@@ -1635,6 +1655,7 @@ describe('App.WizardStep3Controller', function () {
});
});
});
+ });
it('should parse umask warnings', function () {
@@ -2081,18 +2102,26 @@ describe('App.WizardStep3Controller', function () {
]).forEach(function (category) {
describe(category.m, function () {
category.tests.forEach(function (test) {
- it(test.m, function () {
- c.parseWarnings({items: test.items});
- c.get('warnings').forEach(function (w, i) {
- Em.keys(test.e.warnings[i]).forEach(function (k) {
- expect(w[k]).to.eql(test.e.warnings[i][k]);
+ describe(test.m, function () {
+
+ beforeEach(function () {
+ c.parseWarnings({items: test.items});
+ });
+ it('warnings', function () {
+ c.get('warnings').forEach(function (w, i) {
+ Em.keys(test.e.warnings[i]).forEach(function (k) {
+ expect(w[k]).to.eql(test.e.warnings[i][k]);
+ });
});
});
- for (var i in test.e.warningsByHost) {
- if (test.e.warningsByHost.hasOwnProperty(i)) {
- expect(c.get('warningsByHost')[i].warnings.length).to.equal(test.e.warningsByHost[i]);
+
+ it('warningsByHost', function () {
+ for (var i in test.e.warningsByHost) {
+ if (test.e.warningsByHost.hasOwnProperty(i)) {
+ expect(c.get('warningsByHost')[i].warnings.length).to.equal(test.e.warningsByHost[i]);
+ }
}
- }
+ });
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/wizard/step4_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step4_test.js b/ambari-web/test/controllers/wizard/step4_test.js
index 69cc727..8cd1c3f 100644
--- a/ambari-web/test/controllers/wizard/step4_test.js
+++ b/ambari-web/test/controllers/wizard/step4_test.js
@@ -160,19 +160,25 @@ describe('App.WizardStep4Controller', function () {
];
testCases.forEach(function(testCase){
- it(testCase.title, function () {
- controller.clear();
- for(var id in testCase.condition) {
- controller.pushObject(Ember.Object.create({
- 'serviceName':id, 'isSelected': testCase.condition[id], 'canBeSelected': true, 'isInstalled': false,
- coSelectedServices: function() {
- return App.StackService.coSelected[this.get('serviceName')] || [];
- }.property('serviceName')
- }));
- }
- controller.setGroupedServices();
+ describe(testCase.title, function () {
+
+ beforeEach(function () {
+ controller.clear();
+ for(var id in testCase.condition) {
+ controller.pushObject(Ember.Object.create({
+ 'serviceName':id, 'isSelected': testCase.condition[id], 'canBeSelected': true, 'isInstalled': false,
+ coSelectedServices: function() {
+ return App.StackService.coSelected[this.get('serviceName')] || [];
+ }.property('serviceName')
+ }));
+ }
+ controller.setGroupedServices();
+ });
+
for(var service in testCase.result) {
- expect(controller.findProperty('serviceName', service).get('isSelected')).to.equal(testCase.result[service]);
+ it(service, function () {
+ expect(controller.findProperty('serviceName', service).get('isSelected')).to.equal(testCase.result[service]);
+ });
}
});
}, this);
@@ -431,26 +437,31 @@ describe('App.WizardStep4Controller', function () {
});
if (test.errorsExpected) {
- it('if errors detected than it should be shown', function () {
+ describe('if errors detected than it should be shown', function () {
+ var currentErrorObject;
+ beforeEach(function () {
+ currentErrorObject = c.get('errorStack').findProperty('isShown', false);
+ });
test.errorsExpected.forEach(function(error, index, errors) {
- // validate current error
- var currentErrorObject = c.get('errorStack').findProperty('isShown', false);
- if (currentErrorObject) {
- expect(test.errorsExpected).to.contain(currentErrorObject.id);
- // show current error
- var popup = c.showError(currentErrorObject);
- // submit popup
- popup.onPrimary();
- // onPrimaryPopupCallback should be called
- expect(c.onPrimaryPopupCallback.called).to.equal(true);
- // submit called
- expect(c.submit.called).to.equal(true);
- if (c.get('errorStack').length) {
- // current error isShown flag changed to true
- expect(currentErrorObject.isShown).to.equal(true);
+ it(error, function () {
+ // validate current error
+ if (currentErrorObject) {
+ expect(test.errorsExpected).to.contain(currentErrorObject.id);
+ // show current error
+ var popup = c.showError(currentErrorObject);
+ // submit popup
+ popup.onPrimary();
+ // onPrimaryPopupCallback should be called
+ expect(c.onPrimaryPopupCallback.called).to.equal(true);
+ // submit called
+ expect(c.submit.called).to.equal(true);
+ if (c.get('errorStack').length) {
+ // current error isShown flag changed to true
+ expect(currentErrorObject.isShown).to.equal(true);
+ }
+ runValidations();
}
- runValidations();
- }
+ });
});
});
}
@@ -795,21 +806,26 @@ describe('App.WizardStep4Controller', function () {
});
cases.forEach(function (item) {
- it(item.title, function () {
- this.stub.withArgs('currentStackName').returns(item.currentStackName).
- withArgs('currentStackVersionNumber').returns(item.currentStackVersionNumber);
- controller.set('content', generateSelectedServicesContent(item.services));
- var spark = controller.findProperty('serviceName', 'SPARK');
- if (item.services.contains('SPARK')) {
- spark.setProperties({
- isSelected: item.isSparkSelected,
- isInstalled: item.isSparkInstalled
- });
- } else {
- controller.removeObject(spark);
- }
- controller.sparkValidation();
- expect(controller.get('errorStack').mapProperty('id').contains('sparkWarning')).to.equal(item.isSparkWarning);
+ describe(item.title, function () {
+ beforeEach(function () {
+ this.stub.withArgs('currentStackName').returns(item.currentStackName).
+ withArgs('currentStackVersionNumber').returns(item.currentStackVersionNumber);
+ controller.set('content', generateSelectedServicesContent(item.services));
+ var spark = controller.findProperty('serviceName', 'SPARK');
+ if (item.services.contains('SPARK')) {
+ spark.setProperties({
+ isSelected: item.isSparkSelected,
+ isInstalled: item.isSparkInstalled
+ });
+ } else {
+ controller.removeObject(spark);
+ }
+ controller.sparkValidation();
+ });
+
+ it('sparkWarning is ' + item.sparkWarning, function () {
+ expect(controller.get('errorStack').mapProperty('id').contains('sparkWarning')).to.equal(item.isSparkWarning);
+ });
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/wizard/step5_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step5_test.js b/ambari-web/test/controllers/wizard/step5_test.js
index 09da19e..033b067 100644
--- a/ambari-web/test/controllers/wizard/step5_test.js
+++ b/ambari-web/test/controllers/wizard/step5_test.js
@@ -1104,17 +1104,24 @@ describe('App.WizardStep5Controller', function () {
expect(r.mapProperty('selectedHost')).to.eql(['h1', 'h1', 'h2', 'h2', 'h3']);
});
- it('some saved components exist', function() {
- c.set('content.controllerName', 'addServiceController');
- c.get('multipleComponents').push('c4');
- c.set('content.masterComponentHosts', [
- {hostName: 'h3', component: 'c4'}
- ]);
- c.get('content.recommendations.blueprint.host_groups')[2].components.push({name: 'c4'});
- var r = c.createComponentInstallationObjects();
- expect(r.mapProperty('component_name')).to.eql(['c1', 'c2', 'c1', 'c2', 'c1', 'c4']);
- expect(r.mapProperty('serviceId')).to.eql(['s1', 's2', 's1', 's2', 's1', 's2']);
- expect(r.mapProperty('selectedHost')).to.eql(['h1', 'h1', 'h2', 'h2', 'h3', 'h3']);
+ describe('some saved components exist', function() {
+
+ beforeEach(function () {
+ c.set('content.controllerName', 'addServiceController');
+ c.get('multipleComponents').push('c4');
+ c.set('content.masterComponentHosts', [
+ {hostName: 'h3', component: 'c4'}
+ ]);
+ c.get('content.recommendations.blueprint.host_groups')[2].components.push({name: 'c4'});
+ });
+
+ it('data contains save components', function () {
+ var r = c.createComponentInstallationObjects();
+ expect(r.mapProperty('component_name')).to.eql(['c1', 'c2', 'c1', 'c2', 'c1', 'c4']);
+ expect(r.mapProperty('serviceId')).to.eql(['s1', 's2', 's1', 's2', 's1', 's2']);
+ expect(r.mapProperty('selectedHost')).to.eql(['h1', 'h1', 'h2', 'h2', 'h3', 'h3']);
+ });
+
});
});
[49/50] [abbrv] ambari git commit: AMBARI-14516. Failed to deploy
Kerberized cluster via blueprint with custom principal name (rlevas)
Posted by nc...@apache.org.
AMBARI-14516. Failed to deploy Kerberized cluster via blueprint with custom principal name (rlevas)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7a9e6243
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7a9e6243
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7a9e6243
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 7a9e6243bdbd1deca16c447ce48701a3be3adde3
Parents: 32c8cfa
Author: Robert Levas <rl...@hortonworks.com>
Authored: Mon Jan 4 15:16:46 2016 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Mon Jan 4 15:16:46 2016 -0500
----------------------------------------------------------------------
.../server/controller/KerberosHelperImpl.java | 11 ++-
.../HostKerberosIdentityResourceProvider.java | 9 ++-
.../kerberos/KerberosPrincipalDescriptor.java | 13 ++--
.../state/kerberos/KerberosPrincipalType.java | 22 +++++-
.../KerberosPrincipalDescriptorTest.java | 73 ++++++++++++++++++++
5 files changed, 116 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7a9e6243/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
index ef9cab6..566e83c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
@@ -823,7 +823,7 @@ public class KerberosHelperImpl implements KerberosHelper {
if (principalDescriptor != null) {
principal = variableReplacementHelper.replaceVariables(principalDescriptor.getValue(), configurations);
- principalType = principalDescriptor.getType().name().toLowerCase();
+ principalType = KerberosPrincipalType.translate(principalDescriptor.getType());
principalConfiguration = variableReplacementHelper.replaceVariables(principalDescriptor.getConfiguration(), configurations);
}
@@ -956,9 +956,16 @@ public class KerberosHelperImpl implements KerberosHelper {
String uniqueKey = String.format("%s|%s", principal, (keytabFile == null) ? "" : keytabFile);
if (!hostActiveIdentities.containsKey(uniqueKey)) {
+ KerberosPrincipalType principalType = principalDescriptor.getType();
+
+ // Assume the principal is a service principal if not specified
+ if(principalType == null) {
+ principalType = KerberosPrincipalType.SERVICE;
+ }
+
KerberosPrincipalDescriptor resolvedPrincipalDescriptor =
new KerberosPrincipalDescriptor(principal,
- principalDescriptor.getType(),
+ principalType,
variableReplacementHelper.replaceVariables(principalDescriptor.getConfiguration(), configurations),
variableReplacementHelper.replaceVariables(principalDescriptor.getLocalUsername(), configurations));
http://git-wip-us.apache.org/repos/asf/ambari/blob/7a9e6243/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostKerberosIdentityResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostKerberosIdentityResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostKerberosIdentityResourceProvider.java
index c76ae6c..5ed5f35 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostKerberosIdentityResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostKerberosIdentityResourceProvider.java
@@ -37,6 +37,7 @@ import org.apache.ambari.server.orm.entities.HostEntity;
import org.apache.ambari.server.state.kerberos.KerberosIdentityDescriptor;
import org.apache.ambari.server.state.kerberos.KerberosKeytabDescriptor;
import org.apache.ambari.server.state.kerberos.KerberosPrincipalDescriptor;
+import org.apache.ambari.server.state.kerberos.KerberosPrincipalType;
import java.text.DecimalFormat;
import java.util.Collection;
@@ -178,12 +179,18 @@ public class HostKerberosIdentityResourceProvider extends ReadOnlyResourceProvid
if ((principal != null) && !principal.isEmpty()) {
Resource resource = new ResourceImpl(Resource.Type.HostKerberosIdentity);
+ KerberosPrincipalType principalType = principalDescriptor.getType();
+
+ // Assume the principal is a service principal if not specified
+ if(principalType == null) {
+ principalType = KerberosPrincipalType.SERVICE;
+ }
setResourceProperty(resource, KERBEROS_IDENTITY_CLUSTER_NAME_PROPERTY_ID, clusterName, requestPropertyIds);
setResourceProperty(resource, KERBEROS_IDENTITY_HOST_NAME_PROPERTY_ID, currentHostName, requestPropertyIds);
setResourceProperty(resource, KERBEROS_IDENTITY_PRINCIPAL_NAME_PROPERTY_ID, principal, requestPropertyIds);
- setResourceProperty(resource, KERBEROS_IDENTITY_PRINCIPAL_TYPE_PROPERTY_ID, principalDescriptor.getType(), requestPropertyIds);
+ setResourceProperty(resource, KERBEROS_IDENTITY_PRINCIPAL_TYPE_PROPERTY_ID, principalType, requestPropertyIds);
setResourceProperty(resource, KERBEROS_IDENTITY_PRINCIPAL_LOCAL_USERNAME_PROPERTY_ID, principalDescriptor.getLocalUsername(), requestPropertyIds);
String installedStatus;
http://git-wip-us.apache.org/repos/asf/ambari/blob/7a9e6243/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalDescriptor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalDescriptor.java b/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalDescriptor.java
index 09f6872..0156e4a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalDescriptor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalDescriptor.java
@@ -73,7 +73,7 @@ public class KerberosPrincipalDescriptor extends AbstractKerberosDescriptor {
* <p/>
* Expecting either "service" or "user"
*/
- private KerberosPrincipalType type = KerberosPrincipalType.SERVICE;
+ private KerberosPrincipalType type = null;
/**
* A string declaring configuration type and property name indicating the property to be updated
@@ -109,7 +109,7 @@ public class KerberosPrincipalDescriptor extends AbstractKerberosDescriptor {
// The name for this KerberosPrincipalDescriptor is stored in the "value" entry in the map
// This is not automatically set by the super classes.
setName(principal);
- setType((type == null) ? KerberosPrincipalType.SERVICE : type);
+ setType(type);
setConfiguration(configuration);
setLocalUsername(localUsername);
}
@@ -270,7 +270,7 @@ public class KerberosPrincipalDescriptor extends AbstractKerberosDescriptor {
Map<String, Object> map = new HashMap<String, Object>();
map.put("value", getValue());
- map.put("type", getType().name().toLowerCase());
+ map.put("type", KerberosPrincipalType.translate(getType()));
map.put("configuration", getConfiguration());
map.put("local_username", getLocalUsername());
@@ -314,19 +314,16 @@ public class KerberosPrincipalDescriptor extends AbstractKerberosDescriptor {
/**
* Translates a string value representing a principal type to a KerberosPrincipalType.
- * <p/>
- * If no value is supplied for the key or a translation cannot be made then KerberosPrincipalType.SERVICE
- * is assumed.
*
* @param map a Map containing the relevant data
* @param key a String declaring the item to retrieve
- * @return a KerberosPrincipalType
+ * @return a KerberosPrincipalType, or null is not specified in the map
* @throws IllegalArgumentException if the principal type value is not one of the expected types.
*/
private static KerberosPrincipalType getKerberosPrincipalTypeValue(Map<?, ?> map, String key) {
String type = getStringValue(map, key);
if ((type == null) || type.isEmpty()) {
- return KerberosPrincipalType.SERVICE;
+ return null;
} else {
return KerberosPrincipalType.valueOf(type.toUpperCase());
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/7a9e6243/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalType.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalType.java b/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalType.java
index e192be0..677be82 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalType.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalType.java
@@ -35,5 +35,25 @@ public enum KerberosPrincipalType {
* <p/>
* Typically in the form <code>service/host@REALM</code>.
*/
- SERVICE
+ SERVICE;
+
+ public static KerberosPrincipalType translate(String string) {
+ if(string == null)
+ return null;
+ else {
+ string = string.trim();
+
+ if(string.isEmpty())
+ return null;
+ else {
+ return valueOf(string.toUpperCase());
+ }
+ }
+ }
+
+ public static String translate(KerberosPrincipalType type) {
+ return (type == null)
+ ? null
+ : type.name().toLowerCase();
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/7a9e6243/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalDescriptorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalDescriptorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalDescriptorTest.java
index 9a4a042..5c249e2 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalDescriptorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalDescriptorTest.java
@@ -34,6 +34,11 @@ public class KerberosPrincipalDescriptorTest {
"\"local_username\": \"localUser\"" +
"}";
+ public static final String JSON_VALUE_SPARSE =
+ "{" +
+ "\"value\": \"serviceOther/_HOST@_REALM\"" +
+ "}";
+
public static final Map<String, Object> MAP_VALUE =
new HashMap<String, Object>() {
{
@@ -44,6 +49,13 @@ public class KerberosPrincipalDescriptorTest {
}
};
+ public static final Map<String, Object> MAP_VALUE_SPARSE =
+ new HashMap<String, Object>() {
+ {
+ put("value", "userOther@_REALM");
+ }
+ };
+
public static void validateFromJSON(KerberosPrincipalDescriptor principalDescriptor) {
Assert.assertNotNull(principalDescriptor);
Assert.assertFalse(principalDescriptor.isContainer());
@@ -77,10 +89,21 @@ public class KerberosPrincipalDescriptorTest {
return new KerberosPrincipalDescriptor(map);
}
+ private static KerberosPrincipalDescriptor createFromJSONSparse() {
+ Map<?, ?> map = new Gson().fromJson(JSON_VALUE_SPARSE,
+ new TypeToken<Map<?, ?>>() {
+ }.getType());
+ return new KerberosPrincipalDescriptor(map);
+ }
+
private static KerberosPrincipalDescriptor createFromMap() {
return new KerberosPrincipalDescriptor(MAP_VALUE);
}
+ private static KerberosPrincipalDescriptor createFromMapSparse() {
+ return new KerberosPrincipalDescriptor(MAP_VALUE_SPARSE);
+ }
+
@Test
public void testJSONDeserialize() {
validateFromJSON(createFromJSON());
@@ -116,4 +139,54 @@ public class KerberosPrincipalDescriptorTest {
validateUpdatedData(principalDescriptor);
}
+
+ @Test
+ public void testUpdateSparse() {
+ KerberosPrincipalDescriptor principalDescriptor;
+ KerberosPrincipalDescriptor updatedPrincipalDescriptor;
+
+ /* ****************************************
+ * Test updating a service principal
+ * **************************************** */
+ principalDescriptor = createFromJSON();
+ updatedPrincipalDescriptor = createFromJSONSparse();
+
+ Assert.assertNotNull(principalDescriptor);
+ Assert.assertNotNull(updatedPrincipalDescriptor);
+
+ // The original value
+ Assert.assertEquals("service/_HOST@_REALM", principalDescriptor.getValue());
+ Assert.assertEquals("service-site/service.component.kerberos.principal", principalDescriptor.getConfiguration());
+ Assert.assertEquals(KerberosPrincipalType.SERVICE, principalDescriptor.getType());
+ Assert.assertEquals("localUser", principalDescriptor.getLocalUsername());
+
+ principalDescriptor.update(updatedPrincipalDescriptor);
+
+ // The updated value
+ Assert.assertEquals("serviceOther/_HOST@_REALM", principalDescriptor.getValue());
+ Assert.assertEquals("service-site/service.component.kerberos.principal", principalDescriptor.getConfiguration());
+ Assert.assertEquals(KerberosPrincipalType.SERVICE, principalDescriptor.getType());
+ Assert.assertEquals("localUser", principalDescriptor.getLocalUsername());
+
+ /* ****************************************
+ * Test updating a user principal
+ * **************************************** */
+ principalDescriptor = createFromMap();
+ updatedPrincipalDescriptor = createFromMapSparse();
+
+ Assert.assertNotNull(principalDescriptor);
+ Assert.assertNotNull(updatedPrincipalDescriptor);
+
+ Assert.assertEquals("user@_REALM", principalDescriptor.getValue());
+ Assert.assertEquals("service-site/service.component.kerberos.https.principal", principalDescriptor.getConfiguration());
+ Assert.assertEquals(KerberosPrincipalType.USER, principalDescriptor.getType());
+ Assert.assertNull(principalDescriptor.getLocalUsername());
+
+ principalDescriptor.update(updatedPrincipalDescriptor);
+
+ Assert.assertEquals("userOther@_REALM", principalDescriptor.getValue());
+ Assert.assertEquals("service-site/service.component.kerberos.https.principal", principalDescriptor.getConfiguration());
+ Assert.assertEquals(KerberosPrincipalType.USER, principalDescriptor.getType());
+ Assert.assertNull(principalDescriptor.getLocalUsername());
+ }
}
\ No newline at end of file
[41/50] [abbrv] ambari git commit: AMBARI-14530. Ambari Admin: Admin
filter remains active after clearing all filters in Users table
(alexantonenko)
Posted by nc...@apache.org.
AMBARI-14530. Ambari Admin: Admin filter remains active after clearing all filters in Users table (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/371376de
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/371376de
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/371376de
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 371376de42d2d8e45eef6b01de9b3f1119e1c914
Parents: b8aede2
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Dec 31 16:48:58 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Dec 31 16:52:10 2015 +0200
----------------------------------------------------------------------
.../scripts/controllers/users/UsersListCtrl.js | 3 +-
.../controllers/users/UsersListCtrl_test.js | 160 +++++++++++++++++++
2 files changed, 162 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/371376de/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js
index bb8ea7c..3c5e7b2 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js
@@ -92,6 +92,7 @@ angular.module('ambariAdminConsole')
$scope.currentNameFilter = '';
$scope.currentTypeFilter = $scope.typeFilterOptions[0];
$scope.currentActiveFilter = $scope.activeFilterOptions[0];
+ $scope.adminFilter = false;
$scope.resetPagination();
};
@@ -100,7 +101,7 @@ angular.module('ambariAdminConsole')
$scope.$watch(
function (scope) {
return Boolean(scope.currentNameFilter || (scope.currentActiveFilter && scope.currentActiveFilter.value !== '*')
- || (scope.currentTypeFilter && scope.currentTypeFilter.value !== '*'));
+ || (scope.currentTypeFilter && scope.currentTypeFilter.value !== '*') || $scope.adminFilter);
},
function (newValue, oldValue, scope) {
scope.isNotEmptyFilter = newValue;
http://git-wip-us.apache.org/repos/asf/ambari/blob/371376de/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/users/UsersListCtrl_test.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/users/UsersListCtrl_test.js b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/users/UsersListCtrl_test.js
index 4b3b101..9d6cd54 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/users/UsersListCtrl_test.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/users/UsersListCtrl_test.js
@@ -46,6 +46,7 @@ describe('#Cluster', function () {
label: $t('common.local'),
value: 'LOCAL'
};
+ scope.adminFilter = true;
scope.clearFilters();
expect(scope.currentNameFilter).toEqual('');
expect(scope.currentActiveFilter).toEqual({
@@ -57,6 +58,7 @@ describe('#Cluster', function () {
value: '*'
});
expect(scope.currentPage).toEqual(1);
+ expect(scope.adminFilter).toBe(false);
});
});
@@ -69,6 +71,7 @@ describe('#Cluster', function () {
currentTypeFilter: null,
currentActiveFilter: null,
isNotEmptyFilter: false,
+ adminFilter: false,
title: 'no filters'
},
{
@@ -79,6 +82,7 @@ describe('#Cluster', function () {
currentActiveFilter: {
value: '*'
},
+ adminFilter: false,
isNotEmptyFilter: false,
title: 'empty filters'
},
@@ -90,6 +94,7 @@ describe('#Cluster', function () {
currentActiveFilter: {
value: '*'
},
+ adminFilter: false,
isNotEmptyFilter: true,
title: 'name filter'
},
@@ -101,6 +106,7 @@ describe('#Cluster', function () {
currentActiveFilter: {
value: '*'
},
+ adminFilter: false,
isNotEmptyFilter: true,
title: 'name filter with "0" as string'
},
@@ -112,6 +118,7 @@ describe('#Cluster', function () {
currentActiveFilter: {
value: '*'
},
+ adminFilter: false,
isNotEmptyFilter: true,
title: 'type filter'
},
@@ -123,10 +130,23 @@ describe('#Cluster', function () {
currentActiveFilter: {
value: false
},
+ adminFilter: false,
isNotEmptyFilter: true,
title: 'activity filter'
},
{
+ currentNameFilter: '',
+ currentTypeFilter: {
+ value: '*'
+ },
+ currentActiveFilter: {
+ value: '*'
+ },
+ adminFilter: true,
+ isNotEmptyFilter: true,
+ title: 'admin filter'
+ },
+ {
currentNameFilter: 'a',
currentTypeFilter: {
value: 'LOCAL'
@@ -134,6 +154,7 @@ describe('#Cluster', function () {
currentActiveFilter: {
value: '*'
},
+ adminFilter: false,
isNotEmptyFilter: true,
title: 'name and type filters'
},
@@ -145,10 +166,23 @@ describe('#Cluster', function () {
currentActiveFilter: {
value: false
},
+ adminFilter: false,
isNotEmptyFilter: true,
title: 'name and activity filters'
},
{
+ currentNameFilter: 'a',
+ currentTypeFilter: {
+ value: '*'
+ },
+ currentActiveFilter: {
+ value: '*'
+ },
+ adminFilter: true,
+ isNotEmptyFilter: true,
+ title: 'name and admin filters'
+ },
+ {
currentNameFilter: '0',
currentTypeFilter: {
value: 'LOCAL'
@@ -156,6 +190,7 @@ describe('#Cluster', function () {
currentActiveFilter: {
value: '*'
},
+ adminFilter: false,
isNotEmptyFilter: true,
title: 'name and type filters with "0" as string'
},
@@ -167,10 +202,23 @@ describe('#Cluster', function () {
currentActiveFilter: {
value: false
},
+ adminFilter: false,
isNotEmptyFilter: true,
title: 'name and activity filters with "0" as string'
},
{
+ currentNameFilter: '0',
+ currentTypeFilter: {
+ value: '*'
+ },
+ currentActiveFilter: {
+ value: '*'
+ },
+ adminFilter: true,
+ isNotEmptyFilter: true,
+ title: 'name and admin filters with "0" as string'
+ },
+ {
currentNameFilter: '',
currentTypeFilter: {
value: 'LOCAL'
@@ -178,10 +226,119 @@ describe('#Cluster', function () {
currentActiveFilter: {
value: false
},
+ adminFilter: false,
isNotEmptyFilter: true,
title: 'type and activity filters'
},
{
+ currentNameFilter: '',
+ currentTypeFilter: {
+ value: 'LOCAL'
+ },
+ currentActiveFilter: {
+ value: '*'
+ },
+ adminFilter: true,
+ isNotEmptyFilter: true,
+ title: 'type and admin filters'
+ },
+ {
+ currentNameFilter: '',
+ currentTypeFilter: {
+ value: '*'
+ },
+ currentActiveFilter: {
+ value: false
+ },
+ adminFilter: true,
+ isNotEmptyFilter: true,
+ title: 'activity and admin filters'
+ },
+ {
+ currentNameFilter: '',
+ currentTypeFilter: {
+ value: 'LOCAL'
+ },
+ currentActiveFilter: {
+ value: false
+ },
+ adminFilter: true,
+ isNotEmptyFilter: true,
+ title: 'all filters except name one'
+ },
+ {
+ currentNameFilter: 'a',
+ currentTypeFilter: {
+ value: '*'
+ },
+ currentActiveFilter: {
+ value: false
+ },
+ adminFilter: true,
+ isNotEmptyFilter: true,
+ title: 'all filters except type one'
+ },
+ {
+ currentNameFilter: 'a',
+ currentTypeFilter: {
+ value: 'LOCAL'
+ },
+ currentActiveFilter: {
+ value: '*'
+ },
+ adminFilter: true,
+ isNotEmptyFilter: true,
+ title: 'all filters except activity one'
+ },
+ {
+ currentNameFilter: 'a',
+ currentTypeFilter: {
+ value: 'LOCAL'
+ },
+ currentActiveFilter: {
+ value: false
+ },
+ adminFilter: false,
+ isNotEmptyFilter: true,
+ title: 'all filters except admin one'
+ },
+ {
+ currentNameFilter: '0',
+ currentTypeFilter: {
+ value: '*'
+ },
+ currentActiveFilter: {
+ value: false
+ },
+ adminFilter: true,
+ isNotEmptyFilter: true,
+ title: 'all filters with "0" as string except type one'
+ },
+ {
+ currentNameFilter: '0',
+ currentTypeFilter: {
+ value: 'LOCAL'
+ },
+ currentActiveFilter: {
+ value: '*'
+ },
+ adminFilter: true,
+ isNotEmptyFilter: true,
+ title: 'all filters with "0" as string except activity one'
+ },
+ {
+ currentNameFilter: '0',
+ currentTypeFilter: {
+ value: 'LOCAL'
+ },
+ currentActiveFilter: {
+ value: false
+ },
+ adminFilter: false,
+ isNotEmptyFilter: true,
+ title: 'all filters with "0" as string except admin one'
+ },
+ {
currentNameFilter: 'a',
currentTypeFilter: {
value: false
@@ -189,6 +346,7 @@ describe('#Cluster', function () {
currentActiveFilter: {
value: 'LOCAL'
},
+ adminFilter: true,
isNotEmptyFilter: true,
title: 'all filters'
},
@@ -200,6 +358,7 @@ describe('#Cluster', function () {
currentActiveFilter: {
value: 'LOCAL'
},
+ adminFilter: true,
isNotEmptyFilter: true,
title: 'all filters with "0" as string'
}
@@ -211,6 +370,7 @@ describe('#Cluster', function () {
scope.currentNameFilter = item.currentNameFilter;
scope.currentActiveFilter = item.currentActiveFilter;
scope.currentTypeFilter = item.currentTypeFilter;
+ scope.adminFilter = item.adminFilter;
scope.$digest();
expect(scope.isNotEmptyFilter).toEqual(item.isNotEmptyFilter);
});
[43/50] [abbrv] ambari git commit: AMBARI-14498. Create RU/EU upgrade
pack for HDP-2.4 (dlysnichenko)
Posted by nc...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/2feea0bd/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
new file mode 100644
index 0000000..57be7b2
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
@@ -0,0 +1,1001 @@
+<?xml version="1.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.
+-->
+
+
+<upgrade xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <target>2.4.*.*</target>
+ <target-stack>HDP-2.4</target-stack>
+ <type>NON_ROLLING</type>
+ <prerequisite-checks>
+ <configuration>
+ <!-- Configuration properties for all pre-reqs including required pre-reqs -->
+ <!--TODO: is it required? -->
+ <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
+ <property name="min-failure-stack-version">HDP-2.3.0.0</property>
+ </check-properties>
+ </configuration>
+ </prerequisite-checks>
+ <order>
+ <group xsi:type="cluster" name="PRE_CLUSTER" title="Prepare Upgrade">
+ <direction>UPGRADE</direction>
+
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage service="YARN" component="RESOURCEMANAGER" title="Stop YARN Queues">
+ <task xsi:type="manual">
+ <message>Before continuing, please stop all YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="SLIDER" component="SLIDER" title="Stop Long Running Applications on Slider">
+ <task xsi:type="manual">
+ <message>Before continuing, please stop all long-running applications deployed using Slider. E.g., su - yarn "/usr/hdp/current/slider-client/bin/slider stop <app_name>"</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="STORM" component="NIMBUS" title="Stop Storm Topologies">
+ <task xsi:type="manual">
+ <message>Before continuing, please deactivate and kill any currently running topologies.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="TEZ" component="TEZ_CLIENT" title="Check Tez Tarball">
+ <task xsi:type="execute" hosts="any">
+ <script>scripts/pre_upgrade.py</script>
+ <function>prepare</function>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="stop" name="STOP_HIGH_LEVEL_SERVICE_COMPONENTS" title="Stop Components for High-Level Services">
+ <direction>UPGRADE</direction>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service-check>false</service-check>
+
+ <service name="ATLAS">
+ <component>ATLAS_SERVER</component>
+ </service>
+
+ <service name="FLUME">
+ <component>FLUME_HANDLER</component>
+ </service>
+
+ <service name="ACCUMULO">
+ <component>ACCUMULO_TRACER</component>
+ <component>ACCUMULO_GC</component>
+ <component>ACCUMULO_TSERVER</component>
+ <component>ACCUMULO_MONITOR</component>
+ <component>ACCUMULO_MASTER</component>
+ </service>
+
+ <service name="STORM">
+ <component>DRPC_SERVER</component>
+ <component>STORM_UI_SERVER</component>
+ <component>SUPERVISOR</component>
+ <component>NIMBUS</component>
+ </service>
+
+ <service name="KNOX">
+ <component>KNOX_GATEWAY</component>
+ </service>
+
+ <service name="KAFKA">
+ <component>KAFKA_BROKER</component>
+ </service>
+
+ <service name="FALCON">
+ <component>FALCON_SERVER</component>
+ </service>
+
+ <service name="OOZIE">
+ <component>OOZIE_SERVER</component>
+ </service>
+
+ <service name="SPARK">
+ <component>SPARK_JOBHISTORYSERVER</component>
+ </service>
+
+ <service name="HIVE">
+ <component>WEBHCAT_SERVER</component>
+ <component>HIVE_SERVER</component>
+ <component>HIVE_METASTORE</component>
+ </service>
+
+ <service name="YARN">
+ <component>NODEMANAGER</component>
+ <component>RESOURCEMANAGER</component>
+ <component>APP_TIMELINE_SERVER</component>
+ </service>
+
+ <service name="MAPREDUCE2">
+ <component>HISTORYSERVER</component>
+ </service>
+ </group>
+
+ <group xsi:type="cluster" name="Backups" title="Perform Backups">
+ <direction>UPGRADE</direction>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Backup Oozie Database">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Oozie Server database on {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HIVE" component="HIVE_METASTORE" title="Backup Hive Metastore">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Hive Metastore database referenced by the Hive Metastore service(s) located on the following host(s): {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="KNOX" component="KNOX_GATEWAY" title="Backup Knox Data">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Knox data. E.g., "cp -RL /usr/hdp/current/knox-server/data/* ~/knox_backup/" on the following host(s): {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HBASE" component="HBASE_MASTER" title="Snapshot HBASE">
+ <task xsi:type="execute" hosts="master">
+ <script>scripts/hbase_upgrade.py</script>
+ <function>take_snapshot</function>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HDFS" component="NAMENODE" title="Prepare HDFS">
+ <task xsi:type="execute" hosts="master">
+ <script>scripts/namenode.py</script>
+ <function>prepare_express_upgrade</function>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="RANGER" component="RANGER_ADMIN" title="Backup Ranger Database">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Ranger Admin database and Ranger Audit database on the following host(s): {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="RANGER_KMS" component="RANGER_KMS_SERVER" title="Backup Ranger KMS Database">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup Ranger KMS database</message>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="stop" name="STOP_LOW_LEVEL_SERVICE_COMPONENTS" title="Stop Components for Core Services">
+ <direction>UPGRADE</direction>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <service-check>false</service-check>
+ <parallel-scheduler/>
+
+ <service name="HBASE">
+ <component>HBASE_REGIONSERVER</component>
+ <component>HBASE_MASTER</component>
+ <component>PHOENIX_QUERY_SERVER</component>
+ </service>
+
+ <service name="HDFS">
+ <component>DATANODE</component>
+ <component>NAMENODE</component>
+ <component>SECONDARY_NAMENODE</component>
+ <component>ZKFC</component>
+ <component>JOURNALNODE</component>
+ <component>NFS_GATEWAY</component>
+ </service>
+
+ <service name="RANGER">
+ <component>RANGER_USERSYNC</component>
+ <component>RANGER_ADMIN</component>
+ </service>
+
+ <service name="RANGER_KMS">
+ <component>RANGER_KMS_SERVER</component>
+ </service>
+
+ <service name="ZOOKEEPER">
+ <component>ZOOKEEPER_SERVER</component>
+ </service>
+ </group>
+
+ <group xsi:type="cluster" name="Restore Backups" title="Restore Backups">
+ <direction>DOWNGRADE</direction>
+ <skippable>true</skippable>
+
+ <!-- If the user attempts a downgrade after this point, they will need to restore backups
+ before starting any of the services. -->
+
+ <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Restore Oozie Database">
+ <task xsi:type="manual">
+ <message>Before continuing, please restore the Oozie Server database on {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HIVE" component="HIVE_METASTORE" title="Restore Hive Metastore">
+ <task xsi:type="manual">
+ <message>Before continuing, please restore the Hive Metastore database located on the following host(s): {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="KNOX" component="KNOX_GATEWAY" title="Restore Knox Data">
+ <task xsi:type="manual">
+ <message>Before continuing, please restore the Knox data. E.g., "cp -RL ~/knox_backup/* /usr/hdp/$(old_version)/knox/data/" on the following host(s): {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="RANGER" component="RANGER_ADMIN" title="Restore Ranger Database">
+ <task xsi:type="manual">
+ <message>Before continuing, please restore the Ranger Admin database and Ranger Audit database on the following host(s): {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="RANGER_KMS" component="RANGER_KMS_SERVER" title="Restore Ranger KMS Database">
+ <task xsi:type="manual">
+ <message>Before continuing, please restore Ranger KMS database</message>
+ </task>
+ </execute-stage>
+
+ </group>
+
+ <!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
+ <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" title="Update Target Stack">
+ <execute-stage title="Update Target Stack" service="" component="">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="cluster" name="Upgrade service configs" title="Upgrade service configs">
+ <direction>UPGRADE</direction> <!-- prevent config changes on downgrade -->
+ <skippable>true</skippable> <!-- May fix configuration problems manually -->
+
+ <execute-stage service="TEZ" component="TEZ_CLIENT" title="Apply config changes for Tez">
+ <task xsi:type="configure" id="hdp_2_4_0_0_tez_client_adjust_tez_lib_uris_property"/>
+ </execute-stage>
+ </group>
+
+ <!-- Now, restart all of the services. -->
+ <group xsi:type="restart" name="ZOOKEEPER" title="ZooKeeper">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="ZOOKEEPER">
+ <service-check>true</service-check>
+ <component>ZOOKEEPER_SERVER</component>
+ <component>ZOOKEEPER_CLIENT</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="RANGER" title="Ranger">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="RANGER">
+ <component>RANGER_ADMIN</component>
+ <component>RANGER_USERSYNC</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="RANGER_KMS" title="Ranger KMS">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="RANGER_KMS">
+ <component>RANGER_KMS_SERVER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="HDFS" title="HDFS">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="HDFS">
+ <component>JOURNALNODE</component>
+ <component>ZKFC</component>
+ <component>NAMENODE</component>
+ <component>SECONDARY_NAMENODE</component>
+ <component>NFS_GATEWAY</component>
+ <component>HDFS_CLIENT</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="HDFS_DATANODES" title="HDFS DataNodes">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="HDFS">
+ <component>DATANODE</component>
+ </service>
+ </group>
+
+ <group xsi:type="cluster" name="HDFS_LEAVE_SAFEMODE" title="HDFS - Wait to leave Safemode">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage service="HDFS" component="NAMENODE" title="Wait to leave Safemode">
+ <task xsi:type="execute" hosts="all" summary="Wait for NameNode to leave Safemode">
+ <script>scripts/namenode.py</script>
+ <function>wait_for_safemode_off</function>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="restart" name="YARN_AND_MAPR" title="YARN and MapReduce2">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+
+ <service name="MAPREDUCE2">
+ <component>HISTORYSERVER</component>
+ <component>MAPREDUCE2_CLIENT</component>
+ </service>
+
+ <service name="YARN">
+ <component>APP_TIMELINE_SERVER</component>
+ <component>RESOURCEMANAGER</component>
+ <component>YARN_CLIENT</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="YARN_NODEMANAGERS" title="YARN NodeManagers">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+
+ <service name="YARN">
+ <component>NODEMANAGER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="HBASE" title="HBASE">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="HBASE">
+ <component>HBASE_MASTER</component>
+ <component>HBASE_REGIONSERVER</component>
+ <component>HBASE_CLIENT</component>
+ <component>PHOENIX_QUERY_SERVER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="CLIENTS" title="Tez, Pig, Sqoop Clients">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="TEZ">
+ <component>TEZ_CLIENT</component>
+ </service>
+
+ <service name="MAHOUT">
+ <component>MAHOUT</component>
+ </service>
+
+ <service name="PIG">
+ <component>PIG</component>
+ </service>
+
+ <service name="SQOOP">
+ <component>SQOOP</component>
+ </service>
+ </group>
+
+ <group name="SERVICE_CHECK" title="All Service Checks" xsi:type="service-check">
+ <skippable>true</skippable>
+ <direction>UPGRADE</direction>
+ <priority>
+ <service>HDFS</service>
+ <service>YARN</service>
+ <service>MAPREDUCE2</service>
+ <service>HBASE</service>
+ </priority>
+ </group>
+
+ <group xsi:type="restart" name="HIVE" title="Hive">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="HIVE">
+ <component>HIVE_METASTORE</component>
+ <component>HIVE_SERVER</component>
+ <component>WEBHCAT_SERVER</component>
+ <component>HIVE_CLIENT</component>
+ <component>HCAT</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="SPARK" title="Spark">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="SPARK">
+ <component>SPARK_JOBHISTORYSERVER</component>
+ <component>SPARK_THRIFTSERVER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="SPARK_CLIENTS" title="Spark Clients">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="SPARK">
+ <component>SPARK_CLIENT</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="ATLAS" title="Atlas">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="ATLAS">
+ <component>ATLAS_SERVER</component>
+ </service>
+ </group>
+
+ <!-- Upgrade Oozie DB only on Upgrade direction, and always create a new ShareLib. -->
+ <group name="UPGRADE_OOZIE" title="Upgrade Oozie Database">
+ <direction>UPGRADE</direction>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Upgrade Oozie Database">
+ <task xsi:type="execute" hosts="any" summary="Upgrading the database and creating a new sharelib">
+ <script>scripts/oozie_server_upgrade.py</script>
+ <function>upgrade_oozie_database_and_sharelib</function>
+ </task>
+ </execute-stage>
+ </group>
+
+ <!-- Only create the ShareLib folder during a Downgrade. -->
+ <group name="DOWNGRADE_OOZIE" title="Downgrade Oozie ShareLib">
+ <direction>DOWNGRADE</direction>
+ <skippable>true</skippable>
+ <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Downgrade Oozie ShareLib">
+ <task xsi:type="execute" hosts="any" summary="Upgrading the database and creating a new sharelib">
+ <script>scripts/oozie_server_upgrade.py</script>
+ <function>create_sharelib</function>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="restart" name="OOZIE" title="Oozie">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="OOZIE">
+ <component>OOZIE_SERVER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="OOZIE_CLIENTS" title="Oozie Clients">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="OOZIE">
+ <component>OOZIE_CLIENT</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="FALCON" title="Falcon">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="FALCON">
+ <component>FALCON_SERVER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="FALCON_CLIENTS" title="Falcon Clients">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="FALCON">
+ <component>FALCON_CLIENT</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="KAFKA" title="Kafka">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="KAFKA">
+ <component>KAFKA_BROKER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="KNOX" title="Knox">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="KNOX">
+ <component>KNOX_GATEWAY</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="STORM" title="Storm">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="STORM">
+ <component>NIMBUS</component>
+ <component>SUPERVISOR</component>
+ <component>STORM_UI_SERVER</component>
+ <component>DRPC_SERVER</component>
+ </service>
+
+ <execute-stage service="STORM" component="DRPC_SERVER" title="Rebuild Storm Topology">
+ <task xsi:type="manual">
+ <message>Please rebuild your topology using the new Storm version dependencies and resubmit it using the newly created jar.</message>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="restart" name="SLIDER" title="Slider">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="SLIDER">
+ <component>SLIDER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="FLUME" title="Flume">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="FLUME">
+ <component>FLUME_HANDLER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="ACCUMULO" title="Accumulo">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="ACCUMULO">
+ <component>ACCUMULO_MASTER</component>
+ <component>ACCUMULO_TSERVER</component>
+ <component>ACCUMULO_MONITOR</component>
+ <component>ACCUMULO_GC</component>
+ <component>ACCUMULO_TRACER</component>
+ <component>ACCUMULO_CLIENT</component>
+ </service>
+ </group>
+
+ <!--
+ Invoke "hdp-select set all" to change any components we may have missed
+ that are installed on the hosts but not known by Ambari.
+ -->
+ <group xsi:type="cluster" name="ALL_HOST_OPS" title="Set Version On All Hosts">
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage title="Update stack to {{version}}">
+ <task xsi:type="execute">
+ <script>scripts/ru_set_all.py</script>
+ <function>actionexecute</function>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="cluster" name="FINALIZE_PRE_CHECK" title="Finalize {{direction.text.proper}} Pre-Check">
+ <direction>UPGRADE</direction>
+
+ <execute-stage title="Check Component Versions">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.ComponentVersionCheckAction" />
+ </execute-stage>
+ </group>
+
+ <group xsi:type="cluster" name="POST_CLUSTER" title="Finalize {{direction.text.proper}}">
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage title="Confirm Finalize">
+ <direction>UPGRADE</direction>
+ <task xsi:type="manual">
+ <message>Please confirm you are ready to finalize.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
+ <task xsi:type="execute" hosts="master">
+ <script>scripts/namenode.py</script>
+ <function>finalize_non_rolling_upgrade</function>
+ </task>
+ </execute-stage>
+
+ <execute-stage title="Save Cluster State" service="" component="">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.FinalizeUpgradeAction">
+ </task>
+ </execute-stage>
+ </group>
+ </order>
+
+ <processing>
+ <service name="ZOOKEEPER">
+ <component name="ZOOKEEPER_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="ZOOKEEPER_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="RANGER">
+ <component name="RANGER_ADMIN">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="RANGER_USERSYNC">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="RANGER_KMS">
+ <component name="RANGER_KMS_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="HDFS">
+ <component name="NAMENODE">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="DATANODE">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HDFS_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="JOURNALNODE">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="ZKFC">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="NFS_GATEWAY">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="MAPREDUCE2">
+ <component name="HISTORYSERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="MAPREDUCE2_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="YARN">
+ <component name="APP_TIMELINE_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="RESOURCEMANAGER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="NODEMANAGER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="YARN_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="HBASE">
+ <component name="HBASE_MASTER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HBASE_REGIONSERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HBASE_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="TEZ">
+ <component name="TEZ_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="MAHOUT">
+ <component name="MAHOUT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="PIG">
+ <component name="PIG">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="SQOOP">
+ <component name="SQOOP">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="HIVE">
+ <component name="HIVE_METASTORE">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HIVE_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="WEBHCAT_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HIVE_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HCAT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="SPARK">
+ <component name="SPARK_JOBHISTORYSERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ <component name="SPARK_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="OOZIE">
+ <component name="OOZIE_SERVER">
+ <pre-upgrade>
+ <task xsi:type="execute" hosts="any" summary="Upgrading the database and creating a new sharelib">
+ <script>scripts/oozie_server_upgrade.py</script>
+ <function>upgrade_oozie_database_and_sharelib</function>
+ </task>
+ </pre-upgrade>
+
+ <pre-downgrade>
+ <task xsi:type="execute" hosts="any" summary="Create a new sharelib">
+ <script>scripts/oozie_server_upgrade.py</script>
+ <function>create_sharelib</function>
+ </task>
+ </pre-downgrade>
+
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="OOZIE_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="FALCON">
+ <component name="FALCON_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ <component name="FALCON_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="KAFKA">
+ <component name="KAFKA_BROKER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="KNOX">
+ <component name="KNOX_GATEWAY">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="STORM">
+ <component name="NIMBUS">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="SUPERVISOR">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="STORM_UI_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="DRPC_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="ACCUMULO">
+ <component name="ACCUMULO_MASTER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="ACCUMULO_TSERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="ACCUMULO_MONITOR">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="ACCUMULO_GC">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="ACCUMULO_TRACER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="ACCUMULO_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="SLIDER">
+ <component name="SLIDER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="FLUME">
+ <component name="FLUME_HANDLER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="ATLAS">
+ <component name="ATLAS_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ </service>
+ </processing>
+</upgrade>
http://git-wip-us.apache.org/repos/asf/ambari/blob/2feea0bd/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.4.xml
new file mode 100644
index 0000000..c534257
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.4.xml
@@ -0,0 +1,808 @@
+<?xml version="1.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.
+-->
+
+
+<upgrade xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <target>2.4.*.*</target>
+ <target-stack>HDP-2.4</target-stack>
+ <type>ROLLING</type>
+ <skip-failures>false</skip-failures>
+ <skip-service-check-failures>false</skip-service-check-failures>
+ <prerequisite-checks>
+ <!-- List of additional pre-req checks to run in addition to the required pre-reqs -->
+ <check>org.apache.ambari.server.checks.HiveMultipleMetastoreCheck</check>
+ <check>org.apache.ambari.server.checks.MapReduce2JobHistoryStatePreservingCheck</check>
+ <check>org.apache.ambari.server.checks.SecondaryNamenodeDeletedCheck</check>
+ <check>org.apache.ambari.server.checks.ServicesMapReduceDistributedCacheCheck</check>
+ <check>org.apache.ambari.server.checks.ServicesNamenodeHighAvailabilityCheck</check>
+ <check>org.apache.ambari.server.checks.ServicesTezDistributedCacheCheck</check>
+ <check>org.apache.ambari.server.checks.ServicesYarnWorkPreservingCheck</check>
+ <check>org.apache.ambari.server.checks.YarnRMHighAvailabilityCheck</check>
+ <check>org.apache.ambari.server.checks.YarnTimelineServerStatePreservingCheck</check>
+
+ <configuration>
+ <!-- Configuration properties for all pre-reqs including required pre-reqs -->
+ <!--TODO: is it required? -->
+ <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
+ <property name="min-failure-stack-version">HDP-2.3.0.0</property>
+ </check-properties>
+ </configuration>
+ </prerequisite-checks>
+
+ <order>
+ <group xsi:type="cluster" name="PRE_CLUSTER" title="Prepare Upgrade">
+ <direction>UPGRADE</direction>
+ <execute-stage service="HDFS" component="NAMENODE" title="Pre Upgrade HDFS">
+ <task xsi:type="execute" hosts="master">
+ <script>scripts/namenode.py</script>
+ <function>prepare_rolling_upgrade</function>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="RANGER" component="RANGER_ADMIN" title="Pre Upgrade Ranger Admin">
+ <task xsi:type="execute" hosts="master">
+ <script>scripts/ranger_admin.py</script>
+ <function>pre_rolling_restart</function>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="TEZ" component="TEZ_CLIENT" title="Check Tez Tarball">
+ <task xsi:type="execute" hosts="any">
+ <script>scripts/pre_upgrade.py</script>
+ <function>prepare</function>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="cluster" name="PREPARE_BACKUPS" title="Prepare Backups">
+ <direction>UPGRADE</direction>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage service="KNOX" component="KNOX_GATEWAY" title="Backup Knox Data">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Knox data. E.g., "cp -RL /usr/hdp/current/knox-server/data/* ~/knox_backup/" on the following host(s): {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HBASE" component="HBASE_MASTER" title="Pre Upgrade HBase Backup">
+ <task xsi:type="execute" hosts="master">
+ <script>scripts/hbase_upgrade.py</script>
+ <function>take_snapshot</function>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HIVE" component="HIVE_METASTORE" title="Pre Upgrade Hive Backup">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Hive Metastore database referenced by the Hive Metastore service(s) located on the following host(s): {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Pre Upgrade Oozie Backup">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Oozie Server database on {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="RANGER" component="RANGER_ADMIN" title="Pre Upgrade Ranger Admin Backup">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Ranger Admin database and Ranger Audit database.
+ If audit database size is too large( > 3GB ) then follow the below instructions:
+ 1. Backup the audit table from audit database.
+ 2. Truncate audit table.
+ 3. Follow upgrade process and once completed then restore audit data to audit table.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="RANGER_KMS" component="RANGER_KMS_SERVER" title="Pre Upgrade Ranger KMS Backup">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup Ranger KMS database</message>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group name="ZOOKEEPER" title="ZooKeeper">
+ <service name="ZOOKEEPER">
+ <component>ZOOKEEPER_SERVER</component>
+ </service>
+ </group>
+
+ <group name="RANGER" title="Ranger">
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <service name="RANGER">
+ <component>RANGER_ADMIN</component>
+ <component>RANGER_USERSYNC</component>
+ </service>
+ </group>
+
+ <group name="RANGER_KMS" title="Ranger_KMS">
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <service name="RANGER_KMS">
+ <component>RANGER_KMS_SERVER</component>
+ </service>
+ </group>
+
+ <group name="CORE_MASTER" title="Core Masters">
+ <service-check>false</service-check>
+ <service name="HDFS">
+ <component>JOURNALNODE</component>
+ <component>NAMENODE</component>
+ <component>ZKFC</component>
+ </service>
+
+ <service name="MAPREDUCE2">
+ <component>HISTORYSERVER</component>
+ </service>
+
+ <service name="YARN">
+ <component>APP_TIMELINE_SERVER</component>
+ <component>RESOURCEMANAGER</component>
+ </service>
+
+ <service name="HBASE">
+ <component>HBASE_MASTER</component>
+ </service>
+ </group>
+
+ <group name="SERVICE_CHECK" title="All Service Checks" xsi:type="service-check">
+ <skippable>true</skippable>
+ <direction>UPGRADE</direction>
+ <priority>
+ <service>ZOOKEEPER</service>
+ <service>HDFS</service>
+ <service>YARN</service>
+ <service>MAPREDUCE2</service>
+ <service>HBASE</service>
+ </priority>
+ <exclude>
+ <service>AMBARI_METRICS</service>
+ </exclude>
+ </group>
+
+ <group name="CORE_SLAVES" title="Core Slaves" xsi:type="colocated">
+ <skippable>true</skippable>
+ <service-check>false</service-check>
+ <service name="HDFS">
+ <component>DATANODE</component>
+ <component>NFS_GATEWAY</component>
+ </service>
+
+ <service name="HBASE">
+ <component>HBASE_REGIONSERVER</component>
+ <component>PHOENIX_QUERY_SERVER</component>
+ </service>
+
+ <service name="YARN">
+ <component>NODEMANAGER</component>
+ </service>
+
+ <batch>
+ <percent>20</percent>
+ <summary>Verification Required</summary>
+ <message>The initial batch of {{components}} hosts have been {{direction.past}}. You are advised to check the hosts and perform cluster/workload-specific tests against your cluster to ensure proper operation before proceeding with {{direction.text}} of the remaining services.</message>
+ </batch>
+ </group>
+
+ <group name="SERVICE_CHECK" title="All Service Checks" xsi:type="service-check">
+ <skippable>true</skippable>
+ <direction>UPGRADE</direction>
+ <priority>
+ <service>ZOOKEEPER</service>
+ <service>HDFS</service>
+ <service>YARN</service>
+ <service>HBASE</service>
+ </priority>
+ <exclude>
+ <service>AMBARI_METRICS</service>
+ </exclude>
+ </group>
+
+ <group name="HIVE" title="Hive">
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <service name="HIVE">
+ <component>HIVE_METASTORE</component>
+ <component>HIVE_SERVER</component>
+ <component>WEBHCAT_SERVER</component>
+ </service>
+ </group>
+
+ <group name="SPARK" title="Spark">
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <service-check>false</service-check>
+ <service name="SPARK">
+ <component>SPARK_JOBHISTORYSERVER</component>
+ <component>SPARK_THRIFTSERVER</component>
+ </service>
+ </group>
+
+ <group name="SPARK_CLIENTS" title="Spark Clients">
+ <skippable>true</skippable>
+ <service name="SPARK">
+ <component>SPARK_CLIENT</component>
+ </service>
+ </group>
+
+ <group name="OOZIE" title="Oozie">
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <service-check>false</service-check>
+ <service name="OOZIE">
+ <component>OOZIE_SERVER</component>
+ </service>
+ </group>
+
+ <group name="OOZIE_CLIENTS" title="Oozie Clients">
+ <skippable>true</skippable>
+ <service name="OOZIE">
+ <component>OOZIE_CLIENT</component>
+ </service>
+ </group>
+
+ <group name="FALCON" title="Falcon">
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <service-check>false</service-check>
+ <service name="FALCON">
+ <component>FALCON_SERVER</component>
+ </service>
+ </group>
+
+ <group name="FALCON_CLIENTS" title="Falcon Clients">
+ <skippable>true</skippable>
+ <service name="FALCON">
+ <component>FALCON_CLIENT</component>
+ </service>
+ </group>
+
+ <group name="CLIENTS" title="Client Components">
+ <service-check>false</service-check>
+ <service name="ZOOKEEPER">
+ <component>ZOOKEEPER_CLIENT</component>
+ </service>
+ <service name="HDFS">
+ <component>HDFS_CLIENT</component>
+ </service>
+
+ <service name="YARN">
+ <component>YARN_CLIENT</component>
+ </service>
+
+ <service name="MAPREDUCE2">
+ <component>MAPREDUCE2_CLIENT</component>
+ </service>
+
+ <service name="TEZ">
+ <component>TEZ_CLIENT</component>
+ </service>
+
+ <service name="HBASE">
+ <component>HBASE_CLIENT</component>
+ </service>
+
+ <service name="PIG">
+ <component>PIG</component>
+ </service>
+
+ <service name="SQOOP">
+ <component>SQOOP</component>
+ </service>
+
+ <service name="MAHOUT">
+ <component>MAHOUT</component>
+ </service>
+
+ <service name="HIVE">
+ <component>HIVE_CLIENT</component>
+ <component>HCAT</component>
+ </service>
+ </group>
+
+ <group name="SERVICE_CHECK" title="All Service Checks" xsi:type="service-check">
+ <skippable>true</skippable>
+ <direction>UPGRADE</direction>
+ <priority>
+ <service>ZOOKEEPER</service>
+ <service>HDFS</service>
+ <service>YARN</service>
+ <service>HBASE</service>
+ </priority>
+ <exclude>
+ <service>AMBARI_METRICS</service>
+ </exclude>
+ </group>
+
+ <group name="KAFKA" title="Kafka">
+ <skippable>true</skippable>
+ <service name="KAFKA">
+ <component>KAFKA_BROKER</component>
+ </service>
+ </group>
+
+ <group name="KNOX" title="Knox">
+ <skippable>true</skippable>
+ <service name="KNOX">
+ <component>KNOX_GATEWAY</component>
+ </service>
+ </group>
+
+ <group name="STORM" title="Storm">
+ <skippable>true</skippable>
+ <service name="STORM">
+ <component>NIMBUS</component>
+ <component>SUPERVISOR</component>
+ <component>STORM_UI_SERVER</component>
+ <component>DRPC_SERVER</component>
+ </service>
+ </group>
+
+ <group name="SLIDER" title="Slider">
+ <skippable>true</skippable>
+ <service name="SLIDER">
+ <component>SLIDER</component>
+ </service>
+ </group>
+
+ <group name="FLUME" title="Flume">
+ <skippable>true</skippable>
+ <service name="FLUME">
+ <component>FLUME_HANDLER</component>
+ </service>
+ </group>
+
+ <group name="ACCUMULO" title="Accumulo">
+ <skippable>true</skippable>
+ <service name="ACCUMULO">
+ <component>ACCUMULO_MASTER</component>
+ <component>ACCUMULO_TSERVER</component>
+ <component>ACCUMULO_MONITOR</component>
+ <component>ACCUMULO_GC</component>
+ <component>ACCUMULO_TRACER</component>
+ <component>ACCUMULO_CLIENT</component>
+ </service>
+ </group>
+
+ <group xsi:type="cluster" name="ALL_HOST_OPS" title="Finalize Hosts">
+ <execute-stage title="Update remaining HDP stack to {{version}}">
+ <task xsi:type="execute">
+ <script>scripts/ru_set_all.py</script>
+ <function>actionexecute</function>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="cluster" name="FINALIZE_PRE_CHECK" title="Finalize {{direction.text.proper}} Pre-Check">
+ <direction>UPGRADE</direction>
+
+ <execute-stage title="Check Component Versions">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.ComponentVersionCheckAction" />
+ </execute-stage>
+ </group>
+
+ <group xsi:type="cluster" name="POST_CLUSTER" title="Finalize {{direction.text.proper}}">
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage title="Confirm Finalize">
+ <direction>UPGRADE</direction>
+ <task xsi:type="manual">
+ <message>Please confirm you are ready to finalize.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
+ <task xsi:type="execute" hosts="master">
+ <script>scripts/namenode.py</script>
+ <function>finalize_rolling_upgrade</function>
+ </task>
+ </execute-stage>
+
+ <execute-stage title="Save Cluster State" service="" component="">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.FinalizeUpgradeAction">
+ </task>
+ </execute-stage>
+ </group>
+ </order>
+
+ <processing>
+ <service name="ZOOKEEPER">
+ <component name="ZOOKEEPER_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="ZOOKEEPER_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="RANGER">
+ <component name="RANGER_ADMIN">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="RANGER_USERSYNC">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="RANGER_KMS">
+ <component name="RANGER_KMS_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="HDFS">
+ <component name="NAMENODE">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="DATANODE">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="NFS_GATEWAY">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="HDFS_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="JOURNALNODE">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="ZKFC">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="SLIDER">
+ <component name="SLIDER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="MAPREDUCE2">
+ <component name="HISTORYSERVER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="MAPREDUCE2_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="YARN">
+ <component name="APP_TIMELINE_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="RESOURCEMANAGER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="NODEMANAGER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="YARN_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="HBASE">
+ <component name="HBASE_MASTER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="HBASE_REGIONSERVER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="HBASE_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="PHOENIX_QUERY_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="TEZ">
+ <component name="TEZ_CLIENT">
+ <pre-upgrade>
+ <task xsi:type="configure" id="hdp_2_4_0_0_tez_client_adjust_tez_lib_uris_property"/>
+ </pre-upgrade>
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="PIG">
+ <component name="PIG">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="SQOOP">
+ <component name="SQOOP">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="MAHOUT">
+ <component name="MAHOUT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="HIVE">
+ <component name="HIVE_METASTORE">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="HIVE_SERVER">
+ <pre-upgrade>
+ <task xsi:type="manual">
+ <summary>HiveServer Port Availability</summary>
+ <message>Please note that the HiveServer port will now change to 10010 if hive is using a binary transfer mode or 10011 if hive is using an http transport mode. You can use "netstat -anp | grep 1001[01]" to determine if the port is available on each of following HiveServer host(s): {{hosts.all}}. If the port is not available, the process using it must be terminated.</message>
+ </task>
+
+ <task xsi:type="configure" id="hdp_2_4_0_0_hive_server_set_transport_mode"/>
+ </pre-upgrade>
+
+ <pre-downgrade>
+ <task xsi:type="manual">
+ <summary>HiveServer Port Availability</summary>
+ <message>Please note that the HiveServer port will now change to 10000 if hive is using a binary transfer mode or 10001 if hive is using an http transport mode. You can use "netstat -anp | grep 1000[01]" to determine if the port is available on each of following HiveServer host(s): {{hosts.all}}. If the port is not available, the process using it must be terminated.</message>
+ </task>
+
+ <task xsi:type="configure" id="hdp_2_4_0_0_hive_server_restore_transport_mode_on_downgrade" />
+ </pre-downgrade>
+
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="WEBHCAT_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="HIVE_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="HCAT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="SPARK">
+ <component name="SPARK_JOBHISTORYSERVER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ <component name="SPARK_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="OOZIE">
+ <component name="OOZIE_SERVER">
+ <pre-upgrade>
+ <task xsi:type="execute" hosts="all" summary="Shut down all Oozie servers">
+ <script>scripts/oozie_server.py</script>
+ <function>stop</function>
+ </task>
+
+ <task xsi:type="execute" hosts="any" summary="Upgrading the database and creating a new sharelib">
+ <script>scripts/oozie_server_upgrade.py</script>
+ <function>upgrade_oozie_database_and_sharelib</function>
+ </task>
+ </pre-upgrade>
+
+ <pre-downgrade>
+ <task xsi:type="execute" hosts="all" summary="Shut down all Oozie servers">
+ <script>scripts/oozie_server.py</script>
+ <function>stop</function>
+ </task>
+
+ <task xsi:type="execute" hosts="any" summary="Create a new sharelib">
+ <script>scripts/oozie_server_upgrade.py</script>
+ <function>create_sharelib</function>
+ </task>
+ </pre-downgrade>
+
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="OOZIE_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="FALCON">
+ <component name="FALCON_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ <component name="FALCON_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="KAFKA">
+ <component name="KAFKA_BROKER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="KNOX">
+ <component name="KNOX_GATEWAY">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="STORM">
+ <component name="NIMBUS">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ <component name="STORM_REST_API">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ <component name="SUPERVISOR">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ <component name="STORM_UI_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ <component name="DRPC_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="FLUME">
+ <component name="FLUME_HANDLER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="ACCUMULO">
+ <component name="ACCUMULO_MASTER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ <component name="ACCUMULO_MONITOR">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ <component name="ACCUMULO_GC">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ <component name="ACCUMULO_TRACER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ <component name="ACCUMULO_TSERVER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ <component name="ACCUMULO_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+ </processing>
+</upgrade>
[21/50] [abbrv] ambari git commit: AMBARI-14515. Improve Ambari UI UT
(p.3) (onechiporenko)
Posted by nc...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
----------------------------------------------------------------------
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 3b37770..19d9201 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
@@ -130,13 +130,21 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
App.router.get.restore();
});
- it('tests database connection', function() {
- sinon.stub(controller, 'prepareDBCheckAction', Em.K);
+ describe('tests database connection', function() {
- controller.testDBConnection();
- expect(controller.prepareDBCheckAction.calledOnce).to.be.true;
+ beforeEach(function () {
+ sinon.stub(controller, 'prepareDBCheckAction', Em.K);
+ });
+
+ afterEach(function () {
+ controller.prepareDBCheckAction.restore();
+ });
+
+ it('prepareDBCheckAction is called once', function() {
+ controller.testDBConnection();
+ expect(controller.prepareDBCheckAction.calledOnce).to.be.true;
+ });
- controller.prepareDBCheckAction.restore();
});
it('tests prepareDBCheckAction', function() {
@@ -770,36 +778,42 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
describe('#setSecureConfigs()', function () {
+ beforeEach(function () {
+ this.stub = sinon.stub(App, 'get');
+ });
+
afterEach(function () {
Em.tryInvoke(App.get, 'restore');
});
it('undefined component and security disabled', function () {
var secureConfigs = [];
- sinon.stub(App, 'get').withArgs('isKerberosEnabled').returns(false);
+ this.stub.withArgs('isKerberosEnabled').returns(false);
controller.set('secureConfigsMap', []);
expect(controller.setSecureConfigs(secureConfigs, {}, 'COMP1')).to.be.false;
expect(secureConfigs).to.eql([]);
});
+
it('component exist and security disabled', function () {
var secureConfigs = [];
- sinon.stub(App, 'get').withArgs('isKerberosEnabled').returns(false);
+ this.stub.withArgs('isKerberosEnabled').returns(false);
controller.set('secureConfigsMap', [{
componentName: 'COMP1'
}]);
expect(controller.setSecureConfigs(secureConfigs, {}, 'COMP1')).to.be.false;
expect(secureConfigs).to.eql([]);
});
+
it('undefined component and security enabled', function () {
var secureConfigs = [];
- sinon.stub(App, 'get').withArgs('isKerberosEnabled').returns(true);
+ this.stub.withArgs('isKerberosEnabled').returns(true);
controller.set('secureConfigsMap', []);
expect(controller.setSecureConfigs(secureConfigs, {}, 'COMP1')).to.be.false;
expect(secureConfigs).to.eql([]);
});
it('component exist and security enabled', function () {
var secureConfigs = [];
- sinon.stub(App, 'get').withArgs('isKerberosEnabled').returns(true);
+ this.stub.withArgs('isKerberosEnabled').returns(true);
var configs = {'s1': {
'k1': 'kValue',
'p1': 'pValue'
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/service/reassign_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign_controller_test.js b/ambari-web/test/controllers/main/service/reassign_controller_test.js
index 48a6dec..ed9a861 100644
--- a/ambari-web/test/controllers/main/service/reassign_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign_controller_test.js
@@ -101,6 +101,7 @@ describe('App.ReassignMasterController', function () {
beforeEach(function () {
sinon.stub(App.db, 'setMasterComponentHosts', Em.K);
sinon.stub(reassignMasterController, 'setDBProperty', Em.K);
+ reassignMasterController.saveMasterComponentHosts(stepController);
});
afterEach(function () {
@@ -108,12 +109,23 @@ describe('App.ReassignMasterController', function () {
reassignMasterController.setDBProperty.restore();
});
- it('should save master component hosts', function () {
- reassignMasterController.saveMasterComponentHosts(stepController);
+ it('setMasterComponentHosts is called once', function () {
expect(App.db.setMasterComponentHosts.calledOnce).to.be.true;
+ });
+
+ it('setDBProperty is called once', function () {
expect(reassignMasterController.setDBProperty.calledOnce).to.be.true;
+ });
+
+ it('setMasterComponentHosts is called with valid arguments', function () {
expect(App.db.setMasterComponentHosts.calledWith(masterComponentHosts)).to.be.true;
+ });
+
+ it('setDBProperty is called with valid arguments', function () {
expect(reassignMasterController.setDBProperty.calledWith('masterComponentHosts', masterComponentHosts)).to.be.true;
+ });
+
+ it('masterComponentHosts are equal to ' + JSON.stringify(masterComponentHosts), function () {
expect(reassignMasterController.get('content.masterComponentHosts')).to.eql(masterComponentHosts);
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/service/widgets/create/step2_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/widgets/create/step2_controller_test.js b/ambari-web/test/controllers/main/service/widgets/create/step2_controller_test.js
index 3178ef5..e860660 100644
--- a/ambari-web/test/controllers/main/service/widgets/create/step2_controller_test.js
+++ b/ambari-web/test/controllers/main/service/widgets/create/step2_controller_test.js
@@ -282,115 +282,245 @@ describe('App.WidgetWizardStep2Controller', function () {
});
describe("#initWidgetData()", function () {
- it("new data", function () {
- controller.set('expressions', []);
- controller.set('dataSets', []);
- controller.get('content').setProperties({
- widgetProperties: {a: 1},
- widgetValues: [1],
- widgetMetrics: [2]
+
+ describe("new data", function () {
+
+ beforeEach(function () {
+ controller.set('expressions', []);
+ controller.set('dataSets', []);
+ controller.get('content').setProperties({
+ widgetProperties: {a: 1},
+ widgetValues: [1],
+ widgetMetrics: [2]
+ });
+
+ controller.initWidgetData();
+ });
+
+ it('widgetProperties is {a: 1}', function () {
+ expect(controller.get('widgetProperties')).to.eql({a: 1});
+ });
+
+ it('widgetValues is []', function () {
+ expect(controller.get('widgetValues')).to.eql([]);
+ });
+
+ it('widgetMetrics is []', function () {
+ expect(controller.get('widgetMetrics')).to.eql([]);
+ });
+
+ it('expressions is not empty', function () {
+ expect(controller.get('expressions')).to.not.be.empty;
});
- controller.initWidgetData();
+ it('dataSets is not empty', function () {
+ expect(controller.get('dataSets')).to.not.be.empty;
+ });
- expect(controller.get('widgetProperties')).to.eql({a: 1});
- expect(controller.get('widgetValues')).to.eql([]);
- expect(controller.get('widgetMetrics')).to.eql([]);
- expect(controller.get('expressions')).to.not.be.empty;
- expect(controller.get('dataSets')).to.not.be.empty;
});
- it("previously edited", function () {
- controller.set('expressions', [{}]);
- controller.set('dataSets', [{}]);
- controller.get('content').setProperties({
- widgetProperties: {a: 1},
- widgetValues: [1],
- widgetMetrics: [2]
+
+ describe("previously edited", function () {
+
+ beforeEach(function () {
+ controller.set('expressions', [{}]);
+ controller.set('dataSets', [{}]);
+ controller.get('content').setProperties({
+ widgetProperties: {a: 1},
+ widgetValues: [1],
+ widgetMetrics: [2]
+ });
+
+ controller.initWidgetData();
});
- controller.initWidgetData();
+ it('widgetProperties is {a: 1}', function () {
+ expect(controller.get('widgetProperties')).to.eql({a: 1});
+ });
+ it('widgetValues is [1]', function () {
+ expect(controller.get('widgetValues')).to.eql([1]);
+ });
+ it('widgetMetrics is [2]', function () {
+ expect(controller.get('widgetMetrics')).to.eql([2]);
+ });
+ it('expressions is not empty', function () {
+ expect(controller.get('expressions')).to.not.be.empty;
+ });
+ it('dataSets is not empty', function () {
+ expect(controller.get('dataSets')).to.not.be.empty;
+ });
- expect(controller.get('widgetProperties')).to.eql({a: 1});
- expect(controller.get('widgetValues')).to.eql([1]);
- expect(controller.get('widgetMetrics')).to.eql([2]);
- expect(controller.get('expressions')).to.not.be.empty;
- expect(controller.get('dataSets')).to.not.be.empty;
});
});
describe("#updateExpressions()", function () {
+
beforeEach(function () {
sinon.stub(controller, 'parseExpression').returns({values: [1], metrics: [1]});
sinon.stub(controller, 'parseTemplateExpression').returns({values: [1], metrics: [1]});
sinon.stub(controller, 'parseGraphDataset').returns({values: [1], metrics: [1]});
});
+
afterEach(function () {
controller.parseExpression.restore();
controller.parseTemplateExpression.restore();
controller.parseGraphDataset.restore();
});
- it("empty expressions", function () {
- controller.set('expressions', []);
- controller.updateExpressions();
- expect(controller.parseExpression.called).to.be.false;
- expect(controller.parseTemplateExpression.called).to.be.false;
- expect(controller.parseGraphDataset.called).to.be.false;
- expect(controller.get('widgetValues')).to.be.empty;
- expect(controller.get('widgetMetrics')).to.be.empty;
+
+ describe("empty expressions", function () {
+
+ beforeEach(function () {
+ controller.set('expressions', []);
+ controller.updateExpressions();
+ });
+
+ it('parseExpression is not called', function () {
+ expect(controller.parseExpression.called).to.be.false;
+ });
+ it('parseTemplateExpression is not called', function () {
+ expect(controller.parseTemplateExpression.called).to.be.false;
+ });
+ it('parseGraphDataset is not called', function () {
+ expect(controller.parseGraphDataset.called).to.be.false;
+ });
+ it('widgetValues is empty', function () {
+ expect(controller.get('widgetValues')).to.be.empty;
+ });
+ it('widgetMetrics is empty', function () {
+ expect(controller.get('widgetMetrics')).to.be.empty;
+ });
});
- it("empty dataSets", function () {
- controller.set('dataSets', []);
- controller.updateExpressions();
- expect(controller.parseExpression.called).to.be.false;
- expect(controller.parseTemplateExpression.called).to.be.false;
- expect(controller.parseGraphDataset.called).to.be.false;
- expect(controller.get('widgetValues')).to.be.empty;
- expect(controller.get('widgetMetrics')).to.be.empty;
- });
- it("GAUGE widget", function () {
- controller.set('expressions', [{}]);
- controller.set('content.widgetType', 'GAUGE');
- controller.set('dataSets', [{}]);
- //controller.updateExpressions();
- expect(controller.parseExpression.calledOnce).to.be.true;
- expect(controller.parseTemplateExpression.called).to.be.false;
- expect(controller.parseGraphDataset.called).to.be.false;
- expect(controller.get('widgetValues')).to.not.be.empty;
- expect(controller.get('widgetMetrics')).to.not.be.empty;
- });
- it("NUMBER widget", function () {
- controller.set('expressions', [{}]);
- controller.set('content.widgetType', 'NUMBER');
- controller.set('dataSets', [{}]);
- //controller.updateExpressions();
- expect(controller.parseExpression.calledOnce).to.be.true;
- expect(controller.parseTemplateExpression.called).to.be.false;
- expect(controller.parseGraphDataset.called).to.be.false;
- expect(controller.get('widgetValues')).to.not.be.empty;
- expect(controller.get('widgetMetrics')).to.not.be.empty;
- });
- it("TEMPLATE widget", function () {
- controller.set('expressions', [{}]);
- controller.set('content.widgetType', 'TEMPLATE');
- controller.set('dataSets', [{}]);
- //controller.updateExpressions();
- expect(controller.parseExpression.called).to.be.false;
- expect(controller.parseTemplateExpression.calledOnce).to.be.true;
- expect(controller.parseGraphDataset.called).to.be.false;
- expect(controller.get('widgetValues')).to.not.be.empty;
- expect(controller.get('widgetMetrics')).to.not.be.empty;
- });
- it("GRAPH widget", function () {
- controller.set('expressions', [{}]);
- controller.set('content.widgetType', 'GRAPH');
- controller.set('dataSets', [{}]);
- //controller.updateExpressions();
- expect(controller.parseExpression.called).to.be.false;
- expect(controller.parseTemplateExpression.called).to.be.false;
- expect(controller.parseGraphDataset.calledOnce).to.be.true;
- expect(controller.get('widgetValues')).to.not.be.empty;
- expect(controller.get('widgetMetrics')).to.not.be.empty;
+
+ describe("empty dataSets", function () {
+
+ beforeEach(function () {
+ controller.set('dataSets', []);
+ controller.updateExpressions();
+ });
+
+ it('parseExpression is not called', function () {
+ expect(controller.parseExpression.called).to.be.false;
+ });
+ it('parseTemplateExpression is not called', function () {
+ expect(controller.parseTemplateExpression.called).to.be.false;
+ });
+ it('parseGraphDataset is not called', function () {
+ expect(controller.parseGraphDataset.called).to.be.false;
+ });
+ it('widgetValues is empty', function () {
+ expect(controller.get('widgetValues')).to.be.empty;
+ });
+ it('widgetMetrics is empty', function () {
+ expect(controller.get('widgetMetrics')).to.be.empty;
+ });
+ });
+
+ describe("GAUGE widget", function () {
+
+ beforeEach(function () {
+ controller.set('expressions', [{}]);
+ controller.set('content.widgetType', 'GAUGE');
+ controller.set('dataSets', [{}]);
+ //controller.updateExpressions();
+ });
+
+
+ it('parseExpression is called once', function () {
+ expect(controller.parseExpression.calledOnce).to.be.true;
+ });
+ it('parseTemplateExpression is not called', function () {
+ expect(controller.parseTemplateExpression.called).to.be.false;
+ });
+ it('parseGraphDataset is not called', function () {
+ expect(controller.parseGraphDataset.called).to.be.false;
+ });
+ it('widgetValues is not empty', function () {
+ expect(controller.get('widgetValues')).to.not.be.empty;
+ });
+ it('widgetMetrics is not empty', function () {
+ expect(controller.get('widgetMetrics')).to.not.be.empty;
+ });
+ });
+
+ describe("NUMBER widget", function () {
+
+ beforeEach(function () {
+ controller.set('expressions', [{}]);
+ controller.set('content.widgetType', 'NUMBER');
+ controller.set('dataSets', [{}]);
+ //controller.updateExpressions();
+ });
+
+
+ it('parseExpression is called once', function () {
+ expect(controller.parseExpression.calledOnce).to.be.true;
+ });
+ it('parseTemplateExpression is not called', function () {
+ expect(controller.parseTemplateExpression.called).to.be.false;
+ });
+ it('parseGraphDataset is not called', function () {
+ expect(controller.parseGraphDataset.called).to.be.false;
+ });
+ it('widgetValues is not empty', function () {
+ expect(controller.get('widgetValues')).to.not.be.empty;
+ });
+ it('widgetMetrics is not empty', function () {
+ expect(controller.get('widgetMetrics')).to.not.be.empty;
+ });
+ });
+
+ describe("TEMPLATE widget", function () {
+
+ beforeEach(function () {
+ controller.set('expressions', [{}]);
+ controller.set('content.widgetType', 'TEMPLATE');
+ controller.set('dataSets', [{}]);
+ //controller.updateExpressions();
+ });
+
+
+ it('parseExpression is not called', function () {
+ expect(controller.parseExpression.called).to.be.false;
+ });
+ it('parseTemplateExpression is called once', function () {
+ expect(controller.parseTemplateExpression.calledOnce).to.be.true;
+ });
+ it('parseGraphDataset is not called', function () {
+ expect(controller.parseGraphDataset.called).to.be.false;
+ });
+ it('widgetValues is not empty', function () {
+ expect(controller.get('widgetValues')).to.not.be.empty;
+ });
+ it('widgetMetrics is not empty', function () {
+ expect(controller.get('widgetMetrics')).to.not.be.empty;
+ });
});
+
+ describe("GRAPH widget", function () {
+
+ beforeEach(function () {
+ controller.set('expressions', [{}]);
+ controller.set('content.widgetType', 'GRAPH');
+ controller.set('dataSets', [{}]);
+ //controller.updateExpressions();
+ });
+
+ it('parseExpression is not called', function () {
+ expect(controller.parseExpression.called).to.be.false;
+ });
+ it('parseTemplateExpression is not called', function () {
+ expect(controller.parseTemplateExpression.called).to.be.false;
+ });
+ it('parseGraphDataset is called once', function () {
+ expect(controller.parseGraphDataset.calledOnce).to.be.true;
+ });
+ it('widgetValues is not empty', function () {
+ expect(controller.get('widgetValues')).to.not.be.empty;
+ });
+ it('widgetMetrics is not empty', function () {
+ expect(controller.get('widgetMetrics')).to.not.be.empty;
+ });
+ });
+
});
describe("#parseGraphDataset()", function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service_test.js b/ambari-web/test/controllers/main/service_test.js
index c134419..4a3d329 100644
--- a/ambari-web/test/controllers/main/service_test.js
+++ b/ambari-web/test/controllers/main/service_test.js
@@ -124,18 +124,28 @@ describe('App.MainServiceController', function () {
e: null
}
]).forEach(function(test) {
- it(test.m, function() {
- sinon.stub(App.router, 'get', function(k) {
- if ('clusterController.isClusterDataLoaded' === k) return test.isLoaded;
- return Em.get(App.router, k);
+ describe(test.m, function() {
+
+ beforeEach(function () {
+ sinon.stub(App.router, 'get', function(k) {
+ if ('clusterController.isClusterDataLoaded' === k) return test.isLoaded;
+ return Em.get(App.router, k);
+ });
+ sinon.stub(App.Cluster, 'find', function() {
+ return [test.e];
+ });
});
- sinon.stub(App.Cluster, 'find', function() {
- return [test.e];
+
+ afterEach(function () {
+ App.router.get.restore();
+ App.Cluster.find.restore();
+ });
+
+ it('cluster is valid', function () {
+ var c = mainServiceController.get('cluster');
+ expect(c).to.eql(test.e);
});
- var c = mainServiceController.get('cluster');
- App.router.get.restore();
- App.Cluster.find.restore();
- expect(c).to.eql(test.e);
+
});
});
@@ -220,28 +230,38 @@ describe('App.MainServiceController', function () {
expect(Em.I18n.t.calledWith('services.service.stop.confirmButton')).to.be.ok;
});
- it ("should check last checkpoint for NN before confirming stop", function() {
- var mainServiceItemController = App.MainServiceItemController.create({});
- sinon.stub(mainServiceItemController, 'checkNnLastCheckpointTime', function() {
- return true;
+ describe("should check last checkpoint for NN before confirming stop", function() {
+ var mainServiceItemController;
+ beforeEach(function() {
+ mainServiceItemController = App.MainServiceItemController.create({});
+ sinon.stub(mainServiceItemController, 'checkNnLastCheckpointTime', function() {
+ return true;
+ });
+ sinon.stub(App.router, 'get', function(k) {
+ if ('mainServiceItemController' === k) {
+ return mainServiceItemController;
+ }
+ return Em.get(App.router, k);
+ });
+ sinon.stub(App.Service, 'find', function() {
+ return [{
+ serviceName: "HDFS",
+ workStatus: "STARTED"
+ }];
+ });
});
- sinon.stub(App.router, 'get', function(k) {
- if ('mainServiceItemController' === k) {
- return mainServiceItemController;
- }
- return Em.get(App.router, k);
+
+ afterEach(function () {
+ mainServiceItemController.checkNnLastCheckpointTime.restore();
+ App.router.get.restore();
+ App.Service.find.restore();
});
- sinon.stub(App.Service, 'find', function() {
- return [{
- serviceName: "HDFS",
- workStatus: "STARTED"
- }];
+
+ it('checkNnLastCheckpointTime is called once', function () {
+ mainServiceController.startStopAllService(event, "INSTALLED");
+ expect(mainServiceItemController.checkNnLastCheckpointTime.calledOnce).to.equal(true);
});
- mainServiceController.startStopAllService(event, "INSTALLED");
- expect(mainServiceItemController.checkNnLastCheckpointTime.calledOnce).to.equal(true);
- mainServiceItemController.checkNnLastCheckpointTime.restore();
- App.router.get.restore();
- App.Service.find.restore();
+
});
it ("should confirm start if state is not INSTALLED", function() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/views_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/views_controller_test.js b/ambari-web/test/controllers/main/views_controller_test.js
index cea1308..85c7521 100644
--- a/ambari-web/test/controllers/main/views_controller_test.js
+++ b/ambari-web/test/controllers/main/views_controller_test.js
@@ -29,6 +29,7 @@ describe('MainViewsController', function () {
describe('#loadAmbariViews()', function () {
beforeEach(function () {
sinon.stub(App.ajax, 'send', Em.K);
+ this.stub = sinon.stub(App.router, 'get');
});
afterEach(function () {
App.router.get.restore();
@@ -36,13 +37,13 @@ describe('MainViewsController', function () {
});
it('should load views if the user is logged in', function () {
- sinon.stub(App.router, 'get').withArgs('loggedIn').returns(true);
+ this.stub.withArgs('loggedIn').returns(true);
mainViewsController.loadAmbariViews();
expect(App.ajax.send.calledOnce).to.be.true;
});
it('should not load views if the user is not logged in', function () {
- sinon.stub(App.router, 'get').withArgs('loggedIn').returns(false);
+ this.stub.withArgs('loggedIn').returns(false);
mainViewsController.loadAmbariViews();
expect(App.ajax.send.notCalled).to.be.true;
})
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main_test.js b/ambari-web/test/controllers/main_test.js
index f9f092a..2a4fe97 100644
--- a/ambari-web/test/controllers/main_test.js
+++ b/ambari-web/test/controllers/main_test.js
@@ -79,25 +79,33 @@ describe('App.MainController', function () {
});
describe('#dataLoading', function() {
+
+ beforeEach(function () {
+ this.stub = sinon.stub(App.router, 'get');
+ });
+
+ afterEach(function () {
+ this.stub.restore();
+ });
+
it ('Should resolve promise', function() {
- sinon.stub(App.router, 'get').returns(true);
+ this.stub.returns(true);
var deffer = mainController.dataLoading();
- App.router.get.restore();
deffer.then(function(val){
expect(val).to.be.undefined;
});
});
- it ('Should resolve promise', function() {
- sinon.stub(App.router, 'get').returns(false);
+ it ('Should resolve promise (2)', function(done) {
+ this.stub.returns(false);
setTimeout(function() {
mainController.set('isClusterDataLoaded', true);
},150);
var deffer = mainController.dataLoading();
- App.router.get.restore();
deffer.then(function(val){
expect(val).to.be.undefined;
+ done();
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/router_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/router_test.js b/ambari-web/test/router_test.js
index da62895..78540e7 100644
--- a/ambari-web/test/router_test.js
+++ b/ambari-web/test/router_test.js
@@ -496,22 +496,32 @@ describe('App.Router', function () {
m: 'jwtProviderUrl is present, current location is local login url, no redirect'
}
].forEach(function(test) {
- it(test.m, function() {
- var mockCurrentUrl = 'http://localhost:3333/#/some/hash';
- router.set('location.lastSetURL', test.lastSetURL);
- sinon.stub(App.ajax, 'send', function() {
- if (!test.isResolved) {
- router.onAuthenticationError(test.responseData);
- }
- return {
- complete: function() {}
- };
+ describe(test.m, function() {
+ var mockCurrentUrl;
+ beforeEach(function () {
+ mockCurrentUrl = 'http://localhost:3333/#/some/hash';
+ router.set('location.lastSetURL', test.lastSetURL);
+ sinon.stub(App.ajax, 'send', function() {
+ if (!test.isResolved) {
+ router.onAuthenticationError(test.responseData);
+ }
+ return {
+ complete: function() {}
+ };
+ });
+ this.mockGetCurrentLocationUrl.returns(mockCurrentUrl);
+ router.getAuthenticated();
+ });
+
+ it('redirectByURL is ' + (test.redirectCalled ? '' : 'not') + ' called', function () {
+ expect(router.redirectByURL.calledOnce).to.be.eql(test.redirectCalled);
});
- this.mockGetCurrentLocationUrl.returns(mockCurrentUrl);
- router.getAuthenticated();
- expect(router.redirectByURL.calledOnce).to.be.eql(test.redirectCalled);
+
+
if (test.redirectCalled) {
- expect(router.redirectByURL.args[0][0]).to.be.eql(JSON.parse(test.responseData.responseText).jwtProviderUrl + encodeURIComponent(mockCurrentUrl));
+ it('redirectByURL is correct', function () {
+ expect(router.redirectByURL.args[0][0]).to.be.eql(JSON.parse(test.responseData.responseText).jwtProviderUrl + encodeURIComponent(mockCurrentUrl));
+ });
}
});
});
[14/50] [abbrv] ambari git commit: AMBARI-14509. Handle the case when
UI call to 'Install Packages' action times out (alexantonenko)
Posted by nc...@apache.org.
AMBARI-14509. Handle the case when UI call to 'Install Packages' action times out
(alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/23653924
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/23653924
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/23653924
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 23653924d6016ce6b3b52d5ea84d53298721ad6f
Parents: f2b1a89
Author: Alex Antonenko <hi...@gmail.com>
Authored: Mon Dec 28 20:42:33 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Mon Dec 28 21:17:57 2015 +0200
----------------------------------------------------------------------
.../main/admin/stack_and_upgrade_controller.js | 14 ++++++++++++++
ambari-web/app/messages.js | 1 +
.../main/admin/stack_upgrade/upgrade_version_box.hbs | 3 +++
.../admin/stack_upgrade/upgrade_version_box_view.js | 8 +++++++-
4 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/23653924/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
index 748cbc8..06ddf24 100644
--- a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
+++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
@@ -140,6 +140,10 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
*/
requestInProgress: false,
/**
+ * @type {number} repo id, request for which is currently in progress
+ */
+ requestInProgressRepoId: null,
+ /**
* @type {boolean} true while no updated upgrade info is loaded after retry
*/
isRetryPending: false,
@@ -1140,6 +1144,8 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
*/
installRepoVersion: function (repo) {
this.set('requestInProgress', true);
+ this.set('requestInProgressRepoId', repo.get('id'));
+
var data = {
ClusterStackVersions: {
stack: repo.get('stackVersionType'),
@@ -1156,6 +1162,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
error: 'installRepoVersionError',
callback: function() {
this.sender.set('requestInProgress', false);
+ this.sender.set('requestInProgressRepoId', null);
}
});
},
@@ -1293,6 +1300,10 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
* @method installStackVersionSuccess
*/
installRepoVersionSuccess: function (data, opt, params) {
+ if(data && data.statusText == "timeout") {
+ App.showAlertPopup(Em.I18n.t('admin.stackVersions.upgrade.installPackage.fail.title'), Em.I18n.t('admin.stackVersions.upgrade.installPackage.fail.timeout'));
+ return false;
+ }
var version = App.RepositoryVersion.find(params.id);
App.db.set('repoVersionInstall', 'id', [data.Requests.id]);
App.clusterStatus.setClusterStatus({
@@ -1320,6 +1331,9 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
body = json.message;
} catch (err) {}
}
+ if(data && data.statusText == "timeout") {
+ body = Em.I18n.t('admin.stackVersions.upgrade.installPackage.fail.timeout');
+ }
App.showAlertPopup(header, body);
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/23653924/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index c0e1e16..2203b17 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1451,6 +1451,7 @@ Em.I18n.translations = {
'admin.stackVersions.filter.upgraded': "Ready to Finalize ({0})",
'admin.stackVersions.upgrade.start.fail.title':'Upgrade could not be started',
'admin.stackVersions.upgrade.installPackage.fail.title':'Packages could not be installed',
+ 'admin.stackVersions.upgrade.installPackage.fail.timeout':'Request timed out.',
'admin.stackVersions.editRepositories.info': 'Provide Base URLs for the Operating Systems you are configuring. Uncheck all other Operating Systems.',
'admin.stackVersions.editRepositories.validation.warning': 'Some of the repositories failed validation. Make changes to the base url or skip validation if you are sure that urls are correct',
http://git-wip-us.apache.org/repos/asf/ambari/blob/23653924/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs
index 96d4544..1bc81c5 100644
--- a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs
@@ -71,6 +71,9 @@
}}
{{/if}}
{{/if}}
+ {{#if view.stateElement.isSpinner}}
+ <div {{bindAttr class="view.stateElement.class"}}></div>
+ {{/if}}
</div>
<div class="hosts-section">
http://git-wip-us.apache.org/repos/asf/ambari/blob/23653924/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
index b6c5ad9..df588fd 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
@@ -114,6 +114,10 @@ App.UpgradeVersionBoxView = Em.View.extend({
text: Em.I18n.t('admin.stackVersions.version.installNow'),
action: 'installRepoVersionConfirmation'
},
+ 'LOADING': {
+ isSpinner: true,
+ class: 'spinner'
+ },
'INSTALLING': {
iconClass: 'icon-cog',
isLink: true,
@@ -141,6 +145,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
stateElement: function () {
var currentVersion = this.get('controller.currentVersion');
var statePropertiesMap = this.get('statePropertiesMap');
+ var requestInProgressRepoId = this.get('controller.requestInProgressRepoId');
var status = this.get('content.status');
var element = Em.Object.create({
status: status,
@@ -157,7 +162,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
element.setProperties(statePropertiesMap[status]);
}
else if (status === 'INIT') {
- element.setProperties(statePropertiesMap[status]);
+ requestInProgressRepoId && requestInProgressRepoId == this.get('content.id') ? element.setProperties(statePropertiesMap['LOADING']) : element.setProperties(statePropertiesMap[status]);
element.set('isDisabled', this.get('controller.requestInProgress') || isInstalling);
}
else if ((status === 'INSTALLED' && !this.get('isUpgrading')) ||
@@ -221,6 +226,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
'controller.isDowngrade',
'isUpgrading',
'controller.requestInProgress',
+ 'controller.requestInProgressRepoId',
'parentView.repoVersions.@each.status'
),
[34/50] [abbrv] ambari git commit: AMBARI-14392. Move logic to
ambari-web,
for adding parameters to hdfs-client.xml for HAWQ when HAWQ is installed on NN
HA cluster (mithmatt via odiachenko).
Posted by nc...@apache.org.
AMBARI-14392. Move logic to ambari-web, for adding parameters to hdfs-client.xml for HAWQ when HAWQ is installed on NN HA cluster (mithmatt via odiachenko).
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/746e90d1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/746e90d1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/746e90d1
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 746e90d1de23060d3d7f33f3995714a0950938b4
Parents: 83ea508
Author: Oleksandr Diachenko <od...@pivotal.io>
Authored: Wed Dec 30 11:27:14 2015 -0800
Committer: Oleksandr Diachenko <od...@pivotal.io>
Committed: Wed Dec 30 11:27:14 2015 -0800
----------------------------------------------------------------------
.../HAWQ/2.0.0/package/scripts/common.py | 17 +----
.../app/controllers/wizard/step7_controller.js | 42 ++++++++++++
.../test/controllers/wizard/step7_test.js | 71 ++++++++++++++++++++
3 files changed, 114 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/746e90d1/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py
index 49e86b6..c427c83 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py
@@ -91,22 +91,7 @@ def __update_hdfs_client():
import params
hdfs_client_dict = params.hdfs_client.copy()
- dfs_nameservice = params.hdfs_site.get('dfs.nameservices')
-
- # Adds additional parameters required for HDFS HA, if HDFS HA is enabled
- # Temporary logic, this logic will be moved to ambari-web to expose these parameters on UI once HDFS HA is enabled
- if dfs_nameservice:
- ha_namenodes = 'dfs.ha.namenodes.{0}'.format(dfs_nameservice)
- ha_nn_list = [ha_nn.strip() for ha_nn in params.hdfs_site[ha_namenodes].split(',')]
- required_keys = ('dfs.nameservices', ha_namenodes,
- 'dfs.namenode.rpc-address.{0}.{1}'.format(dfs_nameservice, ha_nn_list[0]),
- 'dfs.namenode.http-address.{0}.{1}'.format(dfs_nameservice, ha_nn_list[0]),
- 'dfs.namenode.rpc-address.{0}.{1}'.format(dfs_nameservice, ha_nn_list[1]),
- 'dfs.namenode.http-address.{0}.{1}'.format(dfs_nameservice, ha_nn_list[1]))
-
- for key in required_keys:
- hdfs_client_dict[key] = params.hdfs_site[key]
-
+
# security
if params.security_enabled:
hdfs_client_dict["hadoop.security.authentication"] = "kerberos"
http://git-wip-us.apache.org/repos/asf/ambari/blob/746e90d1/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index 823d663..d10f348 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -688,6 +688,10 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
if (this.get('allSelectedServiceNames').contains('YARN')) {
configs = App.config.fileConfigsIntoTextarea(configs, 'capacity-scheduler.xml', []);
}
+ // if HA is enabled and HAWQ is selected to be installed -> Add HAWQ related configs
+ if (this.get('wizardController.name') === 'addServiceController' && App.get('isHaEnabled') && this.get('allSelectedServiceNames').contains('HAWQ')) {
+ this.addHawqConfigsOnNnHa(configs);
+ }
if (App.get('isKerberosEnabled') && this.get('wizardController.name') == 'addServiceController') {
this.addKerberosDescriptorConfigs(configs, this.get('wizardController.kerberosDescriptorConfigs') || []);
}
@@ -794,6 +798,44 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
},
/**
+ * For Namenode HA, HAWQ service requires additional config parameters in hdfs-client.xml
+ * This method ensures that these additional parameters are added to hdfs-client.xml
+ * @param configs existing configs on cluster
+ * @returns {Object[]} existing configs + additional config parameters in hdfs-client.xml
+ * @private
+ */
+ addHawqConfigsOnNnHa: function(configs) {
+ var nameService = configs.findProperty('id', 'dfs.nameservices__hdfs-site').value;
+ var propertyNames = [
+ 'dfs.nameservices',
+ 'dfs.ha.namenodes.' + nameService,
+ 'dfs.namenode.rpc-address.'+ nameService +'.nn1',
+ 'dfs.namenode.rpc-address.'+ nameService +'.nn2',
+ 'dfs.namenode.http-address.'+ nameService +'.nn1',
+ 'dfs.namenode.http-address.'+ nameService +'.nn2'
+ ];
+
+ propertyNames.forEach(function(propertyName, propertyIndex) {
+ var propertyFromHdfs = configs.findProperty('id', propertyName + '__hdfs-site');
+ var newProperty = App.config.createDefaultConfig(propertyName, 'HAWQ', 'hdfs-client.xml', true);
+ Em.setProperties(newProperty, {
+ description: propertyFromHdfs.description,
+ displayName: propertyFromHdfs.displayName,
+ displayType: 'string',
+ index: propertyIndex,
+ isOverridable: false,
+ isReconfigurable: false,
+ name: propertyFromHdfs.name,
+ value: propertyFromHdfs.value,
+ recommendedValue: propertyFromHdfs.recommendedValue
+ });
+
+ configs.push(App.ServiceConfigProperty.create(newProperty));
+ });
+ return configs;
+ },
+
+ /**
* render configs, distribute them by service
* and wrap each in ServiceConfigProperty object
* @param stepConfigs
http://git-wip-us.apache.org/repos/asf/ambari/blob/746e90d1/ambari-web/test/controllers/wizard/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js
index 3c23c54..ac7b3c3 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -1608,6 +1608,77 @@ describe('App.InstallerStep7Controller', function () {
});
});
+ describe('#addHawqConfigsOnNnHa', function () {
+ var configs = [
+ {
+ id: 'dfs.nameservices__hdfs-site',
+ description: 'dfs.nameservices__hdfs-site',
+ displayName: 'dfs.nameservices',
+ displayType: 'string',
+ name: 'dfs.nameservices',
+ value: 'haservice',
+ recommendedValue: 'haservice'
+ },
+ {
+ id: 'dfs.ha.namenodes.haservice__hdfs-site',
+ description: 'dfs.ha.namenodes.haservice__hdfs-site',
+ displayName: 'dfs.ha.namenodes.haservice',
+ displayType: 'string',
+ name: 'dfs.ha.namenodes.haservice',
+ value: 'nn1,nn2',
+ recommendedValue: 'nn1,nn2'
+ },
+ {
+ id: 'dfs.namenode.rpc-address.haservice.nn1__hdfs-site',
+ description: 'dfs.namenode.rpc-address.haservice.nn1__hdfs-site',
+ displayName: 'dfs.namenode.rpc-address.haservice.nn1',
+ displayType: 'string',
+ name: 'dfs.namenode.rpc-address.haservice.nn1',
+ value: 'c6401.ambari.apache.org:8020',
+ recommendedValue: 'c6401.ambari.apache.org:8020'
+ },
+ {
+ id: 'dfs.namenode.rpc-address.haservice.nn2__hdfs-site',
+ description: 'dfs.namenode.rpc-address.haservice.nn2__hdfs-site',
+ displayName: 'dfs.namenode.rpc-address.haservice.nn2',
+ displayType: 'string',
+ name: 'dfs.namenode.rpc-address.haservice.nn2',
+ value: 'c6402.ambari.apache.org:8020',
+ recommendedValue: 'c6402.ambari.apache.org:8020'
+ },
+ {
+ id: 'dfs.namenode.http-address.haservice.nn1__hdfs-site',
+ description: 'dfs.namenode.http-address.haservice.nn1__hdfs-site',
+ displayName: 'dfs.namenode.http-address.haservice.nn1',
+ displayType: 'string',
+ name: 'dfs.namenode.http-address.haservice.nn1',
+ value: 'c6401.ambari.apache.org:50070',
+ recommendedValue: 'c6401.ambari.apache.org:50070'
+ },
+ {
+ id: 'dfs.namenode.http-address.haservice.nn2__hdfs-site',
+ description: 'dfs.namenode.http-address.haservice.nn2__hdfs-site',
+ displayName: 'dfs.namenode.http-address.haservice.nn2',
+ displayType: 'string',
+ name: 'dfs.namenode.http-address.haservice.nn2',
+ value: 'c6402.ambari.apache.org:50070',
+ recommendedValue: 'c6402.ambari.apache.org:50070'
+ }
+ ];
+
+ it('should copy properties from hdfs-site to hdfs-client for HAWQ', function() {
+ var oldConfigs = configs.slice();
+ installerStep7Controller.addHawqConfigsOnNnHa(configs);
+ oldConfigs.forEach(function(property){
+ // find the same property in hdfs-client for HAWQ and see if attribute value matches with the corresponding property's attribute value in hdfs-site
+ expect(configs.findProperty('id', property.name + '__hdfs-client').description).to.be.eql(property.description);
+ expect(configs.findProperty('id', property.name + '__hdfs-client').displayName).to.be.eql(property.displayName);
+ expect(configs.findProperty('id', property.name + '__hdfs-client').value).to.be.eql(property.value);
+ expect(configs.findProperty('id', property.name + '__hdfs-client').recommendedValue).to.be.eql(property.recommendedValue);
+ });
+ });
+ });
+
describe('#errorsCount', function () {
it('should ignore configs with widgets (enhanced configs)', function () {
[02/50] [abbrv] ambari git commit: AMBARI-14495. Improve Ambari UI UT
(p.2) (onechiporenko)
Posted by nc...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/controllers/wizard/step8_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step8_test.js b/ambari-web/test/controllers/wizard/step8_test.js
index 0e120a2..576e303 100644
--- a/ambari-web/test/controllers/wizard/step8_test.js
+++ b/ambari-web/test/controllers/wizard/step8_test.js
@@ -1170,46 +1170,6 @@ describe('App.WizardStep8Controller', function () {
});
- describe('#createSelectedServicesData', function() {
- it('should reformat provided data', function() {
- var selectedServices = [
- Em.Object.create({serviceName: 's1'}),
- Em.Object.create({serviceName: 's2'}),
- Em.Object.create({serviceName: 's3'})
- ];
- var expected = [
- {"ServiceInfo": { "service_name": 's1' }},
- {"ServiceInfo": { "service_name": 's2' }},
- {"ServiceInfo": { "service_name": 's3' }}
- ];
- installerStep8Controller.reopen({selectedServices: selectedServices});
- var createdData = installerStep8Controller.createSelectedServicesData();
- expect(createdData).to.eql(expected);
- });
- });
-
- describe('#createRegisterHostData', function() {
- it('should return empty data if no hosts', function() {
- sinon.stub(installerStep8Controller, 'getRegisteredHosts', function() {return [];});
- expect(installerStep8Controller.createRegisterHostData()).to.eql([]);
- installerStep8Controller.getRegisteredHosts.restore();
- });
- it('should return computed data', function() {
- var data = [
- {isInstalled: false, hostName: 'h1'},
- {isInstalled: true, hostName: 'h2'},
- {isInstalled: false, hostName: 'h3'}
- ];
- var expected = [
- {"Hosts": { "host_name": 'h1'}},
- {"Hosts": { "host_name": 'h3'}}
- ];
- sinon.stub(installerStep8Controller, 'getRegisteredHosts', function() {return data;});
- expect(installerStep8Controller.createRegisterHostData()).to.eql(expected);
- installerStep8Controller.getRegisteredHosts.restore();
- });
- });
-
describe('#createStormSiteObj', function() {
it('should replace quote \'"\' to "\'" for some properties', function() {
var configs = [
@@ -1247,11 +1207,18 @@ describe('App.WizardStep8Controller', function () {
});
describe('#ajaxQueueFinished', function() {
- it('should call App.router.next', function() {
+
+ beforeEach(function () {
sinon.stub(App.router, 'send', Em.K);
+ });
+
+ afterEach(function () {
+ App.router.send.restore();
+ });
+
+ it('should call App.router.next', function() {
installerStep8Controller.ajaxQueueFinished();
expect(App.router.send.calledWith('next')).to.equal(true);
- App.router.send.restore();
});
});
@@ -1423,43 +1390,60 @@ describe('App.WizardStep8Controller', function () {
describe('#createSelectedServices', function() {
+ var data;
+
+ beforeEach(function () {
+ sinon.stub(installerStep8Controller, 'createSelectedServicesData', function () {
+ return data;
+ });
+ });
+
+ afterEach(function () {
+ installerStep8Controller.createSelectedServicesData.restore();
+ });
+
it('shouldn\'t do nothing if no data', function() {
- sinon.stub(installerStep8Controller, 'createSelectedServicesData', function() {return [];});
+ data = [];
installerStep8Controller.createSelectedServices();
expect(installerStep8Controller.addRequestToAjaxQueue.called).to.equal(false);
- installerStep8Controller.createSelectedServicesData.restore();
});
it('should call addRequestToAjaxQueue with computed data', function() {
- var data = [
+ data = [
{"ServiceInfo": { "service_name": 's1' }},
{"ServiceInfo": { "service_name": 's2' }},
{"ServiceInfo": { "service_name": 's3' }}
];
- sinon.stub(installerStep8Controller, 'createSelectedServicesData', function() {return data;});
installerStep8Controller.createSelectedServices();
expect(installerStep8Controller.addRequestToAjaxQueue.args[0][0].data.data).to.equal(JSON.stringify(data));
- installerStep8Controller.createSelectedServicesData.restore();
});
});
describe('#registerHostsToCluster', function() {
+ var data;
+ beforeEach(function () {
+ sinon.stub(installerStep8Controller, 'createRegisterHostData', function () {
+ return data;
+ });
+ });
+
+ afterEach(function () {
+ installerStep8Controller.createRegisterHostData.restore();
+ });
+
it('shouldn\'t do nothing if no data', function() {
- sinon.stub(installerStep8Controller, 'createRegisterHostData', function() {return [];});
+ data = [];
installerStep8Controller.registerHostsToCluster();
expect(installerStep8Controller.addRequestToAjaxQueue.called).to.equal(false);
- installerStep8Controller.createRegisterHostData.restore();
});
it('should call addRequestToAjaxQueue with computed data', function() {
- var data = [
+ data = [
{"Hosts": { "host_name": 'h1'}},
{"Hosts": { "host_name": 'h3'}}
];
- sinon.stub(installerStep8Controller, 'createRegisterHostData', function() {return data;});
installerStep8Controller.registerHostsToCluster();
expect(installerStep8Controller.addRequestToAjaxQueue.args[0][0].data.data).to.equal(JSON.stringify(data));
- installerStep8Controller.createRegisterHostData.restore();
});
});
@@ -1646,98 +1630,107 @@ describe('App.WizardStep8Controller', function () {
installerStep8Controller.registerHostsToComponent.restore();
});
- it('should add components with isRequiredOnAllHosts == true (1)', function() {
- installerStep8Controller.reopen({
- getRegisteredHosts: function() {
- return [{hostName: 'h1'}, {hostName: 'h2'}];
- },
- content: {
- services: Em.A([
- Em.Object.create({
- serviceName: 'ANYSERVICE', isSelected: true, isInstalled: false, serviceComponents: [
- // set isRequiredOnAllHosts = true for slave and client
- Em.Object.create({
- componentName: 'ANYSERVICE_MASTER',
- isMaster: true,
- isRequiredOnAllHosts: false
- }),
- Em.Object.create({
- componentName: 'ANYSERVICE_SLAVE',
- isSlave: true,
- isRequiredOnAllHosts: true
- }),
- Em.Object.create({
- componentName: 'ANYSERVICE_SLAVE2',
- isSlave: true,
- isRequiredOnAllHosts: true
- }),
- Em.Object.create({
- componentName: 'ANYSERVICE_CLIENT',
- isClient: true,
- isRequiredOnAllHosts: true
- })
- ]
- })
- ]),
- masterComponentHosts: Em.A([
- Em.Object.create({
- componentName: 'ANYSERVICE_MASTER',
- component: 'ANYSERVICE_MASTER',
- hosts: Em.A([
- Em.Object.create({hostName: 'h1', isInstalled: true})
- ])
- })
- ]),
- slaveComponentHosts: Em.A([
- Em.Object.create({
- componentName: 'ANYSERVICE_SLAVE',
- hosts: Em.A([
- Em.Object.create({hostName: 'h1', isInstalled: false}),
- Em.Object.create({hostName: 'h2', isInstalled: false})
- ])
- }),
- Em.Object.create({
- componentName: 'ANYSERVICE_SLAVE2',
- hosts: Em.A([
- Em.Object.create({hostName: 'h1', isInstalled: false}),
- Em.Object.create({hostName: 'h2', isInstalled: false})
- ]),
- }),
- Em.Object.create({
- componentName: 'CLIENT',
- hosts: Em.A([
- Em.Object.create({hostName: 'h1', isInstalled: false}),
- Em.Object.create({hostName: 'h2', isInstalled: false})
- ])
- })
- ]),
- clients: Em.A([
- Em.Object.create({
- component_name: 'ANYSERVICE_CLIENT',
- isInstalled: false,
- hosts: Em.A([
- Em.Object.create({hostName: 'h1', isInstalled: false}),
- Em.Object.create({hostName: 'h2', isInstalled: false})
- ])
- })
- ])
- }
+ describe('should add components with isRequiredOnAllHosts == true (1)', function() {
+
+ beforeEach(function () {
+ installerStep8Controller.reopen({
+ getRegisteredHosts: function() {
+ return [{hostName: 'h1'}, {hostName: 'h2'}];
+ },
+ content: {
+ services: Em.A([
+ Em.Object.create({
+ serviceName: 'ANYSERVICE', isSelected: true, isInstalled: false, serviceComponents: [
+ // set isRequiredOnAllHosts = true for slave and client
+ Em.Object.create({
+ componentName: 'ANYSERVICE_MASTER',
+ isMaster: true,
+ isRequiredOnAllHosts: false
+ }),
+ Em.Object.create({
+ componentName: 'ANYSERVICE_SLAVE',
+ isSlave: true,
+ isRequiredOnAllHosts: true
+ }),
+ Em.Object.create({
+ componentName: 'ANYSERVICE_SLAVE2',
+ isSlave: true,
+ isRequiredOnAllHosts: true
+ }),
+ Em.Object.create({
+ componentName: 'ANYSERVICE_CLIENT',
+ isClient: true,
+ isRequiredOnAllHosts: true
+ })
+ ]
+ })
+ ]),
+ masterComponentHosts: Em.A([
+ Em.Object.create({
+ componentName: 'ANYSERVICE_MASTER',
+ component: 'ANYSERVICE_MASTER',
+ hosts: Em.A([
+ Em.Object.create({hostName: 'h1', isInstalled: true})
+ ])
+ })
+ ]),
+ slaveComponentHosts: Em.A([
+ Em.Object.create({
+ componentName: 'ANYSERVICE_SLAVE',
+ hosts: Em.A([
+ Em.Object.create({hostName: 'h1', isInstalled: false}),
+ Em.Object.create({hostName: 'h2', isInstalled: false})
+ ])
+ }),
+ Em.Object.create({
+ componentName: 'ANYSERVICE_SLAVE2',
+ hosts: Em.A([
+ Em.Object.create({hostName: 'h1', isInstalled: false}),
+ Em.Object.create({hostName: 'h2', isInstalled: false})
+ ]),
+ }),
+ Em.Object.create({
+ componentName: 'CLIENT',
+ hosts: Em.A([
+ Em.Object.create({hostName: 'h1', isInstalled: false}),
+ Em.Object.create({hostName: 'h2', isInstalled: false})
+ ])
+ })
+ ]),
+ clients: Em.A([
+ Em.Object.create({
+ component_name: 'ANYSERVICE_CLIENT',
+ isInstalled: false,
+ hosts: Em.A([
+ Em.Object.create({hostName: 'h1', isInstalled: false}),
+ Em.Object.create({hostName: 'h2', isInstalled: false})
+ ])
+ })
+ ])
+ }
+ });
+ installerStep8Controller.set('ajaxRequestsQueue', App.ajaxQueue.create());
+ installerStep8Controller.get('ajaxRequestsQueue').clear();
+ installerStep8Controller.createAdditionalHostComponents();
});
- installerStep8Controller.set('ajaxRequestsQueue', App.ajaxQueue.create());
- installerStep8Controller.get('ajaxRequestsQueue').clear();
- installerStep8Controller.createAdditionalHostComponents();
- // Any component with isRequiredOnAllHosts = true implies that
- // registerHostsToComponent would be done via
- // createAdditionalHostComponents() BUT NOT
- // createMasterHostComponents() or createSlaveAndClientsHostComponents()
- // or createAdditionalClientComponents()
- expect(installerStep8Controller.registerHostsToComponent.args[0][0]).to.eql(['h1', 'h2']);
- expect(installerStep8Controller.registerHostsToComponent.args[0][1]).to.equal('ANYSERVICE_SLAVE');
- expect(installerStep8Controller.registerHostsToComponent.args[1][0]).to.eql(['h1', 'h2']);
- expect(installerStep8Controller.registerHostsToComponent.args[1][1]).to.equal('ANYSERVICE_SLAVE2');
- expect(installerStep8Controller.registerHostsToComponent.args[2][0]).to.eql(['h1', 'h2']);
- expect(installerStep8Controller.registerHostsToComponent.args[2][1]).to.equal('ANYSERVICE_CLIENT');
+ // Any component with isRequiredOnAllHosts = true implies that
+ // registerHostsToComponent would be done via
+ // createAdditionalHostComponents() BUT NOT
+ // createMasterHostComponents() or createSlaveAndClientsHostComponents()
+ // or createAdditionalClientComponents()
+ it('registerHostsToComponent 1st call', function () {
+ expect(installerStep8Controller.registerHostsToComponent.args[0][0]).to.eql(['h1', 'h2']);
+ expect(installerStep8Controller.registerHostsToComponent.args[0][1]).to.equal('ANYSERVICE_SLAVE');
+ });
+ it('registerHostsToComponent 2nd call', function () {
+ expect(installerStep8Controller.registerHostsToComponent.args[1][0]).to.eql(['h1', 'h2']);
+ expect(installerStep8Controller.registerHostsToComponent.args[1][1]).to.equal('ANYSERVICE_SLAVE2');
+ });
+ it('registerHostsToComponent 3rd call', function () {
+ expect(installerStep8Controller.registerHostsToComponent.args[2][0]).to.eql(['h1', 'h2']);
+ expect(installerStep8Controller.registerHostsToComponent.args[2][1]).to.equal('ANYSERVICE_CLIENT');
+ });
});
it('should not add components with isRequiredOnAllHosts == false (2)', function() {
@@ -1868,22 +1861,49 @@ describe('App.WizardStep8Controller', function () {
expect($.ajax.args[0][0].url.contains('overwrite_existing=true')).to.be.true;
});
- it('sent data should be valid', function () {
+ describe('sent data should be valid', function () {
+ var data;
+ beforeEach(function () {
+ installerStep8Controller.createNotification();
+ data = installerStep8Controller.get('ajaxRequestsQueue.queue')[0].data.data.AlertTarget;
+ });
- installerStep8Controller.createNotification();
- var data = installerStep8Controller.get('ajaxRequestsQueue.queue')[0].data.data.AlertTarget;
- expect(data.global).to.be.true;
- expect(data.notification_type).to.equal('EMAIL');
- expect(data.alert_states).to.eql(['OK', 'WARNING', 'CRITICAL', 'UNKNOWN']);
- expect(data.properties['ambari.dispatch.recipients']).to.eql(['to@f.c']);
- expect(data.properties['mail.smtp.host']).to.equal('h');
- expect(data.properties['mail.smtp.port']).to.equal('25');
- expect(data.properties['mail.smtp.from']).to.equal('from@f.c');
- expect(data.properties['mail.smtp.starttls.enable']).to.equal(true);
- expect(data.properties['mail.smtp.startssl.enable']).to.equal(false);
- expect(data.properties['ambari.dispatch.credential.username']).to.equal('usr');
- expect(data.properties['ambari.dispatch.credential.password']).to.equal('pwd');
- expect(data.properties['some_p']).to.equal('some_v');
+ it('global is true', function () {
+ expect(data.global).to.be.true;
+ });
+ it('notification_type is EMAIL', function () {
+ expect(data.notification_type).to.equal('EMAIL');
+ });
+ it('alert_states are valid', function () {
+ expect(data.alert_states).to.eql(['OK', 'WARNING', 'CRITICAL', 'UNKNOWN']);
+ });
+ it('ambari.dispatch.recipients is valid', function () {
+ expect(data.properties['ambari.dispatch.recipients']).to.eql(['to@f.c']);
+ });
+ it('mail.smtp.host is valid', function () {
+ expect(data.properties['mail.smtp.host']).to.equal('h');
+ });
+ it('mail.smtp.port is valid', function () {
+ expect(data.properties['mail.smtp.port']).to.equal('25');
+ });
+ it('mail.smtp.from is valid', function () {
+ expect(data.properties['mail.smtp.from']).to.equal('from@f.c');
+ });
+ it('mail.smtp.starttls.enable is true', function () {
+ expect(data.properties['mail.smtp.starttls.enable']).to.equal(true);
+ });
+ it('mail.smtp.startssl.enable is false', function () {
+ expect(data.properties['mail.smtp.startssl.enable']).to.equal(false);
+ });
+ it('ambari.dispatch.credential.username is valid', function () {
+ expect(data.properties['ambari.dispatch.credential.username']).to.equal('usr');
+ });
+ it('ambari.dispatch.credential.password is valid', function () {
+ expect(data.properties['ambari.dispatch.credential.password']).to.equal('pwd');
+ });
+ it('custom property is valid', function () {
+ expect(data.properties['some_p']).to.equal('some_v');
+ });
});
@@ -1911,14 +1931,18 @@ describe('App.WizardStep8Controller', function () {
installerStep8Controller.startDeploy.restore();
});
- it('no failed requests', function () {
- expect(installerStep8Controller.get('clusterDeleteRequestsCompleted')).to.equal(1);
- expect(installerStep8Controller.showDeleteClustersErrorPopup.called).to.be.false;
- expect(installerStep8Controller.startDeploy.called).to.be.false;
- installerStep8Controller.deleteClusterSuccessCallback();
- expect(installerStep8Controller.get('clusterDeleteRequestsCompleted')).to.equal(2);
- expect(installerStep8Controller.showDeleteClustersErrorPopup.called).to.be.false;
- expect(installerStep8Controller.startDeploy.calledOnce).to.be.true;
+ describe('no failed requests', function () {
+ it('before Delete Cluster request', function () {
+ expect(installerStep8Controller.get('clusterDeleteRequestsCompleted')).to.equal(1);
+ expect(installerStep8Controller.showDeleteClustersErrorPopup.called).to.be.false;
+ expect(installerStep8Controller.startDeploy.called).to.be.false;
+ });
+ it('after Delete Cluster request', function () {
+ installerStep8Controller.deleteClusterSuccessCallback();
+ expect(installerStep8Controller.get('clusterDeleteRequestsCompleted')).to.equal(2);
+ expect(installerStep8Controller.showDeleteClustersErrorPopup.called).to.be.false;
+ expect(installerStep8Controller.startDeploy.calledOnce).to.be.true;
+ });
});
it('one request failed', function () {
@@ -1957,20 +1981,34 @@ describe('App.WizardStep8Controller', function () {
installerStep8Controller.showDeleteClustersErrorPopup.restore();
});
- it('should show error popup only if all requests are completed', function () {
- expect(installerStep8Controller.get('clusterDeleteRequestsCompleted')).to.equal(1);
- expect(installerStep8Controller.showDeleteClustersErrorPopup.called).to.be.false;
- installerStep8Controller.deleteClusterErrorCallback(request, ajaxOptions, error, opt);
- expect(installerStep8Controller.get('clusterDeleteRequestsCompleted')).to.equal(2);
- expect(installerStep8Controller.showDeleteClustersErrorPopup.calledOnce).to.be.true;
+ describe('should show error popup only if all requests are completed', function () {
+ it('Before Delete Cluster request fail', function () {
+ expect(installerStep8Controller.get('clusterDeleteRequestsCompleted')).to.equal(1);
+ expect(installerStep8Controller.showDeleteClustersErrorPopup.called).to.be.false;
+ });
+ it('After Delete Cluster request is failed', function () {
+ installerStep8Controller.deleteClusterErrorCallback(request, ajaxOptions, error, opt);
+ expect(installerStep8Controller.get('clusterDeleteRequestsCompleted')).to.equal(2);
+ expect(installerStep8Controller.showDeleteClustersErrorPopup.calledOnce).to.be.true;
+ });
});
- it('should create error popup body view', function () {
- expect(installerStep8Controller.get('clusterDeleteErrorViews')).to.have.length(1);
- expect(installerStep8Controller.get('clusterDeleteErrorViews.firstObject.url')).to.equal('api/v1/clusters/c0');
- expect(installerStep8Controller.get('clusterDeleteErrorViews.firstObject.type')).to.equal('DELETE');
- expect(installerStep8Controller.get('clusterDeleteErrorViews.firstObject.status')).to.equal(500);
- expect(installerStep8Controller.get('clusterDeleteErrorViews.firstObject.message')).to.equal('Internal Server Error');
+ describe('should create error popup body view', function () {
+ it('One failed request', function () {
+ expect(installerStep8Controller.get('clusterDeleteErrorViews')).to.have.length(1);
+ });
+ it('failed request url is valid', function () {
+ expect(installerStep8Controller.get('clusterDeleteErrorViews.firstObject.url')).to.equal('api/v1/clusters/c0');
+ });
+ it('failed request type is valid', function () {
+ expect(installerStep8Controller.get('clusterDeleteErrorViews.firstObject.type')).to.equal('DELETE');
+ });
+ it('failed request status is valid', function () {
+ expect(installerStep8Controller.get('clusterDeleteErrorViews.firstObject.status')).to.equal(500);
+ });
+ it('failed request message is valid', function () {
+ expect(installerStep8Controller.get('clusterDeleteErrorViews.firstObject.message')).to.equal('Internal Server Error');
+ });
});
});
@@ -2052,22 +2090,29 @@ describe('App.WizardStep8Controller', function () {
});
cases.forEach(function (item) {
- it(item.title, function () {
- sinon.stub(installerStep8Controller, 'get')
- .withArgs('ajaxRequestsQueue').returns({
- start: Em.K
- })
- .withArgs('ajaxRequestsQueue.queue.length').returns(1)
- .withArgs('wizardController').returns({
- getDBProperty: function () {
- return item.fileNamesToUpdate;
- }
- })
- .withArgs('content.controllerName').returns(item.controllerName);
- installerStep8Controller.startDeploy();
+ describe(item.title, function () {
+
+ beforeEach(function () {
+ sinon.stub(installerStep8Controller, 'get')
+ .withArgs('ajaxRequestsQueue').returns({
+ start: Em.K
+ })
+ .withArgs('ajaxRequestsQueue.queue.length').returns(1)
+ .withArgs('wizardController').returns({
+ getDBProperty: function () {
+ return item.fileNamesToUpdate;
+ }
+ })
+ .withArgs('content.controllerName').returns(item.controllerName);
+ installerStep8Controller.startDeploy();
+ });
+
stubbedNames.forEach(function (name) {
- expect(installerStep8Controller[name].called).to.equal(!item.notExecuted.contains(name));
+ it(name, function () {
+ expect(installerStep8Controller[name].called).to.equal(!item.notExecuted.contains(name));
+ });
});
+
});
});
@@ -2305,12 +2350,19 @@ describe('App.WizardStep8Controller', function () {
});
describe('#showLoadingIndicator', function() {
+
+ beforeEach(function () {
+ sinon.spy(App.ModalPopup, 'show');
+ });
+
+ afterEach(function () {
+ App.ModalPopup.show.restore();
+ });
+
it('if popup doesn\'t exist should create another', function() {
installerStep8Controller.set('isSubmitDisabled', true);
- sinon.spy(App.ModalPopup, 'show');
installerStep8Controller.showLoadingIndicator();
expect(App.ModalPopup.show.calledOnce).to.equal(true);
- App.ModalPopup.show.restore();
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/controllers/wizard/step9_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step9_test.js b/ambari-web/test/controllers/wizard/step9_test.js
index fa57fd5..d60b24a 100644
--- a/ambari-web/test/controllers/wizard/step9_test.js
+++ b/ambari-web/test/controllers/wizard/step9_test.js
@@ -397,14 +397,12 @@ describe('App.InstallerStep9Controller', function () {
var loaded_hosts = c.get('hosts');
expect(loaded_hosts.length).to.equal(2);
});
+
it('All hosts have progress 0', function () {
var loaded_hosts = c.get('hosts');
expect(loaded_hosts.everyProperty('progress', 0)).to.equal(true);
});
- it('All hosts have progress 0', function () {
- var loaded_hosts = c.get('hosts');
- expect(loaded_hosts.everyProperty('progress', 0)).to.equal(true);
- });
+
it('All host don\'t have logTasks', function () {
var loaded_hosts = c.get('hosts');
expect(loaded_hosts.everyProperty('logTasks.length', 0)).to.equal(true);
@@ -1026,12 +1024,22 @@ describe('App.InstallerStep9Controller', function () {
});
describe('#clearStep', function () {
- it('All to default values', function () {
+
+ beforeEach(function () {
c.reopen({hosts: [{},{},{}]});
c.clearStep();
+ });
+
+ it('hosts are empty', function () {
expect(c.get('hosts.length')).to.equal(0);
+ });
+ it('status is `info`', function () {
expect(c.get('status')).to.equal('info');
+ });
+ it('progress is 0', function () {
expect(c.get('progress')).to.equal('0');
+ });
+ it('numPolls is 1', function () {
expect(c.get('numPolls')).to.equal(1);
});
});
@@ -1287,11 +1295,18 @@ describe('App.InstallerStep9Controller', function () {
});
describe('#submit', function () {
- it('should call App.router.send', function () {
+
+ beforeEach(function () {
sinon.stub(App.router, 'send', Em.K);
+ });
+
+ afterEach(function () {
+ App.router.send.restore();
+ });
+
+ it('should call App.router.send', function () {
c.submit();
expect(App.router.send.calledWith('next')).to.equal(true);
- App.router.send.restore();
});
});
@@ -1336,9 +1351,11 @@ describe('App.InstallerStep9Controller', function () {
describe('#startPolling', function () {
beforeEach(function () {
sinon.stub(c, 'reloadErrorCallback', Em.K);
+ sinon.stub(c, 'doPolling', Em.K);
});
afterEach(function () {
c.reloadErrorCallback.restore();
+ c.doPolling.restore();
});
it('should set isSubmitDisabled to true', function () {
c.set('isSubmitDisabled', false);
@@ -1346,10 +1363,8 @@ describe('App.InstallerStep9Controller', function () {
expect(c.get('isSubmitDisabled')).to.equal(true);
});
it('should call doPolling', function () {
- sinon.stub(c, 'doPolling', Em.K);
c.startPolling();
expect(c.doPolling.calledOnce).to.equal(true);
- c.doPolling.restore();
});
});
@@ -1375,13 +1390,6 @@ describe('App.InstallerStep9Controller', function () {
expect(c.getLogsByRequest.calledWith(true, 3)).to.equal(true);
});
- it('should set POLL_INTERVAL to 1 if testMode enabled', function () {
- sinon.stub(App, 'get', function(k) { if ('testMode' === k) return true; return Em.get(App, k);});
- c.loadLogData();
- expect(c.get('POLL_INTERVAL')).to.equal(1);
- App.get.restore();
- });
-
});
describe('#loadCurrentTaskLog', function () {
@@ -1390,23 +1398,25 @@ describe('App.InstallerStep9Controller', function () {
c.set('wizardController', Em.Object.create({
getDBProperty: Em.K
}));
+ sinon.stub(c, 'togglePreviousSteps', Em.K);
});
afterEach(function () {
c.loadLogData.restore();
+ c.togglePreviousSteps.restore();
});
+
it('shouldn\'t call App.ajax.send if no currentOpenTaskId', function () {
c.set('currentOpenTaskId', null);
c.loadCurrentTaskLog();
expect(App.ajax.send.called).to.equal(false);
});
+
it('should call App.ajax.send with provided data', function () {
- sinon.stub(c, 'togglePreviousSteps', Em.K);
c.set('currentOpenTaskId', 1);
c.set('currentOpenTaskRequestId', 2);
c.set('content', {cluster: {name: 3}});
c.loadCurrentTaskLog();
expect(App.ajax.send.args[0][0].data).to.eql({taskId: 1, requestId: 2, clusterName: 3});
- c.togglePreviousSteps.restore();
});
});
@@ -1535,12 +1545,15 @@ describe('App.InstallerStep9Controller', function () {
});
describe('#navigateStep', function () {
+
beforeEach(function () {
sinon.stub(c, 'togglePreviousSteps', Em.K);
sinon.stub(c, 'loadStep', Em.K);
sinon.stub(c, 'loadLogData', Em.K);
sinon.stub(c, 'startPolling', Em.K);
+ sinon.stub(App, 'get', function(k) {if('testMode' === k) return false; return Em.get(App, k);});
});
+
afterEach(function () {
c.togglePreviousSteps.restore();
c.loadStep.restore();
@@ -1548,16 +1561,8 @@ describe('App.InstallerStep9Controller', function () {
c.startPolling.restore();
App.get.restore();
});
- it('should set custom data in testMode', function () {
- sinon.stub(App, 'get', function(k) {if('testMode' === k) return true; return Em.get(App, k);});
- c.reopen({content: {cluster: {status: 'st', isCompleted: true, requestId: 0}}});
- c.navigateStep();
- expect(c.get('content.cluster.status')).to.equal('PENDING');
- expect(c.get('content.cluster.isCompleted')).to.equal(false);
- expect(c.get('content.cluster.requestId')).to.equal(1);
- });
+
it('isCompleted = true, requestId = 1', function () {
- sinon.stub(App, 'get', function(k) {if('testMode' === k) return false; return Em.get(App, k);});
c.reopen({content: {cluster: {isCompleted: true, requestId: 1}}});
c.navigateStep();
expect(c.loadStep.calledOnce).to.equal(true);
@@ -1565,21 +1570,18 @@ describe('App.InstallerStep9Controller', function () {
expect(c.get('progress')).to.equal('100');
});
it('isCompleted = false, requestId = 1, status = INSTALL FAILED', function () {
- sinon.stub(App, 'get', function(k) {if('testMode' === k) return false; return Em.get(App, k);});
c.reopen({content: {cluster: {status: 'INSTALL FAILED', isCompleted: false, requestId: 1}}});
c.navigateStep();
expect(c.loadStep.calledOnce).to.equal(true);
expect(c.loadLogData.calledWith(false)).to.equal(true);
});
it('isCompleted = false, requestId = 1, status = START FAILED', function () {
- sinon.stub(App, 'get', function(k) {if('testMode' === k) return false; return Em.get(App, k);});
c.reopen({content: {cluster: {status: 'START FAILED', isCompleted: false, requestId: 1}}});
c.navigateStep();
expect(c.loadStep.calledOnce).to.equal(true);
expect(c.loadLogData.calledWith(false)).to.equal(true);
});
it('isCompleted = false, requestId = 1, status = OTHER', function () {
- sinon.stub(App, 'get', function(k) {if('testMode' === k) return false; return Em.get(App, k);});
c.reopen({content: {cluster: {status: 'STARTED', isCompleted: false, requestId: 1}}});
c.navigateStep();
expect(c.loadStep.calledOnce).to.equal(true);
@@ -1633,15 +1635,30 @@ describe('App.InstallerStep9Controller', function () {
}
}
]).forEach(function (test) {
- it(test.m, function () {
- c.launchStartServicesSuccessCallback(test.jsonData);
- expect(c.hostHasClientsOnly.calledWith(test.e.hostHasClientsOnly)).to.equal(true);
- expect(c.saveClusterStatus.calledWith(test.e.clusterStatus)).to.equal(true);
+ describe(test.m, function () {
+
+ beforeEach(function () {
+ c.launchStartServicesSuccessCallback(test.jsonData);
+ });
+
+ it('hostHasClientsOnly is called with valid arguments', function () {
+ expect(c.hostHasClientsOnly.calledWith(test.e.hostHasClientsOnly)).to.equal(true);
+ });
+
+ it('saveClusterStatus is called with valid arguments', function () {
+ expect(c.saveClusterStatus.calledWith(test.e.clusterStatus)).to.equal(true);
+ });
+
+
if (test.e.status) {
- expect(c.get('status')).to.equal(test.e.status);
+ it('status is valid', function () {
+ expect(c.get('status')).to.equal(test.e.status);
+ });
}
if (test.e.progress) {
- expect(c.get('progress')).to.equal(test.e.progress);
+ it('progress is valid', function () {
+ expect(c.get('progress')).to.equal(test.e.progress);
+ });
}
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/controllers/wizard_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard_test.js b/ambari-web/test/controllers/wizard_test.js
index 316ec2d..dced13c 100644
--- a/ambari-web/test/controllers/wizard_test.js
+++ b/ambari-web/test/controllers/wizard_test.js
@@ -56,21 +56,21 @@ describe('App.WizardController', function () {
// isStep0 ... isStep10 tests
App.WizardController1 = App.WizardController.extend({currentStep:''});
var tests = [];
- for(var i = 0; i < totalSteps; i++) {
+ for (var i = 0; i < totalSteps; i++) {
var n = ruller.slice(0);
- n.splice(i,1);
- tests.push({i:i,n:n});
+ n.splice(i, 1);
+ tests.push({i: i, n: n});
}
- tests.forEach(function(test) {
- describe('isStep'+test.i, function() {
+ tests.forEach(function (test) {
+ describe('isStep' + test.i, function () {
var w = App.WizardController1.create();
w.set('currentStep', test.i);
- it('Current Step is ' + test.i + ', so isStep' + test.i + ' is TRUE', function() {
- expect(w.get('isStep'+ test.i)).to.equal(true);
+ it('Current Step is ' + test.i + ', so isStep' + test.i + ' is TRUE', function () {
+ expect(w.get('isStep' + test.i)).to.equal(true);
});
- test.n.forEach(function(indx) {
- it('Current Step is ' + test.i + ', so isStep' + indx + ' is FALSE', function() {
- expect(w.get('isStep'+ indx)).to.equal(false);
+ test.n.forEach(function (indx) {
+ it('Current Step is ' + test.i + ', so isStep' + indx + ' is FALSE', function () {
+ expect(w.get('isStep' + indx)).to.equal(false);
});
});
});
@@ -93,13 +93,19 @@ describe('App.WizardController', function () {
});
describe('#launchBootstrapSuccessCallback', function() {
+ var params = {popup: {finishLoading: function(){}}};
+ beforeEach(function () {
+ sinon.spy(params.popup, "finishLoading");
+ });
+
+ afterEach(function () {
+ params.popup.finishLoading.restore();
+ });
+
it('Save bootstrapRequestId', function() {
var data = {requestId: 123, status: 'SUCCESS', log: 'ok'};
- var params = {popup: {finishLoading: function(){}}};
- sinon.spy(params.popup, "finishLoading");
wizardController.launchBootstrapSuccessCallback(data, {}, params);
expect(params.popup.finishLoading.calledWith(123, null, 'SUCCESS', 'ok')).to.be.true;
- params.popup.finishLoading.restore();
});
});
@@ -125,6 +131,7 @@ describe('App.WizardController', function () {
sinon.stub(wizardController, 'get')
.withArgs('installOptionsTemplate').returns({useSsh: true})
.withArgs('installWindowsOptionsTemplate').returns({useSsh: false});
+ this.stub = sinon.stub(App, 'get');
});
afterEach(function () {
@@ -134,7 +141,7 @@ describe('App.WizardController', function () {
cases.forEach(function (item) {
it(title.format(item.expected), function () {
- sinon.stub(App, 'get').withArgs('isHadoopWindowsStack').returns(item.isHadoopWindowsStack);
+ this.stub.withArgs('isHadoopWindowsStack').returns(item.isHadoopWindowsStack);
expect(wizardController.getInstallOptions()).to.eql(item.expected);
});
});
@@ -156,12 +163,23 @@ describe('App.WizardController', function () {
App.get.restore();
});
- it('should clear install options', function () {
- wizardController.clearInstallOptions();
- expect(wizardController.get('content.installOptions')).to.eql(wizardController.get('installOptionsTemplate'));
- expect(wizardController.get('content.hosts')).to.eql({});
- expect(wizardController.getDBProperty('installOptions')).to.eql(wizardController.get('installOptionsTemplate'));
- expect(wizardController.getDBProperty('hosts')).to.eql({});
+ describe('should clear install options', function () {
+
+ beforeEach(function () {
+ wizardController.clearInstallOptions();
+ });
+ it('content.installOptions', function () {
+ expect(wizardController.get('content.installOptions')).to.eql(wizardController.get('installOptionsTemplate'));
+ });
+ it('content.hosts', function () {
+ expect(wizardController.get('content.hosts')).to.eql({});
+ });
+ it('installOptions', function () {
+ expect(wizardController.getDBProperty('installOptions')).to.eql(wizardController.get('installOptionsTemplate'));
+ });
+ it('hosts', function () {
+ expect(wizardController.getDBProperty('hosts')).to.eql({});
+ });
});
});
@@ -250,13 +268,21 @@ describe('App.WizardController', function () {
afterEach(function(){
App.ModalPopup.show.restore();
});
- it('should set error', function () {
- sinon.stub(App.ModalPopup,'show', function (data) {
- data.finishLoading.call(c);
+
+ describe('errors', function () {
+
+ beforeEach(function () {
+ sinon.stub(App.ModalPopup,'show', function (data) {
+ data.finishLoading.call(c);
+ });
+ });
+
+ it('should set error', function () {
+ c.showLaunchBootstrapPopup(Em.K);
+ expect(c.get('isError')).to.be.true;
});
- c.showLaunchBootstrapPopup(Em.K);
- expect(c.get('isError')).to.be.true;
});
+
describe('#finishLoading', function () {
var callback = sinon.spy(),
stepController = App.get('router.wizardStep3Controller'),
@@ -346,18 +372,36 @@ describe('App.WizardController', function () {
c.callback.restore();
});
cases.forEach(function (item) {
- it(item.title, function () {
+ describe(item.title, function () {
var wizardControllerProperties = Em.keys(item.wizardControllerProperties),
stepControllerProperties = Em.keys(item.stepControllerProperties);
- sinon.stub(App.ModalPopup,'show', function (data) {
- data.finishLoading.call(c, item.requestId, item.serverError, item.status, item.log);
+
+ beforeEach(function () {
+ sinon.stub(App.ModalPopup,'show', function (data) {
+ data.finishLoading.call(c, item.requestId, item.serverError, item.status, item.log);
+ });
+ c.showLaunchBootstrapPopup(c.callback);
+ });
+
+ it('wizardControllerProperties are valid', function () {
+ expect(c.getProperties.apply(c, wizardControllerProperties)).to.eql(item.wizardControllerProperties);
+ });
+
+ it('stepControllerProperties are valid', function () {
+ expect(stepController.getProperties.apply(stepController, stepControllerProperties)).to.eql(item.stepControllerProperties);
+ });
+
+ it('bootStatus is valid', function () {
+ expect(stepController.get('hosts').mapProperty('bootStatus').uniq()).to.eql([item.bootStatus]);
+ });
+
+ it('callback is called needed number of times', function () {
+ expect(c.callback.callCount).to.equal(item.callbackCallCount);
+ });
+
+ it('hide is called needed number of times', function () {
+ expect(c.hide.callCount).to.equal(item.hideCallCount);
});
- c.showLaunchBootstrapPopup(c.callback);
- expect(c.getProperties.apply(c, wizardControllerProperties)).to.eql(item.wizardControllerProperties);
- expect(stepController.getProperties.apply(stepController, stepControllerProperties)).to.eql(item.stepControllerProperties);
- expect(stepController.get('hosts').mapProperty('bootStatus').uniq()).to.eql([item.bootStatus]);
- expect(c.callback.callCount).to.equal(item.callbackCallCount);
- expect(c.hide.callCount).to.equal(item.hideCallCount);
});
});
});
@@ -584,15 +628,21 @@ describe('App.WizardController', function () {
});
describe('#save', function () {
- it('should save data', function () {
- var res;
+ var res;
+ beforeEach(function () {
sinon.stub(wizardController,'setDBProperty', function(data){
res = data;
});
sinon.stub(wizardController,'toJSInstance').returns('val');
- wizardController.save('name');
+ });
+
+ afterEach(function () {
wizardController.setDBProperty.restore();
wizardController.toJSInstance.restore();
+ });
+
+ it('should save data', function () {
+ wizardController.save('name');
expect(res).to.be.equal('name');
});
});
@@ -1459,6 +1509,7 @@ describe('App.WizardController', function () {
serviceName: 's1'
})
]));
+ this.stub = sinon.stub(App, 'get');
});
afterEach(function () {
App.get.restore();
@@ -1468,13 +1519,13 @@ describe('App.WizardController', function () {
wizardController.loadConfigThemeForServices.restore();
});
it('Should load config themes', function() {
- sinon.stub(App, 'get').returns(true);
+ this.stub.returns(true);
wizardController.loadConfigThemes().then(function(data) {
expect().to.be.undefined;
});
});
- it('Should load config themes', function() {
- sinon.stub(App, 'get').returns(false);
+ it('Should load config themes (2)', function() {
+ this.stub.returns(false);
wizardController.loadConfigThemes().then(function(data) {
expect().to.be.undefined;
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/data/HDP2.2/site_properties_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/data/HDP2.2/site_properties_test.js b/ambari-web/test/data/HDP2.2/site_properties_test.js
index 1cde085..a5e0e18 100644
--- a/ambari-web/test/data/HDP2.2/site_properties_test.js
+++ b/ambari-web/test/data/HDP2.2/site_properties_test.js
@@ -43,16 +43,12 @@ describe('hdp2SiteProperties', function () {
* showLabel
* unit
*/
- it('Check attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Stack driven attributes should be undefined ', function () {
- expect(siteProperty.isVisible).to.equal(undefined);
- expect(siteProperty.value).to.equal(undefined);
- expect(siteProperty.recommendedValue).to.equal(undefined);
- expect(siteProperty.description).to.equal(undefined);
- expect(siteProperty.isReconfigurable).to.equal(undefined);
- expect(siteProperty.isRequired).to.equal(undefined);
- expect(siteProperty.displayName).to.equal(undefined);
- expect(siteProperty.showLabel).to.equal(undefined);
- expect(siteProperty.unit).to.equal(undefined);
+ describe('Check attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Stack driven attributes should be undefined ', function () {
+ ['isVisible', 'value', 'recommendedValue', 'description', 'isReconfigurable', 'isRequired', 'displayName', 'showLabel', 'unit'].forEach(function (p) {
+ it(p, function () {
+ expect(siteProperty[p]).to.not.exist;
+ });
+ });
});
/**
@@ -68,9 +64,13 @@ describe('hdp2SiteProperties', function () {
* name
* filename
*/
- it('Check primary attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Attributes that uniquely represent a property should be defined ', function () {
- expect(siteProperty.name).to.not.equal(undefined);
- expect(siteProperty.filename).to.not.equal(undefined);
+ describe('Check primary attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Attributes that uniquely represent a property should be defined ', function () {
+ it('name', function () {
+ expect(siteProperty.name).to.not.equal(undefined);
+ });
+ it('filename', function () {
+ expect(siteProperty.filename).to.not.equal(undefined);
+ });
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/data/HDP2.3/site_properties_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/data/HDP2.3/site_properties_test.js b/ambari-web/test/data/HDP2.3/site_properties_test.js
index 263ad6a..b94e0b2 100644
--- a/ambari-web/test/data/HDP2.3/site_properties_test.js
+++ b/ambari-web/test/data/HDP2.3/site_properties_test.js
@@ -43,16 +43,12 @@ describe('hdp2SiteProperties', function () {
* showLabel
* unit
*/
- it('Check attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Stack driven attributes should be undefined ', function () {
- expect(siteProperty.isVisible).to.equal(undefined);
- expect(siteProperty.value).to.equal(undefined);
- expect(siteProperty.recommendedValue).to.equal(undefined);
- expect(siteProperty.description).to.equal(undefined);
- expect(siteProperty.isReconfigurable).to.equal(undefined);
- expect(siteProperty.isRequired).to.equal(undefined);
- expect(siteProperty.displayName).to.equal(undefined);
- expect(siteProperty.showLabel).to.equal(undefined);
- expect(siteProperty.unit).to.equal(undefined);
+ describe('Check attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Stack driven attributes should be undefined ', function () {
+ ['isVisible', 'value', 'recommendedValue', 'description', 'isReconfigurable', 'isRequired', 'displayName', 'showLabel', 'unit'].forEach(function (p) {
+ it(p, function () {
+ expect(siteProperty[p]).to.not.exist;
+ });
+ });
});
@@ -69,9 +65,13 @@ describe('hdp2SiteProperties', function () {
* name
* filename
*/
- it('Check primary attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Attributes that uniquely represent a property should be defined ', function () {
- expect(siteProperty.name).to.not.equal(undefined);
- expect(siteProperty.filename).to.not.equal(undefined);
+ describe('Check primary attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Attributes that uniquely represent a property should be defined ', function () {
+ it('name', function () {
+ expect(siteProperty.name).to.not.equal(undefined);
+ });
+ it('filename', function () {
+ expect(siteProperty.filename).to.not.equal(undefined);
+ });
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/data/HDP2/site_properties_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/data/HDP2/site_properties_test.js b/ambari-web/test/data/HDP2/site_properties_test.js
index 89e0ea1..26be9c3 100644
--- a/ambari-web/test/data/HDP2/site_properties_test.js
+++ b/ambari-web/test/data/HDP2/site_properties_test.js
@@ -43,16 +43,12 @@ describe('hdp2SiteProperties', function () {
* showLabel
* unit
*/
- it('Check attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Stack driven attributes should be undefined ', function () {
- expect(siteProperty.isVisible).to.equal(undefined);
- expect(siteProperty.value).to.equal(undefined);
- expect(siteProperty.recommendedValue).to.equal(undefined);
- expect(siteProperty.description).to.equal(undefined);
- expect(siteProperty.isReconfigurable).to.equal(undefined);
- expect(siteProperty.isRequired).to.equal(undefined);
- expect(siteProperty.displayName).to.equal(undefined);
- expect(siteProperty.showLabel).to.equal(undefined);
- expect(siteProperty.unit).to.equal(undefined);
+ describe('Check attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Stack driven attributes should be undefined ', function () {
+ ['isVisible', 'value', 'recommendedValue', 'description', 'isReconfigurable', 'isRequired', 'displayName', 'showLabel', 'unit'].forEach(function (p) {
+ it(p, function () {
+ expect(siteProperty[p]).to.not.exist;
+ });
+ });
});
/**
@@ -68,9 +64,13 @@ describe('hdp2SiteProperties', function () {
* name
* filename
*/
- it('Check primary attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Attributes that uniquely represent a property should be defined ', function () {
- expect(siteProperty.name).to.not.equal(undefined);
- expect(siteProperty.filename).to.not.equal(undefined);
+ describe('Check primary attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Attributes that uniquely represent a property should be defined ', function () {
+ it('name', function () {
+ expect(siteProperty.name).to.not.equal(undefined);
+ });
+ it('filename', function () {
+ expect(siteProperty.filename).to.not.equal(undefined);
+ });
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/mappers/alert_definition_summary_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/alert_definition_summary_mapper_test.js b/ambari-web/test/mappers/alert_definition_summary_mapper_test.js
index 946839a..9208766 100644
--- a/ambari-web/test/mappers/alert_definition_summary_mapper_test.js
+++ b/ambari-web/test/mappers/alert_definition_summary_mapper_test.js
@@ -21,7 +21,7 @@ require('mappers/alert_definition_summary_mapper');
describe('App.alertDefinitionSummaryMapper', function () {
- describe('#map', function() {
+ describe('#map', function () {
var testModels = [
App.AlertDefinition.createRecord({id: 1, enabled: true, type: 'PORT'}),
@@ -36,8 +36,18 @@ describe('App.alertDefinitionSummaryMapper', function () {
{
definition_id: 1,
summary: {
- OK: {count: 1, original_timestamp: 1, maintenance_count: 0, latest_text : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"},
- WARNING: {count: 1, original_timestamp: 2, maintenance_count: 0, latest_text : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"},
+ OK: {
+ count: 1,
+ original_timestamp: 1,
+ maintenance_count: 0,
+ latest_text: "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"
+ },
+ WARNING: {
+ count: 1,
+ original_timestamp: 2,
+ maintenance_count: 0,
+ latest_text: "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"
+ },
CRITICAL: {count: 0, original_timestamp: 0, maintenance_count: 1},
UNKNOWN: {count: 0, original_timestamp: 0, maintenance_count: 0}
}
@@ -45,8 +55,18 @@ describe('App.alertDefinitionSummaryMapper', function () {
{
definition_id: 2,
summary: {
- OK: {count: 1, original_timestamp: 1, maintenance_count: 0, latest_text : "HTTP 200 response in 0.000 seconds"},
- WARNING: {count: 5, original_timestamp: 2, maintenance_count: 0, latest_text : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"},
+ OK: {
+ count: 1,
+ original_timestamp: 1,
+ maintenance_count: 0,
+ latest_text: "HTTP 200 response in 0.000 seconds"
+ },
+ WARNING: {
+ count: 5,
+ original_timestamp: 2,
+ maintenance_count: 0,
+ latest_text: "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"
+ },
CRITICAL: {count: 1, original_timestamp: 1, maintenance_count: 0},
UNKNOWN: {count: 1, original_timestamp: 3, maintenance_count: 0}
}
@@ -54,25 +74,50 @@ describe('App.alertDefinitionSummaryMapper', function () {
{
definition_id: 3,
summary: {
- OK: {count: 1, original_timestamp: 1, maintenance_count: 0, latest_text : "HTTP 200 response in 0.000 seconds"},
+ OK: {
+ count: 1,
+ original_timestamp: 1,
+ maintenance_count: 0,
+ latest_text: "HTTP 200 response in 0.000 seconds"
+ },
WARNING: {count: 2, original_timestamp: 2, maintenance_count: 2},
- CRITICAL: {count: 3, original_timestamp: 4, maintenance_count: 0, latest_text : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"},
+ CRITICAL: {
+ count: 3,
+ original_timestamp: 4,
+ maintenance_count: 0,
+ latest_text: "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"
+ },
UNKNOWN: {count: 4, original_timestamp: 3, maintenance_count: 0}
}
},
{
definition_id: 4,
summary: {
- OK: {count: 4, original_timestamp: 1, maintenance_count: 0, latest_text : "HTTP 200 response in 0.000 seconds"},
+ OK: {
+ count: 4,
+ original_timestamp: 1,
+ maintenance_count: 0,
+ latest_text: "HTTP 200 response in 0.000 seconds"
+ },
WARNING: {count: 3, original_timestamp: 2, maintenance_count: 0},
CRITICAL: {count: 2, original_timestamp: 1, maintenance_count: 0},
- UNKNOWN: {count: 1, original_timestamp: 2, maintenance_count: 0, latest_text : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}
+ UNKNOWN: {
+ count: 1,
+ original_timestamp: 2,
+ maintenance_count: 0,
+ latest_text: "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"
+ }
}
},
{
definition_id: 5,
summary: {
- OK: {count: 1, original_timestamp: 1, maintenance_count: 0, latest_text : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"},
+ OK: {
+ count: 1,
+ original_timestamp: 1,
+ maintenance_count: 0,
+ latest_text: "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"
+ },
WARNING: {count: 1, original_timestamp: 2, maintenance_count: 0},
CRITICAL: {count: 1, original_timestamp: 3, maintenance_count: 0},
UNKNOWN: {count: 1, original_timestamp: 4, maintenance_count: 0}
@@ -81,45 +126,105 @@ describe('App.alertDefinitionSummaryMapper', function () {
]
};
- beforeEach(function() {
-
- sinon.stub(App.AlertDefinition, 'find', function() {return testModels;});
-
+ beforeEach(function () {
+ sinon.stub(App.AlertDefinition, 'find').returns(testModels);
+ App.alertDefinitionSummaryMapper.map(dataToMap);
});
- afterEach(function() {
-
+ afterEach(function () {
App.AlertDefinition.find.restore();
-
});
- it('should map summary info for each alert', function() {
-
- App.alertDefinitionSummaryMapper.map(dataToMap);
+ it('should map summary info for 1st alert', function () {
expect(App.AlertDefinition.find().findProperty('id', 1).get('lastTriggered')).to.equal(2);
- expect(App.AlertDefinition.find().findProperty('id', 1).get('summary')).to.eql({OK: {count: 1, maintenanceCount: 0, latestText : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}, WARNING: {count: 1, maintenanceCount: 0, latestText : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}, CRITICAL: {count: 0, maintenanceCount: 1}, UNKNOWN: {count: 0, maintenanceCount: 0}});
+ expect(App.AlertDefinition.find().findProperty('id', 1).get('summary')).to.eql({
+ OK: {
+ count: 1,
+ maintenanceCount: 0,
+ latestText: "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"
+ },
+ WARNING: {
+ count: 1,
+ maintenanceCount: 0,
+ latestText: "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"
+ },
+ CRITICAL: {count: 0, maintenanceCount: 1},
+ UNKNOWN: {count: 0, maintenanceCount: 0}
+ });
+ });
+ it('should map summary info for 2nd alert', function () {
expect(App.AlertDefinition.find().findProperty('id', 2).get('lastTriggered')).to.equal(3);
- expect(App.AlertDefinition.find().findProperty('id', 2).get('summary')).to.eql({OK: {count: 1, maintenanceCount: 0, latestText : "HTTP 200 response in 0.000 seconds"}, WARNING: {count: 5, maintenanceCount: 0, latestText : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}, CRITICAL: {count: 1, maintenanceCount: 0}, UNKNOWN: {count: 1, maintenanceCount: 0}});
+ expect(App.AlertDefinition.find().findProperty('id', 2).get('summary')).to.eql({
+ OK: {
+ count: 1,
+ maintenanceCount: 0,
+ latestText: "HTTP 200 response in 0.000 seconds"
+ },
+ WARNING: {
+ count: 5,
+ maintenanceCount: 0,
+ latestText: "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"
+ },
+ CRITICAL: {count: 1, maintenanceCount: 0},
+ UNKNOWN: {count: 1, maintenanceCount: 0}
+ });
+ });
+ it('should map summary info for 3rd alert', function () {
expect(App.AlertDefinition.find().findProperty('id', 3).get('lastTriggered')).to.equal(4);
- expect(App.AlertDefinition.find().findProperty('id', 3).get('summary')).to.eql({OK: {count: 1, maintenanceCount: 0, latestText : "HTTP 200 response in 0.000 seconds"}, WARNING: {count: 2, maintenanceCount: 2}, CRITICAL: {count: 3, maintenanceCount: 0, latestText : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}, UNKNOWN: {count: 4, maintenanceCount: 0}});
+ expect(App.AlertDefinition.find().findProperty('id', 3).get('summary')).to.eql({
+ OK: {
+ count: 1,
+ maintenanceCount: 0,
+ latestText: "HTTP 200 response in 0.000 seconds"
+ },
+ WARNING: {count: 2, maintenanceCount: 2},
+ CRITICAL: {
+ count: 3,
+ maintenanceCount: 0,
+ latestText: "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"
+ },
+ UNKNOWN: {count: 4, maintenanceCount: 0}
+ });
+ });
+ it('should map summary info for 4th alert', function () {
expect(App.AlertDefinition.find().findProperty('id', 4).get('lastTriggered')).to.equal(2);
- expect(App.AlertDefinition.find().findProperty('id', 4).get('summary')).to.eql({OK: {count: 4, maintenanceCount: 0, latestText : "HTTP 200 response in 0.000 seconds"}, WARNING: {count: 3, maintenanceCount: 0}, CRITICAL: {count: 2, maintenanceCount: 0}, UNKNOWN: {count: 1, maintenanceCount: 0, latestText : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}});
+ expect(App.AlertDefinition.find().findProperty('id', 4).get('summary')).to.eql({
+ OK: {
+ count: 4,
+ maintenanceCount: 0,
+ latestText: "HTTP 200 response in 0.000 seconds"
+ },
+ WARNING: {count: 3, maintenanceCount: 0},
+ CRITICAL: {count: 2, maintenanceCount: 0},
+ UNKNOWN: {
+ count: 1,
+ maintenanceCount: 0,
+ latestText: "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"
+ }
+ });
+ });
+ it('should map summary info for 5th alert', function () {
expect(App.AlertDefinition.find().findProperty('id', 5).get('lastTriggered')).to.equal(4);
- expect(App.AlertDefinition.find().findProperty('id', 5).get('summary')).to.eql({OK: {count: 1, maintenanceCount: 0, latestText : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}, WARNING: {count: 1, maintenanceCount: 0}, CRITICAL: {count: 1, maintenanceCount: 0}, UNKNOWN: {count: 1, maintenanceCount: 0}});
-
+ expect(App.AlertDefinition.find().findProperty('id', 5).get('summary')).to.eql({
+ OK: {
+ count: 1,
+ maintenanceCount: 0,
+ latestText: "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"
+ },
+ WARNING: {count: 1, maintenanceCount: 0},
+ CRITICAL: {count: 1, maintenanceCount: 0},
+ UNKNOWN: {count: 1, maintenanceCount: 0}
+ });
});
it('should clear summary for disabled definitions', function () {
-
- App.alertDefinitionSummaryMapper.map(dataToMap);
expect(App.AlertDefinition.find().findProperty('id', 6).get('summary')).to.eql({});
-
});
});
-});
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/mappers/configs/service_config_version_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/configs/service_config_version_mapper_test.js b/ambari-web/test/mappers/configs/service_config_version_mapper_test.js
index c118ada..c38c5db 100644
--- a/ambari-web/test/mappers/configs/service_config_version_mapper_test.js
+++ b/ambari-web/test/mappers/configs/service_config_version_mapper_test.js
@@ -88,30 +88,69 @@ describe.skip('App.serviceConfigVersionsMapper', function () {
expect(App.ServiceConfigVersion.find().get('length')).to.equal(0);
});
- it('should load data to model', function() {
- App.serviceConfigVersionsMapper.map(json);
- expect(App.ServiceConfigVersion.find().get('length')).to.equal(2);
- expect(App.ServiceConfigVersion.find().mapProperty('id')).to.eql(['SERVICE1_1','SERVICE2_4']);
+ describe('should load data to model', function() {
- //SERVICE1_1
- expect(App.ServiceConfigVersion.find('SERVICE1_1').get('createTime')).to.eql(1425979244738);
- expect(App.ServiceConfigVersion.find('SERVICE1_1').get('groupId')).to.eql(-1);
- expect(App.ServiceConfigVersion.find('SERVICE1_1').get('hosts')).to.eql(defaultAllHosts);
- expect(App.ServiceConfigVersion.find('SERVICE1_1').get('isCurrent')).to.be.true;
- expect(App.ServiceConfigVersion.find('SERVICE1_1').get('version')).to.eql(1);
- expect(App.ServiceConfigVersion.find('SERVICE1_1').get('notes')).to.eql("Initial configurations for SERVICE1");
- expect(App.ServiceConfigVersion.find('SERVICE1_1').get('serviceName')).to.eql("SERVICE1");
- expect(App.ServiceConfigVersion.find('SERVICE1_1').get('author')).to.eql("admin");
+ beforeEach(function () {
+ App.serviceConfigVersionsMapper.map(json);
+ });
- //SERVICE1_2
- expect(App.ServiceConfigVersion.find('SERVICE2_4').get('createTime')).to.eql(1426088137115);
- expect(App.ServiceConfigVersion.find('SERVICE2_4').get('groupId')).to.eql(2);
- expect(App.ServiceConfigVersion.find('SERVICE2_4').get('hosts')).to.eql(["host1"]);
- expect(App.ServiceConfigVersion.find('SERVICE2_4').get('isCurrent')).to.be.false;
- expect(App.ServiceConfigVersion.find('SERVICE2_4').get('version')).to.eql(4);
- expect(App.ServiceConfigVersion.find('SERVICE2_4').get('notes')).to.eql("");
- expect(App.ServiceConfigVersion.find('SERVICE2_4').get('serviceName')).to.eql("SERVICE2");
- expect(App.ServiceConfigVersion.find('SERVICE2_4').get('author')).to.eql("admin");
+ it('two versions are mapped', function () {
+ expect(App.ServiceConfigVersion.find().get('length')).to.equal(2);
+ });
+
+ it('services have correct ids', function () {
+ expect(App.ServiceConfigVersion.find().mapProperty('id')).to.eql(['SERVICE1_1','SERVICE2_4']);
+ });
+
+ it('SERVICE1_1 createTime', function () {
+ expect(App.ServiceConfigVersion.find('SERVICE1_1').get('createTime')).to.equal(1425979244738);
+ });
+ it('SERVICE1_1 groupId', function () {
+ expect(App.ServiceConfigVersion.find('SERVICE1_1').get('groupId')).to.equal(-1);
+ });
+ it('SERVICE1_1 hosts', function () {
+ expect(App.ServiceConfigVersion.find('SERVICE1_1').get('hosts')).to.eql(defaultAllHosts);
+ });
+ it('SERVICE1_1 isCurrent', function () {
+ expect(App.ServiceConfigVersion.find('SERVICE1_1').get('isCurrent')).to.be.true;
+ });
+ it('SERVICE1_1 version', function () {
+ expect(App.ServiceConfigVersion.find('SERVICE1_1').get('version')).to.equal(1);
+ });
+ it('SERVICE1_1 notes', function () {
+ expect(App.ServiceConfigVersion.find('SERVICE1_1').get('notes')).to.equal("Initial configurations for SERVICE1");
+ });
+ it('SERVICE1_1 serviceName', function () {
+ expect(App.ServiceConfigVersion.find('SERVICE1_1').get('serviceName')).to.equal("SERVICE1");
+ });
+ it('SERVICE1_1 author', function () {
+ expect(App.ServiceConfigVersion.find('SERVICE1_1').get('author')).to.equal("admin");
+ });
+
+ it('SERVICE2_4 createTime', function () {
+ expect(App.ServiceConfigVersion.find('SERVICE2_4').get('createTime')).to.equal(1426088137115);
+ });
+ it('SERVICE2_4 groupId', function () {
+ expect(App.ServiceConfigVersion.find('SERVICE2_4').get('groupId')).to.equal(2);
+ });
+ it('SERVICE2_4 hosts', function () {
+ expect(App.ServiceConfigVersion.find('SERVICE2_4').get('hosts')).to.eql(["host1"]);
+ });
+ it('SERVICE2_4 isCurrent', function () {
+ expect(App.ServiceConfigVersion.find('SERVICE2_4').get('isCurrent')).to.be.false;
+ });
+ it('SERVICE2_4 version', function () {
+ expect(App.ServiceConfigVersion.find('SERVICE2_4').get('version')).to.equal(4);
+ });
+ it('SERVICE2_4 notes', function () {
+ expect(App.ServiceConfigVersion.find('SERVICE2_4').get('notes')).to.equal("");
+ });
+ it('SERVICE2_4 serviceName', function () {
+ expect(App.ServiceConfigVersion.find('SERVICE2_4').get('serviceName')).to.equal("SERVICE2");
+ });
+ it('SERVICE2_4 author', function () {
+ expect(App.ServiceConfigVersion.find('SERVICE2_4').get('author')).to.equal("admin");
+ });
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/mappers/configs/stack_config_properties_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/configs/stack_config_properties_mapper_test.js b/ambari-web/test/mappers/configs/stack_config_properties_mapper_test.js
index 3c06724..81341bd 100644
--- a/ambari-web/test/mappers/configs/stack_config_properties_mapper_test.js
+++ b/ambari-web/test/mappers/configs/stack_config_properties_mapper_test.js
@@ -21,196 +21,250 @@ require('mappers/configs/stack_config_properties_mapper');
describe.skip('App.stackConfigPropertiesMapper', function () {
- describe("#map", function() {
-
- var json = { items: [
- {
- "StackServices" : {
- "service_name" : "HBASE",
- "stack_name" : "HDP",
- "stack_version" : "2.2",
- "config_types" : {
- "site1" : {
- "supports" : {
- "adding_forbidden" : "false",
- "do_not_extend" : "false",
- "final" : "true"
+ describe("#map", function () {
+
+ var json = {
+ items: [
+ {
+ "StackServices": {
+ "service_name": "HBASE",
+ "stack_name": "HDP",
+ "stack_version": "2.2",
+ "config_types": {
+ "site1": {
+ "supports": {
+ "adding_forbidden": "false",
+ "do_not_extend": "false",
+ "final": "true"
+ }
}
}
- }
- },
- "configurations" : [
- {
- "StackConfigurations" : {
- "final" : "false",
- "property_description" : "desc1",
- "property_name" : "p1",
- "property_display_name" : "P1",
- "property_type" : [ ],
- "property_value" : "v1",
- "service_name" : "s1",
- "stack_name" : "HDP",
- "stack_version" : "2.2",
- "type" : "site1.xml",
- "property_depends_on": [
+ },
+ "configurations": [
+ {
+ "StackConfigurations": {
+ "final": "false",
+ "property_description": "desc1",
+ "property_name": "p1",
+ "property_display_name": "P1",
+ "property_type": [],
+ "property_value": "v1",
+ "service_name": "s1",
+ "stack_name": "HDP",
+ "stack_version": "2.2",
+ "type": "site1.xml",
+ "property_depends_on": [
+ {
+ "name": "p5",
+ "type": "site5"
+ }
+ ],
+ "property_value_attributes": {
+ "type": "int",
+ "minimum": "512",
+ "maximum": "10240",
+ "unit": "MB"
+ }
+ },
+ "dependencies": [
{
- "name": "p5",
- "type": "site5"
+ "StackConfigurationDependency": {
+ "dependency_name": "p4",
+ "dependency_type": "site4"
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "StackServices": {
+ "service_name": "HDFS",
+ "stack_name": "HDP",
+ "stack_version": "2.2",
+ "config_types": {
+ "site2": {
+ "supports": {
+ "adding_forbidden": "false",
+ "do_not_extend": "false",
+ "final": "true"
+ }
+ },
+ "site3": {
+ "supports": {
+ "adding_forbidden": "false",
+ "do_not_extend": "false",
+ "final": "true"
}
- ],
- "property_value_attributes": {
- "type": "int",
- "minimum": "512",
- "maximum": "10240",
- "unit": "MB"
+ }
+ }
+ },
+ "configurations": [
+ {
+ "StackConfigurations": {
+ "final": "false",
+ "property_description": "desc3",
+ "property_name": "p2",
+ "property_display_name": "P2",
+ "property_type": [],
+ "property_value": "v2",
+ "service_name": "s2",
+ "stack_name": "HDP",
+ "stack_version": "2.2",
+ "type": "site2.xml"
}
},
- "dependencies": [
- {
- "StackConfigurationDependency" : {
- "dependency_name" : "p4",
- "dependency_type" : "site4"
- }
+ {
+ "StackConfigurations": {
+ "final": "false",
+ "property_description": "desc3",
+ "property_name": "p3",
+ "property_display_name": "P3",
+ "property_type": [],
+ "property_value": "v3",
+ "service_name": "s2",
+ "stack_name": "HDP",
+ "stack_version": "2.2",
+ "type": "site3.xml"
}
- ]
- }
- ]
- },
- {
- "StackServices" : {
- "service_name" : "HDFS",
- "stack_name" : "HDP",
- "stack_version" : "2.2",
- "config_types" : {
- "site2" : {
- "supports" : {
- "adding_forbidden" : "false",
- "do_not_extend" : "false",
- "final" : "true"
+ },
+ {
+ "StackConfigurations": {
+ "final": "false",
+ "property_description": "desc4",
+ "property_name": "p4",
+ "property_display_name": "P4",
+ "property_type": ["PASSWORD"],
+ "property_value": "v4",
+ "service_name": "s2",
+ "stack_name": "HDP",
+ "stack_version": "2.2",
+ "type": "site3.xml"
}
},
- "site3" : {
- "supports" : {
- "adding_forbidden" : "false",
- "do_not_extend" : "false",
- "final" : "true"
+ {
+ "StackConfigurations": {
+ "final": "false",
+ "property_description": "desc5",
+ "property_name": "p5",
+ "property_display_name": "P5",
+ "property_type": ["USER"],
+ "property_value": "v4",
+ "service_name": "s2",
+ "stack_name": "HDP",
+ "stack_version": "2.2",
+ "type": "site3.xml"
}
}
- }
- },
- "configurations" : [
- {
- "StackConfigurations" : {
- "final" : "false",
- "property_description" : "desc3",
- "property_name" : "p2",
- "property_display_name" : "P2",
- "property_type" : [ ],
- "property_value" : "v2",
- "service_name" : "s2",
- "stack_name" : "HDP",
- "stack_version" : "2.2",
- "type" : "site2.xml"
- }
- },
- {
- "StackConfigurations" : {
- "final" : "false",
- "property_description" : "desc3",
- "property_name" : "p3",
- "property_display_name" : "P3",
- "property_type" : [ ],
- "property_value" : "v3",
- "service_name" : "s2",
- "stack_name" : "HDP",
- "stack_version" : "2.2",
- "type" : "site3.xml"
- }
- },
- {
- "StackConfigurations" : {
- "final" : "false",
- "property_description" : "desc4",
- "property_name" : "p4",
- "property_display_name" : "P4",
- "property_type" : [ "PASSWORD" ],
- "property_value" : "v4",
- "service_name" : "s2",
- "stack_name" : "HDP",
- "stack_version" : "2.2",
- "type" : "site3.xml"
- }
- },
- {
- "StackConfigurations" : {
- "final" : "false",
- "property_description" : "desc5",
- "property_name" : "p5",
- "property_display_name" : "P5",
- "property_type" : [ "USER" ],
- "property_value" : "v4",
- "service_name" : "s2",
- "stack_name" : "HDP",
- "stack_version" : "2.2",
- "type" : "site3.xml"
- }
- }
- ]
- }
- ]};
+ ]
+ }
+ ]
+ };
beforeEach(function () {
App.resetDsStoreTypeMap(App.StackConfigProperty);
sinon.stub(App.store, 'commit', Em.K);
- sinon.stub(App.StackService, 'find', function() { return Em.A()});
+ sinon.stub(App.StackService, 'find', function () {
+ return Em.A()
+ });
});
- afterEach(function(){
+ afterEach(function () {
App.store.commit.restore();
App.StackService.find.restore();
});
- it('should not do anything as there is no json', function() {
+ it('should not do anything as there is no json', function () {
App.stackConfigPropertiesMapper.map(null);
expect(App.StackConfigProperty.find().get('length')).to.equal(0);
});
- it('should load data to model', function() {
- App.stackConfigPropertiesMapper.map(json);
- expect(App.StackConfigProperty.find().get('length')).to.equal(5);
- expect(App.StackConfigProperty.find().mapProperty('id')).to.eql(['p1__site1','p2__site2','p3__site3', 'p4__site3', 'p5__site3']);
-
- expect(App.StackConfigProperty.find('p1__site1').get('name')).to.eql('p1');
- expect(App.StackConfigProperty.find('p1__site1').get('displayName')).to.eql('P1');
- expect(App.StackConfigProperty.find('p1__site1').get('description')).to.eql('desc1');
- expect(App.StackConfigProperty.find('p1__site1').get('recommendedValue')).to.eql('v1');
- expect(App.StackConfigProperty.find('p1__site1').get('recommendedIsFinal')).to.be.false;
- expect(App.StackConfigProperty.find('p1__site1').get('serviceName')).to.eql('s1');
- expect(App.StackConfigProperty.find('p1__site1').get('stackName')).to.eql('HDP');
- expect(App.StackConfigProperty.find('p1__site1').get('stackVersion')).to.eql('2.2');
- expect(App.StackConfigProperty.find('p1__site1').get('type').toArray()).to.eql([]);
- expect(App.StackConfigProperty.find('p1__site1').get('fileName')).to.eql('site1.xml');
- expect(App.StackConfigProperty.find('p1__site1').get('propertyDependedBy')).to.eql([
- {
- "type": "site4",
- "name": "p4"
- }
- ]);
- expect(App.StackConfigProperty.find('p1__site1').get('propertyDependsOn')).to.eql([
- {
- "type": "site5",
- "name": "p5"
- }
- ]);
- expect(App.StackConfigProperty.find('p1__site1').get('valueAttributes')).to.eql({
- "type": "int",
- "minimum": "512",
- "maximum": "10240",
- "unit": "MB"
- });
- expect(App.StackConfigProperty.find('p1__site1').get('supportsFinal')).to.be.true;
+ describe('should load data to model', function () {
+
+ beforeEach(function () {
+ App.stackConfigPropertiesMapper.map(json);
+ });
+
+ it('5 properties are mapped', function () {
+ expect(App.StackConfigProperty.find().get('length')).to.equal(5);
+ });
+
+ it('ids are valid', function () {
+ expect(App.StackConfigProperty.find().mapProperty('id')).to.eql(['p1__site1', 'p2__site2', 'p3__site3', 'p4__site3', 'p5__site3']);
+ });
+
+ it('name is valid', function () {
+ expect(App.StackConfigProperty.find('p1__site1').get('name')).to.eql('p1');
+ });
+
+ it('displayName is valid', function () {
+ expect(App.StackConfigProperty.find('p1__site1').get('displayName')).to.eql('P1');
+ });
+
+ it('description is valid', function () {
+ expect(App.StackConfigProperty.find('p1__site1').get('description')).to.eql('desc1');
+ });
+
+ it('recommendedValue is valid', function () {
+ expect(App.StackConfigProperty.find('p1__site1').get('recommendedValue')).to.eql('v1');
+ });
+
+ it('recommendedIsFinal is valid', function () {
+ expect(App.StackConfigProperty.find('p1__site1').get('recommendedIsFinal')).to.be.false;
+ });
+
+ it('serviceName is valid', function () {
+ expect(App.StackConfigProperty.find('p1__site1').get('serviceName')).to.eql('s1');
+ });
+
+ it('stackName is valid', function () {
+ expect(App.StackConfigProperty.find('p1__site1').get('stackName')).to.eql('HDP');
+ });
+
+ it('stackVersion is valid', function () {
+ expect(App.StackConfigProperty.find('p1__site1').get('stackVersion')).to.eql('2.2');
+ });
+
+ it('type is valid', function () {
+ expect(App.StackConfigProperty.find('p1__site1').get('type').toArray()).to.eql([]);
+ });
+
+ it('fileName is valid', function () {
+ expect(App.StackConfigProperty.find('p1__site1').get('fileName')).to.eql('site1.xml');
+ });
+
+ it('propertyDependedBy is valid', function () {
+ expect(App.StackConfigProperty.find('p1__site1').get('propertyDependedBy')).to.eql([
+ {
+ "type": "site4",
+ "name": "p4"
+ }
+ ]);
+ });
+
+ it('propertyDependsOn is valid', function () {
+ expect(App.StackConfigProperty.find('p1__site1').get('propertyDependsOn')).to.eql([
+ {
+ "type": "site5",
+ "name": "p5"
+ }
+ ]);
+ });
+
+ it('valueAttributes is valid', function () {
+ expect(App.StackConfigProperty.find('p1__site1').get('valueAttributes')).to.eql({
+ "type": "int",
+ "minimum": "512",
+ "maximum": "10240",
+ "unit": "MB"
+ });
+ });
+
+ it('supportsFinal is valid', function () {
+ expect(App.StackConfigProperty.find('p1__site1').get('supportsFinal')).to.be.true;
+ });
});
- it('should set "displayType" by "property_type" attribute', function() {
+ it('should set "displayType" by "property_type" attribute', function () {
App.stackConfigPropertiesMapper.map(json);
var prop = App.StackConfigProperty.find().findProperty('name', 'p4');
var prop2 = App.StackConfigProperty.find().findProperty('name', 'p5');
[30/50] [abbrv] ambari git commit: AMBARI-11670. Width of services
menu container is fixed and causes part of longer service names to be
rendered outside the frame (alexantonenko)
Posted by nc...@apache.org.
AMBARI-11670. Width of services menu container is fixed and causes part of longer service names to be rendered outside the frame (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/df267643
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/df267643
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/df267643
Branch: refs/heads/branch-dev-patch-upgrade
Commit: df267643d7ff1d03eeb12ff82eea45720f76c132
Parents: 1c40e9c
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed Dec 30 15:25:59 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed Dec 30 15:26:08 2015 +0200
----------------------------------------------------------------------
ambari-web/app/assets/test/tests.js | 3 +-
ambari-web/app/styles/application.less | 23 +++++--
.../app/templates/main/service/menu_item.hbs | 22 +++----
ambari-web/app/views/main/service/menu.js | 4 +-
ambari-web/test/views/main/service/menu_test.js | 67 ++++++++++++++++++++
5 files changed, 102 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/df267643/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 d13767f..76c9e98 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -333,7 +333,8 @@ var files = [
'test/models/stack_version/repository_version_test',
'test/routes/views_test',
//contains test with fake timers that affect Date
- 'test/utils/lazy_loading_test'
+ 'test/utils/lazy_loading_test',
+ 'test/views/main/service/menu_test'
];
App.initialize();
http://git-wip-us.apache.org/repos/asf/ambari/blob/df267643/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 381459a..eaadee6 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -2442,6 +2442,19 @@ a:focus {
padding-left:6px;
}
}
+a.services-menu-blocks{
+ overflow:auto;
+ .icon-health-block{
+ width:16%;
+ float:left;
+ }
+ .service-name-block{
+ width:55%;
+ float:left;
+ white-space:normal;
+ word-break:break-word;
+ }
+}
.quick-links-wrapper {
margin-top: -53px;
position: relative;
@@ -3680,7 +3693,7 @@ table.graphs {
.services-menu {
.icon-refresh {
color: @restart-indicator-color;
- margin-left: 1px;
+ margin-left: 4px;
}
}
#host-details, #serviceConfig {
@@ -5124,7 +5137,8 @@ i.icon-asterisks {
float: left;
width: 100%;
min-height: 30px;
- margin-left: 2.564102564102564%;
+ margin-left: 1.282051282051282%;
+ *margin-left: 2.564102564102564%;
*margin-left: 2.5109110747408616%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
@@ -5190,7 +5204,8 @@ i.icon-asterisks {
}
.row-fluid .span2 {
- width: 14.52991452991453%;
+ width: 15.811965811965812%;
+ *width: 14.52991452991453%;
*width: 14.476723040552828%;
}
@@ -5473,7 +5488,7 @@ i.icon-asterisks {
.services-menu .nav-list li {
.label.alerts-count {
- margin-right: 4px;
+ margin-right: 0;
}
.icon-laptop {
padding-left: 5px;
http://git-wip-us.apache.org/repos/asf/ambari/blob/df267643/ambari-web/app/templates/main/service/menu_item.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/menu_item.hbs b/ambari-web/app/templates/main/service/menu_item.hbs
index 8842858..6e69fbb 100644
--- a/ambari-web/app/templates/main/service/menu_item.hbs
+++ b/ambari-web/app/templates/main/service/menu_item.hbs
@@ -16,18 +16,18 @@
* limitations under the License.
}}
-<a {{bindAttr href="view.link"}}>
- <div {{bindAttr class="view.alertsCount:with-alert :service-caption"}}>
+<a class="services-menu-blocks" {{bindAttr href="view.link"}}>
+ {{#if view.alertsCount}}
+ <span {{bindAttr class=":label :alerts-count view.hasCriticalAlerts:alerts-crit-count:alerts-warn-count"}}>
+ {{view.alertsCount}}
+ </span>
+ {{/if}}
+
+ <div class="icon-health-block">
{{view App.MainDashboardServiceHealthView class="service-health" serviceBinding="view.content"}}
- <span>{{unbound view.content.displayName}}</span>
- <i rel="tooltip" {{action goToConfigs target="view"}}{{bindAttr class=":icon-refresh :restart-required-service view.content.isRestartRequired::hidden" data-original-title="view.restartRequiredMessage"}}></i>
</div>
-
- <div class="icon-caption">
- {{#if view.alertsCount}}
- <span {{bindAttr class=":label :alerts-count view.hasCriticalAlerts:alerts-crit-count:alerts-warn-count"}}>
- {{view.alertsCount}}
- </span>
- {{/if}}
+ <div class="service-name-block">
+ <span>{{unbound view.content.displayName}}</span>
</div>
+ <i rel="tooltip" {{action goToConfigs target="view"}}{{bindAttr class=":icon-refresh :restart-required-service view.content.isRestartRequired::hidden" data-original-title="view.restartRequiredMessage"}}></i>
</a>
http://git-wip-us.apache.org/repos/asf/ambari/blob/df267643/ambari-web/app/views/main/service/menu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/menu.js b/ambari-web/app/views/main/service/menu.js
index cd54288..f5768f8 100644
--- a/ambari-web/app/views/main/service/menu.js
+++ b/ambari-web/app/views/main/service/menu.js
@@ -69,7 +69,9 @@ App.MainServiceMenuView = Em.CollectionView.extend({
return this.get('content.id') == this.get('parentView.activeServiceId') ? 'active' : '';
}.property('parentView.activeServiceId'),
- alertsCount: Em.computed.alias('content.alertsCount'),
+ alertsCount: function () {
+ return this.get('content.alertsCount') > 99 ? "99+" : this.get('content.alertsCount') ;
+ }.property('content.alertsCount'),
hasCriticalAlerts: Em.computed.alias('content.hasCriticalAlerts'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/df267643/ambari-web/test/views/main/service/menu_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/menu_test.js b/ambari-web/test/views/main/service/menu_test.js
new file mode 100644
index 0000000..15f0c15
--- /dev/null
+++ b/ambari-web/test/views/main/service/menu_test.js
@@ -0,0 +1,67 @@
+/**
+ * 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('views/main/service/menu');
+
+describe('App.MainServiceMenuView', function () {
+
+ var mainServiceMenuView;
+
+ beforeEach(function(){
+ mainServiceMenuView = App.MainServiceMenuView.create();
+ var view = mainServiceMenuView.get('itemViewClass').create({
+ content:{
+ alertsCount: 2
+ }
+ });
+ mainServiceMenuView.set('itemViewClass',view);
+ });
+
+ var cases = [
+ {
+ title:'alertsCount=0 test case:',
+ alertsCount:0,
+ result:0
+ },
+ {
+ title:'alertsCount=5 test case:',
+ alertsCount:5,
+ result:5
+ },
+ {
+ title:'alertsCount=200 test case:',
+ alertsCount:200,
+ result:"99+"
+ },
+ {
+ title:'alertsCount=99 test case:',
+ alertsCount:99,
+ result:99
+ }
+ ];
+
+
+ cases.forEach(function(item){
+ it(item.title,function(){
+ mainServiceMenuView.get('itemViewClass').set('content.alertsCount',item.alertsCount);
+ expect(mainServiceMenuView.get('itemViewClass.alertsCount')).to.not.be.undefined;
+ expect(mainServiceMenuView.get('itemViewClass.alertsCount')).to.equal(item.result);
+ });
+ });
+});
[23/50] [abbrv] ambari git commit: AMBARI-14515. Improve Ambari UI UT
(p.3) (onechiporenko)
Posted by nc...@apache.org.
AMBARI-14515. Improve Ambari UI UT (p.3) (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a487e501
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a487e501
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a487e501
Branch: refs/heads/branch-dev-patch-upgrade
Commit: a487e5018d320bb0943df0a27fcd6242e084ff80
Parents: 376fc6f
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Tue Dec 29 11:55:40 2015 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Tue Dec 29 15:13:47 2015 +0200
----------------------------------------------------------------------
ambari-web/test/app_test.js | 47 +-
.../global/cluster_controller_test.js | 160 +++--
.../global/update_controller_test.js | 13 +-
ambari-web/test/controllers/installer_test.js | 208 ++++--
.../progress_popup_controller_test.js | 111 +++-
.../resourceManager/step3_controller_test.js | 38 +-
.../admin/highAvailability_controller_test.js | 166 +++--
.../admin/kerberos/step2_controller_test.js | 30 +-
.../admin/kerberos/step4_controller_test.js | 23 +-
.../admin/kerberos/step6_controller_test.js | 22 +-
.../controllers/main/admin/kerberos_test.js | 102 ++-
.../admin/stack_and_upgrade_controller_test.js | 390 +++++++----
.../definitions_configs_controller_test.js | 63 +-
...anage_alert_notifications_controller_test.js | 31 +-
.../heatmap_metrics/heatmap_metric_test.js | 109 ++-
.../controllers/main/charts/heatmap_test.js | 22 +-
.../dashboard/config_history_controller_test.js | 20 +-
.../main/host/configs_service_test.js | 16 +-
.../test/controllers/main/host/details_test.js | 656 ++++++++++++-------
.../main/service/add_controller_test.js | 109 ++-
.../main/service/info/config_test.js | 94 ++-
.../test/controllers/main/service/item_test.js | 141 ++--
.../manage_config_groups_controller_test.js | 137 +++-
.../service/reassign/step1_controller_test.js | 28 +-
.../service/reassign/step4_controller_test.js | 32 +-
.../main/service/reassign_controller_test.js | 16 +-
.../widgets/create/step2_controller_test.js | 302 ++++++---
.../test/controllers/main/service_test.js | 78 ++-
.../controllers/main/views_controller_test.js | 5 +-
ambari-web/test/controllers/main_test.js | 18 +-
ambari-web/test/router_test.js | 38 +-
31 files changed, 2202 insertions(+), 1023 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/app_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/app_test.js b/ambari-web/test/app_test.js
index dea2464..972f57f 100644
--- a/ambari-web/test/app_test.js
+++ b/ambari-web/test/app_test.js
@@ -103,12 +103,22 @@ describe('App', function () {
];
testCases.forEach(function (test) {
- it(test.title, function () {
- sinon.stub(App.Service, 'find', function () {
- return test.service;
+ describe(test.title, function () {
+
+ beforeEach(function () {
+ sinon.stub(App.Service, 'find', function () {
+ return test.service;
+ });
+ });
+
+ afterEach(function () {
+ App.Service.find.restore();
});
- expect(App.get('falconServerURL')).to.equal(test.result);
- App.Service.find.restore();
+
+ it('App.falconServerURL is ' + test.result, function () {
+ expect(App.get('falconServerURL')).to.equal(test.result);
+ });
+
});
});
});
@@ -219,19 +229,42 @@ describe('App', function () {
})
];
- it('distribute services by categories', function () {
+ beforeEach(function () {
sinon.stub(App.StackService, 'find', function () {
return stackServices;
});
+ });
+
+ afterEach(function () {
+ App.StackService.find.restore();
+ });
+ it('App.services.all', function () {
expect(App.get('services.all')).to.eql(['S1', 'S2', 'S3', 'S4', 'S5', 'S6', 'S7']);
+ });
+
+ it('App.services.clientOnly', function () {
expect(App.get('services.clientOnly')).to.eql(['S1']);
+ });
+
+ it('App.services.hasClient', function () {
expect(App.get('services.hasClient')).to.eql(['S2']);
+ });
+
+ it('App.services.hasMaster', function () {
expect(App.get('services.hasMaster')).to.eql(['S3']);
+ });
+
+ it('App.services.hasSlave', function () {
expect(App.get('services.hasSlave')).to.eql(['S4']);
+ });
+
+ it('App.services.noConfigTypes', function () {
expect(App.get('services.noConfigTypes')).to.eql(['S5']);
+ });
+
+ it('App.services.monitoring', function () {
expect(App.get('services.monitoring')).to.eql(['S6']);
- App.StackService.find.restore();
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/global/cluster_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/cluster_controller_test.js b/ambari-web/test/controllers/global/cluster_controller_test.js
index c2f3498..a020b46 100644
--- a/ambari-web/test/controllers/global/cluster_controller_test.js
+++ b/ambari-web/test/controllers/global/cluster_controller_test.js
@@ -202,6 +202,7 @@ describe('App.clusterController', function () {
});
describe("#createKerberosAdminSession()", function() {
+
beforeEach(function () {
sinon.stub(App.ajax, 'send', function() {
return {success: Em.K}
@@ -209,21 +210,24 @@ describe('App.clusterController', function () {
sinon.stub(credentialUtils, 'createOrUpdateCredentials', function() {
return $.Deferred().resolve().promise();
});
+ this.stub = sinon.stub(App, 'get');
+ this.stub.withArgs('clusterName').returns('test');
});
+
afterEach(function () {
App.ajax.send.restore();
credentialUtils.createOrUpdateCredentials.restore();
+ App.get.restore();
});
+
it("KDC Store supports disabled, credentials updated via kdc session call", function() {
- sinon.stub(App, 'get')
- .withArgs('supports.storeKDCCredentials').returns(false)
- .withArgs('clusterName').returns('test');
+ this.stub.withArgs('supports.storeKDCCredentials').returns(false);
controller.createKerberosAdminSession({
principal: 'admin',
key: 'pass',
type: 'persistent'
}, {});
- App.get.restore();
+
expect(App.ajax.send.getCall(0).args[0]).to.eql({
name: 'common.cluster.update',
sender: controller,
@@ -238,15 +242,12 @@ describe('App.clusterController', function () {
});
});
it("KDC Store supports enabled, credentials updated via credentials storage call", function() {
- sinon.stub(App, 'get')
- .withArgs('supports.storeKDCCredentials').returns(true)
- .withArgs('clusterName').returns('test');
+ this.stub.withArgs('supports.storeKDCCredentials').returns(true);
controller.createKerberosAdminSession({
principal: 'admin',
key: 'pass',
type: 'persistent'
}, {});
- App.get.restore();
expect(App.ajax.send.called).to.be.eql(false);
expect(credentialUtils.createOrUpdateCredentials.getCall(0).args).to.eql([
'test', 'kdc.admin.credential', {
@@ -292,20 +293,36 @@ describe('App.clusterController', function () {
App.get.restore();
});
- it('should check detailed repo version for HDP 2.2', function () {
- sinon.stub(App, 'get').withArgs('currentStackName').returns('HDP').withArgs('currentStackVersionNumber').returns('2.2');
- controller.checkDetailedRepoVersion();
- expect(App.ajax.send.calledOnce).to.be.true;
+ describe('should check detailed repo version for HDP 2.2', function () {
+
+ beforeEach(function () {
+ sinon.stub(App, 'get').withArgs('currentStackName').returns('HDP').withArgs('currentStackVersionNumber').returns('2.2');
+ });
+
+ it('request is sent', function () {
+ controller.checkDetailedRepoVersion();
+ expect(App.ajax.send.calledOnce).to.be.true;
+ });
});
cases.forEach(function (item) {
- it(item.title, function () {
- sinon.stub(App, 'get', function (key) {
- return item[key] || Em.get(App, key);
+ describe(item.title, function () {
+
+ beforeEach(function () {
+ sinon.stub(App, 'get', function (key) {
+ return item[key] || Em.get(App, key);
+ });
+ controller.checkDetailedRepoVersion();
});
- controller.checkDetailedRepoVersion();
- expect(App.ajax.send.called).to.be.false;
- expect(App.get('isStormMetricsSupported')).to.equal(item.isStormMetricsSupported);
+
+ it('request is not sent', function () {
+ expect(App.ajax.send.called).to.be.false;
+ });
+
+ it('App.isStormMetricsSupported is ' + item.isStormMetricsSupported, function () {
+ expect(App.get('isStormMetricsSupported')).to.equal(item.isStormMetricsSupported);
+ });
+
});
});
@@ -438,14 +455,18 @@ describe('App.clusterController', function () {
describe("#restoreUpgradeState()", function() {
var data = {upgradeData: {}};
- var mock = {done: function(callback) {
- callback(data.upgradeData);
- }};
+ var mock = {
+ done: function (callback) {
+ callback(data.upgradeData);
+ }
+ };
var upgradeController = Em.Object.create({
restoreLastUpgrade: Em.K,
initDBProperties: Em.K,
loadUpgradeData: Em.K,
- loadStackVersionsToModel: function(){return {done: Em.K};}
+ loadStackVersionsToModel: function () {
+ return {done: Em.K};
+ }
});
beforeEach(function () {
@@ -458,6 +479,7 @@ describe('App.clusterController', function () {
sinon.spy(upgradeController, 'loadUpgradeData');
sinon.spy(upgradeController, 'loadStackVersionsToModel');
});
+
afterEach(function () {
mock.done.restore();
controller.getAllUpgrades.restore();
@@ -468,31 +490,77 @@ describe('App.clusterController', function () {
upgradeController.loadUpgradeData.restore();
upgradeController.loadStackVersionsToModel.restore();
});
- it("has upgrade request", function() {
- data.upgradeData = {items: [
- {
- Upgrade: {
- request_id: 1
+
+ describe("has upgrade request", function() {
+
+ beforeEach(function () {
+ data.upgradeData = {items: [
+ {
+ Upgrade: {
+ request_id: 1
+ }
}
- }
- ]};
- controller.restoreUpgradeState();
- expect(controller.getAllUpgrades.calledOnce).to.be.true;
- expect(App.get('upgradeState')).to.equal('PENDING');
- expect(upgradeController.restoreLastUpgrade.calledWith(data.upgradeData.items[0])).to.be.true;
- expect(upgradeController.loadStackVersionsToModel.calledWith(true)).to.be.true;
- expect(upgradeController.initDBProperties.called).to.be.false;
- expect(upgradeController.loadUpgradeData.called).to.be.false;
- });
- it("does not have upgrade request", function() {
- data.upgradeData = {items: []};
- controller.restoreUpgradeState();
- expect(controller.getAllUpgrades.calledOnce).to.be.true;
- expect(App.get('upgradeState')).to.equal('PENDING');
- expect(upgradeController.restoreLastUpgrade.called).to.be.false;
- expect(upgradeController.loadStackVersionsToModel.calledWith(true)).to.be.true;
- expect(upgradeController.initDBProperties.calledOnce).to.be.true;
- expect(upgradeController.loadUpgradeData.calledWith(true)).to.be.true;
+ ]};
+ controller.restoreUpgradeState();
+ });
+
+ it('getAllUpgrades is called once', function () {
+ expect(controller.getAllUpgrades.calledOnce).to.be.true;
+ });
+
+ it('upgradeState is PENDING', function () {
+ expect(App.get('upgradeState')).to.equal('PENDING');
+ });
+
+ it('restoreLastUpgrade is called with valid arguments', function () {
+ expect(upgradeController.restoreLastUpgrade.calledWith(data.upgradeData.items[0])).to.be.true;
+ });
+
+ it('loadStackVersionsToModel is called with valid arguments', function () {
+ expect(upgradeController.loadStackVersionsToModel.calledWith(true)).to.be.true;
+ });
+
+ it('initDBProperties is not called', function () {
+ expect(upgradeController.initDBProperties.called).to.be.false;
+ });
+
+ it('loadUpgradeData is not called', function () {
+ expect(upgradeController.loadUpgradeData.called).to.be.false;
+ });
+
+ });
+
+ describe("does not have upgrade request", function() {
+
+ beforeEach(function () {
+ data.upgradeData = {items: []};
+ controller.restoreUpgradeState();
+ });
+
+ it('getAllUpgrades is called once', function () {
+ expect(controller.getAllUpgrades.calledOnce).to.be.true;
+ });
+
+ it('upgradeState is PENDING', function () {
+ expect(App.get('upgradeState')).to.equal('PENDING');
+ });
+
+ it('restoreLastUpgrade is not called', function () {
+ expect(upgradeController.restoreLastUpgrade.called).to.be.false;
+ });
+
+ it('loadStackVersionsToModel is called with valid arguments', function () {
+ expect(upgradeController.loadStackVersionsToModel.calledWith(true)).to.be.true;
+ });
+
+ it('initDBProperties is called once', function () {
+ expect(upgradeController.initDBProperties.calledOnce).to.be.true;
+ });
+
+ it('loadUpgradeData is called with valid arguments', function () {
+ expect(upgradeController.loadUpgradeData.calledWith(true)).to.be.true;
+ });
+
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/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 807d99d..010e30a 100644
--- a/ambari-web/test/controllers/global/update_controller_test.js
+++ b/ambari-web/test/controllers/global/update_controller_test.js
@@ -34,18 +34,19 @@ describe('App.UpdateController', function () {
describe('#getUrl()', function () {
- it('testMode = true', function () {
- App.set('testMode', true);
- expect(controller.getUrl('test', '/real')).to.equal('test');
+ beforeEach(function () {
+ sinon.stub(App, 'get').withArgs('testMode').returns(false);
+ });
+
+ afterEach(function () {
+ App.get.restore();
});
it('testMode = false', function () {
- App.set('testMode', false);
expect(controller.getUrl('test', '/real')).to.equal('/api/v1/clusters//real');
});
- it('testMode = false', function () {
- App.set('testMode', false);
+ it('testMode = false (2)', function () {
controller.set('clusterName', 'mycluster');
expect(controller.getUrl('test', '/real')).to.equal('/api/v1/clusters/mycluster/real');
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/installer_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/installer_test.js b/ambari-web/test/controllers/installer_test.js
index 06d4ca7..65b911c 100644
--- a/ambari-web/test/controllers/installer_test.js
+++ b/ambari-web/test/controllers/installer_test.js
@@ -462,17 +462,25 @@ describe('App.InstallerController', function () {
});
describe('#loadMap', function() {
- it ('Should load cluster', function() {
+
+ describe('Should load cluster', function() {
var loadCluster = false;
var checker = {
load: function() {
loadCluster = true;
}
};
- installerController.loadMap['0'][0].callback.call(checker);
- expect(loadCluster).to.be.true;
+
+ beforeEach(function () {
+ installerController.loadMap['0'][0].callback.call(checker);
+ });
+
+ it('cluster info is loaded', function () {
+ expect(loadCluster).to.be.true;
+ });
});
- it ('Should load stacks', function() {
+
+ describe('Should load stacks', function() {
var loadStacks = false;
var checker = {
loadStacks: function() {
@@ -483,52 +491,84 @@ describe('App.InstallerController', function () {
};
}
};
- installerController.loadMap['1'][0].callback.call(checker);
- expect(loadStacks).to.be.true;
+
+ beforeEach(function () {
+ installerController.loadMap['1'][0].callback.call(checker);
+ });
+
+ it('stack info is loaded', function () {
+ expect(loadStacks).to.be.true;
+ });
});
- it ('Should load stacks async', function() {
+
+ describe ('Should load stacks async', function() {
var loadStacksVersions = false;
var checker = {
loadStacksVersions: function() {
loadStacksVersions = true;
}
};
- installerController.loadMap['1'][1].callback.call(checker, true).then(function(data){
- expect(data).to.be.true;
+
+ it('stack versions are loaded', function () {
+ installerController.loadMap['1'][1].callback.call(checker, true).then(function(data){
+ expect(data).to.be.true;
+ });
+ expect(loadStacksVersions).to.be.false;
});
- expect(loadStacksVersions).to.be.false;
});
- it ('Should load installOptions', function() {
- var loadStacks = false;
+
+ describe('Should load installOptions', function() {
+ var installOptions = false;
var checker = {
load: function() {
- loadStacks = true;
+ installOptions = true;
}
};
- installerController.loadMap['2'][0].callback.call(checker);
- expect(loadStacks).to.be.true;
+
+ beforeEach(function () {
+ installerController.loadMap['2'][0].callback.call(checker);
+ });
+
+ it('install option are loaded', function () {
+ expect(installOptions).to.be.true;
+ });
});
- it ('Should load loadConfirmedHosts', function() {
+
+ describe('Should load loadConfirmedHosts', function() {
var loadConfirmedHosts = false;
var checker = {
loadConfirmedHosts: function() {
loadConfirmedHosts = true;
}
};
- installerController.loadMap['3'][0].callback.call(checker);
- expect(loadConfirmedHosts).to.be.true;
+
+ beforeEach(function () {
+ installerController.loadMap['3'][0].callback.call(checker);
+ });
+
+ it('confirmed hosts are loaded', function () {
+ expect(loadConfirmedHosts).to.be.true;
+ });
});
- it ('Should load loadServices', function() {
+
+ describe('Should load loadServices', function() {
var loadServices = false;
var checker = {
loadServices: function() {
loadServices = true;
}
};
- installerController.loadMap['4'][0].callback.call(checker);
- expect(loadServices).to.be.true;
+
+ beforeEach(function () {
+ installerController.loadMap['4'][0].callback.call(checker);
+ });
+
+ it('services are loaded', function () {
+ expect(loadServices).to.be.true;
+ });
});
- it ('Should load loadServices', function() {
+
+ describe('Should load loadServices (2)', function() {
var setSkipSlavesStep = false;
var loadMasterComponentHosts = false;
var loadConfirmedHosts = false;
@@ -548,14 +588,30 @@ describe('App.InstallerController', function () {
loadRecommendations = true;
}
};
- installerController.loadMap['5'][0].callback.call(checker);
- expect(loadConfirmedHosts).to.be.true;
- expect(setSkipSlavesStep).to.be.true;
- expect(loadMasterComponentHosts).to.be.true;
- expect(loadRecommendations).to.be.true;
+
+ beforeEach(function () {
+ installerController.loadMap['5'][0].callback.call(checker);
+ });
+
+ it('confirmed hosts are loaded', function() {
+ expect(loadConfirmedHosts).to.be.true;
+ });
+
+ it('`skipSlavesStep` is loaded', function() {
+ expect(setSkipSlavesStep).to.be.true;
+ });
+
+ it('master components hosts are loaded', function() {
+ expect(loadMasterComponentHosts).to.be.true;
+ });
+
+ it('recommendations are loaded', function() {
+ expect(loadRecommendations).to.be.true;
+ });
});
- it ('Should load serviceConfigGroups', function() {
+
+ describe ('Should load serviceConfigGroups', function() {
var loadServiceConfigGroups = false;
var loadServiceConfigProperties = false;
var loadCurrentHostGroups = false;
@@ -579,14 +635,34 @@ describe('App.InstallerController', function () {
loadConfigThemes = true;
}
};
- installerController.loadMap['7'][0].callback.call(checker);
- expect(loadServiceConfigGroups).to.be.true;
- expect(loadServiceConfigProperties).to.be.true;
- expect(loadCurrentHostGroups).to.be.true;
- expect(loadRecommendationsConfigs).to.be.true;
- expect(loadConfigThemes).to.be.true;
+
+ beforeEach(function () {
+ installerController.loadMap['7'][0].callback.call(checker);
+ });
+
+ it('config groups are loaded', function () {
+ expect(loadServiceConfigGroups).to.be.true;
+ });
+
+ it('config properties are loaded', function () {
+ expect(loadServiceConfigProperties).to.be.true;
+ });
+
+ it('current host groups are loaded', function () {
+ expect(loadCurrentHostGroups).to.be.true;
+ });
+
+ it('recommendations are loaded', function () {
+ expect(loadRecommendationsConfigs).to.be.true;
+ });
+
+ it('config themes are loaded', function () {
+ expect(loadConfigThemes).to.be.true;
+ });
+
});
- it ('Should load clients', function() {
+
+ describe('Should load clients', function() {
var loadSlaveComponentHosts = false;
var loadClients = false;
var loadRecommendations = false;
@@ -602,11 +678,25 @@ describe('App.InstallerController', function () {
loadRecommendations = true;
}
};
- installerController.loadMap['6'][0].callback.call(checker);
- expect(loadSlaveComponentHosts).to.be.true;
- expect(loadClients).to.be.true;
- expect(loadRecommendations).to.be.true;
+
+ beforeEach(function () {
+ installerController.loadMap['6'][0].callback.call(checker);
+ });
+
+ it('slave components hosts are loaded', function () {
+ expect(loadSlaveComponentHosts).to.be.true;
+ });
+
+ it('clients are loaded', function () {
+ expect(loadClients).to.be.true;
+ });
+
+ it('recommendations are loaded', function () {
+ expect(loadRecommendations).to.be.true;
+ });
+
});
+
});
describe('#removeHosts', function() {
@@ -1121,18 +1211,34 @@ describe('App.InstallerController', function () {
];
tests.forEach(function(test) {
- it(test.m, function() {
- sinon.stub(App.Stack, 'find').returns(test.stacks);
- sinon.stub(App.router, 'get').withArgs('clusterController.isCustomJDK').returns(test.isCustomJDK)
- .withArgs('clusterController.ambariProperties').returns(test.ambariProperties);
- sinon.stub(App, 'showConfirmationPopup', Em.K);
- var successCallback = sinon.spy();
- installerController.validateJDKVersion(successCallback);
- expect(successCallback.called).to.be.eql(test.successCallbackCalled);
- expect(App.showConfirmationPopup.called).to.be.eql(test.popupCalled);
- App.router.get.restore();
- App.Stack.find.restore();
- App.showConfirmationPopup.restore();
+
+ describe(test.m, function() {
+
+ var successCallback;
+
+ beforeEach(function () {
+ sinon.stub(App.Stack, 'find').returns(test.stacks);
+ sinon.stub(App.router, 'get').withArgs('clusterController.isCustomJDK').returns(test.isCustomJDK)
+ .withArgs('clusterController.ambariProperties').returns(test.ambariProperties);
+ sinon.stub(App, 'showConfirmationPopup', Em.K);
+ successCallback = sinon.spy();
+ installerController.validateJDKVersion(successCallback);
+ });
+
+ afterEach(function () {
+ App.router.get.restore();
+ App.Stack.find.restore();
+ App.showConfirmationPopup.restore();
+ });
+
+ it('successCallback is ' + (test.successCallbackCalled ? '' : 'not') + ' called', function () {
+ expect(successCallback.called).to.be.equal(test.successCallbackCalled);
+ });
+
+ it('App.showConfirmationPopup. is ' + (test.popupCalled ? '' : 'not') + ' called', function () {
+ expect(App.showConfirmationPopup.called).to.be.equal(test.popupCalled);
+ });
+
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js
index bd8deb3..2a9a4d7 100644
--- a/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js
@@ -44,13 +44,32 @@ describe('App.HighAvailabilityProgressPopupController', function () {
App.updater.immediateRun.restore();
});
- it('should start task polling', function () {
- controller.startTaskPolling(1, 2);
- expect(controller.get('isTaskPolling')).to.be.true;
- expect(controller.get('taskInfo.id'), 2);
- expect(controller.get('taskInfo.requestId'), 1);
- expect(App.updater.run.calledOnce).to.be.true;
- expect(App.updater.immediateRun.calledOnce).to.be.true;
+ describe('should start task polling', function () {
+
+ beforeEach(function () {
+ controller.startTaskPolling(1, 2);
+ });
+
+ it('isTaskPolling = true', function () {
+ expect(controller.get('isTaskPolling')).to.be.true;
+ });
+
+ it('taskInfo.id = 2', function () {
+ expect(controller.get('taskInfo.id'), 2);
+ });
+
+ it('taskInfo.requestId = 1', function () {
+ expect(controller.get('taskInfo.requestId'), 1);
+ });
+
+ it('App.updater.run is called once', function () {
+ expect(App.updater.run.calledOnce).to.be.true;
+ });
+
+ it('App.updater.immediateRun is called once', function () {
+ expect(App.updater.immediateRun.calledOnce).to.be.true;
+ });
+
});
});
@@ -125,17 +144,36 @@ describe('App.HighAvailabilityProgressPopupController', function () {
cases.forEach(function (item) {
var message = title.format(item.isTaskPolling ? '' : 'not ', item.status);
- it(message, function () {
- controller.updateTaskSuccessCallback({
- Tasks: $.extend(tasks, {
- status: item.status
- })
+ describe(message, function () {
+
+ beforeEach(function () {
+ controller.updateTaskSuccessCallback({
+ Tasks: $.extend(tasks, {
+ status: item.status
+ })
+ });
});
- expect(controller.get('taskInfo.stderr')).to.equal('error');
- expect(controller.get('taskInfo.stdout')).to.equal('output');
- expect(controller.get('taskInfo.outputLog')).to.equal('output-log.txt');
- expect(controller.get('taskInfo.errorLog')).to.equal('error-log.txt');
- expect(controller.get('isTaskPolling')).to.equal(item.isTaskPolling);
+
+ it('stderr is valid', function () {
+ expect(controller.get('taskInfo.stderr')).to.equal('error');
+ });
+
+ it('stdout is valid', function () {
+ expect(controller.get('taskInfo.stdout')).to.equal('output');
+ });
+
+ it('outputLog is valid', function () {
+ expect(controller.get('taskInfo.outputLog')).to.equal('output-log.txt');
+ });
+
+ it('errorLog is valid', function () {
+ expect(controller.get('taskInfo.errorLog')).to.equal('error-log.txt');
+ });
+
+ it('isTaskPolling is valid', function () {
+ expect(controller.get('isTaskPolling')).to.equal(item.isTaskPolling);
+ });
+
});
});
@@ -171,17 +209,36 @@ describe('App.HighAvailabilityProgressPopupController', function () {
});
cases.forEach(function (item) {
- it(item.title, function () {
- controller.setProperties({
- requestIds: [1, 2],
- stageId: item.stageId
+ describe(item.title, function () {
+
+ beforeEach(function () {
+ controller.setProperties({
+ requestIds: [1, 2],
+ stageId: item.stageId
+ });
+ controller.getHosts();
+ });
+
+ it('two requests are sent', function () {
+ expect(App.ajax.send.calledTwice).to.be.true;
});
- controller.getHosts();
- expect(App.ajax.send.calledTwice).to.be.true;
- expect(App.ajax.send.firstCall.args[0].name).to.equal(item.name);
- expect(App.ajax.send.secondCall.args[0].name).to.equal(item.name);
- expect(App.ajax.send.firstCall.args[0].data.stageId).to.eql(item.stageIdPassed);
- expect(App.ajax.send.secondCall.args[0].data.stageId).to.eql(item.stageIdPassed);
+
+ it('1st call name is valid', function () {
+ expect(App.ajax.send.firstCall.args[0].name).to.equal(item.name);
+ });
+
+ it('2nd call name is valid', function () {
+ expect(App.ajax.send.secondCall.args[0].name).to.equal(item.name);
+ });
+
+ it('1st stageId is valid', function () {
+ expect(App.ajax.send.firstCall.args[0].data.stageId).to.eql(item.stageIdPassed);
+ });
+
+ it('2nd stageId is valid', function () {
+ expect(App.ajax.send.secondCall.args[0].data.stageId).to.eql(item.stageIdPassed);
+ });
+
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
index fedcb8e..5b34dd4 100644
--- a/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
@@ -295,35 +295,59 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function () {
})
];
});
+ controller.setDynamicConfigValues(configs, data);
});
afterEach(function () {
App.HostComponent.find.restore();
});
- it('setting new RM properties values', function () {
- controller.setDynamicConfigValues(configs, data);
+ it('yarn.resourcemanager.hostname.rm1 value', function () {
expect(configs.configs.findProperty('name', 'yarn.resourcemanager.hostname.rm1').get('value')).to.equal('h0');
+ });
+ it('yarn.resourcemanager.hostname.rm1 recommendedValue', function () {
expect(configs.configs.findProperty('name', 'yarn.resourcemanager.hostname.rm1').get('recommendedValue')).to.equal('h0');
+ });
+ it('yarn.resourcemanager.hostname.rm2 value', function () {
expect(configs.configs.findProperty('name', 'yarn.resourcemanager.hostname.rm2').get('value')).to.equal('h1');
+ });
+ it('yarn.resourcemanager.hostname.rm2 recommendedValue', function () {
expect(configs.configs.findProperty('name', 'yarn.resourcemanager.hostname.rm2').get('recommendedValue')).to.equal('h1');
-
+ });
+ it('yarn.resourcemanager.webapp.address.rm1 value', function () {
expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.address.rm1').get('value')).to.equal('h0:1234');
+ });
+ it('yarn.resourcemanager.webapp.address.rm1 recommendedValue', function () {
expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.address.rm1').get('recommendedValue')).to.equal('h0:1234');
+ });
+ it('yarn.resourcemanager.webapp.address.rm2 value', function () {
expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.address.rm2').get('value')).to.equal('h1:1234');
+ });
+ it('yarn.resourcemanager.webapp.address.rm2 recommendedValue', function () {
expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.address.rm2').get('recommendedValue')).to.equal('h1:1234');
-
+ });
+ it('yarn.resourcemanager.webapp.https.address.rm1 value', function () {
expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.https.address.rm1').get('value')).to.equal('h0:4321');
+ });
+ it('yarn.resourcemanager.webapp.https.address.rm1 recommendedValue', function () {
expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.https.address.rm1').get('recommendedValue')).to.equal('h0:4321');
+ });
+ it('yarn.resourcemanager.webapp.https.address.rm2 value', function () {
expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.https.address.rm2').get('value')).to.equal('h1:4321');
+ });
+ it('yarn.resourcemanager.webapp.https.address.rm2 recommendedValue', function () {
expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.https.address.rm2').get('recommendedValue')).to.equal('h1:4321');
-
+ });
+ it('yarn.resourcemanager.zk-address value', function () {
expect(configs.configs.findProperty('name', 'yarn.resourcemanager.zk-address').get('value')).to.equal('h2:2222,h3:2222');
+ });
+ it('yarn.resourcemanager.zk-address recommendedValue', function () {
expect(configs.configs.findProperty('name', 'yarn.resourcemanager.zk-address').get('recommendedValue')).to.equal('h2:2222,h3:2222');
});
-
- it('Setting new HAWQ RM properties values', function () {
+ it('yarn.resourcemanager.ha value', function () {
expect(configs.configs.findProperty('name', 'yarn.resourcemanager.ha').get('value')).to.equal('h0:8032,h1:8032');
+ });
+ it('yarn.resourcemanager.ha recommendedValud', function () {
expect(configs.configs.findProperty('name', 'yarn.resourcemanager.scheduler.ha').get('recommendedValue')).to.equal('h0:8030,h1:8030');
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/admin/highAvailability_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability_controller_test.js
index 0a75d9f..1e3d140 100644
--- a/ambari-web/test/controllers/main/admin/highAvailability_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/highAvailability_controller_test.js
@@ -38,40 +38,51 @@ describe('App.MainAdminHighAvailabilityController', function () {
});
sinon.spy(controller, "showErrorPopup");
});
+
afterEach(function () {
App.router.transitionTo.restore();
controller.showErrorPopup.restore();
App.HostComponent.find.restore();
+ App.router.get.restore();
});
- it('NAMENODE in INSTALLED state', function () {
- hostComponents = [
- Em.Object.create({
- componentName: 'NAMENODE',
- workStatus: 'INSTALLED'
- }),
- Em.Object.create({
- componentName: 'ZOOKEEPER_SERVER',
- workStatus: 'INSTALLED'
- }),
- Em.Object.create({
- componentName: 'ZOOKEEPER_SERVER',
- workStatus: 'INSTALLED'
- }),
- Em.Object.create({
- componentName: 'ZOOKEEPER_SERVER',
- workStatus: 'INSTALLED'
- })
- ];
+ describe('NAMENODE in INSTALLED state', function () {
+ beforeEach(function () {
+ hostComponents = [
+ Em.Object.create({
+ componentName: 'NAMENODE',
+ workStatus: 'INSTALLED'
+ }),
+ Em.Object.create({
+ componentName: 'ZOOKEEPER_SERVER',
+ workStatus: 'INSTALLED'
+ }),
+ Em.Object.create({
+ componentName: 'ZOOKEEPER_SERVER',
+ workStatus: 'INSTALLED'
+ }),
+ Em.Object.create({
+ componentName: 'ZOOKEEPER_SERVER',
+ workStatus: 'INSTALLED'
+ })
+ ];
+ sinon.stub(App.router, 'get', function() {
+ return 3;
+ });
+ this.result = controller.enableHighAvailability();
+ });
- sinon.stub(App.router, 'get', function(){
- return 3;
+ it('enableHighAvailability result is false', function () {
+ expect(this.result).to.be.false;
});
- expect(controller.enableHighAvailability()).to.be.false;
- expect(controller.showErrorPopup.calledOnce).to.be.true;
- App.router.get.restore();
+
+ it('showErrorPopup is called once', function () {
+ expect(controller.showErrorPopup.calledOnce).to.be.true;
+ });
+
});
- it('Cluster has less than 3 ZOOKEPER_SERVER components', function () {
+
+ describe('Cluster has less than 3 ZOOKEPER_SERVER components', function () {
hostComponents = [
Em.Object.create({
componentName: 'NAMENODE',
@@ -79,14 +90,24 @@ describe('App.MainAdminHighAvailabilityController', function () {
})
];
- sinon.stub(App.router, 'get', function(){
- return 3;
+ beforeEach(function () {
+ sinon.stub(App.router, 'get', function(){
+ return 3;
+ });
+ this.result = controller.enableHighAvailability();
});
- expect(controller.enableHighAvailability()).to.be.false;
- expect(controller.showErrorPopup.called).to.be.true;
- App.router.get.restore();
+
+ it('enableHighAvailability result is false', function () {
+ expect(this.result).to.be.false;
+ });
+
+ it('showErrorPopup is called', function () {
+ expect(controller.showErrorPopup.called).to.be.true;
+ });
+
});
- it('total hosts number less than 3', function () {
+
+ describe('total hosts number less than 3', function () {
hostComponents = [
Em.Object.create({
componentName: 'NAMENODE',
@@ -105,39 +126,62 @@ describe('App.MainAdminHighAvailabilityController', function () {
workStatus: 'INSTALLED'
})
];
- sinon.stub(App.router, 'get', function () {
- return 1;
+
+ beforeEach(function () {
+ sinon.stub(App.router, 'get', function () {
+ return 1;
+ });
+ this.result = controller.enableHighAvailability();
});
- expect(controller.enableHighAvailability()).to.be.false;
- expect(controller.showErrorPopup.calledOnce).to.be.true;
- App.router.get.restore();
+
+ it('enableHighAvailability result is false', function () {
+ expect(this.result).to.be.false;
+ });
+
+ it('showErrorPopup is called once', function () {
+ expect(controller.showErrorPopup.calledOnce).to.be.true;
+ });
+
});
- it('All checks passed', function () {
- hostComponents = [
- Em.Object.create({
- componentName: 'NAMENODE',
- workStatus: 'STARTED'
- }),
- Em.Object.create({
- componentName: 'ZOOKEEPER_SERVER',
- workStatus: 'INSTALLED'
- }),
- Em.Object.create({
- componentName: 'ZOOKEEPER_SERVER',
- workStatus: 'INSTALLED'
- }),
- Em.Object.create({
- componentName: 'ZOOKEEPER_SERVER',
- workStatus: 'INSTALLED'
- })
- ];
- sinon.stub(App.router, 'get', function(){
- return 3;
+
+ describe('All checks passed', function () {
+ beforeEach(function () {
+ hostComponents = [
+ Em.Object.create({
+ componentName: 'NAMENODE',
+ workStatus: 'STARTED'
+ }),
+ Em.Object.create({
+ componentName: 'ZOOKEEPER_SERVER',
+ workStatus: 'INSTALLED'
+ }),
+ Em.Object.create({
+ componentName: 'ZOOKEEPER_SERVER',
+ workStatus: 'INSTALLED'
+ }),
+ Em.Object.create({
+ componentName: 'ZOOKEEPER_SERVER',
+ workStatus: 'INSTALLED'
+ })
+ ];
+ sinon.stub(App.router, 'get', function() {
+ return 3;
+ });
+ this.result = controller.enableHighAvailability();
});
- expect(controller.enableHighAvailability()).to.be.true;
- expect(App.router.transitionTo.calledWith('main.services.enableHighAvailability')).to.be.true;
- expect(controller.showErrorPopup.calledOnce).to.be.false;
- App.router.get.restore();
+
+ it('enableHighAvailability result is true', function () {
+ expect(this.result).to.be.true;
+ });
+
+ it('user is moved to enable HA', function () {
+ expect(App.router.transitionTo.calledWith('main.services.enableHighAvailability')).to.be.true;
+ });
+
+ it('showErrorPopup is not called', function () {
+ expect(controller.showErrorPopup.calledOnce).to.be.false;
+ });
+
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js b/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js
index c87c86c..275588d 100644
--- a/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js
@@ -79,17 +79,27 @@ describe('App.KerberosWizardStep2Controller', function() {
];
tests.forEach(function(test) {
- it('Should trim values for properties ' + Em.keys(test.e).join(','), function() {
- sinon.stub(App.StackService, 'find').returns([Em.Object.create({serviceName: 'KERBEROS'})]);
- controller.set('stepConfigs', [
- App.ServiceConfig.create({
- configs: test.stepConfigs.map(function(item) { return _createProperty(item[0], item[1], item[2]); })
- })
- ]);
- var result = controller.createKerberosSiteObj('some-site', 'random-tag');
- App.StackService.find.restore();
+ describe('Should trim values for properties ' + Em.keys(test.e).join(','), function() {
+ var result;
+
+ beforeEach(function () {
+ sinon.stub(App.StackService, 'find').returns([Em.Object.create({serviceName: 'KERBEROS'})]);
+ controller.set('stepConfigs', [
+ App.ServiceConfig.create({
+ configs: test.stepConfigs.map(function(item) { return _createProperty(item[0], item[1], item[2]); })
+ })
+ ]);
+ result = controller.createKerberosSiteObj('some-site', 'random-tag');
+ });
+
+ afterEach(function () {
+ App.StackService.find.restore();
+ });
+
Em.keys(test.e).forEach(function(propertyName) {
- expect(result.properties[propertyName]).to.be.eql(test.e[propertyName]);
+ it(propertyName, function () {
+ expect(result.properties[propertyName]).to.be.eql(test.e[propertyName]);
+ });
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js b/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
index 7b2f877..3f284f4 100644
--- a/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
@@ -319,12 +319,23 @@ describe('App.KerberosWizardStep4Controller', function() {
];
tests.forEach(function(test) {
- it('Security {0} configure identities step should be {1}'.format(!!test.securityEnabled ? 'enabled' : 'disabled', !!test.stepSkipped ? 'skipped' : 'not skipped'), function() {
- sinon.stub(App, 'get').withArgs('isKerberosEnabled').returns(test.securityEnabled);
- this.wizardController.checkSecurityStatus();
- App.get.restore();
- controller.loadStep();
- expect(App.router.send.calledWith('next')).to.be.eql(test.stepSkipped);
+ var message = 'Security {0} configure identities step should be {1}'.format(!!test.securityEnabled ? 'enabled' : 'disabled', !!test.stepSkipped ? 'skipped' : 'not skipped');
+ describe(message, function() {
+
+ beforeEach(function () {
+ sinon.stub(App, 'get').withArgs('isKerberosEnabled').returns(test.securityEnabled);
+ this.wizardController.checkSecurityStatus();
+ controller.loadStep();
+ });
+
+ afterEach(function () {
+ App.get.restore();
+ });
+
+ it('`send` is ' + (test.stepSkipped ? '' : 'not') + ' called with `next`', function () {
+ expect(App.router.send.calledWith('next')).to.be.eql(test.stepSkipped);
+ });
+
});
}, this);
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/admin/kerberos/step6_controller_test.js
----------------------------------------------------------------------
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 780f896..8fe9bc2 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
@@ -37,13 +37,21 @@ describe('App.KerberosWizardStep6Controller', function() {
];
tests.forEach(function(test) {
- it('YARN installed: {0}, ATS supported: {1} list of commands should be {2}'.format(test.yarnInstalled, test.doesATSSupportKerberos, test.commands.toString()), function () {
- var controller = App.KerberosWizardStep6Controller.create({ commands: ['stopServices'] });
- sinon.stub(App, 'get').withArgs('doesATSSupportKerberos').returns(test.doesATSSupportKerberos);
- sinon.stub(App.Service, 'find').returns(test.yarnInstalled ? [Em.Object.create({serviceName: 'YARN'})] : []);
- sinon.stub(App.HostComponent, 'find').returns(test.ATSInstalled ? [Em.Object.create({componentName: 'APP_TIMELINE_SERVER'})] : []);
- controller.checkComponentsRemoval();
- expect(controller.get('commands').toArray()).to.eql(test.commands);
+ var message = 'YARN installed: {0}, ATS supported: {1} list of commands should be {2}'.format(test.yarnInstalled, test.doesATSSupportKerberos, test.commands.toString());
+ describe(message, function () {
+ var controller;
+ beforeEach(function () {
+ controller = App.KerberosWizardStep6Controller.create({ commands: ['stopServices'] });
+ sinon.stub(App, 'get').withArgs('doesATSSupportKerberos').returns(test.doesATSSupportKerberos);
+ sinon.stub(App.Service, 'find').returns(test.yarnInstalled ? [Em.Object.create({serviceName: 'YARN'})] : []);
+ sinon.stub(App.HostComponent, 'find').returns(test.ATSInstalled ? [Em.Object.create({componentName: 'APP_TIMELINE_SERVER'})] : []);
+ controller.checkComponentsRemoval();
+ });
+
+ it('commands are valid', function () {
+ expect(controller.get('commands').toArray()).to.eql(test.commands);
+ });
+
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/admin/kerberos_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos_test.js b/ambari-web/test/controllers/main/admin/kerberos_test.js
index e05dfdb..d69e168 100644
--- a/ambari-web/test/controllers/main/admin/kerberos_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos_test.js
@@ -61,20 +61,30 @@ describe('App.MainAdminKerberosController', function() {
});
});
- it('should take displayType from predefinedSiteProperties', function () {
- sinon.stub(App.configsCollection, 'getAll').returns([
- {
- name: 'hadoop.security.auth_to_local',
- displayType: 'multiLine'
- }
- ]);
- expect(controller.prepareConfigProperties([
- Em.Object.create({
- name: 'hadoop.security.auth_to_local',
- serviceName: 'HDFS'
- })
- ])[0].get('displayType')).to.equal('multiLine');
- App.configsCollection.getAll.restore();
+ describe('should take displayType from predefinedSiteProperties', function () {
+
+ beforeEach(function () {
+ sinon.stub(App.configsCollection, 'getAll').returns([
+ {
+ name: 'hadoop.security.auth_to_local',
+ displayType: 'multiLine'
+ }
+ ]);
+ });
+
+ afterEach(function () {
+ App.configsCollection.getAll.restore();
+ });
+
+ it('displayType is valid', function () {
+ expect(controller.prepareConfigProperties([
+ Em.Object.create({
+ name: 'hadoop.security.auth_to_local',
+ serviceName: 'HDFS'
+ })
+ ])[0].get('displayType')).to.equal('multiLine');
+ });
+
});
});
@@ -227,17 +237,31 @@ describe('App.MainAdminKerberosController', function() {
result: true
}
].forEach(function (test) {
- it(test.m, function () {
- sinon.stub(App, 'get').returns(test.isKerberosEnabled);
- controller.set('securityEnabled', test.securityEnabled);
- controller.set('kdc_type', test.kdc_type);
- controller.getKDCSessionState(mock.callback);
+ describe(test.m, function () {
+
+ beforeEach(function () {
+ sinon.stub(App, 'get').returns(test.isKerberosEnabled);
+ controller.set('securityEnabled', test.securityEnabled);
+ controller.set('kdc_type', test.kdc_type);
+ controller.getKDCSessionState(mock.callback);
+ });
+
+
if (test.result) {
- expect(mock.callback.calledOnce).to.be.false;
- expect(App.ajax.send.calledOnce).to.be.true;
- } else {
- expect(mock.callback.calledOnce).to.be.true;
- expect(App.ajax.send.calledOnce).to.be.false;
+ it('callback is not called', function () {
+ expect(mock.callback.calledOnce).to.be.false;
+ });
+ it('1 request is sent', function () {
+ expect(App.ajax.send.calledOnce).to.be.true;
+ });
+ }
+ else {
+ it('callback is called once', function () {
+ expect(mock.callback.calledOnce).to.be.true;
+ });
+ it('no request is sent', function () {
+ expect(App.ajax.send.calledOnce).to.be.false;
+ });
}
});
});
@@ -281,17 +305,29 @@ describe('App.MainAdminKerberosController', function() {
result: true
}
].forEach(function (test) {
- it(test.m, function () {
- sinon.stub(App, 'get').returns(test.isKerberosEnabled);
- controller.set('securityEnabled', test.securityEnabled);
- controller.set('kdc_type', test.kdc_type);
- controller.getSecurityType(mock.callback);
+ describe(test.m, function () {
+
+ beforeEach(function () {
+ sinon.stub(App, 'get').returns(test.isKerberosEnabled);
+ controller.set('securityEnabled', test.securityEnabled);
+ controller.set('kdc_type', test.kdc_type);
+ controller.getSecurityType(mock.callback);
+ });
+
if (test.result) {
- expect(mock.callback.calledOnce).to.be.false;
- expect(App.ajax.send.calledOnce).to.be.true;
+ it('callback os not called', function () {
+ expect(mock.callback.calledOnce).to.be.false;
+ });
+ it('1 request is sent', function () {
+ expect(App.ajax.send.calledOnce).to.be.true;
+ });
} else {
- expect(mock.callback.calledOnce).to.be.true;
- expect(App.ajax.send.calledOnce).to.be.false;
+ it('callback is called once', function () {
+ expect(mock.callback.calledOnce).to.be.true;
+ });
+ it('no request is sent', function () {
+ expect(App.ajax.send.calledOnce).to.be.false;
+ });
}
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
index 392f899..2651437 100644
--- a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
@@ -523,15 +523,11 @@ describe('App.MainAdminStackAndUpgradeController', function() {
});
describe("#upgrade()", function() {
- before(function () {
+ var callArgs;
+
+ beforeEach(function () {
sinon.stub(App.ajax, 'send', Em.K);
sinon.stub(controller, 'setDBProperty', Em.K);
- });
- after(function () {
- App.ajax.send.restore();
- controller.setDBProperty.restore();
- });
- it("make ajax call", function() {
controller.set('currentVersion', {
repository_version: '2.2'
});
@@ -539,12 +535,30 @@ describe('App.MainAdminStackAndUpgradeController', function() {
value: '2.2',
label: 'HDP-2.2'
});
- var callArgs = App.ajax.send.getCall(0).args[0];
+ callArgs = App.ajax.send.getCall(0).args[0];
+ });
+
+ afterEach(function () {
+ App.ajax.send.restore();
+ controller.setDBProperty.restore();
+ });
+
+ it("request-data is valid", function() {
expect(callArgs.data).to.eql({"value": '2.2', "label": 'HDP-2.2'});
- expect(callArgs.name).to.eql('admin.upgrade.start');
+ });
+ it('request-name is valid', function () {
+ expect(callArgs.name).to.equal('admin.upgrade.start');
+ });
+ it('request-sender is valid', function () {
expect(callArgs.sender).to.eql(controller);
- expect(callArgs.success).to.eql('upgradeSuccessCallback');
+ });
+ it('callback is valid', function () {
+ expect(callArgs.success).to.equal('upgradeSuccessCallback');
+ });
+ it('callback is called', function () {
expect(callArgs.callback).to.be.called;
+ });
+ it('setDBProperty is called with valid data', function () {
expect(controller.setDBProperty.calledWith('currentVersion', {
repository_version: '2.2'
})).to.be.true;
@@ -552,19 +566,12 @@ describe('App.MainAdminStackAndUpgradeController', function() {
});
describe("#upgradeSuccessCallback()", function() {
- before(function () {
+
+ beforeEach(function () {
sinon.stub(App.clusterStatus, 'setClusterStatus', Em.K);
sinon.stub(controller, 'openUpgradeDialog', Em.K);
sinon.stub(controller, 'setDBProperties', Em.K);
sinon.stub(controller, 'load', Em.K);
- });
- after(function () {
- App.clusterStatus.setClusterStatus.restore();
- controller.openUpgradeDialog.restore();
- controller.setDBProperties.restore();
- controller.load.restore();
- });
- it("open upgrade dialog", function() {
var data = {
resources: [
{
@@ -575,11 +582,31 @@ describe('App.MainAdminStackAndUpgradeController', function() {
]
};
controller.upgradeSuccessCallback(data, {}, {label: 'HDP-2.2.1', isDowngrade: true});
+ });
+
+ afterEach(function () {
+ App.clusterStatus.setClusterStatus.restore();
+ controller.openUpgradeDialog.restore();
+ controller.setDBProperties.restore();
+ controller.load.restore();
+ });
+
+ it('load is called ocne', function() {
expect(controller.load.calledOnce).to.be.true;
+ });
+ it('upgradeVersion is HDP-2.2.1', function() {
expect(controller.get('upgradeVersion')).to.equal('HDP-2.2.1');
+ });
+ it('upgradeData is null', function() {
expect(controller.get('upgradeData')).to.be.null;
+ });
+ it('isDowngrade is true', function() {
expect(controller.get('isDowngrade')).to.be.true;
+ });
+ it('App.clusterStatus.setClusterStatus is called once', function() {
expect(App.clusterStatus.setClusterStatus.calledOnce).to.be.true;
+ });
+ it('controller.openUpgradeDialog is called once', function() {
expect(controller.openUpgradeDialog.calledOnce).to.be.true;
});
});
@@ -678,22 +705,46 @@ describe('App.MainAdminStackAndUpgradeController', function() {
groups = controller.get('upgradeData.upgradeGroups');
});
- it("checking 1st group", function() {
- expect(groups[0].get('status')).to.equal('COMPLETED');
- expect(groups[0].get('progress_percent')).to.equal(100);
- expect(groups[0].get('completed_task_count')).to.equal(3);
- expect(groups[0].get('upgradeItems')[0].get('status')).to.equal('COMPLETED');
- expect(groups[0].get('upgradeItems')[0].get('progress_percent')).to.equal(100);
- expect(groups[0].get('hasExpandableItems')).to.be.true;
+ describe("checking 1st group", function() {
+ it('status is COMPLETED', function () {
+ expect(groups[0].get('status')).to.equal('COMPLETED');
+ });
+ it('progress_percent is 100', function () {
+ expect(groups[0].get('progress_percent')).to.equal(100);
+ });
+ it('completed_task_count = 3', function () {
+ expect(groups[0].get('completed_task_count')).to.equal(3);
+ });
+ it('upgradeItems.0.status is COMPLETED', function () {
+ expect(groups[0].get('upgradeItems')[0].get('status')).to.equal('COMPLETED');
+ });
+ it('upgradeItems.0.progress_percent is 100', function () {
+ expect(groups[0].get('upgradeItems')[0].get('progress_percent')).to.equal(100);
+ });
+ it('hasExpandableItems is true', function () {
+ expect(groups[0].get('hasExpandableItems')).to.be.true;
+ });
});
- it('checking 2nd group', function () {
- expect(groups[1].get('status')).to.equal('ABORTED');
- expect(groups[1].get('progress_percent')).to.equal(50);
- expect(groups[1].get('completed_task_count')).to.equal(1);
- expect(groups[1].get('upgradeItems').mapProperty('status')).to.eql(['ABORTED', 'PENDING']);
- expect(groups[1].get('upgradeItems').mapProperty('progress_percent')).to.eql([99, 0]);
- expect(groups[1].get('hasExpandableItems')).to.be.false;
+ describe('checking 2nd group', function () {
+ it('status is ABORTED', function () {
+ expect(groups[1].get('status')).to.equal('ABORTED');
+ });
+ it('progress_percent is 50', function () {
+ expect(groups[1].get('progress_percent')).to.equal(50);
+ });
+ it('completed_task_count = 1', function () {
+ expect(groups[1].get('completed_task_count')).to.equal(1);
+ });
+ it('upgradeItems.[].status = ["ABORTED", "PENDING"]', function () {
+ expect(groups[1].get('upgradeItems').mapProperty('status')).to.eql(['ABORTED', 'PENDING']);
+ });
+ it('upgradeItems.[].progress_percent = [99, 0]', function () {
+ expect(groups[1].get('upgradeItems').mapProperty('progress_percent')).to.eql([99, 0]);
+ });
+ it('hasExpandableItems is false', function () {
+ expect(groups[1].get('hasExpandableItems')).to.be.false;
+ });
});
});
@@ -802,14 +853,17 @@ describe('App.MainAdminStackAndUpgradeController', function() {
});
describe("#confirmDowngrade()", function() {
+
before(function () {
sinon.spy(App, 'showConfirmationPopup');
sinon.stub(controller, 'downgrade', Em.K);
});
+
after(function () {
App.showConfirmationPopup.restore();
controller.downgrade.restore();
});
+
it("show confirmation popup", function() {
controller.set('currentVersion', Em.Object.create({
repository_version: '2.2',
@@ -826,8 +880,9 @@ describe('App.MainAdminStackAndUpgradeController', function() {
});
describe("#upgradeOptions()", function() {
- before(function () {
- sinon.spy(App, 'ModalPopup');
+ var version = Em.Object.create({displayName: 'HDP-2.2'});
+ beforeEach(function () {
+ sinon.spy(App.ModalPopup, 'show');
sinon.spy(App, 'showConfirmationFeedBackPopup');
sinon.stub(controller, 'getSupportedUpgradeTypes').returns({
done: function (callback) {
@@ -846,38 +901,77 @@ describe('App.MainAdminStackAndUpgradeController', function() {
status: 'CURRENT'
})
]);
- });
- beforeEach(function () {
controller.get('runningCheckRequests').clear();
});
- after(function () {
- App.ModalPopup.restore();
+
+ afterEach(function () {
+ App.ModalPopup.show.restore();
App.showConfirmationFeedBackPopup.restore();
controller.runPreUpgradeCheck.restore();
controller.getSupportedUpgradeTypes.restore();
controller.get('upgradeMethods').setEach('selected', false);
App.RepositoryVersion.find.restore();
});
- it("show confirmation popup", function() {
- var version = Em.Object.create({displayName: 'HDP-2.2'});
- controller.set('isDowngrade', false);
- var popup = controller.upgradeOptions(false, version);
- expect(App.ModalPopup.calledOnce).to.be.true;
- expect(controller.get('upgradeMethods').everyProperty('isCheckRequestInProgress')).to.be.true;
- expect(controller.get('upgradeMethods').someProperty('selected')).to.be.false;
- controller.get('upgradeMethods')[0].set('selected', true);
- var confirmPopup = popup.onPrimary();
- expect(App.showConfirmationFeedBackPopup.calledOnce).to.be.true;
- confirmPopup.onPrimary();
- expect(controller.runPreUpgradeCheck.calledWith(version)).to.be.true;
- expect( controller.get('runningCheckRequests')).to.have.length(1);
- });
- it("NOT show confirmation popup on Downgrade", function() {
- var version = Em.Object.create({displayName: 'HDP-2.2'});
- controller.set('isDowngrade', true);
- controller.upgradeOptions(false, version);
- expect(App.ModalPopup.calledOnce).to.be.false;
- expect( controller.get('runningCheckRequests')).to.have.length(1);
+
+ describe("show confirmation popup", function() {
+
+ beforeEach(function () {
+ controller.set('isDowngrade', false);
+ this.popup = controller.upgradeOptions(false, version);
+ });
+
+ it('popup is shown', function () {
+ expect(App.ModalPopup.show.calledOnce).to.be.true;
+ });
+
+ it('all upgradeMethods have isCheckRequestInProgress = true', function () {
+ expect(controller.get('upgradeMethods').everyProperty('isCheckRequestInProgress')).to.be.true;
+ });
+
+ it('upgradeMethods no one is selected', function () {
+ expect(controller.get('upgradeMethods').someProperty('selected')).to.be.false;
+ });
+
+ describe('#popup.onPrimary', function () {
+
+ beforeEach(function () {
+ controller.get('upgradeMethods')[0].set('selected', true);
+ this.confirmPopup = this.popup.onPrimary();
+ });
+
+ it('showConfirmationFeedBackPopup is called once', function () {
+ expect(App.showConfirmationFeedBackPopup.calledOnce).to.be.true;
+ });
+
+ describe('#confirmPopup.onPrimary', function () {
+ beforeEach(function () {
+ this.confirmPopup.onPrimary();
+ });
+
+ it('runPreUpgradeCheck is called with correct version', function () {
+ expect(controller.runPreUpgradeCheck.calledWith(version)).to.be.true;
+ });
+
+ it('runningCheckRequests has 1 item', function () {
+ expect(controller.get('runningCheckRequests')).to.have.length(1);
+ });
+
+ });
+
+ });
+
+ });
+
+ describe("NOT show confirmation popup on Downgrade", function() {
+ beforeEach(function () {
+ controller.set('isDowngrade', true);
+ controller.upgradeOptions(false, version);
+ });
+
+ it('runningCheckRequests has 1 item', function () {
+ expect( controller.get('runningCheckRequests')).to.have.length(1);
+ });
+
});
});
@@ -896,7 +990,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
});
describe("#downgrade()", function() {
- before(function () {
+ beforeEach(function () {
sinon.stub(App.ajax, 'send', Em.K);
sinon.stub(controller, 'abortUpgrade');
sinon.stub(App.RepositoryVersion, 'find').returns([
@@ -905,20 +999,25 @@ describe('App.MainAdminStackAndUpgradeController', function() {
repositoryVersion: '2.3'
})
]);
- });
- after(function () {
- App.ajax.send.restore();
- controller.abortUpgrade.restore();
- App.RepositoryVersion.find.restore();
- });
- it("make ajax call", function() {
controller.set('upgradeVersion', 'HDP-2.3');
controller.set('upgradeType', 'NON_ROLLING');
controller.downgrade(Em.Object.create({
repository_version: '2.2',
repository_name: 'HDP-2.2'
}), {context: 'context'});
+ this.callArgs = App.ajax.send.getCall(0).args[0];
+ });
+
+ afterEach(function () {
+ App.ajax.send.restore();
+ controller.abortUpgrade.restore();
+ App.RepositoryVersion.find.restore();
+ });
+
+ it('abortUpgrade is called once', function() {
expect(controller.abortUpgrade.calledOnce).to.be.true;
+ });
+ it('request-data is valid', function () {
expect(App.ajax.send.getCall(0).args[0].data).to.eql({
from: '2.3',
value: '2.2',
@@ -926,11 +1025,18 @@ describe('App.MainAdminStackAndUpgradeController', function() {
isDowngrade: true,
upgradeType: "NON_ROLLING"
});
- var callArgs = App.ajax.send.getCall(0).args[0];
- expect(callArgs.name).to.eql('admin.downgrade.start');
- expect(callArgs.sender).to.eql(controller);
- expect(callArgs.success).to.eql('upgradeSuccessCallback');
- expect(callArgs.callback).to.be.called;
+ });
+ it('request-name is valid', function () {
+ expect(this.callArgs.name).to.eql('admin.downgrade.start');
+ });
+ it('request-sender is valid', function () {
+ expect(this.callArgs.sender).to.eql(controller);
+ });
+ it('callback is valid', function () {
+ expect(this.callArgs.success).to.eql('upgradeSuccessCallback');
+ });
+ it('callback is called', function () {
+ expect(this.callArgs.callback).to.be.called;
});
});
@@ -1001,28 +1107,39 @@ describe('App.MainAdminStackAndUpgradeController', function() {
});
describe("#setUpgradeItemStatus()", function () {
- before(function () {
+ var item;
+ beforeEach(function () {
sinon.stub(App.ajax, 'send', function () {
return {
done: Em.clb
}
});
- });
- after(function () {
- App.ajax.send.restore();
- });
- it("valid request is sent", function () {
- var item = Em.Object.create({
+ item = Em.Object.create({
request_id: 1,
stage_id: 1,
group_id: 1
});
controller.setUpgradeItemStatus(item, 'PENDING');
- var callArgs = App.ajax.send.getCall(0).args[0];
- expect(callArgs.data).to.eql({upgradeId: 1, itemId: 1, groupId: 1, status: 'PENDING'});
- expect(callArgs.name).to.eql('admin.upgrade.upgradeItem.setState');
- expect(callArgs.sender).to.eql(controller);
- expect(callArgs.callback).to.be.called;
+ this.callArgs = App.ajax.send.getCall(0).args[0];
+ });
+
+ afterEach(function () {
+ App.ajax.send.restore();
+ });
+
+ it('request-data is valid', function () {
+ expect(this.callArgs.data).to.eql({upgradeId: 1, itemId: 1, groupId: 1, status: 'PENDING'});
+ });
+ it('request-name is valid', function () {
+ expect(this.callArgs.name).to.eql('admin.upgrade.upgradeItem.setState');
+ });
+ it('request-sendeer is valid', function () {
+ expect(this.callArgs.sender).to.eql(controller);
+ });
+ it('callback is called', function () {
+ expect(this.callArgs.callback).to.be.called;
+ });
+ it('item.status is PENDING', function () {
expect(item.get('status')).to.equal('PENDING');
});
});
@@ -1238,17 +1355,24 @@ describe('App.MainAdminStackAndUpgradeController', function() {
});
cases.forEach(function (item) {
- it(item.title, function () {
- sinon.stub(App.RepositoryVersion, 'find').returns([
- Em.Object.create({
- status: 'CURRENT',
- stackVersionType: item.stackVersionType
- })
- ]);
- controller.set('currentVersion', {
- repository_version: item.repoVersion
+ describe(item.title, function () {
+
+ beforeEach(function () {
+ sinon.stub(App.RepositoryVersion, 'find').returns([
+ Em.Object.create({
+ status: 'CURRENT',
+ stackVersionType: item.stackVersionType
+ })
+ ]);
+ controller.set('currentVersion', {
+ repository_version: item.repoVersion
+ });
});
- expect(App.get('isStormMetricsSupported')).to.equal(item.isStormMetricsSupported);
+
+ it('isStormMetricsSupported is ' + (item.isStormMetricsSupported ? '' : 'not') + ' supported', function () {
+ expect(App.get('isStormMetricsSupported')).to.equal(item.isStormMetricsSupported);
+ });
+
});
});
@@ -1259,25 +1383,42 @@ describe('App.MainAdminStackAndUpgradeController', function() {
beforeEach(function() {
sinon.stub($, 'ajax', Em.K);
controller.set('isFinalizeItem', true);
+ this.stub = sinon.stub(App, 'get');
});
afterEach(function () {
$.ajax.restore();
+ this.stub.restore();
});
- it('should do ajax-request', function () {
- sinon.stub(App, 'get').withArgs('upgradeState').returns('HOLDING');
- controller.updateFinalize();
- App.get.restore();
- expect($.ajax.calledOnce).to.be.true;
+ describe('should do ajax-request', function () {
+
+ beforeEach(function () {
+ this.stub.withArgs('upgradeState').returns('HOLDING');
+ controller.updateFinalize();
+ });
+
+ it('request is sent', function () {
+ expect($.ajax.calledOnce).to.be.true;
+ });
+
});
- it('shouldn\'t do ajax-request', function () {
- sinon.stub(App, 'get').withArgs('upgradeState').returns('HOLDING_TIMEDOUT');
- controller.updateFinalize();
- App.get.restore();
- expect(controller.get('isFinalizeItem')).to.be.false;
- expect($.ajax.calledOnce).to.be.false;
+ describe('shouldn\'t do ajax-request', function () {
+
+ beforeEach(function () {
+ this.stub.withArgs('upgradeState').returns('HOLDING_TIMEDOUT');
+ controller.updateFinalize();
+ });
+
+ it('request is not sent', function () {
+ expect($.ajax.called).to.be.false;
+ });
+
+ it('isFinalizeItem is false', function () {
+ expect(controller.get('isFinalizeItem')).to.be.false;
+ });
+
});
});
@@ -1900,19 +2041,38 @@ describe('App.MainAdminStackAndUpgradeController', function() {
});
cases.forEach(function (item) {
- it(item.title, function () {
- var runningCheckRequests = controller.get('runningCheckRequests');
- appGetMock.returns(item.supportsPreUpgradeCheck);
- controller.runPreUpgradeCheckOnly({
- type: item.type
+ describe(item.title, function () {
+ var runningCheckRequests;
+ beforeEach(function () {
+ runningCheckRequests = controller.get('runningCheckRequests');
+ appGetMock.returns(item.supportsPreUpgradeCheck);
+ controller.runPreUpgradeCheckOnly({
+ type: item.type
+ });
});
- expect(upgradeMethods.findProperty('type', 'ROLLING').getProperties('isCheckComplete', 'isCheckRequestInProgress', 'action')).to.eql(item.ru);
- expect(upgradeMethods.findProperty('type', 'NON_ROLLING').getProperties('isCheckComplete', 'isCheckRequestInProgress', 'action')).to.eql(item.eu);
- expect(App.ajax.send.callCount).to.equal(item.ajaxCallCount);
- expect(runningCheckRequests).to.have.length(item.runningCheckRequestsLength);
+
+ it('ROLLING properties', function () {
+ expect(upgradeMethods.findProperty('type', 'ROLLING').getProperties('isCheckComplete', 'isCheckRequestInProgress', 'action')).to.eql(item.ru);
+ });
+
+ it('NON_ROLLING properties', function () {
+ expect(upgradeMethods.findProperty('type', 'NON_ROLLING').getProperties('isCheckComplete', 'isCheckRequestInProgress', 'action')).to.eql(item.eu);
+ });
+
+ it(item.ajaxCallCount + ' requests sent', function () {
+ expect(App.ajax.send.callCount).to.equal(item.ajaxCallCount);
+ });
+
+ it('runningCheckRequests length is ' + item.runningCheckRequestsLength, function () {
+ expect(runningCheckRequests).to.have.length(item.runningCheckRequestsLength);
+ });
+
if (item.runningCheckRequestsLength) {
- expect(runningCheckRequests[0].type).to.equal(item.type);
+ it('runningCheckRequests.type is ' + item.type, function () {
+ expect(runningCheckRequests[0].type).to.equal(item.type);
+ });
}
+
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js b/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
index 530c6ad..f39f7bf 100644
--- a/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
@@ -474,8 +474,7 @@ describe('App.MainAlertDefinitionConfigsController', function () {
describe('#changeType()', function () {
- it('should disable and enable appropriate configs', function () {
-
+ beforeEach(function () {
controller.set('allServices', ['service1', 'service2']);
controller.set('allScopes', ['scope1', 'scope2']);
@@ -484,25 +483,57 @@ describe('App.MainAlertDefinitionConfigsController', function () {
Em.Object.create({name: 'component', isDisabled: false}),
Em.Object.create({name: 'scope', isDisabled: false})
]);
+ });
- controller.changeType('Host Alert Definition');
+ describe('Host Alert Definition', function () {
- expect(controller.get('configs').everyProperty('isDisabled', true)).to.be.true;
- expect(controller.get('configs').findProperty('name', 'service').get('options')).to.eql(['Ambari']);
- expect(controller.get('configs').findProperty('name', 'service').get('value')).to.equal('Ambari');
- expect(controller.get('configs').findProperty('name', 'component').get('value')).to.equal('Ambari Agent');
- expect(controller.get('configs').findProperty('name', 'scope').get('options')).to.eql(['Host']);
- expect(controller.get('configs').findProperty('name', 'scope').get('value')).to.equal('Host');
+ beforeEach(function () {
+ controller.changeType('Host Alert Definition');
+ });
- controller.changeType('alert_type_service');
+ it('all configs are disabled', function () {
+ expect(controller.get('configs').everyProperty('isDisabled', true)).to.be.true;
+ });
+ it('service.options = ["Ambari"]', function () {
+ expect(controller.get('configs').findProperty('name', 'service').get('options')).to.eql(['Ambari']);
+ });
+ it('service.value = "Ambari"', function () {
+ expect(controller.get('configs').findProperty('name', 'service').get('value')).to.equal('Ambari');
+ });
+ it('component.value = "Ambari Agent"', function () {
+ expect(controller.get('configs').findProperty('name', 'component').get('value')).to.equal('Ambari Agent');
+ });
+ it('scope.options = ["Host"]', function () {
+ expect(controller.get('configs').findProperty('name', 'scope').get('options')).to.eql(['Host']);
+ });
+ it('isDisabled.value = "Host"', function () {
+ expect(controller.get('configs').findProperty('name', 'scope').get('value')).to.equal('Host');
+ });
+ });
- expect(controller.get('configs').everyProperty('isDisabled', false)).to.be.true;
- expect(controller.get('configs').findProperty('name', 'service').get('options')).to.eql(['service1', 'service2']);
- expect(controller.get('configs').findProperty('name', 'service').get('value')).to.equal('service1');
- expect(controller.get('configs').findProperty('name', 'component').get('value')).to.equal('No component');
- expect(controller.get('configs').findProperty('name', 'scope').get('options')).to.eql(['scope1', 'scope2']);
- expect(controller.get('configs').findProperty('name', 'scope').get('value')).to.equal('scope1');
+ describe('alert_type_service', function () {
+ beforeEach(function () {
+ controller.changeType('alert_type_service');
+ });
+ it('all configs are not disabled', function () {
+ expect(controller.get('configs').everyProperty('isDisabled', false)).to.be.true;
+ });
+ it('service.options = ["service1", "service2"]', function () {
+ expect(controller.get('configs').findProperty('name', 'service').get('options')).to.eql(['service1', 'service2']);
+ });
+ it('service.value = "service1"', function () {
+ expect(controller.get('configs').findProperty('name', 'service').get('value')).to.equal('service1');
+ });
+ it('component.value = "No component"', function () {
+ expect(controller.get('configs').findProperty('name', 'component').get('value')).to.equal('No component');
+ });
+ it('scope.options = ["scope1", "scope2"]', function () {
+ expect(controller.get('configs').findProperty('name', 'scope').get('options')).to.eql(['scope1', 'scope2']);
+ });
+ it('scope.value = "scope1"', function () {
+ expect(controller.get('configs').findProperty('name', 'scope').get('value')).to.equal('scope1');
+ });
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js b/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
index 25ed383..025ce86 100644
--- a/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
@@ -585,20 +585,20 @@ describe('App.ManageAlertNotificationsController', function () {
expect(view.get('parentView.hasErrors')).to.be.true;
});
- it('should check inputFields.name.value', function () {
+ it('should check inputFields.name.value (2)', function () {
view.set('controller.inputFields.name.errorMsg', 'error');
view.set('controller.inputFields.name.value', 'test');
expect(view.get('controller.inputFields.name.errorMsg')).to.equal('');
});
- it('should check inputFields.name.value', function () {
+ it('should check inputFields.name.value (3)', function () {
view.set('isEdit', true);
view.set('controller.inputFields.name.value', '');
expect(view.get('controller.inputFields.name.errorMsg')).to.equal(Em.I18n.t('alerts.actions.manage_alert_notifications_popup.error.name.empty'));
expect(view.get('parentView.hasErrors')).to.be.true;
});
- it('should check inputFields.name.value', function () {
+ it('should check inputFields.name.value (4)', function () {
view.set('isEdit', true);
view.set('controller.inputFields.name.errorMsg', 'error');
view.set('controller.inputFields.name.value', 'test');
@@ -620,7 +620,7 @@ describe('App.ManageAlertNotificationsController', function () {
});
- it('should check inputFields.retypeSMTPPassword.value', function () {
+ it('should check inputFields.retypeSMTPPassword.value (2)', function () {
view.set('parentView.hasErrors', true);
view.set('controller.inputFields.retypeSMTPPassword.errorMsg', 'error');
@@ -883,24 +883,33 @@ describe('App.ManageAlertNotificationsController', function () {
});
describe('#deleteAlertNotificationSuccessCallback()', function () {
+ var mockSelectedAlertNotification;
- it("should call loadAlertNotifications, selectedAlertNotification.deleteRecord and set null to selectedAlertNotification", function () {
-
- var mockSelectedAlertNotification = {
+ beforeEach(function () {
+ mockSelectedAlertNotification = {
deleteRecord: Em.K
};
controller.set('selectedAlertNotification', mockSelectedAlertNotification);
sinon.stub(controller, 'loadAlertNotifications', Em.K);
sinon.spy(mockSelectedAlertNotification, 'deleteRecord');
-
controller.deleteAlertNotificationSuccessCallback();
+ });
+
+ afterEach(function () {
+ controller.loadAlertNotifications.restore();
+ mockSelectedAlertNotification.deleteRecord.restore();
+ });
+ it("should call loadAlertNotifications", function () {
expect(controller.loadAlertNotifications.calledOnce).to.be.true;
+ });
+
+ it("should call selectedAlertNotification.deleteRecord", function () {
expect(mockSelectedAlertNotification.deleteRecord.calledOnce).to.be.true;
- expect(controller.get('selectedAlertNotification')).to.equal(null);
+ });
- controller.loadAlertNotifications.restore();
- mockSelectedAlertNotification.deleteRecord.restore();
+ it("should set null to selectedAlertNotification", function () {
+ expect(controller.get('selectedAlertNotification')).to.equal(null);
});
});
[09/50] [abbrv] ambari git commit: AMBARI-14485 Unable to reconfigure
truststore with ambari-server setup-security (dsen)
Posted by nc...@apache.org.
AMBARI-14485 Unable to reconfigure truststore with ambari-server setup-security (dsen)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9c6f7490
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9c6f7490
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9c6f7490
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 9c6f7490d5d4c8365c00c860fb3aacf554ab7bad
Parents: 30e6c68
Author: Dmytro Sen <ds...@apache.org>
Authored: Mon Dec 28 17:20:42 2015 +0200
Committer: Dmytro Sen <ds...@apache.org>
Committed: Mon Dec 28 17:20:42 2015 +0200
----------------------------------------------------------------------
.../src/main/python/ambari_server/setupHttps.py | 22 ++--
.../src/test/python/TestAmbariServer.py | 103 ++++++++++++++++---
2 files changed, 102 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/9c6f7490/ambari-server/src/main/python/ambari_server/setupHttps.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/setupHttps.py b/ambari-server/src/main/python/ambari_server/setupHttps.py
index c9fe421..4e95999 100644
--- a/ambari-server/src/main/python/ambari_server/setupHttps.py
+++ b/ambari-server/src/main/python/ambari_server/setupHttps.py
@@ -82,7 +82,7 @@ SRVR_ONE_WAY_SSL_PORT = "8440"
GANGLIA_HTTPS = 'ganglia.https'
-def get_truststore_path(properties):
+def get_and_persist_truststore_path(properties):
truststore_path = properties.get_property(SSL_TRUSTSTORE_PATH_PROPERTY)
if not truststore_path:
SSL_TRUSTSTORE_PATH_DEFAULT = get_value_from_properties(properties, SSL_TRUSTSTORE_PATH_PROPERTY)
@@ -98,7 +98,7 @@ def get_truststore_path(properties):
return truststore_path
-def get_truststore_type(properties):
+def get_and_persist_truststore_type(properties):
truststore_type = properties.get_property(SSL_TRUSTSTORE_TYPE_PROPERTY)
if not truststore_type:
SSL_TRUSTSTORE_TYPE_DEFAULT = get_value_from_properties(properties, SSL_TRUSTSTORE_TYPE_PROPERTY, "jks")
@@ -113,7 +113,7 @@ def get_truststore_type(properties):
return truststore_type
-def get_truststore_password(properties):
+def get_and_persist_truststore_password(properties):
truststore_password = properties.get_property(SSL_TRUSTSTORE_PASSWORD_PROPERTY)
isSecure = get_is_secure(properties)
if truststore_password:
@@ -462,9 +462,19 @@ def setup_truststore(import_cert=False):
properties = get_ambari_properties()
if get_YN_input("Do you want to configure a truststore [y/n] (y)? ", True):
- truststore_type = get_truststore_type(properties)
- truststore_path = get_truststore_path(properties)
- truststore_password = get_truststore_password(properties)
+
+ #Re-configuration enabled only for option "Setup truststore"
+ if not import_cert and properties.get_property(SSL_TRUSTSTORE_TYPE_PROPERTY)\
+ and get_YN_input(
+ "The truststore is already configured. Do you want to re-configure "
+ "the truststore [y/n] (y)? ", True):
+ properties.removeProp(SSL_TRUSTSTORE_TYPE_PROPERTY)
+ properties.removeProp(SSL_TRUSTSTORE_PATH_PROPERTY)
+ properties.removeProp(SSL_TRUSTSTORE_PASSWORD_PROPERTY)
+
+ truststore_type = get_and_persist_truststore_type(properties)
+ truststore_path = get_and_persist_truststore_path(properties)
+ truststore_password = get_and_persist_truststore_password(properties)
if import_cert:
http://git-wip-us.apache.org/repos/asf/ambari/blob/9c6f7490/ambari-server/src/test/python/TestAmbariServer.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestAmbariServer.py b/ambari-server/src/test/python/TestAmbariServer.py
index fde647a..970bcab 100644
--- a/ambari-server/src/test/python/TestAmbariServer.py
+++ b/ambari-server/src/test/python/TestAmbariServer.py
@@ -1904,21 +1904,21 @@ class TestAmbariServer(TestCase):
@patch("ambari_server.setupHttps.get_validated_filepath_input")
@patch("ambari_server.setupHttps.get_validated_string_input")
@patch("ambari_server.setupHttps.run_os_command")
- @patch("ambari_server.setupHttps.get_truststore_type")
+ @patch("ambari_server.setupHttps.get_and_persist_truststore_type")
@patch("__builtin__.open")
@patch("ambari_server.setupHttps.find_properties_file")
@patch("ambari_server.setupHttps.run_component_https_cmd")
@patch("ambari_server.setupHttps.get_delete_cert_command")
- @patch("ambari_server.setupHttps.get_truststore_password")
- @patch("ambari_server.setupHttps.get_truststore_path")
+ @patch("ambari_server.setupHttps.get_and_persist_truststore_password")
+ @patch("ambari_server.setupHttps.get_and_persist_truststore_path")
@patch("ambari_server.setupHttps.get_YN_input")
@patch("ambari_server.setupHttps.get_ambari_properties")
@patch("ambari_server.setupHttps.find_jdk")
def test_setup_truststore(self, find_jdk_mock, get_ambari_properties_mock, get_YN_input_mock,
- get_truststore_path_mock, get_truststore_password_mock,
+ get_and_persist_truststore_path_mock, get_and_persist_truststore_password_mock,
get_delete_cert_command_mock, run_component_https_cmd_mock,
find_properties_file_mock, open_mock,
- get_truststore_type_mock, run_os_command_mock,
+ get_and_persist_truststore_type_mock, run_os_command_mock,
get_validated_string_input_mock,
get_validated_filepath_input_mock):
out = StringIO.StringIO()
@@ -1956,13 +1956,13 @@ class TestAmbariServer(TestCase):
find_jdk_mock.return_value = "/jdk_path"
p.get_property.side_effect = ["true"]
get_YN_input_mock.side_effect = [True,True]
- get_truststore_path_mock.return_value = "/truststore_path"
- get_truststore_password_mock.return_value = "/truststore_password"
+ get_and_persist_truststore_path_mock.return_value = "/truststore_path"
+ get_and_persist_truststore_password_mock.return_value = "/truststore_password"
get_delete_cert_command_mock.return_value = "rm -f"
setup_truststore(True)
- self.assertTrue(get_truststore_path_mock.called)
- self.assertTrue(get_truststore_password_mock.called)
+ self.assertTrue(get_and_persist_truststore_path_mock.called)
+ self.assertTrue(get_and_persist_truststore_password_mock.called)
self.assertTrue(get_delete_cert_command_mock.called)
self.assertTrue(find_properties_file_mock.called)
self.assertTrue(open_mock.called)
@@ -1970,8 +1970,8 @@ class TestAmbariServer(TestCase):
self.assertTrue(run_component_https_cmd_mock.called)
p.process_pair.reset_mock()
- get_truststore_path_mock.reset_mock()
- get_truststore_password_mock.reset_mock()
+ get_and_persist_truststore_path_mock.reset_mock()
+ get_and_persist_truststore_password_mock.reset_mock()
get_delete_cert_command_mock.reset_mock()
find_properties_file_mock.reset_mock()
open_mock.reset_mock()
@@ -1981,9 +1981,9 @@ class TestAmbariServer(TestCase):
get_YN_input_mock.side_effect = [True,True]
setup_truststore(True)
- self.assertTrue(get_truststore_type_mock.called)
- self.assertTrue(get_truststore_path_mock.called)
- self.assertTrue(get_truststore_password_mock.called)
+ self.assertTrue(get_and_persist_truststore_type_mock.called)
+ self.assertTrue(get_and_persist_truststore_path_mock.called)
+ self.assertTrue(get_and_persist_truststore_password_mock.called)
self.assertTrue(get_delete_cert_command_mock.called)
self.assertTrue(find_properties_file_mock.called)
self.assertTrue(open_mock.called)
@@ -1993,9 +1993,9 @@ class TestAmbariServer(TestCase):
self.assertTrue(get_validated_filepath_input_mock.called)
p.process_pair.reset_mock()
- get_truststore_type_mock.reset_mock()
- get_truststore_path_mock.reset_mock()
- get_truststore_password_mock.reset_mock()
+ get_and_persist_truststore_type_mock.reset_mock()
+ get_and_persist_truststore_path_mock.reset_mock()
+ get_and_persist_truststore_password_mock.reset_mock()
get_delete_cert_command_mock.reset_mock()
find_properties_file_mock.reset_mock()
open_mock.reset_mock()
@@ -2003,6 +2003,75 @@ class TestAmbariServer(TestCase):
run_os_command_mock.reset_mock()
get_validated_filepath_input_mock.reset_mock()
pass
+
+ @patch("__builtin__.open")
+ @patch("ambari_commons.logging_utils.get_silent")
+ @patch("ambari_server.setupHttps.find_jdk")
+ @patch("ambari_server.setupHttps.get_ambari_properties")
+ @patch("ambari_server.setupHttps.get_YN_input")
+ @patch("ambari_server.setupHttps.get_and_persist_truststore_type")
+ @patch("ambari_server.setupHttps.get_and_persist_truststore_path")
+ @patch("ambari_server.setupHttps.get_and_persist_truststore_password")
+ @patch("ambari_server.setupHttps.find_properties_file")
+ @patch("ambari_server.setupHttps.get_validated_string_input")
+ @patch("ambari_server.setupHttps.run_os_command")
+ @patch("ambari_server.setupHttps.get_validated_filepath_input")
+ @patch("ambari_server.setupHttps.get_import_cert_command")
+ @patch("ambari_server.setupHttps.run_component_https_cmd")
+ def test_reconfigure_truststore(self, run_component_https_cmd_mock,
+ get_import_cert_command_mock,
+ get_validated_filepath_input_mock, run_os_command_mock,
+ get_validated_string_input_mock, find_properties_file_mock,
+ get_and_persist_truststore_password_mock, get_and_persist_truststore_path_mock,
+ get_and_persist_truststore_type_mock, get_YN_input_mock,
+ get_ambari_properties_mock, find_jdk_mock, get_silent_mock,
+ open_mock):
+
+ def reset_mocks():
+ open_mock.reset_mock()
+ find_jdk_mock.reset_mock()
+ get_ambari_properties_mock.reset_mock()
+ get_YN_input_mock.reset_mock()
+ get_and_persist_truststore_type_mock.reset_mock()
+ get_and_persist_truststore_path_mock.reset_mock()
+ get_and_persist_truststore_password_mock.reset_mock()
+ find_properties_file_mock.reset_mock()
+ get_validated_string_input_mock.reset_mock()
+ run_os_command_mock.reset_mock()
+ get_validated_filepath_input_mock.reset_mock()
+ get_import_cert_command_mock.reset_mock()
+ run_component_https_cmd_mock.reset_mock()
+
+ #Test preconditions
+ get_silent_mock.return_value = False
+ find_jdk_mock.return_value = "/path"
+
+ #Reconfiguration allowed by the user
+ reset_mocks()
+ get_YN_input_mock.side_effect = [True, True, True]
+ setup_truststore()
+ self.assertTrue(get_and_persist_truststore_type_mock.called)
+ self.assertTrue(get_and_persist_truststore_path_mock.called)
+ self.assertTrue(get_and_persist_truststore_password_mock.called)
+
+ #Reconfiguration disallowed by the user
+ reset_mocks()
+ get_YN_input_mock.side_effect = [True, False]
+ setup_truststore()
+ self.assertTrue(get_and_persist_truststore_type_mock.called)
+ self.assertTrue(get_and_persist_truststore_path_mock.called)
+ self.assertTrue(get_and_persist_truststore_password_mock.called)
+
+ #Reconfiguration should be disabled when 'import_cert' flag is 'True'
+ reset_mocks()
+ get_YN_input_mock.side_effect = [True, True]
+ setup_truststore(True)
+ self.assertTrue(get_and_persist_truststore_type_mock.called)
+ self.assertTrue(get_and_persist_truststore_path_mock.called)
+ self.assertTrue(get_and_persist_truststore_password_mock.called)
+ self.assertTrue(get_import_cert_command_mock.called)
+
+ pass
@patch("ambari_server.setupHttps.adjust_directory_permissions")
@patch("ambari_server.setupHttps.read_ambari_user")
[35/50] [abbrv] ambari git commit: AMBARI-14412. Recommend PXF
component to be collocated with NAMENODE and DATANODE (mithmatt via
odiachenko).
Posted by nc...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/c96a9e41/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
index 67ac25f..aa7688b 100644
--- a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
@@ -152,6 +152,19 @@ class TestHDP23StackAdvisor(TestCase):
self.assertFalse('HAWQSEGMENT' in recommendedComponents)
+ def test_createComponentLayoutRecommendations_pxf_co_locate_with_namenode_or_datanode(self):
+ """ Test that PXF gets recommended on same host group which has NAMENODE or DATANODE"""
+
+ services = self.load_json("services-pxf-hdfs.json")
+ hosts = self.load_json("hosts-3-hosts.json")
+ recommendations = self.stackAdvisor.createComponentLayoutRecommendations(services, hosts)
+
+ for hostgroup in recommendations["blueprint"]["host_groups"]:
+ component_names = [component["name"] for component in hostgroup["components"]]
+ if "NAMENODE" in component_names or "DATANODE" in component_names:
+ self.assertTrue("PXF" in component_names)
+
+
def fqdn_mock_result(value=None):
return 'c6401.ambari.apache.org' if value is None else value
[10/50] [abbrv] ambari git commit: AMBARI-14489 EU/RU: failure not
shown on all levels. (ababiichuk)
Posted by nc...@apache.org.
AMBARI-14489 EU/RU: failure not shown on all levels. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f2b1a89a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f2b1a89a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f2b1a89a
Branch: refs/heads/branch-dev-patch-upgrade
Commit: f2b1a89ac66946ea3b86bace27e78ac59a737a12
Parents: 9c6f749
Author: ababiichuk <ab...@hortonworks.com>
Authored: Mon Dec 28 18:15:26 2015 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Mon Dec 28 18:15:35 2015 +0200
----------------------------------------------------------------------
ambari-web/app/models/upgrade_entity.js | 2 ++
.../app/templates/main/admin/stack_upgrade/upgrade_group.hbs | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/f2b1a89a/ambari-web/app/models/upgrade_entity.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/upgrade_entity.js b/ambari-web/app/models/upgrade_entity.js
index 89709b2..70d1840 100644
--- a/ambari-web/app/models/upgrade_entity.js
+++ b/ambari-web/app/models/upgrade_entity.js
@@ -78,6 +78,8 @@ App.upgradeEntity = Em.Object.extend({
return this.get('type') === 'GROUP' && (this.get('isActive') || this.get('hasExpandableItems'));
}.property('isActive', 'hasExpandableItems'),
+ upgradeItemStatus: Em.computed.firstNotBlank('display_status', 'status'),
+
upgradeGroupStatus: function () {
if (this.get('status') === 'ABORTED') {
return 'SUSPENDED';
http://git-wip-us.apache.org/repos/asf/ambari/blob/f2b1a89a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_group.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_group.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_group.hbs
index ab0d70e..60cf553 100644
--- a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_group.hbs
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_group.hbs
@@ -44,7 +44,7 @@
{{#if item.isVisible}}
<div class="row-fluid">
<div {{bindAttr class="item.isActive::not-active-link :span8 :upgrade-item-text"}}>
- {{statusIcon item.status}}
+ {{statusIcon item.upgradeItemStatus}}
<a href="#" {{action toggleExpanded item view.content.upgradeItems target="view"}}>{{item.context}}</a>
</div>
{{#if item.isRunning}}
@@ -75,4 +75,4 @@
{{/if}}
{{/each}}
-</div>
\ No newline at end of file
+</div>
[50/50] [abbrv] ambari git commit: Merge branch 'trunk' into
branch-dev-patch-upgrade
Posted by nc...@apache.org.
Merge branch 'trunk' into branch-dev-patch-upgrade
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5310b95e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5310b95e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5310b95e
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 5310b95e63b955c697f33413b3af0bce8068f9fc
Parents: 99ce307 7a9e624
Author: Nate Cole <nc...@hortonworks.com>
Authored: Mon Jan 4 16:37:36 2016 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Mon Jan 4 16:37:36 2016 -0500
----------------------------------------------------------------------
.../main/resources/ui/admin-web/app/index.html | 12 +-
.../app/scripts/controllers/NavbarCtrl.js | 16 +-
.../ambariViews/CreateViewInstanceCtrl.js | 18 +-
.../controllers/ambariViews/ViewsEditCtrl.js | 40 +-
.../controllers/ambariViews/ViewsListCtrl.js | 11 +-
.../clusters/ClustersManageAccessCtrl.js | 10 +-
.../controllers/clusters/UserAccessListCtrl.js | 52 +-
.../controllers/groups/GroupsCreateCtrl.js | 7 +-
.../controllers/groups/GroupsEditCtrl.js | 24 +-
.../controllers/groups/GroupsListCtrl.js | 36 +-
.../app/scripts/controllers/mainCtrl.js | 11 +-
.../stackVersions/StackVersionsCreateCtrl.js | 14 +-
.../stackVersions/StackVersionsEditCtrl.js | 30 +-
.../stackVersions/StackVersionsListCtrl.js | 13 +-
.../controllers/users/UsersCreateCtrl.js | 10 +-
.../scripts/controllers/users/UsersListCtrl.js | 45 +-
.../scripts/controllers/users/UsersShowCtrl.js | 64 +-
.../app/scripts/directives/editableList.js | 8 +-
.../ui/admin-web/app/scripts/i18n.config.js | 284 +-
.../ui/admin-web/app/scripts/services/Alert.js | 2 +-
.../app/scripts/services/ConfirmationModal.js | 8 +-
.../ui/admin-web/app/scripts/services/Stack.js | 31 +-
.../app/scripts/services/UnsavedDialog.js | 2 +-
.../app/scripts/services/UserConstants.js | 6 +-
.../resources/ui/admin-web/app/styles/main.css | 9 +-
.../admin-web/app/views/ambariViews/create.html | 56 +-
.../admin-web/app/views/ambariViews/edit.html | 86 +-
.../app/views/ambariViews/listTable.html | 24 +-
.../app/views/ambariViews/modals/create.html | 34 +-
.../app/views/ambariViews/modals/edit.html | 44 +-
.../app/views/clusters/manageAccess.html | 10 +-
.../app/views/clusters/userAccessList.html | 22 +-
.../app/views/directives/editableList.html | 4 +-
.../ui/admin-web/app/views/groups/create.html | 16 +-
.../ui/admin-web/app/views/groups/edit.html | 28 +-
.../ui/admin-web/app/views/groups/list.html | 26 +-
.../ui/admin-web/app/views/leftNavbar.html | 26 +-
.../resources/ui/admin-web/app/views/main.html | 38 +-
.../admin-web/app/views/modals/AboutModal.html | 16 +-
.../views/modals/BodyForDeregisterVersion.html | 2 +-
.../app/views/modals/TimeoutWarning.html | 4 +-
.../admin-web/app/views/stackVersions/list.html | 24 +-
.../views/stackVersions/stackVersionPage.html | 41 +-
.../ui/admin-web/app/views/users/create.html | 42 +-
.../ui/admin-web/app/views/users/list.html | 30 +-
.../app/views/users/modals/changePassword.html | 28 +-
.../ui/admin-web/app/views/users/show.html | 42 +-
.../clusters/UserAccessListCtrl_test.js | 223 ++
.../controllers/groups/GroupsListCtrl_test.js | 129 +
.../stackVersions/StackversionsListCtrl_test.js | 119 +-
.../controllers/users/UsersListCtrl_test.js | 383 ++
ambari-server/pom.xml | 11 -
.../AmbariManagementControllerImpl.java | 134 +-
.../ambari/server/controller/AmbariServer.java | 8 +-
.../server/controller/KerberosHelper.java | 2 +-
.../server/controller/KerberosHelperImpl.java | 71 +-
.../controller/ServiceComponentRequest.java | 7 +-
.../internal/ComponentResourceProvider.java | 604 +--
.../HostKerberosIdentityResourceProvider.java | 9 +-
.../controller/utilities/DatabaseChecker.java | 136 +-
.../server/metadata/RoleCommandOrder.java | 3 +
.../ambari/server/stack/StackDirectory.java | 6 +-
.../kerberos/KerberosPrincipalDescriptor.java | 13 +-
.../state/kerberos/KerberosPrincipalType.java | 22 +-
.../ambari/server/topology/AmbariContext.java | 4 +
.../topology/ClusterConfigurationRequest.java | 2 +-
.../ambari/server/topology/HostRequest.java | 4 +
.../ambari/server/topology/LogicalRequest.java | 35 +-
.../server/upgrade/UpgradeCatalog211.java | 140 +-
.../server/upgrade/UpgradeCatalog221.java | 14 +-
.../src/main/package/deb/control/preinst | 2 +-
.../src/main/package/rpm/preinstall.sh | 2 +-
ambari-server/src/main/python/ambari-server.py | 4 +
.../python/ambari_server/serverConfiguration.py | 14 +
.../src/main/python/ambari_server/setupHttps.py | 22 +-
.../src/main/python/ambari_server_main.py | 13 +-
.../main/resources/Ambari-DDL-Derby-CREATE.sql | 5 +
.../main/resources/Ambari-DDL-MySQL-CREATE.sql | 5 +
.../main/resources/Ambari-DDL-Oracle-CREATE.sql | 5 +
.../resources/Ambari-DDL-Postgres-CREATE.sql | 5 +
.../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql | 5 +
.../resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 5 +
.../resources/Ambari-DDL-SQLServer-CREATE.sql | 5 +
.../0.1.0/configuration/ams-hbase-site.xml | 16 +
.../HAWQ/2.0.0/package/scripts/common.py | 17 +-
.../HAWQ/2.0.0/package/scripts/master_helper.py | 13 +-
.../HAWQ/2.0.0/package/scripts/params.py | 21 +
.../HDFS/2.1.0.2.0/configuration/hdfs-site.xml | 6 +
.../2.1.0.2.0/package/scripts/hdfs_namenode.py | 49 +-
.../package/scripts/hdfs_nfsgateway.py | 5 +-
.../HDFS/2.1.0.2.0/package/scripts/namenode.py | 36 +-
.../2.1.0.2.0/package/scripts/params_linux.py | 1 +
.../MAHOUT/1.0.0.2.3/package/scripts/params.py | 2 +
.../0.4.0/package/scripts/ranger_service.py | 2 +-
.../0.4.0/package/scripts/setup_ranger_xml.py | 14 +-
.../RANGER_KMS/0.5.0.2.3/package/scripts/kms.py | 2 +-
.../0.9.1.2.1/configuration/storm-site.xml | 3 +-
.../custom_actions/scripts/install_packages.py | 8 +-
.../src/main/resources/role_command_order.json | 104 -
.../before-START/files/fast-hdfs-resource.jar | Bin 19285353 -> 19285461 bytes
.../stacks/HDP/2.0.6/services/stack_advisor.py | 48 +-
.../stacks/HDP/2.2/services/stack_advisor.py | 5 +-
.../stacks/HDP/2.3/services/stack_advisor.py | 28 +-
.../HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml | 1 -
.../HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml | 960 +++++
.../stacks/HDP/2.3/upgrades/upgrade-2.3.xml | 6 +
.../stacks/HDP/2.3/upgrades/upgrade-2.4.xml | 847 +++++
.../stacks/HDP/2.4/upgrades/config-upgrade.xml | 92 +
.../HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml | 1001 +++++
.../stacks/HDP/2.4/upgrades/upgrade-2.4.xml | 808 ++++
.../server/controller/KerberosHelperTest.java | 61 +-
.../internal/ComponentResourceProviderTest.java | 213 +-
.../utilities/DatabaseCheckerTest.java | 28 +-
.../KerberosPrincipalDescriptorTest.java | 73 +
.../ClusterConfigurationRequestTest.java | 43 +-
.../server/upgrade/UpgradeCatalog221Test.java | 31 +
.../src/test/python/TestAmbariServer.py | 103 +-
.../custom_actions/TestInstallPackages.py | 56 +-
.../python/stacks/2.0.6/HDFS/test_namenode.py | 18 +-
.../python/stacks/2.0.6/HDFS/test_nfsgateway.py | 8 +
.../stacks/2.0.6/common/test_stack_advisor.py | 47 +-
.../python/stacks/2.0.6/configs/default.json | 1 +
.../python/stacks/2.0.6/configs/secured.json | 1 +
.../stacks/2.1/common/test_stack_advisor.py | 15 +-
.../stacks/2.2/common/test_stack_advisor.py | 50 +-
.../stacks/2.3/common/services-pxf-hdfs.json | 3490 ++++++++++++++++++
.../stacks/2.3/common/test_stack_advisor.py | 57 +-
.../stacks/HDP/0.1/role_command_order.json | 104 +
.../stacks/HDP/2.0.5/role_command_order.json | 104 +
ambari-web/app/assets/test/tests.js | 3 +-
.../resourceManager/step3_controller.js | 12 +-
.../resourceManager/step4_controller.js | 40 +-
.../main/admin/kerberos/step2_controller.js | 12 +-
.../main/admin/stack_and_upgrade_controller.js | 14 +
ambari-web/app/controllers/main/service.js | 31 +-
.../controllers/main/service/add_controller.js | 5 +-
.../controllers/main/service/info/configs.js | 22 +-
.../service/manage_config_groups_controller.js | 20 +-
.../app/controllers/wizard/step6_controller.js | 120 +-
.../app/controllers/wizard/step7_controller.js | 144 +-
ambari-web/app/data/HDP2/rm_ha_properties.js | 20 +-
ambari-web/app/messages.js | 6 +-
ambari-web/app/mixins.js | 3 +
.../configs/config_recommendation_parser.js | 248 ++
.../common/configs/config_recommendations.js | 201 +
...onfig_with_override_recommendation_parser.js | 112 +
.../app/mixins/common/configs/configs_saver.js | 2 +-
.../mixins/common/configs/enhanced_configs.js | 625 +---
ambari-web/app/mixins/common/serverValidator.js | 6 +-
.../main/service/configs/config_overridable.js | 12 +-
.../models/configs/objects/service_config.js | 4 +
.../configs/objects/service_config_property.js | 14 +
ambari-web/app/models/host_component.js | 8 +-
ambari-web/app/models/upgrade_entity.js | 2 +
ambari-web/app/routes/add_service_routes.js | 2 +-
ambari-web/app/styles/application.less | 25 +-
.../modal_popups/dependent_configs_list.hbs | 4 +-
.../main/admin/stack_upgrade/upgrade_group.hbs | 4 +-
.../admin/stack_upgrade/upgrade_version_box.hbs | 3 +
.../templates/main/dashboard/config_history.hbs | 8 +-
.../app/templates/main/service/menu_item.hbs | 22 +-
ambari-web/app/utils/ajax/ajax.js | 22 +
ambari-web/app/utils/config.js | 42 +-
.../utils/configs/rm_ha_config_initializer.js | 20 +-
ambari-web/app/views/common/controls_view.js | 9 +-
.../dependent_configs_list_popup.js | 7 +-
.../common/modal_popups/select_groups_popup.js | 2 +-
.../stack_upgrade/upgrade_version_box_view.js | 8 +-
.../views/main/dashboard/config_history_view.js | 9 +-
.../main/host/details/host_component_view.js | 14 +-
ambari-web/app/views/main/service/item.js | 3 +-
ambari-web/app/views/main/service/menu.js | 4 +-
ambari-web/test/app_test.js | 47 +-
.../global/cluster_controller_test.js | 160 +-
.../global/update_controller_test.js | 41 +-
ambari-web/test/controllers/installer_test.js | 456 ++-
.../nameNode/step3_controller_test.js | 28 +-
.../nameNode/step4_controller_test.js | 23 +-
.../progress_popup_controller_test.js | 111 +-
.../resourceManager/step3_controller_test.js | 60 +-
.../admin/highAvailability_controller_test.js | 166 +-
.../admin/kerberos/step2_controller_test.js | 30 +-
.../admin/kerberos/step4_controller_test.js | 23 +-
.../admin/kerberos/step6_controller_test.js | 22 +-
.../controllers/main/admin/kerberos_test.js | 102 +-
.../admin/stack_and_upgrade_controller_test.js | 454 ++-
.../definitions_configs_controller_test.js | 149 +-
...anage_alert_notifications_controller_test.js | 31 +-
.../heatmap_metrics/heatmap_metric_test.js | 165 +-
.../controllers/main/charts/heatmap_test.js | 62 +-
.../dashboard/config_history_controller_test.js | 20 +-
.../main/host/add_controller_test.js | 246 +-
.../main/host/configs_service_test.js | 16 +-
.../test/controllers/main/host/details_test.js | 811 ++--
.../main/service/add_controller_test.js | 131 +-
.../main/service/info/config_test.js | 98 +-
.../main/service/info/summary_test.js | 35 +-
.../test/controllers/main/service/item_test.js | 252 +-
.../manage_config_groups_controller_test.js | 247 +-
.../service/reassign/step1_controller_test.js | 28 +-
.../service/reassign/step4_controller_test.js | 50 +-
.../main/service/reassign_controller_test.js | 16 +-
.../widgets/create/step2_controller_test.js | 302 +-
.../test/controllers/main/service_test.js | 118 +-
.../controllers/main/views_controller_test.js | 5 +-
ambari-web/test/controllers/main_test.js | 18 +-
.../test/controllers/wizard/step10_test.js | 85 +-
.../test/controllers/wizard/step2_test.js | 30 +-
.../test/controllers/wizard/step3_test.js | 371 +-
.../test/controllers/wizard/step4_test.js | 163 +-
.../test/controllers/wizard/step5_test.js | 246 +-
.../test/controllers/wizard/step6_test.js | 495 ++-
.../test/controllers/wizard/step7_test.js | 569 ++-
.../test/controllers/wizard/step8_test.js | 837 +++--
.../test/controllers/wizard/step9_test.js | 234 +-
ambari-web/test/controllers/wizard_test.js | 138 +-
.../test/data/HDP2.2/site_properties_test.js | 26 +-
.../test/data/HDP2.3/site_properties_test.js | 26 +-
.../test/data/HDP2/site_properties_test.js | 26 +-
ambari-web/test/helpers.js | 2 +
.../alert_definition_summary_mapper_test.js | 165 +-
.../service_config_version_mapper_test.js | 83 +-
.../stack_config_properties_mapper_test.js | 382 +-
.../test/mappers/configs/themes_mapper_test.js | 180 +-
ambari-web/test/mappers/service_mapper_test.js | 15 +-
ambari-web/test/mappers/stack_mapper_test.js | 24 +-
.../test/mappers/stack_service_mapper_test.js | 2 +
.../common/configs/enhanced_configs_test.js | 10 +-
.../kdc_credentials_controller_mixin_test.js | 64 +-
.../test/mixins/common/reload_popup_test.js | 39 +-
.../test/mixins/common/serverValidator_test.js | 29 +-
.../common/table_server_view_mixin_test.js | 124 +-
.../test/mixins/common/widget_mixin_test.js | 2 +-
.../common/widgets/export_metrics_mixin_test.js | 57 +-
.../common/widgets/widget_section_test.js | 6 +-
.../wizard/wizardProgressPageController_test.js | 69 +-
ambari-web/test/models/cluster_states_test.js | 13 +-
.../test/models/configs/config_group_test.js | 28 +-
.../configs/service_config_version_test.js | 2 +-
ambari-web/test/models/form_test.js | 3 +-
ambari-web/test/router_test.js | 63 +-
ambari-web/test/utils/ajax/ajax_test.js | 20 +-
ambari-web/test/utils/blueprint_test.js | 32 +-
ambari-web/test/utils/config_test.js | 350 +-
.../utils/configs/config_initializer_test.js | 80 +-
ambari-web/test/utils/helper_test.js | 5 +-
.../test/utils/host_progress_popup_test.js | 5 +-
ambari-web/test/utils/ui_effects_test.js | 11 +-
.../test/views/common/chart/linear_time_test.js | 2 +-
.../common/configs/config_history_flow_test.js | 147 +-
.../notification_configs_view_test.js | 64 +-
.../service_configs_by_category_view_test.js | 21 +-
.../configs/widgets/config_widget_view_test.js | 87 +-
.../widgets/list_config_widget_view_test.js | 43 +-
.../widgets/slider_config_widget_view_test.js | 269 +-
.../widgets/toggle_config_widget_view_test.js | 43 +-
.../test/views/common/controls_view_test.js | 197 +-
.../test/views/common/custom_date_popup_test.js | 69 +-
.../views/common/filter_combo_cleanable_test.js | 10 +-
.../form/manage_kdc_credentials_form_test.js | 87 +-
.../test/views/common/modal_popup_test.js | 11 +-
.../modal_popups/cluster_check_popup_test.js | 53 +-
.../modal_popups/hosts_table_list_popup_test.js | 30 +-
.../views/common/rolling_restart_view_test.js | 27 +-
.../common/widget/graph_widget_view_test.js | 59 +-
.../main/admin/stack_upgrade/menu_view_test.js | 7 +-
.../stack_upgrade/upgrade_wizard_view_test.js | 28 +-
.../admin/stack_upgrade/version_view_test.js | 14 +-
ambari-web/test/views/main/admin_test.js | 6 +-
.../select_definitions_popup_body_view_test.js | 26 +-
.../alerts/manage_alert_groups_view_test.js | 59 -
.../main/charts/heatmap/heatmap_host_test.js | 211 +-
.../main/dashboard/config_history_view_test.js | 4 +-
.../test/views/main/dashboard/widget_test.js | 80 +-
.../dashboard/widgets/datanode_live_test.js | 10 +-
.../test/views/main/dashboard/widgets_test.js | 26 +-
.../host/details/host_component_view_test.js | 38 +-
.../host_component_views/datanode_view_test.js | 6 +
ambari-web/test/views/main/host/details_test.js | 8 +-
ambari-web/test/views/main/host/menu_test.js | 9 +-
ambari-web/test/views/main/menu_test.js | 8 +-
.../ambari_metrics/regionserver_base_test.js | 63 +-
.../views/main/service/info/summary_test.js | 293 +-
ambari-web/test/views/main/service/menu_test.js | 67 +
ambari-web/test/views/wizard/step0_view_test.js | 12 +-
.../test/views/wizard/step10_view_test.js | 11 +-
ambari-web/test/views/wizard/step1_view_test.js | 73 +-
.../step3/hostWarningPopupBody_view_test.js | 131 +-
ambari-web/test/views/wizard/step3_view_test.js | 23 +-
ambari-web/test/views/wizard/step5_view_test.js | 40 +-
ambari-web/test/views/wizard/step6_view_test.js | 14 +-
ambari-web/test/views/wizard/step8_view_test.js | 22 +-
.../wizard/step9/hostLogPopupBody_view_test.js | 210 +-
ambari-web/test/views/wizard/step9_view_test.js | 48 +-
.../ambari/fast_hdfs_resource/Resource.java | 2 +-
295 files changed, 19857 insertions(+), 6614 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5310b95e/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5310b95e/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5310b95e/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5310b95e/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5310b95e/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5310b95e/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
----------------------------------------------------------------------
[07/50] [abbrv] ambari git commit: AMBARI-14504. Role command order
is parsed incorrectly causing Hive Service Check fail on 'Start all'
(aonishuk)
Posted by nc...@apache.org.
AMBARI-14504. Role command order is parsed incorrectly causing Hive Service Check fail on 'Start all' (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/48604428
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/48604428
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/48604428
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 48604428b05e8baa1c71e3a013f510aa5bb3a61e
Parents: 73a850e
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Mon Dec 28 15:58:26 2015 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Mon Dec 28 15:58:26 2015 +0200
----------------------------------------------------------------------
ambari-server/pom.xml | 11 --
.../ambari/server/stack/StackDirectory.java | 6 +-
.../src/main/resources/role_command_order.json | 104 -------------------
3 files changed, 2 insertions(+), 119 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/48604428/ambari-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index 17d3aae..9c0ba26 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -531,9 +531,6 @@
<source>
<location>${project.build.directory}/DBConnectionVerification.jar</location>
</source>
- <source>
- <location>src/main/resources/role_command_order.json</location>
- </source>
</sources>
</mapping>
<mapping>
@@ -1006,14 +1003,6 @@
</mapper>
</data>
<data>
- <src>src/main/resources/role_command_order.json</src>
- <type>file</type>
- <mapper>
- <type>perm</type>
- <prefix>/var/lib/ambari-server/resources</prefix>
- </mapper>
- </data>
- <data>
<src>src/main/resources/scripts</src>
<type>directory</type>
<mapper>
http://git-wip-us.apache.org/repos/asf/ambari/blob/48604428/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
index 9cfeffe..c552e41 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
@@ -487,10 +487,8 @@ public class StackDirectory extends StackDefinitionDirectory {
result = mapper.readValue(file, rcoElementTypeReference);
LOG.info("Role command order info was loaded from file: {}", file.getAbsolutePath());
} else {
- InputStream rcoInputStream = ClassLoader.getSystemResourceAsStream(ROLE_COMMAND_ORDER_FILE);
- result = mapper.readValue(rcoInputStream, rcoElementTypeReference);
- LOG.info("Role command order info was loaded from classpath: " +
- ClassLoader.getSystemResource(ROLE_COMMAND_ORDER_FILE));
+ LOG.info("Stack '{}' doesn't contain role command order file", getPath());
+ result = new HashMap<String, Object>();
}
roleCommandOrder = new StackRoleCommandOrder(result);
parseRoleCommandOrdersForServices();
http://git-wip-us.apache.org/repos/asf/ambari/blob/48604428/ambari-server/src/main/resources/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/role_command_order.json b/ambari-server/src/main/resources/role_command_order.json
deleted file mode 100644
index 870a537..0000000
--- a/ambari-server/src/main/resources/role_command_order.json
+++ /dev/null
@@ -1,104 +0,0 @@
-{
- "_comment" : "Record format:",
- "_comment" : "blockedRole-blockedCommand: [blockerRole1-blockerCommand1, blockerRole2-blockerCommand2, ...]",
- "general_deps" : {
- "_comment" : "dependencies for all cases",
- "HBASE_MASTER-START": ["ZOOKEEPER_SERVER-START"],
- "HBASE_REGIONSERVER-START": ["HBASE_MASTER-START"],
- "OOZIE_SERVER-START": ["JOBTRACKER-START", "TASKTRACKER-START"],
- "WEBHCAT_SERVER-START": ["TASKTRACKER-START", "HIVE_SERVER-START"],
- "WEBHCAT_SERVER-RESTART": ["TASKTRACKER-RESTART", "HIVE_SERVER-RESTART"],
- "HIVE_METASTORE-START": ["MYSQL_SERVER-START"],
- "HIVE_METASTORE-RESTART": ["MYSQL_SERVER-RESTART"],
- "HIVE_SERVER-START": ["TASKTRACKER-START", "MYSQL_SERVER-START"],
- "HIVE_SERVER-RESTART": ["TASKTRACKER-RESTART", "MYSQL_SERVER-RESTART"],
- "HUE_SERVER-START": ["HIVE_SERVER-START", "HCAT-START", "OOZIE_SERVER-START"],
- "FLUME_HANDLER-START": ["OOZIE_SERVER-START"],
- "ACCUMULO_MASTER-START": ["ZOOKEEPER_SERVER-START", "NAMENODE-START", "DATANODE-START"],
- "ACCUMULO_TSERVER-START": ["ACCUMULO_MASTER-START"],
- "ACCUMULO_MONITOR-START": ["ACCUMULO_MASTER-START"],
- "ACCUMULO_GC-START": ["ACCUMULO_MASTER-START"],
- "ACCUMULO_TRACER-START": ["ACCUMULO_MASTER-START", "ACCUMULO_TSERVER-START"],
- "MAPREDUCE_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
- "OOZIE_SERVICE_CHECK-SERVICE_CHECK": ["OOZIE_SERVER-START"],
- "WEBHCAT_SERVICE_CHECK-SERVICE_CHECK": ["WEBHCAT_SERVER-START"],
- "HBASE_SERVICE_CHECK-SERVICE_CHECK": ["HBASE_MASTER-START", "HBASE_REGIONSERVER-START"],
- "HIVE_SERVICE_CHECK-SERVICE_CHECK": ["HIVE_SERVER-START", "HIVE_METASTORE-START"],
- "HCAT_SERVICE_CHECK-SERVICE_CHECK": ["HIVE_SERVER-START"],
- "PIG_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
- "SQOOP_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
- "ACCUMULO_SERVICE_CHECK-SERVICE_CHECK": ["ACCUMULO_MASTER-START", "ACCUMULO_TSERVER-START", "ACCUMULO_TRACER-START"],
- "ZOOKEEPER_SERVICE_CHECK-SERVICE_CHECK": ["ZOOKEEPER_SERVER-START"],
- "ZOOKEEPER_QUORUM_SERVICE_CHECK-SERVICE_CHECK": ["ZOOKEEPER_SERVER-START"],
- "ZOOKEEPER_SERVER-STOP" : ["HBASE_MASTER-STOP", "HBASE_REGIONSERVER-STOP", "ACCUMULO_MASTER-STOP", "ACCUMULO_TSERVER-STOP", "ACCUMULO_GC-STOP"],
- "ACCUMULO_MONITOR-STOP" : ["ACCUMULO_MASTER-STOP"],
- "ACCUMULO_MASTER-STOP" : ["ACCUMULO_TSERVER-STOP"],
- "ACCUMULO_TSERVER-STOP" : ["ACCUMULO_TRACER-STOP", "ACCUMULO_GC-STOP"],
- "HBASE_MASTER-STOP": ["HBASE_REGIONSERVER-STOP"],
- "TASKTRACKER-UPGRADE": ["JOBTRACKER-UPGRADE"],
- "MAPREDUCE_CLIENT-UPGRADE": ["TASKTRACKER-UPGRADE", "JOBTRACKER-UPGRADE"],
- "ZOOKEEPER_SERVER-UPGRADE": ["MAPREDUCE_CLIENT-UPGRADE"],
- "ZOOKEEPER_CLIENT-UPGRADE": ["ZOOKEEPER_SERVER-UPGRADE"],
- "HBASE_MASTER-UPGRADE": ["ZOOKEEPER_CLIENT-UPGRADE"],
- "HBASE_REGIONSERVER-UPGRADE": ["HBASE_MASTER-UPGRADE"],
- "HBASE_CLIENT-UPGRADE": ["HBASE_REGIONSERVER-UPGRADE"],
- "HIVE_SERVER-UPGRADE" : ["HBASE_CLIENT-UPGRADE"],
- "HIVE_METASTORE-UPGRADE" : ["HIVE_SERVER-UPGRADE"],
- "MYSQL_SERVER-UPGRADE": ["HIVE_METASTORE-UPGRADE"],
- "HIVE_CLIENT-UPGRADE": ["MYSQL_SERVER-UPGRADE"],
- "HCAT-UPGRADE": ["HIVE_CLIENT-UPGRADE"],
- "OOZIE_SERVER-UPGRADE" : ["HCAT-UPGRADE"],
- "OOZIE_CLIENT-UPGRADE" : ["OOZIE_SERVER-UPGRADE"],
- "WEBHCAT_SERVER-UPGRADE" : ["OOZIE_CLIENT-UPGRADE"],
- "PIG-UPGRADE" : ["WEBHCAT_SERVER-UPGRADE"],
- "SQOOP-UPGRADE" : ["PIG-UPGRADE"],
- "GANGLIA_SERVER-UPGRADE" : ["SQOOP-UPGRADE"],
- "GANGLIA_MONITOR-UPGRADE" : ["GANGLIA_SERVER-UPGRADE"]
- },
- "_comment" : "GLUSTERFS-specific dependencies",
- "optional_glusterfs": {
- "HBASE_MASTER-START": ["PEERSTATUS-START"],
- "JOBTRACKER-START": ["PEERSTATUS-START"],
- "TASKTRACKER-START": ["PEERSTATUS-START"],
- "GLUSTERFS_SERVICE_CHECK-SERVICE_CHECK": ["PEERSTATUS-START"],
- "JOBTRACKER-UPGRADE": ["GLUSTERFS_CLIENT-UPGRADE"]
- },
- "_comment" : "Dependencies that are used when GLUSTERFS is not present in cluster",
- "optional_no_glusterfs": {
- "SECONDARY_NAMENODE-START": ["NAMENODE-START"],
- "RESOURCEMANAGER-START": ["NAMENODE-START", "DATANODE-START"],
- "NODEMANAGER-START": ["NAMENODE-START", "DATANODE-START", "RESOURCEMANAGER-START"],
- "HISTORYSERVER-START": ["NAMENODE-START", "DATANODE-START"],
- "HBASE_MASTER-START": ["NAMENODE-START", "DATANODE-START"],
- "JOBTRACKER-START": ["NAMENODE-START", "DATANODE-START"],
- "TASKTRACKER-START": ["NAMENODE-START", "DATANODE-START"],
- "HIVE_SERVER-START": ["DATANODE-START"],
- "WEBHCAT_SERVER-START": ["DATANODE-START"],
- "HDFS_SERVICE_CHECK-SERVICE_CHECK": ["NAMENODE-START", "DATANODE-START",
- "SECONDARY_NAMENODE-START"],
- "MAPREDUCE2_SERVICE_CHECK-SERVICE_CHECK": ["NODEMANAGER-START",
- "RESOURCEMANAGER-START", "HISTORYSERVER-START", "YARN_SERVICE_CHECK-SERVICE_CHECK"],
- "YARN_SERVICE_CHECK-SERVICE_CHECK": ["NODEMANAGER-START", "RESOURCEMANAGER-START"],
- "RESOURCEMANAGER_SERVICE_CHECK-SERVICE_CHECK": ["RESOURCEMANAGER-START"],
- "PIG_SERVICE_CHECK-SERVICE_CHECK": ["RESOURCEMANAGER-START", "NODEMANAGER-START"],
- "NAMENODE-STOP": ["JOBTRACKER-STOP", "TASKTRACKER-STOP", "RESOURCEMANAGER-STOP",
- "NODEMANAGER-STOP", "HISTORYSERVER-STOP", "HBASE_MASTER-STOP"],
- "DATANODE-STOP": ["JOBTRACKER-STOP", "TASKTRACKER-STOP", "RESOURCEMANAGER-STOP",
- "NODEMANAGER-STOP", "HISTORYSERVER-STOP", "HBASE_MASTER-STOP"],
- "SECONDARY_NAMENODE-UPGRADE": ["NAMENODE-UPGRADE"],
- "DATANODE-UPGRADE": ["SECONDARY_NAMENODE-UPGRADE"],
- "HDFS_CLIENT-UPGRADE": ["DATANODE-UPGRADE"],
- "JOBTRACKER-UPGRADE": ["HDFS_CLIENT-UPGRADE"]
- },
- "_comment" : "Dependencies that are used in HA NameNode cluster",
- "namenode_optional_ha": {
- "NAMENODE-START": ["JOURNALNODE-START", "ZOOKEEPER_SERVER-START"],
- "ZKFC-START": ["NAMENODE-START"],
- "HDFS_SERVICE_CHECK-SERVICE_CHECK": ["ZKFC-START"]
- },
- "_comment" : "Dependencies that are used in ResourceManager HA cluster",
- "resourcemanager_optional_ha" : {
- "RESOURCEMANAGER-START": ["ZOOKEEPER_SERVER-START"]
- }
-}
-
[12/50] [abbrv] ambari git commit: AMBARI-14476. View display name
overlaps with version if name is long and does not contain spaces
(alexantonenko)
Posted by nc...@apache.org.
AMBARI-14476. View display name overlaps with version if name is long and does not contain spaces (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7d6caf6c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7d6caf6c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7d6caf6c
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 7d6caf6cdbfaefec8c992647a56e64e3fab3dd45
Parents: c763570
Author: Alex Antonenko <hi...@gmail.com>
Authored: Mon Dec 28 21:05:27 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Mon Dec 28 21:17:57 2015 +0200
----------------------------------------------------------------------
.../src/main/resources/ui/admin-web/app/styles/main.css | 5 ++++-
.../resources/ui/admin-web/app/views/ambariViews/listTable.html | 4 ++--
2 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7d6caf6c/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css b/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
index e380706..895a28f 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
@@ -204,6 +204,9 @@
.instances-table{
table-layout: fixed;
}
+ .instance-link{
+ word-wrap:break-word;
+ }
.description-column{
text-overflow: ellipsis;
overflow: hidden;
@@ -1348,4 +1351,4 @@ accordion .panel-group .panel{
thead.view-permission-header > tr > th {
border-top: 0px;
padding-top: 40px;
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/7d6caf6c/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listTable.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listTable.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listTable.html
index 05cb1d5..d922f13 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listTable.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listTable.html
@@ -67,8 +67,8 @@
<table class="table instances-table">
<tbody>
<tr ng-repeat="instance in view.instances">
- <td class="col-sm-3"></td>
- <td class="col-sm-3">
+ <td class="col-sm-1"></td>
+ <td class="col-sm-5">
<a href="#/views/{{view.view_name}}/versions/{{instance.ViewInstanceInfo.version}}/instances/{{instance.ViewInstanceInfo.instance_name}}/edit" class="instance-link">{{instance.label}}</a>
</td>
<td class="col-sm-5">{{instance.ViewInstanceInfo.version}}</td>
[24/50] [abbrv] ambari git commit: AMBARI-14517 Database version
check doesn't work in case of existing database from older Ambari version
(dsen)
Posted by nc...@apache.org.
AMBARI-14517 Database version check doesn't work in case of existing database from older Ambari version (dsen)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/48c0df46
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/48c0df46
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/48c0df46
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 48c0df464f915438f8eaad35b4c2a443ca9e9aed
Parents: a487e50
Author: Dmytro Sen <ds...@apache.org>
Authored: Tue Dec 29 17:48:27 2015 +0200
Committer: Dmytro Sen <ds...@apache.org>
Committed: Tue Dec 29 17:48:27 2015 +0200
----------------------------------------------------------------------
.../ambari/server/controller/AmbariServer.java | 1 +
.../controller/utilities/DatabaseChecker.java | 23 +++++++++++-----
.../utilities/DatabaseCheckerTest.java | 28 +++++++++++---------
3 files changed, 34 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/48c0df46/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index cc69134..353a972 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -833,6 +833,7 @@ public class AmbariServer {
setupProxyAuth();
injector.getInstance(GuiceJpaInitializer.class);
+ DatabaseChecker.checkDBVersion();
server = injector.getInstance(AmbariServer.class);
CertificateManager certMan = injector.getInstance(CertificateManager.class);
certMan.initRootCert();
http://git-wip-us.apache.org/repos/asf/ambari/blob/48c0df46/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
index 4839d21..190a6a7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
@@ -18,9 +18,12 @@
package org.apache.ambari.server.controller.utilities;
+import java.io.File;
+import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
+import java.util.Scanner;
import java.util.Map;
import org.apache.ambari.server.AmbariException;
@@ -259,23 +262,31 @@ public class DatabaseChecker {
public static void checkDBVersion() throws AmbariException {
LOG.info("Checking DB store version");
- if (ambariMetaInfo == null) {
- ambariMetaInfo = injector.getInstance(AmbariMetaInfo.class);
- }
if (metainfoDAO == null) {
metainfoDAO = injector.getInstance(MetainfoDAO.class);
}
MetainfoEntity schemaVersionEntity = metainfoDAO.findByKey(Configuration.SERVER_VERSION_KEY);
String schemaVersion = null;
- String serverVersion = null;
if (schemaVersionEntity != null) {
schemaVersion = schemaVersionEntity.getMetainfoValue();
- serverVersion = ambariMetaInfo.getServerVersion();
}
- if (schemaVersionEntity==null || VersionUtils.compareVersions(schemaVersion, serverVersion, 3) != 0) {
+ Configuration conf = injector.getInstance(Configuration.class);
+ File versionFile = new File(conf.getServerVersionFilePath());
+ if (!versionFile.exists()) {
+ throw new AmbariException("Server version file does not exist.");
+ }
+ String serverVersion = null;
+ try (Scanner scanner = new Scanner(versionFile)) {
+ serverVersion = scanner.useDelimiter("\\Z").next();
+
+ } catch (IOException ioe) {
+ throw new AmbariException("Unable to read server version file.");
+ }
+
+ if (schemaVersionEntity==null || VersionUtils.compareVersions(schemaVersion, serverVersion, 4) != 0) {
String error = "Current database store version is not compatible with " +
"current server version"
+ ", serverVersion=" + serverVersion
http://git-wip-us.apache.org/repos/asf/ambari/blob/48c0df46/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/DatabaseCheckerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/DatabaseCheckerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/DatabaseCheckerTest.java
index 03d3661..63baafe 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/DatabaseCheckerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/DatabaseCheckerTest.java
@@ -30,6 +30,7 @@ import org.apache.ambari.server.orm.dao.MetainfoDAO;
import org.apache.ambari.server.orm.entities.MetainfoEntity;
import org.junit.After;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import static org.easymock.EasyMock.createMock;
@@ -38,15 +39,19 @@ import static org.easymock.EasyMock.replay;
import static org.junit.Assert.fail;
public class DatabaseCheckerTest {
- private Injector injector;
+ private static Injector injector;
@Inject
private AmbariMetaInfo ambariMetaInfo;
- @Before
- public void setup() throws Exception {
+ @BeforeClass
+ public static void setupClass() throws Exception {
injector = Guice.createInjector(new InMemoryDefaultTestModule());
injector.getInstance(GuiceJpaInitializer.class);
+ }
+
+ @Before
+ public void setup() throws Exception {
injector.injectMembers(this);
}
@@ -66,11 +71,15 @@ public class DatabaseCheckerTest {
replay(metainfoDAO);
DatabaseChecker.metainfoDAO = metainfoDAO;
DatabaseChecker.ambariMetaInfo = ambariMetaInfo;
- DatabaseChecker.checkDBVersion();
+ try {
+ DatabaseChecker.checkDBVersion();
+ } catch (AmbariException ae) {
+ fail("DB versions check failed.");
+ }
}
- @Test
- public void testCheckDBVersion_Invalid() throws Exception {
+ @Test(expected = AmbariException.class)
+ public void testCheckDBVersionInvalid() throws Exception {
MetainfoDAO metainfoDAO = createMock(MetainfoDAO.class);
MetainfoEntity metainfoEntity = new MetainfoEntity();
metainfoEntity.setMetainfoName(Configuration.SERVER_VERSION_KEY);
@@ -81,11 +90,6 @@ public class DatabaseCheckerTest {
DatabaseChecker.metainfoDAO = metainfoDAO;
DatabaseChecker.ambariMetaInfo = ambariMetaInfo;
- try {
- DatabaseChecker.checkDBVersion();
- fail();
- } catch(AmbariException e) {
- // Expected
- }
+ DatabaseChecker.checkDBVersion();
}
}
[18/50] [abbrv] ambari git commit: AMBARI-14385. Robust Handling of
Ambari properites and DB state. (aonishuk)
Posted by nc...@apache.org.
AMBARI-14385. Robust Handling of Ambari properites and DB state. (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/65752c9b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/65752c9b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/65752c9b
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 65752c9bd95af7f64002e1b1da6b734b3bd99d8f
Parents: f697f4a
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Tue Dec 29 13:33:42 2015 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Dec 29 13:33:42 2015 +0200
----------------------------------------------------------------------
.../ambari/server/controller/AmbariServer.java | 7 +-
.../controller/utilities/DatabaseChecker.java | 115 ++++++++++++++++++-
ambari-server/src/main/python/ambari-server.py | 4 +
.../python/ambari_server/serverConfiguration.py | 14 +++
.../src/main/python/ambari_server_main.py | 13 ++-
5 files changed, 148 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/65752c9b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index c6f90c0..cc69134 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -260,8 +260,11 @@ public class AmbariServer {
server.setSessionIdManager(sessionIdManager);
Server serverForAgent = new Server();
- DatabaseChecker.checkDBVersion();
- DatabaseChecker.checkDBConsistency();
+ if (System.getProperty("skipDatabaseConsistencyValidation") == null) {
+ DatabaseChecker.checkDBVersion();
+ DatabaseChecker.checkDBConsistency();
+ DatabaseChecker.checkDBConfigsConsistency();
+ }
try {
ClassPathXmlApplicationContext parentSpringAppContext =
http://git-wip-us.apache.org/repos/asf/ambari/blob/65752c9b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
index c4a4e4c..4839d21 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
@@ -19,22 +19,31 @@
package org.apache.ambari.server.controller.utilities;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.orm.dao.ClusterDAO;
import org.apache.ambari.server.orm.dao.MetainfoDAO;
+import org.apache.ambari.server.orm.entities.ClusterConfigEntity;
+import org.apache.ambari.server.orm.entities.ClusterConfigMappingEntity;
import org.apache.ambari.server.orm.entities.ClusterEntity;
import org.apache.ambari.server.orm.entities.ClusterServiceEntity;
+import org.apache.ambari.server.orm.entities.ClusterStateEntity;
import org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity;
import org.apache.ambari.server.orm.entities.HostComponentStateEntity;
import org.apache.ambari.server.orm.entities.MetainfoEntity;
import org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity;
import org.apache.ambari.server.orm.entities.ServiceDesiredStateEntity;
+import org.apache.ambari.server.orm.entities.StackEntity;
import org.apache.ambari.server.state.ComponentInfo;
+import org.apache.ambari.server.state.ServiceInfo;
import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.StackInfo;
+import org.apache.ambari.server.state.State;
import org.apache.ambari.server.utils.VersionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -142,7 +151,108 @@ public class DatabaseChecker {
if (checkPassed) {
LOG.info("DB consistency check passed.");
} else {
- LOG.error("DB consistency check failed.");
+ String errorMessage = "DB consistency check failed. Run \"ambari-server start --skip-database-validation\" to skip validation.";
+ LOG.error(errorMessage);
+ throw new AmbariException(errorMessage);
+ }
+ }
+
+ private static boolean clusterConfigsContainTypeAndTag(Collection<ClusterConfigEntity> clusterConfigEntities,
+ String typeName, String tag) {
+ for (ClusterConfigEntity clusterConfigEntity : clusterConfigEntities) {
+ if (typeName.equals(clusterConfigEntity.getType()) && tag.equals(clusterConfigEntity.getTag())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Validates configuration consistency. Checks that every config type from stack is presented in
+ * ClusterConfigMapping. Checks that for each config type exactly one is selected. Checks that ClusterConfig
+ * contains type_names and tags from ClusterConfigMapping.
+ *
+ * @throws AmbariException if check failed
+ */
+ public static void checkDBConfigsConsistency() throws AmbariException {
+ LOG.info("Checking DB configs consistency");
+
+ boolean checkPassed = true;
+
+ if (ambariMetaInfo == null) {
+ ambariMetaInfo = injector.getInstance(AmbariMetaInfo.class);
+ }
+
+ ClusterDAO clusterDAO = injector.getInstance(ClusterDAO.class);
+ List<ClusterEntity> clusters = clusterDAO.findAll();
+ if (clusters != null) {
+ for (ClusterEntity clusterEntity : clusters) {
+ Collection<ClusterConfigMappingEntity> configMappingEntities = clusterEntity.getConfigMappingEntities();
+ Collection<ClusterConfigEntity> clusterConfigEntities = clusterEntity.getClusterConfigEntities();
+
+ if (configMappingEntities != null) {
+ Map<String, Integer> selectedCountForType = new HashMap<>();
+ for (ClusterConfigMappingEntity clusterConfigMappingEntity : configMappingEntities) {
+ String typeName = clusterConfigMappingEntity.getType();
+ if (clusterConfigMappingEntity.isSelected() > 0) {
+ int selectedCount = selectedCountForType.get(typeName) != null ? selectedCountForType.get(typeName) : 0;
+ selectedCountForType.put(typeName, selectedCount + 1);
+
+ // Check that ClusterConfig contains type_name and tag from ClusterConfigMapping
+ if (!clusterConfigsContainTypeAndTag(clusterConfigEntities, typeName, clusterConfigMappingEntity.getTag())) {
+ checkPassed = false;
+ LOG.error("ClusterConfig does not contain mapping for type_name=" + typeName + " tag="
+ + clusterConfigMappingEntity.getTag());
+ }
+ } else {
+ if (!selectedCountForType.containsKey(typeName)) {
+ selectedCountForType.put(typeName, 0);
+ }
+ }
+ }
+
+ // Check that every config type from stack is presented in ClusterConfigMapping
+ Collection<ClusterServiceEntity> clusterServiceEntities = clusterEntity.getClusterServiceEntities();
+ ClusterStateEntity clusterStateEntity = clusterEntity.getClusterStateEntity();
+ if (clusterStateEntity != null) {
+ StackEntity currentStack = clusterStateEntity.getCurrentStack();
+ StackInfo stack = ambariMetaInfo.getStack(currentStack.getStackName(), currentStack.getStackVersion());
+
+ for (ClusterServiceEntity clusterServiceEntity : clusterServiceEntities) {
+ if (!State.INIT.equals(clusterServiceEntity.getServiceDesiredStateEntity().getDesiredState())) {
+ String serviceName = clusterServiceEntity.getServiceName();
+ ServiceInfo serviceInfo = ambariMetaInfo.getService(stack.getName(), stack.getVersion(), serviceName);
+ for (String configTypeName : serviceInfo.getConfigTypeAttributes().keySet()) {
+ if (selectedCountForType.get(configTypeName) == null) {
+ checkPassed = false;
+ LOG.error("ClusterConfigMapping does not contain mapping for service=" + serviceName + " type_name="
+ + configTypeName);
+ } else {
+ // Check that for each config type exactly one is selected
+ if (selectedCountForType.get(configTypeName) == 0) {
+ checkPassed = false;
+ LOG.error("ClusterConfigMapping selected count is 0 for service=" + serviceName + " type_name="
+ + configTypeName);
+ } else if (selectedCountForType.get(configTypeName) > 1) {
+ checkPassed = false;
+ LOG.error("ClusterConfigMapping selected count is more than 1 for service=" + serviceName
+ + " type_name=" + configTypeName);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (checkPassed) {
+ LOG.info("DB configs consistency check passed.");
+ } else {
+ String errorMessage = "DB configs consistency check failed. Run \"ambari-server start --skip-database-validation\" to skip validation.";
+ LOG.error(errorMessage);
+ throw new AmbariException(errorMessage);
}
}
@@ -169,7 +279,8 @@ public class DatabaseChecker {
String error = "Current database store version is not compatible with " +
"current server version"
+ ", serverVersion=" + serverVersion
- + ", schemaVersion=" + schemaVersion;
+ + ", schemaVersion=" + schemaVersion
+ + " Run \"ambari-server start --skip-database-validation\" to skip validation";
LOG.warn(error);
throw new AmbariException(error);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/65752c9b/ambari-server/src/main/python/ambari-server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari-server.py b/ambari-server/src/main/python/ambari-server.py
index 41fdfb6..9f13ac5 100755
--- a/ambari-server/src/main/python/ambari-server.py
+++ b/ambari-server/src/main/python/ambari-server.py
@@ -316,6 +316,8 @@ def init_parser_options(parser):
help="Database user password")
parser.add_option('--jdbc-driver', default=None, dest="jdbc_driver",
help="Specifies the path to the JDBC driver JAR file")
+ parser.add_option('--skip-properties-validation', action="store_true", default=False, help="Skip properties file validation", dest="skip_properties_validation")
+ parser.add_option('--skip-database-validation', action="store_true", default=False, help="Skip database consistency validation", dest="skip_database_validation")
# -b and -i the remaining available short options
# -h reserved for help
@@ -380,6 +382,8 @@ def init_parser_options(parser):
dest="jdbc_db")
parser.add_option('--cluster-name', default=None, help="Cluster name", dest="cluster_name")
parser.add_option('--version-display-name', default=None, help="Display name of desired repo version", dest="desired_repo_version")
+ parser.add_option('--skip-properties-validation', action="store_true", default=False, help="Skip properties file validation", dest="skip_properties_validation")
+ parser.add_option('--skip-database-validation', action="store_true", default=False, help="Skip database consistency validation", dest="skip_database_validation")
parser.add_option('--force-version', action="store_true", default=False, help="Force version to current", dest="force_repo_version")
parser.add_option('--version', dest="stack_versions", default=None, action="append", type="string",
help="Specify stack version that needs to be enabled. All other stacks versions will be disabled")
http://git-wip-us.apache.org/repos/asf/ambari/blob/65752c9b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/serverConfiguration.py b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
index 223c608..aeb4d5b 100644
--- a/ambari-server/src/main/python/ambari_server/serverConfiguration.py
+++ b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
@@ -177,6 +177,11 @@ SETUP_OR_UPGRADE_MSG = "- If this is a new setup, then run the \"ambari-server s
DEFAULT_DB_NAME = "ambari"
+COMMON_SERVICES_PATH_PROPERTY = 'common.services.path'
+WEBAPP_DIR_PROPERTY = 'webapp.dir'
+REQUIRED_PROPERTIES = [OS_FAMILY_PROPERTY, OS_TYPE_PROPERTY, COMMON_SERVICES_PATH_PROPERTY, SERVER_VERSION_FILE_PATH, \
+ WEBAPP_DIR_PROPERTY, STACK_LOCATION_KEY]
+
class ServerDatabaseType(object):
internal = 0
remote = 1
@@ -1303,3 +1308,12 @@ def get_stack_location(properties):
if stack_location is None:
stack_location = configDefaults.STACK_LOCATION_DEFAULT
return stack_location
+
+def get_missing_properties(properties):
+ missing_propertiers = []
+ for property in REQUIRED_PROPERTIES:
+ value = properties[property]
+ if not value:
+ missing_propertiers.append(property)
+
+ return missing_propertiers
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/65752c9b/ambari-server/src/main/python/ambari_server_main.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server_main.py b/ambari-server/src/main/python/ambari_server_main.py
index cf8e8c0..5c98bf4 100644
--- a/ambari-server/src/main/python/ambari_server_main.py
+++ b/ambari-server/src/main/python/ambari_server_main.py
@@ -32,7 +32,7 @@ from ambari_server.serverConfiguration import configDefaults, find_jdk, get_amba
get_conf_dir, get_is_persisted, get_is_secure, get_java_exe_path, get_original_master_key, read_ambari_user, \
get_is_active_instance, \
PID_NAME, SECURITY_KEY_ENV_VAR_NAME, SECURITY_MASTER_KEY_LOCATION, \
- SETUP_OR_UPGRADE_MSG, check_database_name_property, parse_properties_file
+ SETUP_OR_UPGRADE_MSG, check_database_name_property, parse_properties_file, get_missing_properties
from ambari_server.serverUtils import refresh_stack_hash
from ambari_server.setupHttps import get_fqdn
from ambari_server.setupSecurity import generate_env, \
@@ -237,6 +237,13 @@ def server_process_main(options, scmStatus=None):
properties = get_ambari_properties()
+ if not options.skip_properties_validation:
+ missing_properties = get_missing_properties(properties)
+ if missing_properties:
+ err = "Required properties are not found: " + str(missing_properties) + ". To skip properties validation " \
+ "use \"--skip-properties-validation\""
+ raise FatalException(1, err)
+
# Preparations
if is_root():
print configDefaults.MESSAGE_SERVER_RUNNING_AS_ROOT
@@ -267,6 +274,10 @@ def server_process_main(options, scmStatus=None):
suspend_start = (debug_mode & 2) or SUSPEND_START_MODE
suspend_mode = 'y' if suspend_start else 'n'
+ if options.skip_database_validation:
+ global jvm_args
+ jvm_args += " -DskipDatabaseConsistencyValidation"
+
param_list = generate_child_process_param_list(ambari_user, java_exe,
serverClassPath.get_full_ambari_classpath_escaped_for_shell(), debug_start,
suspend_mode)
[16/50] [abbrv] ambari git commit: AMBARI-14506. Certain config
properties get reverted when adding new host or host component (secure
cluster).(vbrodetskyi)
Posted by nc...@apache.org.
AMBARI-14506. Certain config properties get reverted when adding new host or host component (secure cluster).(vbrodetskyi)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9022bfb1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9022bfb1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9022bfb1
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 9022bfb113feba9f212dd843e38263f2f7e9f176
Parents: 6c71cd1
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Mon Dec 28 23:31:28 2015 +0200
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Mon Dec 28 23:31:28 2015 +0200
----------------------------------------------------------------------
.../AmbariManagementControllerImpl.java | 134 +++++++++++--------
.../server/controller/KerberosHelper.java | 2 +-
.../server/controller/KerberosHelperImpl.java | 60 ++++++---
.../topology/ClusterConfigurationRequest.java | 2 +-
.../server/controller/KerberosHelperTest.java | 61 +++++----
.../ClusterConfigurationRequestTest.java | 43 ++----
6 files changed, 160 insertions(+), 142 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/9022bfb1/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 545a25e..95f0230 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -18,50 +18,16 @@
package org.apache.ambari.server.controller;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_DRIVER;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_PASSWORD;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_URL;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_USERNAME;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.CLIENTS_TO_UPDATE_CONFIGS;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.COMMAND_RETRY_ENABLED;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.COMMAND_TIMEOUT;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.DB_DRIVER_FILENAME;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.GROUP_LIST;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.HOOKS_FOLDER;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.MAX_DURATION_OF_RETRIES;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.PACKAGE_LIST;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.REPO_INFO;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SCRIPT;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SCRIPT_TYPE;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SERVICE_PACKAGE_FOLDER;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SERVICE_REPO_INFO;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.USER_LIST;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.VERSION;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.lang.reflect.Type;
-import java.net.InetAddress;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.EnumMap;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Lock;
-
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Multimap;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+import com.google.inject.Singleton;
+import com.google.inject.persist.Transactional;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.ClusterNotFoundException;
import org.apache.ambari.server.DuplicateResourceException;
@@ -171,16 +137,49 @@ import org.apache.http.client.utils.URIBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.Multimap;
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-import com.google.inject.Singleton;
-import com.google.inject.persist.Transactional;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.lang.reflect.Type;
+import java.net.InetAddress;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Lock;
+
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_DRIVER;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_PASSWORD;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_URL;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_USERNAME;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.CLIENTS_TO_UPDATE_CONFIGS;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.COMMAND_RETRY_ENABLED;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.COMMAND_TIMEOUT;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.DB_DRIVER_FILENAME;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.GROUP_LIST;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.HOOKS_FOLDER;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.MAX_DURATION_OF_RETRIES;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.PACKAGE_LIST;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.REPO_INFO;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SCRIPT;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SCRIPT_TYPE;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SERVICE_PACKAGE_FOLDER;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SERVICE_REPO_INFO;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.USER_LIST;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.VERSION;
@Singleton
public class AmbariManagementControllerImpl implements AmbariManagementController {
@@ -2396,10 +2395,13 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
// the host (i,e, create user accounts, etc...) before Kerberos-related tasks an
// occur (like distribute keytabs)
if((oldSchState == State.INIT || oldSchState == State.INSTALL_FAILED) && kerberosHelper.isClusterKerberosEnabled(cluster)) {
- try {
- kerberosHelper.configureService(cluster, scHost);
- } catch (KerberosInvalidConfigurationException e) {
- throw new AmbariException(e.getMessage(), e);
+ // check if host component already exists, if it exists no need to reset kerberos configs
+ if (!hostComponentAlreadyExists(cluster, scHost)) {
+ try {
+ kerberosHelper.configureService(cluster, scHost);
+ } catch (KerberosInvalidConfigurationException e) {
+ throw new AmbariException(e.getMessage(), e);
+ }
}
componentsToEnableKerberos.add(scHost);
@@ -2643,6 +2645,22 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
return requestStages;
}
+ private boolean hostComponentAlreadyExists(Cluster cluster, ServiceComponentHost sch) throws AmbariException {
+ Service service = cluster.getService(sch.getServiceName());
+ if (service != null) {
+ ServiceComponent serviceComponent = service.getServiceComponent(sch.getServiceComponentName());
+ if (serviceComponent != null) {
+ Map<String, ServiceComponentHost> serviceComponentHostMap = serviceComponent.getServiceComponentHosts();
+ for (ServiceComponentHost serviceComponentHost : serviceComponentHostMap.values()) {
+ if (serviceComponentHost.getState() == State.INSTALLED || serviceComponentHost.getState() == State.STARTED) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
@Override
public ExecutionCommand getExecutionCommand(Cluster cluster,
ServiceComponentHost scHost,
http://git-wip-us.apache.org/repos/asf/ambari/blob/9022bfb1/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java
index bdb208b..b6686b4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java
@@ -231,7 +231,7 @@ public interface KerberosHelper {
*/
Map<String, Map<String, String>> getServiceConfigurationUpdates(Cluster cluster,
Map<String, Map<String, String>> existingConfigurations,
- Set<String> services)
+ Set<String> services, boolean serviceAlreadyExists)
throws KerberosInvalidConfigurationException, AmbariException;
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/9022bfb1/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
index a9f11f7..ef9cab6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
@@ -18,23 +18,10 @@
package org.apache.ambari.server.controller;
-import java.io.File;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
+import com.google.inject.Inject;
import com.google.inject.Injector;
+import com.google.inject.Singleton;
+import com.google.inject.persist.Transactional;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.Role;
import org.apache.ambari.server.RoleCommand;
@@ -122,9 +109,21 @@ import org.apache.directory.server.kerberos.shared.keytab.Keytab;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.google.inject.persist.Transactional;
+import java.io.File;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
@Singleton
public class KerberosHelperImpl implements KerberosHelper {
@@ -311,7 +310,7 @@ public class KerberosHelperImpl implements KerberosHelper {
Map<String, Map<String, String>> existingConfigurations = calculateExistingConfigurations(cluster, hostName);
Map<String, Map<String, String>> updates = getServiceConfigurationUpdates(cluster,
- existingConfigurations, Collections.singleton(serviceName));
+ existingConfigurations, Collections.singleton(serviceName), serviceAlreadyExists(cluster, serviceComponentHost));
for (Map.Entry<String, Map<String, String>> entry : updates.entrySet()) {
configHelper.updateConfigType(cluster, ambariManagementController, entry.getKey(), entry.getValue(), null,
@@ -319,8 +318,25 @@ public class KerberosHelperImpl implements KerberosHelper {
}
}
+ private boolean serviceAlreadyExists(Cluster cluster, ServiceComponentHost sch) throws AmbariException {
+ Service service = cluster.getService(sch.getServiceName());
+ if (service != null) {
+ Map<String, ServiceComponent> serviceComponentMap = service.getServiceComponents();
+ for (ServiceComponent serviceComponent : serviceComponentMap.values()) {
+ Map<String, ServiceComponentHost> serviceComponentHostMap = serviceComponent.getServiceComponentHosts();
+ for (ServiceComponentHost serviceComponentHost : serviceComponentHostMap.values()) {
+ if (serviceComponentHost.getState() == State.INSTALLED || serviceComponentHost.getState() == State.STARTED) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
@Override
- public Map<String, Map<String, String>> getServiceConfigurationUpdates(Cluster cluster, Map<String, Map<String, String>> existingConfigurations, Set<String> services)
+ public Map<String, Map<String, String>> getServiceConfigurationUpdates(Cluster cluster, Map<String, Map<String, String>> existingConfigurations, Set<String> services,
+ boolean serviceAlreadyExists)
throws KerberosInvalidConfigurationException, AmbariException {
Map<String, Map<String, String>> kerberosConfigurations = new HashMap<String, Map<String, String>>();
@@ -359,7 +375,7 @@ public class KerberosHelperImpl implements KerberosHelper {
}
mergeConfigurations(kerberosConfigurations,
- componentDescriptor.getConfigurations(true), configurations);
+ componentDescriptor.getConfigurations(!serviceAlreadyExists), configurations);
}
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9022bfb1/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
index c662e28..9390b3a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
@@ -116,7 +116,7 @@ public class ClusterConfigurationRequest {
Map<String, Map<String, String>> updatedConfigs = AmbariContext.getController().getKerberosHelper()
.getServiceConfigurationUpdates(cluster, clusterConfiguration.getFullProperties(),
- new HashSet<String>(blueprint.getServices()));
+ new HashSet<String>(blueprint.getServices()), false);
for (String configType : updatedConfigs.keySet()) {
Map<String, String> propertyMap = updatedConfigs.get(configType);
for (String property : propertyMap.keySet()) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/9022bfb1/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
index 6b7ec6f..035d6b1 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
@@ -18,27 +18,10 @@
package org.apache.ambari.server.controller;
-import static org.easymock.EasyMock.*;
-import static org.junit.Assert.*;
-
-import java.lang.reflect.Field;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import javax.persistence.EntityManager;
-
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
import junit.framework.Assert;
-
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.Role;
import org.apache.ambari.server.actionmanager.ActionManager;
@@ -111,9 +94,37 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
+import javax.persistence.EntityManager;
+import java.lang.reflect.Field;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import static org.easymock.EasyMock.anyLong;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.capture;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.getCurrentArguments;
+import static org.easymock.EasyMock.isNull;
+import static org.easymock.EasyMock.newCapture;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.reset;
+import static org.easymock.EasyMock.verify;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
@SuppressWarnings("unchecked")
public class KerberosHelperTest extends EasyMockSupport {
@@ -2256,10 +2267,10 @@ public class KerberosHelperTest extends EasyMockSupport {
injector.getInstance(AmbariMetaInfo.class).init();
Map<String, Map<String, String>> updates1 = kerberosHelper.getServiceConfigurationUpdates(
- cluster, existingConfigurations, new HashSet<String>(Arrays.asList("SERVICE1", "SERVICE2", "SERVICE3")));
+ cluster, existingConfigurations, new HashSet<String>(Arrays.asList("SERVICE1", "SERVICE2", "SERVICE3")), false);
Map<String, Map<String, String>> updates2 = kerberosHelper.getServiceConfigurationUpdates(
- cluster, existingConfigurations, new HashSet<String>(Arrays.asList("SERVICE1", "SERVICE3")));
+ cluster, existingConfigurations, new HashSet<String>(Arrays.asList("SERVICE1", "SERVICE3")), false);
verifyAll();
http://git-wip-us.apache.org/repos/asf/ambari/blob/9022bfb1/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java
index 93f4de6..26ab63f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java
@@ -18,43 +18,16 @@
package org.apache.ambari.server.topology;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-
import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorBlueprintProcessor;
import org.apache.ambari.server.controller.AmbariManagementController;
-import org.apache.ambari.server.controller.ClusterRequest;
import org.apache.ambari.server.controller.ConfigurationRequest;
import org.apache.ambari.server.controller.KerberosHelper;
-import org.apache.ambari.server.controller.RequestStatusResponse;
-import org.apache.ambari.server.controller.internal.ProvisionClusterRequest;
import org.apache.ambari.server.controller.internal.Stack;
-import org.apache.ambari.server.controller.spi.ClusterController;
-import org.apache.ambari.server.controller.spi.Resource;
-import org.apache.ambari.server.controller.spi.ResourceProvider;
-import org.apache.ambari.server.security.encryption.CredentialStoreService;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
-import org.apache.ambari.server.state.SecurityType;
-import org.easymock.Capture;
-import org.easymock.EasyMock;
import org.easymock.EasyMockRule;
-import org.easymock.EasyMockSupport;
import org.easymock.Mock;
import org.easymock.MockType;
-import org.easymock.TestSubject;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -62,17 +35,17 @@ import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import static org.easymock.EasyMock.anyBoolean;
import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.anyString;
-import static org.easymock.EasyMock.capture;
-import static org.easymock.EasyMock.eq;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.isA;
-import static org.easymock.EasyMock.isNull;
-import static org.easymock.EasyMock.newCapture;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.reset;
import static org.easymock.EasyMock.verify;
/**
@@ -157,7 +130,7 @@ public class ClusterConfigurationRequestTest {
expect(kerberosHelper.ensureHeadlessIdentities(anyObject(Cluster.class), anyObject(Map.class), anyObject
(Set.class))).andReturn(true).once();
expect(kerberosHelper.getServiceConfigurationUpdates(anyObject(Cluster.class), anyObject(Map.class), anyObject
- (Set.class))).andReturn(kerberosConfig).once();
+ (Set.class), anyBoolean())).andReturn(kerberosConfig).once();
PowerMock.replay(stack, blueprint, topology, controller, clusters, kerberosHelper, ambariContext,
[17/50] [abbrv] ambari git commit: AMBARI-14504. Role command order
is parsed incorrectly causing Hive Service Check fail on 'Start all'
(aonishuk)
Posted by nc...@apache.org.
AMBARI-14504. Role command order is parsed incorrectly causing Hive Service Check fail on 'Start all' (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f697f4af
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f697f4af
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f697f4af
Branch: refs/heads/branch-dev-patch-upgrade
Commit: f697f4aff80ab8f49eed654e70087bf436f9240f
Parents: b328f6d
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Tue Dec 29 13:16:32 2015 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Dec 29 13:16:32 2015 +0200
----------------------------------------------------------------------
ambari-server/pom.xml | 11 --
.../server/metadata/RoleCommandOrder.java | 3 +
.../ambari/server/stack/StackDirectory.java | 6 +-
.../src/main/resources/role_command_order.json | 104 -------------------
.../stacks/HDP/0.1/role_command_order.json | 104 +++++++++++++++++++
.../stacks/HDP/2.0.5/role_command_order.json | 104 +++++++++++++++++++
6 files changed, 213 insertions(+), 119 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/f697f4af/ambari-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index 17d3aae..9c0ba26 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -531,9 +531,6 @@
<source>
<location>${project.build.directory}/DBConnectionVerification.jar</location>
</source>
- <source>
- <location>src/main/resources/role_command_order.json</location>
- </source>
</sources>
</mapping>
<mapping>
@@ -1006,14 +1003,6 @@
</mapper>
</data>
<data>
- <src>src/main/resources/role_command_order.json</src>
- <type>file</type>
- <mapper>
- <type>perm</type>
- <prefix>/var/lib/ambari-server/resources</prefix>
- </mapper>
- </data>
- <data>
<src>src/main/resources/scripts</src>
<type>directory</type>
<mapper>
http://git-wip-us.apache.org/repos/asf/ambari/blob/f697f4af/ambari-server/src/main/java/org/apache/ambari/server/metadata/RoleCommandOrder.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/metadata/RoleCommandOrder.java b/ambari-server/src/main/java/org/apache/ambari/server/metadata/RoleCommandOrder.java
index f424f81..f3356da 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/metadata/RoleCommandOrder.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/metadata/RoleCommandOrder.java
@@ -137,6 +137,9 @@ public class RoleCommandOrder {
}
void addDependencies(Map<String, Object> jsonSection) {
+ if(jsonSection == null) // in case we don't have a certain section or role_command_order.json at all.
+ return;
+
for (Object blockedObj : jsonSection.keySet()) {
String blocked = (String) blockedObj;
if (COMMENT_STR.equals(blocked)) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/f697f4af/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
index 9cfeffe..c552e41 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
@@ -487,10 +487,8 @@ public class StackDirectory extends StackDefinitionDirectory {
result = mapper.readValue(file, rcoElementTypeReference);
LOG.info("Role command order info was loaded from file: {}", file.getAbsolutePath());
} else {
- InputStream rcoInputStream = ClassLoader.getSystemResourceAsStream(ROLE_COMMAND_ORDER_FILE);
- result = mapper.readValue(rcoInputStream, rcoElementTypeReference);
- LOG.info("Role command order info was loaded from classpath: " +
- ClassLoader.getSystemResource(ROLE_COMMAND_ORDER_FILE));
+ LOG.info("Stack '{}' doesn't contain role command order file", getPath());
+ result = new HashMap<String, Object>();
}
roleCommandOrder = new StackRoleCommandOrder(result);
parseRoleCommandOrdersForServices();
http://git-wip-us.apache.org/repos/asf/ambari/blob/f697f4af/ambari-server/src/main/resources/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/role_command_order.json b/ambari-server/src/main/resources/role_command_order.json
deleted file mode 100644
index 870a537..0000000
--- a/ambari-server/src/main/resources/role_command_order.json
+++ /dev/null
@@ -1,104 +0,0 @@
-{
- "_comment" : "Record format:",
- "_comment" : "blockedRole-blockedCommand: [blockerRole1-blockerCommand1, blockerRole2-blockerCommand2, ...]",
- "general_deps" : {
- "_comment" : "dependencies for all cases",
- "HBASE_MASTER-START": ["ZOOKEEPER_SERVER-START"],
- "HBASE_REGIONSERVER-START": ["HBASE_MASTER-START"],
- "OOZIE_SERVER-START": ["JOBTRACKER-START", "TASKTRACKER-START"],
- "WEBHCAT_SERVER-START": ["TASKTRACKER-START", "HIVE_SERVER-START"],
- "WEBHCAT_SERVER-RESTART": ["TASKTRACKER-RESTART", "HIVE_SERVER-RESTART"],
- "HIVE_METASTORE-START": ["MYSQL_SERVER-START"],
- "HIVE_METASTORE-RESTART": ["MYSQL_SERVER-RESTART"],
- "HIVE_SERVER-START": ["TASKTRACKER-START", "MYSQL_SERVER-START"],
- "HIVE_SERVER-RESTART": ["TASKTRACKER-RESTART", "MYSQL_SERVER-RESTART"],
- "HUE_SERVER-START": ["HIVE_SERVER-START", "HCAT-START", "OOZIE_SERVER-START"],
- "FLUME_HANDLER-START": ["OOZIE_SERVER-START"],
- "ACCUMULO_MASTER-START": ["ZOOKEEPER_SERVER-START", "NAMENODE-START", "DATANODE-START"],
- "ACCUMULO_TSERVER-START": ["ACCUMULO_MASTER-START"],
- "ACCUMULO_MONITOR-START": ["ACCUMULO_MASTER-START"],
- "ACCUMULO_GC-START": ["ACCUMULO_MASTER-START"],
- "ACCUMULO_TRACER-START": ["ACCUMULO_MASTER-START", "ACCUMULO_TSERVER-START"],
- "MAPREDUCE_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
- "OOZIE_SERVICE_CHECK-SERVICE_CHECK": ["OOZIE_SERVER-START"],
- "WEBHCAT_SERVICE_CHECK-SERVICE_CHECK": ["WEBHCAT_SERVER-START"],
- "HBASE_SERVICE_CHECK-SERVICE_CHECK": ["HBASE_MASTER-START", "HBASE_REGIONSERVER-START"],
- "HIVE_SERVICE_CHECK-SERVICE_CHECK": ["HIVE_SERVER-START", "HIVE_METASTORE-START"],
- "HCAT_SERVICE_CHECK-SERVICE_CHECK": ["HIVE_SERVER-START"],
- "PIG_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
- "SQOOP_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
- "ACCUMULO_SERVICE_CHECK-SERVICE_CHECK": ["ACCUMULO_MASTER-START", "ACCUMULO_TSERVER-START", "ACCUMULO_TRACER-START"],
- "ZOOKEEPER_SERVICE_CHECK-SERVICE_CHECK": ["ZOOKEEPER_SERVER-START"],
- "ZOOKEEPER_QUORUM_SERVICE_CHECK-SERVICE_CHECK": ["ZOOKEEPER_SERVER-START"],
- "ZOOKEEPER_SERVER-STOP" : ["HBASE_MASTER-STOP", "HBASE_REGIONSERVER-STOP", "ACCUMULO_MASTER-STOP", "ACCUMULO_TSERVER-STOP", "ACCUMULO_GC-STOP"],
- "ACCUMULO_MONITOR-STOP" : ["ACCUMULO_MASTER-STOP"],
- "ACCUMULO_MASTER-STOP" : ["ACCUMULO_TSERVER-STOP"],
- "ACCUMULO_TSERVER-STOP" : ["ACCUMULO_TRACER-STOP", "ACCUMULO_GC-STOP"],
- "HBASE_MASTER-STOP": ["HBASE_REGIONSERVER-STOP"],
- "TASKTRACKER-UPGRADE": ["JOBTRACKER-UPGRADE"],
- "MAPREDUCE_CLIENT-UPGRADE": ["TASKTRACKER-UPGRADE", "JOBTRACKER-UPGRADE"],
- "ZOOKEEPER_SERVER-UPGRADE": ["MAPREDUCE_CLIENT-UPGRADE"],
- "ZOOKEEPER_CLIENT-UPGRADE": ["ZOOKEEPER_SERVER-UPGRADE"],
- "HBASE_MASTER-UPGRADE": ["ZOOKEEPER_CLIENT-UPGRADE"],
- "HBASE_REGIONSERVER-UPGRADE": ["HBASE_MASTER-UPGRADE"],
- "HBASE_CLIENT-UPGRADE": ["HBASE_REGIONSERVER-UPGRADE"],
- "HIVE_SERVER-UPGRADE" : ["HBASE_CLIENT-UPGRADE"],
- "HIVE_METASTORE-UPGRADE" : ["HIVE_SERVER-UPGRADE"],
- "MYSQL_SERVER-UPGRADE": ["HIVE_METASTORE-UPGRADE"],
- "HIVE_CLIENT-UPGRADE": ["MYSQL_SERVER-UPGRADE"],
- "HCAT-UPGRADE": ["HIVE_CLIENT-UPGRADE"],
- "OOZIE_SERVER-UPGRADE" : ["HCAT-UPGRADE"],
- "OOZIE_CLIENT-UPGRADE" : ["OOZIE_SERVER-UPGRADE"],
- "WEBHCAT_SERVER-UPGRADE" : ["OOZIE_CLIENT-UPGRADE"],
- "PIG-UPGRADE" : ["WEBHCAT_SERVER-UPGRADE"],
- "SQOOP-UPGRADE" : ["PIG-UPGRADE"],
- "GANGLIA_SERVER-UPGRADE" : ["SQOOP-UPGRADE"],
- "GANGLIA_MONITOR-UPGRADE" : ["GANGLIA_SERVER-UPGRADE"]
- },
- "_comment" : "GLUSTERFS-specific dependencies",
- "optional_glusterfs": {
- "HBASE_MASTER-START": ["PEERSTATUS-START"],
- "JOBTRACKER-START": ["PEERSTATUS-START"],
- "TASKTRACKER-START": ["PEERSTATUS-START"],
- "GLUSTERFS_SERVICE_CHECK-SERVICE_CHECK": ["PEERSTATUS-START"],
- "JOBTRACKER-UPGRADE": ["GLUSTERFS_CLIENT-UPGRADE"]
- },
- "_comment" : "Dependencies that are used when GLUSTERFS is not present in cluster",
- "optional_no_glusterfs": {
- "SECONDARY_NAMENODE-START": ["NAMENODE-START"],
- "RESOURCEMANAGER-START": ["NAMENODE-START", "DATANODE-START"],
- "NODEMANAGER-START": ["NAMENODE-START", "DATANODE-START", "RESOURCEMANAGER-START"],
- "HISTORYSERVER-START": ["NAMENODE-START", "DATANODE-START"],
- "HBASE_MASTER-START": ["NAMENODE-START", "DATANODE-START"],
- "JOBTRACKER-START": ["NAMENODE-START", "DATANODE-START"],
- "TASKTRACKER-START": ["NAMENODE-START", "DATANODE-START"],
- "HIVE_SERVER-START": ["DATANODE-START"],
- "WEBHCAT_SERVER-START": ["DATANODE-START"],
- "HDFS_SERVICE_CHECK-SERVICE_CHECK": ["NAMENODE-START", "DATANODE-START",
- "SECONDARY_NAMENODE-START"],
- "MAPREDUCE2_SERVICE_CHECK-SERVICE_CHECK": ["NODEMANAGER-START",
- "RESOURCEMANAGER-START", "HISTORYSERVER-START", "YARN_SERVICE_CHECK-SERVICE_CHECK"],
- "YARN_SERVICE_CHECK-SERVICE_CHECK": ["NODEMANAGER-START", "RESOURCEMANAGER-START"],
- "RESOURCEMANAGER_SERVICE_CHECK-SERVICE_CHECK": ["RESOURCEMANAGER-START"],
- "PIG_SERVICE_CHECK-SERVICE_CHECK": ["RESOURCEMANAGER-START", "NODEMANAGER-START"],
- "NAMENODE-STOP": ["JOBTRACKER-STOP", "TASKTRACKER-STOP", "RESOURCEMANAGER-STOP",
- "NODEMANAGER-STOP", "HISTORYSERVER-STOP", "HBASE_MASTER-STOP"],
- "DATANODE-STOP": ["JOBTRACKER-STOP", "TASKTRACKER-STOP", "RESOURCEMANAGER-STOP",
- "NODEMANAGER-STOP", "HISTORYSERVER-STOP", "HBASE_MASTER-STOP"],
- "SECONDARY_NAMENODE-UPGRADE": ["NAMENODE-UPGRADE"],
- "DATANODE-UPGRADE": ["SECONDARY_NAMENODE-UPGRADE"],
- "HDFS_CLIENT-UPGRADE": ["DATANODE-UPGRADE"],
- "JOBTRACKER-UPGRADE": ["HDFS_CLIENT-UPGRADE"]
- },
- "_comment" : "Dependencies that are used in HA NameNode cluster",
- "namenode_optional_ha": {
- "NAMENODE-START": ["JOURNALNODE-START", "ZOOKEEPER_SERVER-START"],
- "ZKFC-START": ["NAMENODE-START"],
- "HDFS_SERVICE_CHECK-SERVICE_CHECK": ["ZKFC-START"]
- },
- "_comment" : "Dependencies that are used in ResourceManager HA cluster",
- "resourcemanager_optional_ha" : {
- "RESOURCEMANAGER-START": ["ZOOKEEPER_SERVER-START"]
- }
-}
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/f697f4af/ambari-server/src/test/resources/stacks/HDP/0.1/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/0.1/role_command_order.json b/ambari-server/src/test/resources/stacks/HDP/0.1/role_command_order.json
new file mode 100644
index 0000000..870a537
--- /dev/null
+++ b/ambari-server/src/test/resources/stacks/HDP/0.1/role_command_order.json
@@ -0,0 +1,104 @@
+{
+ "_comment" : "Record format:",
+ "_comment" : "blockedRole-blockedCommand: [blockerRole1-blockerCommand1, blockerRole2-blockerCommand2, ...]",
+ "general_deps" : {
+ "_comment" : "dependencies for all cases",
+ "HBASE_MASTER-START": ["ZOOKEEPER_SERVER-START"],
+ "HBASE_REGIONSERVER-START": ["HBASE_MASTER-START"],
+ "OOZIE_SERVER-START": ["JOBTRACKER-START", "TASKTRACKER-START"],
+ "WEBHCAT_SERVER-START": ["TASKTRACKER-START", "HIVE_SERVER-START"],
+ "WEBHCAT_SERVER-RESTART": ["TASKTRACKER-RESTART", "HIVE_SERVER-RESTART"],
+ "HIVE_METASTORE-START": ["MYSQL_SERVER-START"],
+ "HIVE_METASTORE-RESTART": ["MYSQL_SERVER-RESTART"],
+ "HIVE_SERVER-START": ["TASKTRACKER-START", "MYSQL_SERVER-START"],
+ "HIVE_SERVER-RESTART": ["TASKTRACKER-RESTART", "MYSQL_SERVER-RESTART"],
+ "HUE_SERVER-START": ["HIVE_SERVER-START", "HCAT-START", "OOZIE_SERVER-START"],
+ "FLUME_HANDLER-START": ["OOZIE_SERVER-START"],
+ "ACCUMULO_MASTER-START": ["ZOOKEEPER_SERVER-START", "NAMENODE-START", "DATANODE-START"],
+ "ACCUMULO_TSERVER-START": ["ACCUMULO_MASTER-START"],
+ "ACCUMULO_MONITOR-START": ["ACCUMULO_MASTER-START"],
+ "ACCUMULO_GC-START": ["ACCUMULO_MASTER-START"],
+ "ACCUMULO_TRACER-START": ["ACCUMULO_MASTER-START", "ACCUMULO_TSERVER-START"],
+ "MAPREDUCE_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
+ "OOZIE_SERVICE_CHECK-SERVICE_CHECK": ["OOZIE_SERVER-START"],
+ "WEBHCAT_SERVICE_CHECK-SERVICE_CHECK": ["WEBHCAT_SERVER-START"],
+ "HBASE_SERVICE_CHECK-SERVICE_CHECK": ["HBASE_MASTER-START", "HBASE_REGIONSERVER-START"],
+ "HIVE_SERVICE_CHECK-SERVICE_CHECK": ["HIVE_SERVER-START", "HIVE_METASTORE-START"],
+ "HCAT_SERVICE_CHECK-SERVICE_CHECK": ["HIVE_SERVER-START"],
+ "PIG_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
+ "SQOOP_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
+ "ACCUMULO_SERVICE_CHECK-SERVICE_CHECK": ["ACCUMULO_MASTER-START", "ACCUMULO_TSERVER-START", "ACCUMULO_TRACER-START"],
+ "ZOOKEEPER_SERVICE_CHECK-SERVICE_CHECK": ["ZOOKEEPER_SERVER-START"],
+ "ZOOKEEPER_QUORUM_SERVICE_CHECK-SERVICE_CHECK": ["ZOOKEEPER_SERVER-START"],
+ "ZOOKEEPER_SERVER-STOP" : ["HBASE_MASTER-STOP", "HBASE_REGIONSERVER-STOP", "ACCUMULO_MASTER-STOP", "ACCUMULO_TSERVER-STOP", "ACCUMULO_GC-STOP"],
+ "ACCUMULO_MONITOR-STOP" : ["ACCUMULO_MASTER-STOP"],
+ "ACCUMULO_MASTER-STOP" : ["ACCUMULO_TSERVER-STOP"],
+ "ACCUMULO_TSERVER-STOP" : ["ACCUMULO_TRACER-STOP", "ACCUMULO_GC-STOP"],
+ "HBASE_MASTER-STOP": ["HBASE_REGIONSERVER-STOP"],
+ "TASKTRACKER-UPGRADE": ["JOBTRACKER-UPGRADE"],
+ "MAPREDUCE_CLIENT-UPGRADE": ["TASKTRACKER-UPGRADE", "JOBTRACKER-UPGRADE"],
+ "ZOOKEEPER_SERVER-UPGRADE": ["MAPREDUCE_CLIENT-UPGRADE"],
+ "ZOOKEEPER_CLIENT-UPGRADE": ["ZOOKEEPER_SERVER-UPGRADE"],
+ "HBASE_MASTER-UPGRADE": ["ZOOKEEPER_CLIENT-UPGRADE"],
+ "HBASE_REGIONSERVER-UPGRADE": ["HBASE_MASTER-UPGRADE"],
+ "HBASE_CLIENT-UPGRADE": ["HBASE_REGIONSERVER-UPGRADE"],
+ "HIVE_SERVER-UPGRADE" : ["HBASE_CLIENT-UPGRADE"],
+ "HIVE_METASTORE-UPGRADE" : ["HIVE_SERVER-UPGRADE"],
+ "MYSQL_SERVER-UPGRADE": ["HIVE_METASTORE-UPGRADE"],
+ "HIVE_CLIENT-UPGRADE": ["MYSQL_SERVER-UPGRADE"],
+ "HCAT-UPGRADE": ["HIVE_CLIENT-UPGRADE"],
+ "OOZIE_SERVER-UPGRADE" : ["HCAT-UPGRADE"],
+ "OOZIE_CLIENT-UPGRADE" : ["OOZIE_SERVER-UPGRADE"],
+ "WEBHCAT_SERVER-UPGRADE" : ["OOZIE_CLIENT-UPGRADE"],
+ "PIG-UPGRADE" : ["WEBHCAT_SERVER-UPGRADE"],
+ "SQOOP-UPGRADE" : ["PIG-UPGRADE"],
+ "GANGLIA_SERVER-UPGRADE" : ["SQOOP-UPGRADE"],
+ "GANGLIA_MONITOR-UPGRADE" : ["GANGLIA_SERVER-UPGRADE"]
+ },
+ "_comment" : "GLUSTERFS-specific dependencies",
+ "optional_glusterfs": {
+ "HBASE_MASTER-START": ["PEERSTATUS-START"],
+ "JOBTRACKER-START": ["PEERSTATUS-START"],
+ "TASKTRACKER-START": ["PEERSTATUS-START"],
+ "GLUSTERFS_SERVICE_CHECK-SERVICE_CHECK": ["PEERSTATUS-START"],
+ "JOBTRACKER-UPGRADE": ["GLUSTERFS_CLIENT-UPGRADE"]
+ },
+ "_comment" : "Dependencies that are used when GLUSTERFS is not present in cluster",
+ "optional_no_glusterfs": {
+ "SECONDARY_NAMENODE-START": ["NAMENODE-START"],
+ "RESOURCEMANAGER-START": ["NAMENODE-START", "DATANODE-START"],
+ "NODEMANAGER-START": ["NAMENODE-START", "DATANODE-START", "RESOURCEMANAGER-START"],
+ "HISTORYSERVER-START": ["NAMENODE-START", "DATANODE-START"],
+ "HBASE_MASTER-START": ["NAMENODE-START", "DATANODE-START"],
+ "JOBTRACKER-START": ["NAMENODE-START", "DATANODE-START"],
+ "TASKTRACKER-START": ["NAMENODE-START", "DATANODE-START"],
+ "HIVE_SERVER-START": ["DATANODE-START"],
+ "WEBHCAT_SERVER-START": ["DATANODE-START"],
+ "HDFS_SERVICE_CHECK-SERVICE_CHECK": ["NAMENODE-START", "DATANODE-START",
+ "SECONDARY_NAMENODE-START"],
+ "MAPREDUCE2_SERVICE_CHECK-SERVICE_CHECK": ["NODEMANAGER-START",
+ "RESOURCEMANAGER-START", "HISTORYSERVER-START", "YARN_SERVICE_CHECK-SERVICE_CHECK"],
+ "YARN_SERVICE_CHECK-SERVICE_CHECK": ["NODEMANAGER-START", "RESOURCEMANAGER-START"],
+ "RESOURCEMANAGER_SERVICE_CHECK-SERVICE_CHECK": ["RESOURCEMANAGER-START"],
+ "PIG_SERVICE_CHECK-SERVICE_CHECK": ["RESOURCEMANAGER-START", "NODEMANAGER-START"],
+ "NAMENODE-STOP": ["JOBTRACKER-STOP", "TASKTRACKER-STOP", "RESOURCEMANAGER-STOP",
+ "NODEMANAGER-STOP", "HISTORYSERVER-STOP", "HBASE_MASTER-STOP"],
+ "DATANODE-STOP": ["JOBTRACKER-STOP", "TASKTRACKER-STOP", "RESOURCEMANAGER-STOP",
+ "NODEMANAGER-STOP", "HISTORYSERVER-STOP", "HBASE_MASTER-STOP"],
+ "SECONDARY_NAMENODE-UPGRADE": ["NAMENODE-UPGRADE"],
+ "DATANODE-UPGRADE": ["SECONDARY_NAMENODE-UPGRADE"],
+ "HDFS_CLIENT-UPGRADE": ["DATANODE-UPGRADE"],
+ "JOBTRACKER-UPGRADE": ["HDFS_CLIENT-UPGRADE"]
+ },
+ "_comment" : "Dependencies that are used in HA NameNode cluster",
+ "namenode_optional_ha": {
+ "NAMENODE-START": ["JOURNALNODE-START", "ZOOKEEPER_SERVER-START"],
+ "ZKFC-START": ["NAMENODE-START"],
+ "HDFS_SERVICE_CHECK-SERVICE_CHECK": ["ZKFC-START"]
+ },
+ "_comment" : "Dependencies that are used in ResourceManager HA cluster",
+ "resourcemanager_optional_ha" : {
+ "RESOURCEMANAGER-START": ["ZOOKEEPER_SERVER-START"]
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/f697f4af/ambari-server/src/test/resources/stacks/HDP/2.0.5/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.5/role_command_order.json b/ambari-server/src/test/resources/stacks/HDP/2.0.5/role_command_order.json
new file mode 100644
index 0000000..870a537
--- /dev/null
+++ b/ambari-server/src/test/resources/stacks/HDP/2.0.5/role_command_order.json
@@ -0,0 +1,104 @@
+{
+ "_comment" : "Record format:",
+ "_comment" : "blockedRole-blockedCommand: [blockerRole1-blockerCommand1, blockerRole2-blockerCommand2, ...]",
+ "general_deps" : {
+ "_comment" : "dependencies for all cases",
+ "HBASE_MASTER-START": ["ZOOKEEPER_SERVER-START"],
+ "HBASE_REGIONSERVER-START": ["HBASE_MASTER-START"],
+ "OOZIE_SERVER-START": ["JOBTRACKER-START", "TASKTRACKER-START"],
+ "WEBHCAT_SERVER-START": ["TASKTRACKER-START", "HIVE_SERVER-START"],
+ "WEBHCAT_SERVER-RESTART": ["TASKTRACKER-RESTART", "HIVE_SERVER-RESTART"],
+ "HIVE_METASTORE-START": ["MYSQL_SERVER-START"],
+ "HIVE_METASTORE-RESTART": ["MYSQL_SERVER-RESTART"],
+ "HIVE_SERVER-START": ["TASKTRACKER-START", "MYSQL_SERVER-START"],
+ "HIVE_SERVER-RESTART": ["TASKTRACKER-RESTART", "MYSQL_SERVER-RESTART"],
+ "HUE_SERVER-START": ["HIVE_SERVER-START", "HCAT-START", "OOZIE_SERVER-START"],
+ "FLUME_HANDLER-START": ["OOZIE_SERVER-START"],
+ "ACCUMULO_MASTER-START": ["ZOOKEEPER_SERVER-START", "NAMENODE-START", "DATANODE-START"],
+ "ACCUMULO_TSERVER-START": ["ACCUMULO_MASTER-START"],
+ "ACCUMULO_MONITOR-START": ["ACCUMULO_MASTER-START"],
+ "ACCUMULO_GC-START": ["ACCUMULO_MASTER-START"],
+ "ACCUMULO_TRACER-START": ["ACCUMULO_MASTER-START", "ACCUMULO_TSERVER-START"],
+ "MAPREDUCE_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
+ "OOZIE_SERVICE_CHECK-SERVICE_CHECK": ["OOZIE_SERVER-START"],
+ "WEBHCAT_SERVICE_CHECK-SERVICE_CHECK": ["WEBHCAT_SERVER-START"],
+ "HBASE_SERVICE_CHECK-SERVICE_CHECK": ["HBASE_MASTER-START", "HBASE_REGIONSERVER-START"],
+ "HIVE_SERVICE_CHECK-SERVICE_CHECK": ["HIVE_SERVER-START", "HIVE_METASTORE-START"],
+ "HCAT_SERVICE_CHECK-SERVICE_CHECK": ["HIVE_SERVER-START"],
+ "PIG_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
+ "SQOOP_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
+ "ACCUMULO_SERVICE_CHECK-SERVICE_CHECK": ["ACCUMULO_MASTER-START", "ACCUMULO_TSERVER-START", "ACCUMULO_TRACER-START"],
+ "ZOOKEEPER_SERVICE_CHECK-SERVICE_CHECK": ["ZOOKEEPER_SERVER-START"],
+ "ZOOKEEPER_QUORUM_SERVICE_CHECK-SERVICE_CHECK": ["ZOOKEEPER_SERVER-START"],
+ "ZOOKEEPER_SERVER-STOP" : ["HBASE_MASTER-STOP", "HBASE_REGIONSERVER-STOP", "ACCUMULO_MASTER-STOP", "ACCUMULO_TSERVER-STOP", "ACCUMULO_GC-STOP"],
+ "ACCUMULO_MONITOR-STOP" : ["ACCUMULO_MASTER-STOP"],
+ "ACCUMULO_MASTER-STOP" : ["ACCUMULO_TSERVER-STOP"],
+ "ACCUMULO_TSERVER-STOP" : ["ACCUMULO_TRACER-STOP", "ACCUMULO_GC-STOP"],
+ "HBASE_MASTER-STOP": ["HBASE_REGIONSERVER-STOP"],
+ "TASKTRACKER-UPGRADE": ["JOBTRACKER-UPGRADE"],
+ "MAPREDUCE_CLIENT-UPGRADE": ["TASKTRACKER-UPGRADE", "JOBTRACKER-UPGRADE"],
+ "ZOOKEEPER_SERVER-UPGRADE": ["MAPREDUCE_CLIENT-UPGRADE"],
+ "ZOOKEEPER_CLIENT-UPGRADE": ["ZOOKEEPER_SERVER-UPGRADE"],
+ "HBASE_MASTER-UPGRADE": ["ZOOKEEPER_CLIENT-UPGRADE"],
+ "HBASE_REGIONSERVER-UPGRADE": ["HBASE_MASTER-UPGRADE"],
+ "HBASE_CLIENT-UPGRADE": ["HBASE_REGIONSERVER-UPGRADE"],
+ "HIVE_SERVER-UPGRADE" : ["HBASE_CLIENT-UPGRADE"],
+ "HIVE_METASTORE-UPGRADE" : ["HIVE_SERVER-UPGRADE"],
+ "MYSQL_SERVER-UPGRADE": ["HIVE_METASTORE-UPGRADE"],
+ "HIVE_CLIENT-UPGRADE": ["MYSQL_SERVER-UPGRADE"],
+ "HCAT-UPGRADE": ["HIVE_CLIENT-UPGRADE"],
+ "OOZIE_SERVER-UPGRADE" : ["HCAT-UPGRADE"],
+ "OOZIE_CLIENT-UPGRADE" : ["OOZIE_SERVER-UPGRADE"],
+ "WEBHCAT_SERVER-UPGRADE" : ["OOZIE_CLIENT-UPGRADE"],
+ "PIG-UPGRADE" : ["WEBHCAT_SERVER-UPGRADE"],
+ "SQOOP-UPGRADE" : ["PIG-UPGRADE"],
+ "GANGLIA_SERVER-UPGRADE" : ["SQOOP-UPGRADE"],
+ "GANGLIA_MONITOR-UPGRADE" : ["GANGLIA_SERVER-UPGRADE"]
+ },
+ "_comment" : "GLUSTERFS-specific dependencies",
+ "optional_glusterfs": {
+ "HBASE_MASTER-START": ["PEERSTATUS-START"],
+ "JOBTRACKER-START": ["PEERSTATUS-START"],
+ "TASKTRACKER-START": ["PEERSTATUS-START"],
+ "GLUSTERFS_SERVICE_CHECK-SERVICE_CHECK": ["PEERSTATUS-START"],
+ "JOBTRACKER-UPGRADE": ["GLUSTERFS_CLIENT-UPGRADE"]
+ },
+ "_comment" : "Dependencies that are used when GLUSTERFS is not present in cluster",
+ "optional_no_glusterfs": {
+ "SECONDARY_NAMENODE-START": ["NAMENODE-START"],
+ "RESOURCEMANAGER-START": ["NAMENODE-START", "DATANODE-START"],
+ "NODEMANAGER-START": ["NAMENODE-START", "DATANODE-START", "RESOURCEMANAGER-START"],
+ "HISTORYSERVER-START": ["NAMENODE-START", "DATANODE-START"],
+ "HBASE_MASTER-START": ["NAMENODE-START", "DATANODE-START"],
+ "JOBTRACKER-START": ["NAMENODE-START", "DATANODE-START"],
+ "TASKTRACKER-START": ["NAMENODE-START", "DATANODE-START"],
+ "HIVE_SERVER-START": ["DATANODE-START"],
+ "WEBHCAT_SERVER-START": ["DATANODE-START"],
+ "HDFS_SERVICE_CHECK-SERVICE_CHECK": ["NAMENODE-START", "DATANODE-START",
+ "SECONDARY_NAMENODE-START"],
+ "MAPREDUCE2_SERVICE_CHECK-SERVICE_CHECK": ["NODEMANAGER-START",
+ "RESOURCEMANAGER-START", "HISTORYSERVER-START", "YARN_SERVICE_CHECK-SERVICE_CHECK"],
+ "YARN_SERVICE_CHECK-SERVICE_CHECK": ["NODEMANAGER-START", "RESOURCEMANAGER-START"],
+ "RESOURCEMANAGER_SERVICE_CHECK-SERVICE_CHECK": ["RESOURCEMANAGER-START"],
+ "PIG_SERVICE_CHECK-SERVICE_CHECK": ["RESOURCEMANAGER-START", "NODEMANAGER-START"],
+ "NAMENODE-STOP": ["JOBTRACKER-STOP", "TASKTRACKER-STOP", "RESOURCEMANAGER-STOP",
+ "NODEMANAGER-STOP", "HISTORYSERVER-STOP", "HBASE_MASTER-STOP"],
+ "DATANODE-STOP": ["JOBTRACKER-STOP", "TASKTRACKER-STOP", "RESOURCEMANAGER-STOP",
+ "NODEMANAGER-STOP", "HISTORYSERVER-STOP", "HBASE_MASTER-STOP"],
+ "SECONDARY_NAMENODE-UPGRADE": ["NAMENODE-UPGRADE"],
+ "DATANODE-UPGRADE": ["SECONDARY_NAMENODE-UPGRADE"],
+ "HDFS_CLIENT-UPGRADE": ["DATANODE-UPGRADE"],
+ "JOBTRACKER-UPGRADE": ["HDFS_CLIENT-UPGRADE"]
+ },
+ "_comment" : "Dependencies that are used in HA NameNode cluster",
+ "namenode_optional_ha": {
+ "NAMENODE-START": ["JOURNALNODE-START", "ZOOKEEPER_SERVER-START"],
+ "ZKFC-START": ["NAMENODE-START"],
+ "HDFS_SERVICE_CHECK-SERVICE_CHECK": ["ZKFC-START"]
+ },
+ "_comment" : "Dependencies that are used in ResourceManager HA cluster",
+ "resourcemanager_optional_ha" : {
+ "RESOURCEMANAGER-START": ["ZOOKEEPER_SERVER-START"]
+ }
+}
+
[06/50] [abbrv] ambari git commit: AMBARI-14501 Improve config
recommendations flow 2. (ababiichuk)
Posted by nc...@apache.org.
AMBARI-14501 Improve config recommendations flow 2. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/73a850eb
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/73a850eb
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/73a850eb
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 73a850eb0bb781d3f6650b176d375aca9b5021f2
Parents: ff3643c
Author: ababiichuk <ab...@hortonworks.com>
Authored: Mon Dec 28 13:01:20 2015 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Mon Dec 28 14:17:03 2015 +0200
----------------------------------------------------------------------
.../controllers/main/service/info/configs.js | 16 +-
.../app/controllers/wizard/step7_controller.js | 86 +++-
ambari-web/app/mixins.js | 3 +
.../configs/config_recommendation_parser.js | 248 ++++++++++
.../common/configs/config_recommendations.js | 201 ++++++++
...onfig_with_override_recommendation_parser.js | 113 +++++
.../app/mixins/common/configs/configs_saver.js | 2 +-
.../mixins/common/configs/enhanced_configs.js | 464 ++-----------------
ambari-web/app/mixins/common/serverValidator.js | 2 +-
.../models/configs/objects/service_config.js | 4 +
.../configs/objects/service_config_property.js | 14 +
ambari-web/app/routes/add_service_routes.js | 2 +-
.../modal_popups/dependent_configs_list.hbs | 4 +-
ambari-web/app/utils/config.js | 26 +-
ambari-web/app/views/common/controls_view.js | 4 +-
.../common/modal_popups/select_groups_popup.js | 2 +-
.../main/service/info/config_test.js | 4 +-
.../common/configs/enhanced_configs_test.js | 10 +-
.../configs/widgets/config_widget_view_test.js | 14 +-
19 files changed, 770 insertions(+), 449 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index 1eef9a1..85b4f60 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -264,7 +264,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
this.get('requestsInProgress').clear();
this.clearLoadInfo();
this.clearSaveInfo();
- this.clearDependentConfigs();
+ this.clearAllRecommendations();
this.setProperties({
saveInProgress: false,
isInit: true,
@@ -536,6 +536,18 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
},
/**
+ * Allow update property if recommendations
+ * is based on changing property
+ *
+ * @param parentProperties
+ * @returns {boolean}
+ * @override
+ */
+ allowUpdateProperty: function(parentProperties) {
+ return !!(parentProperties && parentProperties.length);
+ },
+
+ /**
* trigger App.config.createOverride
* @param {Object[]} stepConfig
* @private
@@ -576,7 +588,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
*/
doCancel: function () {
this.set('preSelectedConfigVersion', null);
- this.clearDependentConfigs();
+ this.clearAllRecommendations();
this.loadSelectedVersion(this.get('selectedVersion'), this.get('selectedConfigGroup'));
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index 2726236..823d663 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -706,18 +706,11 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
if (rangerService && !rangerService.get('isInstalled') && !rangerService.get('isSelected')) {
App.config.removeRangerConfigs(self.get('stepConfigs'));
}
- this.loadServerSideConfigsRecommendations().always(function() {
- if (self.get('wizardController.name') == 'addServiceController') {
- // for Add Service just remove or add dependent properties and ignore config values changes
- // for installed services only
- self.clearDependenciesForInstalledServices(self.get('installedServiceNames'), self.get('stepConfigs'));
- }
- self.completeConfigLoading();
- });
+ this.loadServerSideConfigsRecommendations().always(this.completeConfigLoading.bind(this));
},
completeConfigLoading: function() {
- this.clearDependentConfigsByService(App.StackService.find().filterProperty('isSelected').mapProperty('serviceName'));
+ this.clearRecommendationsByServiceName(App.StackService.find().filterProperty('isSelected').mapProperty('serviceName'));
console.timeEnd('wizard loadStep: ');
this.set('isRecommendedLoaded', true);
if (this.get('content.skipConfigStep')) {
@@ -727,6 +720,17 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
},
/**
+ * Update initialValues only while loading recommendations first time
+ *
+ * @param serviceName
+ * @returns {boolean}
+ * @override
+ */
+ updateInitialOnRecommendations: function(serviceName) {
+ return this._super(serviceName) && !this.get('isRecommendedLoaded');
+ },
+
+ /**
* Mark descriptor properties in configuration object.
*
* @param {Object[]} configs - config properties to change
@@ -1224,6 +1228,70 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
},
/**
+ * @param serviceName
+ * @returns {boolean}
+ * @override
+ */
+ useInitialValue: function(serviceName) {
+ return !App.Service.find(serviceName).get('serviceName', serviceName);
+ },
+
+ /**
+ *
+ * @param parentProperties
+ * @param name
+ * @param fileName
+ * @returns {*}
+ * @override
+ */
+ allowUpdateProperty: function(parentProperties, name, fileName) {
+ if (['installerController'].contains(this.get('wizardController.name')) || !!(parentProperties && parentProperties.length)) {
+ return true;
+ } else if (['addServiceController'].contains(this.get('wizardController.name'))) {
+ var stackProperty = App.configsCollection.getConfigByName(name, fileName);
+ if (!stackProperty || !this.get('installedServices')[stackProperty.serviceName]) {
+ return true;
+ } else if (stackProperty.propertyDependsOn.length) {
+ return stackProperty.propertyDependsOn.filter(function (p) {
+ var service = App.config.getServiceByConfigType(p.type);
+ return service && !this.get('installedServices')[service.get('serviceName')];
+ }, this).length;
+ } else {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ /**
+ * remove config based on recommendations
+ * @param config
+ * @param configsCollection
+ * @param parentProperties
+ * @protected
+ * @override
+ */
+ _removeConfigByRecommendation: function (config, configsCollection, parentProperties) {
+ this._super(config, configsCollection, parentProperties);
+ /**
+ * need to update wizard info when removing configs for installed services;
+ */
+ var installedServices = this.get('installedServices'), wizardController = this.get('wizardController'),
+ fileNamesToUpdate = wizardController ? wizardController.getDBProperty('fileNamesToUpdate') || [] : [],
+ fileName = Em.get(config, 'filename'), serviceName = Em.get(config, 'serviceName');
+ var modifiedFileNames = this.get('modifiedFileNames');
+ if (modifiedFileNames && !modifiedFileNames.contains(fileName)) {
+ modifiedFileNames.push(fileName);
+ } else if (wizardController && installedServices[serviceName]) {
+ if (!fileNamesToUpdate.contains(fileName)) {
+ fileNamesToUpdate.push(fileName);
+ }
+ }
+ if (wizardController) {
+ wizardController.setDBProperty('fileNamesToUpdate', fileNamesToUpdate.uniq());
+ }
+ },
+ /**
* @method manageConfigurationGroup
*/
manageConfigurationGroup: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/app/mixins.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins.js b/ambari-web/app/mixins.js
index 90fbaa2..38d112d 100644
--- a/ambari-web/app/mixins.js
+++ b/ambari-web/app/mixins.js
@@ -45,6 +45,9 @@ require('mixins/wizard/selectHost');
require('mixins/wizard/addSecurityConfigs');
require('mixins/wizard/wizard_menu_view');
require('mixins/wizard/assign_master_components');
+require('mixins/common/configs/config_recommendations');
+require('mixins/common/configs/config_recommendation_parser');
+require('mixins/common/configs/config_with_override_recommendation_parser');
require('mixins/common/configs/enhanced_configs');
require('mixins/common/configs/configs_saver');
require('mixins/common/configs/configs_loader');
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/config_recommendation_parser.js b/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
new file mode 100644
index 0000000..4da42dd
--- /dev/null
+++ b/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
@@ -0,0 +1,248 @@
+/**
+ * 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');
+var validator = require('utils/validator');
+
+App.ConfigRecommendationParser = Em.Mixin.create(App.ConfigRecommendations, {
+
+ stepConfigs: [],
+
+ /**
+ * Method that goes through all configs
+ * and apply recommendations using callbacks
+ *
+ * @param recommendationObject
+ * @param configs
+ * @param parentProperties
+ * @param configGroup
+ * @param updateCallback
+ * @param removeCallback
+ * @param updateBoundariesCallback
+ */
+ parseRecommendations: function(recommendationObject, configs, parentProperties, configGroup,
+ updateCallback, removeCallback, updateBoundariesCallback) {
+ var propertiesToDelete = [];
+ configs.forEach(function (config) {
+ var name = Em.get(config, 'name'), fileName = Em.get(config, 'filename'),
+ site = App.config.getConfigTagFromFileName(fileName);
+ if (recommendationObject[site]) {
+ var properties = recommendationObject[site].properties,
+ property_attributes = recommendationObject[site].property_attributes;
+ if (properties) {
+ var recommendedValue = App.config.formatValue(properties[name]);
+ if (!Em.isNone(recommendedValue)) {
+ /** update config **/
+ updateCallback(config, recommendedValue, parentProperties, configGroup);
+
+ delete recommendationObject[site].properties[name];
+ }
+ }
+ if (property_attributes) {
+ var propertyAttributes = property_attributes[name];
+ var stackProperty = App.configsCollection.getConfigByName(name, fileName);
+ for (var attr in propertyAttributes) {
+ if (attr == 'delete' && this.allowUpdateProperty(parentProperties, name, fileName)) {
+ propertiesToDelete.push(config);
+ } else if (stackProperty) {
+ /** update config boundaries **/
+ updateBoundariesCallback(stackProperty, attr, propertyAttributes[attr], configGroup);
+ }
+ }
+ }
+ }
+ }, this);
+
+ if (propertiesToDelete.length) {
+ propertiesToDelete.forEach(function (property) {
+ /** remove config **/
+ removeCallback(property, configs, parentProperties, configGroup);
+
+ }, this);
+ }
+ },
+
+ /**
+ * Method that goes through all configs
+ * and apply recommendations to configs when it's needed
+ *
+ * @param {Object} recommendationObject
+ * @param {Object[]} configs
+ * @param {Object[]} parentProperties
+ */
+ updateConfigsByRecommendations: function (recommendationObject, configs, parentProperties) {
+ this.parseRecommendations(recommendationObject, configs, parentProperties, null,
+ this._updateConfigByRecommendation.bind(this), this._removeConfigByRecommendation.bind(this), this._updateBoundaries.bind(this));
+ },
+
+ /**
+ * This method goes through all config recommendations
+ * and trying to add new properties
+ *
+ * @param {Object} recommendationObject
+ * @param {Object[]} parentProperties
+ */
+ addByRecommendations: function (recommendationObject, parentProperties) {
+ for (var site in recommendationObject) {
+ if (Object.keys(recommendationObject[site].properties).length) {
+ var stepConfig = App.config.getStepConfigForProperty(this.get('stepConfigs'), site), configs = [];
+ if (stepConfig) {
+ for (var propertyName in recommendationObject[site].properties) {
+ if (this.allowUpdateProperty(parentProperties, propertyName, site)) {
+ this._addConfigByRecommendation(configs, propertyName, site, recommendationObject[site].properties[propertyName], parentProperties);
+ }
+ }
+ var mergedConfigs = configs.concat(stepConfig.get('configs'));
+ stepConfig.set('configs', mergedConfigs);
+ }
+ }
+ }
+ },
+
+ /**
+ * Update config based on recommendations
+ *
+ * @param config
+ * @param recommendedValue
+ * @param parentProperties
+ * @protected
+ */
+ _updateConfigByRecommendation: function (config, recommendedValue, parentProperties) {
+ Em.assert('config should be defined', config);
+ Em.set(config, 'recommendedValue', recommendedValue);
+ if (this.allowUpdateProperty(parentProperties, Em.get(config, 'name'), Em.get(config, 'filename'))) {
+ Em.set(config, 'value', recommendedValue);
+ this.applyRecommendation(Em.get(config, 'name'), Em.get(config, 'filename'), Em.get(config, 'group.name'), recommendedValue, this._getInitialValue(config), parentProperties);
+ }
+ if (this.updateInitialOnRecommendations(Em.get(config, 'serviceName'))) {
+ Em.set(config, 'initialValue', recommendedValue);
+ }
+ },
+
+ /**
+ * Add config based on recommendations
+ *
+ * @param configs
+ * @param name
+ * @param fileName
+ * @param recommendedValue
+ * @param parentProperties
+ * @protected
+ */
+ _addConfigByRecommendation: function (configs, name, fileName, recommendedValue, parentProperties) {
+ fileName = App.config.getOriginalFileName(fileName);
+ var stackConfig = App.configsCollection.getConfigByName(name, fileName),
+ service = App.config.get('serviceByConfigTypeMap')[App.config.getConfigTagFromFileName(fileName)];
+ if (service) {
+ var serviceName = stackConfig ? stackConfig.serviceName : service && service.get('serviceName'),
+ popupProperty = this.getRecommendation(name, fileName),
+ initialValue = popupProperty ? popupProperty.value : null;
+
+ var coreObject = {
+ "value": recommendedValue,
+ "recommendedValue": recommendedValue,
+ "initialValue": this.updateInitialOnRecommendations(serviceName) ? recommendedValue : initialValue,
+ "savedValue": !this.useInitialValue(serviceName) && !Em.isNone(initialValue) ? initialValue : null
+ };
+ var addedProperty = stackConfig || App.config.createDefaultConfig(name, serviceName, fileName, false);
+ Em.setProperties(addedProperty, coreObject);
+ var addedPropertyObject = App.ServiceConfigProperty.create(addedProperty);
+ configs.pushObject(addedPropertyObject);
+ addedPropertyObject.validate();
+
+ this.applyRecommendation(name, fileName, "Default",
+ recommendedValue, null, parentProperties);
+ }
+ },
+
+ /**
+ * Remove config based on recommendations
+ *
+ * @param config
+ * @param configsCollection
+ * @param parentProperties
+ * @protected
+ */
+ _removeConfigByRecommendation: function (config, configsCollection, parentProperties) {
+ Em.assert('config and configsCollection should be defined', config && configsCollection);
+ configsCollection.removeObject(config);
+
+ this.applyRecommendation(Em.get(config, 'name'), Em.get(config, 'filename'), Em.get(config, 'group.name'),
+ null, this._getInitialValue(config), parentProperties);
+ },
+
+ /**
+ * Update config valueAttributes by recommendations
+ *
+ * @param {Object} stackProperty
+ * @param {string} attr
+ * @param {Number|String|Boolean} value
+ * @protected
+ */
+ _updateBoundaries: function(stackProperty, attr, value) {
+ Em.set(stackProperty.valueAttributes, attr, value);
+ },
+
+ /**
+ * Get default config value
+ * <code>savedValue<code> for installed services
+ * <code>initialValue<code> for new services
+ *
+ * @param configProperty
+ * @returns {*}
+ * @protected
+ */
+ _getInitialValue: function (configProperty) {
+ if (!configProperty) return null;
+ return this.useInitialValue(Em.get(configProperty, 'serviceName')) ?
+ Em.get(configProperty, 'initialValue') : Em.get(configProperty, 'savedValue');
+ },
+
+ /**
+ * Update initial only when <code>initialValue<code> is used
+ *
+ * @param {string} serviceName
+ * @returns {boolean}
+ */
+ updateInitialOnRecommendations: function(serviceName) {
+ return this.useInitialValue(serviceName);
+ },
+
+ /**
+ * Defines if initialValue of config can be used on current controller
+ * if not savedValue is used instead
+ *
+ * @param {String} serviceName
+ * @return {boolean}
+ */
+ useInitialValue: function (serviceName) {
+ return false;
+ },
+
+ /**
+ * Defines if recommendation allowed to be applied
+ *
+ * @param parentProperties
+ * @param name
+ * @param fileName
+ * @returns {boolean}
+ */
+ allowUpdateProperty: function (parentProperties, name, fileName) {
+ return true;
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/app/mixins/common/configs/config_recommendations.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/config_recommendations.js b/ambari-web/app/mixins/common/configs/config_recommendations.js
new file mode 100644
index 0000000..583e86d
--- /dev/null
+++ b/ambari-web/app/mixins/common/configs/config_recommendations.js
@@ -0,0 +1,201 @@
+/**
+ * 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');
+
+/**
+ * @typedef {object} recommendation
+ * @property {boolean} saveRecommended - by default is true (checkbox binding)
+ * @property {boolean} saveRecommendedDefault - used for cancel operation to restore previous state (saved checkbox value)
+ * @property {boolean} isDeleted - true if property was deleted
+ * @property {boolean} notDefined - true if property was added
+ * @property {string} propertyName
+ * @property {string} propertyFileName - file name without '.xml'
+ * @property {string} configGroup - name of config group, by default "Default"
+ * @property {string} serviceName
+ * @property {string} serviceDisplayName
+ * @property {string} initialValue
+ * @property {string} recommendedValue
+ * @property {boolean} allowChangeGroup - flag that allows to change config group for config from dependent not default group
+ * @property {string[]} parentConfigs - list of properties based on which current recommendation was performed
+ */
+
+App.ConfigRecommendations = Em.Mixin.create({
+
+ /**
+ * List of recommendations that was applied to configs
+ *
+ * @type {recommendation[]}
+ */
+ recommendations: [],
+
+ /**
+ * Update recommendation property if exists
+ * otherwise add new
+ *
+ * @param {string} name
+ * @param {string} fileName
+ * @param {string} configGroupName
+ * @param {string} recommendedValue
+ * @param {string} initialValue
+ * @param {Object[]}parentProperties
+ * @returns {recommendation}
+ */
+ applyRecommendation: function(name, fileName, configGroupName, recommendedValue, initialValue, parentProperties) {
+ var parentPropertiesNames = parentProperties ? parentProperties.map(function(p) {
+ return App.config.configId(p.name, p.type);
+ }) : [];
+ var updated = this.updateRecommendation(name, fileName, configGroupName, recommendedValue, parentPropertiesNames);
+ if (!updated)
+ var added = this.addRecommendation(name, fileName, configGroupName, recommendedValue, initialValue, parentPropertiesNames);
+ return updated || added;
+ },
+
+ /**
+ * Add new recommendation
+ *
+ * @param {string} name
+ * @param {string} fileName
+ * @param {string} configGroupName
+ * @param {string} recommendedValue
+ * @param {string} initialValue
+ * @param {string[]} parentPropertiesNames
+ * @returns {recommendation}
+ */
+ addRecommendation: function(name, fileName, configGroupName, recommendedValue, initialValue, parentPropertiesNames) {
+ Em.assert('name and fileName should be defined', name && fileName);
+ var site = App.config.getConfigTagFromFileName(fileName);
+ var service = App.config.get('serviceByConfigTypeMap')[site];
+ var recommendation = {
+ saveRecommended: true,
+ saveRecommendedDefault: true,
+ propertyFileName: site,
+ propertyName: name,
+
+ isDeleted: Em.isNone(recommendedValue),
+ notDefined: Em.isNone(initialValue),
+
+ configGroup: configGroupName || "Default",
+ initialValue: initialValue,
+ parentConfigs: parentPropertiesNames || [],
+ serviceName: service.get('serviceName'),
+ allowChangeGroup: false,//TODO groupName!= "Default" && (service.get('serviceName') != this.get('selectedService.serviceName'))
+ //TODO&& (App.ServiceConfigGroup.find().filterProperty('serviceName', service.get('serviceName')).length > 1), //TODO
+ serviceDisplayName: service.get('displayName'),
+ recommendedValue: recommendedValue
+ };
+ this.get('recommendations').pushObject(recommendation);
+ return recommendation;
+ },
+
+ /**
+ * Remove recommendation
+ * based on unique identifiers
+ *
+ * @param {string} name
+ * @param {string} fileName
+ * @param {string} configGroupName
+ */
+ removeRecommendation: function(name, fileName, configGroupName) {
+ this.removeRecommendationObject(this.getRecommendation(name, fileName, configGroupName));
+ },
+
+ /**
+ * Remove recommended Object
+ *
+ * @param {recommendation} recommendation
+ */
+ removeRecommendationObject: function(recommendation) {
+ if (recommendation)
+ this.get('recommendations').removeObject(recommendation);
+ },
+
+ /**
+ * Update recommended object
+ *
+ * @param name
+ * @param fileName
+ * @param configGroupName
+ * @param recommendedValue
+ * @param parentPropertiesNames
+ * @returns {*|recommendation|null}
+ */
+ updateRecommendation: function(name, fileName, configGroupName, recommendedValue, parentPropertiesNames) {
+ var recommendation = this.getRecommendation(name, fileName, configGroupName);
+ if (recommendation) {
+ Em.set(recommendation, 'recommendedValue', recommendedValue);
+ if (parentPropertiesNames && parentPropertiesNames.length) {
+ var mergedProperties = parentPropertiesNames.concat(Em.get(recommendation, 'parentPropertiesNames'));
+ Em.set(recommendation, 'parentPropertiesNames', mergedProperties);
+ }
+ }
+ return recommendation;
+ },
+
+ /**
+ * Get single recommendation
+ *
+ * @param name
+ * @param fileName
+ * @param configGroupName
+ * @returns {recommendation|null}
+ */
+ getRecommendation: function(name, fileName, configGroupName) {
+ Em.assert('name and fileName should be defined', name && fileName);
+ return this.get('recommendations').find(function (dcv) {
+ return dcv.propertyName === name
+ && dcv.propertyFileName === App.config.getConfigTagFromFileName(fileName)
+ && dcv.configGroup === (configGroupName || "Default");
+ });
+ },
+
+ /**
+ * Clear recommendations that are
+ * same as initial value
+ *
+ * @method cleanUpRecommendations
+ */
+ cleanUpRecommendations: function() {
+ var cleanDependentList = this.get('recommendations').filter(function(d) {
+ return !((Em.isNone(d.initialValue) && Em.isNone(d.recommendedValue)) || d.initialValue == d.recommendedValue);
+ }, this);
+ this.set('recommendations', cleanDependentList);
+ },
+
+ /**
+ * Remove all recommendations
+ *
+ * @method clearAllRecommendations
+ */
+ clearAllRecommendations: function() {
+ this.set('recommendations', []);
+ },
+
+ /**
+ * Clear values for dependent configs for given services
+ *
+ * @method clearRecommendationsByServiceName
+ */
+ clearRecommendationsByServiceName: function(serviceNames) {
+ var filteredRecommendations = this.get('recommendations').reject(function(c) {
+ return serviceNames.contains(c.serviceName);
+ }, this);
+ this.set('recommendations', filteredRecommendations);
+ }
+
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js b/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js
new file mode 100644
index 0000000..5339637
--- /dev/null
+++ b/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js
@@ -0,0 +1,113 @@
+/**
+ * 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.ConfigWithOverrideRecommendationParser = Em.Mixin.create(App.ConfigRecommendationParser, {
+
+ /**
+ * Method that goes through all configs
+ * and apply recommendations to overrides when it's needed
+ *
+ * @param {Object} recommendationObject
+ * @param {Object[]} configs
+ * @param {Object[]} parentProperties
+ * @param {App.ServiceConfigGroup} configGroup
+ */
+ updateOverridesByRecommendations: function (recommendationObject, configs, parentProperties, configGroup) {
+ Em.assert('Config groups should be defined and not default', configGroup && configGroup.get('name') && !configGroup.get('isDefault'));
+ this.parseRecommendations(recommendationObject, configs, parentProperties, configGroup,
+ this._updateOverride.bind(this), this._removeOverride.bind(this), this._updateOverrideBoundaries.bind(this));
+ },
+
+ /**
+ * Update override by recommendations
+ * includes add/update actions
+ *
+ * @param config
+ * @param recommendedValue
+ * @param parentProperties
+ * @param configGroup
+ * @protected
+ */
+ _updateOverride: function(config, recommendedValue, parentProperties, configGroup) {
+ debugger;
+ var updateValue = this.allowUpdateProperty(parentProperties, Em.get(config, 'name'), Em.get(config, 'filename'));
+ var override = config.getOverride(configGroup.get('name'));
+ if (override) {
+ this._updateConfigByRecommendation(override, recommendedValue, parentProperties);
+ } else if (updateValue) {
+ this._addConfigOverrideRecommendation(config, recommendedValue, parentProperties, configGroup);
+ }
+ },
+
+ /**
+ * Remove override by recommendations
+ *
+ * @param property
+ * @param configs
+ * @param parentProperties
+ * @param configGroup
+ * @protected
+ */
+ _removeOverride: function(property, configs, parentProperties, configGroup) {
+ this._removeConfigByRecommendation(property.getOverride(configGroup.get('name')), property.get('overrides') || [], parentProperties);
+ },
+
+ /**
+ * Add override by recommendations
+ *
+ * @param config
+ * @param recommendedValue
+ * @param configGroup
+ * @param parentProperties
+ * @protected
+ */
+ _addConfigOverrideRecommendation: function (config, recommendedValue, parentProperties, configGroup) {
+ var popupProperty = this.getRecommendation(Em.get(config, 'name'), Em.get(config, 'filename'), configGroup.get('name')),
+ initialValue = popupProperty ? popupProperty.value : null;
+ var coreObject = {
+ "value": recommendedValue,
+ "recommendedValue": recommendedValue,
+ "initialValue": initialValue,
+ "savedValue": !this.useInitialValue(Em.get(config, 'serviceName')) && !Em.isNone(initialValue) ? initialValue : null,
+ "isEditable": true
+ };
+ var override = App.config.createOverride(config, coreObject, configGroup);
+ configGroup.get('properties').pushObject(override);
+
+ this.applyRecommendation(Em.get(config, 'name'), Em.get(config, 'filename'), configGroup.get('name'),
+ recommendedValue, this._getInitialValue(override), parentProperties);
+ },
+
+ /**
+ * Update override valueAttributes by recommendations
+ *
+ * @param {Object} stackProperty
+ * @param {string} attr
+ * @param {Number|String|Boolean} value
+ * @param {App.ServiceConfigGroup} configGroup
+ * @protected
+ */
+ _updateOverrideBoundaries: function(stackProperty, attr, value, configGroup) {
+ if (!stackProperty.valueAttributes[configGroup.get('name')]) {
+ stackProperty.valueAttributes[configGroup.get('name')] = {};
+ }
+ Em.set(stackProperty.valueAttributes[configGroup.get('name')], attr, value);
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/app/mixins/common/configs/configs_saver.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/configs_saver.js b/ambari-web/app/mixins/common/configs/configs_saver.js
index 09cfd6f..383e4d0 100644
--- a/ambari-web/app/mixins/common/configs/configs_saver.js
+++ b/ambari-web/app/mixins/common/configs/configs_saver.js
@@ -620,7 +620,7 @@ App.ConfigsSaverMixin = Em.Mixin.create({
App.QuickViewLinks.proto().loadTags();
}
this.showSaveConfigsPopup(header, flag, message, messageClass, value, status, urlParams);
- this.clearDependentConfigs();
+ this.clearAllRecommendations();
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/app/mixins/common/configs/enhanced_configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/enhanced_configs.js b/ambari-web/app/mixins/common/configs/enhanced_configs.js
index 7efcf55..0d3f20a 100644
--- a/ambari-web/app/mixins/common/configs/enhanced_configs.js
+++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js
@@ -18,9 +18,8 @@
var App = require('app');
var blueprintUtils = require('utils/blueprint');
-var validator = require('utils/validator');
-App.EnhancedConfigsMixin = Em.Mixin.create({
+App.EnhancedConfigsMixin = Em.Mixin.create(App.ConfigWithOverrideRecommendationParser, {
/**
* this value is used for observing
@@ -49,17 +48,6 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
*/
isControllerSupportsEnhancedConfigs: Em.computed.existsIn('name', ['wizardStep7Controller','mainServiceInfoConfigsController']),
- /**
- * defines if initialValue of config can be used on current controller
- * if not savedValue is used instead
- * @param {String} serviceName
- * @return {boolean}
- * @method useInitialValue
- */
- useInitialValue: function(serviceName) {
- return ['wizardStep7Controller'].contains(this.get('name')) && !App.Service.find().findProperty('serviceName', serviceName);
- },
-
dependenciesGroupMessage: Em.I18n.t('popup.dependent.configs.dependencies.for.groups'),
/**
* message fro alert box for dependent configs
@@ -75,39 +63,15 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
}.property('changedProperties.length'),
/**
- * values for dependent configs
- * @type {Object[]}
- * ex:
- * {
- * saveRecommended: {boolean}, //by default is true (checkbox binding)
- * saveRecommendedDefault: {boolean}, used for cancel operation to restore previous state
- * toDelete: {boolean} [true], // defines if property should be deleted
- * toAdd: {boolean} [false], // defines if property should be added
- * isDeleted: {boolean} [true], // defines if property was deleted, but was present in initial configs
- * fileName: {string}, //file name without '.xml'
- * propertyName: {string},
- * parentConfigs: {string[]} // name of the parent configs
- * configGroup: {string},
- * value: {string},
- * serviceName: {string},
- * allowChangeGroup: {boolean}, //used to disable group link for current service
- * serviceDisplayName: {string},
- * recommendedValue: {string}
- * }
- * @private
- */
- _dependentConfigValues: Em.A([]),
-
- /**
* dependent properties that was changed by Ambari
* @type {Object[]}
*/
changedProperties: function() {
- return this.get('_dependentConfigValues').filter(function(dp) {
+ return this.get('recommendations').filter(function(dp) {
return (this.get('selectedConfigGroup.isDefault') && Em.get(dp, 'configGroup').contains('Default'))
|| [this.get('selectedConfigGroup.name'), this.get('selectedConfigGroup.dependentConfigGroups') && this.get('selectedConfigGroup.dependentConfigGroups')[Em.get(dp, 'serviceName')]].contains(Em.get(dp, 'configGroup'));
}, this);
- }.property('_dependentConfigValues.@each.saveRecommended', 'selectedConfigGroup'),
+ }.property('recommendations.@each.saveRecommended', 'recommendations.@each.recommendedValue', 'selectedConfigGroup'),
/**
* defines if change dependent group message should be shown
@@ -143,67 +107,6 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
/******************************METHODS THAT WORKS WITH DEPENDENT CONFIGS *************************************/
/**
- * clear values for dependent configs
- * @method clearDependentConfigs
- * @private
- */
- clearDependentConfigs: function() {
- this.setProperties({
- _dependentConfigValues: []
- });
- },
-
- /**
- * clear values for dependent configs for given services
- * @method clearDependentConfigs
- * @private
- */
- clearDependentConfigsByService: function(serviceNames) {
- var cleanDependencies = this.get('_dependentConfigValues').reject(function(c) {
- return serviceNames.contains(c.serviceName);
- }, this);
- this.get('stepConfigs').filter(function(s) {
- return serviceNames.contains(s.get('serviceName'));
- }).forEach(function(s) {
- s.get('configs').setEach('isNotSaved', false);
- });
- this.set('_dependentConfigValues', cleanDependencies);
- },
-
- /**
- * Remove configs from <code>_dependentConfigValues</code> which depends between installed services only.
- *
- * @param {String[]} installedServices
- * @param {App.ServiceConfig[]} stepConfigs
- */
- clearDependenciesForInstalledServices: function(installedServices, stepConfigs) {
- var allConfigs = stepConfigs.mapProperty('configs').filterProperty('length').reduce(function(p, c) {
- return p && p.concat(c);
- });
- var cleanDependencies = this.get('_dependentConfigValues').reject(function(item) {
- if (Em.get(item, 'propertyName').contains('hadoop.proxyuser')) return false;
- if (installedServices.contains(Em.get(item, 'serviceName'))) {
- var stackProperty = App.configsCollection.getConfigByName(item.propertyName, item.fileName);
- var parentConfigs = stackProperty && stackProperty.propertyDependsOn;
- if (!parentConfigs || !parentConfigs.length) {
- return true;
- }
- // check that all parent properties from installed service
- return !parentConfigs.reject(function(parentConfig) {
- var property = allConfigs.filterProperty('filename', App.config.getOriginalFileName(parentConfig.type))
- .findProperty('name', parentConfig.name);
- if (!property) {
- return false;
- }
- return installedServices.contains(Em.get(property, 'serviceName'));
- }).length;
- }
- return false;
- });
- this.set('_dependentConfigValues', cleanDependencies);
- },
-
- /**
* get config group object for current service
* @param serviceName
* @returns {App.ConfigGroup|null}
@@ -236,9 +139,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
* @method removeCurrentFromDependentList
*/
removeCurrentFromDependentList: function (config, saveRecommended) {
- var current = this.get('_dependentConfigValues').find(function(dependentConfig) {
- return Em.get(dependentConfig, 'propertyName') == config.get('name') && Em.get(dependentConfig, 'fileName') == App.config.getConfigTagFromFileName(config.get('filename'));
- });
+ var current = this.getRecommendation(config.get('name'), config.get('filename'), config.get('group.name'));
if (current) {
Em.setProperties(current, {
'saveRecommended': !!saveRecommended,
@@ -265,7 +166,8 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
hosts: this.get('hostNames'),
services: this.get('serviceNames')
};
- var clearConfigsOnAddService = this.isConfigHasInitialState();
+
+ var clearConfigsOnAddService = configGroup.get('isDefault') && this.isConfigHasInitialState();
if (clearConfigsOnAddService) {
recommendations.blueprint.configurations = this.get('initialConfigValues');
} else {
@@ -287,7 +189,6 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
stackVersionUrl: App.get('stackVersionURL'),
dataToSend: dataToSend,
notDefaultGroup: configGroup && !configGroup.get('isDefault'),
- initial: initial,
clearConfigsOnAddService: clearConfigsOnAddService
},
success: 'dependenciesSuccess',
@@ -313,7 +214,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
return !this.get('stepConfigs').filter(function(stepConfig) {
return stepConfig.get('changedConfigProperties').filter(function(c) {
return !this.get('changedProperties').map(function(changed) {
- return App.config.configId(changed.propertyName, changed.fileName);
+ return App.config.configId(changed.propertyName, changed.propertyFileName);
}).contains(App.config.configId(c.get('name'), c.get('filename')));
}, this).length;
}, this).length;
@@ -326,18 +227,16 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
clearConfigValues: function() {
this.get('stepConfigs').forEach(function(stepConfig) {
stepConfig.get('changedConfigProperties').forEach(function(c) {
- var recommendedProperty = this.get('_dependentConfigValues').find(function(d) {
- return App.config.configId(d.propertyName, d.fileName) == App.config.configId(c.get('name'), c.get('filename'));
- });
+ var recommendedProperty = this.getRecommendation(c.get('name'), c.get('filename'), c.get('group.name'));
if (recommendedProperty) {
- var initialValue = recommendedProperty.value;
+ var initialValue = recommendedProperty.initialValue;
if (Em.isNone(initialValue)) {
stepConfig.get('configs').removeObject(c);
} else {
+ c.set('initialValue', initialValue);
c.set('value', initialValue);
- c.set('recommendedValue', initialValue);
}
- this.get('_dependentConfigValues').removeObject(recommendedProperty);
+ this.removeRecommendationObject(recommendedProperty);
}
}, this)
}, this);
@@ -379,13 +278,11 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
* @method dependenciesSuccess
*/
dependenciesSuccess: function (data, opt, params) {
- this._saveRecommendedValues(data, params.initial, params.dataToSend.changed_configurations, params.notDefaultGroup);
+ this._saveRecommendedValues(data, params.dataToSend.changed_configurations, params.notDefaultGroup);
this.set("recommendationsConfigs", Em.get(data.resources[0] , "recommendations.blueprint.configurations"));
if (params.clearConfigsOnAddService) {
- if (this.get('wizardController.name') == 'addServiceController') {
- this.clearDependenciesForInstalledServices(this.get('installedServiceNames'), this.get('stepConfigs'));
- }
this.clearConfigValues();
+ this.clearAllRecommendations();
}
this.set('recommendationTimeStamp', (new Date).getTime());
},
@@ -395,7 +292,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
* @method showChangedDependentConfigs
*/
showChangedDependentConfigs: function(event, callback, secondary) {
- if (this.get('_dependentConfigValues.length') > 0) {
+ if (this.get('recommendations.length') > 0) {
App.showDependentConfigsPopup(this.get('changedProperties'), this.onSaveRecommendedPopup.bind(this), secondary);
} else {
if (callback) {
@@ -413,23 +310,32 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
*/
undoRedoRecommended: function(propertiesToUpdate, redo) {
propertiesToUpdate.forEach(function(p) {
- var initial = redo ? Em.get(p, 'value') : Em.get(p, 'recommendedValue');
- var recommended = redo ? Em.get(p, 'recommendedValue') : Em.get(p, 'value');
+ var initial = redo ? Em.get(p, 'initialValue') : Em.get(p, 'recommendedValue');
+ var recommended = redo ? Em.get(p, 'recommendedValue') : Em.get(p, 'initialValue');
var stepConfig = this.get('stepConfigs').findProperty('serviceName', Em.get(p, 'serviceName'));
var config = stepConfig.get('configs').find(function(scp) {
- return scp.get('name') == Em.get(p, 'propertyName') && scp.get('filename') == Em.get(p, 'fileName');
+ return scp.get('name') == Em.get(p, 'propertyName') && scp.get('filename') == App.config.getOriginalFileName(Em.get(p, 'propertyFileName'));
});
var selectedGroup = App.ServiceConfigGroup.find().filterProperty('serviceName', Em.get(p, 'serviceName')).findProperty('name', Em.get(p, 'configGroup'));
- if (Em.isNone(recommended)) {
- if (selectedGroup.get('isDefault')) {
+ if (selectedGroup.get('isDefault')) {
+ if (Em.isNone(recommended)) {
stepConfig.get('configs').removeObject(config);
+ } else if (Em.isNone(initial)) {
+ this._addConfigByRecommendation(stepConfig.get('configs'), Em.get(p, 'propertyName'), Em.get(p, 'propertyFileName'), recommended);
} else {
- config.get('overrides').removeObject(this._getOverride(config, selectedGroup));
+ Em.set(config, 'value', recommended);
}
- } else if (Em.isNone(initial)) {
- this._addConfigByRecommendation(stepConfig, selectedGroup, Em.get(p, 'propertyName'), Em.get(p, 'fileName'), Em.get(p, 'serviceName'), recommended, initial, config);
} else {
- Em.set(config, 'value', recommended);
+ if (Em.isNone(recommended)) {
+ config.get('overrides').removeObject(config.getOverride(selectedGroup.get('name')));
+ } else if (Em.isNone(initial)) {
+ this._addConfigOverrideRecommendation(config, recommended, null, selectedGroup);
+ } else {
+ var override = config.getOverride(selectedGroup.get('name'));
+ if (override) {
+ override.set('value', recommended);
+ }
+ }
}
}, this);
},
@@ -451,7 +357,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
}, this);
App.showSelectGroupsPopup(this.get('selectedService.serviceName'),
this.get('selectedService.configGroups').findProperty('name', this.get('selectedConfigGroup.name')),
- dependentServices, this.get('_dependentConfigValues'))
+ dependentServices, this.get('recommendations'))
},
/**
@@ -467,72 +373,33 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
},
/**
- * saves values from response for dependent config properties to <code>_dependentConfigValues<code>
+ * saves values from response for dependent config properties to <code>recommendations<code>
* @param data
- * @param [updateOnlyBoundaries=false]
* @param [changedConfigs=null]
* @param notDefaultGroup
- * @param updateInitial
* @method saveRecommendedValues
* @private
*/
- _saveRecommendedValues: function(data, updateOnlyBoundaries, changedConfigs, notDefaultGroup, updateInitial) {
+ _saveRecommendedValues: function(data, changedConfigs, notDefaultGroup) {
Em.assert('invalid data - `data.resources[0].recommendations.blueprint.configurations` not defined ', data && data.resources[0] && Em.get(data.resources[0], 'recommendations.blueprint.configurations'));
var configObject = data.resources[0].recommendations.blueprint.configurations;
if (!notDefaultGroup) {
- this.parseConfigsByTag(configObject, changedConfigs, updateInitial, updateOnlyBoundaries);
- } else if (data.resources[0].recommendations['config-groups']){
+ this.get('stepConfigs').forEach(function(stepConfig) {
+ this.updateConfigsByRecommendations(configObject, stepConfig.get('configs'), changedConfigs);
+ }, this);
+ this.addByRecommendations(configObject, changedConfigs);
+ } else if (data.resources[0].recommendations['config-groups']) {
var configFroGroup = data.resources[0].recommendations['config-groups'][0];
- this.parseConfigsByTag(configFroGroup.configurations, changedConfigs, updateInitial, updateOnlyBoundaries);
- this.parseConfigsByTag(configFroGroup.dependent_configurations, changedConfigs, updateInitial, updateOnlyBoundaries);
- }
- this._cleanUpPopupProperties();
- },
-
- /**
- * saves values from response for dependent configs to <code>_dependentConfigValues<code>
- * @param configObject - JSON response from `recommendations` endpoint
- * @param {App.ServiceConfigProperty[]} parentConfigs - config properties for which recommendations were received
- * @param updateInitial
- * @param updateOnlyBoundaries
- * @method saveRecommendedValues
- * @private
- */
- parseConfigsByTag: function(configObject, parentConfigs, updateInitial, updateOnlyBoundaries) {
- var parentPropertiesNames = parentConfigs ? parentConfigs.map(function(p) { return App.config.configId(Em.get(p, 'name'), Em.get(p, 'type'))}) : [];
- /** get all configs by config group **/
- for (var key in configObject) {
-
- /** defines main info for file name (service name, config group, config that belongs to filename) **/
- var service = App.config.get('serviceByConfigTypeMap')[key];
- var serviceName = service.get('serviceName');
- var stepConfig = this.get('stepConfigs').findProperty('serviceName', serviceName);
- if (stepConfig) {
- var configProperties = stepConfig ? stepConfig.get('configs').filterProperty('filename', App.config.getOriginalFileName(key)) : [];
-
- var group = this.getGroupForService(serviceName);
-
- for (var propertyName in configObject[key].properties) {
-
- var cp = configProperties.findProperty('name', propertyName);
-
- var configPropertyObject = (!group || group.get('isDefault')) ? cp : this._getOverride(cp, group);
-
- var recommendedValue = this.getFormattedValue(configObject[key].properties[propertyName]);
- var popupProperty = this.getPopupProperty(propertyName, key, Em.get(group || {}, 'name'));
- var initialValue = this._getInitialValue(configObject, popupProperty, serviceName, recommendedValue, updateInitial);
- if (configPropertyObject) {
- this._updateConfigByRecommendation(configPropertyObject, recommendedValue, updateInitial, updateOnlyBoundaries);
- } else if (!updateOnlyBoundaries) {
- this._addConfigByRecommendation(stepConfig, group, propertyName, key, serviceName, recommendedValue, initialValue, cp);
- }
- if (!updateOnlyBoundaries) {
- this._updatePopup(popupProperty, propertyName, key, recommendedValue, Em.get(configPropertyObject || {}, 'initialValue'), service, Em.get(group || {},'name') || "Default", parentPropertiesNames);
- }
+ this.get('stepConfigs').forEach(function(stepConfig) {
+ var configGroup = this.getGroupForService(stepConfig.get('serviceName'));
+ if (configGroup) {
+ this.updateOverridesByRecommendations(configFroGroup.configurations, stepConfig.get('configs'), changedConfigs, configGroup);
+ this.updateOverridesByRecommendations(configFroGroup.dependent_configurations, stepConfig.get('configs'), changedConfigs, configGroup);
+ this.toggleProperty('forceUpdateBoundaries');
}
- }
+ }, this);
}
- this.parseConfigAttributes(configObject, parentPropertiesNames, updateOnlyBoundaries);
+ this.cleanUpRecommendations();
},
installedServices: function () {
@@ -542,241 +409,6 @@ App.EnhancedConfigsMixin = Em.Mixin.create({
}.property(),
/**
- * Save property attributes received from recommendations. These attributes are minimum, maximum,
- * increment_step. Attributes are stored in <code>App.StackConfigProperty</code> model.
- *
- * @param {Object[]} configs
- * @param parentPropertiesNames
- * @param updateOnlyBoundaries
- * @private
- */
- parseConfigAttributes: function(configs, parentPropertiesNames, updateOnlyBoundaries) {
- var self = this;
- Em.keys(configs).forEach(function (siteName) {
- var fileName = App.config.getOriginalFileName(siteName),
- service = App.config.get('serviceByConfigTypeMap')[siteName];
- var serviceName = service && service.get('serviceName'),
- stepConfig = self.get('stepConfigs').findProperty('serviceName', serviceName);
- if (stepConfig) {
- var group = self.getGroupForService(serviceName),
- configProperties = stepConfig ? stepConfig.get('configs').filterProperty('filename', App.config.getOriginalFileName(siteName)) : [],
- properties = configs[siteName].property_attributes || {};
- Em.keys(properties).forEach(function (propertyName) {
- var cp = configProperties.findProperty('name', propertyName);
- var stackProperty = App.configsCollection.getConfigByName(propertyName, siteName);
- var configObject = (!group || group.get('isDefault')) ? cp : self._getOverride(cp, group);
- var configsCollection = !group || group.get('isDefault') ? stepConfig.get('configs') : Em.getWithDefault(cp, 'overrides', []);
- var dependentProperty = self.getPopupProperty(propertyName, fileName, Em.get(group || {},'name'));
- var attributes = properties[propertyName] || {};
- Em.keys(attributes).forEach(function (attributeName) {
- if (attributeName == 'delete' && configObject) {
- if (!updateOnlyBoundaries) {
- self._removeConfigByRecommendation(configObject, configsCollection);
- self._updatePopup(dependentProperty, propertyName, siteName, null, Em.get(configObject, 'initialValue'), service, Em.get(group || {},'name') || "Default", parentPropertiesNames);
- }
- } else if (stackProperty) {
- var selectedConfigGroup = group && !group.get('isDefault') ? group.get('name') : null;
- if (selectedConfigGroup) {
- if (!stackProperty.valueAttributes[selectedConfigGroup]) {
- /** create not default group object for updating such values as min/max **/
- Em.set(stackProperty.valueAttributes, selectedConfigGroup, {});
- }
- if (stackProperty.valueAttributes[selectedConfigGroup][attributeName] != attributes[attributeName]) {
- Em.set(stackProperty.valueAttributes[selectedConfigGroup], attributeName, attributes[attributeName]);
- self.toggleProperty('forceUpdateBoundaries');
- }
- } else {
- Em.set(stackProperty.valueAttributes, attributeName, attributes[attributeName]);
- }
- }
- });
- });
- }
- });
- },
-
- /**
- * update config based on recommendations
- * @param config
- * @param recommendedValue
- * @param updateInitial
- * @param updateOnlyBoundaries
- * @private
- */
- _updateConfigByRecommendation: function(config, recommendedValue, updateInitial, updateOnlyBoundaries) {
- Em.assert('config should be defined', config);
- Em.set(config, 'recommendedValue', recommendedValue);
- if (!updateOnlyBoundaries) Em.set(config, 'value', recommendedValue);
- if (updateInitial && Em.isNone(Em.get(config, 'savedValue'))) Em.set(config, 'initialValue', recommendedValue);
- },
-
- /**
- * remove config based on recommendations
- * @param config
- * @param configsCollection
- * @private
- */
- _removeConfigByRecommendation: function(config, configsCollection) {
- Em.assert('config and configsCollection should be defined', config && configsCollection);
- configsCollection.removeObject(config);
- /**
- * need to update wizard info when removing configs for installed services;
- */
- var installedServices = this.get('installedServices'), wizardController = this.get('wizardController'),
- fileNamesToUpdate = wizardController ? wizardController.getDBProperty('fileNamesToUpdate') || [] : [],
- fileName = Em.get(config, 'filename'), serviceName = Em.get(config, 'serviceName');
- var modifiedFileNames = this.get('modifiedFileNames');
- if (modifiedFileNames && !modifiedFileNames.contains(fileName)) {
- modifiedFileNames.push(fileName);
- } else if (wizardController && installedServices[serviceName]) {
- if (!fileNamesToUpdate.contains(fileName)) {
- fileNamesToUpdate.push(fileName);
- }
- }
- if (wizardController) {
- wizardController.setDBProperty('fileNamesToUpdate', fileNamesToUpdate.uniq());
- }
- },
-
- /**
- * add config based on recommendations
- * @param stepConfigs
- * @param selectedGroup
- * @param name
- * @param fileName
- * @param serviceName
- * @param recommendedValue
- * @param initialValue
- * @param cp
- * @private
- */
- _addConfigByRecommendation: function(stepConfigs, selectedGroup, name, fileName, serviceName, recommendedValue, initialValue, cp) {
- fileName = App.config.getOriginalFileName(fileName);
- var coreObject = {
- "value": recommendedValue,
- "recommendedValue": recommendedValue,
- "initialValue": initialValue,
- "savedValue": !this.useInitialValue(serviceName) && !Em.isNone(initialValue) ? initialValue : null,
- "isEditable": true
- };
- if (!selectedGroup || selectedGroup.get('isDefault')) {
- var addedProperty = App.configsCollection.getConfigByName(name, fileName) || App.config.createDefaultConfig(name, serviceName, fileName, false, coreObject);
- var addedPropertyObject = App.ServiceConfigProperty.create(addedProperty);
- stepConfigs.get('configs').pushObject(addedPropertyObject);
- addedPropertyObject.validate();
- } else {
- if (cp) {
- var newOverride = App.config.createOverride(cp, coreObject, selectedGroup);
- selectedGroup.get('properties').pushObject(newOverride);
- } else {
- stepConfigs.get('configs').push(App.config.createCustomGroupConfig(name, fileName, recommendedValue, selectedGroup, true, true));
- }
- }
- },
-
- /**
- * @param configProperty
- * @param popupProperty
- * @param serviceName
- * @param recommendedValue
- * @param updateInitial
- * @returns {*}
- * @private
- */
- _getInitialValue: function(configProperty, popupProperty, serviceName, recommendedValue, updateInitial) {
- if (!this.useInitialValue(serviceName)) {
- return configProperty ? Em.get(configProperty, 'savedValue') : null;
- } else if (updateInitial) {
- return recommendedValue;
- } else {
- return popupProperty ? popupProperty.value : configProperty ? Em.get(configProperty, 'initialValue') : null;
- }
- },
-
- /**
- * format value for float values
- * @param value
- * @returns {*}
- */
- getFormattedValue: function(value) {
- return validator.isValidFloat(value) ? parseFloat(value).toString() : value;
- },
-
- /**
- * just get config override
- * @param cp
- * @param selectedGroup
- * @returns {*|Object}
- * @private
- */
- _getOverride: function(cp, selectedGroup) {
- return Em.get(cp, 'overrides.length') && Em.get(cp, 'overrides').findProperty('group.name', Em.get(selectedGroup, 'name'));
- },
-
- /**
- * get property form popup
- * @param name
- * @param fileName
- * @param groupName
- * @returns {Object}
- */
- getPopupProperty: function(name, fileName, groupName) {
- return this.get('_dependentConfigValues').find(function (dcv) {
- return dcv.propertyName === name && dcv.fileName === App.config.getOriginalFileName(fileName) && dcv.configGroup === (groupName || "Default");
- });
- },
-
- /**
- * add or update proeprty in popup
- * @param popupProperty
- * @param name
- * @param fileName
- * @param recommendedValue
- * @param initialValue
- * @param service
- * @param groupName
- * @param parentPropertiesNames
- * @private
- */
- _updatePopup: function(popupProperty, name, fileName, recommendedValue, initialValue, service, groupName, parentPropertiesNames) {
- if (popupProperty) {
- Em.set(popupProperty, 'recommendedValue', recommendedValue);
- Em.set(popupProperty, 'isDeleted', Em.isNone(recommendedValue));
- } else {
- var popupPropertyObject = {
- saveRecommended: true,
- saveRecommendedDefault: true,
- fileName: App.config.getOriginalFileName(fileName),
- propertyName: name,
-
- isDeleted: Em.isNone(recommendedValue),
- notDefined: Em.isNone(initialValue),
-
- configGroup: groupName,
- value: initialValue,
- parentConfigs: parentPropertiesNames,
- serviceName: service.get('serviceName'),
- allowChangeGroup: groupName!= "Default" && (service.get('serviceName') != this.get('selectedService.serviceName'))
- && (App.ServiceConfigGroup.find().filterProperty('serviceName', service.get('serviceName')).length > 1),
- serviceDisplayName: service.get('displayName'),
- recommendedValue: recommendedValue
- };
- this.get('_dependentConfigValues').pushObject(popupPropertyObject);
- }
- },
-
- /**
- * clean properties that have same current and recommended values
- * @private
- */
- _cleanUpPopupProperties: function() {
- var cleanDependentList = this.get('_dependentConfigValues').filter(function(d) {
- return !((Em.isNone(d.value) && Em.isNone(d.recommendedValue)) || d.value == d.recommendedValue);
- }, this);
- this.set('_dependentConfigValues', cleanDependentList);
- },
-
- /**
* Helper method to get property from the <code>stepConfigs</code>
*
* @param {String} name - config property name
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/app/mixins/common/serverValidator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/serverValidator.js b/ambari-web/app/mixins/common/serverValidator.js
index 7938729..40dd054 100644
--- a/ambari-web/app/mixins/common/serverValidator.js
+++ b/ambari-web/app/mixins/common/serverValidator.js
@@ -174,7 +174,7 @@ App.ServerValidatorMixin = Em.Mixin.create({
* @param data
*/
loadRecommendationsSuccess: function(data) {
- this._saveRecommendedValues(data, false, null, false, true);
+ this._saveRecommendedValues(data, null, false);
this.set("recommendationsConfigs", Em.get(data.resources[0] , "recommendations.blueprint.configurations"));
this.set('recommendationTimeStamp', (new Date).getTime());
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/app/models/configs/objects/service_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/objects/service_config.js b/ambari-web/app/models/configs/objects/service_config.js
index 2bc151b..56b8aa4 100644
--- a/ambari-web/app/models/configs/objects/service_config.js
+++ b/ambari-web/app/models/configs/objects/service_config.js
@@ -59,6 +59,10 @@ App.ServiceConfig = Ember.Object.extend({
}, this);
}.observes('configsWithErrors'),
+ configTypes: function() {
+ return App.StackService.find(this.get('serviceName')).get('configTypeList') || [];
+ }.property('serviceName'),
+
observeForeignKeys: function() {
//TODO refactor or move this logic to other place
var configs = this.get('configs');
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/app/models/configs/objects/service_config_property.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/objects/service_config_property.js b/ambari-web/app/models/configs/objects/service_config_property.js
index 3a4ca3d..4b48a98 100644
--- a/ambari-web/app/models/configs/objects/service_config_property.js
+++ b/ambari-web/app/models/configs/objects/service_config_property.js
@@ -506,6 +506,20 @@ App.ServiceConfigProperty = Em.Object.extend({
}.property('displayType', 'name', 'App.isHadoop22Stack'),
/**
+ * Get override for selected group
+ *
+ * @param {String} groupName
+ * @returns {App.ServiceConfigProperty|null}
+ */
+ getOverride: function(groupName) {
+ Em.assert('Group name should be defined string', (typeof groupName === 'string') && groupName);
+ if (this.get('overrides.length')) {
+ return this.get('overrides').findProperty('group.name', groupName);
+ }
+ return null;
+ },
+
+ /**
* Update description for `password`-config
* Add extra-message about their comparison
*
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/app/routes/add_service_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_service_routes.js b/ambari-web/app/routes/add_service_routes.js
index 35b06ab..30bdcbc 100644
--- a/ambari-web/app/routes/add_service_routes.js
+++ b/ambari-web/app/routes/add_service_routes.js
@@ -199,7 +199,7 @@ module.exports = App.WizardRoute.extend({
recommendationsConfigs: null
});
router.get('wizardStep7Controller').set('recommendationsConfigs', null);
- router.get('wizardStep7Controller').clearDependentConfigs();
+ router.get('wizardStep7Controller').clearAllRecommendations();
router.transitionTo('step4');
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/app/templates/common/modal_popups/dependent_configs_list.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/modal_popups/dependent_configs_list.hbs b/ambari-web/app/templates/common/modal_popups/dependent_configs_list.hbs
index ca62592..cef7be2 100644
--- a/ambari-web/app/templates/common/modal_popups/dependent_configs_list.hbs
+++ b/ambari-web/app/templates/common/modal_popups/dependent_configs_list.hbs
@@ -44,12 +44,12 @@
{{config.configGroup}}
</a></span>
</td>
- <td class="config-dependency-filename">{{config.fileName}}</td>
+ <td class="config-dependency-filename">{{config.propertyFileName}}</td>
<td class="config-dependency-value">
{{#if config.notDefined}}
<i>{{t popup.dependent.configs.table.not.defined}}</i>
{{else}}
- {{config.value}}
+ {{config.initialValue}}
{{/if}}
</td>
<td class="config-dependency-recommended-value">
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index f4c8034..a533994 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -19,6 +19,7 @@
var App = require('app');
require('utils/configs_collection');
var stringUtils = require('utils/string_utils');
+var validator = require('utils/validator');
var configTagFromFileNameMap = {};
@@ -212,7 +213,7 @@ App.config = Em.Object.create({
*/
getServiceByConfigType: function(configType) {
return App.StackService.find().find(function(s) {
- return Object.keys(s.get('configTypes')).contains(configType);
+ return s.get('configTypeList').contains(configType);
});
},
@@ -495,6 +496,29 @@ App.config = Em.Object.create({
},
/**
+ * Format float value
+ *
+ * @param {*} value
+ * @returns {string|*}
+ */
+ formatValue: function(value) {
+ return validator.isValidFloat(value) ? parseFloat(value).toString() : value;
+ },
+
+ /**
+ * Get step config by file name
+ *
+ * @param stepConfigs
+ * @param fileName
+ * @returns {Object|null}
+ */
+ getStepConfigForProperty: function (stepConfigs, fileName) {
+ return stepConfigs.find(function (s) {
+ return s.get('configTypes').contains(App.config.getConfigTagFromFileName(fileName));
+ });
+ },
+
+ /**
*
* @param configs
* @returns {Object[]}
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/app/views/common/controls_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/controls_view.js b/ambari-web/app/views/common/controls_view.js
index a88be76..367a7ee 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -113,9 +113,9 @@ App.SupportsDependentConfigs = Ember.Mixin.create({
*/
restoreDependentConfigs: function(parentConfig) {
var controller = this.get('controller');
- var dependentConfigs = controller.get('_dependentConfigValues');
+ var dependentConfigs = controller.get('recommendations');
try {
- controller.set('_dependentConfigValues', dependentConfigs.reject(function(item) {
+ controller.set('recommendations', dependentConfigs.reject(function(item) {
if (item.parentConfigs.contains(parentConfig.get('name'))) {
if (item.parentConfigs.length > 1) {
item.parentConfigs.removeObject(parentConfig.get('name'));
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/app/views/common/modal_popups/select_groups_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popups/select_groups_popup.js b/ambari-web/app/views/common/modal_popups/select_groups_popup.js
index 264d7b1..33c72a2 100644
--- a/ambari-web/app/views/common/modal_popups/select_groups_popup.js
+++ b/ambari-web/app/views/common/modal_popups/select_groups_popup.js
@@ -64,7 +64,7 @@ App.showSelectGroupsPopup = function (selectedServiceName, selectedConfigGroup,
var currentGroupName = this.get('selectedGroups')[serviceName] || "";
var configGroup = this.get('dependentStepConfigs').findProperty('serviceName', serviceName).get('configGroups').findProperty('name', selectedGroupName);
if (selectedGroupName != currentGroupName) {
- /** changing config group for _dependentConfigValues **/
+ /** changing config group for recommendations **/
configs.filterProperty('serviceName', serviceName).filterProperty('configGroup', selectedGroupName).forEach(function (c) {
if (configs.filterProperty('serviceName', serviceName).filterProperty('configGroup', currentGroupName)) {
configs.removeObject(c);
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/test/controllers/main/service/info/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/info/config_test.js b/ambari-web/test/controllers/main/service/info/config_test.js
index b6abb8e..ba8f1d3 100644
--- a/ambari-web/test/controllers/main/service/info/config_test.js
+++ b/ambari-web/test/controllers/main/service/info/config_test.js
@@ -376,9 +376,9 @@ describe("App.MainServiceInfoConfigsController", function () {
it("should clear dependent configs", function() {
mainServiceInfoConfigsController.set('groupsToSave', { HDFS: 'my cool group'});
- mainServiceInfoConfigsController.set('_dependentConfigValues', Em.A([{name: 'prop_1'}]));
+ mainServiceInfoConfigsController.set('recommendations', Em.A([{name: 'prop_1'}]));
mainServiceInfoConfigsController.doCancel();
- expect(App.isEmptyObject(mainServiceInfoConfigsController.get('_dependentConfigValues'))).to.be.true;
+ expect(App.isEmptyObject(mainServiceInfoConfigsController.get('recommendations'))).to.be.true;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/configs/enhanced_configs_test.js b/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
index 1b7115c..3ec4b07 100644
--- a/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
+++ b/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
@@ -24,19 +24,21 @@ describe('App.EnhancedConfigsMixin', function() {
var instanceObject = mixinObject.create({});
describe('#removeCurrentFromDependentList()', function() {
it('update some fields', function() {
- instanceObject.get('_dependentConfigValues').pushObject({
+ instanceObject.get('recommendations').pushObject({
saveRecommended: true,
saveRecommendedDefault: true,
+ configGroup: "Default",
propertyName: 'p1',
- fileName: 'f1',
+ propertyFileName: 'f1',
value: 'v1'
});
instanceObject.removeCurrentFromDependentList(Em.Object.create({name: 'p1', filename: 'f1.xml', value: 'v2'}));
- expect(instanceObject.get('_dependentConfigValues')[0]).to.eql({
+ expect(instanceObject.get('recommendations')[0]).to.eql({
saveRecommended: false,
saveRecommendedDefault: false,
+ configGroup: "Default",
propertyName: 'p1',
- fileName: 'f1',
+ propertyFileName: 'f1',
value: 'v1'
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/73a850eb/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js b/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js
index e7f979b..ed43a1b 100644
--- a/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js
@@ -209,22 +209,22 @@ describe('App.ConfigWidgetView', function () {
tests.forEach(function(test) {
it(test.m, function() {
- view.set('controller._dependentConfigValues', test.dependentConfigs);
+ view.set('controller.recommendations', test.dependentConfigs);
view.restoreDependentConfigs(view.get('config'));
- expect(view.get('controller._dependentConfigValues').mapProperty('name')).to.be.eql(test.e);
+ expect(view.get('controller.recommendations').mapProperty('name')).to.be.eql(test.e);
});
});
it('when dependent configs has multiple parents appropriate parent config should be removed', function() {
- view.set('controller._dependentConfigValues', [
+ view.set('controller.recommendations', [
{name: 'dependent1', parentConfigs: ['config1', 'config2']},
{name: 'dependent2', parentConfigs: ['config2', 'config1']},
{name: 'dependent3', parentConfigs: ['config1']}
]);
view.restoreDependentConfigs(view.get('config'));
- expect(view.get('controller._dependentConfigValues').findProperty('name', 'dependent1').parentConfigs.toArray()).to.be.eql(["config2"]);
- expect(view.get('controller._dependentConfigValues').findProperty('name', 'dependent2').parentConfigs.toArray()).to.be.eql(["config2"]);
- expect(view.get('controller._dependentConfigValues.length')).to.be.eql(2);
+ expect(view.get('controller.recommendations').findProperty('name', 'dependent1').parentConfigs.toArray()).to.be.eql(["config2"]);
+ expect(view.get('controller.recommendations').findProperty('name', 'dependent2').parentConfigs.toArray()).to.be.eql(["config2"]);
+ expect(view.get('controller.recommendations.length')).to.be.eql(2);
});
it('dependent config value should be set with inital or saved when it has one parent', function() {
@@ -237,7 +237,7 @@ describe('App.ConfigWidgetView', function () {
])
})
]);
- view.set('controller._dependentConfigValues', [
+ view.set('controller.recommendations', [
{propertyName: 'dependent1', parentConfigs: ['config1', 'config2'], fileName: 'some-file' },
{propertyName: 'dependent2', parentConfigs: ['config2', 'config1'], fileName: 'some-file'},
{propertyName: 'dependent3', parentConfigs: ['config1'], fileName: 'some-file' }
[32/50] [abbrv] ambari git commit: AMBARI-14521. Ambari Admin:
externalize string constants used in views (alexantonenko)
Posted by nc...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/list.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/list.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/list.html
index d0df0fa..b359ede 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/list.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/list.html
@@ -18,10 +18,10 @@
<div class="groups-pane">
<div class="clearfix">
<ol class="breadcrumb pull-left">
- <li class="active">Groups</li>
+ <li class="active">{{'common.groups' | translate}}</li>
</ol>
<div class="pull-right top-margin-4">
- <link-to route="groups.create" class="btn btn-primary creategroup-btn"><span class="glyphicon glyphicon-plus"></span> Create Local Group</link-to>
+ <link-to route="groups.create" class="btn btn-primary creategroup-btn"><span class="glyphicon glyphicon-plus"></span> {{'groups.createLocal' | translate}}</link-to>
</div>
</div>
<hr>
@@ -30,13 +30,13 @@
<tr>
<th class="col-sm-8">
<div class="search-container">
- <label for="">Group Name</label>
- <input type="text" class="form-control namefilter" placeholder="Any" ng-model="currentNameFilter" ng-change="resetPagination()">
- <button type="button" class="close" ng-show="currentNameFilter" ng-click="currentNameFilter=''; resetPagination()"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
+ <label for="">{{'groups.name' | translate}}</label>
+ <input type="text" class="form-control namefilter" placeholder="{{'common.any' | translate}}" ng-model="currentNameFilter" ng-change="resetPagination()">
+ <button type="button" class="close" ng-show="currentNameFilter" ng-click="currentNameFilter=''; resetPagination()"><span aria-hidden="true">×</span><span class="sr-only">{{'common.controls.close' | translate}}</span></button>
</div>
</th>
<th class="col-sm-2">
- <label for="">Type</label>
+ <label for="">{{'common.type' | translate}}</label>
<select class="form-control typefilter"
ng-model="currentTypeFilter"
ng-options="item.label for item in typeFilterOptions"
@@ -44,7 +44,7 @@
</select>
</th>
<th class="col-sm-2 vertical-top">
- <label for="">Members</label>
+ <label for="">{{'groups.members' | translate}}</label>
</th>
</tr>
</thead>
@@ -53,18 +53,18 @@
<td class="col-sm-8">
<link-to route="groups.edit" class="link-to-group" id="{{group.group_name}}">{{group.group_name}}</link-to>
</td>
- <td class="col-sm-2">{{group.ldap_group ? 'LDAP' : 'Local'}}</td>
- <td class="col-sm-2">{{group.members ? group.members.length : 0}} {{group.members.length === 1 ? 'member' : 'members'}}</td>
+ <td class="col-sm-2">{{'common.' + (group.ldap_group ? 'ldap' : 'local') | translate}}</td>
+ <td class="col-sm-2">{{'groups.membersPlural' | translate: '{n: group.members && group.members.length || 0}'}}</td>
</tr>
</tbody>
</table>
<div class="alert alert-info col-sm-12" ng-show="!groups.length">
- No groups to display.
+ {{'common.alerts.nothingToDisplay' | translate: '{term: constants.groups}'}}
</div>
<div class="col-sm-12 table-bar">
<div class="pull-left filtered-info">
- <span>{{tableInfo.showed}} of {{tableInfo.total}} groups showing</span>
- <span ng-show="isNotEmptyFilter">- <a href ng-click="clearFilters()">clear filters</a></span>
+ <span>{{'common.filterInfo' | translate: '{showed: tableInfo.showed, total: tableInfo.total, term: constants.groups}'}}</span>
+ <span ng-show="isNotEmptyFilter">- <a href ng-click="clearFilters()">{{'common.controls.clearFilters' | translate}}</a></span>
</div>
<div class="pull-right left-margin">
<pagination class="paginator" total-items="totalGroups" max-size="maxVisiblePages" items-per-page="groupsPerPage" ng-model="currentPage" ng-change="pageChanged()"></pagination>
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html
index 40e2505..bf7f3a1 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html
@@ -17,14 +17,14 @@
-->
<div class="left-navbar" xmlns="http://www.w3.org/1999/html">
<div class="panel panel-default">
- <div class="panel-heading"><span class="glyphicon glyphicon-cloud"></span> Clusters</div>
+ <div class="panel-heading"><span class="glyphicon glyphicon-cloud"></span> {{'common.clusters' | translate}}</div>
<div class="panel-body">
<div class="cluster-section" ng-show="cluster">
<div id="cluster-name" ng-switch on="editCluster.editingName">
<h5 ng-switch-when="false">{{cluster.Clusters.cluster_name}}
<i ng-show="cluster.Clusters.provisioning_state == 'INSTALLED'"
ng-click="toggleEditName()"
- class="glyphicon glyphicon-edit pull-right edit-cluster-name" tooltip="Rename Cluster">
+ class="glyphicon glyphicon-edit pull-right edit-cluster-name" tooltip="{{'common.renameCluster' | translate}}">
</i>
</h5>
@@ -46,7 +46,7 @@
ng-model="editCluster.name"
class="form-control input-sm"
ng-maxlength="80"
- tooltip="Only alpha-numeric characters, up to 80 characters"
+ tooltip="{{'common.renameClusterTip' | translate}}"
tooltip-trigger="focus">
<button ng-click="toggleEditName()"
class="btn btn-xs">
@@ -65,42 +65,42 @@
<ul class="nav nav-pills nav-stacked" ng-show="cluster.Clusters.provisioning_state == 'INSTALLED' ">
<li ng-class="{active: isActive('clusters.manageAccess')}">
- <a href="#/clusters/{{cluster.Clusters.cluster_name}}/userAccessList" class="permissions">Roles</a>
+ <a href="#/clusters/{{cluster.Clusters.cluster_name}}/userAccessList" class="permissions">{{'common.roles' | translate}}</a>
</li>
- <li><a href="#/dashboard" class="gotodashboard">Go to Dashboard</a></li>
+ <li><a href="#/dashboard" class="gotodashboard">{{'common.goToDashboard' | translate}}</a></li>
</ul>
- <span class="cluster-installation-progress-label" ng-show="cluster.Clusters.provisioning_state == 'INIT'"><a href="/#/">Cluster creation in progress...</a></span>
+ <span class="cluster-installation-progress-label" ng-show="cluster.Clusters.provisioning_state == 'INIT'"><a href="/#/">{{'common.clusterCreationInProgress' | translate}}</a></span>
</div>
<div ng-hide="cluster">
<ul class="nav nav-pills nav-stacked">
- <li><p class="noclusters">No clusters</p></li>
+ <li><p class="noclusters">{{'common.noClusters' | translate}}</p></li>
</ul>
</div>
<ul class="nav nav-pills nav-stacked" ng-show="cluster && totalRepos > 0">
<li ng-class="{active: isActive('stackVersions.list')}">
- <a href="#/stackVersions">Versions</a>
+ <a href="#/stackVersions">{{'common.versions' | translate}}</a>
</li>
</ul>
</div>
</div>
<div class="panel panel-default">
- <div class="panel-heading"><span class="glyphicon glyphicon-th"></span> Views</div>
+ <div class="panel-heading"><span class="glyphicon glyphicon-th"></span> {{'common.views' | translate}}</div>
<div class="panel-body">
<ul class="nav nav-pills nav-stacked">
- <li ng-class="{active: isActive('views.list')}"><link-to route="views.list" class="viewslist-link">Views</link-to></li>
+ <li ng-class="{active: isActive('views.list')}"><link-to route="views.list" class="viewslist-link">{{'common.views' | translate}}</link-to></li>
</ul>
</div>
</div>
<div class="panel panel-default">
- <div class="panel-heading"><span class="glyphicon glyphicon-user"></span> User + Group Management</div>
+ <div class="panel-heading"><span class="glyphicon glyphicon-user"></span> {{'common.userGroupManagement' | translate}}</div>
<div class="panel-body">
<ul class="nav nav-pills nav-stacked">
- <li ng-class="{active: isActive('users.list')}"><link-to route="users.list" class="userslist-link">Users</link-to></li>
- <li ng-class="{active: isActive('groups.list')}"><link-to route="groups.list" class="groupslist-link">Groups</link-to></li>
+ <li ng-class="{active: isActive('users.list')}"><link-to route="users.list" class="userslist-link">{{'common.users' | translate}}</link-to></li>
+ <li ng-class="{active: isActive('groups.list')}"><link-to route="groups.list" class="groupslist-link">{{'common.groups' | translate}}</link-to></li>
</ul>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/main.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/main.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/main.html
index 8eb710e..f9e6e63 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/main.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/main.html
@@ -17,51 +17,51 @@
-->
<div class="panel panel-default mainpage">
<div class="panel-body">
- <h1>Welcome to Apache Ambari</h1>
+ <h1>{{'main.title' | translate}}</h1>
<div ng-if="isLoaded" id="main-operations-boxes" class="row thumbnails">
- <p ng-hide="cluster">Provision a cluster, manage who can access the cluster, and customize views for Ambari users.</p>
- <p ng-show="cluster">Monitor your cluster resources, manage who can access the cluster, and customize views for Ambari users.</p>
+ <p ng-hide="cluster">{{'main.noClusterDescription' | translate}}</p>
+ <p ng-show="cluster">{{'main.hasClusterDescription' | translate}}</p>
<!--Clusters-->
<div ng-show="cluster" class="col-sm-11 thumbnail">
- <h4 class="title">Operate Your Cluster</h4>
- <div class="description">Manage the configuration of your cluster and monitor the health of your services</div>
+ <h4 class="title">{{'main.operateCluster.title' | translate}}</h4>
+ <div class="description">{{'main.operateCluster.description' | translate}}</div>
<div class="glyphicon glyphicon-cloud"></div>
<div class="buttons">
<span ng-class="{active: isActive('clusters.manageAccess')}">
- <a ng-show="cluster.Clusters.provisioning_state != 'INSTALLED'" href class="btn btn-primary permission-button" ng-disabled="cluster.Clusters.provisioning_state != 'INSTALLED' ">Manage Roles</a>
- <a ng-show="cluster.Clusters.provisioning_state == 'INSTALLED'" href="#/clusters/{{cluster.Clusters.cluster_name}}/userAccessList" class="btn btn-primary permission-button" ng-disabled="cluster.Clusters.provisioning_state != 'INSTALLED' ">Manage Roles</a>
+ <a ng-show="cluster.Clusters.provisioning_state != 'INSTALLED'" href class="btn btn-primary permission-button" ng-disabled="cluster.Clusters.provisioning_state != 'INSTALLED' ">{{'main.operateCluster.manageRoles' | translate}}</a>
+ <a ng-show="cluster.Clusters.provisioning_state == 'INSTALLED'" href="#/clusters/{{cluster.Clusters.cluster_name}}/userAccessList" class="btn btn-primary permission-button" ng-disabled="cluster.Clusters.provisioning_state != 'INSTALLED' ">{{'main.operateCluster.manageRoles' | translate}}</a>
</span>
<span>
- <a ng-show="cluster.Clusters.provisioning_state != 'INSTALLED'" href class="btn btn-primary go-dashboard-button" ng-disabled="cluster.Clusters.provisioning_state != 'INSTALLED' ">Go to Dashboard</a>
- <a ng-show="cluster.Clusters.provisioning_state == 'INSTALLED'" href="/#/main/dashboard/metrics" class="btn btn-primary go-dashboard-button" ng-disabled="cluster.Clusters.provisioning_state != 'INSTALLED' ">Go to Dashboard</a>
+ <a ng-show="cluster.Clusters.provisioning_state != 'INSTALLED'" href class="btn btn-primary go-dashboard-button" ng-disabled="cluster.Clusters.provisioning_state != 'INSTALLED' ">{{'common.goToDashboard' | translate}}</a>
+ <a ng-show="cluster.Clusters.provisioning_state == 'INSTALLED'" href="/#/main/dashboard/metrics" class="btn btn-primary go-dashboard-button" ng-disabled="cluster.Clusters.provisioning_state != 'INSTALLED' ">{{'common.goToDashboard' | translate}}</a>
</span>
</div>
</div>
<div ng-hide="cluster" class="col-sm-11 thumbnail">
- <h4 class="title">Create a Cluster</h4>
- <div class="description">Use the Install Wizard to select services and configure your cluster</div>
+ <h4 class="title">{{'main.createCluster.title' | translate}}</h4>
+ <div class="description">{{'main.createCluster.description' | translate}}</div>
<div class="glyphicon glyphicon-cloud"></div>
- <div class="buttons"> <a href="/#/installer/step0" class="btn btn-primary create-cluster-button">Launch Install Wizard</a></div>
+ <div class="buttons"> <a href="/#/installer/step0" class="btn btn-primary create-cluster-button">{{'main.createCluster.launchInstallWizard' | translate}}</a></div>
</div>
<!--Manage Users and groups-->
<div class="col-sm-5 thumbnail">
- <h4 class="title">Manage Users + Groups</h4>
- <div class="description">Manage the users and groups that can access Ambari</div>
+ <h4 class="title">{{'main.manageUsersAndGroups.title' | translate}}</h4>
+ <div class="description">{{'main.manageUsersAndGroups.description' | translate}}</div>
<div class="glyphicon glyphicon-user"></div>
<div class="buttons">
- <span ng-class="{active: isActive('users.list')}"><link-to route="users.list" class="btn btn-primary userslist-button">Users</link-to></span>
- <span ng-class="{active: isActive('groups.list')}"><link-to route="groups.list" class="btn btn-primary groupslist-button">Groups</link-to></span>
+ <span ng-class="{active: isActive('users.list')}"><link-to route="users.list" class="btn btn-primary userslist-button">{{'common.users' | translate}}</link-to></span>
+ <span ng-class="{active: isActive('groups.list')}"><link-to route="groups.list" class="btn btn-primary groupslist-button">{{'common.groups' | translate}}</link-to></span>
</div>
</div>
<!--Deploy Views-->
<div class="col-sm-5 thumbnail">
- <h4 class="title">Deploy Views</h4>
- <div class="description">Create view instances and grant permissions</div>
+ <h4 class="title">{{'main.deployViews.title' | translate}}</h4>
+ <div class="description">{{'main.deployViews.description' | translate}}</div>
<div class="glyphicon glyphicon-th"></div>
- <div ng-class="{active: isActive('views.list')}" class="buttons"><link-to route="views.list" class="btn btn-primary viewslist-button">Views</link-to></div>
+ <div ng-class="{active: isActive('views.list')}" class="buttons"><link-to route="views.list" class="btn btn-primary viewslist-button">{{'common.views' | translate}}</link-to></div>
</div>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/AboutModal.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/AboutModal.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/AboutModal.html
index a78db29..e8856d4 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/AboutModal.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/AboutModal.html
@@ -16,29 +16,29 @@
* limitations under the License.
-->
<div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" ng-click="ok()"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
- <h3 class="modal-title">About</h3>
+ <button type="button" class="close" data-dismiss="modal" ng-click="ok()"><span aria-hidden="true">×</span><span class="sr-only">{{'common.controls.close' | translate}}</span></button>
+ <h3 class="modal-title">{{'common.about' | translate}}</h3>
</div>
<div class="modal-body">
<div class="about clearfix">
<div class="logo">
- <img src="/img/logo.png" alt="Apache Ambari" title="Apache Ambari">
+ <img src="/img/logo.png" alt="{{'common.apacheAmbari' | translate}}" title="{{'common.apacheAmbari' | translate}}">
</div>
<div class="content">
- <div class="project">Apache Ambari</div>
+ <div class="project">{{'common.apacheAmbari' | translate}}</div>
<br>
- <span id="i18n-33">Version</span>
+ <span id="i18n-33">{{'common.version' | translate}}</span>
<script id="metamorph-199-start" type="text/x-placeholder"></script>
<span ng-bind="ambariVersion"></span>
<script id="metamorph-199-end" type="text/x-placeholder"></script>
<br>
<br>
- <a href="http://ambari.apache.org/" target="_blank"><span id="i18n-34">Get involved!</span></a>
+ <a href="http://ambari.apache.org/" target="_blank"><span id="i18n-34">{{'common.getInvolved' | translate}}</span></a>
<br>
- <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank"><span id="i18n-35">Licensed under the Apache License, Version 2.0</span></a>
+ <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank"><span id="i18n-35">{{'common.license' | translate}}</span></a>
</div>
</div>
</div>
<div class="modal-footer">
- <button class="btn btn-success" ng-click="ok()">OK</button>
+ <button class="btn btn-success" ng-click="ok()">{{'common.controls.ok' | translate}}</button>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/BodyForDeregisterVersion.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/BodyForDeregisterVersion.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/BodyForDeregisterVersion.html
index a48633a..4d0ca30 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/BodyForDeregisterVersion.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/BodyForDeregisterVersion.html
@@ -15,4 +15,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
-->
-Are you sure you want to deregister version <strong>{{innerScope.displayName}}</strong> ?
+<span translate="versions.deregisterConfirmation" translate-values="{versionName: innerScope.displayName}"></span>
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/TimeoutWarning.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/TimeoutWarning.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/TimeoutWarning.html
index ad5c3a0..abcb84c 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/TimeoutWarning.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/TimeoutWarning.html
@@ -19,9 +19,7 @@
<div class="modal-header">
<h4 class="modal-title">{{title}}</h4>
</div>
-<div class="modal-body">
- You will be automatically logged out in <b>{{remainTime}}</b> seconds due to inactivity.
-</div>
+<div class="modal-body" translate="common.alerts.timeOut" translate-values="{time: remainTime}"></div>
<div class="modal-footer">
<button class="btn btn-default" ng-click="logout()">{{secondaryText}}</button>
<button class="btn btn-primary" ng-click="remain()">{{primaryText}}</button>
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
index ed014d8..5f5421b 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
@@ -19,12 +19,12 @@
<div id="stack-versions">
<div class="clearfix">
<ol class="breadcrumb pull-left">
- <li class="active">Versions</li>
+ <li class="active">{{'common.versions' | translate}}</li>
</ol>
<div class="pull-right top-margin-4">
<a href="#/stackVersions/create" class="btn btn-primary">
<span class="glyphicon glyphicon-plus"></span>
- Register Version
+ {{'versions.register' | translate}}
</a>
</div>
</div>
@@ -33,11 +33,11 @@
<thead>
<tr>
<th class="col-medium">
- <label>Name</label>
- <input type="text" class="form-control" ng-change="resetPagination()" ng-model="filter.version" placeholder="Any">
+ <label>{{'common.name' | translate}}</label>
+ <input type="text" class="form-control" ng-change="resetPagination()" ng-model="filter.version" placeholder="{{'common.any' | translate}}">
</th>
<th class="col-small">
- <label>Cluster</label>
+ <label>{{'common.cluster' | translate}}</label>
<select class="form-control"
ng-change="resetPagination()"
ng-model="filter.cluster.current"
@@ -57,20 +57,20 @@
{{repo.cluster}}
</a>
<span ng-show="!repo.cluster">
- None
+ {{'common.none' | translate}}
</span>
</td>
<td class="verison-label-row">
<div ng-show="repo.status == 'current'">
- <span class="label {{'status-' + repo.status}}">Current: {{repo.currentHosts}}/{{repo.totalHosts}}</span>
+ <span class="label {{'status-' + repo.status}}">{{'versions.current' | translate}}: {{repo.currentHosts}}/{{repo.totalHosts}}</span>
</div>
<div ng-show="repo.status == 'installed'">
- <span class="label {{'status-' + repo.status}}">Installed: {{repo.installedHosts}}/{{repo.totalHosts}}</span>
+ <span class="label {{'status-' + repo.status}}">{{'versions.installed' | translate}}: {{repo.installedHosts}}/{{repo.totalHosts}}</span>
</div>
<div ng-show="!repo.cluster">
<div class="btn-group display-inline-block" dropdown is-open="viewsdropdown.isopen" ng-mouseover="viewsdropdown.isopen=true" ng-mouseout="viewsdropdown.isopen=false" ng-init="viewsdropdown.isopen=false">
<a class="btn dropdown-toggle">
- <span>Install on...</span>
+ <span>{{'versions.installOn' | translate}}</span>
</a>
<ul class="dropdown-menu" ng-show="viewsdropdown.isopen">
<li ng-repeat="cluster in dropDownClusters">
@@ -86,12 +86,12 @@
</tbody>
</table>
<div class="alert alert-info col-sm-12" ng-show="!repos.length">
- No version to display.
+ {{'common.alerts.nothingToDisplay' | translate: '{term: getConstant("version")}'}}
</div>
<div class="col-sm-12 table-bar">
<div class="pull-left filtered-info">
- <span>{{tableInfo.showed}} of {{tableInfo.total}} versions showing</span>
- <span ng-show="isNotEmptyFilter">- <a href ng-click="clearFilters()">clear filters</a></span>
+ <span>{{'common.filterInfo' | translate: '{showed: tableInfo.showed, total: tableInfo.total, term: getConstant("versions")}'}}</span>
+ <span ng-show="isNotEmptyFilter">- <a href ng-click="clearFilters()">{{'common.controls.clearFilters' | translate}}</a></span>
</div>
<div class="pull-right left-margin">
<pagination class="paginator"
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
index 0c6ca84..9b7e032 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
@@ -18,28 +18,25 @@
<div class="clearfix">
<ol class="breadcrumb pull-left">
- <li><a href="#/stackVersions">Versions</a></li>
+ <li><a href="#/stackVersions">{{'common.versions' | translate}}</a></li>
<li class="active" ng-if="editController">{{displayName}} <span class="sub-text">({{repoVersionFullName}})</span></li>
- <li class="active" ng-if="createController">Register Version</li>
+ <li class="active" ng-if="createController">{{'versions.register' | translate}}</li>
</ol>
<div class="pull-right top-margin-4" ng-switch="deleteEnabled" ng-if="editController">
- <button ng-switch-when="false" class="btn disabled btn-default" tooltip="Cannot delete version already installed.">Deregister
- Version
- </button>
- <button ng-switch-when="true" class="btn btn-danger" ng-click="delete()">Deregister Version
- </button>
+ <button ng-switch-when="false" class="btn disabled btn-default" tooltip="Cannot delete version already installed.">{{'versions.deregister' | translate}}</button>
+ <button ng-switch-when="true" class="btn btn-danger" ng-click="delete()">{{'versions.deregister' | translate}}</button>
</div>
</div>
<hr>
<form class="form-horizontal register-version-form" role="form" name="repoRegForm" novalidate>
<div class="panel panel-default" ng-if="createController">
<div class="panel-heading">
- <h3 class="panel-title">Details</h3>
+ <h3 class="panel-title">{{'common.details' | translate}}</h3>
</div>
<div class="panel-body">
<div class="form-inline repo-version-inline">
- <label class="control-label col-sm-2 repo-version-label">Name</label>
+ <label class="control-label col-sm-2 repo-version-label">{{'common.name' | translate}}</label>
<div class="col-sm-10">
<select class="form-control repo-version-select"
ng-model="$parent.upgradeStack.selected"
@@ -49,9 +46,9 @@
<span class="bold-dot">.</span>
<div class="form-group" ng-class="{'has-error' : repoRegForm.version.$error.pattern}">
<input class="form-control" name="version" type="text" ng-model="$parent.repoSubversion" ng-pattern="subversionPattern"
- placeholder="Version Number (0.0)" ng-change="updateCurrentVersionInput()" required/>
+ placeholder="{{'versions.placeholder' | translate}}" ng-change="updateCurrentVersionInput()" required/>
<span class="text-danger" ng-show="repoRegForm.version.$error.pattern">
-  {{currentVersionInput}} Invalid.
+  {{'common.alerts.isInvalid' | translate: '{term: currentVersionInput}'}}
</span>
</div>
</div>
@@ -60,19 +57,15 @@
</div>
<div class="panel panel-default">
<div class="panel-heading">
- <h3 class="panel-title">Repositories</h3>
+ <h3 class="panel-title">{{'versions.repos' | translate}}</h3>
</div>
<div class="panel-body ">
- <div class="alert alert-info" role="alert">
- Provide Base URLs for the Operating Systems you are configuring. Uncheck all other Operating Systems.
- </div>
- <div class="alert alert-warning hide-soft" ng-class="{'visible' : hasValidationErrors()}" role="alert">
- Some of the repositories failed validation. Make changes to the base url or skip validation if you are sure that urls are correct
- </div>
+ <div class="alert alert-info" role="alert">{{'versions.alerts.baseURLs' | translate}}</div>
+ <div class="alert alert-warning hide-soft" ng-class="{'visible' : hasValidationErrors()}" role="alert">{{'versions.alerts.validationFailed' | translate}}</div>
<div class="border-bottom bottom-margin clearfix">
- <div class="col-sm-2"><h5><label>OS</label></h5></div>
- <div class="name-label-adjust col-sm-2"><h5><label>Name</label></h5></div>
- <div class="col-sm-7"><h5><label>Base URL</label></h5></div>
+ <div class="col-sm-2"><h5><label>{{'versions.os' | translate}}</label></h5></div>
+ <div class="name-label-adjust col-sm-2"><h5><label>{{'common.name' | translate}}</label></h5></div>
+ <div class="col-sm-7"><h5><label >{{'versions.baseURL' | translate}}</label></h5></div>
</div>
<div class="clearfix border-bottom bottom-margin" ng-repeat="os in osList">
<div class="col-sm-2 os-checkbox">
@@ -95,7 +88,7 @@
<div class="checkbox">
<label>
<input type="checkbox" ng-model="skipValidation" ng-change="clearErrors()">
- Skip Repository Base URL validation (Advanced) <span class="glyphicon glyphicon-question-sign" tooltip-html-unsafe="<b>Warning:</b> This is for advanced users only. Use this option if you want to skip validation for Repository Base URLs."></span>
+ {{'versions.skipValidation' | translate}} <span class="glyphicon glyphicon-question-sign" tooltip-html-unsafe="{{'versions.alerts.skipValidationWarning' | translate}}"></span>
</label>
</div>
</div>
@@ -104,7 +97,7 @@
</div>
<div class="col-sm-12">
<button class="btn btn-primary pull-right left-margin" ng-click="save()"
- ng-disabled="(createController && repoRegForm.version.$invalid) || selectedOS === 0">Save</button>
- <button class="btn btn-default pull-right" ng-click="cancel()">Cancel</button>
+ ng-disabled="(createController && repoRegForm.version.$invalid) || selectedOS === 0">{{'common.controls.save' | translate}}</button>
+ <button class="btn btn-default pull-right" ng-click="cancel()">{{'common.controls.cancel' | translate}}</button>
</div>
</form>
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/users/create.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/users/create.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/users/create.html
index 3d1cfc5..c0967fb 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/users/create.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/users/create.html
@@ -16,58 +16,52 @@
* limitations under the License.
-->
<ol class="breadcrumb">
- <li><a href="#/users">Users</a></li>
- <li class="active">Create Local User</li>
+ <li><a href="#/users">{{'common.users' | translate}}</a></li>
+ <li class="active">{{'users.create' | translate}}</li>
</ol>
<hr>
<form class="form-horizontal create-user-form" role="form" novalidate name="form" autocomplete="off">
<div class="form-group" ng-class="{'has-error' : form.user_name.$error.required && form.submitted}">
- <label for="username" class="col-sm-2 control-label">Username</label>
+ <label for="username" class="col-sm-2 control-label">{{'users.username' | translate}}</label>
<div class="col-sm-10">
- <input type="text" id="username" class="form-control username-input" name="user_name" placeholder="User name" ng-model="user.user_name" required autocomplete="off">
- <div class="alert alert-danger top-margin" ng-show="form.user_name.$error.required && form.submitted">
- This field is required.
- </div>
+ <input type="text" id="username" class="form-control username-input" name="user_name" placeholder="{{'users.userName' | translate}}" ng-model="user.user_name" required autocomplete="off">
+ <div class="alert alert-danger top-margin" ng-show="form.user_name.$error.required && form.submitted">{{'common.alerts.fieldIsRequired' | translate}</div>
</div>
</div>
<div class="form-group">
- <label for="" class="col-sm-2 control-label">Type</label>
+ <label for="" class="col-sm-2 control-label">{{'common.type' | translate}}</label>
<div class="col-sm-10">
- <label for="" class="control-label">Local</label>
+ <label for="" class="control-label">{{'common.local' | translate}}</label>
</div>
</div>
<div class="form-group">
- <label for="" class="col-sm-2 control-label">Status</label>
+ <label for="" class="col-sm-2 control-label">{{'users.status' | translate}}</label>
<div class="col-sm-10">
- <toggle-switch model="user.active" on-label="Active" off-label="Inactive" class="switch-primary userstatus" data-off-color="danger"></toggle-switch>
+ <toggle-switch model="user.active" on-label="{{'users.active' | translate}}" off-label="{{'users.inactive' | translate}}" class="switch-primary userstatus" data-off-color="danger"></toggle-switch>
</div>
</div>
<div class="form-group">
- <label for="" class="col-sm-2 control-label"><span class="glyphicon glyphicon-flash"></span>Ambari Admin</label>
+ <label for="" class="col-sm-2 control-label"><span class="glyphicon glyphicon-flash"></span>{{'users.ambariAdmin' | translate}}</label>
<div class="col-sm-10">
- <toggle-switch ng-disabled="isCurrentUser" model="user.admin" on-label="Yes" off-label="No" class="switch-primary userstatus" data-off-color="danger"></toggle-switch>
+ <toggle-switch ng-disabled="isCurrentUser" model="user.admin" on-label="{{'common.yes' | translate}}" off-label="{{'common.no' | translate}}" class="switch-primary userstatus" data-off-color="danger"></toggle-switch>
</div>
</div>
<div class="form-group" ng-class="{'has-error' : (form.password.$error.required && form.submitted) || form.confirmPassword.$error.passwordVerify}">
- <label for="password" class="col-sm-2 control-label">Password</label>
+ <label for="password" class="col-sm-2 control-label">{{'users.password' | translate}}</label>
<div class="col-sm-10">
- <input type="password" class="form-control bottom-margin userpassword" name="password" placeholder="Password" required ng-model="user.password" autocomplete="off">
- <input type="password" class="form-control bottom-margin userpasswordconfirm" name="confirmPassword" placeholder="Password confirmation" required ng-model="user.passwordConfirmation"
+ <input type="password" class="form-control bottom-margin userpassword" name="password" placeholder="{{'users.password' | translate}}" required ng-model="user.password" autocomplete="off">
+ <input type="password" class="form-control bottom-margin userpasswordconfirm" name="confirmPassword" placeholder="{{'users.passwordConfirmation' | translate}}" required ng-model="user.passwordConfirmation"
password-verify="user.password" autocomplete="off">
- <div class="alert alert-danger" ng-show='form.confirmPassword.$error.passwordVerify'>
- Password must match!
- </div>
- <div class="alert alert-danger" ng-show='form.password.$error.required && form.submitted'>
- Password required!
- </div>
+ <div class="alert alert-danger" ng-show='form.confirmPassword.$error.passwordVerify'>{{'users.alerts.wrongPassword' | translate}}</div>
+ <div class="alert alert-danger" ng-show='form.password.$error.required && form.submitted'>{{'users.alerts.passwordRequired' | translate}}</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
- <button class="btn btn-primary pull-right left-margin saveuser" ng-click="createUser()">Save</button>
- <a class="btn btn-default pull-right cancel" href ng-click="cancel()">Cancel</a>
+ <button class="btn btn-primary pull-right left-margin saveuser" ng-click="createUser()">{{'common.controls.save' | translate}}</button>
+ <a class="btn btn-default pull-right cancel" href ng-click="cancel()">{{'common.controls.cancel' | translate}}</a>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/users/list.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/users/list.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/users/list.html
index 3885978..9e93032 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/users/list.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/users/list.html
@@ -19,10 +19,10 @@
<div class="users-pane">
<div class="clearfix">
<ol class="breadcrumb pull-left">
- <li class="active">Users</li>
+ <li class="active">{{'common.users' | translate}}</li>
</ol>
<div class="pull-right top-margin-4">
- <link-to route="users.create" class="btn btn-primary createuser-btn"><span class="glyphicon glyphicon-plus"></span> Create Local User</link-to>
+ <link-to route="users.create" class="btn btn-primary createuser-btn"><span class="glyphicon glyphicon-plus"></span> {{'users.create' | translate}}</link-to>
</div>
</div>
<hr>
@@ -33,18 +33,18 @@
<span class="bottom-margin admin-filter glyphicon glyphicon-flash"
ng-class="{'no-filter' : !adminFilter}"
ng-click="toggleAdminFilter()"
- tooltip="{{adminFilter ? 'Show all users' : 'Show only admin users'}}"
+ tooltip="{{'users.' + (adminFilter ? 'showAll' : 'showAdmin') | translate}}"
></span>
</th>
<th>
<div class="search-container">
- <label for="">Username</label>
- <input type="text" class="form-control namefilter" placeholder="Any" ng-model="currentNameFilter" ng-change="resetPagination()">
- <button type="button" class="close clearfilter" ng-show="currentNameFilter" ng-click="currentNameFilter=''; resetPagination()"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
+ <label for="">{{'users.username' | translate}}</label>
+ <input type="text" class="form-control namefilter" placeholder="{{'common.any' | translate}}" ng-model="currentNameFilter" ng-change="resetPagination()">
+ <button type="button" class="close clearfilter" ng-show="currentNameFilter" ng-click="currentNameFilter=''; resetPagination()"><span aria-hidden="true">×</span><span class="sr-only">{{'common.controls.close' | translate}}</span></button>
</div>
</th>
<th>
- <label for="">Type</label>
+ <label for="">{{'common.type' | translate}}</label>
<select class="form-control typefilter"
ng-model="currentTypeFilter"
ng-options="item.label for item in typeFilterOptions"
@@ -53,7 +53,7 @@
</th>
<th>
- <label for="">Status</label>
+ <label for="">{{'users.status' | translate}}</label>
<select class="form-control statusfilter"
ng-model="currentActiveFilter"
ng-options="item.label for item in activeFilterOptions"
@@ -65,23 +65,23 @@
<tbody>
<tr ng-repeat="user in users">
<td>
- <span class="glyphicon" tooltip="{{user.Users.admin ? 'Ambari Admin' : ''}}" ng-class="{'glyphicon-flash' : user.Users.admin}"></span>
+ <span class="glyphicon" tooltip="{{user.Users.admin ? constants.admin : ''}}" ng-class="{'glyphicon-flash' : user.Users.admin}"></span>
</td>
<td>
<a href="#/users/{{user.Users.encoded_name}}">{{user.Users.user_name}}</a>
</td>
<td>{{user.Users.userTypeName}}</td>
- <td><span ng-class="user.Users.active ? 'text-success' : 'text-danger'">{{user.Users.active ? 'Active' : 'Inactive'}}</span></td>
+ <td><span ng-class="user.Users.active ? 'text-success' : 'text-danger'">{{'users.' + (user.Users.active ? 'active' : 'inactive') | translate}}</span></td>
</tr>
</tbody>
</table>
<div class="alert alert-info col-sm-12" ng-show="!users.length">
- No users to display.
+ {{'common.alerts.nothingToDisplay' | translate: '{term: constants.users}'}}
</div>
<div class="col-sm-12 table-bar">
<div class="pull-left filtered-info">
- <span>{{tableInfo.showed}} of {{tableInfo.total}} users showing</span>
- <span ng-show="isNotEmptyFilter">- <a href ng-click="clearFilters()">clear filters</a></span>
+ <span>{{'common.filterInfo' | translate: '{showed: tableInfo.showed, total: tableInfo.total, term: constants.users}'}}</span>
+ <span ng-show="isNotEmptyFilter">- <a href ng-click="clearFilters()">{{'common.controls.clearFilters' | translate}}</a></span>
</div>
<div class="pull-right left-margin">
<pagination class="paginator" total-items="totalUsers" max-size="maxVisiblePages" items-per-page="usersPerPage" ng-model="currentPage" ng-change="pageChanged()"></pagination>
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/users/modals/changePassword.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/users/modals/changePassword.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/users/modals/changePassword.html
index 9b3f50d..f29d315 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/users/modals/changePassword.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/users/modals/changePassword.html
@@ -16,37 +16,31 @@
* limitations under the License.
-->
<div class="modal-header">
- <h3 class="modal-title">Change Password for {{userName}}</h3>
+ <h3 class="modal-title">{{'users.changePasswordFor' | translate: '{userName: userName}'}}</h3>
</div>
<div class="modal-body">
<form class="form-horizontal" novalidate name="form.passwordChangeForm" role="form" >
<div class="form-group" ng-class="{'has-error' : (form.passwordChangeForm.currentPassword.$error.required && form.passwordChangeForm.submitted)}">
- <label for="" class="col-sm-4 control-label" >Your Password</label>
+ <label for="" class="col-sm-4 control-label" >{{'users.yourPassword' | translate}}</label>
<div class="col-sm-8">
- <input type="password" name="currentPassword" class="form-control bottom-margin" placeholder="Your password" required ng-model="passwordData.currentUserPassword" autocomplete="off">
- <div class="alert alert-danger no-margin-bottom" ng-show='form.passwordChangeForm.password.$error.required && form.passwordChangeForm.submitted'>
- Password required!
- </div>
+ <input type="password" name="currentPassword" class="form-control bottom-margin" placeholder="{{'users.yourPassword' | translate}}" required ng-model="passwordData.currentUserPassword" autocomplete="off">
+ <div class="alert alert-danger no-margin-bottom" ng-show='form.passwordChangeForm.password.$error.required && form.passwordChangeForm.submitted'>{{'users.alerts.passwordRequired' | translate}}</div>
</div>
</div>
<div class="form-group no-margin-bottom" ng-class="{'has-error' : (form.passwordChangeForm.password.$error.required && form.passwordChangeForm.submitted) || form.passwordChangeForm.confirmPassword.$error.passwordVerify}">
- <label for="" class="col-sm-4 control-label">New User Password:</label>
+ <label for="" class="col-sm-4 control-label">{{'users.newPassword' | translate}}:</label>
<div class="col-sm-8">
- <input type="password" class="form-control bottom-margin" name="password" placeholder="New User Password" required ng-model="passwordData.password" autocomplete="off">
- <input type="password" class="form-control bottom-margin" name="confirmPassword" placeholder="New User Password Confirmation" required ng-model="passwordData.passwordConfirmation"
+ <input type="password" class="form-control bottom-margin" name="password" placeholder="{{'users.newPassword' | translate}}" required ng-model="passwordData.password" autocomplete="off">
+ <input type="password" class="form-control bottom-margin" name="confirmPassword" placeholder="{{'users.newPasswordConfirmation' | translate}}" required ng-model="passwordData.passwordConfirmation"
password-verify="passwordData.password" autocomplete="off">
- <div class="alert alert-danger no-margin-bottom" ng-show='form.passwordChangeForm.confirmPassword.$error.passwordVerify'>
- Password must match!
- </div>
- <div class="alert alert-danger no-margin-bottom" ng-show='form.passwordChangeForm.password.$error.required && form.passwordChangeForm.submitted'>
- Password required!
- </div>
+ <div class="alert alert-danger no-margin-bottom" ng-show='form.passwordChangeForm.confirmPassword.$error.passwordVerify'>{{'users.alerts.wrongPassword' | translate}}</div>
+ <div class="alert alert-danger no-margin-bottom" ng-show='form.passwordChangeForm.password.$error.required && form.passwordChangeForm.submitted'>{{'users.alerts.passwordRequired' | translate}}</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
- <button class="btn btn-default" ng-click="cancel()">Cancel</button>
- <button class="btn btn-primary" ng-click="ok()">OK</button>
+ <button class="btn btn-default" ng-click="cancel()">{{'common.controls.cancel' | translate}}</button>
+ <button class="btn btn-primary" ng-click="ok()">{{'common.controls.ok' | translate}}</button>
</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/users/show.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/users/show.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/users/show.html
index 38bb355..18df5fa 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/users/show.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/users/show.html
@@ -19,61 +19,61 @@
<div ng-show="user" class="user-edit-panel">
<div class="clearfix">
<ol class="breadcrumb pull-left">
- <li><a href="#/users">Users</a></li>
+ <li><a href="#/users">{{'common.users' | translate}}</a></li>
<li class="active"><span class="glyphicon glyphicon-flash" ng-show="user.admin"></span>{{user.user_name}}</li>
</ol>
<div class="pull-right top-margin-4">
<div ng-switch="isCurrentUser || user.ldap_user">
- <button class="btn deleteuser-btn disabled btn-default" ng-switch-when="true" tooltip="Cannot Delete User">Delete User</button>
- <button class="btn deleteuser-btn btn-danger" ng-switch-when="false" ng-click="deleteUser()">Delete User</button>
+ <button class="btn deleteuser-btn disabled btn-default" ng-switch-when="true" tooltip="{{'common.cannotDelete' | translate: '{term: constants.user}'}}">{{'common.delete' | translate: '{term: constants.user}'}}</button>
+ <button class="btn deleteuser-btn btn-danger" ng-switch-when="false" ng-click="deleteUser()">{{'common.delete' | translate: '{term: constants.user}'}}</button>
</div>
</div>
</div>
<hr>
<form class="form-horizontal" role="form" >
<div class="form-group">
- <label for="" class="col-sm-2 control-label">Type</label>
+ <label for="" class="col-sm-2 control-label">{{'common.type' | translate}}</label>
<div class="col-sm-10">
<label for="" class="control-label">{{user.userTypeName}}</label>
</div>
</div>
<div class="form-group">
- <label for="" class="col-sm-2 control-label">Status</label>
+ <label for="" class="col-sm-2 control-label">{{'users.status' | translate}}</label>
<div class="col-sm-10">
- <toggle-switch on-change="toggleUserActive()" disabled-tooltip="Cannot Change Status" ng-disabled="isCurrentUser" model="user.active" on-label="Active" off-label="Inactive" class="switch-primary userstatus {{user ? '' : 'no-animation'}}" data-off-color="danger"></toggle-switch>
+ <toggle-switch on-change="toggleUserActive()" disabled-tooltip="{{'users.alerts.cannotChange' | translate: '{term: constants.status}'}}" ng-disabled="isCurrentUser" model="user.active" on-label="{{'users.active' | translate}}" off-label="{{'users.inactive' | translate}}" class="switch-primary userstatus {{user ? '' : 'no-animation'}}" data-off-color="danger"></toggle-switch>
</div>
</div>
<div class="form-group">
- <label for="" class="col-sm-2 control-label"><span class="glyphicon glyphicon-flash"></span> Ambari Admin</label>
+ <label for="" class="col-sm-2 control-label"><span class="glyphicon glyphicon-flash"></span> {{'users.ambariAdmin' | translate}}</label>
<div class="col-sm-10">
- <toggle-switch on-change="toggleUserAdmin()" disabled-tooltip="Cannot Change Admin" ng-disabled="isCurrentUser" model="user.admin" on-label="Yes" off-label="No" class="switch-primary userstatus {{user ? '' : 'no-animation'}}" data-off-color="danger"></toggle-switch>
+ <toggle-switch on-change="toggleUserAdmin()" disabled-tooltip="{{'users.alerts.cannotChange' | translate: '{term: constants.admin}'}}" ng-disabled="isCurrentUser" model="user.admin" on-label="{{'common.yes' | translate}}" off-label="{{'common.no' | translate}}" class="switch-primary userstatus {{user ? '' : 'no-animation'}}" data-off-color="danger"></toggle-switch>
</div>
</div>
<div class="form-group">
- <label for="password" class="col-sm-2 control-label">Password</label>
+ <label for="password" class="col-sm-2 control-label">{{'users.password' | translate}}</label>
<div class="col-sm-10">
<div ng-switch="user.ldap_user">
- <button class="btn deleteuser-btn disabled btn-default" ng-switch-when="true" tooltip="Cannot Change Password">Change Password</button>
- <a href ng-click="openChangePwdDialog()" ng-switch-when="false" class="btn btn-default changepassword">Change Password</a>
+ <button class="btn deleteuser-btn disabled btn-default" ng-switch-when="true" tooltip="{{'users.alerts.cannotChange' | translate: '{term: constants.password}'}}">{{'users.changePassword'}}</button>
+ <a href ng-click="openChangePwdDialog()" ng-switch-when="false" class="btn btn-default changepassword">{{'users.changePassword' | translate}}</a>
</div>
</div>
</div>
<div class="form-group">
- <label for="groups" class="col-sm-2 control-label">{{user.ldap_user ? 'LDAP Group Membership' : 'Local Group Membership'}}</label>
+ <label for="groups" class="col-sm-2 control-label">{{'common.' + (user.ldap_user ? 'ldap' : 'local') | translate}} {{'users.groupMembership' | translate}}</label>
<div class="col-sm-10">
<editable-list items-source="editingGroupsList" resource-type="Group" editable="!user.ldap_user"></editable-list>
</div>
</div>
<div class="form-group" >
- <label for="" class="col-sm-2 control-label">Privileges</label>
+ <label for="" class="col-sm-2 control-label">{{'common.privileges' | translate}}</label>
<div class="col-sm-10">
<table class="table" ng-hide="hidePrivileges || user.admin">
<thead>
<tr>
- <th>Cluster</th>
- <th>Cluster Role</th>
+ <th>{{'common.cluster' | translate}}</th>
+ <th>{{'common.clusterRole' | translate}}</th>
</tr>
</thead>
<tbody>
@@ -87,13 +87,13 @@
</td>
</tr>
<tr>
- <td ng-show="noClusterPriv">No cluster privileges</td>
+ <td ng-show="noClusterPriv">{{'common.alerts.noPrivileges' | translate: '{term: constants.cluster}'}}</td>
</tr>
</tbody>
<thead class="view-permission-header">
<tr>
- <th>View</th>
- <th>View Permissions</th>
+ <th>{{'common.view' | translate}}</th>
+ <th>{{'common.viewPermissions' | translate}}</th>
</tr>
</thead>
<tbody>
@@ -107,12 +107,12 @@
</td>
</tr>
<tr>
- <td ng-show="noViewPriv">No view privileges</td>
+ <td ng-show="noViewPriv">{{'common.alerts.noPrivileges' | translate: '{term: constants.view}'}}</td>
</tr>
</tbody>
</table>
- <div class="alert alert-info" ng-show="!privileges && !user.admin">This user does not have any privileges.</div>
- <div class="alert alert-info" ng-show="user.admin">This user is an Ambari Admin and has all privileges.</div>
+ <div class="alert alert-info" ng-show="!privileges && !user.admin">{{'common.alerts.noPrivilegesDescription' | translate: '{term: constants.user}'}}</div>
+ <div class="alert alert-info" ng-show="user.admin">{{'users.userIsAdmin' | translate}}</div>
</div>
</div>
</form>
[28/50] [abbrv] ambari git commit: AMBARI-14523. RU: Mahout client
restart failed on one host -Ubuntu 12/14 (aonishuk)
Posted by nc...@apache.org.
AMBARI-14523. RU: Mahout client restart failed on one host -Ubuntu 12/14 (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/23a921bf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/23a921bf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/23a921bf
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 23a921bf03c86aeb3af88892a38469ed4a06aa07
Parents: 0050787
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Wed Dec 30 12:27:33 2015 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Wed Dec 30 12:27:33 2015 +0200
----------------------------------------------------------------------
.../custom_actions/scripts/install_packages.py | 8 +--
.../custom_actions/TestInstallPackages.py | 56 ++++++++++----------
2 files changed, 33 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/23a921bf/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py b/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
index b1b4496..b28a5e0 100644
--- a/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
+++ b/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
@@ -334,7 +334,9 @@ class InstallPackages(Script):
# Install packages
packages_were_checked = False
try:
- Package('hdp-select', action="upgrade")
+ Package("hdp-select",
+ action="upgrade",
+ )
packages_installed_before = []
allInstalledPackages(packages_installed_before)
@@ -343,8 +345,8 @@ class InstallPackages(Script):
filtered_package_list = self.filter_package_list(package_list)
for package in filtered_package_list:
name = self.format_package_name(package['name'])
- Package(name
- # action="upgrade" # should we use "upgrade" action here, to upgrade not versioned packages?
+ Package(name,
+ action="upgrade" # this enables upgrading non-versioned packages, despite the fact they exist. Needed by 'mahout' which is non-version but have to be updated
)
except Exception, err:
ret_code = 1
http://git-wip-us.apache.org/repos/asf/ambari/blob/23a921bf/ambari-server/src/test/python/custom_actions/TestInstallPackages.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/custom_actions/TestInstallPackages.py b/ambari-server/src/test/python/custom_actions/TestInstallPackages.py
index 679ae2a..4f9967f 100644
--- a/ambari-server/src/test/python/custom_actions/TestInstallPackages.py
+++ b/ambari-server/src/test/python/custom_actions/TestInstallPackages.py
@@ -111,13 +111,13 @@ class TestInstallPackages(RMFTestCase):
append_to_file=True,
)
self.assertResourceCalled('Package', 'hdp-select', action=["upgrade"])
- self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885')
- self.assertResourceCalled('Package', 'snappy')
- self.assertResourceCalled('Package', 'snappy-devel')
- self.assertResourceCalled('Package', 'lzo')
- self.assertResourceCalled('Package', 'hadooplzo_2_2_0_1_885')
- self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885-libhdfs')
- self.assertResourceCalled('Package', 'ambari-log4j')
+ self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885', action=["upgrade"])
+ self.assertResourceCalled('Package', 'snappy', action=["upgrade"])
+ self.assertResourceCalled('Package', 'snappy-devel', action=["upgrade"])
+ self.assertResourceCalled('Package', 'lzo', action=["upgrade"])
+ self.assertResourceCalled('Package', 'hadooplzo_2_2_0_1_885', action=["upgrade"])
+ self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885-libhdfs', action=["upgrade"])
+ self.assertResourceCalled('Package', 'ambari-log4j', action=["upgrade"])
self.assertNoMoreResources()
@patch("ambari_commons.os_check.OSCheck.is_suse_family")
@@ -171,13 +171,13 @@ class TestInstallPackages(RMFTestCase):
append_to_file=True,
)
self.assertResourceCalled('Package', 'hdp-select', action=["upgrade"])
- self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885')
- self.assertResourceCalled('Package', 'snappy')
- self.assertResourceCalled('Package', 'snappy-devel')
- self.assertResourceCalled('Package', 'lzo')
- self.assertResourceCalled('Package', 'hadooplzo_2_2_0_1_885')
- self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885-libhdfs')
- self.assertResourceCalled('Package', 'ambari-log4j')
+ self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885', action=["upgrade"])
+ self.assertResourceCalled('Package', 'snappy', action=["upgrade"])
+ self.assertResourceCalled('Package', 'snappy-devel', action=["upgrade"])
+ self.assertResourceCalled('Package', 'lzo', action=["upgrade"])
+ self.assertResourceCalled('Package', 'hadooplzo_2_2_0_1_885', action=["upgrade"])
+ self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885-libhdfs', action=["upgrade"])
+ self.assertResourceCalled('Package', 'ambari-log4j', action=["upgrade"])
self.assertNoMoreResources()
@@ -234,13 +234,13 @@ class TestInstallPackages(RMFTestCase):
append_to_file=True,
)
self.assertResourceCalled('Package', 'hdp-select', action=["upgrade"])
- self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885')
- self.assertResourceCalled('Package', 'snappy')
- self.assertResourceCalled('Package', 'snappy-devel')
- self.assertResourceCalled('Package', 'lzo')
- self.assertResourceCalled('Package', 'hadooplzo_2_2_0_1_885')
- self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885-libhdfs')
- self.assertResourceCalled('Package', 'ambari-log4j')
+ self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885', action=["upgrade"])
+ self.assertResourceCalled('Package', 'snappy', action=["upgrade"])
+ self.assertResourceCalled('Package', 'snappy-devel', action=["upgrade"])
+ self.assertResourceCalled('Package', 'lzo', action=["upgrade"])
+ self.assertResourceCalled('Package', 'hadooplzo_2_2_0_1_885', action=["upgrade"])
+ self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885-libhdfs', action=["upgrade"])
+ self.assertResourceCalled('Package', 'ambari-log4j', action=["upgrade"])
self.assertNoMoreResources()
@@ -368,13 +368,13 @@ class TestInstallPackages(RMFTestCase):
append_to_file=True,
)
self.assertResourceCalled('Package', 'hdp-select', action=["upgrade"])
- self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885')
- self.assertResourceCalled('Package', 'snappy')
- self.assertResourceCalled('Package', 'snappy-devel')
- self.assertResourceCalled('Package', 'lzo')
- self.assertResourceCalled('Package', 'hadooplzo_2_2_0_1_885')
- self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885-libhdfs')
- self.assertResourceCalled('Package', 'ambari-log4j')
+ self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885', action=["upgrade"])
+ self.assertResourceCalled('Package', 'snappy', action=["upgrade"])
+ self.assertResourceCalled('Package', 'snappy-devel', action=["upgrade"])
+ self.assertResourceCalled('Package', 'lzo', action=["upgrade"])
+ self.assertResourceCalled('Package', 'hadooplzo_2_2_0_1_885', action=["upgrade"])
+ self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885-libhdfs', action=["upgrade"])
+ self.assertResourceCalled('Package', 'ambari-log4j', action=["upgrade"])
self.assertNoMoreResources()
[15/50] [abbrv] ambari git commit: AMBARI-14452: It should be
possible to delete service components if all related host components are
stopped (Ajit Kumar via jluniya)
Posted by nc...@apache.org.
AMBARI-14452: It should be possible to delete service components if all related host components are stopped (Ajit Kumar via jluniya)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b328f6db
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b328f6db
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b328f6db
Branch: refs/heads/branch-dev-patch-upgrade
Commit: b328f6dbe3ed94df662858962aad37b4e889bcd9
Parents: 7d6caf6
Author: Jayush Luniya <jl...@hortonworks.com>
Authored: Mon Dec 28 12:49:51 2015 -0800
Committer: Jayush Luniya <jl...@hortonworks.com>
Committed: Mon Dec 28 12:49:51 2015 -0800
----------------------------------------------------------------------
.../controller/ServiceComponentRequest.java | 7 +-
.../internal/ComponentResourceProvider.java | 604 +++++++------------
.../internal/ComponentResourceProviderTest.java | 213 +------
3 files changed, 234 insertions(+), 590 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b328f6db/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
index 63af85e..78b9897 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
@@ -42,7 +42,6 @@ public class ServiceComponentRequest {
public ServiceComponentRequest(String clusterName,
String serviceName, String componentName,
String desiredState, String componentCategory) {
- super();
this.clusterName = clusterName;
this.serviceName = serviceName;
this.componentName = componentName;
@@ -113,4 +112,10 @@ public class ServiceComponentRequest {
public void setComponentCategory(String componentCategory) {
this.componentCategory = componentCategory;
}
+
+ @Override
+ public String toString() {
+ return String.format("[clusterName=%s, serviceName=%s, componentName=%s, desiredState=%s, componentCategory=%s]",
+ clusterName, serviceName, clusterName, desiredState, componentCategory);
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b328f6db/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
index ddbf60a..3ad6e64 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
@@ -65,13 +65,14 @@ import org.apache.ambari.server.state.State;
import com.google.inject.assistedinject.Assisted;
import com.google.inject.assistedinject.AssistedInject;
import com.google.inject.persist.Transactional;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.Validate;
/**
* Resource provider for component resources.
*/
public class ComponentResourceProvider extends AbstractControllerResourceProvider {
-
// ----- Property ID constants ---------------------------------------------
// Components
@@ -84,12 +85,13 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
protected static final String COMPONENT_STARTED_COUNT_PROPERTY_ID = "ServiceComponentInfo/started_count";
protected static final String COMPONENT_INSTALLED_COUNT_PROPERTY_ID = "ServiceComponentInfo/installed_count";
+ private static final String TRUE = "true";
+
//Parameters from the predicate
- private static final String QUERY_PARAMETERS_RUN_SMOKE_TEST_ID =
- "params/run_smoke_test";
+ private static final String QUERY_PARAMETERS_RUN_SMOKE_TEST_ID = "params/run_smoke_test";
private static Set<String> pkPropertyIds =
- new HashSet<String>(Arrays.asList(new String[]{
+ new HashSet<>(Arrays.asList(new String[]{
COMPONENT_CLUSTER_NAME_PROPERTY_ID,
COMPONENT_SERVICE_NAME_PROPERTY_ID,
COMPONENT_COMPONENT_NAME_PROPERTY_ID}));
@@ -99,7 +101,7 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
// ----- Constructors ----------------------------------------------------
/**
- * Create a new resource provider for the given management controller.
+ * Create a new resource provider for the given management controller.
*
* @param propertyIds the property ids
* @param keyPropertyIds the key property ids
@@ -113,7 +115,6 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
super(propertyIds, keyPropertyIds, managementController);
this.maintenanceStateHelper = maintenanceStateHelper;
-
setRequiredCreateAuthorizations(EnumSet.of(RoleAuthorization.SERVICE_ADD_DELETE_SERVICES));
setRequiredDeleteAuthorizations(EnumSet.of(RoleAuthorization.SERVICE_ADD_DELETE_SERVICES));
setRequiredGetAuthorizations(RoleAuthorization.AUTHORIZATIONS_VIEW_SERVICE);
@@ -126,12 +127,9 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
@Override
protected RequestStatus createResourcesAuthorized(Request request)
- throws SystemException,
- UnsupportedPropertyException,
- ResourceAlreadyExistsException,
- NoSuchParentResourceException {
+ throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException {
- final Set<ServiceComponentRequest> requests = new HashSet<ServiceComponentRequest>();
+ final Set<ServiceComponentRequest> requests = new HashSet<>();
for (Map<String, Object> propertyMap : request.getProperties()) {
requests.add(getRequest(propertyMap));
}
@@ -154,7 +152,7 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
public Set<Resource> getResources(Request request, Predicate predicate)
throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
- final Set<ServiceComponentRequest> requests = new HashSet<ServiceComponentRequest>();
+ final Set<ServiceComponentRequest> requests = new HashSet<>();
for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) {
requests.add(getRequest(propertyMap));
@@ -167,16 +165,15 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
}
});
- Set<String> requestedIds = getRequestPropertyIds(request, predicate);
- Set<Resource> resources = new HashSet<Resource>();
+ Set<String> requestedIds = getRequestPropertyIds(request, predicate);
+ Set<Resource> resources = new HashSet<>();
for (ServiceComponentResponse response : responses) {
Resource resource = new ResourceImpl(Resource.Type.Component);
setResourceProperty(resource, COMPONENT_CLUSTER_NAME_PROPERTY_ID, response.getClusterName(), requestedIds);
setResourceProperty(resource, COMPONENT_SERVICE_NAME_PROPERTY_ID, response.getServiceName(), requestedIds);
setResourceProperty(resource, COMPONENT_COMPONENT_NAME_PROPERTY_ID, response.getComponentName(), requestedIds);
- setResourceProperty(resource, COMPONENT_STATE_PROPERTY_ID,
- response.getDesiredState(), requestedIds);
+ setResourceProperty(resource, COMPONENT_STATE_PROPERTY_ID, response.getDesiredState(), requestedIds);
setResourceProperty(resource, COMPONENT_CATEGORY_PROPERTY_ID, response.getCategory(), requestedIds);
setResourceProperty(resource, COMPONENT_TOTAL_COUNT_PROPERTY_ID, response.getTotalCount(), requestedIds);
setResourceProperty(resource, COMPONENT_STARTED_COUNT_PROPERTY_ID, response.getStartedCount(), requestedIds);
@@ -191,15 +188,13 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
public RequestStatus updateResources(final Request request, Predicate predicate)
throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
- final Set<ServiceComponentRequest> requests = new HashSet<ServiceComponentRequest>();
+ final Set<ServiceComponentRequest> requests = new HashSet<>();
for (Map<String, Object> propertyMap : getPropertyMaps(request.getProperties().iterator().next(), predicate)) {
- ServiceComponentRequest compRequest = getRequest(propertyMap);
-
- requests.add(compRequest);
+ requests.add(getRequest(propertyMap));
}
Object queryParameterValue = getQueryParameterValue(QUERY_PARAMETERS_RUN_SMOKE_TEST_ID, predicate);
- final boolean runSmokeTest = queryParameterValue != null && queryParameterValue.equals("true");
+ final boolean runSmokeTest = TRUE.equals(queryParameterValue);
RequestStatusResponse response = modifyResources(new Command<RequestStatusResponse>() {
@Override
@@ -217,10 +212,10 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
protected RequestStatus deleteResourcesAuthorized(Predicate predicate)
throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
- final Set<ServiceComponentRequest> requests = new HashSet<ServiceComponentRequest>();
- for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) {
- requests.add(getRequest(propertyMap));
- }
+ final Set<ServiceComponentRequest> requests = new HashSet<>();
+ for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) {
+ requests.add(getRequest(propertyMap));
+ }
RequestStatusResponse response = modifyResources(new Command<RequestStatusResponse>() {
@Override
public RequestStatusResponse invoke() throws AmbariException, AuthorizationException {
@@ -260,8 +255,8 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
}
// Create the components for the given requests.
- public synchronized void createComponents(
- Set<ServiceComponentRequest> requests) throws AmbariException, AuthorizationException {
+ public synchronized void createComponents(Set<ServiceComponentRequest> requests)
+ throws AmbariException, AuthorizationException {
if (requests.isEmpty()) {
LOG.warn("Received an empty requests set");
@@ -273,106 +268,45 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
ServiceComponentFactory serviceComponentFactory = getManagementController().getServiceComponentFactory();
// do all validation checks
- Map<String, Map<String, Set<String>>> componentNames =
- new HashMap<String, Map<String, Set<String>>>();
- Set<String> duplicates = new HashSet<String>();
+ Map<String, Map<String, Set<String>>> componentNames = new HashMap<>();
+ Set<String> duplicates = new HashSet<>();
for (ServiceComponentRequest request : requests) {
- if (request.getClusterName() == null
- || request.getClusterName().isEmpty()
- || request.getComponentName() == null
- || request.getComponentName().isEmpty()) {
- throw new IllegalArgumentException("Invalid arguments"
- + ", clustername and componentname should be"
- + " non-null and non-empty when trying to create a"
- + " component");
- }
-
- Cluster cluster;
- try {
- cluster = clusters.getCluster(request.getClusterName());
- } catch (ClusterNotFoundException e) {
- throw new ParentObjectNotFoundException(
- "Attempted to add a component to a cluster which doesn't exist:", e);
- }
-
- if(!AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, cluster.getResourceId(), RoleAuthorization.SERVICE_ADD_DELETE_SERVICES)) {
- throw new AuthorizationException("The user is not authorized to create components");
- }
-
- if (request.getServiceName() == null
- || request.getServiceName().isEmpty()) {
- StackId stackId = cluster.getDesiredStackVersion();
- String serviceName =
- ambariMetaInfo.getComponentToService(stackId.getStackName(),
- stackId.getStackVersion(), request.getComponentName());
- if (LOG.isDebugEnabled()) {
- LOG.debug("Looking up service name for component"
- + ", componentName=" + request.getComponentName()
- + ", serviceName=" + serviceName);
- }
+ Validate.notEmpty(request.getComponentName(), "component name should be non-empty");
+ Cluster cluster = getClusterForRequest(request, clusters);
- if (serviceName == null
- || serviceName.isEmpty()) {
- throw new AmbariException("Could not find service for component"
- + ", componentName=" + request.getComponentName()
- + ", clusterName=" + cluster.getClusterName()
- + ", stackInfo=" + stackId.getStackId());
- }
- request.setServiceName(serviceName);
- }
+ isAuthorized(cluster, RoleAuthorization.SERVICE_ADD_DELETE_SERVICES);
- if (LOG.isDebugEnabled()) {
- LOG.debug("Received a createComponent request"
- + ", clusterName=" + request.getClusterName()
- + ", serviceName=" + request.getServiceName()
- + ", componentName=" + request.getComponentName()
- + ", request=" + request);
- }
+ setServiceNameIfAbsent(request, cluster, ambariMetaInfo);
+ debug("Received a createComponent request: {}", request);
if (!componentNames.containsKey(request.getClusterName())) {
- componentNames.put(request.getClusterName(),
- new HashMap<String, Set<String>>());
+ componentNames.put(request.getClusterName(), new HashMap<String, Set<String>>());
}
- if (!componentNames.get(request.getClusterName())
- .containsKey(request.getServiceName())) {
- componentNames.get(request.getClusterName()).put(
- request.getServiceName(), new HashSet<String>());
+ Map<String, Set<String>> serviceComponents = componentNames.get(request.getClusterName());
+ if (!serviceComponents.containsKey(request.getServiceName())) {
+ serviceComponents.put(request.getServiceName(), new HashSet<String>());
}
- if (componentNames.get(request.getClusterName())
- .get(request.getServiceName()).contains(request.getComponentName())) {
+
+ if (serviceComponents.get(request.getServiceName()).contains(request.getComponentName())) {
// throw error later for dup
- duplicates.add("[clusterName=" + request.getClusterName() + ", serviceName=" + request.getServiceName() +
- ", componentName=" + request.getComponentName() + "]");
+ duplicates.add(request.toString());
continue;
}
- componentNames.get(request.getClusterName())
- .get(request.getServiceName()).add(request.getComponentName());
+ serviceComponents.get(request.getServiceName()).add(request.getComponentName());
- if (request.getDesiredState() != null
- && !request.getDesiredState().isEmpty()) {
- State state = State.valueOf(request.getDesiredState());
- if (!state.isValidDesiredState()
- || state != State.INIT) {
- throw new IllegalArgumentException("Invalid desired state"
- + " only INIT state allowed during creation"
- + ", providedDesiredState=" + request.getDesiredState());
- }
+ if (StringUtils.isNotEmpty(request.getDesiredState())) {
+ Validate.isTrue(State.INIT == State.valueOf(request.getDesiredState()),
+ "Invalid desired state only INIT state allowed during creation, providedDesiredState=" + request.getDesiredState());
}
- Service s;
- try {
- s = cluster.getService(request.getServiceName());
- } catch (ServiceNotFoundException e) {
- throw new ParentObjectNotFoundException(
- "Attempted to add a component to a service which doesn't exist:", e);
- }
+ Service s = getServiceFromCluster(request, cluster);
+
try {
ServiceComponent sc = s.getServiceComponent(request.getComponentName());
if (sc != null) {
// throw error later for dup
- duplicates.add("[clusterName=" + request.getClusterName() + ", serviceName=" + request.getServiceName() +
- ", componentName=" + request.getComponentName() + "]");
+ duplicates.add(request.toString());
continue;
}
} catch (AmbariException e) {
@@ -383,50 +317,30 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
if (!ambariMetaInfo.isValidServiceComponent(stackId.getStackName(),
stackId.getStackVersion(), s.getName(), request.getComponentName())) {
throw new IllegalArgumentException("Unsupported or invalid component"
- + " in stack"
- + ", clusterName=" + request.getClusterName()
- + ", serviceName=" + request.getServiceName()
- + ", componentName=" + request.getComponentName()
- + ", stackInfo=" + stackId.getStackId());
+ + " in stack stackInfo=" + stackId.getStackId()
+ + " request=" + request.toString());
}
}
// ensure only a single cluster update
- if (componentNames.size() != 1) {
- throw new IllegalArgumentException("Invalid arguments, updates allowed"
- + "on only one cluster at a time");
- }
+ Validate.isTrue(componentNames.size() == 1,
+ "Invalid arguments, updates allowed on only one cluster at a time");
// Validate dups
if (!duplicates.isEmpty()) {
- StringBuilder names = new StringBuilder();
- boolean first = true;
- for (String cName : duplicates) {
- if (!first) {
- names.append(",");
- }
- first = false;
- names.append(cName);
- }
- String msg;
- if (duplicates.size() == 1) {
- msg = "Attempted to create a component which already exists: ";
- } else {
- msg = "Attempted to create components which already exist: ";
- }
- throw new DuplicateResourceException(msg + names.toString());
+ //Java8 has StringJoiner library but ambari is not on Java8 yet.
+ throw new DuplicateResourceException("Attempted to create one or more components which already exist:"
+ + StringUtils.join(duplicates, ","));
}
// now doing actual work
for (ServiceComponentRequest request : requests) {
Cluster cluster = clusters.getCluster(request.getClusterName());
Service s = cluster.getService(request.getServiceName());
- ServiceComponent sc = serviceComponentFactory.createNew(s,
- request.getComponentName());
+ ServiceComponent sc = serviceComponentFactory.createNew(s, request.getComponentName());
sc.setDesiredStackVersion(s.getDesiredStackVersion());
- if (request.getDesiredState() != null
- && !request.getDesiredState().isEmpty()) {
+ if (StringUtils.isNotEmpty(request.getDesiredState())) {
State state = State.valueOf(request.getDesiredState());
sc.setDesiredState(state);
} else {
@@ -439,10 +353,8 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
}
// Get the components for the given requests.
- protected Set<ServiceComponentResponse> getComponents(
- Set<ServiceComponentRequest> requests) throws AmbariException {
-
- Set<ServiceComponentResponse> response = new HashSet<ServiceComponentResponse>();
+ protected Set<ServiceComponentResponse> getComponents(Set<ServiceComponentRequest> requests) throws AmbariException {
+ Set<ServiceComponentResponse> response = new HashSet<>();
for (ServiceComponentRequest request : requests) {
try {
response.addAll(getComponents(request));
@@ -458,57 +370,21 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
}
// Get the components for the given request.
- private Set<ServiceComponentResponse> getComponents(
- ServiceComponentRequest request) throws AmbariException {
- if (request.getClusterName() == null
- || request.getClusterName().isEmpty()) {
- throw new IllegalArgumentException("Invalid arguments, cluster name"
- + " should be non-null");
- }
+ private Set<ServiceComponentResponse> getComponents(ServiceComponentRequest request) throws AmbariException {
- Clusters clusters = getManagementController().getClusters();
- AmbariMetaInfo ambariMetaInfo = getManagementController().getAmbariMetaInfo();
+ final AmbariMetaInfo ambariMetaInfo = getManagementController().getAmbariMetaInfo();
+ final Clusters clusters = getManagementController().getClusters();
+ final Cluster cluster = getCluster(request, clusters);
- final Cluster cluster;
- try {
- cluster = clusters.getCluster(request.getClusterName());
- } catch (ObjectNotFoundException e) {
- throw new ParentObjectNotFoundException("Parent Cluster resource doesn't exist", e);
- }
-
- Set<ServiceComponentResponse> response =
- new HashSet<ServiceComponentResponse>();
+ Set<ServiceComponentResponse> response = new HashSet<>();
String category = null;
StackId stackId = cluster.getDesiredStackVersion();
if (request.getComponentName() != null) {
- if (request.getServiceName() == null) {
- String serviceName =
- ambariMetaInfo.getComponentToService(stackId.getStackName(),
- stackId.getStackVersion(), request.getComponentName());
- if (LOG.isDebugEnabled()) {
- LOG.debug("Looking up service name for component"
- + ", componentName=" + request.getComponentName()
- + ", serviceName=" + serviceName);
- }
- if (serviceName == null
- || serviceName.isEmpty()) {
- throw new ObjectNotFoundException("Could not find service for component"
- + ", componentName=" + request.getComponentName()
- + ", clusterName=" + cluster.getClusterName()
- + ", stackInfo=" + stackId.getStackId());
- }
- request.setServiceName(serviceName);
- }
-
- final Service s;
- try {
- s = cluster.getService(request.getServiceName());
- } catch (ObjectNotFoundException e) {
- throw new ParentObjectNotFoundException("Parent Service resource doesn't exist", e);
- }
+ setServiceNameIfAbsent(request, cluster, ambariMetaInfo);
+ final Service s = getServiceFromCluster(request, cluster);
ServiceComponent sc = s.getServiceComponent(request.getComponentName());
ServiceComponentResponse serviceComponentResponse = sc.convertToResponse();
@@ -527,35 +403,18 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
return response;
}
- boolean checkDesiredState = false;
- State desiredStateToCheck = null;
- if (request.getDesiredState() != null
- && !request.getDesiredState().isEmpty()) {
- desiredStateToCheck = State.valueOf(request.getDesiredState());
- if (!desiredStateToCheck.isValidDesiredState()) {
- throw new IllegalArgumentException("Invalid arguments, invalid desired"
- + " state, desiredState=" + desiredStateToCheck);
- }
- checkDesiredState = true;
- }
-
- Set<Service> services = new HashSet<Service>();
- if (request.getServiceName() != null
- && !request.getServiceName().isEmpty()) {
- try {
- services.add(cluster.getService(request.getServiceName()));
- } catch (ObjectNotFoundException e) {
- throw new ParentObjectNotFoundException("Could not find service", e);
- }
+ Set<Service> services = new HashSet<>();
+ if (StringUtils.isNotEmpty(request.getServiceName())) {
+ services.add(getServiceFromCluster(request, cluster));
} else {
services.addAll(cluster.getServices().values());
}
+ final State desiredStateToCheck = getValidDesiredState(request);
for (Service s : services) {
// filter on request.getDesiredState()
for (ServiceComponent sc : s.getServiceComponents().values()) {
- if (checkDesiredState
- && (desiredStateToCheck != sc.getDesiredState())) {
+ if (desiredStateToCheck != null && desiredStateToCheck != sc.getDesiredState()) {
// skip non matching state
continue;
}
@@ -572,8 +431,7 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
// component doesn't exist, nothing to do
}
String requestedCategory = request.getComponentCategory();
- if (requestedCategory != null && !requestedCategory.isEmpty() &&
- category != null && !requestedCategory.equalsIgnoreCase(category)) {
+ if (StringUtils.isNotEmpty(requestedCategory) && !requestedCategory.equalsIgnoreCase(category)) {
continue;
}
@@ -585,7 +443,8 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
// Update the components for the given requests.
protected synchronized RequestStatusResponse updateComponents(Set<ServiceComponentRequest> requests,
- Map<String, String> requestProperties, boolean runSmokeTest)
+ Map<String, String> requestProperties,
+ boolean runSmokeTest)
throws AmbariException, AuthorizationException {
if (requests.isEmpty()) {
@@ -593,21 +452,16 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
return null;
}
- AmbariManagementController controller = getManagementController();
- Clusters clusters = controller.getClusters();
- AmbariMetaInfo ambariMetaInfo = controller.getAmbariMetaInfo();
+ Clusters clusters = getManagementController().getClusters();
+ AmbariMetaInfo ambariMetaInfo = getManagementController().getAmbariMetaInfo();
- Map<State, List<ServiceComponent>> changedComps =
- new HashMap<State, List<ServiceComponent>>();
- Map<String, Map<State, List<ServiceComponentHost>>> changedScHosts =
- new HashMap<String, Map<State, List<ServiceComponentHost>>>();
- Collection<ServiceComponentHost> ignoredScHosts =
- new ArrayList<ServiceComponentHost>();
+ Map<State, List<ServiceComponent>> changedComps = new HashMap<>();
+ Map<String, Map<State, List<ServiceComponentHost>>> changedScHosts = new HashMap<>();
+ Collection<ServiceComponentHost> ignoredScHosts = new ArrayList<>();
- Set<String> clusterNames = new HashSet<String>();
- Map<String, Map<String, Set<String>>> componentNames =
- new HashMap<String, Map<String,Set<String>>>();
- Set<State> seenNewStates = new HashSet<State>();
+ Set<String> clusterNames = new HashSet<>();
+ Map<String, Map<String, Set<String>>> componentNames = new HashMap<>();
+ Set<State> seenNewStates = new HashSet<>();
// Determine operation level
Resource.Type reqOpLvl;
@@ -615,101 +469,42 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
RequestOperationLevel operationLevel = new RequestOperationLevel(requestProperties);
reqOpLvl = operationLevel.getLevel();
} else {
- String message = "Can not determine request operation level. " +
- "Operation level property should " +
- "be specified for this request.";
- LOG.warn(message);
+ LOG.warn("Can not determine request operation level. Operation level property should be specified for this request.");
reqOpLvl = Resource.Type.Cluster;
}
for (ServiceComponentRequest request : requests) {
+ Validate.notEmpty(request.getComponentName(), "component name should be non-empty");
+ final Cluster cluster = getClusterForRequest(request, clusters);
final String clusterName = request.getClusterName();
- String componentName = request.getComponentName();
- if (clusterName == null
- || clusterName.isEmpty()
- || componentName == null
- || componentName.isEmpty()) {
- throw new IllegalArgumentException("Invalid arguments, cluster name"
- + ", service name and component name should be provided to"
- + " update components");
- }
+ final String componentName = request.getComponentName();
- String serviceName = request.getServiceName();
- LOG.info("Received a updateComponent request"
- + ", clusterName=" + clusterName
- + ", serviceName=" + serviceName
- + ", componentName=" + componentName
- + ", request=" + request.toString());
-
- Cluster cluster = clusters.getCluster(clusterName);
-
- if (serviceName == null
- || serviceName.isEmpty()) {
- StackId stackId = cluster.getDesiredStackVersion();
- String alternativeServiceName =
- ambariMetaInfo.getComponentToService(stackId.getStackName(),
- stackId.getStackVersion(), componentName);
- if (LOG.isDebugEnabled()) {
- LOG.debug("Looking up service name for component"
- + ", componentName=" + componentName
- + ", serviceName=" + alternativeServiceName);
- }
+ LOG.info("Received a updateComponent request: {}", request);
- if (alternativeServiceName == null
- || alternativeServiceName.isEmpty()) {
- throw new AmbariException("Could not find service for component"
- + ", componentName=" + componentName
- + ", clusterName=" + cluster.getClusterName()
- + ", stackInfo=" + stackId.getStackId());
- }
- request.setServiceName(alternativeServiceName);
- serviceName = alternativeServiceName;
- }
+ setServiceNameIfAbsent(request, cluster, ambariMetaInfo);
+ final String serviceName = request.getServiceName();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Received a updateComponent request"
- + ", clusterName=" + clusterName
- + ", serviceName=" + serviceName
- + ", componentName=" + componentName
- + ", request=" + request);
- }
+ debug("Received a updateComponent request: {}", request);
clusterNames.add(clusterName);
- if (clusterNames.size() > 1) {
- // FIXME throw correct error
- throw new IllegalArgumentException("Updates to multiple clusters is not"
- + " supported");
- }
+ Validate.isTrue(clusterNames.size() == 1, "Updates to multiple clusters is not supported");
if (!componentNames.containsKey(clusterName)) {
- componentNames.put(clusterName,
- new HashMap<String, Set<String>>());
+ componentNames.put(clusterName, new HashMap<String, Set<String>>());
}
- if (!componentNames.get(clusterName)
- .containsKey(serviceName)) {
- componentNames.get(clusterName).put(
- serviceName, new HashSet<String>());
+ if (!componentNames.get(clusterName).containsKey(serviceName)) {
+ componentNames.get(clusterName).put(serviceName, new HashSet<String>());
}
- if (componentNames.get(clusterName)
- .get(serviceName).contains(componentName)){
+ if (componentNames.get(clusterName).get(serviceName).contains(componentName)){
// throw error later for dup
- throw new IllegalArgumentException("Invalid request contains duplicate"
- + " service components");
+ throw new IllegalArgumentException("Invalid request contains duplicate service components");
}
- componentNames.get(clusterName)
- .get(serviceName).add(componentName);
+ componentNames.get(clusterName).get(serviceName).add(componentName);
Service s = cluster.getService(serviceName);
ServiceComponent sc = s.getServiceComponent(componentName);
- State newState = null;
- if (request.getDesiredState() != null) {
- newState = State.valueOf(request.getDesiredState());
- if (!newState.isValidDesiredState()) {
- throw new IllegalArgumentException("Invalid arguments, invalid"
- + " desired state, desiredState=" + newState.toString());
- }
- }
+ State newState = getValidDesiredState(request);
if (! maintenanceStateHelper.isOperationAllowed(reqOpLvl, s)) {
LOG.info("Operations cannot be applied to component " + componentName
@@ -719,20 +514,12 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
}
if (newState == null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Nothing to do for new updateServiceComponent request"
- + ", clusterName=" + clusterName
- + ", serviceName=" + serviceName
- + ", componentName=" + componentName
- + ", newDesiredState=null");
- }
+ debug("Nothing to do for new updateServiceComponent request, request ={}, newDesiredState=null" + request);
continue;
}
- if (sc.isClientComponent() &&
- !newState.isValidClientComponentState()) {
- throw new AmbariException("Invalid desired state for a client"
- + " component");
+ if (sc.isClientComponent() && !newState.isValidClientComponentState()) {
+ throw new AmbariException("Invalid desired state for a client component");
}
seenNewStates.add(newState);
@@ -740,9 +527,8 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
State oldScState = sc.getDesiredState();
if (newState != oldScState) {
// The if user is trying to start or stop the component, ensure authorization
- if (((newState == State.INSTALLED) || (newState == State.STARTED)) &&
- !AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, cluster.getResourceId(), RoleAuthorization.SERVICE_START_STOP)) {
- throw new AuthorizationException("The authenticated user is not authorized to start or stop components of services");
+ if (((newState == State.INSTALLED) || (newState == State.STARTED))) {
+ isAuthorized(cluster, RoleAuthorization.SERVICE_START_STOP);
}
if (!State.isValidDesiredStateTransition(oldScState, newState)) {
@@ -759,56 +545,50 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
if (!changedComps.containsKey(newState)) {
changedComps.put(newState, new ArrayList<ServiceComponent>());
}
- if (LOG.isDebugEnabled()) {
- LOG.debug("Handling update to ServiceComponent"
+ debug("Handling update to ServiceComponent"
+ ", clusterName=" + clusterName
+ ", serviceName=" + serviceName
+ ", componentName=" + sc.getName()
+ ", currentDesiredState=" + oldScState
+ ", newDesiredState=" + newState);
- }
+
changedComps.get(newState).add(sc);
}
for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
State oldSchState = sch.getState();
if (oldSchState == State.DISABLED || oldSchState == State.UNKNOWN) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Ignoring ServiceComponentHost"
+ debug("Ignoring ServiceComponentHost"
+ ", clusterName=" + clusterName
+ ", serviceName=" + serviceName
+ ", componentName=" + sc.getName()
+ ", hostname=" + sch.getHostName()
+ ", currentState=" + oldSchState
+ ", newDesiredState=" + newState);
- }
continue;
}
if (newState == oldSchState) {
ignoredScHosts.add(sch);
- if (LOG.isDebugEnabled()) {
- LOG.debug("Ignoring ServiceComponentHost"
+ debug("Ignoring ServiceComponentHost"
+ ", clusterName=" + clusterName
+ ", serviceName=" + serviceName
+ ", componentName=" + sc.getName()
+ ", hostname=" + sch.getHostName()
+ ", currentState=" + oldSchState
+ ", newDesiredState=" + newState);
- }
continue;
}
// do not update or alter any HC that is not active
if (! maintenanceStateHelper.isOperationAllowed(reqOpLvl, sch)) {
ignoredScHosts.add(sch);
- if (LOG.isDebugEnabled()) {
- LOG.debug("Ignoring ServiceComponentHost in maintenance state"
+ debug("Ignoring ServiceComponentHost in maintenance state"
+ ", clusterName=" + clusterName
+ ", serviceName=" + serviceName
+ ", componentName=" + sc.getName()
+ ", hostname=" + sch.getHostName());
- }
+
continue;
}
@@ -825,31 +605,26 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
+ ", newDesiredState=" + newState);
}
if (!changedScHosts.containsKey(sc.getName())) {
- changedScHosts.put(sc.getName(),
- new HashMap<State, List<ServiceComponentHost>>());
+ changedScHosts.put(sc.getName(), new HashMap<State, List<ServiceComponentHost>>());
}
if (!changedScHosts.get(sc.getName()).containsKey(newState)) {
- changedScHosts.get(sc.getName()).put(newState,
- new ArrayList<ServiceComponentHost>());
+ changedScHosts.get(sc.getName()).put(newState, new ArrayList<ServiceComponentHost>());
}
- if (LOG.isDebugEnabled()) {
- LOG.debug("Handling update to ServiceComponentHost"
+
+ debug("Handling update to ServiceComponentHost"
+ ", clusterName=" + clusterName
+ ", serviceName=" + serviceName
+ ", componentName=" + sc.getName()
+ ", hostname=" + sch.getHostName()
+ ", currentState=" + oldSchState
+ ", newDesiredState=" + newState);
- }
+
changedScHosts.get(sc.getName()).get(newState).add(sch);
}
}
- if (seenNewStates.size() > 1) {
- // FIXME should we handle this scenario
- throw new IllegalArgumentException("Cannot handle different desired"
- + " state changes for a set of service components at the same time");
- }
+ Validate.isTrue(seenNewStates.size() <= 1,
+ "Cannot handle different desired state changes for a set of service components at the same time");
// TODO additional validation?
@@ -860,87 +635,112 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
}
protected RequestStatusResponse deleteComponents(Set<ServiceComponentRequest> requests) throws AmbariException, AuthorizationException {
- AmbariManagementController controller = getManagementController();
- Clusters clusters = controller.getClusters();
- AmbariMetaInfo ambariMetaInfo = controller.getAmbariMetaInfo();
+ Clusters clusters = getManagementController().getClusters();
+ AmbariMetaInfo ambariMetaInfo = getManagementController().getAmbariMetaInfo();
for (ServiceComponentRequest request : requests) {
+ Validate.notEmpty(request.getComponentName(), "component name should be non-empty");
+ Cluster cluster = getClusterForRequest(request, clusters);
- if (request.getClusterName() == null || request.getClusterName().isEmpty()
- || request.getComponentName() == null || request.getComponentName().isEmpty()) {
- throw new IllegalArgumentException("Invalid arguments"
- + ", clustername and componentname should be"
- + " non-null and non-empty when trying to create a"
- + " component");
- }
+ setServiceNameIfAbsent(request, cluster, ambariMetaInfo);
- Cluster cluster;
- try {
- cluster = clusters.getCluster(request.getClusterName());
- } catch (ClusterNotFoundException e) {
- throw new ParentObjectNotFoundException(
- "Attempted to add a component to a cluster which doesn't exist:", e);
+ Service s = getServiceFromCluster(request, cluster);
+
+ ServiceComponent sc = s.getServiceComponent(request.getComponentName());
+
+ if (sc != null) {
+ deleteHostComponentsForServiceComponent(sc, request);
+ sc.setDesiredState(State.DISABLED);
+ s.deleteServiceComponent(request.getComponentName());
}
+ }
+ return null;
+ }
+
+ private void deleteHostComponentsForServiceComponent(ServiceComponent sc, ServiceComponentRequest request) throws AmbariException {
+ for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
+ if (!sch.getDesiredState().isRemovableState()) {
+ throw new AmbariException("Found non removable host component when trying to delete service component." +
+ " To remove host component, it must be in DISABLED/INIT/INSTALLED/INSTALL_FAILED/UNKNOWN" +
+ "/UNINSTALLED/INSTALLING state."
+ + ", request=" + request.toString()
+ + ", current state=" + sc.getDesiredState() + ".");
- if(!AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, cluster.getResourceId(), RoleAuthorization.SERVICE_ADD_DELETE_SERVICES)) {
- throw new AuthorizationException("The user is not authorized to delete components");
}
+ }
- if (request.getServiceName() == null || request.getServiceName().isEmpty()) {
- StackId stackId = cluster.getDesiredStackVersion();
- String serviceName = ambariMetaInfo.getComponentToService(stackId.getStackName(),
- stackId.getStackVersion(), request.getComponentName());
- if (LOG.isDebugEnabled()) {
- LOG.debug("Looking up service name for component"
- + ", componentName=" + request.getComponentName()
- + ", serviceName=" + serviceName);
- }
+ for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
+ sch.delete();
+ }
+ }
+ private Cluster getClusterForRequest(final ServiceComponentRequest request, final Clusters clusters) throws AmbariException {
+ Validate.notEmpty(request.getClusterName(), "cluster name should be non-empty");
+ try {
+ return clusters.getCluster(request.getClusterName());
+ } catch (ClusterNotFoundException e) {
+ throw new ParentObjectNotFoundException("Attempted to add a component to a cluster which doesn't exist:", e);
+ }
+ }
- if (serviceName == null || serviceName.isEmpty()) {
- throw new AmbariException("Could not find service for component"
- + ", componentName=" + request.getComponentName()
- + ", clusterName=" + cluster.getClusterName()
- + ", stackInfo=" + stackId.getStackId());
- }
- request.setServiceName(serviceName);
- }
+ private Service getServiceFromCluster(final ServiceComponentRequest request, final Cluster cluster) throws AmbariException {
+ try {
+ return cluster.getService(request.getServiceName());
+ } catch (ServiceNotFoundException e) {
+ throw new ParentObjectNotFoundException("Parent Service resource doesn't exist.", e);
+ }
+ }
- Service s;
- try {
- s = cluster.getService(request.getServiceName());
- } catch (ServiceNotFoundException e) {
- throw new ParentObjectNotFoundException(
- "Attempted to add a component to a service which doesn't exist:", e);
- }
+ private Cluster getCluster(final ServiceComponentRequest request, final Clusters clusters) throws AmbariException {
+ Validate.notEmpty(request.getClusterName(), "cluster name should be non-empty");
- ServiceComponent sc = s.getServiceComponent(request.getComponentName());
- if (sc != null) {
- if (!sc.getDesiredState().isRemovableState()) {
- throw new AmbariException("Could not delete service component from cluster. To remove service component," +
- " it must be in DISABLED/INIT/INSTALLED/INSTALL_FAILED/UNKNOWN/UNINSTALLED/INSTALLING state."
- + ", clusterName=" + request.getClusterName()
- + ", serviceName=" + request.getServiceName()
- + ", componentName=" + request.getComponentName()
- + ", current state=" + sc.getDesiredState() + ".");
- }
+ try {
+ return clusters.getCluster(request.getClusterName());
+ } catch (ObjectNotFoundException e) {
+ throw new ParentObjectNotFoundException("Parent Cluster resource doesn't exist", e);
+ }
- for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
- if (!sch.getDesiredState().isRemovableState()) {
- throw new AmbariException("Found non removable host component when trying to delete service component." +
- " To remove host component, it must be in DISABLED/INIT/INSTALLED/INSTALL_FAILED/UNKNOWN" +
- "/UNINSTALLED/INSTALLING state."
- + ", clusterName=" + request.getClusterName()
- + ", serviceName=" + request.getServiceName()
- + ", componentName=" + request.getComponentName()
- + ", current state=" + sc.getDesiredState() + ".");
+ }
- }
- }
+ private void isAuthorized(final Cluster cluster, final RoleAuthorization roleAuthorization) throws AuthorizationException {
+ if (!AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, cluster.getResourceId(), roleAuthorization)) {
+ throw new AuthorizationException("The user is not authorized to for role " + roleAuthorization.name());
+ }
+ }
- s.deleteServiceComponent(request.getComponentName());
+ private void setServiceNameIfAbsent(final ServiceComponentRequest request,
+ final Cluster cluster,
+ final AmbariMetaInfo ambariMetaInfo) throws AmbariException {
+ if (StringUtils.isEmpty(request.getServiceName())) {
+ StackId stackId = cluster.getDesiredStackVersion();
+ String componentName = request.getComponentName();
+ String serviceName = ambariMetaInfo.getComponentToService(stackId.getStackName(),
+ stackId.getStackVersion(), componentName);
+ debug("Looking up service name for component, componentName={}, serviceName={}", componentName, serviceName);
+
+ if (StringUtils.isEmpty(serviceName)) {
+ throw new AmbariException("Could not find service for component"
+ + ", componentName=" + request.getComponentName()
+ + ", clusterName=" + cluster.getClusterName()
+ + ", stackInfo=" + stackId.getStackId());
}
+ request.setServiceName(serviceName);
}
- return null;
}
-}
+ private State getValidDesiredState(ServiceComponentRequest request) {
+
+ if (StringUtils.isEmpty(request.getDesiredState())) {
+ return null;
+ }
+ final State desiredStateToCheck = State.valueOf(request.getDesiredState());
+ Validate.isTrue(desiredStateToCheck.isValidDesiredState(),
+ "Invalid arguments, invalid desired state, desiredState=" + desiredStateToCheck);
+ return desiredStateToCheck;
+ }
+
+ private void debug(String format, Object... arguments) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(format, arguments);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b328f6db/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
index 6ec27ad..f38fab1 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
@@ -58,6 +58,7 @@ import org.apache.ambari.server.controller.spi.Predicate;
import org.apache.ambari.server.controller.spi.Request;
import org.apache.ambari.server.controller.spi.Resource;
import org.apache.ambari.server.controller.spi.ResourceProvider;
+import org.apache.ambari.server.controller.spi.SystemException;
import org.apache.ambari.server.controller.utilities.PredicateBuilder;
import org.apache.ambari.server.controller.utilities.PropertyHelper;
import org.apache.ambari.server.security.TestAuthenticationFactory;
@@ -88,6 +89,10 @@ import org.springframework.security.core.context.SecurityContextHolder;
*/
public class ComponentResourceProviderTest {
+ private static final long CLUSTER_ID = 100;
+ private static final String CLUSTER_NAME = "Cluster100";
+ private static final String SERVICE_NAME = "Service100";
+
@Before
public void clearAuthentication() {
SecurityContextHolder.getContext().setAuthentication(null);
@@ -426,20 +431,26 @@ public class ComponentResourceProviderTest {
@Test
public void testSuccessDeleteResourcesAsAdministrator() throws Exception {
- testSuccessDeleteResources(TestAuthenticationFactory.createAdministrator());
+ testSuccessDeleteResources(TestAuthenticationFactory.createAdministrator(), State.INSTALLED);
}
@Test
public void testSuccessDeleteResourcesAsClusterAdministrator() throws Exception {
- testSuccessDeleteResources(TestAuthenticationFactory.createClusterAdministrator());
+ testSuccessDeleteResources(TestAuthenticationFactory.createClusterAdministrator(), State.INSTALLED);
}
+
@Test(expected = AuthorizationException.class)
- public void testSuccessDeleteResourcesAsServiceAdministrator() throws Exception {
- testSuccessDeleteResources(TestAuthenticationFactory.createServiceAdministrator());
+ public void testDeleteResourcesAsServiceAdministrator() throws Exception {
+ testSuccessDeleteResources(TestAuthenticationFactory.createServiceAdministrator(), State.INSTALLED);
}
- private void testSuccessDeleteResources(Authentication authentication) throws Exception {
+ @Test(expected = SystemException.class)
+ public void testDeleteResourcesWithStartedHostComponentState() throws Exception {
+ testSuccessDeleteResources(TestAuthenticationFactory.createAdministrator(), State.STARTED);
+ }
+
+ private void testSuccessDeleteResources(Authentication authentication, State hostComponentState) throws Exception {
Resource.Type type = Resource.Type.Component;
AmbariManagementController managementController = createMock(AmbariManagementController.class);
@@ -453,22 +464,22 @@ public class ComponentResourceProviderTest {
ServiceComponentHost serviceComponentHost = createNiceMock(ServiceComponentHost.class);
StackId stackId = createNiceMock(StackId.class);
- Map<String, ServiceComponentHost> serviceComponentHosts = new HashMap<String, ServiceComponentHost>();
+ Map<String, ServiceComponentHost> serviceComponentHosts = new HashMap<>();
serviceComponentHosts.put("", serviceComponentHost);
expect(managementController.getClusters()).andReturn(clusters);
expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo);
- expect(clusters.getCluster("Cluster100")).andReturn(cluster);
- expect(cluster.getService("Service100")).andReturn(service);
- expect(cluster.getClusterId()).andReturn(2L).anyTimes();
+ expect(clusters.getCluster(CLUSTER_NAME)).andReturn(cluster);
+ expect(cluster.getService(SERVICE_NAME)).andReturn(service);
+ expect(cluster.getClusterId()).andReturn(CLUSTER_ID).anyTimes();
expect(service.getServiceComponent("Component100")).andReturn(serviceComponent);
- expect(serviceComponent.getDesiredState()).andReturn(State.INSTALLED);
- expect(serviceComponent.getServiceComponentHosts()).andReturn(serviceComponentHosts);
+ expect(serviceComponent.getDesiredState()).andReturn(State.STARTED);
+ expect(serviceComponent.getServiceComponentHosts()).andReturn(serviceComponentHosts).anyTimes();
- expect(serviceComponentHost.getDesiredState()).andReturn(State.INSTALLED);
+ expect(serviceComponentHost.getDesiredState()).andReturn(hostComponentState);
service.deleteServiceComponent("Component100");
@@ -579,178 +590,6 @@ public class ComponentResourceProviderTest {
verify(managementController);
}
- @Test
- public void testDeleteResourcesWithServiceComponentStartedAsAdministrator() throws Exception {
- testDeleteResourcesWithServiceComponentStarted(TestAuthenticationFactory.createAdministrator());
- }
-
- @Test
- public void testDeleteResourcesWithServiceComponentStartedAsClusterAdministrator() throws Exception {
- testDeleteResourcesWithServiceComponentStarted(TestAuthenticationFactory.createClusterAdministrator());
- }
-
- @Test(expected = AuthorizationException.class)
- public void testDeleteResourcesWithServiceComponentStartedAsServiceAdministrator() throws Exception {
- testDeleteResourcesWithServiceComponentStarted(TestAuthenticationFactory.createServiceAdministrator());
- }
-
- private void testDeleteResourcesWithServiceComponentStarted(Authentication authentication) throws Exception {
- Resource.Type type = Resource.Type.Component;
-
- AmbariManagementController managementController = createMock(AmbariManagementController.class);
- MaintenanceStateHelper maintenanceStateHelper = createNiceMock(MaintenanceStateHelper.class);
-
- Clusters clusters = createNiceMock(Clusters.class);
- Cluster cluster = createNiceMock(Cluster.class);
- Service service = createNiceMock(Service.class);
- AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class);
- ServiceComponent serviceComponent = createNiceMock(ServiceComponent.class);
- ServiceComponentHost serviceComponentHost = createNiceMock(ServiceComponentHost.class);
- StackId stackId = createNiceMock(StackId.class);
-
- Map<String, ServiceComponentHost> serviceComponentHosts = new HashMap<String, ServiceComponentHost>();
- serviceComponentHosts.put("", serviceComponentHost);
-
- expect(managementController.getClusters()).andReturn(clusters);
- expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo);
-
- expect(clusters.getCluster("Cluster100")).andReturn(cluster);
- expect(cluster.getService("Service100")).andReturn(service);
- expect(cluster.getClusterId()).andReturn(2L).anyTimes();
-
- expect(service.getServiceComponent("Component100")).andReturn(serviceComponent);
-
- expect(serviceComponent.getDesiredState()).andReturn(State.STARTED);
- expect(serviceComponent.getServiceComponentHosts()).andReturn(serviceComponentHosts);
-
- expect(serviceComponentHost.getDesiredState()).andReturn(State.INSTALLED);
-
-
- // replay
- replay(managementController, clusters, cluster, service, stackId, ambariMetaInfo,
- serviceComponent, serviceComponentHost, maintenanceStateHelper);
-
- SecurityContextHolder.getContext().setAuthentication(authentication);
-
- ResourceProvider provider = new ComponentResourceProvider(
- PropertyHelper.getPropertyIds(type),
- PropertyHelper.getKeyPropertyIds(type),
- managementController, maintenanceStateHelper);
-
- AbstractResourceProviderTest.TestObserver observer = new AbstractResourceProviderTest.TestObserver();
-
- ((ObservableResourceProvider)provider).addObserver(observer);
-
- Predicate predicate = new PredicateBuilder()
- .property(ComponentResourceProvider.COMPONENT_CLUSTER_NAME_PROPERTY_ID)
- .equals("Cluster100")
- .and()
- .property(ComponentResourceProvider.COMPONENT_SERVICE_NAME_PROPERTY_ID)
- .equals("Service100")
- .and()
- .property(ComponentResourceProvider.COMPONENT_COMPONENT_NAME_PROPERTY_ID)
- .equals("Component100").toPredicate();
-
- try {
- provider.deleteResources(predicate);
- Assert.fail("Expected exception.");
- } catch(Exception e) {
- if (e instanceof AuthorizationException) {
- throw e;
- }
- //expected
- }
-
- // verify
- verify(managementController);
- }
-
- @Test
- public void testDeleteResourcesWithServiceComponentHostStartedAsAdministrator() throws Exception {
- testDeleteResourcesWithServiceComponentHostStarted(TestAuthenticationFactory.createAdministrator());
- }
-
- @Test
- public void testDeleteResourcesWithServiceComponentHostStartedAsClusterAdministrator() throws Exception {
- testDeleteResourcesWithServiceComponentHostStarted(TestAuthenticationFactory.createClusterAdministrator());
- }
-
- @Test(expected = AuthorizationException.class)
- public void testDeleteResourcesWithServiceComponentHostStartedAsServiceAdministrator() throws Exception {
- testDeleteResourcesWithServiceComponentHostStarted(TestAuthenticationFactory.createServiceAdministrator());
- }
-
- private void testDeleteResourcesWithServiceComponentHostStarted(Authentication authentication) throws Exception {
- Resource.Type type = Resource.Type.Component;
-
- AmbariManagementController managementController = createMock(AmbariManagementController.class);
- MaintenanceStateHelper maintenanceStateHelper = createNiceMock(MaintenanceStateHelper.class);
-
- Clusters clusters = createNiceMock(Clusters.class);
- Cluster cluster = createNiceMock(Cluster.class);
- Service service = createNiceMock(Service.class);
- AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class);
- ServiceComponent serviceComponent = createNiceMock(ServiceComponent.class);
- ServiceComponentHost serviceComponentHost = createNiceMock(ServiceComponentHost.class);
- StackId stackId = createNiceMock(StackId.class);
-
- Map<String, ServiceComponentHost> serviceComponentHosts = new HashMap<String, ServiceComponentHost>();
- serviceComponentHosts.put("", serviceComponentHost);
-
- expect(managementController.getClusters()).andReturn(clusters);
- expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo);
-
- expect(clusters.getCluster("Cluster100")).andReturn(cluster);
- expect(cluster.getService("Service100")).andReturn(service);
- expect(cluster.getClusterId()).andReturn(2L).anyTimes();
-
- expect(service.getServiceComponent("Component100")).andReturn(serviceComponent);
-
- expect(serviceComponent.getDesiredState()).andReturn(State.INSTALLED);
- expect(serviceComponent.getServiceComponentHosts()).andReturn(serviceComponentHosts);
-
- expect(serviceComponentHost.getDesiredState()).andReturn(State.STARTED);
-
-
- // replay
- replay(managementController, clusters, cluster, service, stackId, ambariMetaInfo,
- serviceComponent, serviceComponentHost, maintenanceStateHelper);
-
- SecurityContextHolder.getContext().setAuthentication(authentication);
-
- ResourceProvider provider = new ComponentResourceProvider(
- PropertyHelper.getPropertyIds(type),
- PropertyHelper.getKeyPropertyIds(type),
- managementController,maintenanceStateHelper);
-
- AbstractResourceProviderTest.TestObserver observer = new AbstractResourceProviderTest.TestObserver();
-
- ((ObservableResourceProvider)provider).addObserver(observer);
-
- Predicate predicate = new PredicateBuilder()
- .property(ComponentResourceProvider.COMPONENT_CLUSTER_NAME_PROPERTY_ID)
- .equals("Cluster100")
- .and()
- .property(ComponentResourceProvider.COMPONENT_SERVICE_NAME_PROPERTY_ID)
- .equals("Service100")
- .and()
- .property(ComponentResourceProvider.COMPONENT_COMPONENT_NAME_PROPERTY_ID)
- .equals("Component100").toPredicate();
-
- try {
- provider.deleteResources(predicate);
- Assert.fail("Expected exception.");
- } catch(Exception e) {
- if (e instanceof AuthorizationException) {
- throw e;
- }
- //expected
- }
-
- // verify
- verify(managementController);
- }
-
@Test
public void testGetComponents() throws Exception {
@@ -810,7 +649,7 @@ public class ComponentResourceProviderTest {
* case when an OR predicate is provided in the query.
*/
@Test
- public void testGetComponents___OR_Predicate_ServiceComponentNotFoundException() throws Exception {
+ public void testGetComponents_OR_Predicate_ServiceComponentNotFoundException() throws Exception {
// member state mocks
AmbariManagementController managementController = createMock(AmbariManagementController.class);
Clusters clusters = createNiceMock(Clusters.class);
@@ -908,7 +747,7 @@ public class ComponentResourceProviderTest {
* Ensure that ServiceComponentNotFoundException is propagated in case where there is a single request.
*/
@Test
- public void testGetComponents___ServiceComponentNotFoundException() throws Exception {
+ public void testGetComponents_ServiceComponentNotFoundException() throws Exception {
// member state mocks
Injector injector = createStrictMock(Injector.class);
Capture<AmbariManagementController> controllerCapture = EasyMock.newCapture();
@@ -953,7 +792,7 @@ public class ComponentResourceProviderTest {
assertSame(controller, controllerCapture.getValue());
verify(injector, clusters, cluster, service);
}
-
+
public static void createComponents(AmbariManagementController controller, Set<ServiceComponentRequest> requests)
throws AmbariException, AuthorizationException {
ComponentResourceProvider provider = getComponentResourceProvider(controller);
[20/50] [abbrv] ambari git commit: AMBARI-14479. Namenode start fails
when time taken to get out of safemode is more than 20 minutes. (additional
patch) (dlysnichenko)
Posted by nc...@apache.org.
AMBARI-14479. Namenode start fails when time taken to get out of safemode is more than 20 minutes. (additional patch) (dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/376fc6ff
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/376fc6ff
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/376fc6ff
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 376fc6ffccab683b9f83f825762e0ef2efaf0d82
Parents: 2b9bfd9
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Tue Dec 29 14:23:12 2015 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Tue Dec 29 14:23:12 2015 +0200
----------------------------------------------------------------------
.../2.1.0.2.0/package/scripts/hdfs_namenode.py | 49 ++++++++++++++------
.../HDFS/2.1.0.2.0/package/scripts/namenode.py | 36 +-------------
.../python/stacks/2.0.6/HDFS/test_namenode.py | 18 +++----
3 files changed, 47 insertions(+), 56 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/376fc6ff/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_namenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_namenode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_namenode.py
index 8fa0a35..12ca1ad 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_namenode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_namenode.py
@@ -42,6 +42,40 @@ from utils import service, safe_zkfc_op, is_previous_fs_image
from setup_ranger_hdfs import setup_ranger_hdfs, create_ranger_audit_hdfs_directories
+def wait_for_safemode_off(hdfs_binary, afterwait_sleep=0, execute_kinit=False):
+ """
+ During NonRolling (aka Express Upgrade), after starting NameNode, which is still in safemode, and then starting
+ all of the DataNodes, we need for NameNode to receive all of the block reports and leave safemode.
+ If HA is present, then this command will run individually on each NameNode, which checks for its own address.
+ """
+ import params
+
+ Logger.info("Wait to leafe safemode since must transition from ON to OFF.")
+
+ if params.security_enabled and execute_kinit:
+ kinit_command = format("{params.kinit_path_local} -kt {params.hdfs_user_keytab} {params.hdfs_principal_name}")
+ Execute(kinit_command, user=params.hdfs_user, logoutput=True)
+
+ try:
+ # Note, this fails if namenode_address isn't prefixed with "params."
+
+ dfsadmin_base_command = get_dfsadmin_base_command(hdfs_binary, use_specific_namenode=True)
+ is_namenode_safe_mode_off = dfsadmin_base_command + " -safemode get | grep 'Safe mode is OFF'"
+
+ # Wait up to 30 mins
+ Execute(is_namenode_safe_mode_off,
+ tries=115,
+ try_sleep=10,
+ user=params.hdfs_user,
+ logoutput=True
+ )
+
+ # Wait a bit more since YARN still depends on block reports coming in.
+ # Also saw intermittent errors with HBASE service check if it was done too soon.
+ time.sleep(afterwait_sleep)
+ except Fail:
+ Logger.error("NameNode is still in safemode, please be careful with commands that need safemode OFF.")
+
@OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
def namenode(action=None, hdfs_binary=None, do_format=True, upgrade_type=None, env=None):
if action is None:
@@ -115,8 +149,7 @@ def namenode(action=None, hdfs_binary=None, do_format=True, upgrade_type=None, e
if params.security_enabled:
Execute(format("{kinit_path_local} -kt {hdfs_user_keytab} {hdfs_principal_name}"),
user = params.hdfs_user)
- dfsadmin_base_command = get_dfsadmin_base_command(hdfs_binary, use_specific_namenode=True)
- is_namenode_safe_mode_off = dfsadmin_base_command + " -safemode get | grep 'Safe mode is OFF'"
+
if params.dfs_ha_enabled:
is_active_namenode_cmd = as_user(format("{hdfs_binary} --config {hadoop_conf_dir} haadmin -getServiceState {namenode_id} | grep active"), params.hdfs_user, env={'PATH':params.hadoop_bin_dir})
else:
@@ -164,17 +197,7 @@ def namenode(action=None, hdfs_binary=None, do_format=True, upgrade_type=None, e
if check_for_safemode_off:
Logger.info("Stay in safe mode: {0}".format(stay_in_safe_mode))
if not stay_in_safe_mode:
- Logger.info("Wait to leafe safemode since must transition from ON to OFF.")
- try:
- # Wait up to 30 mins
- Execute(is_namenode_safe_mode_off,
- tries=65,
- try_sleep=10,
- user=params.hdfs_user,
- logoutput=True
- )
- except Fail:
- Logger.error("NameNode is still in safemode, please be careful with commands that need safemode OFF.")
+ wait_for_safemode_off(hdfs_binary)
# Always run this on non-HA, or active NameNode during HA.
create_hdfs_directories(is_active_namenode_cmd)
http://git-wip-us.apache.org/repos/asf/ambari/blob/376fc6ff/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
index 9f5ea76..9a42702 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
@@ -47,7 +47,7 @@ from ambari_commons import OSConst
import namenode_upgrade
-from hdfs_namenode import namenode
+from hdfs_namenode import namenode, wait_for_safemode_off
from hdfs import hdfs
import hdfs_rebalance
from utils import initiate_safe_zkfc_failover, get_hdfs_binary, get_dfsadmin_base_command
@@ -175,39 +175,7 @@ class NameNodeDefault(NameNode):
namenode_upgrade.prepare_rolling_upgrade(hfds_binary)
def wait_for_safemode_off(self, env):
- """
- During NonRolling (aka Express Upgrade), after starting NameNode, which is still in safemode, and then starting
- all of the DataNodes, we need for NameNode to receive all of the block reports and leave safemode.
- If HA is present, then this command will run individually on each NameNode, which checks for its own address.
- """
- import params
-
- Logger.info("Wait to leafe safemode since must transition from ON to OFF.")
-
- if params.security_enabled:
- kinit_command = format("{params.kinit_path_local} -kt {params.hdfs_user_keytab} {params.hdfs_principal_name}")
- Execute(kinit_command, user=params.hdfs_user, logoutput=True)
-
- try:
- hdfs_binary = self.get_hdfs_binary()
- # Note, this fails if namenode_address isn't prefixed with "params."
-
- dfsadmin_base_command = get_dfsadmin_base_command(hdfs_binary, use_specific_namenode=True)
- is_namenode_safe_mode_off = dfsadmin_base_command + " -safemode get | grep 'Safe mode is OFF'"
-
- # Wait up to 30 mins
- Execute(is_namenode_safe_mode_off,
- tries=65,
- try_sleep=10,
- user=params.hdfs_user,
- logoutput=True
- )
-
- # Wait a bit more since YARN still depends on block reports coming in.
- # Also saw intermittent errors with HBASE service check if it was done too soon.
- time.sleep(30)
- except Fail:
- Logger.error("NameNode is still in safemode, please be careful with commands that need safemode OFF.")
+ wait_for_safemode_off(self.get_hdfs_binary(), 30, True)
def finalize_non_rolling_upgrade(self, env):
hfds_binary = self.get_hdfs_binary()
http://git-wip-us.apache.org/repos/asf/ambari/blob/376fc6ff/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
index 2beb8fc..36d9133 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
@@ -89,7 +89,7 @@ class TestNamenode(RMFTestCase):
not_if = "ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E test -f /var/run/hadoop/hdfs/hadoop-hdfs-namenode.pid && ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E pgrep -F /var/run/hadoop/hdfs/hadoop-hdfs-namenode.pid",
)
self.assertResourceCalled('Execute', "hdfs dfsadmin -fs hdfs://c6405.ambari.apache.org:8020 -safemode get | grep 'Safe mode is OFF'",
- tries=65,
+ tries=115,
try_sleep=10,
user="hdfs",
logoutput=True
@@ -202,7 +202,7 @@ class TestNamenode(RMFTestCase):
not_if = "ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E test -f /var/run/hadoop/hdfs/hadoop-hdfs-namenode.pid && ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E pgrep -F /var/run/hadoop/hdfs/hadoop-hdfs-namenode.pid",
)
self.assertResourceCalled('Execute', "hdfs dfsadmin -fs hdfs://c6401.ambari.apache.org:8020 -safemode get | grep 'Safe mode is OFF'",
- tries=65,
+ tries=115,
try_sleep=10,
user="hdfs",
logoutput=True
@@ -331,7 +331,7 @@ class TestNamenode(RMFTestCase):
user='hdfs',
)
self.assertResourceCalled('Execute', "hdfs dfsadmin -fs hdfs://c6401.ambari.apache.org:8020 -safemode get | grep 'Safe mode is OFF'",
- tries=65,
+ tries=115,
try_sleep=10,
user="hdfs",
logoutput=True
@@ -427,7 +427,7 @@ class TestNamenode(RMFTestCase):
not_if = "ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E test -f /var/run/hadoop/hdfs/hadoop-hdfs-namenode.pid && ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E pgrep -F /var/run/hadoop/hdfs/hadoop-hdfs-namenode.pid",
)
self.assertResourceCalled('Execute', "hdfs dfsadmin -fs hdfs://c6401.ambari.apache.org:8020 -safemode get | grep 'Safe mode is OFF'",
- tries=65,
+ tries=115,
try_sleep=10,
user="hdfs",
logoutput=True
@@ -524,7 +524,7 @@ class TestNamenode(RMFTestCase):
not_if = "ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E test -f /var/run/hadoop/hdfs/hadoop-hdfs-namenode.pid && ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E pgrep -F /var/run/hadoop/hdfs/hadoop-hdfs-namenode.pid",
)
self.assertResourceCalled('Execute', "hdfs dfsadmin -fs hdfs://c6401.ambari.apache.org:8020 -safemode get | grep 'Safe mode is OFF'",
- tries=65,
+ tries=115,
try_sleep=10,
user="hdfs",
logoutput=True
@@ -627,7 +627,7 @@ class TestNamenode(RMFTestCase):
user = 'hdfs',
)
self.assertResourceCalled('Execute', "hdfs dfsadmin -fs hdfs://c6401.ambari.apache.org:8020 -safemode get | grep 'Safe mode is OFF'",
- tries=65,
+ tries=115,
try_sleep=10,
user="hdfs",
logoutput=True
@@ -730,7 +730,7 @@ class TestNamenode(RMFTestCase):
not_if = "ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E test -f /var/run/hadoop/hdfs/hadoop-hdfs-namenode.pid && ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E pgrep -F /var/run/hadoop/hdfs/hadoop-hdfs-namenode.pid",
)
self.assertResourceCalled('Execute', "hdfs dfsadmin -fs hdfs://c6401.ambari.apache.org:8020 -safemode get | grep 'Safe mode is OFF'",
- tries=65,
+ tries=115,
try_sleep=10,
user="hdfs",
logoutput=True
@@ -832,7 +832,7 @@ class TestNamenode(RMFTestCase):
not_if = "ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E test -f /var/run/hadoop/hdfs/hadoop-hdfs-namenode.pid && ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E pgrep -F /var/run/hadoop/hdfs/hadoop-hdfs-namenode.pid",
)
self.assertResourceCalled('Execute', "hdfs dfsadmin -fs hdfs://c6402.ambari.apache.org:8020 -safemode get | grep 'Safe mode is OFF'",
- tries=65,
+ tries=115,
try_sleep=10,
user="hdfs",
logoutput=True
@@ -942,7 +942,7 @@ class TestNamenode(RMFTestCase):
not_if = "ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E test -f /var/run/hadoop/hdfs/hadoop-hdfs-namenode.pid && ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E pgrep -F /var/run/hadoop/hdfs/hadoop-hdfs-namenode.pid",
)
self.assertResourceCalled('Execute', "hdfs dfsadmin -fs hdfs://c6402.ambari.apache.org:8020 -safemode get | grep 'Safe mode is OFF'",
- tries=65,
+ tries=115,
try_sleep=10,
user="hdfs",
logoutput=True
[42/50] [abbrv] ambari git commit: AMBARI-14532 AMS fails to stay up
after changing AMS configs to distributed mode (dsen)
Posted by nc...@apache.org.
AMBARI-14532 AMS fails to stay up after changing AMS configs to distributed mode (dsen)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/52ca9daa
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/52ca9daa
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/52ca9daa
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 52ca9daa68b8302775dd2ee8d0b901d53ce69df7
Parents: 371376d
Author: Dmytro Sen <ds...@apache.org>
Authored: Thu Dec 31 16:53:04 2015 +0200
Committer: Dmytro Sen <ds...@apache.org>
Committed: Thu Dec 31 16:53:04 2015 +0200
----------------------------------------------------------------------
.../AMBARI_METRICS/0.1.0/configuration/ams-hbase-site.xml | 10 ++++++++++
1 file changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/52ca9daa/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-hbase-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-hbase-site.xml b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-hbase-site.xml
index 1964047..fb0f680 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-hbase-site.xml
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-hbase-site.xml
@@ -253,6 +253,16 @@
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>61181</value>
+ <depends-on>
+ <property>
+ <type>zoo.cfg</type>
+ <name>clientPort</name>
+ </property>
+ <property>
+ <type>ams-hbase-site</type>
+ <name>hbase.cluster.distributed</name>
+ </property>
+ </depends-on>
</property>
<property>
<name>hbase.zookeeper.peerport</name>
[25/50] [abbrv] ambari git commit: AMBARI-14518
hadoop.proxyuser.yarn.hosts does not include both RM's in HA deployment.
(ababiichuk)
Posted by nc...@apache.org.
AMBARI-14518 hadoop.proxyuser.yarn.hosts does not include both RM's in HA deployment. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6c71cd1f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6c71cd1f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6c71cd1f
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 6c71cd1f022841d94152b6c704a17374bb4ba4c2
Parents: 48c0df4
Author: ababiichuk <ab...@hortonworks.com>
Authored: Tue Dec 29 15:36:18 2015 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Tue Dec 29 17:48:58 2015 +0200
----------------------------------------------------------------------
.../resourceManager/step3_controller.js | 12 +++++-
.../resourceManager/step4_controller.js | 40 ++++++++++----------
ambari-web/app/data/HDP2/rm_ha_properties.js | 20 +++++++++-
ambari-web/app/messages.js | 3 +-
...onfig_with_override_recommendation_parser.js | 1 -
.../utils/configs/rm_ha_config_initializer.js | 20 +++++++++-
.../resourceManager/step3_controller_test.js | 24 +++++++++++-
7 files changed, 91 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/6c71cd1f/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js
index 1350811..d2b7a86 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js
@@ -79,7 +79,8 @@ App.RMHighAvailabilityWizardStep3Controller = Em.Controller.extend({
loadConfigTagsSuccessCallback: function (data, opt, params) {
var urlParams = '(type=zoo.cfg&tag=' + data.Clusters.desired_configs['zoo.cfg'].tag + ')|' +
- '(type=yarn-site&tag=' + data.Clusters.desired_configs['yarn-site'].tag + ')';
+ '(type=yarn-site&tag=' + data.Clusters.desired_configs['yarn-site'].tag + ')|' +
+ '(type=yarn-env&tag=' + data.Clusters.desired_configs['yarn-env'].tag + ')';
App.ajax.send({
name: 'reassign.load_configs',
sender: this,
@@ -134,11 +135,20 @@ App.RMHighAvailabilityWizardStep3Controller = Em.Controller.extend({
*/
setDynamicConfigValues: function (configs, data) {
var topologyLocalDB = this.get('content').getProperties(['masterComponentHosts', 'slaveComponentHosts', 'hosts']);
+ var yarnUser = data.items.findProperty('type', 'yarn-env').properties.yarn_user;
+ App.RmHaConfigInitializer.setup({
+ yarnUser: yarnUser
+ });
var dependencies = this._prepareDependencies(data);
+ /** add dynamic property 'hadoop.proxyuser.' + yarnUser + '.hosts' **/
+ var proxyUserConfig = App.ServiceConfigProperty.create(App.config.createDefaultConfig('hadoop.proxyuser.' + yarnUser + '.hosts',
+ 'MISC', 'core-site', false, {category : "HDFS", isUserProperty: false, isEditable: false, isOverridable: false}));
+ configs.configs.pushObject(proxyUserConfig);
configs.configs.forEach(function (config) {
App.RmHaConfigInitializer.initialValue(config, topologyLocalDB, dependencies);
});
+ App.RmHaConfigInitializer.cleanup();
return configs;
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/6c71cd1f/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js
index 2617721..2d4831a 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js
@@ -26,7 +26,7 @@ App.RMHighAvailabilityWizardStep4Controller = App.HighAvailabilityProgressPageCo
clusterDeployState: 'RM_HIGH_AVAILABILITY_DEPLOY',
- commands: ['stopRequiredServices', 'installResourceManager', 'reconfigureYARN', 'reconfigureHAWQ', 'startAllServices'],
+ commands: ['stopRequiredServices', 'installResourceManager', 'reconfigureYARN', 'reconfigureHAWQ', 'reconfigureHDFS', 'startAllServices'],
tasksMessagesPrefix: 'admin.rm_highAvailability.wizard.step',
@@ -55,8 +55,12 @@ App.RMHighAvailabilityWizardStep4Controller = App.HighAvailabilityProgressPageCo
this.loadConfigsTags("Hawq");
},
+ reconfigureHDFS: function () {
+ this.loadConfigsTags("Hdfs");
+ },
+
loadConfigsTags: function (service) {
- onLoadServiceConfigsTags = 'onLoad' + service + "ConfigsTags"
+ var onLoadServiceConfigsTags = 'onLoad' + service + "ConfigsTags";
App.ajax.send({
name: 'config.tags',
sender: this,
@@ -70,9 +74,10 @@ App.RMHighAvailabilityWizardStep4Controller = App.HighAvailabilityProgressPageCo
name: 'reassign.load_configs',
sender: this,
data: {
- urlParams: '(type=yarn-site&tag=' + data.Clusters.desired_configs['yarn-site'].tag + ')'
+ urlParams: '(type=yarn-site&tag=' + data.Clusters.desired_configs['yarn-site'].tag + ')',
+ type: 'yarn-site'
},
- success: 'onLoadYarnConfigs',
+ success: 'onLoadConfigs',
error: 'onTaskError'
});
},
@@ -82,39 +87,34 @@ App.RMHighAvailabilityWizardStep4Controller = App.HighAvailabilityProgressPageCo
name: 'reassign.load_configs',
sender: this,
data: {
- urlParams: '(type=yarn-client&tag=' + data.Clusters.desired_configs['yarn-client'].tag + ')'
+ urlParams: '(type=yarn-client&tag=' + data.Clusters.desired_configs['yarn-client'].tag + ')',
+ type: 'yarn-client'
},
- success: 'onLoadHawqConfigs',
+ success: 'onLoadConfigs',
error: 'onTaskError'
});
},
- onLoadYarnConfigs: function (data) {
- var propertiesToAdd = this.get('content.configs').filterProperty('filename', 'yarn-site');
- propertiesToAdd.forEach(function (property) {
- data.items[0].properties[property.name] = property.value;
- });
-
- var configData = this.reconfigureSites(['yarn-site'], data, Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format(App.format.role('RESOURCEMANAGER')));
-
+ onLoadHdfsConfigsTags: function (data) {
App.ajax.send({
- name: 'common.service.configurations',
+ name: 'reassign.load_configs',
sender: this,
data: {
- desired_config: configData
+ urlParams: '(type=core-site&tag=' + data.Clusters.desired_configs['core-site'].tag + ')',
+ type: 'core-site'
},
- success: 'onSaveConfigs',
+ success: 'onLoadConfigs',
error: 'onTaskError'
});
},
- onLoadHawqConfigs: function (data) {
- var propertiesToAdd = this.get('content.configs').filterProperty('filename', 'yarn-client');
+ onLoadConfigs: function (data, opt, params) {
+ var propertiesToAdd = this.get('content.configs').filterProperty('filename', params.type);
propertiesToAdd.forEach(function (property) {
data.items[0].properties[property.name] = property.value;
});
- var configData = this.reconfigureSites(['yarn-client'], data, Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format(App.format.role('RESOURCEMANAGER')));
+ var configData = this.reconfigureSites([params.type], data, Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format(App.format.role('RESOURCEMANAGER')));
App.ajax.send({
name: 'common.service.configurations',
http://git-wip-us.apache.org/repos/asf/ambari/blob/6c71cd1f/ambari-web/app/data/HDP2/rm_ha_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2/rm_ha_properties.js b/ambari-web/app/data/HDP2/rm_ha_properties.js
index 5c85297..fb1bd13 100644
--- a/ambari-web/app/data/HDP2/rm_ha_properties.js
+++ b/ambari-web/app/data/HDP2/rm_ha_properties.js
@@ -23,9 +23,10 @@ module.exports =
displayName: 'MISC',
configCategories: [
App.ServiceConfigCategory.create({ name: 'YARN', displayName: 'YARN'}),
- App.ServiceConfigCategory.create({ name: 'HAWQ', displayName: 'HAWQ'})
+ App.ServiceConfigCategory.create({ name: 'HAWQ', displayName: 'HAWQ'}),
+ App.ServiceConfigCategory.create({ name: 'HDFS', displayName: 'HDFS'})
],
- sites: ['yarn-site', 'hawq-site'],
+ sites: ['yarn-site', 'hawq-site', 'core-site'],
configs: [
/**********************************************HDFS***************************************/
{
@@ -33,6 +34,7 @@ module.exports =
"displayName": "yarn.resourcemanager.ha.enabled",
"isReconfigurable": false,
"recommendedValue": true,
+ "isOverridable": false,
"value": true,
"displayType": "checkbox",
"category": "YARN",
@@ -44,6 +46,7 @@ module.exports =
"displayName": "yarn.resourcemanager.ha.rm-ids",
"isReconfigurable": false,
"recommendedValue": "rm1,rm2",
+ "isOverridable": false,
"value": "rm1,rm2",
"category": "YARN",
"filename": "yarn-site",
@@ -54,6 +57,7 @@ module.exports =
"displayName": "yarn.resourcemanager.hostname.rm1",
"isReconfigurable": false,
"recommendedValue": "",
+ "isOverridable": false,
"value": "",
"category": "YARN",
"filename": "yarn-site",
@@ -65,6 +69,7 @@ module.exports =
"displayName": "yarn.resourcemanager.webapp.address.rm1",
"isReconfigurable": false,
"recommendedValue": "",
+ "isOverridable": false,
"value": "",
"category": "YARN",
"filename": "yarn-site",
@@ -75,6 +80,7 @@ module.exports =
"displayName": "yarn.resourcemanager.webapp.address.rm2",
"isReconfigurable": false,
"recommendedValue": "",
+ "isOverridable": false,
"value": "",
"category": "YARN",
"filename": "yarn-site",
@@ -85,6 +91,7 @@ module.exports =
"displayName": "yarn.resourcemanager.webapp.https.address.rm1",
"isReconfigurable": false,
"recommendedValue": "",
+ "isOverridable": false,
"value": "",
"category": "YARN",
"filename": "yarn-site",
@@ -95,6 +102,7 @@ module.exports =
"displayName": "yarn.resourcemanager.webapp.https.address.rm2",
"isReconfigurable": false,
"recommendedValue": "",
+ "isOverridable": false,
"value": "",
"category": "YARN",
"filename": "yarn-site",
@@ -106,6 +114,7 @@ module.exports =
"displayName": "yarn.resourcemanager.hostname.rm2",
"isReconfigurable": false,
"recommendedValue": "",
+ "isOverridable": false,
"value": "",
"category": "YARN",
"filename": "yarn-site",
@@ -116,6 +125,7 @@ module.exports =
"displayName": "yarn.resourcemanager.recovery.enabled",
"isReconfigurable": false,
"recommendedValue": true,
+ "isOverridable": false,
"value": true,
"displayType": "checkbox",
"category": "YARN",
@@ -127,6 +137,7 @@ module.exports =
"displayName": "yarn.resourcemanager.store.class",
"isReconfigurable": false,
"recommendedValue": "org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore",
+ "isOverridable": false,
"value": "org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore",
"category": "YARN",
"filename": "yarn-site",
@@ -137,6 +148,7 @@ module.exports =
"displayName": "yarn.resourcemanager.zk-address",
"isReconfigurable": false,
"recommendedValue": "",
+ "isOverridable": false,
"value": "",
"category": "YARN",
"filename": "yarn-site",
@@ -147,6 +159,7 @@ module.exports =
"displayName": "yarn.resourcemanager.cluster-id",
"isReconfigurable": false,
"recommendedValue": "yarn-cluster",
+ "isOverridable": false,
"value": "yarn-cluster",
"category": "YARN",
"filename": "yarn-site",
@@ -157,6 +170,7 @@ module.exports =
"displayName": "yarn.resourcemanager.ha.automatic-failover.zk-base-path",
"isReconfigurable": false,
"recommendedValue": "/yarn-leader-election",
+ "isOverridable": false,
"value": "/yarn-leader-election",
"category": "YARN",
"filename": "yarn-site",
@@ -169,6 +183,7 @@ module.exports =
"description": "Comma separated yarn resourcemanager host addresses with port",
"isReconfigurable": false,
"recommendedValue": "",
+ "isOverridable": false,
"value": "",
"category": "HAWQ",
"filename": "yarn-client",
@@ -180,6 +195,7 @@ module.exports =
"description": "Comma separated yarn resourcemanager scheduler addresses with port",
"isReconfigurable": false,
"recommendedValue": "",
+ "isOverridable": false,
"value": "",
"category": "HAWQ",
"filename": "yarn-client",
http://git-wip-us.apache.org/repos/asf/ambari/blob/6c71cd1f/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 2203b17..17a9ef9 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1326,7 +1326,8 @@ Em.I18n.translations = {
'admin.rm_highAvailability.wizard.step4.task1.title': 'Install Additional ResourceManager',
'admin.rm_highAvailability.wizard.step4.task2.title': 'Reconfigure YARN',
'admin.rm_highAvailability.wizard.step4.task3.title': 'Reconfigure HAWQ',
- 'admin.rm_highAvailability.wizard.step4.task4.title': 'Start All Services',
+ 'admin.rm_highAvailability.wizard.step4.task4.title': 'Reconfigure HDFS',
+ 'admin.rm_highAvailability.wizard.step4.task5.title': 'Start All Services',
'admin.rm_highAvailability.wizard.step4.notice.inProgress':'Please wait while ResourceManager HA is being deployed.',
'admin.rm_highAvailability.wizard.step4.notice.completed':'ResourceManager HA has been enabled successfully.',
http://git-wip-us.apache.org/repos/asf/ambari/blob/6c71cd1f/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js b/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js
index 5339637..7002110 100644
--- a/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js
+++ b/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js
@@ -46,7 +46,6 @@ App.ConfigWithOverrideRecommendationParser = Em.Mixin.create(App.ConfigRecommend
* @protected
*/
_updateOverride: function(config, recommendedValue, parentProperties, configGroup) {
- debugger;
var updateValue = this.allowUpdateProperty(parentProperties, Em.get(config, 'name'), Em.get(config, 'filename'));
var override = config.getOverride(configGroup.get('name'));
if (override) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/6c71cd1f/ambari-web/app/utils/configs/rm_ha_config_initializer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/rm_ha_config_initializer.js b/ambari-web/app/utils/configs/rm_ha_config_initializer.js
index 0255b27..9c36323 100644
--- a/ambari-web/app/utils/configs/rm_ha_config_initializer.js
+++ b/ambari-web/app/utils/configs/rm_ha_config_initializer.js
@@ -52,15 +52,31 @@ App.RmHaConfigInitializer = App.HaConfigInitializerClass.create(App.HostsBasedIn
'yarn.resourcemanager.webapp.https.address.rm1': this.getHostWithPortConfig('RESOURCEMANAGER', true, '', '', 'httpsWebAddressPort', true),
'yarn.resourcemanager.webapp.https.address.rm2': this.getHostWithPortConfig('RESOURCEMANAGER', false, '', '', 'httpsWebAddressPort', true),
'yarn.resourcemanager.ha': getRmHaHostsWithPort(8032),
- 'yarn.resourcemanager.scheduler.ha': getRmHaHostsWithPort(8030)
+ 'yarn.resourcemanager.scheduler.ha': getRmHaHostsWithPort(8030),
+ 'hadoop.proxyuser.{{yarnUser}}.hosts': this.getComponentsHostsConfig(['RESOURCEMANAGER'])
};
}.property(),
initializerTypes: [
- {name: 'rm_hosts_with_port', method: '_initRmHaHostsWithPort'},
+ {name: 'rm_hosts_with_port', method: '_initRmHaHostsWithPort'}
],
/**
+ * @override
+ * @param {object} settings
+ */
+ setup: function (settings) {
+ this._updateInitializers(settings);
+ },
+
+ /**
+ * @override
+ */
+ cleanup: function () {
+ this._restoreInitializers();
+ },
+
+ /**
* Initializer for configs that should be updated with yarn resourcemanager ha host addresses with port
*
* @param {configProperty} configProperty
http://git-wip-us.apache.org/repos/asf/ambari/blob/6c71cd1f/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
index 5b34dd4..9a24cf3 100644
--- a/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
@@ -71,6 +71,9 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function () {
},
'yarn-site': {
'tag': 1
+ },
+ 'yarn-env': {
+ 'tag': 1
}
}
}
@@ -78,7 +81,7 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function () {
'serviceConfig': {}
});
var data = App.ajax.send.args[0][0].data;
- expect(data.urlParams).to.equal('(type=zoo.cfg&tag=1)|(type=yarn-site&tag=1)');
+ expect(data.urlParams).to.equal('(type=zoo.cfg&tag=1)|(type=yarn-site&tag=1)|(type=yarn-env&tag=1)');
expect(data.serviceConfig).to.eql({});
});
@@ -221,6 +224,12 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function () {
}
},
{
+ type: 'yarn-env',
+ properties: {
+ yarn_user: 'yarn'
+ }
+ },
+ {
type: 'yarn-site',
properties: {
'yarn.resourcemanager.webapp.address': 'lclhst:1234',
@@ -274,6 +283,9 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function () {
}),
Em.Object.create({
name: 'yarn.resourcemanager.scheduler.ha'
+ }),
+ Em.Object.create({
+ name: 'hadoop.proxyuser.yarn.hosts'
})
]
};
@@ -347,10 +359,18 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function () {
it('yarn.resourcemanager.ha value', function () {
expect(configs.configs.findProperty('name', 'yarn.resourcemanager.ha').get('value')).to.equal('h0:8032,h1:8032');
});
- it('yarn.resourcemanager.ha recommendedValud', function () {
+ it('yarn.resourcemanager.ha recommendedValue', function () {
expect(configs.configs.findProperty('name', 'yarn.resourcemanager.scheduler.ha').get('recommendedValue')).to.equal('h0:8030,h1:8030');
});
+ it('hadoop.proxyuser.yarn.hosts value', function () {
+ expect(configs.configs.findProperty('name', 'hadoop.proxyuser.yarn.hosts').get('value')).to.equal('h0,h1');
+ });
+
+ it('hadoop.proxyuser.yarn.hosts recommendedValue', function () {
+ expect(configs.configs.findProperty('name', 'hadoop.proxyuser.yarn.hosts').get('recommendedValue')).to.equal('h0,h1');
+ });
+
});
});
[38/50] [abbrv] ambari git commit: AMBARI-14477. Custom command label
for HAWQ Segment Stop (Immediate Mode) (mithmatt via odiachenko).
Posted by nc...@apache.org.
AMBARI-14477. Custom command label for HAWQ Segment Stop (Immediate Mode) (mithmatt via odiachenko).
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/09406ac6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/09406ac6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/09406ac6
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 09406ac65f78a5213236ec33735dccd35e61d90b
Parents: c96a9e4
Author: Oleksandr Diachenko <od...@pivotal.io>
Authored: Wed Dec 30 11:41:22 2015 -0800
Committer: Oleksandr Diachenko <od...@pivotal.io>
Committed: Wed Dec 30 11:41:22 2015 -0800
----------------------------------------------------------------------
ambari-web/app/messages.js | 2 ++
ambari-web/app/models/host_component.js | 8 ++++-
.../main/host/details/host_component_view.js | 14 ++++----
ambari-web/app/views/main/service/item.js | 3 +-
.../host/details/host_component_view_test.js | 38 ++++++++++----------
5 files changed, 36 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/09406ac6/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 17a9ef9..8892cac 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1660,6 +1660,8 @@ Em.I18n.translations = {
'services.service.actions.run.stopLdapKnox.context':'Stop Demo LDAP',
'services.service.actions.run.startStopLdapKnox.error': 'Error during remote command: ',
'services.service.actions.run.immediateStopHawqCluster.context':'Stop HAWQ Cluster (Immediate Mode)',
+ 'services.service.actions.run.immediateStopHawqSegment.label':'Stop (Immediate Mode)',
+ 'services.service.actions.run.immediateStopHawqSegment.context':'Stop HAWQ Segment (Immediate Mode)',
'services.service.actions.run.immediateStopHawqCluster.error': 'Error during remote command: ',
'services.service.actions.manage_configuration_groups.short':'Manage Config Groups',
'services.service.actions.serviceActions':'Service Actions',
http://git-wip-us.apache.org/repos/asf/ambari/blob/09406ac6/ambari-web/app/models/host_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/host_component.js b/ambari-web/app/models/host_component.js
index 4fe08f5..b463c80 100644
--- a/ambari-web/app/models/host_component.js
+++ b/ambari-web/app/models/host_component.js
@@ -364,7 +364,13 @@ App.HostComponentActionMap = {
context: Em.I18n.t('services.service.actions.run.immediateStopHawqCluster.context'),
label: Em.I18n.t('services.service.actions.run.immediateStopHawqCluster.context'),
cssClass: 'icon-stop',
- disabled: false,
+ disabled: false
+ },
+ IMMEDIATE_STOP: {
+ customCommand: 'IMMEDIATE_STOP',
+ context: Em.I18n.t('services.service.actions.run.immediateStopHawqSegment.context'),
+ label: Em.I18n.t('services.service.actions.run.immediateStopHawqSegment.label'),
+ cssClass: 'icon-stop'
},
MASTER_CUSTOM_COMMAND: {
action: 'executeCustomCommand',
http://git-wip-us.apache.org/repos/asf/ambari/blob/09406ac6/ambari-web/app/views/main/host/details/host_component_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/details/host_component_view.js b/ambari-web/app/views/main/host/details/host_component_view.js
index 7247134..21295b8 100644
--- a/ambari-web/app/views/main/host/details/host_component_view.js
+++ b/ambari-web/app/views/main/host/details/host_component_view.js
@@ -294,9 +294,9 @@ App.HostComponentView = Em.View.extend({
return;
}
- var isContextPresent = (!isSlave && (command in App.HostComponentActionMap.getMap(self)) && App.HostComponentActionMap.getMap(self)[command].context);
+ var isContextPresent = command in App.HostComponentActionMap.getMap(self) && App.HostComponentActionMap.getMap(self)[command].context;
customCommands.push({
- label: self.getCustomCommandLabel(command, isSlave),
+ label: self.getCustomCommandLabel(command),
service: component.get('serviceName'),
hosts: hostComponent.get('hostName'),
context: isContextPresent ? App.HostComponentActionMap.getMap(self)[command].context : null,
@@ -314,11 +314,11 @@ App.HostComponentView = Em.View.extend({
* @param command
* @returns {String}
*/
- getCustomCommandLabel: function (command, isSlave) {
- if (isSlave || !(command in App.HostComponentActionMap.getMap(this)) || !App.HostComponentActionMap.getMap(this)[command].label) {
- return Em.I18n.t('services.service.actions.run.executeCustomCommand.menu').format(App.format.normalizeNameBySeparators(command, ["_", "-", " "]))
- }
- return App.HostComponentActionMap.getMap(this)[command].label;
+ getCustomCommandLabel: function (command) {
+ if (command in App.HostComponentActionMap.getMap(this) && App.HostComponentActionMap.getMap(this)[command].label)
+ return App.HostComponentActionMap.getMap(this)[command].label;
+
+ return Em.I18n.t('services.service.actions.run.executeCustomCommand.menu').format(App.format.normalizeNameBySeparators(command, ["_", "-", " "]));
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/09406ac6/ambari-web/app/views/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/item.js b/ambari-web/app/views/main/service/item.js
index f85f266..1dfa937 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -35,7 +35,8 @@ App.MainServiceItemView = Em.View.extend({
'RESOURCEMANAGER': ['DECOMMISSION', 'REFRESHQUEUES'],
'HBASE_MASTER': ['DECOMMISSION'],
'KNOX_GATEWAY': ['STARTDEMOLDAP','STOPDEMOLDAP'],
- 'HAWQMASTER': ['IMMEDIATE_STOP_CLUSTER']
+ 'HAWQMASTER': ['IMMEDIATE_STOP_CLUSTER'],
+ 'HAWQSEGMENT': ['IMMEDIATE_STOP']
},
addActionMap: function() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/09406ac6/ambari-web/test/views/main/host/details/host_component_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/host/details/host_component_view_test.js b/ambari-web/test/views/main/host/details/host_component_view_test.js
index e8366bd..648f0f6 100644
--- a/ambari-web/test/views/main/host/details/host_component_view_test.js
+++ b/ambari-web/test/views/main/host/details/host_component_view_test.js
@@ -288,9 +288,21 @@ describe('App.HostComponentView', function() {
return Em.Object.create({
componentName: 'SLAVE_COMPONENT',
isSlave: true,
- customCommands: ['CUSTOM']
+ customCommands: ['SLAVE_CUSTOM_COMMAND']
});
});
+ sinon.stub(App.HostComponentActionMap, 'getMap', function () {
+ return {
+ SLAVE_CUSTOM_COMMAND: {
+ customCommand: 'SLAVE_CUSTOM_COMMAND',
+ cssClass: 'icon-play-circle',
+ label: 'Custom Command',
+ context: 'Custom Command',
+ isHidden: false,
+ disabled: false
+ }
+ }
+ });
});
it('Should get custom commands for slaves', function() {
@@ -300,6 +312,7 @@ describe('App.HostComponentView', function() {
after(function() {
App.StackServiceComponent.find.restore();
+ App.HostComponentActionMap.getMap.restore();
});
});
@@ -331,40 +344,25 @@ describe('App.HostComponentView', function() {
var tests = Em.A([
{
- msg: 'Non-slave component not present in `App.HostComponentActionMap.getMap()` should have a default valid label',
- isSlave: false,
+ msg: 'Component not present in `App.HostComponentActionMap.getMap()` should have a default valid label',
command: 'CUSTOM',
e: Em.I18n.t('services.service.actions.run.executeCustomCommand.menu').format('Custom')
},
{
- msg: 'Non-slave component present in `App.HostComponentActionMap.getMap()` with no label should have a default valid label',
- isSlave: false,
+ msg: 'Component present in `App.HostComponentActionMap.getMap()` with no label should have a default valid label',
command: 'MASTER_CUSTOM_COMMAND',
e: Em.I18n.t('services.service.actions.run.executeCustomCommand.menu').format('Master Custom Command')
},
{
- msg: 'Non-slave component present in `App.HostComponentActionMap.getMap()` with label should have a custom valid label',
- isSlave: false,
+ msg: 'Component present in `App.HostComponentActionMap.getMap()` with label should have a custom valid label',
command: 'REFRESHQUEUES',
e: Em.I18n.t('services.service.actions.run.yarnRefreshQueues.menu')
- },
- {
- msg: 'Slave component not present in `App.HostComponentActionMap.getMap()` should have a default valid label',
- isSlave: true,
- command: 'CUSTOM',
- e: Em.I18n.t('services.service.actions.run.executeCustomCommand.menu').format('Custom')
- },
- {
- msg: 'Slave component present in `App.HostComponentActionMap.getMap()` should have a default valid label',
- isSlave: true,
- command: 'REFRESHQUEUES',
- e: Em.I18n.t('services.service.actions.run.executeCustomCommand.menu').format('Refreshqueues')
}
]);
tests.forEach(function(test) {
it(test.msg, function() {
- expect(hostComponentView.getCustomCommandLabel(test.command, test.isSlave)).to.equal(test.e);
+ expect(hostComponentView.getCustomCommandLabel(test.command)).to.equal(test.e);
})
});
});
[05/50] [abbrv] ambari git commit: AMBARI-14502. Devdeploy:
Nodemanager becomes stopped after Mahout client is installed on host
(aonishuk)
Posted by nc...@apache.org.
AMBARI-14502. Devdeploy: Nodemanager becomes stopped after Mahout client is installed on host (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ff3643cd
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ff3643cd
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ff3643cd
Branch: refs/heads/branch-dev-patch-upgrade
Commit: ff3643cdff812510c027e0e11d7e36e42b463ccc
Parents: 2a7ccf4
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Mon Dec 28 12:48:10 2015 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Mon Dec 28 12:48:10 2015 +0200
----------------------------------------------------------------------
.../common-services/MAHOUT/1.0.0.2.3/package/scripts/params.py | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ff3643cd/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/params.py b/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/params.py
index e258cec..69c03ea 100644
--- a/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/params.py
@@ -45,6 +45,8 @@ mahout_home = "/usr/hdp/current/mahout-client"
mahout_conf_dir = "/usr/hdp/current/mahout-client/conf"
mahout_user = config['configurations']['mahout-env']['mahout_user']
+yarn_log_dir_prefix = config['configurations']['yarn-env']['yarn_log_dir_prefix']
+
#hadoop params
hadoop_bin_dir = hdp_select.get_hadoop_dir("bin")
hadoop_home = hdp_select.get_hadoop_dir("home")
[36/50] [abbrv] ambari git commit: AMBARI-14412. Recommend PXF
component to be collocated with NAMENODE and DATANODE (mithmatt via
odiachenko).
Posted by nc...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/c96a9e41/ambari-server/src/test/python/stacks/2.3/common/services-pxf-hdfs.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/common/services-pxf-hdfs.json b/ambari-server/src/test/python/stacks/2.3/common/services-pxf-hdfs.json
new file mode 100644
index 0000000..4cd2d4d
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.3/common/services-pxf-hdfs.json
@@ -0,0 +1,3490 @@
+{
+ "href" : "/api/v1/stacks/HDP/versions/2.3/?fields=Versions/stack_name,Versions/stack_version,Versions/parent_stack_version,services/StackServices/service_name,services/StackServices/service_version,services/components/StackServiceComponents,services/components/dependencies,services/components/auto_deploy,services/configurations/StackConfigurations/property_depends_on,services/configurations/dependencies/StackConfigurationDependency/dependency_name,services/configurations/dependencies/StackConfigurationDependency/dependency_type,services/configurations/StackConfigurations/type&services/StackServices/service_name.in(HDFS,HAWQ,PXF)",
+ "Versions" : {
+ "parent_stack_version" : "2.2",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3"
+ },
+ "services" : [
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ",
+ "StackServices" : {
+ "service_name" : "HAWQ",
+ "service_version" : "2.0.0",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3"
+ },
+ "components" : [
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/components/HAWQMASTER",
+ "StackServiceComponents" : {
+ "advertise_version" : false,
+ "cardinality" : "1",
+ "component_category" : "MASTER",
+ "component_name" : "HAWQMASTER",
+ "custom_commands" : [ ],
+ "display_name" : "HAWQ Master",
+ "is_client" : false,
+ "is_master" : true,
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "hostnames" : [ ]
+ },
+ "dependencies" : [
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/components/HAWQMASTER/dependencies/HDFS_CLIENT",
+ "Dependencies" : {
+ "component_name" : "HDFS_CLIENT",
+ "dependent_component_name" : "HAWQMASTER",
+ "dependent_service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3"
+ }
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/components/HAWQMASTER/dependencies/NAMENODE",
+ "Dependencies" : {
+ "component_name" : "NAMENODE",
+ "dependent_component_name" : "HAWQMASTER",
+ "dependent_service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3"
+ }
+ }
+ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/components/HAWQSEGMENT",
+ "StackServiceComponents" : {
+ "advertise_version" : false,
+ "cardinality" : "1+",
+ "component_category" : "SLAVE",
+ "component_name" : "HAWQSEGMENT",
+ "custom_commands" : [ ],
+ "display_name" : "HAWQ Segment",
+ "is_client" : false,
+ "is_master" : false,
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "hostnames" : [ ]
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/components/HAWQSTANDBY",
+ "StackServiceComponents" : {
+ "advertise_version" : false,
+ "cardinality" : "0-1",
+ "component_category" : "MASTER",
+ "component_name" : "HAWQSTANDBY",
+ "custom_commands" : [ ],
+ "display_name" : "HAWQ Standby Master",
+ "is_client" : false,
+ "is_master" : true,
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "hostnames" : [ ]
+ },
+ "dependencies" : [
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/components/HAWQSTANDBY/dependencies/HDFS_CLIENT",
+ "Dependencies" : {
+ "component_name" : "HDFS_CLIENT",
+ "dependent_component_name" : "HAWQSTANDBY",
+ "dependent_service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3"
+ }
+ }
+ ]
+ }
+ ],
+ "configurations" : [
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/content",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "content",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "gpcheck-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/dfs.client.failover.max.attempts",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.client.failover.max.attempts",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/dfs.client.log.severity",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.client.log.severity",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/dfs.client.read.shortcircuit",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.client.read.shortcircuit",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/dfs.client.use.legacy.blockreader.local",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.client.use.legacy.blockreader.local",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/dfs.default.blocksize",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.default.blocksize",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/dfs.default.replica",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.default.replica",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/dfs.domain.socket.path",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.domain.socket.path",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/dfs.prefetchsize",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.prefetchsize",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/fs.nr_open",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "fs.nr_open",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hard_nofile",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hard_nofile",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-limits-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hard_nproc",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hard_nproc",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-limits-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_dfs_url",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_dfs_url",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_global_rm_type",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_global_rm_type",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_master_address_host",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_master_address_host",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_master_address_port",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_master_address_port",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_master_directory",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_master_directory",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_master_temp_directory",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_master_temp_directory",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_password",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_password",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_re_cgroup_hierarchy_name",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_re_cgroup_hierarchy_name",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_re_cgroup_mount_point",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_re_cgroup_mount_point",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_re_cpu_enable",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_re_cpu_enable",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_rm_memory_limit_perseg",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_rm_memory_limit_perseg",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_rm_nvcore_limit_perseg",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_rm_nvcore_limit_perseg",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_rm_yarn_address",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_rm_yarn_address",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_rm_yarn_app_name",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_rm_yarn_app_name",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_rm_yarn_queue_name",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_rm_yarn_queue_name",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_rm_yarn_scheduler_address",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_rm_yarn_scheduler_address",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_segment_address_port",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_segment_address_port",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_segment_directory",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_segment_directory",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_segment_temp_directory",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_segment_temp_directory",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/hawq_standby_address_host",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hawq_standby_address_host",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/input.connect.timeout",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "input.connect.timeout",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/input.localread.blockinfo.cachesize",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "input.localread.blockinfo.cachesize",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/input.localread.default.buffersize",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "input.localread.default.buffersize",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/input.read.getblockinfo.retry",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "input.read.getblockinfo.retry",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/input.read.timeout",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "input.read.timeout",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/input.write.timeout",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "input.write.timeout",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/kernel.core_uses_pid",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "kernel.core_uses_pid",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/kernel.msgmax",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "kernel.msgmax",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/kernel.msgmnb",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "kernel.msgmnb",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/kernel.msgmni",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "kernel.msgmni",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/kernel.pid_max",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "kernel.pid_max",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/kernel.sem",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "kernel.sem",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/kernel.shmall",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "kernel.shmall",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/kernel.shmmax",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "kernel.shmmax",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/kernel.shmmni",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "kernel.shmmni",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/kernel.sysrq",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "kernel.sysrq",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/kernel.threads-max",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "kernel.threads-max",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/net.core.netdev_max_backlog",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "net.core.netdev_max_backlog",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/net.core.rmem_max",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "net.core.rmem_max",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/net.core.wmem_max",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "net.core.wmem_max",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/net.ipv4.conf.all.arp_filter",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "net.ipv4.conf.all.arp_filter",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/net.ipv4.conf.default.accept_source_route",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "net.ipv4.conf.default.accept_source_route",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/net.ipv4.ip_forward",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "net.ipv4.ip_forward",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/net.ipv4.ip_local_port_range",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "net.ipv4.ip_local_port_range",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/net.ipv4.tcp_max_syn_backlog",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "net.ipv4.tcp_max_syn_backlog",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/net.ipv4.tcp_syncookies",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "net.ipv4.tcp_syncookies",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/net.ipv4.tcp_tw_recycle",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "net.ipv4.tcp_tw_recycle",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/output.close.timeout",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "output.close.timeout",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/output.connect.timeout",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "output.connect.timeout",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/output.default.chunksize",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "output.default.chunksize",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/output.default.packetsize",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "output.default.packetsize",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/output.default.write.retry",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "output.default.write.retry",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/output.packetpool.size",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "output.packetpool.size",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/output.read.timeout",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "output.read.timeout",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/output.replace-datanode-on-failure",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "output.replace-datanode-on-failure",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/output.write.timeout",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "output.write.timeout",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/rpc.client.connect.retry",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "rpc.client.connect.retry",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/rpc.client.connect.retry",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "rpc.client.connect.retry",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "yarn-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/rpc.client.connect.tcpnodelay",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "rpc.client.connect.tcpnodelay",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/rpc.client.connect.tcpnodelay",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "rpc.client.connect.tcpnodelay",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "yarn-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/rpc.client.connect.timeout",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "rpc.client.connect.timeout",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/rpc.client.connect.timeout",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "rpc.client.connect.timeout",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "yarn-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/rpc.client.max.idle",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "rpc.client.max.idle",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/rpc.client.max.idle",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "rpc.client.max.idle",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "yarn-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/rpc.client.ping.interval",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "rpc.client.ping.interval",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/rpc.client.ping.interval",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "rpc.client.ping.interval",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "yarn-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/rpc.client.read.timeout",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "rpc.client.read.timeout",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/rpc.client.read.timeout",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "rpc.client.read.timeout",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "yarn-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/rpc.client.socket.linger.timeout",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "rpc.client.socket.linger.timeout",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/rpc.client.socket.linger.timeout",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "rpc.client.socket.linger.timeout",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "yarn-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/rpc.client.timeout",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "rpc.client.timeout",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/rpc.client.timeout",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "rpc.client.timeout",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "yarn-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/rpc.client.write.timeout",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "rpc.client.write.timeout",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/rpc.client.write.timeout",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "rpc.client.write.timeout",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "yarn-client.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/soft_nofile",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "soft_nofile",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-limits-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/soft_nproc",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "soft_nproc",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-limits-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/vm.overcommit_memory",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "vm.overcommit_memory",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hawq-sysctl-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HAWQ/configurations/yarn.client.failover.max.attempts",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "yarn.client.failover.max.attempts",
+ "service_name" : "HAWQ",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "yarn-client.xml"
+ },
+ "dependencies" : [ ]
+ }
+ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS",
+ "StackServices" : {
+ "service_name" : "HDFS",
+ "service_version" : "2.7.1.2.3",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3"
+ },
+ "components" : [
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/components/DATANODE",
+ "StackServiceComponents" : {
+ "advertise_version" : true,
+ "cardinality" : "1+",
+ "component_category" : "SLAVE",
+ "component_name" : "DATANODE",
+ "custom_commands" : [ ],
+ "display_name" : "DataNode",
+ "is_client" : false,
+ "is_master" : false,
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "hostnames" : [ ]
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/components/HDFS_CLIENT",
+ "StackServiceComponents" : {
+ "advertise_version" : true,
+ "cardinality" : "1+",
+ "component_category" : "CLIENT",
+ "component_name" : "HDFS_CLIENT",
+ "custom_commands" : [ ],
+ "display_name" : "HDFS Client",
+ "is_client" : true,
+ "is_master" : false,
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "hostnames" : [ ]
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/components/JOURNALNODE",
+ "StackServiceComponents" : {
+ "advertise_version" : true,
+ "cardinality" : "0+",
+ "component_category" : "SLAVE",
+ "component_name" : "JOURNALNODE",
+ "custom_commands" : [ ],
+ "display_name" : "JournalNode",
+ "is_client" : false,
+ "is_master" : false,
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "hostnames" : [ ]
+ },
+ "dependencies" : [
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/components/JOURNALNODE/dependencies/HDFS_CLIENT",
+ "Dependencies" : {
+ "component_name" : "HDFS_CLIENT",
+ "dependent_component_name" : "JOURNALNODE",
+ "dependent_service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3"
+ }
+ }
+ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/components/NAMENODE",
+ "StackServiceComponents" : {
+ "advertise_version" : true,
+ "cardinality" : "1-2",
+ "component_category" : "MASTER",
+ "component_name" : "NAMENODE",
+ "custom_commands" : [
+ "DECOMMISSION",
+ "REBALANCEHDFS"
+ ],
+ "display_name" : "NameNode",
+ "is_client" : false,
+ "is_master" : true,
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "hostnames" : [ ]
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/components/NFS_GATEWAY",
+ "StackServiceComponents" : {
+ "advertise_version" : false,
+ "cardinality" : "0+",
+ "component_category" : "SLAVE",
+ "component_name" : "NFS_GATEWAY",
+ "custom_commands" : [ ],
+ "display_name" : "NFSGateway",
+ "is_client" : false,
+ "is_master" : false,
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "hostnames" : [ ]
+ },
+ "dependencies" : [
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/components/NFS_GATEWAY/dependencies/HDFS_CLIENT",
+ "Dependencies" : {
+ "component_name" : "HDFS_CLIENT",
+ "dependent_component_name" : "NFS_GATEWAY",
+ "dependent_service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3"
+ }
+ }
+ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/components/SECONDARY_NAMENODE",
+ "StackServiceComponents" : {
+ "advertise_version" : true,
+ "cardinality" : "1",
+ "component_category" : "MASTER",
+ "component_name" : "SECONDARY_NAMENODE",
+ "custom_commands" : [ ],
+ "display_name" : "SNameNode",
+ "is_client" : false,
+ "is_master" : true,
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "hostnames" : [ ]
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/components/ZKFC",
+ "StackServiceComponents" : {
+ "advertise_version" : false,
+ "cardinality" : "0+",
+ "component_category" : "SLAVE",
+ "component_name" : "ZKFC",
+ "custom_commands" : [ ],
+ "display_name" : "ZKFailoverController",
+ "is_client" : false,
+ "is_master" : false,
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "hostnames" : [ ]
+ },
+ "dependencies" : [ ]
+ }
+ ],
+ "configurations" : [
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/REPOSITORY_CONFIG_PASSWORD",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "REPOSITORY_CONFIG_PASSWORD",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "ranger-hdfs-plugin-properties.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/REPOSITORY_CONFIG_USERNAME",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "REPOSITORY_CONFIG_USERNAME",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "ranger-hdfs-plugin-properties.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/common.name.for.certificate",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "common.name.for.certificate",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "ranger-hdfs-plugin-properties.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/content",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "content",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hadoop-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/content",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "content",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-log4j.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.block.access.token.enable",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.block.access.token.enable",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.blockreport.initialDelay",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.blockreport.initialDelay",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.blocksize",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.blocksize",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.client.read.shortcircuit",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.client.read.shortcircuit",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.client.read.shortcircuit.streams.cache.size",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.client.read.shortcircuit.streams.cache.size",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.client.retry.policy.enabled",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.client.retry.policy.enabled",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.cluster.administrators",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.cluster.administrators",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.content-summary.limit",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.content-summary.limit",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.datanode.address",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.datanode.address",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.datanode.balance.bandwidthPerSec",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.datanode.balance.bandwidthPerSec",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.datanode.data.dir",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.datanode.data.dir",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.datanode.data.dir/dependencies/dfs.datanode.failed.volumes.tolerated",
+ "StackConfigurationDependency" : {
+ "dependency_name" : "dfs.datanode.failed.volumes.tolerated",
+ "dependency_type" : "hdfs-site",
+ "property_name" : "dfs.datanode.data.dir",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3"
+ }
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.datanode.data.dir/dependencies/namenode_heapsize",
+ "StackConfigurationDependency" : {
+ "dependency_name" : "namenode_heapsize",
+ "dependency_type" : "hadoop-env",
+ "property_name" : "dfs.datanode.data.dir",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3"
+ }
+ }
+ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.datanode.data.dir.perm",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.datanode.data.dir.perm",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.datanode.du.reserved",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.datanode.du.reserved",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.datanode.failed.volumes.tolerated",
+ "StackConfigurations" : {
+ "property_depends_on" : [
+ {
+ "type" : "hdfs-site",
+ "name" : "dfs.datanode.data.dir"
+ }
+ ],
+ "property_name" : "dfs.datanode.failed.volumes.tolerated",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.datanode.http.address",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.datanode.http.address",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.datanode.https.address",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.datanode.https.address",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.datanode.ipc.address",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.datanode.ipc.address",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.datanode.max.transfer.threads",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.datanode.max.transfer.threads",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.domain.socket.path",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.domain.socket.path",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.encrypt.data.transfer.cipher.suites",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.encrypt.data.transfer.cipher.suites",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.encryption.key.provider.uri",
+ "StackConfigurations" : {
+ "property_depends_on" : [
+ {
+ "type" : "hadoop-env",
+ "name" : "keyserver_port"
+ },
+ {
+ "type" : "kms-env",
+ "name" : "kms_port"
+ },
+ {
+ "type" : "hadoop-env",
+ "name" : "keyserver_host"
+ },
+ {
+ "type" : "ranger-kms-site",
+ "name" : "ranger.service.https.attrib.ssl.enabled"
+ }
+ ],
+ "property_name" : "dfs.encryption.key.provider.uri",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.heartbeat.interval",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.heartbeat.interval",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.hosts.exclude",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.hosts.exclude",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.http.policy",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.http.policy",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.https.port",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.https.port",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.journalnode.edits.dir",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.journalnode.edits.dir",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.journalnode.http-address",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.journalnode.http-address",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.journalnode.https-address",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.journalnode.https-address",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.accesstime.precision",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.accesstime.precision",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.audit.log.async",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.audit.log.async",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.avoid.read.stale.datanode",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.avoid.read.stale.datanode",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.avoid.write.stale.datanode",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.avoid.write.stale.datanode",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.checkpoint.dir",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.checkpoint.dir",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.checkpoint.edits.dir",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.checkpoint.edits.dir",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.checkpoint.period",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.checkpoint.period",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.checkpoint.txns",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.checkpoint.txns",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.fslock.fair",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.fslock.fair",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.handler.count",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.handler.count",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.http-address",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.http-address",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.https-address",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.https-address",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.inode.attributes.provider.class",
+ "StackConfigurations" : {
+ "property_depends_on" : [
+ {
+ "type" : "ranger-hdfs-plugin-properties",
+ "name" : "ranger-hdfs-plugin-enabled"
+ }
+ ],
+ "property_name" : "dfs.namenode.inode.attributes.provider.class",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.name.dir",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.name.dir",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.name.dir.restore",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.name.dir.restore",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.rpc-address",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.rpc-address",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.safemode.threshold-pct",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.safemode.threshold-pct",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.secondary.http-address",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.secondary.http-address",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.stale.datanode.interval",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.stale.datanode.interval",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.startup.delay.block.deletion.sec",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.startup.delay.block.deletion.sec",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.namenode.write.stale.datanode.ratio",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.namenode.write.stale.datanode.ratio",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.permissions.enabled",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.permissions.enabled",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.permissions.superusergroup",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.permissions.superusergroup",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.replication",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.replication",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.replication.max",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.replication.max",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.support.append",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.support.append",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dfs.webhdfs.enabled",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dfs.webhdfs.enabled",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/dtnode_heapsize",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "dtnode_heapsize",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hadoop-env.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/fs.defaultFS",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "fs.defaultFS",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "core-site.xml"
+ },
+ "dependencies" : [
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/fs.defaultFS/dependencies/xasecure.audit.destination.hdfs.dir",
+ "StackConfigurationDependency" : {
+ "dependency_name" : "xasecure.audit.destination.hdfs.dir",
+ "dependency_type" : "ranger-env",
+ "property_name" : "fs.defaultFS",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3"
+ }
+ }
+ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/fs.permissions.umask-mode",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "fs.permissions.umask-mode",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "hdfs-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/fs.trash.interval",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "fs.trash.interval",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "core-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/ha.failover-controller.active-standby-elector.zk.op.retries",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "ha.failover-controller.active-standby-elector.zk.op.retries",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "core-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/hadoop.http.authentication.simple.anonymous.allowed",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hadoop.http.authentication.simple.anonymous.allowed",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "core-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/hadoop.rpc.protection",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hadoop.rpc.protection",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "ranger-hdfs-plugin-properties.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/hadoop.security.auth_to_local",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hadoop.security.auth_to_local",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "core-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/hadoop.security.authentication",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hadoop.security.authentication",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "core-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/hadoop.security.authorization",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hadoop.security.authorization",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "core-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/hadoop.security.key.provider.path",
+ "StackConfigurations" : {
+ "property_depends_on" : [
+ {
+ "type" : "hadoop-env",
+ "name" : "keyserver_port"
+ },
+ {
+ "type" : "kms-env",
+ "name" : "kms_port"
+ },
+ {
+ "type" : "hadoop-env",
+ "name" : "keyserver_host"
+ },
+ {
+ "type" : "ranger-kms-site",
+ "name" : "ranger.service.https.attrib.ssl.enabled"
+ }
+ ],
+ "property_name" : "hadoop.security.key.provider.path",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+ "stack_version" : "2.3",
+ "type" : "core-site.xml"
+ },
+ "dependencies" : [ ]
+ },
+ {
+ "href" : "/api/v1/stacks/HDP/versions/2.3/services/HDFS/configurations/hadoop_heapsize",
+ "StackConfigurations" : {
+ "property_depends_on" : [ ],
+ "property_name" : "hadoop_heapsize",
+ "service_name" : "HDFS",
+ "stack_name" : "HDP",
+
<TRUNCATED>
[45/50] [abbrv] ambari git commit: AMBARI-14537 Update API request
using resource predicate (akovalenko)
Posted by nc...@apache.org.
AMBARI-14537 Update API request using resource predicate (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d6883af7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d6883af7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d6883af7
Branch: refs/heads/branch-dev-patch-upgrade
Commit: d6883af71dc90c21e400e32553adad76e653f00d
Parents: 2feea0b
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Mon Jan 4 17:14:35 2016 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Mon Jan 4 17:14:35 2016 +0200
----------------------------------------------------------------------
ambari-web/app/controllers/main/service.js | 31 ++++++--------------
ambari-web/app/utils/ajax/ajax.js | 22 ++++++++++++++
.../test/controllers/main/service_test.js | 13 +-------
3 files changed, 32 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d6883af7/ambari-web/app/controllers/main/service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service.js b/ambari-web/app/controllers/main/service.js
index 8fda05a..ab68890 100644
--- a/ambari-web/app/controllers/main/service.js
+++ b/ambari-web/app/controllers/main/service.js
@@ -300,20 +300,15 @@ App.MainServiceController = Em.ArrayController.extend({
*/
restartAllRequired: function () {
var self = this;
- var servicesList = [];
- var hostComponentsToRestart = [];
if (!this.get('isRestartAllRequiredDisabled')) {
- App.HostComponent.find().filterProperty('staleConfigs').forEach(function (hostComponent) {
- hostComponentsToRestart.push({
- component_name: hostComponent.get('componentName'),
- service_name: hostComponent.get('service.serviceName'),
- hosts: hostComponent.get('hostName')
- });
- servicesList.push(hostComponent.get('service.displayName'));
- });
return App.showConfirmationPopup(function () {
- self.restartHostComponents(hostComponentsToRestart);
- }, Em.I18n.t('services.service.refreshAll.confirmMsg').format(servicesList.uniq().join(', ')), null, null, Em.I18n.t('services.service.restartAll.confirmButton'));
+ self.restartHostComponents();
+ }, Em.I18n.t('services.service.refreshAll.confirmMsg').format(
+ App.HostComponent.find().filterProperty('staleConfigs').mapProperty('service.displayName').uniq().join(', ')),
+ null,
+ null,
+ Em.I18n.t('services.service.restartAll.confirmButton')
+ );
} else {
return null;
}
@@ -323,18 +318,10 @@ App.MainServiceController = Em.ArrayController.extend({
* Send request restart host components from hostComponentsToRestart
* @returns {$.ajax}
*/
- restartHostComponents: function (hostComponentsToRestart) {
+ restartHostComponents: function () {
App.ajax.send({
- name: 'restart.hostComponents',
+ name: 'restart.staleConfigs',
sender: this,
- data: {
- context: 'Restart all required services',
- resource_filters: hostComponentsToRestart,
- operation_level: {
- level: "CLUSTER",
- cluster_name: App.get('clusterName')
- }
- },
success: 'restartAllRequiredSuccessCallback'
});
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/d6883af7/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 762ffa6..b52bcfe 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -2178,6 +2178,28 @@ var urls = {
}
},
+ 'restart.staleConfigs': {
+ 'real': "/clusters/{clusterName}/requests",
+ 'mock': "",
+ 'format': function () {
+ return {
+ type: 'POST',
+ data: JSON.stringify({
+ "RequestInfo": {
+ "command": "RESTART",
+ "context": "Restart all required services",
+ "operation_level": "host_component"
+ },
+ "Requests/resource_filters": [
+ {
+ "hosts_predicate": "HostRoles/stale_configs=true"
+ }
+ ]
+ })
+ }
+ }
+ },
+
'bulk_request.decommission': {
'real': '/clusters/{clusterName}/requests',
'mock': '',
http://git-wip-us.apache.org/repos/asf/ambari/blob/d6883af7/ambari-web/test/controllers/main/service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service_test.js b/ambari-web/test/controllers/main/service_test.js
index 3c90b9d..f9e6e8b 100644
--- a/ambari-web/test/controllers/main/service_test.js
+++ b/ambari-web/test/controllers/main/service_test.js
@@ -396,18 +396,7 @@ describe('App.MainServiceController', function () {
popup = mainServiceController.restartAllRequired();
popup.onPrimary();
expect(App.showConfirmationPopup.args[0][1]).to.equal(Em.I18n.t('services.service.refreshAll.confirmMsg').format('displayName1, displayName2'));
- expect(mainServiceController.restartHostComponents.calledWith([
- {
- component_name: 'componentName1',
- service_name: 'serviceName1',
- hosts: 'hostName1'
- },
- {
- component_name: 'componentName2',
- service_name: 'serviceName2',
- hosts: 'hostName2'
- }
- ])).to.be.true;
+ expect(mainServiceController.restartHostComponents.calledOnce).to.be.true;
});
it('should not open popup if isRestartAllRequiredDisabled is true', function(){
[29/50] [abbrv] ambari git commit: AMBARI-14505. UpgradeCatalog211
executeHostComponentStateDDLUpdates is not idempotent (aonishuk)
Posted by nc...@apache.org.
AMBARI-14505. UpgradeCatalog211 executeHostComponentStateDDLUpdates is not idempotent (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1c40e9c2
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1c40e9c2
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1c40e9c2
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 1c40e9c29999e07367959bf6e0675355264d7243
Parents: 23a921b
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Wed Dec 30 15:21:27 2015 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Wed Dec 30 15:21:27 2015 +0200
----------------------------------------------------------------------
.../server/upgrade/UpgradeCatalog211.java | 140 ++++++++++---------
1 file changed, 71 insertions(+), 69 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c40e9c2/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog211.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog211.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog211.java
index cafbc35..db13612 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog211.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog211.java
@@ -201,87 +201,89 @@ public class UpgradeCatalog211 extends AbstractUpgradeCatalog {
* @throws SQLException
*/
private void executeHostComponentStateDDLUpdates() throws AmbariException, SQLException {
- // add the new column, nullable for now until we insert unique IDs
- dbAccessor.addColumn(HOST_COMPONENT_STATE_TABLE,
- new DBColumnInfo(HOST_COMPONENT_STATE_ID_COLUMN, Long.class, null, null, true));
-
- Statement statement = null;
- ResultSet resultSet = null;
- try {
- statement = dbAccessor.getConnection().createStatement();
- if (statement != null) {
- String selectSQL = MessageFormat.format(
- "SELECT cluster_id, service_name, component_name, host_id FROM {0}",
- HOST_COMPONENT_STATE_TABLE);
-
- resultSet = statement.executeQuery(selectSQL);
- while (resultSet.next()) {
- final Long clusterId = resultSet.getLong("cluster_id");
- final String serviceName = resultSet.getString("service_name");
- final String componentName = resultSet.getString("component_name");
- final Long hostId = resultSet.getLong("host_id");
-
- String updateSQL = MessageFormat.format(
- "UPDATE {0} SET {1} = {2,number,#} WHERE cluster_id = {3} AND service_name = ''{4}'' AND component_name = ''{5}'' and host_id = {6,number,#}",
- HOST_COMPONENT_STATE_TABLE, HOST_COMPONENT_STATE_ID_COLUMN, m_hcsId.getAndIncrement(),
- clusterId, serviceName, componentName, hostId);
-
- dbAccessor.executeQuery(updateSQL);
+ if (!dbAccessor.tableHasPrimaryKey(HOST_COMPONENT_STATE_TABLE, HOST_COMPONENT_STATE_ID_COLUMN)) {
+ // add the new column, nullable for now until we insert unique IDs
+ dbAccessor.addColumn(HOST_COMPONENT_STATE_TABLE,
+ new DBColumnInfo(HOST_COMPONENT_STATE_ID_COLUMN, Long.class, null, null, true));
+
+ Statement statement = null;
+ ResultSet resultSet = null;
+ try {
+ statement = dbAccessor.getConnection().createStatement();
+ if (statement != null) {
+ String selectSQL = MessageFormat.format(
+ "SELECT cluster_id, service_name, component_name, host_id FROM {0}",
+ HOST_COMPONENT_STATE_TABLE);
+
+ resultSet = statement.executeQuery(selectSQL);
+ while (resultSet.next()) {
+ final Long clusterId = resultSet.getLong("cluster_id");
+ final String serviceName = resultSet.getString("service_name");
+ final String componentName = resultSet.getString("component_name");
+ final Long hostId = resultSet.getLong("host_id");
+
+ String updateSQL = MessageFormat.format(
+ "UPDATE {0} SET {1} = {2,number,#} WHERE cluster_id = {3} AND service_name = ''{4}'' AND component_name = ''{5}'' and host_id = {6,number,#}",
+ HOST_COMPONENT_STATE_TABLE, HOST_COMPONENT_STATE_ID_COLUMN, m_hcsId.getAndIncrement(),
+ clusterId, serviceName, componentName, hostId);
+
+ dbAccessor.executeQuery(updateSQL);
+ }
}
+ } finally {
+ JdbcUtils.closeResultSet(resultSet);
+ JdbcUtils.closeStatement(statement);
}
- } finally {
- JdbcUtils.closeResultSet(resultSet);
- JdbcUtils.closeStatement(statement);
- }
- // make the column NON NULL now
- dbAccessor.alterColumn(HOST_COMPONENT_STATE_TABLE,
- new DBColumnInfo(HOST_COMPONENT_STATE_ID_COLUMN, Long.class, null, null, false));
+ // make the column NON NULL now
+ dbAccessor.alterColumn(HOST_COMPONENT_STATE_TABLE,
+ new DBColumnInfo(HOST_COMPONENT_STATE_ID_COLUMN, Long.class, null, null, false));
- // Add sequence for hostcomponentstate id
- addSequence("hostcomponentstate_id_seq", m_hcsId.get(), false);
+ // Add sequence for hostcomponentstate id
+ addSequence("hostcomponentstate_id_seq", m_hcsId.get(), false);
- // drop the current PK
- String primaryKeyConstraintName = null;
- Configuration.DatabaseType databaseType = configuration.getDatabaseType();
- switch (databaseType) {
- case POSTGRES: {
- primaryKeyConstraintName = "hostcomponentstate_pkey";
- break;
- }
- case ORACLE:
- case SQL_SERVER: {
- // Oracle and SQL Server require us to lookup the PK name
- primaryKeyConstraintName = dbAccessor.getPrimaryKeyConstraintName(
- HOST_COMPONENT_STATE_TABLE);
+ // drop the current PK
+ String primaryKeyConstraintName = null;
+ Configuration.DatabaseType databaseType = configuration.getDatabaseType();
+ switch (databaseType) {
+ case POSTGRES: {
+ primaryKeyConstraintName = "hostcomponentstate_pkey";
+ break;
+ }
+ case ORACLE:
+ case SQL_SERVER: {
+ // Oracle and SQL Server require us to lookup the PK name
+ primaryKeyConstraintName = dbAccessor.getPrimaryKeyConstraintName(
+ HOST_COMPONENT_STATE_TABLE);
- break;
+ break;
+ }
+ default:
+ break;
}
- default:
- break;
- }
- if (databaseType == DatabaseType.MYSQL) {
- String mysqlDropQuery = MessageFormat.format("ALTER TABLE {0} DROP PRIMARY KEY",
- HOST_COMPONENT_STATE_TABLE);
-
- dbAccessor.executeQuery(mysqlDropQuery, true);
- } else {
- // warn if we can't find it
- if (null == primaryKeyConstraintName) {
- LOG.warn("Unable to determine the primary key constraint name for {}",
+ if (databaseType == DatabaseType.MYSQL) {
+ String mysqlDropQuery = MessageFormat.format("ALTER TABLE {0} DROP PRIMARY KEY",
HOST_COMPONENT_STATE_TABLE);
+
+ dbAccessor.executeQuery(mysqlDropQuery, true);
} else {
- dbAccessor.dropPKConstraint(HOST_COMPONENT_STATE_TABLE, primaryKeyConstraintName, true);
+ // warn if we can't find it
+ if (null == primaryKeyConstraintName) {
+ LOG.warn("Unable to determine the primary key constraint name for {}",
+ HOST_COMPONENT_STATE_TABLE);
+ } else {
+ dbAccessor.dropPKConstraint(HOST_COMPONENT_STATE_TABLE, primaryKeyConstraintName, true);
+ }
}
- }
- // create a new PK, matching the name of the constraint found in the SQL
- // files
- dbAccessor.addPKConstraint(HOST_COMPONENT_STATE_TABLE, "pk_hostcomponentstate", "id");
+ // create a new PK, matching the name of the constraint found in the SQL
+ // files
+ dbAccessor.addPKConstraint(HOST_COMPONENT_STATE_TABLE, "pk_hostcomponentstate", "id");
- // create index, ensuring column order matches that of the SQL files
- dbAccessor.createIndex(HOST_COMPONENT_STATE_INDEX, HOST_COMPONENT_STATE_TABLE, "host_id",
- "component_name", "service_name", "cluster_id");
+ // create index, ensuring column order matches that of the SQL files
+ dbAccessor.createIndex(HOST_COMPONENT_STATE_INDEX, HOST_COMPONENT_STATE_TABLE, "host_id",
+ "component_name", "service_name", "cluster_id");
+ }
}
}
[27/50] [abbrv] ambari git commit: AMBARI-14522. Unable to install
Ranger Admin and start Ranger Usersync (aonishuk)
Posted by nc...@apache.org.
AMBARI-14522. Unable to install Ranger Admin and start Ranger Usersync (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0050787b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0050787b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0050787b
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 0050787b853898a1387556b8f16cd1bfe609c3b5
Parents: 8a748ff
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Wed Dec 30 12:23:53 2015 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Wed Dec 30 12:23:53 2015 +0200
----------------------------------------------------------------------
.../common-services/RANGER/0.4.0/package/scripts/ranger_service.py | 2 +-
.../RANGER/0.4.0/package/scripts/setup_ranger_xml.py | 2 +-
.../common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms.py | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/0050787b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_service.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_service.py
index 9270ea3..8bbab02 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_service.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_service.py
@@ -35,7 +35,7 @@ def ranger_service(name, action=None):
if params.stack_is_hdp23_or_further:
Directory(format('{usersync_log_dir}/'),
- user = params.unix_user,
+ owner = params.unix_user,
group = params.unix_group,
recursive_ownership = True,
)
http://git-wip-us.apache.org/repos/asf/ambari/blob/0050787b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
index 5e9f394..119da1a 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
@@ -96,7 +96,7 @@ def setup_ranger_admin(upgrade_type=None):
Execute(('cp', '-f', src_file, dst_file), sudo=True)
Directory(format('{ranger_home}/'),
- user = params.unix_user,
+ owner = params.unix_user,
group = params.unix_group,
recursive_ownership = True,
)
http://git-wip-us.apache.org/repos/asf/ambari/blob/0050787b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms.py b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms.py
index a611f8e..5119f1e 100755
--- a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms.py
+++ b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms.py
@@ -202,7 +202,7 @@ def kms():
)
Directory(format('{kms_home}/'),
- user = params.kms_user,
+ owner = params.kms_user,
group = params.kms_group,
recursive_ownership = True,
)
[44/50] [abbrv] ambari git commit: AMBARI-14498. Create RU/EU upgrade
pack for HDP-2.4 (dlysnichenko)
Posted by nc...@apache.org.
AMBARI-14498. Create RU/EU upgrade pack for HDP-2.4 (dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2feea0bd
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2feea0bd
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2feea0bd
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 2feea0bd878fa2cce0f4c4e00c4c757b07352632
Parents: 52ca9da
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Thu Dec 31 18:01:41 2015 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Thu Dec 31 18:02:41 2015 +0200
----------------------------------------------------------------------
.../HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml | 1 -
.../HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml | 960 +++++++++++++++++
.../stacks/HDP/2.3/upgrades/upgrade-2.3.xml | 6 +
.../stacks/HDP/2.3/upgrades/upgrade-2.4.xml | 847 +++++++++++++++
.../stacks/HDP/2.4/upgrades/config-upgrade.xml | 92 ++
.../HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml | 1001 ++++++++++++++++++
.../stacks/HDP/2.4/upgrades/upgrade-2.4.xml | 808 ++++++++++++++
7 files changed, 3714 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2feea0bd/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
index 3b45149..ba2578b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
@@ -146,7 +146,6 @@
</task>
</execute-stage>
- <!--TODO(dlysnichenko): This step is missing in 2.3->2.3+ RU pack -->
<execute-stage service="KNOX" component="KNOX_GATEWAY" title="Backup Knox Data">
<task xsi:type="manual">
<message>Before continuing, please backup the Knox data. E.g., "cp -RL /usr/hdp/current/knox-server/data/* ~/knox_backup/" on the following host(s): {{hosts.all}}.</message>
http://git-wip-us.apache.org/repos/asf/ambari/blob/2feea0bd/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
new file mode 100644
index 0000000..ab91379
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
@@ -0,0 +1,960 @@
+<?xml version="1.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.
+-->
+
+
+<upgrade xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <target>2.4.*.*</target>
+ <target-stack>HDP-2.4</target-stack>
+ <type>NON_ROLLING</type>
+ <prerequisite-checks>
+ <configuration>
+ <!-- Configuration properties for all pre-reqs including required pre-reqs -->
+ <!--TODO: is it required? -->
+ <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
+ <property name="min-failure-stack-version">HDP-2.3.0.0</property>
+ </check-properties>
+ </configuration>
+ </prerequisite-checks>
+ <order>
+ <group xsi:type="cluster" name="PRE_CLUSTER" title="Prepare Upgrade">
+ <direction>UPGRADE</direction>
+
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage service="YARN" component="RESOURCEMANAGER" title="Stop YARN Queues">
+ <task xsi:type="manual">
+ <message>Before continuing, please stop all YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="SLIDER" component="SLIDER" title="Stop Long Running Applications on Slider">
+ <task xsi:type="manual">
+ <message>Before continuing, please stop all long-running applications deployed using Slider. E.g., su - yarn "/usr/hdp/current/slider-client/bin/slider stop <app_name>"</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="STORM" component="NIMBUS" title="Stop Storm Topologies">
+ <task xsi:type="manual">
+ <message>Before continuing, please deactivate and kill any currently running topologies.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="TEZ" component="TEZ_CLIENT" title="Check Tez Tarball">
+ <task xsi:type="execute" hosts="any">
+ <script>scripts/pre_upgrade.py</script>
+ <function>prepare</function>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="stop" name="STOP_HIGH_LEVEL_SERVICE_COMPONENTS" title="Stop Components for High-Level Services">
+ <direction>UPGRADE</direction>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <service-check>false</service-check>
+ <parallel-scheduler/>
+
+ <service name="FLUME">
+ <component>FLUME_HANDLER</component>
+ </service>
+
+ <service name="ACCUMULO">
+ <component>ACCUMULO_TRACER</component>
+ <component>ACCUMULO_GC</component>
+ <component>ACCUMULO_TSERVER</component>
+ <component>ACCUMULO_MONITOR</component>
+ <component>ACCUMULO_MASTER</component>
+ </service>
+
+ <service name="STORM">
+ <component>DRPC_SERVER</component>
+ <component>STORM_UI_SERVER</component>
+ <component>SUPERVISOR</component>
+ <component>NIMBUS</component>
+ </service>
+
+ <service name="KNOX">
+ <component>KNOX_GATEWAY</component>
+ </service>
+
+ <service name="KAFKA">
+ <component>KAFKA_BROKER</component>
+ </service>
+
+ <service name="FALCON">
+ <component>FALCON_SERVER</component>
+ </service>
+
+ <service name="OOZIE">
+ <component>OOZIE_SERVER</component>
+ </service>
+
+ <service name="SPARK">
+ <component>SPARK_JOBHISTORYSERVER</component>
+ </service>
+
+ <service name="HIVE">
+ <component>WEBHCAT_SERVER</component>
+ <component>HIVE_SERVER</component>
+ <component>HIVE_METASTORE</component>
+ </service>
+
+ <service name="YARN">
+ <component>NODEMANAGER</component>
+ <component>RESOURCEMANAGER</component>
+ <component>APP_TIMELINE_SERVER</component>
+ </service>
+
+ <service name="MAPREDUCE2">
+ <component>HISTORYSERVER</component>
+ </service>
+ </group>
+
+ <group xsi:type="cluster" name="Backups" title="Perform Backups">
+ <direction>UPGRADE</direction>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Backup Oozie Database">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Oozie Server database on {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HIVE" component="HIVE_METASTORE" title="Backup Hive Metastore">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Hive Metastore database referenced by the Hive Metastore service(s) located on the following host(s): {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="KNOX" component="KNOX_GATEWAY" title="Backup Knox Data">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Knox data. E.g., "cp -RL /var/lib/knox/data/* ~/knox_backup/" on the following host(s): {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HBASE" component="HBASE_MASTER" title="Snapshot HBASE">
+ <task xsi:type="execute" hosts="master">
+ <script>scripts/hbase_upgrade.py</script>
+ <function>take_snapshot</function>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HDFS" component="NAMENODE" title="Prepare HDFS">
+ <task xsi:type="execute" hosts="master">
+ <script>scripts/namenode.py</script>
+ <function>prepare_express_upgrade</function>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="RANGER" component="RANGER_ADMIN" title="Backup Ranger Database">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Ranger Admin database and Ranger Audit database on the following host(s): {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="stop" name="STOP_LOW_LEVEL_SERVICE_COMPONENTS" title="Stop Components for Core Services">
+ <direction>UPGRADE</direction>
+ <skippable>true</skippable>
+ <service-check>false</service-check>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+
+ <service name="HBASE">
+ <component>HBASE_REGIONSERVER</component>
+ <component>HBASE_MASTER</component>
+ </service>
+
+ <service name="HDFS">
+ <component>DATANODE</component>
+ <component>NAMENODE</component>
+ <component>SECONDARY_NAMENODE</component>
+ <component>ZKFC</component>
+ <component>JOURNALNODE</component>
+ </service>
+
+ <service name="RANGER">
+ <component>RANGER_USERSYNC</component>
+ <component>RANGER_ADMIN</component>
+ </service>
+
+ <service name="ZOOKEEPER">
+ <component>ZOOKEEPER_SERVER</component>
+ </service>
+ </group>
+
+ <group xsi:type="cluster" name="Restore Backups" title="Restore Backups">
+ <direction>DOWNGRADE</direction>
+ <skippable>true</skippable>
+
+ <!-- If the user attempts a downgrade after this point, they will need to restore backups
+ before starting any of the services. -->
+
+ <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Restore Oozie Database">
+ <task xsi:type="manual">
+ <message>Before continuing, please restore the Oozie Server database on {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HIVE" component="HIVE_METASTORE" title="Restore Hive Metastore">
+ <task xsi:type="manual">
+ <message>Before continuing, please restore the Hive Metastore database located on the following host(s): {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="KNOX" component="KNOX_GATEWAY" title="Restore Knox Data">
+ <task xsi:type="manual">
+ <message>Before continuing, please restore the Knox data. E.g., "cp -RL ~/knox_backup/* /var/lib/knox/data/" on the following host(s): {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="RANGER" component="RANGER_ADMIN" title="Restore Ranger Database">
+ <task xsi:type="manual">
+ <message>Before continuing, please restore the Ranger Admin database and Ranger Audit database on the following host(s): {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+ </group>
+
+ <!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
+ <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" title="Update Target Stack">
+ <execute-stage title="Update Target Stack" service="" component="">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="cluster" name="Upgrade service configs" title="Upgrade service configs">
+ <direction>UPGRADE</direction> <!-- prevent config changes on downgrade -->
+ <skippable>true</skippable> <!-- May fix configuration problems manually -->
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage service="TEZ" component="TEZ_CLIENT" title="Apply config changes for Tez">
+ <task xsi:type="configure" id="hdp_2_4_0_0_tez_client_adjust_tez_lib_uris_property"/>
+ </execute-stage>
+
+ <execute-stage service="HIVE" component="WEBHCAT_SERVER" title="Apply config changes for WebHCat Server">
+ <task xsi:type="configure" id="hdp_2_4_0_0_webhcat_server_update_configuration_paths"/>
+ </execute-stage>
+
+ <!-- KAFKA -->
+ <!--TODO: remove? Used for non-rolling upgrade only-->
+ <execute-stage service="KAFKA" component="KAFKA_BROKER" title="Apply config changes for Kafka">
+ <task xsi:type="configure" id ="hdp_2_4_0_0_kafka_broker_listeners"/>
+ </execute-stage>
+
+ </group>
+
+ <!-- Now, restart all of the services. -->
+ <group xsi:type="restart" name="ZOOKEEPER" title="ZooKeeper">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="ZOOKEEPER">
+ <service-check>false</service-check>
+ <component>ZOOKEEPER_SERVER</component>
+ <component>ZOOKEEPER_CLIENT</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="RANGER" title="Ranger">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="RANGER">
+ <component>RANGER_ADMIN</component>
+ <component>RANGER_USERSYNC</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="HDFS" title="HDFS">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="HDFS">
+ <component>JOURNALNODE</component>
+ <component>ZKFC</component>
+ <component>NAMENODE</component>
+ <component>SECONDARY_NAMENODE</component>
+ <component>HDFS_CLIENT</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="HDFS_DATANODES" title="HDFS DataNodes">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="HDFS">
+ <component>DATANODE</component>
+ </service>
+ </group>
+
+ <group xsi:type="cluster" name="HDFS_LEAVE_SAFEMODE" title="HDFS - Wait to leave Safemode">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage service="HDFS" component="NAMENODE" title="Wait to leave Safemode">
+ <task xsi:type="execute" hosts="all" summary="Wait for NameNode to leave Safemode">
+ <script>scripts/namenode.py</script>
+ <function>wait_for_safemode_off</function>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="restart" name="YARN_AND_MAPR" title="YARN and MapReduce2">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+
+ <service name="MAPREDUCE2">
+ <component>HISTORYSERVER</component>
+ <component>MAPREDUCE2_CLIENT</component>
+ </service>
+
+ <service name="YARN">
+ <component>APP_TIMELINE_SERVER</component>
+ <component>RESOURCEMANAGER</component>
+ <component>YARN_CLIENT</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="YARN_NODEMANAGERS" title="YARN NodeManagers">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+
+ <service name="YARN">
+ <component>NODEMANAGER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="HBASE" title="HBASE">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="HBASE">
+ <component>HBASE_MASTER</component>
+ <component>HBASE_REGIONSERVER</component>
+ <component>HBASE_CLIENT</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="CLIENTS" title="Tez, Pig, Sqoop Clients">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="TEZ">
+ <component>TEZ_CLIENT</component>
+ </service>
+
+ <service name="PIG">
+ <component>PIG</component>
+ </service>
+
+ <service name="SQOOP">
+ <component>SQOOP</component>
+ </service>
+ </group>
+
+ <group name="SERVICE_CHECK" title="All Service Checks" xsi:type="service-check">
+ <skippable>true</skippable>
+ <direction>UPGRADE</direction>
+ <priority>
+ <service>HDFS</service>
+ <service>YARN</service>
+ <service>MAPREDUCE2</service>
+ <service>HBASE</service>
+ </priority>
+ </group>
+
+ <group xsi:type="restart" name="HIVE" title="Hive">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="HIVE">
+ <component>HIVE_METASTORE</component>
+ <component>HIVE_SERVER</component>
+ <component>WEBHCAT_SERVER</component>
+ <component>HIVE_CLIENT</component>
+ <component>HCAT</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="SPARK" title="Spark">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="SPARK">
+ <component>SPARK_JOBHISTORYSERVER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="SPARK_CLIENTS" title="Spark Clients">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="SPARK">
+ <component>SPARK_CLIENT</component>
+ </service>
+ </group>
+
+ <!-- Upgrade Oozie DB only on Upgrade direction, and always create a new ShareLib. -->
+ <group name="UPGRADE_OOZIE" title="Upgrade Oozie Database">
+ <direction>UPGRADE</direction>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Upgrade Oozie Database">
+ <task xsi:type="execute" hosts="any" summary="Upgrading the database and creating a new sharelib">
+ <script>scripts/oozie_server_upgrade.py</script>
+ <function>upgrade_oozie_database_and_sharelib</function>
+ </task>
+ </execute-stage>
+ </group>
+
+ <!-- Only create the ShareLib folder during a Downgrade. -->
+ <group name="DOWNGRADE_OOZIE" title="Downgrade Oozie ShareLib">
+ <direction>DOWNGRADE</direction>
+ <skippable>true</skippable>
+ <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Downgrade Oozie ShareLib">
+ <task xsi:type="execute" hosts="any" summary="Upgrading the database and creating a new sharelib">
+ <script>scripts/oozie_server_upgrade.py</script>
+ <function>create_sharelib</function>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="restart" name="OOZIE" title="Oozie">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="OOZIE">
+ <component>OOZIE_SERVER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="OOZIE_CLIENTS" title="Oozie Clients">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="OOZIE">
+ <component>OOZIE_CLIENT</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="FALCON" title="Falcon">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="FALCON">
+ <component>FALCON_SERVER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="FALCON_CLIENTS" title="Falcon Clients">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="FALCON">
+ <component>FALCON_CLIENT</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="KAFKA" title="Kafka">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="KAFKA">
+ <component>KAFKA_BROKER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="KNOX" title="Knox">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="KNOX">
+ <component>KNOX_GATEWAY</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="STORM" title="Storm">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="STORM">
+ <component>NIMBUS</component>
+ <component>SUPERVISOR</component>
+ <component>STORM_UI_SERVER</component>
+ <component>DRPC_SERVER</component>
+ </service>
+
+ <execute-stage service="STORM" component="DRPC_SERVER" title="Rebuild Storm Topology">
+ <task xsi:type="manual">
+ <message>Please rebuild your topology using the new Storm version dependencies and resubmit it using the newly created jar.</message>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="restart" name="SLIDER" title="Slider">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="SLIDER">
+ <component>SLIDER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="FLUME" title="Flume">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="FLUME">
+ <component>FLUME_HANDLER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="ACCUMULO" title="Accumulo">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="ACCUMULO">
+ <component>ACCUMULO_MASTER</component>
+ <component>ACCUMULO_TSERVER</component>
+ <component>ACCUMULO_MONITOR</component>
+ <component>ACCUMULO_GC</component>
+ <component>ACCUMULO_TRACER</component>
+ <component>ACCUMULO_CLIENT</component>
+ </service>
+ </group>
+
+ <!--
+ Invoke "hdp-select set all" to change any components we may have missed
+ that are installed on the hosts but not known by Ambari.
+ -->
+ <group xsi:type="cluster" name="ALL_HOST_OPS" title="Set Version On All Hosts">
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage title="Update stack to {{version}}">
+ <task xsi:type="execute">
+ <script>scripts/ru_set_all.py</script>
+ <function>actionexecute</function>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="cluster" name="FINALIZE_PRE_CHECK" title="Finalize {{direction.text.proper}} Pre-Check">
+ <direction>UPGRADE</direction>
+
+ <execute-stage title="Check Component Versions">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.ComponentVersionCheckAction" />
+ </execute-stage>
+ </group>
+
+ <group xsi:type="cluster" name="POST_CLUSTER" title="Finalize {{direction.text.proper}}">
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage title="Confirm Finalize">
+ <direction>UPGRADE</direction>
+ <task xsi:type="manual">
+ <message>Please confirm you are ready to finalize.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
+ <task xsi:type="execute" hosts="master">
+ <script>scripts/namenode.py</script>
+ <function>finalize_non_rolling_upgrade</function>
+ </task>
+ </execute-stage>
+
+ <execute-stage title="Save Cluster State" service="" component="">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.FinalizeUpgradeAction">
+ </task>
+ </execute-stage>
+ </group>
+ </order>
+
+ <processing>
+ <service name="ZOOKEEPER">
+ <component name="ZOOKEEPER_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="ZOOKEEPER_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="RANGER">
+ <component name="RANGER_ADMIN">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="RANGER_USERSYNC">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="HDFS">
+ <component name="NAMENODE">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="DATANODE">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HDFS_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="JOURNALNODE">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="ZKFC">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="MAPREDUCE2">
+ <component name="HISTORYSERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="MAPREDUCE2_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="YARN">
+ <component name="APP_TIMELINE_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="RESOURCEMANAGER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="NODEMANAGER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="YARN_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="HBASE">
+ <component name="HBASE_MASTER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HBASE_REGIONSERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HBASE_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="TEZ">
+ <component name="TEZ_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="PIG">
+ <component name="PIG">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="SQOOP">
+ <component name="SQOOP">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="HIVE">
+ <component name="HIVE_METASTORE">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HIVE_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="WEBHCAT_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HIVE_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HCAT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="SPARK">
+ <component name="SPARK_JOBHISTORYSERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ <component name="SPARK_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="OOZIE">
+ <component name="OOZIE_SERVER">
+ <pre-upgrade>
+ <task xsi:type="execute" hosts="any" summary="Upgrading the database and creating a new sharelib">
+ <script>scripts/oozie_server_upgrade.py</script>
+ <function>upgrade_oozie_database_and_sharelib</function>
+ </task>
+ </pre-upgrade>
+
+ <pre-downgrade>
+ <task xsi:type="execute" hosts="any" summary="Create a new sharelib">
+ <script>scripts/oozie_server_upgrade.py</script>
+ <function>create_sharelib</function>
+ </task>
+ </pre-downgrade>
+
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="OOZIE_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="FALCON">
+ <component name="FALCON_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ <component name="FALCON_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="KAFKA">
+ <component name="KAFKA_BROKER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="KNOX">
+ <component name="KNOX_GATEWAY">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="STORM">
+ <component name="NIMBUS">
+ <pre-upgrade>
+ <task xsi:type="execute" summary="Removing Storm data from ZooKeeper">
+ <script>scripts/storm_upgrade.py</script>
+ <function>delete_storm_zookeeper_data</function>
+ </task>
+
+ <task xsi:type="execute" summary="Removing local Storm data">
+ <script>scripts/storm_upgrade.py</script>
+ <function>delete_storm_local_data</function>
+ </task>
+ </pre-upgrade>
+
+ <pre-downgrade>
+ <task xsi:type="manual">
+ <message>Before continuing, please deactivate and kill any currently running topologies.</message>
+ </task>
+
+ <task xsi:type="execute" summary="Removing Storm data from ZooKeeper">
+ <script>scripts/storm_upgrade.py</script>
+ <function>delete_storm_zookeeper_data</function>
+ </task>
+
+ <task xsi:type="execute" summary="Removing local Storm data">
+ <script>scripts/storm_upgrade.py</script>
+ <function>delete_storm_local_data</function>
+ </task>
+ </pre-downgrade>
+
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="SUPERVISOR">
+ <pre-upgrade>
+ <task xsi:type="execute" summary="Removing local Storm data">
+ <script>scripts/storm_upgrade.py</script>
+ <function>delete_storm_local_data</function>
+ </task>
+ </pre-upgrade>
+
+ <pre-downgrade>
+ <task xsi:type="manual">
+ <message>Before continuing, please deactivate and kill any currently running topologies.</message>
+ </task>
+
+ <task xsi:type="execute" summary="Removing local Storm data">
+ <script>scripts/storm_upgrade.py</script>
+ <function>delete_storm_local_data</function>
+ </task>
+ </pre-downgrade>
+
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="STORM_UI_SERVER">
+ <pre-upgrade>
+ <task xsi:type="execute" summary="Removing local Storm data">
+ <script>scripts/storm_upgrade.py</script>
+ <function>delete_storm_local_data</function>
+ </task>
+ </pre-upgrade>
+
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="DRPC_SERVER">
+ <pre-upgrade>
+ <task xsi:type="execute" summary="Removing local Storm data">
+ <script>scripts/storm_upgrade.py</script>
+ <function>delete_storm_local_data</function>
+ </task>
+ </pre-upgrade>
+
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+
+ <post-upgrade>
+ <task xsi:type="manual">
+ <message>Please rebuild your topology using the new Storm version dependencies and resubmit it using the newly created jar.</message>
+ </task>
+ </post-upgrade>
+ </component>
+ </service>
+
+ <service name="SLIDER">
+ <component name="SLIDER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="FLUME">
+ <component name="FLUME_HANDLER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+ </processing>
+</upgrade>
http://git-wip-us.apache.org/repos/asf/ambari/blob/2feea0bd/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
index 29384b0..5534e3e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
@@ -76,6 +76,12 @@
<skippable>true</skippable>
<supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <execute-stage service="KNOX" component="KNOX_GATEWAY" title="Backup Knox Data">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Knox data. E.g., "cp -RL /usr/hdp/current/knox-server/data/* ~/knox_backup/" on the following host(s): {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
<execute-stage service="HBASE" component="HBASE_MASTER" title="Pre Upgrade HBase Backup">
<task xsi:type="execute" hosts="master">
<script>scripts/hbase_upgrade.py</script>
http://git-wip-us.apache.org/repos/asf/ambari/blob/2feea0bd/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
new file mode 100644
index 0000000..863e0a0
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
@@ -0,0 +1,847 @@
+<?xml version="1.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.
+-->
+
+
+<upgrade xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <target>2.4.*.*</target>
+ <target-stack>HDP-2.4</target-stack>
+ <type>ROLLING</type>
+ <skip-failures>false</skip-failures>
+ <skip-service-check-failures>false</skip-service-check-failures>
+
+ <prerequisite-checks>
+ <!-- List of additional pre-req checks to run in addition to the required pre-reqs -->
+ <check>org.apache.ambari.server.checks.HiveMultipleMetastoreCheck</check>
+ <check>org.apache.ambari.server.checks.SecondaryNamenodeDeletedCheck</check>
+ <check>org.apache.ambari.server.checks.ServicesMapReduceDistributedCacheCheck</check>
+ <check>org.apache.ambari.server.checks.ServicesNamenodeHighAvailabilityCheck</check>
+ <check>org.apache.ambari.server.checks.ServicesNamenodeTruncateCheck</check>
+ <check>org.apache.ambari.server.checks.ServicesTezDistributedCacheCheck</check>
+ <check>org.apache.ambari.server.checks.ServicesYarnWorkPreservingCheck</check>
+ <check>org.apache.ambari.server.checks.YarnRMHighAvailabilityCheck</check>
+ <check>org.apache.ambari.server.checks.YarnTimelineServerStatePreservingCheck</check>
+
+ <configuration>
+ <!-- Configuration properties for all pre-reqs including required pre-reqs -->
+ <!--TODO: is it required? -->
+ <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
+ <property name="min-failure-stack-version">HDP-2.3.0.0</property>
+ </check-properties>
+ </configuration>
+ </prerequisite-checks>
+
+ <skip-failures>false</skip-failures>
+ <skip-service-check-failures>false</skip-service-check-failures>
+
+ <order>
+ <group xsi:type="cluster" name="PRE_CLUSTER" title="Prepare Upgrade">
+ <direction>UPGRADE</direction>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage service="HDFS" component="NAMENODE" title="Pre Upgrade HDFS">
+ <task xsi:type="execute" hosts="master">
+ <script>scripts/namenode.py</script>
+ <function>prepare_rolling_upgrade</function>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="TEZ" component="TEZ_CLIENT" title="Check Tez Tarball">
+ <task xsi:type="execute" hosts="any">
+ <script>scripts/pre_upgrade.py</script>
+ <function>prepare</function>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="cluster" name="PREPARE_BACKUPS" title="Prepare Backups">
+ <direction>UPGRADE</direction>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage service="HBASE" component="HBASE_MASTER" title="Pre Upgrade HBase Backup">
+ <task xsi:type="execute" hosts="master">
+ <script>scripts/hbase_upgrade.py</script>
+ <function>take_snapshot</function>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HIVE" component="HIVE_METASTORE" title="Pre Upgrade Hive Backup">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Hive Metastore database referenced by the Hive Metastore service(s) located on the following host(s): {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Pre Upgrade Oozie Backup">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Oozie Server database on {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="RANGER" component="RANGER_ADMIN" title="Pre Upgrade Ranger Backup">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Ranger Admin database and Ranger Audit database.
+ If audit database size is too large( > 3GB ) then follow the below instructions:
+ 1. Backup the audit table from audit database.
+ 2. Truncate audit table.
+ 3. Follow upgrade process and once completed then restore audit data to audit table.</message>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group name="ZOOKEEPER" title="ZooKeeper">
+ <service name="ZOOKEEPER">
+ <component>ZOOKEEPER_SERVER</component>
+ </service>
+ </group>
+
+ <group name="RANGER" title="Ranger">
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <service name="RANGER">
+ <component>RANGER_ADMIN</component>
+ <component>RANGER_USERSYNC</component>
+ </service>
+ </group>
+
+ <group name="CORE_MASTER" title="Core Masters">
+ <service-check>false</service-check>
+ <service name="HDFS">
+ <component>JOURNALNODE</component>
+ <component>NAMENODE</component>
+ <component>ZKFC</component>
+ </service>
+
+ <service name="MAPREDUCE2">
+ <component>HISTORYSERVER</component>
+ </service>
+
+ <service name="YARN">
+ <component>APP_TIMELINE_SERVER</component>
+ <component>RESOURCEMANAGER</component>
+ </service>
+
+ <service name="HBASE">
+ <component>HBASE_MASTER</component>
+ </service>
+ </group>
+
+ <group name="SERVICE_CHECK" title="All Service Checks" xsi:type="service-check">
+ <skippable>true</skippable>
+ <direction>UPGRADE</direction>
+ <priority>
+ <service>ZOOKEEPER</service>
+ <service>HDFS</service>
+ <service>YARN</service>
+ <service>MAPREDUCE2</service>
+ <service>HBASE</service>
+ </priority>
+ <exclude>
+ <service>AMBARI_METRICS</service>
+ </exclude>
+ </group>
+
+ <group name="CORE_SLAVES" title="Core Slaves" xsi:type="colocated">
+ <skippable>true</skippable>
+ <service-check>false</service-check>
+ <service name="HDFS">
+ <component>DATANODE</component>
+ </service>
+
+ <service name="HBASE">
+ <component>HBASE_REGIONSERVER</component>
+ </service>
+
+ <service name="YARN">
+ <component>NODEMANAGER</component>
+ </service>
+
+ <batch>
+ <percent>20</percent>
+ <summary>Verification Required</summary>
+ <message>The initial batch of {{components}} hosts have been {{direction.past}}. You are advised to check the hosts and perform cluster/workload-specific tests against your cluster to ensure proper operation before proceeding with {{direction.text}} of the remaining services.</message>
+ </batch>
+ </group>
+
+ <group name="SERVICE_CHECK" title="All Service Checks" xsi:type="service-check">
+ <skippable>true</skippable>
+ <direction>UPGRADE</direction>
+ <priority>
+ <service>ZOOKEEPER</service>
+ <service>HDFS</service>
+ <service>YARN</service>
+ <service>HBASE</service>
+ </priority>
+ <exclude>
+ <service>AMBARI_METRICS</service>
+ </exclude>
+ </group>
+
+ <group name="HIVE" title="Hive">
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <service name="HIVE">
+ <component>HIVE_METASTORE</component>
+ <component>HIVE_SERVER</component>
+ <component>WEBHCAT_SERVER</component>
+ </service>
+ </group>
+
+ <group name="SPARK" title="Spark">
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <service-check>false</service-check>
+ <service name="SPARK">
+ <component>SPARK_JOBHISTORYSERVER</component>
+ </service>
+ </group>
+
+ <group name="SPARK_CLIENTS" title="Spark Clients">
+ <skippable>true</skippable>
+ <service name="SPARK">
+ <component>SPARK_CLIENT</component>
+ </service>
+ </group>
+
+ <group name="OOZIE" title="Oozie">
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <service-check>false</service-check>
+ <service name="OOZIE">
+ <component>OOZIE_SERVER</component>
+ </service>
+ </group>
+
+ <group name="OOZIE_CLIENTS" title="Oozie Clients">
+ <skippable>true</skippable>
+ <service name="OOZIE">
+ <component>OOZIE_CLIENT</component>
+ </service>
+ </group>
+
+ <group name="FALCON" title="Falcon">
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <service-check>false</service-check>
+ <service name="FALCON">
+ <component>FALCON_SERVER</component>
+ </service>
+ </group>
+
+ <group name="FALCON_CLIENTS" title="Falcon Clients">
+ <skippable>true</skippable>
+ <service name="FALCON">
+ <component>FALCON_CLIENT</component>
+ </service>
+ </group>
+
+ <group name="CLIENTS" title="Client Components">
+ <service-check>false</service-check>
+ <service name="ZOOKEEPER">
+ <component>ZOOKEEPER_CLIENT</component>
+ </service>
+
+ <service name="HDFS">
+ <component>HDFS_CLIENT</component>
+ </service>
+
+ <service name="YARN">
+ <component>YARN_CLIENT</component>
+ </service>
+
+ <service name="MAPREDUCE2">
+ <component>MAPREDUCE2_CLIENT</component>
+ </service>
+
+ <service name="TEZ">
+ <component>TEZ_CLIENT</component>
+ </service>
+
+ <service name="HBASE">
+ <component>HBASE_CLIENT</component>
+ </service>
+
+ <service name="PIG">
+ <component>PIG</component>
+ </service>
+
+ <service name="SQOOP">
+ <component>SQOOP</component>
+ </service>
+
+ <service name="HIVE">
+ <component>HIVE_CLIENT</component>
+ <component>HCAT</component>
+ </service>
+ </group>
+
+ <group name="SERVICE_CHECK" title="All Service Checks" xsi:type="service-check">
+ <skippable>true</skippable>
+ <direction>UPGRADE</direction>
+ <priority>
+ <service>ZOOKEEPER</service>
+ <service>HDFS</service>
+ <service>YARN</service>
+ <service>HBASE</service>
+ </priority>
+ <exclude>
+ <service>AMBARI_METRICS</service>
+ </exclude>
+ </group>
+
+ <group name="KAFKA" title="Kafka">
+ <skippable>true</skippable>
+ <service name="KAFKA">
+ <component>KAFKA_BROKER</component>
+ </service>
+ </group>
+
+ <group name="KNOX" title="Knox">
+ <skippable>true</skippable>
+ <service name="KNOX">
+ <component>KNOX_GATEWAY</component>
+ </service>
+ </group>
+
+ <group name="STORM" title="Storm">
+ <skippable>true</skippable>
+ <service name="STORM">
+ <component>NIMBUS</component>
+ <component>SUPERVISOR</component>
+ <component>STORM_UI_SERVER</component>
+ <component>DRPC_SERVER</component>
+ </service>
+ </group>
+
+ <group name="SLIDER" title="Slider">
+ <skippable>true</skippable>
+ <service name="SLIDER">
+ <component>SLIDER</component>
+ </service>
+ </group>
+
+ <group name="FLUME" title="Flume">
+ <skippable>true</skippable>
+ <service name="FLUME">
+ <component>FLUME_HANDLER</component>
+ </service>
+ </group>
+
+ <group name="ACCUMULO" title="Accumulo">
+ <skippable>true</skippable>
+ <service name="ACCUMULO">
+ <component>ACCUMULO_MASTER</component>
+ <component>ACCUMULO_TSERVER</component>
+ <component>ACCUMULO_MONITOR</component>
+ <component>ACCUMULO_GC</component>
+ <component>ACCUMULO_TRACER</component>
+ <component>ACCUMULO_CLIENT</component>
+ </service>
+ </group>
+
+ <group xsi:type="cluster" name="ALL_HOST_OPS" title="Finalize Hosts">
+ <execute-stage title="Update remaining HDP stack to {{version}}">
+ <task xsi:type="execute">
+ <script>scripts/ru_set_all.py</script>
+ <function>actionexecute</function>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="cluster" name="FINALIZE_PRE_CHECK" title="Finalize {{direction.text.proper}} Pre-Check">
+ <direction>UPGRADE</direction>
+
+ <execute-stage title="Check Component Versions">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.ComponentVersionCheckAction" />
+ </execute-stage>
+ </group>
+
+ <group xsi:type="cluster" name="POST_CLUSTER" title="Finalize {{direction.text.proper}}">
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage title="Confirm Finalize">
+ <direction>UPGRADE</direction>
+ <task xsi:type="manual">
+ <message>Please confirm you are ready to finalize.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
+ <task xsi:type="execute" hosts="master">
+ <script>scripts/namenode.py</script>
+ <function>finalize_rolling_upgrade</function>
+ </task>
+ </execute-stage>
+
+ <execute-stage title="Save Cluster State" service="" component="">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.FinalizeUpgradeAction" />
+ </execute-stage>
+
+ </group>
+ </order>
+
+ <processing>
+ <service name="ZOOKEEPER">
+ <component name="ZOOKEEPER_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="ZOOKEEPER_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="RANGER">
+ <component name="RANGER_ADMIN">
+ <pre-downgrade /> <!-- no-op to prevent config changes on downgrade -->
+
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="RANGER_USERSYNC">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="HDFS">
+ <component name="NAMENODE">
+ <pre-downgrade /> <!-- no-op to prevent config changes on downgrade -->
+
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="DATANODE">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="HDFS_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="JOURNALNODE">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="ZKFC">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="MAPREDUCE2">
+ <component name="HISTORYSERVER">
+ <pre-downgrade /> <!-- no-op to prevent config changes on downgrade -->
+
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="MAPREDUCE2_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="YARN">
+ <component name="APP_TIMELINE_SERVER">
+ <pre-downgrade /> <!-- no-op to prevent config changes on downgrade -->
+
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="RESOURCEMANAGER">
+ <pre-downgrade /> <!-- no-op to prevent config changes on downgrade -->
+
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="NODEMANAGER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="YARN_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="HBASE">
+ <component name="HBASE_MASTER">
+ <pre-downgrade /> <!-- no-op to prevent config changes on downgrade -->
+
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="HBASE_REGIONSERVER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="HBASE_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="TEZ">
+ <component name="TEZ_CLIENT">
+ <pre-upgrade>
+ <task xsi:type="configure" id="hdp_2_4_0_0_tez_client_adjust_tez_lib_uris_property"/>
+ </pre-upgrade>
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="PIG">
+ <component name="PIG">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="SQOOP">
+ <component name="SQOOP">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="HIVE">
+ <component name="HIVE_METASTORE">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="HIVE_SERVER">
+ <pre-upgrade>
+ <task xsi:type="manual">
+ <summary>HiveServer Port Availability</summary>
+ <message>Please note that the HiveServer port will now change to 10010 if hive is using a binary transfer mode or 10011 if hive is using an http transport mode. You can use "netstat -anp | grep 1001[01]" to determine if the port is available on each of following HiveServer host(s): {{hosts.all}}. If the port is not available, the process using it must be terminated.</message>
+ </task>
+
+ <task xsi:type="configure" id="hdp_2_4_0_0_hive_server_set_transport_mode"/>
+ </pre-upgrade>
+
+ <pre-downgrade>
+ <task xsi:type="manual">
+ <summary>HiveServer Port Availability</summary>
+ <message>Please note that the HiveServer port will now change to 10000 if hive is using a binary transfer mode or 10001 if hive is using an http transport mode. You can use "netstat -anp | grep 1000[01]" to determine if the port is available on each of following HiveServer host(s): {{hosts.all}}. If the port is not available, the process using it must be terminated.</message>
+ </task>
+
+ <task xsi:type="configure" id="hdp_2_4_0_0_hive_server_restore_transport_mode_on_downgrade"/>
+ </pre-downgrade>
+
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="WEBHCAT_SERVER">
+ <pre-upgrade>
+ <task xsi:type="configure" id="hdp_2_4_0_0_webhcat_server_update_configuration_paths"/>
+ </pre-upgrade>
+
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="HIVE_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="HCAT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="SLIDER">
+ <component name="SLIDER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="SPARK">
+ <component name="SPARK_JOBHISTORYSERVER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ <component name="SPARK_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="OOZIE">
+ <component name="OOZIE_SERVER">
+ <pre-upgrade>
+ <task xsi:type="execute" hosts="all" summary="Shut down all Oozie servers">
+ <script>scripts/oozie_server.py</script>
+ <function>stop</function>
+ </task>
+
+ <task xsi:type="execute" hosts="any" summary="Upgrading the database and creating a new sharelib">
+ <script>scripts/oozie_server_upgrade.py</script>
+ <function>upgrade_oozie_database_and_sharelib</function>
+ </task>
+ </pre-upgrade>
+
+ <pre-downgrade>
+ <task xsi:type="execute" hosts="all" summary="Shut down all Oozie servers">
+ <script>scripts/oozie_server.py</script>
+ <function>stop</function>
+ </task>
+
+ <task xsi:type="execute" hosts="any" summary="Create a new sharelib">
+ <script>scripts/oozie_server_upgrade.py</script>
+ <function>create_sharelib</function>
+ </task>
+ </pre-downgrade>
+
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="OOZIE_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="FALCON">
+ <component name="FALCON_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ <component name="FALCON_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="KAFKA">
+ <component name="KAFKA_BROKER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="KNOX">
+ <component name="KNOX_GATEWAY">
+ <pre-downgrade /> <!-- no-op to prevent config changes on downgrade -->
+
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="STORM">
+ <component name="NIMBUS">
+ <pre-downgrade>
+ <task xsi:type="execute" summary="Removing Storm data from ZooKeeper">
+ <script>scripts/storm_upgrade.py</script>
+ <function>delete_storm_zookeeper_data</function>
+ </task>
+
+ <task xsi:type="execute" summary="Removing local Storm data">
+ <script>scripts/storm_upgrade.py</script>
+ <function>delete_storm_local_data</function>
+ </task>
+ </pre-downgrade>
+
+ <pre-upgrade>
+ <task xsi:type="manual">
+ <message>Before continuing, please deactivate and kill any currently running topologies.</message>
+ </task>
+
+ <task xsi:type="execute" summary="Removing Storm data from ZooKeeper">
+ <script>scripts/storm_upgrade.py</script>
+ <function>delete_storm_zookeeper_data</function>
+ </task>
+
+ <task xsi:type="execute" summary="Removing local Storm data">
+ <script>scripts/storm_upgrade.py</script>
+ <function>delete_storm_local_data</function>
+ </task>
+
+ </pre-upgrade>
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="STORM_REST_API">
+ <pre-upgrade>
+ <task xsi:type="execute" summary="Removing local Storm data">
+ <script>scripts/storm_upgrade.py</script>
+ <function>delete_storm_local_data</function>
+ </task>
+ </pre-upgrade>
+
+ <pre-downgrade>
+ <task xsi:type="manual">
+ <message>Before continuing, please deactivate and kill any currently running topologies.</message>
+ </task>
+
+ <task xsi:type="execute" summary="Removing local Storm data">
+ <script>scripts/storm_upgrade.py</script>
+ <function>delete_storm_local_data</function>
+ </task>
+ </pre-downgrade>
+
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="SUPERVISOR">
+ <pre-upgrade>
+ <task xsi:type="execute" summary="Removing local Storm data">
+ <script>scripts/storm_upgrade.py</script>
+ <function>delete_storm_local_data</function>
+ </task>
+ </pre-upgrade>
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="STORM_UI_SERVER">
+ <pre-upgrade>
+ <task xsi:type="execute" summary="Removing local Storm data">
+ <script>scripts/storm_upgrade.py</script>
+ <function>delete_storm_local_data</function>
+ </task>
+ </pre-upgrade>
+
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+
+ <component name="DRPC_SERVER">
+ <pre-upgrade>
+ <task xsi:type="execute" summary="Removing local Storm data">
+ <script>scripts/storm_upgrade.py</script>
+ <function>delete_storm_local_data</function>
+ </task>
+ </pre-upgrade>
+
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+
+ <post-upgrade>
+ <task xsi:type="manual">
+ <message>Please rebuild your topology using the new Storm version dependencies and resubmit it using the newly created jar.</message>
+ </task>
+ </post-upgrade>
+ </component>
+ </service>
+
+ <service name="FLUME">
+ <component name="FLUME_HANDLER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="ACCUMULO">
+ <component name="ACCUMULO_MASTER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ <component name="ACCUMULO_MONITOR">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ <component name="ACCUMULO_GC">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ <component name="ACCUMULO_TRACER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ <component name="ACCUMULO_TSERVER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ <component name="ACCUMULO_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
+ </processing>
+</upgrade>
http://git-wip-us.apache.org/repos/asf/ambari/blob/2feea0bd/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml
new file mode 100644
index 0000000..e8f1db4
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml
@@ -0,0 +1,92 @@
+<?xml version="1.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.
+-->
+
+<upgrade-config-changes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <services>
+
+ <service name="TEZ">
+ <component name="TEZ_CLIENT">
+ <changes>
+ <definition xsi:type="configure" id="hdp_2_4_0_0_tez_client_adjust_tez_lib_uris_property">
+ <type>tez-site</type>
+ <set key="tez.lib.uris" value="/hdp/apps/${hdp.version}/tez/tez.tar.gz"/>
+ </definition>
+ </changes>
+ </component>
+ </service>
+
+ <service name="HIVE">
+ <component name="HIVE_SERVER">
+ <changes>
+ <definition xsi:type="configure" id="hdp_2_4_0_0_hive_server_set_transport_mode">
+ <condition type="hive-site" key="hive.server2.transport.mode" value="binary">
+ <type>hive-site</type>
+ <key>hive.server2.thrift.port</key>
+ <value>10010</value>
+ </condition>
+ <condition type="hive-site" key="hive.server2.transport.mode" value="http">
+ <type>hive-site</type>
+ <key>hive.server2.http.port</key>
+ <value>10011</value>
+ </condition>
+ </definition>
+
+ <definition xsi:type="configure" id="hdp_2_4_0_0_hive_server_restore_transport_mode_on_downgrade">
+ <condition type="hive-site" key="hive.server2.transport.mode" value="binary">
+ <type>hive-site</type>
+ <key>hive.server2.thrift.port</key>
+ <value>10000</value>
+ </condition>
+ <condition type="hive-site" key="hive.server2.transport.mode" value="http">
+ <type>hive-site</type>
+ <key>hive.server2.http.port</key>
+ <value>10001</value>
+ </condition>
+ </definition>
+ </changes>
+ </component>
+
+ <component name="WEBHCAT_SERVER">
+ <changes>
+ <definition xsi:type="configure" id="hdp_2_4_0_0_webhcat_server_update_configuration_paths" summary="Updating Configuration Paths">
+ <type>webhcat-site</type>
+ <replace key="templeton.jar" find="/usr/hdp/current/hive-webhcat" replace-with="/usr/hdp/${hdp.version}/hive"/>
+ <replace key="templeton.libjars" find="/usr/hdp/current/zookeeper-client" replace-with="/usr/hdp/${hdp.version}/zookeeper,/usr/hdp/${hdp.version}/hive/lib/hive-common.jar"/>
+ <replace key="templeton.hadoop" find="/usr/hdp/current/hadoop-client" replace-with="/usr/hdp/${hdp.version}/hadoop"/>
+ <replace key="templeton.hcat" find="/usr/hdp/current/hive-client" replace-with="/usr/hdp/${hdp.version}/hive"/>
+ <set key="templeton.hive.extra.files" value="/usr/hdp/${hdp.version}/tez/conf/tez-site.xml,/usr/hdp/${hdp.version}/tez,/usr/hdp/${hdp.version}/tez/lib"/>
+ </definition>
+ </changes>
+ </component>
+ </service>
+
+ <!--TODO: remove? Used for non-rolling upgrade only-->
+ <service name="KAFKA">
+ <component name="KAFKA_BROKER">
+ <changes>
+ <definition xsi:type="configure" id="hdp_2_4_0_0_kafka_broker_listeners">
+ <type>kafka-broker</type>
+ <set key="listeners" value="PLAINTEXT://localhost:6667"/>
+ </definition>
+ </changes>
+ </component>
+ </service>
+ </services>
+
+</upgrade-config-changes>
[33/50] [abbrv] ambari git commit: AMBARI-14521. Ambari Admin:
externalize string constants used in views (alexantonenko)
Posted by nc...@apache.org.
AMBARI-14521. Ambari Admin: externalize string constants used in views (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/83ea508b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/83ea508b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/83ea508b
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 83ea508b621c5f17468f3698f0960cfcdf953f0c
Parents: ce4e4ea
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed Dec 30 15:41:15 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed Dec 30 19:50:19 2015 +0200
----------------------------------------------------------------------
.../main/resources/ui/admin-web/app/index.html | 12 +--
.../ambariViews/CreateViewInstanceCtrl.js | 3 +
.../controllers/ambariViews/ViewsEditCtrl.js | 5 ++
.../controllers/ambariViews/ViewsListCtrl.js | 4 +
.../clusters/ClustersManageAccessCtrl.js | 3 +
.../controllers/clusters/UserAccessListCtrl.js | 3 +
.../controllers/groups/GroupsEditCtrl.js | 5 ++
.../controllers/groups/GroupsListCtrl.js | 3 +
.../stackVersions/StackVersionsListCtrl.js | 3 +
.../scripts/controllers/users/UsersListCtrl.js | 4 +
.../scripts/controllers/users/UsersShowCtrl.js | 9 ++
.../ui/admin-web/app/scripts/i18n.config.js | 21 +++--
.../admin-web/app/views/ambariViews/create.html | 56 ++++++-------
.../admin-web/app/views/ambariViews/edit.html | 86 ++++++++++----------
.../app/views/ambariViews/listTable.html | 20 ++---
.../app/views/ambariViews/modals/create.html | 34 ++++----
.../app/views/ambariViews/modals/edit.html | 44 +++++-----
.../app/views/clusters/manageAccess.html | 10 +--
.../app/views/clusters/userAccessList.html | 20 ++---
.../app/views/directives/editableList.html | 4 +-
.../ui/admin-web/app/views/groups/create.html | 16 ++--
.../ui/admin-web/app/views/groups/edit.html | 28 +++----
.../ui/admin-web/app/views/groups/list.html | 24 +++---
.../ui/admin-web/app/views/leftNavbar.html | 26 +++---
.../resources/ui/admin-web/app/views/main.html | 38 ++++-----
.../admin-web/app/views/modals/AboutModal.html | 16 ++--
.../views/modals/BodyForDeregisterVersion.html | 2 +-
.../app/views/modals/TimeoutWarning.html | 4 +-
.../admin-web/app/views/stackVersions/list.html | 24 +++---
.../views/stackVersions/stackVersionPage.html | 41 ++++------
.../ui/admin-web/app/views/users/create.html | 42 ++++------
.../ui/admin-web/app/views/users/list.html | 26 +++---
.../app/views/users/modals/changePassword.html | 28 +++----
.../ui/admin-web/app/views/users/show.html | 42 +++++-----
34 files changed, 365 insertions(+), 341 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/index.html b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
index a6eab79..7b31fff 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/index.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
@@ -48,15 +48,15 @@
<header class="navbar navbar-static-top navbar-inverse">
<div class="navbar-inner">
<div class="container">
- <a href="/#/main/dashboard" class="logo"><img src="/img/logo-white.png" alt="Apache Ambari" title="Apache Ambari"></a>
- <a href="/#/main/dashboard" class="brand" title="Apache Ambari">Ambari</a>
+ <a href="/#/main/dashboard" class="logo"><img src="/img/logo-white.png" alt="{{'common.apacheAmbari' | translate}}" title="{{'common.apacheAmbari' | translate}}"></a>
+ <a href="/#/main/dashboard" class="brand" title="{{'common.apacheAmbari' | translate}}">{{'common.ambari' | translate}}</a>
<ul class="nav navbar-nav navbar-right">
<li>
<div class="btn-group navbar-views-dropdown" dropdown is-open="viewsdropdown.isopen" ng-mouseover="viewsdropdown.isopen=true" ng-mouseout="viewsdropdown.isopen=false">
<a href="/#/main/views" ng-click="gotoViewsDashboard()" class="dropdown-toggle"><i class="fa fa-th"></i></a>
<ul class="dropdown-menu" role="menu">
<li ng-repeat="instance in viewInstances"><a href="/#/main{{instance.context_path}}" ng-click="about()">{{instance.label}}</a></li>
- <li ng-show="!viewInstances.length" class="disabled"><a>No Views</a></li>
+ <li ng-show="!viewInstances.length" class="disabled"><a>{{'common.noViews' | translate}}</a></li>
</ul>
</div>
</li>
@@ -66,14 +66,14 @@
<i class="fa fa-user"></i> {{currentUser}} <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
- <li><a href ng-click="about()">About</a></li>
+ <li><a href ng-click="about()">{{'common.about' | translate}}</a></li>
<li class="divider"></li>
- <li><a href ng-click="signOut()">Sign out</a></li>
+ <li><a href ng-click="signOut()">{{'common.signOut' | translate}}</a></li>
</ul>
</div>
</li>
</ul>
- </div>
+ </div>
</div>
</header>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
index 2bc1872..962b795 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
@@ -21,6 +21,9 @@ angular.module('ambariAdminConsole')
.controller('CreateViewInstanceCtrl',['$scope', 'View', 'Alert', 'Cluster', '$routeParams', '$location', 'UnsavedDialog', '$translate', function($scope, View, Alert, Cluster, $routeParams, $location, UnsavedDialog, $translate) {
var $t = $translate.instant;
$scope.form = {};
+ $scope.constants = {
+ props: $t('views.properties')
+ };
var targetUrl = '';
function loadMeta(){
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
index ae37c88..0d2bdf7 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
@@ -23,6 +23,11 @@ angular.module('ambariAdminConsole')
$scope.identity = angular.identity;
$scope.isConfigurationEmpty = true;
$scope.isSettingsEmpty = true;
+ $scope.constants = {
+ instance: $t('views.instance'),
+ props: $t('views.properties'),
+ perms: $t('views.permissions').toLowerCase()
+ };
function reloadViewInfo(section){
// Load instance data, after View permissions meta loaded
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.js
index eadfcf7..75f6198 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.js
@@ -21,6 +21,10 @@ angular.module('ambariAdminConsole')
.controller('ViewsListCtrl',['$scope', 'View', '$modal', 'Alert', 'ConfirmationModal', '$location', '$translate', function($scope, View, $modal, Alert, ConfirmationModal, $location, $translate) {
var deferredList = [],
$t = $translate.instant;
+ $scope.constants = {
+ unable: $t('views.alerts.unableToCreate'),
+ views: $t('common.views').toLowerCase()
+ };
$scope.$on('$locationChangeStart', function() {
deferredList.forEach(function(def) {
def.reject();
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/ClustersManageAccessCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/ClustersManageAccessCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/ClustersManageAccessCtrl.js
index dfc509f..45130f7 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/ClustersManageAccessCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/ClustersManageAccessCtrl.js
@@ -20,6 +20,9 @@
angular.module('ambariAdminConsole')
.controller('ClustersManageAccessCtrl', ['$scope', '$location', 'Cluster', '$routeParams', 'Alert', 'PermissionLoader', 'PermissionSaver', '$translate', function($scope, $location, Cluster, $routeParams, Alert, PermissionLoader, PermissionSaver, $translate) {
var $t = $translate.instant;
+ $scope.getConstant = function (key) {
+ return $t('common.' + key).toLowerCase();
+ };
$scope.identity = angular.identity;
function reloadClusterData(){
PermissionLoader.getClusterPermissions({
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/UserAccessListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/UserAccessListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/UserAccessListCtrl.js
index 1da4aff..eed71d5 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/UserAccessListCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/UserAccessListCtrl.js
@@ -21,6 +21,9 @@ angular.module('ambariAdminConsole')
.controller('UserAccessListCtrl',['$scope', '$location', 'Cluster', '$modal', '$rootScope', '$routeParams', 'PermissionSaver', 'Alert', '$translate',
function($scope, $location, Cluster, $modal, $rootScope, $routeParams, PermissionSaver, Alert, $translate) {
var $t = $translate.instant;
+ $scope.constants = {
+ users: $t('common.users').toLowerCase()
+ };
$scope.users = [];
$scope.usersPerPage = 10;
$scope.currentPage = 1;
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js
index 048c2bf..a8411dd 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js
@@ -20,6 +20,11 @@
angular.module('ambariAdminConsole')
.controller('GroupsEditCtrl',['$scope', 'Group', '$routeParams', 'Alert', 'ConfirmationModal', '$location', '$translate', function($scope, Group, $routeParams, Alert, ConfirmationModal, $location, $translate) {
var $t = $translate.instant;
+ $scope.constants = {
+ group: $t('common.group'),
+ view: $t('common.view').toLowerCase(),
+ cluster: $t('common.cluster').toLowerCase()
+ };
$scope.editMode = false;
$scope.group = new Group($routeParams.id);
$scope.group.editingUsers = [];
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsListCtrl.js
index 330d3c2..1f86393 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsListCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsListCtrl.js
@@ -20,6 +20,9 @@
angular.module('ambariAdminConsole')
.controller('GroupsListCtrl',['$scope', 'Group', '$modal', 'ConfirmationModal', '$rootScope', '$translate', function($scope, Group, $modal, ConfirmationModal, $rootScope, $translate) {
var $t = $translate.instant;
+ $scope.constants = {
+ groups: $t('common.groups').toLowerCase()
+ };
$scope.groups = [];
$scope.groupsPerPage = 10;
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
index 583468c..010ec1b 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
@@ -20,6 +20,9 @@
angular.module('ambariAdminConsole')
.controller('StackVersionsListCtrl', ['$scope', 'Cluster', 'Stack', '$routeParams', '$translate', function ($scope, Cluster, Stack, $routeParams, $translate) {
var $t = $translate.instant;
+ $scope.getConstant = function (key) {
+ return $t('common.' + key).toLowerCase();
+ }
$scope.clusterName = $routeParams.clusterName;
$scope.filter = {
version: '',
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js
index dfbd008..bb8ea7c 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js
@@ -20,6 +20,10 @@
angular.module('ambariAdminConsole')
.controller('UsersListCtrl',['$scope', 'User', '$modal', '$rootScope', 'UserConstants', '$translate', function($scope, User, $modal, $rootScope, UserConstants, $translate) {
var $t = $translate.instant;
+ $scope.constants = {
+ admin: $t('users.ambariAdmin'),
+ users: $t('common.users').toLowerCase()
+ };
$scope.users = [];
$scope.usersPerPage = 10;
$scope.currentPage = 1;
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js
index 9464225..f93a368 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js
@@ -22,6 +22,15 @@ angular.module('ambariAdminConsole')
var $t = $translate.instant;
+ $scope.constants = {
+ user: $t('common.user'),
+ status: $t('users.status'),
+ admin: $t('users.admin'),
+ password: $t('users.password'),
+ view: $t('common.view').toLowerCase(),
+ cluster: $t('common.cluster').toLowerCase()
+ };
+
function loadUserInfo(){
User.get($routeParams.id).then(function(data) {
$scope.user = User.makeUser(data).Users;
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
index cc1ca26..40baf18 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
@@ -39,6 +39,7 @@ angular.module('ambariAdminConsole')
'details': 'Details',
'goToDashboard': 'Go to Dashboard',
'noClusters': 'No Clusters',
+ 'noViews': 'No Views',
'view': 'View',
'displayLabel': 'Display label',
'search': 'Search',
@@ -70,6 +71,7 @@ angular.module('ambariAdminConsole')
'ldap': 'LDAP',
'jwt': 'JWT',
'warning': 'Warning',
+ 'filterInfo': '{{showed}} of {{total}} {{term}} showing',
'clusterNameChangeConfirmation': {
'title': 'Confirm Cluster Name Change',
@@ -89,8 +91,7 @@ angular.module('ambariAdminConsole')
'alerts': {
'fieldRequired': 'Field required!',
'fieldIsRequired': 'This field is required.',
- 'noSpecialChars': 'Must no contain special characters!',
- 'instanceExists': 'Instance with this name already exists.',
+ 'noSpecialChars': 'Must not contain special characters!',
'nothingToDisplay': 'No {{term}} to display.',
'noPrivileges': 'No {{term}} privileges',
'noPrivilegesDescription': 'This {{term}} does not have any privileges.',
@@ -140,6 +141,7 @@ angular.module('ambariAdminConsole')
},
'views': {
+ 'instance': 'Instance',
'viewInstance': 'View Instance',
'create': 'Create Instance',
'createViewInstance': 'Create View Instance',
@@ -168,17 +170,17 @@ angular.module('ambariAdminConsole')
'goToInstance': 'Go to instance',
'pending': 'Pending...',
'deploying': 'Deploying...',
+ 'properties': 'properties',
'alerts': {
'noSpecialChars': 'Must not contain any special characters.',
'noSpecialCharsOrSpaces': 'Must not contain any special characters or spaces.',
- 'noProperties': 'There are no properties defined for this view.',
- 'noPermissions': 'There are no permissions defined for this view.',
+ 'instanceExists': 'Instance with this name already exists.',
+ 'notDefined': 'There are no {{term}} defined for this view.',
'cannotEditInstance': 'Cannot Edit Static Instances',
'cannotDeleteStaticInstance': 'Cannot Delete Static Instances',
'deployError': 'Error deploying. Check Ambari Server log.',
'unableToCreate': 'Unable to create view instances',
- 'onlySimpleChars': 'Must contain only simple characters.',
'cannotUseOption': 'This view cannot use this option',
'unableToResetErrorMessage': 'Unable to reset error message for prop: {{key}}',
'instanceCreated': 'Created View Instance {{instanceName}}',
@@ -197,6 +199,7 @@ angular.module('ambariAdminConsole')
'switchToList': 'Switch to list view',
'switchToBlock': 'Switch to block view',
'role': 'Role',
+ 'assignRoles': 'Assign roles to these {{term}}',
'alerts': {
'cannotLoadClusterData': 'Cannot load cluster data'
@@ -207,8 +210,10 @@ angular.module('ambariAdminConsole')
'createLocal': 'Create Local Group',
'name': 'Group name',
'members': 'Members',
+ 'membersPlural': '{{n}} member{{n == 1 ? "" : "s"}}',
'alerts': {
+ 'onlySimpleChars': 'Must contain only simple characters.',
'groupCreated': 'Created group <a href="#/groups/{{groupName}}/edit">{{groupName}}</a>',
'groupCreationError': 'Group creation error',
'cannotUpdateGroupMembers': 'Cannot update group members',
@@ -219,6 +224,7 @@ angular.module('ambariAdminConsole')
'users': {
'username': 'Username',
'userName': 'User name',
+ 'admin': 'Admin',
'ambariAdmin': 'Ambari Admin',
'changePassword': 'Change Password',
'changePasswordFor': 'Change Password for {{userName}}',
@@ -232,6 +238,9 @@ angular.module('ambariAdminConsole')
'password': 'Password',
'passwordConfirmation': 'Password сonfirmation',
'userIsAdmin': 'This user is an Ambari Admin and has all privileges.',
+ 'showAll': 'Show all users',
+ 'showAdmin': 'Show only admin users',
+ 'groupMembership': 'Group Membership',
'changeStatusConfirmation': {
'title': 'Change Status',
@@ -255,7 +264,7 @@ angular.module('ambariAdminConsole')
'passwordRequired': 'Password required!',
'wrongPassword': 'Password must match!',
'cannotChange': 'Cannot Change {{term}}',
- 'userCreated': 'Created user <a href="#/users/{{encUserName}}/edit">{{userName}}</a>',
+ 'userCreated': 'Created user <a href="#/users/{{encUserName}}">{{userName}}</a>',
'userCreationError': 'User creation error',
'removeUserError': 'Removing from group error',
'cannotAddUser': 'Cannot add user to group',
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html
index dcc77ef..b9bd609 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html
@@ -16,20 +16,20 @@
* limitations under the License.
-->
<ol class="breadcrumb">
- <li><a href="#/views">Views</a></li>
- <li class="active">Create Instance</li>
+ <li><a href="#/views">{{'common.views' | translate}}</a></li>
+ <li class="active">{{'views.create' | translate}}</li>
</ol>
<hr>
<form class="form-horizontal create-view-form" role="form" name="form.instanceCreateForm" novalidate>
<div class="view-header">
<div class="form-group">
<div class="col-sm-2">
- <label for="" class="control-label">View</label>
+ <label for="" class="control-label">{{'common.view' | translate}}</label>
</div>
<div class="col-sm-10"><label for="" class="control-label">{{view.ViewVersionInfo.view_name}}</label></div>
</div>
<div class="form-group">
- <div class="col-sm-2"><label for="" class="control-label">Version</label></div>
+ <div class="col-sm-2"><label for="" class="control-label">{{'common.version' | translate}}</label></div>
<div class="col-sm-3">
<select ng-model="version" class="instanceversion-input form-control" ng-change="versionChanged()" ng-options="o as o for o in versions"></select>
</div>
@@ -38,47 +38,41 @@
<div class="panel panel-default">
<div class="panel-heading">
- <h3 class="panel-title">Details</h3>
+ <h3 class="panel-title">{{'common.details' | translate}}</h3>
</div>
<div class="panel-body">
<div class="form-group"
ng-class="{'has-error' : ( (form.instanceCreateForm.instanceNameInput.$error.required || form.instanceCreateForm.instanceNameInput.$error.pattern) && form.instanceCreateForm.submitted) || instanceExists }"
>
- <label for="" class="control-label col-sm-3">Instance Name*</label>
+ <label for="" class="control-label col-sm-3">{{'views.instanceName' | translate}}*</label>
<div class="col-sm-9">
<input type="text" class="form-control instancename-input" name="instanceNameInput" ng-pattern="nameValidationPattern" required ng-model="instance.instance_name" autocomplete="off">
- <div class="alert alert-danger no-margin-bottom top-margin" ng-show='form.instanceCreateForm.instanceNameInput.$error.required && form.instanceCreateForm.submitted'>
- This field is required.
- </div>
- <div class="alert alert-danger no-margin-bottom top-margin" ng-show='form.instanceCreateForm.instanceNameInput.$error.pattern && form.instanceCreateForm.submitted'>
- Must not contain any special characters or spaces.
- </div>
- <div class="alert alert-danger no-margin-bottom top-margin" ng-show='instanceExists'>
- Instance with this name already exists.
- </div>
+ <div class="alert alert-danger no-margin-bottom top-margin" ng-show='form.instanceCreateForm.instanceNameInput.$error.required && form.instanceCreateForm.submitted'>{{'common.alerts.fieldIsRequired' | translate}}</div>
+ <div class="alert alert-danger no-margin-bottom top-margin" ng-show='form.instanceCreateForm.instanceNameInput.$error.pattern && form.instanceCreateForm.submitted'>{{'views.alerts.noSpecialCharsOrSpaces' | translate}}</div>
+ <div class="alert alert-danger no-margin-bottom top-margin" ng-show='instanceExists'>{{'views.alerts.instanceExists' | translate}}</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error' : ( (form.instanceCreateForm.displayLabel.$error.required || form.instanceCreateForm.displayLabel.$error.pattern) && form.instanceCreateForm.submitted)}">
- <label for="" class="control-label col-sm-3">Display Name*</label>
+ <label for="" class="control-label col-sm-3">{{'views.displayName' | translate}}*</label>
<div class="col-sm-9">
<input type="text" class="form-control instancelabel-input" name="displayLabel" ng-model="instance.label" required ng-pattern="/^([a-zA-Z0-9._\s]+)$/" autocomplete="off">
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='form.instanceCreateForm.displayLabel.$error.required && form.instanceCreateForm.submitted'>
- This field is required.
+ {{'common.alerts.fieldIsRequired' | translate}}
</div>
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='form.instanceCreateForm.displayLabel.$error.pattern && form.instanceCreateForm.submitted'>
- Must not contain any special characters.
+ {{'views.alerts.noSpecialChars' | translate}}
</div>
</div>
</div>
<div class="form-group" ng-class="{'has-error' : form.instanceCreateForm.description.$error.required && form.instanceCreateForm.submitted }">
- <label for="" class="control-label col-sm-3">Description*</label>
+ <label for="" class="control-label col-sm-3">{{'views.description' | translate}}*</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="description" ng-model="instance.description" maxlength="140" required>
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='form.instanceCreateForm.description.$error.required && form.instanceCreateForm.submitted'>
- This field is required.
+ {{'common.alerts.fieldIsRequired' | translate}}
</div>
</div>
</div>
@@ -86,7 +80,7 @@
<div class="col-sm-10 col-sm-offset-3">
<div class="checkbox">
<label>
- <input type="checkbox" ng-model='instance.visible' class="visibilityCheckbox"> Visible
+ <input type="checkbox" ng-model='instance.visible' class="visibilityCheckbox"> {{'views.visible' | translate}}
</label>
</div>
</div>
@@ -96,7 +90,7 @@
<div class="panel panel-default" ng-hide="!numberOfSettingConfigs">
<div class="panel-heading">
- <h3 class="panel-title">Settings</h3>
+ <h3 class="panel-title">{{'views.settings' | translate}}</h3>
</div>
<div class="panel-body">
<div class="form-group" ng-repeat="parameter in instance.properties | filter:{clusterConfig:false}"
@@ -109,7 +103,7 @@
<div class="col-sm-9" ng-switch-default>
<input type="{{parameter.masked ? 'password' : 'text'}}" class="form-control viewproperty-input" name="{{parameter.name}}" ng-change="form.instanceCreateForm[parameter.name].validationError=''" ng-required="parameter.required" ng-model="parameter.value" autocomplete="off" popover="{{parameter.description}}" popover-title="{{parameter.name}}" popover-trigger="mouseenter" placeholder="{{parameter.placeholder}}">
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='form.instanceCreateForm[parameter.name].$error.required && form.instanceCreateForm.submitted'>
- This field is required.
+ {{'common.alerts.fieldIsRequired' | translate}}
</div>
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='form.instanceCreateForm[parameter.name].validationError'>
{{form.instanceCreateForm[parameter.name].validationMessage}}
@@ -122,20 +116,20 @@
<div class="panel panel-default" ng-hide="!numberOfClusterConfigs">
<div class="panel-heading">
- <h3 class="panel-title">Cluster Configuration</h3>
+ <h3 class="panel-title">{{'views.clusterConfiguration' | translate}}</h3>
</div>
<div class="panel-body property-form" popover="{{clusterConfigurableErrorMsg}}" popover-trigger="mouseenter">
<div class="checkbox create-checkbox-cluster">
<label>
- <input type="radio" ng-disabled="!clusterConfigurable || noClusterAvailible" ng-model="instance.isLocalCluster" ng-change="enableLocalCluster()" ng-value="true" class="visibilityCheckbox"> Local Ambari Managed Cluster
+ <input type="radio" ng-disabled="!clusterConfigurable || noClusterAvailible" ng-model="instance.isLocalCluster" ng-change="enableLocalCluster()" ng-value="true" class="visibilityCheckbox"> {{'views.localCluster' | translate}}
</label>
</div>
<div class="form-horizontal property-form">
<div class="form-group">
- <label for="" class="control-label col-sm-3 ng-binding not-required" >Cluster Name</label>
+ <label for="" class="control-label col-sm-3 ng-binding not-required" >{{'views.clusterName' | translate}}</label>
<div>
<div class="col-sm-9">
<select ng-model="cluster" ng-disabled="!instance.isLocalCluster" ng-change="onClusterChange()" class="clusters-name-dropdown form-control" ng-options="o as o for o in clusters"></select>
@@ -148,7 +142,7 @@
<div class="panel-body property-form">
<div class="checkbox">
<label>
- <input type="radio" ng-model="instance.isLocalCluster" ng-value="false" class="visibilityCheckbox"> Custom
+ <input type="radio" ng-model="instance.isLocalCluster" ng-value="false" class="visibilityCheckbox"> {{'views.custom' | translate}}
</label>
</div>
<div class="alert alert-danger bottom-margin top-margin" ng-show='form.instanceCreateForm.generalValidationError'>
@@ -164,7 +158,7 @@
<div class="col-sm-9" ng-switch-default>
<input type="{{parameter.masked ? 'password' : 'text'}}" class="form-control viewproperty-input" name="{{parameter.name}}" ng-disabled="instance.isLocalCluster" ng-change="form.instanceCreateForm[parameter.name].validationError=''" ng-required="parameter.required && !instance.isLocalCluster" ng-model="parameter.value" autocomplete="off" popover="{{parameter.description}}" popover-title="{{parameter.name}}" popover-trigger="mouseenter" placeholder="{{parameter.placeholder}}">
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='form.instanceCreateForm[parameter.name].$error.required && form.instanceCreateForm.submitted && !instance.isLocalCluster'>
- This field is required.
+ {{'common.alerts.fieldIsRequired' | translate}}
</div>
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='form.instanceCreateForm[parameter.name].validationError'>
{{form.instanceCreateForm[parameter.name].validationMessage}}
@@ -173,15 +167,15 @@
</div>
</div>
<div ng-show="!instance.properties.length">
- <div class="alert alert-info">There are no properties defined for this view.</div>
+ <div class="alert alert-info">{{'views.alerts.notDefined' | translate: '{term: constants.props}'}}</div>
</div>
</div>
</div>
<div class="col-sm-12 ">
<button class="btn btn-primary pull-right left-margin save-button"
- ng-class="{'disabled' : (form.instanceCreateForm.isSaving)}" ng-click="save()" type="submit">Save</button>
- <a href ng-click="cancel()" class="btn btn-default pull-right cancel-button">Cancel</a>
+ ng-class="{'disabled' : (form.instanceCreateForm.isSaving)}" ng-click="save()" type="submit">{{'common.controls.save' | translate}}</button>
+ <a href ng-click="cancel()" class="btn btn-default pull-right cancel-button">{{'common.controls.cancel' | translate}}</a>
</div>
</form>
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
index ac058c0..85e4e44 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
@@ -17,12 +17,12 @@
-->
<div class="clearfix">
<ol class="breadcrumb pull-left">
- <li><a href="#/views">Views</a></li>
- <li class="active">{{instance.ViewInstanceInfo.label}} <a class="gotoinstance" ng-show="instance.ViewInstanceInfo.visible" href="/#/main{{instance.ViewInstanceInfo.context_path}}">Go to instance</a></li>
+ <li><a href="#/views">{{'common.views' | translate}}</a></li>
+ <li class="active">{{instance.ViewInstanceInfo.label}} <a class="gotoinstance" ng-show="instance.ViewInstanceInfo.visible" href="/#/main{{instance.ViewInstanceInfo.context_path}}">{{'views.goToInstance' | translate}}</a></li>
</ol>
<div class="pull-right top-margin-4" ng-switch="instance.ViewInstanceInfo.static">
- <button ng-switch-when="true" class="btn disabled btn-default btn-delete-instance" tooltip="Cannot Delete Static Instances">Delete Instance</button>
- <button ng-switch-when="false" class="btn btn-danger" ng-click="deleteInstance(instance)">Delete Instance</button>
+ <button ng-switch-when="true" class="btn disabled btn-default btn-delete-instance" tooltip="{{'views.alerts.cannotDeleteStaticInstance' | translate}}">{{'common.delete' | translate: '{term: instanceType}'}}</button>
+ <button ng-switch-when="false" class="btn btn-danger" ng-click="deleteInstance(instance)">{{'common.delete' | translate: '{term: constants.instance}'}}</button>
</div>
</div>
<hr>
@@ -30,50 +30,50 @@
<div class="view-header">
<div class="form-group">
<div class="col-sm-2">
- <label for="" class="control-label">View</label>
+ <label for="" class="control-label">{{'common.view' | translate}}</label>
</div>
<div class="col-sm-10"><label for="" class="control-label">{{instance.ViewInstanceInfo.view_name}}</label></div>
</div>
<div class="form-group">
- <div class="col-sm-2"><label for="" class="control-label">Version</label></div>
+ <div class="col-sm-2"><label for="" class="control-label">{{'common.version' | translate}}</label></div>
<div class="col-sm-3">
- <input disabled="disabled" type="text" class="form-control instancename-input" placeholder="Version" value="{{instance.ViewInstanceInfo.version}}"></div>
+ <input disabled="disabled" type="text" class="form-control instancename-input" placeholder="{{'common.version' | translate}}" value="{{instance.ViewInstanceInfo.version}}"></div>
</div>
</div>
</div>
<div class="panel panel-default" ng-cloak ng-show="instance">
<div class="panel-heading clearfix">
- <h3 class="panel-title pull-left">Details</h3>
+ <h3 class="panel-title pull-left">{{'common.details' | translate}}</h3>
<div class="pull-right" ng-switch="instance.ViewInstanceInfo.static">
- <a href ng-switch-when="false" ng-click="toggleDetailsSettingsEdit()" ng-show="editDetailsSettingsDisabled" class="settings-edit-toggle"> <span class="glyphicon glyphicon-pencil" ></span> Edit</a>
- <a href ng-switch-when="true" class="settings-edit-toggle disabled" tooltip="Cannot Edit Static Instances"> <span class="glyphicon glyphicon-pencil" ></span> Edit</a>
+ <a href ng-switch-when="false" ng-click="toggleDetailsSettingsEdit()" ng-show="editDetailsSettingsDisabled" class="settings-edit-toggle"> <span class="glyphicon glyphicon-pencil" ></span> {{'views.edit' | translate}}</a>
+ <a href ng-switch-when="true" class="settings-edit-toggle disabled" tooltip="{{'views.cannotEditInstance' | translate}}"> <span class="glyphicon glyphicon-pencil" ></span> {{'views.edit' | translate}}</a>
</div>
</div>
<div class="panel-body">
<form class="form-horizontal" name="detailsForm" novalidate>
<fieldset ng-disabled="editDetailsSettingsDisabled">
<div class="form-group">
- <label for="" class="col-sm-3 control-label">Instance Name</label>
- <div class="col-sm-9"><input disabled="disabled" type="text" class="form-control instancename-input" placeholder="Display Name" value="{{instance.ViewInstanceInfo.instance_name}}"></div>
+ <label for="" class="col-sm-3 control-label">{{'views.instanceName' | translate}}</label>
+ <div class="col-sm-9"><input disabled="disabled" type="text" class="form-control instancename-input" placeholder="{{'views.displayName' | translate}}" value="{{instance.ViewInstanceInfo.instance_name}}"></div>
</div>
<div class="form-group" ng-class="{'has-error' : (detailsForm.displayName.$error.required || detailsForm.displayName.$error.pattern) && !editDetailsSettingsDisabled}">
- <label for="" class="col-sm-3 control-label">Display Name</label>
+ <label for="" class="col-sm-3 control-label">{{'views.displayName' | translate}}</label>
<div class="col-sm-9">
- <input type="text" class="form-control instancename-input" placeholder="Display Name" name="displayName" required ng-model="settings.label" ng-pattern="/^([a-zA-Z0-9._\s]+)$/">
+ <input type="text" class="form-control instancename-input" placeholder="{{'views.displayName' | translate}}" name="displayName" required ng-model="settings.label" ng-pattern="/^([a-zA-Z0-9._\s]+)$/">
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='detailsForm.displayName.$error.required && !editDetailsSettingsDisabled'>
- This field is required.
+ {{'common.alerts.fieldIsRequired' | translate}}
</div>
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='detailsForm.displayName.$error.pattern && !editDetailsSettingsDisabled'>
- Must not contain any special characters.
+ {{'views.alerts.noSpecialChars' | translate}}
</div>
</div>
</div>
<div class="form-group" ng-class="{'has-error' : detailsForm.description.$error.required && !editDetailsSettingsDisabled}">
- <label for="" class="control-label col-sm-3">Description</label>
+ <label for="" class="control-label col-sm-3">{{'views.description' | translate}}</label>
<div class="col-sm-9">
- <input type="text" class="form-control" ng-model="settings.description" name="description" placeholder="Instance Description" required>
+ <input type="text" class="form-control" ng-model="settings.description" name="description" placeholder="{{'views.instanceDescription' | translate}}" required>
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='detailsForm.description.$error.required && !editDetailsSettingsDisabled'>
- This field is required.
+ {{'common.alerts.fieldIsRequired' | translate}}
</div>
</div>
</div>
@@ -81,15 +81,15 @@
<div class="col-sm-offset-3 col-sm-10">
<div class="checkbox">
<label>
- <input type="checkbox" ng-model="settings.visible" ng-class="instancevisibility-input"> Visible
+ <input type="checkbox" ng-model="settings.visible" ng-class="instancevisibility-input"> {{'views.visible' | translate}}
</label>
</div>
</div>
</div>
<div class="form-group" ng-hide="editDetailsSettingsDisabled">
<div class="col-sm-offset-2 col-sm-10">
- <button class="btn btn-primary pull-right left-margin settingssave-btn" ng-click="saveDetails()">Save</button>
- <button class="btn btn-default pull-right settingscancel-btn" ng-click="cancelDetails()">Cancel</button>
+ <button class="btn btn-primary pull-right left-margin settingssave-btn" ng-click="saveDetails()">{{'common.controls.save' | translate}}</button>
+ <button class="btn btn-default pull-right settingscancel-btn" ng-click="cancelDetails()">{{'common.controls.cancel' | translate}}</button>
</div>
</div>
</fieldset>
@@ -99,7 +99,7 @@
<div class="panel panel-default views-permissions-panel" style="">
<div class="panel-heading clearfix">
- <h3 class="panel-title pull-left">Permissions</h3>
+ <h3 class="panel-title pull-left">{{'views.permissions' | translate}}</h3>
</div>
<div class="panel-body">
@@ -107,9 +107,9 @@
<table class="table" ng-show="!isPermissionsEmpty">
<thead>
<tr>
- <th class="col-sm-2"><label>Permission</label></th>
- <th><label>Grant permission to these users</label></th>
- <th><label>Grant permission to these groups</label></th>
+ <th class="col-sm-2"><label>{{'views.permission' | translate}}</label></th>
+ <th><label>{{'views.grantUsers' | translate}}</label></th>
+ <th><label>{{'views.grantGroups' | translate}}</label></th>
</tr>
</thead>
<tbody>
@@ -127,17 +127,17 @@
</tbody>
</table>
<div ng-show="isPermissionsEmpty">
- <div class="alert alert-info">There are no permissions defined for this view.</div>
+ <div class="alert alert-info">{{'views.alerts.notDefined' | translate: '{term: constants.perms}'}}</div>
</div>
</div>
</div>
<div class="panel panel-default" ng-cloak ng-hide="isSettingsEmpty && instance">
<div class="panel-heading clearfix">
- <h3 class="panel-title pull-left">Settings</h3>
+ <h3 class="panel-title pull-left">{{'views.settings' | translate}}</h3>
<div class="pull-right" ng-switch="instance.ViewInstanceInfo.static">
- <a href ng-switch-when="false" ng-click="toggleSettingsEdit()" ng-show="editSettingsDisabled" class="settings-edit-toggle"> <span class="glyphicon glyphicon-pencil" ></span> Edit</a>
- <a href ng-switch-when="true" class="settings-edit-toggle disabled" tooltip="Cannot Edit Static Instances"> <span class="glyphicon glyphicon-pencil" ></span> Edit</a>
+ <a href ng-switch-when="false" ng-click="toggleSettingsEdit()" ng-show="editSettingsDisabled" class="settings-edit-toggle"> <span class="glyphicon glyphicon-pencil" ></span> {{'views.edit' | translate}}</a>
+ <a href ng-switch-when="true" class="settings-edit-toggle disabled" tooltip="{{'views.cannotEditInstance' | translate}}"> <span class="glyphicon glyphicon-pencil" ></span> {{'views.edit' | translate}}</a>
</div>
</div>
<div class="panel-body">
@@ -152,7 +152,7 @@
<div class="col-sm-9" ng-switch-default>
<input type="{{property.masked ? 'password' : 'text'}}" class="form-control propertie-input" ng-required="property.required" ng-change="settingsForm[property.name].validationError=''" ng-disabled="editSettingsDisabled" name="{{property.name}}" ng-model="configuration[property.name]" popover="{{property.description}}" popover-title="{{property.name}}" popover-trigger="mouseenter" placeholder="{{property.placeholder}}">
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='property.required && settingsForm[property.name].$error.required && !editSettingsDisabled'>
- This field is required.
+ {{'common.alerts.fieldIsRequired' | translate}}
</div>
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='property.required && settingsForm[property.name].validationError && !editSettingsDisabled'>
{{propertiesForm[property.name].validationMessage}}
@@ -162,8 +162,8 @@
</div>
<div class="form-group" ng-hide="editSettingsDisabled">
<div class="col-sm-offset-2 col-sm-10">
- <button class="btn btn-primary pull-right left-margin settingssave-btn" ng-click="saveSettings()">Save</button>
- <button class="btn btn-default pull-right settingscancel-btn" ng-click="cancelSettings()">Cancel</button>
+ <button class="btn btn-primary pull-right left-margin settingssave-btn" ng-click="saveSettings()">{{'common.controls.save' | translate}}</button>
+ <button class="btn btn-default pull-right settingscancel-btn" ng-click="cancelSettings()">{{'common.controls.cancel' | translate}}</button>
</div>
</div>
</fieldset>
@@ -173,21 +173,21 @@
<div class="panel panel-default" ng-hide="isConfigurationEmpty">
<div class="panel-heading clearfix">
- <h3 class="panel-title pull-left">Cluster Configuration</h3>
+ <h3 class="panel-title pull-left">{{'views.clusterConfiguration' | translate}}</h3>
<div class="pull-right" ng-switch="instance.ViewInstanceInfo.static">
- <a href ng-switch-when="false" ng-hide="isConfigurationEmpty" ng-click="togglePropertiesEditing()" ng-show="editConfigurationDisabled" class="properties-toggle"> <span class="glyphicon glyphicon-pencil"></span> Edit</a>
- <a href ng-switch-when="true" ng-hide="isConfigurationEmpty" class="properties-toggle disabled"> <span class="glyphicon glyphicon-pencil"></span> Edit</a>
+ <a href ng-switch-when="false" ng-hide="isConfigurationEmpty" ng-click="togglePropertiesEditing()" ng-show="editConfigurationDisabled" class="properties-toggle"> <span class="glyphicon glyphicon-pencil"></span> {{'views.edit' | translate}}</a>
+ <a href ng-switch-when="true" ng-hide="isConfigurationEmpty" class="properties-toggle disabled"> <span class="glyphicon glyphicon-pencil"></span> {{'views.edit' | translate}}</a>
</div>
</div>
<div class="panel-body property-form" popover="{{clusterConfigurableErrorMsg}}" popover-trigger="mouseenter">
<div class="checkbox">
<label>
- <input type="radio" ng-model="$parent.isLocalCluster" ng-change="enableLocalCluster()" ng-disabled="!clusterConfigurable || editConfigurationDisabled || noClusterAvailible" ng-value="true" class="visibilityCheckbox"> Local Ambari Managed Cluster
+ <input type="radio" ng-model="$parent.isLocalCluster" ng-change="enableLocalCluster()" ng-disabled="!clusterConfigurable || editConfigurationDisabled || noClusterAvailible" ng-value="true" class="visibilityCheckbox"> {{'views.localCluster' | translate}}
</label>
</div>
<div class="form-horizontal property-form">
<div class="form-group">
- <label for="" class="control-label col-sm-3 ng-binding not-required" >Cluster Name</label>
+ <label for="" class="control-label col-sm-3 ng-binding not-required" >{{'views.clusterName' | translate}}</label>
<div>
<div class="col-sm-9">
<select ng-model="cluster" ng-disabled="!$parent.isLocalCluster || editConfigurationDisabled" ng-change="onClusterChange()" class="clusters-name-dropdown form-control" ng-options="o as o for o in clusters"></select>
@@ -204,7 +204,7 @@
ng-value="false"
ng-change="disableLocalCluster()"
class="visibilityCheckbox">
- Custom
+ {{'views.custom' | translate}}
</label>
</div>
</div>
@@ -220,7 +220,7 @@
<div class="col-sm-9" ng-switch-default>
<input type="{{property.masked ? 'password' : 'text'}}" class="form-control propertie-input" ng-required="property.required && !isLocalCluster" ng-change="propertiesForm[property.name].validationError=''" ng-disabled="isLocalCluster || editConfigurationDisabled" name="{{property.name}}" ng-model="configuration[property.name]" popover="{{property.description}}" popover-title="{{property.name}}" popover-trigger="mouseenter" placeholder="{{property.placeholder}}">
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='property.required && propertiesForm[property.name].$error.required && !editConfigurationDisabled && !isLocalCluster'>
- This field is required.
+ {{'common.alerts.fieldIsRequired' | translate}}
</div>
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='property.required && propertiesForm[property.name].validationError && !editConfigurationDisabled && !isLocalCluster'>
{{propertiesForm[property.name].validationMessage}}
@@ -230,14 +230,14 @@
</div>
<div class="form-group" ng-hide="editConfigurationDisabled">
<div class="col-sm-offset-2 col-sm-10">
- <button class="btn btn-primary pull-right left-margin propertie-save" ng-click="saveConfiguration()">Save</button>
- <button class="btn btn-default pull-right propertie-cancel" ng-click="cancelConfiguration()">Cancel</button>
+ <button class="btn btn-primary pull-right left-margin propertie-save" ng-click="saveConfiguration()">{{'common.controls.save' | translate}}</button>
+ <button class="btn btn-default pull-right propertie-cancel" ng-click="cancelConfiguration()">{{'common.controls.cancel' | translate}}</button>
</div>
</div>
</fieldset>
</form>
<div ng-show="isConfigurationEmpty">
- <div class="alert alert-info">There are no properties defined for this view.</div>
+ <div class="alert alert-info">{{'views.alerts.notDefined' | translate: '{term: constants.props}'}}</div>
</div>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listTable.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listTable.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listTable.html
index d922f13..4b87070 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listTable.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listTable.html
@@ -19,12 +19,12 @@
<div class="views-list-table">
<div class="clearfix">
<ol class="breadcrumb pull-left">
- <li class="active">Views</li>
+ <li class="active">{{'common.views' | translate}}</li>
</ol>
<div class="pull-right col-sm-4">
<div class="input-group search-container">
- <input type="text" class="form-control search-input" placeholder="Search" ng-model="viewsFilter" ng-change="getFilteredViews()">
- <button type="button" class="close clear-search" ng-show="viewsFilter" ng-click="viewsFilter=''; getFilteredViews()"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
+ <input type="text" class="form-control search-input" placeholder="{{'common.search' | translate}}" ng-model="viewsFilter" ng-change="getFilteredViews()">
+ <button type="button" class="close clear-search" ng-show="viewsFilter" ng-click="viewsFilter=''; getFilteredViews()"><span aria-hidden="true">×</span><span class="sr-only">{{"common.controls.close" | translate}}</span></button>
<span class="input-group-addon">
<span class="glyphicon glyphicon-search"></span>
</span>
@@ -33,8 +33,8 @@
</div>
<hr>
<div class="row">
- <div class="col-sm-3 padding-left-30"><h4>View Name</h4></div>
- <div class="col-sm-3"><h4>Instances</h4></div>
+ <div class="col-sm-3 padding-left-30"><h4>{{'views.viewName' | translate}}</h4></div>
+ <div class="col-sm-3"><h4>{{'views.instances' | translate}}</h4></div>
<div class="col-sm-6"><h4></h4></div>
</div>
<accordion close-others="false">
@@ -49,14 +49,14 @@
<span ng-repeat="(version, vData) in view.versions">
{{version}}
<span ng-switch="vData.status">
- <span ng-switch-when="PENDING" class="viewstatus pending" ng-switch-when="true" tooltip="Pending..."></span>
- <div class="viewstatus deploying" ng-switch-when="DEPLOYING" tooltip="Deploying...">
+ <span ng-switch-when="PENDING" class="viewstatus pending" ng-switch-when="true" tooltip="{{'views.pending' | translate}}"></span>
+ <div class="viewstatus deploying" ng-switch-when="DEPLOYING" tooltip="{{'views.deploying' | translate}}">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
</div>
<span ng-switch-when="DEPLOYED">({{vData.count}})</span>
- <span ng-switch-when="ERROR" tooltip="Error deploying. Check Ambari Server log."><i class="fa fa-exclamation-triangle"></i></span>
+ <span ng-switch-when="ERROR" tooltip="{{'views.alerts.deployError' | translate}}"><i class="fa fa-exclamation-triangle"></i></span>
</span>
{{$last ? '' : ', '}}
</span>
@@ -80,7 +80,7 @@
<tr>
<td class="col-sm-3"></td>
<td class="col-sm-3">
- <a tooltip="{{view.canCreateInstance ? '' : 'Unable to create view instances'}}" class="btn btn-default createisntance-btn {{view.canCreateInstance ? '' : 'disabled'}}" href ng-click="gotoCreate(view.view_name, view.canCreateInstance);"><span class="glyphicon glyphicon-plus"></span> Create Instance</a>
+ <a tooltip="{{view.canCreateInstance ? '' : constants.unable}}" class="btn btn-default createisntance-btn {{view.canCreateInstance ? '' : 'disabled'}}" href ng-click="gotoCreate(view.view_name, view.canCreateInstance);"><span class="glyphicon glyphicon-plus"></span> {{'views.create' | translate}}</a>
</td>
<td class="col-sm-3"></td>
<td class="col-sm-3">
@@ -90,7 +90,7 @@
</table>
</accordion-group>
<div class="alert alert-info" ng-show="views && !filteredViews.length">
- No views to display.
+ {{'common.alerts.nothingToDisplay' | translate: '{term: constants.views}'}}
</div>
</accordion>
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/modals/create.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/modals/create.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/modals/create.html
index cd4e958..e13f84c 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/modals/create.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/modals/create.html
@@ -17,7 +17,7 @@
-->
<form class="form-horizontal" role="form" name="form.instanceCreateForm" novalidate>
<div class="modal-header">
- <h3 class="modal-title">Create View Instance</h3>
+ <h3 class="modal-title">{{'views.createViewInstance' | translate}}</h3>
</div>
<div class="modal-body createViewModal">
<div class="view-header">
@@ -31,45 +31,45 @@
<div class="panel panel-default">
<div class="panel-heading">
- <h3 class="panel-title">Details</h3>
+ <h3 class="panel-title">{{'common.details' | translate}}</h3>
</div>
<div class="panel-body">
<div class="form-group"
ng-class="{'has-error' : ( (form.instanceCreateForm.instanceNameInput.$error.required || form.instanceCreateForm.instanceNameInput.$error.pattern) && form.instanceCreateForm.submitted) || instanceExists }"
>
- <label for="" class="control-labe col-sm-2">Instance name</label>
+ <label for="" class="control-labe col-sm-2">{{'views.instanceName' | translate}}</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="instanceNameInput" ng-pattern="nameValidationPattern" required ng-model="instance.instance_name">
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='form.instanceCreateForm.instanceNameInput.$error.required && form.instanceCreateForm.submitted'>
- Field requried!
+ {{'common.alerts.fieldRequired' | translate}}
</div>
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='form.instanceCreateForm.instanceNameInput.$error.pattern && form.instanceCreateForm.submitted'>
- Must no contain special characters!
+ {{'common.alerts.noSpecialChars' | translate}}
</div>
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='instanceExists'>
- Instance with this name already exists.
+ {{'common.alerts.instanceExists' | translate}}
</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error' : ( (form.instanceCreateForm.displayLabel.$error.required || form.instanceCreateForm.displayLabel.$error.pattern) && form.instanceCreateForm.submitted)}">
- <label for="" class="control-labe col-sm-2">Display label</label>
+ <label for="" class="control-labe col-sm-2">{{'common.displayLabel' | translate}}</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="displayLabel" ng-model="instance.label" required ng-pattern="nameValidationPattern">
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='form.instanceCreateForm.displayLabel.$error.required && form.instanceCreateForm.submitted'>
- Field requried!
+ {{'common.alerts.fieldRequired' | translate}}
</div>
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='form.instanceCreateForm.displayLabel.$error.pattern && form.instanceCreateForm.submitted'>
- Must no contain special characters!
+ {{'common.alerts.noSpecialChars' | translate}}
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-10 col-sm-offset-2">
- <button class="btn btn-default" ng-click="isAdvancedClosed = !isAdvancedClosed">Advanced</button>
+ <button class="btn btn-default" ng-click="isAdvancedClosed = !isAdvancedClosed">{{'views.advanced' | translate}}</button>
</div>
</div>
<div collapse="isAdvancedClosed">
@@ -77,14 +77,14 @@
<div class="col-sm-10 col-sm-offset-2">
<div class="checkbox">
<label>
- <input type="checkbox" ng-model='instance.visible'> Visible
+ <input type="checkbox" ng-model='instance.visible'> {{'views.visible' | translate}}
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-10 col-sm-offset-2">
- <label for="" class="control-label col-sm-2">Icon</label>
+ <label for="" class="control-label col-sm-2">{{'views.icon' | translate}}</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="iconUrl" ng-model="instance.icon_path">
</div>
@@ -92,7 +92,7 @@
</div>
<div class="form-group">
<div class="col-sm-10 col-sm-offset-2">
- <label for="" class="control-label col-sm-2">Icon64</label>
+ <label for="" class="control-label col-sm-2">{{'views.icon64' | translate}}</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="icon64Url" ng-model="instance.icon64_path">
</div>
@@ -103,7 +103,7 @@
<div class="panel panel-default">
<div class="panel-heading">
- <h3 class="panel-title">Configuration</h3>
+ <h3 class="panel-title">{{'views.configuration' | translate}}</h3>
</div>
<div class="panel-body">
<div class="form-group" ng-repeat="parameter in instance.properties"
@@ -112,7 +112,7 @@
<div class="col-sm-9">
<input type="text" class="form-control" name="{{parameter.name}}" ng-required="parameter.required" ng-model="parameter.value">
<div class="alert alert-danger no-margin-bottom top-margin" ng-show='form.instanceCreateForm[parameter.name].$error.required && form.instanceCreateForm.submitted'>
- Field requried!
+ {{'common.alerts.fieldRequired' | translate}}
</div>
</div>
</div>
@@ -121,7 +121,7 @@
</div>
<div class="modal-footer">
- <button class="btn btn-default" ng-click="cancel()">Cancel</button>
- <button class="btn btn-primary" ng-click="save()" type="submit">Save</button>
+ <button class="btn btn-default" ng-click="cancel()">{{'common.controls.cancel' | translate}}</button>
+ <button class="btn btn-primary" ng-click="save()" type="submit">{{'common.controls.save' | translate}}</button>
</div>
</form>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/modals/edit.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/modals/edit.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/modals/edit.html
index 8516bad..aab526e 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/modals/edit.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/modals/edit.html
@@ -17,40 +17,40 @@
-->
<div class="modal-header">
- <h3 class="modal-title">Edit {{instance.ViewInstanceInfo.view_name}}: {{instance.ViewInstanceInfo.label}}</h3>
+ <h3 class="modal-title">{{'views.edit' | translate}} {{instance.ViewInstanceInfo.view_name}}: {{instance.ViewInstanceInfo.label}}</h3>
</div>
<div class="modal-body">
<div class="panel panel-default">
<div class="panel-heading clearfix">
- <h3 class="panel-title pull-left">Settings</h3>
+ <h3 class="panel-title pull-left">{{'views.settings' | translate}}</h3>
<div class="pull-right">
- <a href ng-click="edit.editSettingsDisabled = !edit.editSettingsDisabled" ng-show="edit.editSettingsDisabled"> <span class="glyphicon glyphicon-cog"></span> Edit</a>
+ <a href ng-click="edit.editSettingsDisabled = !edit.editSettingsDisabled" ng-show="edit.editSettingsDisabled"> <span class="glyphicon glyphicon-cog"></span> {{'views.edit' | translate}}</a>
</div>
</div>
<div class="panel-body">
<form class="form-horizontal">
<fieldset ng-disabled="edit.editSettingsDisabled">
<div class="form-group">
- <label for="" class="col-sm-2 control-label">Instance ID</label>
+ <label for="" class="col-sm-2 control-label">{{'views.instanceId' | translate}}</label>
<label for="" class="col-sm-10 control-label text-left">{{instance.ViewInstanceInfo.instance_name}}</label>
</div>
<div class="form-group">
- <label for="" class="col-sm-2 control-label">Display Name</label>
- <div class="col-sm-10"><input type="text" class="form-control" placeholder="Display Name" ng-model="settings.label"></div>
+ <label for="" class="col-sm-2 control-label">{{'views.displayName' | translate}}</label>
+ <div class="col-sm-10"><input type="text" class="form-control" placeholder="{{'views.displayName' | translate}}" ng-model="settings.label"></div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
- <input type="checkbox" ng-model="settings.visible"> Visible
+ <input type="checkbox" ng-model="settings.visible"> {{'views.visible' | translate}}
</label>
</div>
</div>
</div>
<div class="form-group" ng-hide="edit.editSettingsDisabled">
<div class="col-sm-offset-2 col-sm-10">
- <button class="btn btn-default pull-right left-margin" ng-click="cancelSettings()">Cancel</button>
- <button class="btn btn-primary pull-right" ng-click="saveSettings()">Save</button>
+ <button class="btn btn-default pull-right left-margin" ng-click="cancelSettings()">{{'common.controls.cancel' | translate}}</button>
+ <button class="btn btn-primary pull-right" ng-click="saveSettings()">{{'common.controls.save' | translate}}</button>
</div>
</div>
</fieldset>
@@ -60,17 +60,17 @@
<div class="panel panel-default views-permissions-panel" style="">
<div class="panel-heading clearfix">
- <h3 class="panel-title pull-left">Permissions</h3>
+ <h3 class="panel-title pull-left">{{'views.permissions' | translate}}</h3>
<div class="pull-right">
- <a href ng-click="edit.editPermissionDisabled = !edit.editPermissionDisabled" ng-show="edit.editPermissionDisabled"> <span class="glyphicon glyphicon-cog"></span> Edit</a>
+ <a href ng-click="edit.editPermissionDisabled = !edit.editPermissionDisabled" ng-show="edit.editPermissionDisabled"> <span class="glyphicon glyphicon-cog"></span> {{'views.edit' | translate}}</a>
</div>
</div>
<div class="panel-body">
<form class="form-horizontal">
<div class="form-group">
<div class="col-sm-2"></div>
- <label class="col-sm-5 control-label text-left">Users</label>
- <label class="col-sm-5 control-label text-left">Groups</label>
+ <label class="col-sm-5 control-label text-left">{{'common.users' | translate}}</label>
+ <label class="col-sm-5 control-label text-left">{{'common.groups' | translate}}</label>
</div>
<div class="form-group" ng-repeat="permission in permissions">
<label class="col-sm-2 control-label">{{permission.PermissionInfo.permission_name}}</label>
@@ -80,7 +80,7 @@
<span ng-repeat="user in permission.USER">
<link-to route="users.show" id="{{user}}">{{user}}</link-to>
<button type="button" class="close remove-button"
- ng-click="removePermission(permission.name, 'USER', user)"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
+ ng-click="removePermission(permission.name, 'USER', user)"><span aria-hidden="true">×</span><span class="sr-only">{{'common.controls.close' | translate}}</span></button>
{{$last ? '' :', '}}
</span>
</div>
@@ -91,7 +91,7 @@
<span ng-repeat="group in permission.GROUP">
<link-to route="groups.edit" id="{{group}}" >{{group}}</link-to>
<button type="button" class="close remove-button"
- ng-click="removePermission(permission.name, 'GROUP', group)"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
+ ng-click="removePermission(permission.name, 'GROUP', group)"><span aria-hidden="true">×</span><span class="sr-only">{{'common.controls.close' | translate}}</span></button>
{{$last ? '' :', '}}
</span>
</div>
@@ -99,8 +99,8 @@
</div>
<div class="form-group" ng-hide="edit.editPermissionDisabled">
<div class="col-sm-offset-2 col-sm-10">
- <button class="btn btn-default pull-right left-margin" ng-click="cancelPermissions()">Cancel</button>
- <button class="btn btn-primary pull-right" ng-click="savePermissions()">Save</button>
+ <button class="btn btn-default pull-right left-margin" ng-click="cancelPermissions()">{{'common.controls.cancel' | translate}}</button>
+ <button class="btn btn-primary pull-right" ng-click="savePermissions()">{{'common.controls.save' | translate}}</button>
</div>
</div>
</form>
@@ -110,9 +110,9 @@
<div class="panel panel-default">
<div class="panel-heading clearfix">
- <h3 class="panel-title pull-left">Configuration</h3>
+ <h3 class="panel-title pull-left">{{'views.configuration' | translate}}</h3>
<div class="pull-right">
- <a href ng-click="edit.editConfigurationDisabled = !edit.editConfigurationDisabled" ng-show="edit.editConfigurationDisabled"> <span class="glyphicon glyphicon-cog"></span> Edit</a>
+ <a href ng-click="edit.editConfigurationDisabled = !edit.editConfigurationDisabled" ng-show="edit.editConfigurationDisabled"> <span class="glyphicon glyphicon-cog"></span> {{'views.edit' | translate}}</a>
</div>
</div>
<div class="panel-body">
@@ -124,8 +124,8 @@
</div>
<div class="form-group" ng-hide="edit.editConfigurationDisabled">
<div class="col-sm-offset-2 col-sm-10">
- <button class="btn btn-default pull-right left-margin" ng-click="cancelConfiguration()">Cancel</button>
- <button class="btn btn-primary pull-right" ng-click="saveConfiguration()">Save</button>
+ <button class="btn btn-default pull-right left-margin" ng-click="cancelConfiguration()">{{'common.controls.cancel' | translate}}</button>
+ <button class="btn btn-primary pull-right" ng-click="saveConfiguration()">{{'common.controls.save' | translate}}</button>
</div>
</div>
</fieldset>
@@ -134,5 +134,5 @@
</div>
</div>
<div class="modal-footer">
- <button class="btn btn-default" ng-click="close()">Close</button>
+ <button class="btn btn-default" ng-click="close()">{{'common.controls.save' | translate}}</button>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/manageAccess.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/manageAccess.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/manageAccess.html
index 924a27f..c0e8f1e 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/manageAccess.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/manageAccess.html
@@ -19,20 +19,20 @@
<div class="cluster-manage-access-pane">
<div class="clearfix">
<ol class="breadcrumb pull-left">
- <li class="active">{{clusterName}} Roles</li>
+ <li class="active">{{clusterName}} {{'common.roles' | translate}}</li>
</ol>
</div>
<hr>
<div class="pull-right">
<i class="glyphicon glyphicon-th-large layout-switch-icon"></i>
- <i class="glyphicon glyphicon-list layout-switch-icon disabled" ng-click="switchToList()" tooltip="Switch to list view"></i>
+ <i class="glyphicon glyphicon-list layout-switch-icon disabled" ng-click="switchToList()" tooltip-html-unsafe="{{'clusters.switchToList' | translate}}"></i>
</div>
<table class="table">
<thead>
<tr>
- <th class="col-sm-2" width="20%"><label>Roles</label></th>
- <th class="col-sm-5" width="40%"><label>Assign roles to these users</label></th>
- <th class="col-sm-5" width="40%"><label>Assign roles to these groups</label></th>
+ <th class="col-sm-2" width="20%"><label>{{'common.roles' | translate}}</label></th>
+ <th class="col-sm-5" width="40%"><label>{{'clusters.assignRoles' | translate: '{term: getConstant("users")}'}}</label></th>
+ <th class="col-sm-5" width="40%"><label>{{'clusters.assignRoles' | translate: '{term: getConstant("groups")}'}}</label></th>
</tr>
</thead>
<tbody>
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/userAccessList.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/userAccessList.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/userAccessList.html
index 969f479..0f3da0e 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/userAccessList.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/userAccessList.html
@@ -19,12 +19,12 @@
<div class="users-pane">
<div class="clearfix">
<ol class="breadcrumb pull-left">
- <li class="active">{{clusterId}} Roles</li>
+ <li class="active">{{clusterId}} {{'common.roles' | translate}}</li>
</ol>
</div>
<hr>
<div class="pull-right">
- <i class="glyphicon glyphicon-th-large layout-switch-icon disabled" ng-click="switchToBlock()" tooltip="Switch to block view"></i>
+ <i class="glyphicon glyphicon-th-large layout-switch-icon disabled" ng-click="switchToBlock()" tooltip-html-unsafe="{{'clusters.switchToBlock' | translate}}"></i>
<i class="glyphicon glyphicon-list layout-switch-icon"></i>
</div>
<table class="table table-striped table-hover">
@@ -32,15 +32,15 @@
<tr>
<th>
<div class="search-container">
- <label for="">Name</label>
- <input type="text" class="form-control namefilter" placeholder="Any" ng-model="currentNameFilter" ng-change="resetPagination()">
+ <label for="">{{'common.name' | translate}}</label>
+ <input type="text" class="form-control namefilter" placeholder="{{'common.any' | translate}}" ng-model="currentNameFilter" ng-change="resetPagination()">
<button type="button" class="close clearfilter" ng-show="currentNameFilter" ng-click="currentNameFilter=''; resetPagination()">
- <span aria-hidden="true">×</span><span class="sr-only">Close</span>
+ <span aria-hidden="true">×</span><span class="sr-only">{{'common.controls.close' | translate}}</span>
</button>
</div>
</th>
<th>
- <label for="">Type</label>
+ <label for="">{{'common.type' | translate}}</label>
<select class="form-control typefilter"
ng-model="currentTypeFilter"
ng-options="item.label for item in typeFilterOptions"
@@ -49,7 +49,7 @@
</th>
<th>
- <label for="">Role</label>
+ <label for="">{{'clusters.role' | translate}}</label>
<select class="form-control statusfilter"
ng-model="currentRoleFilter"
ng-options="item.label for item in roleFilterOptions"
@@ -73,12 +73,12 @@
</tbody>
</table>
<div class="alert alert-info col-sm-12" ng-show="!users.length">
- No users to display.
+ {{'common.alerts.nothingToDisplay' | translate: '{term: constants.users}'}}
</div>
<div class="col-sm-12 table-bar">
<div class="pull-left filtered-info">
- <span>{{tableInfo.showed}} of {{tableInfo.total}} users showing</span>
- <span ng-show="isNotEmptyFilter">- <a href ng-click="clearFilters()">clear filters</a></span>
+ <span>{{'common.filterInfo' | translate: '{showed: tableInfo.showed, total: tableInfo.total, term: constants.users}'}}</span>
+ <span ng-show="isNotEmptyFilter">- <a href ng-click="clearFilters()">{{'common.controls.clearFilters' | translate}}</a></span>
</div>
<div class="pull-right left-margin">
<pagination class="paginator" total-items="totalUsers" max-size="maxVisiblePages" items-per-page="usersPerPage" ng-model="currentPage" ng-change="pageChanged()"></pagination>
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/directives/editableList.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/directives/editableList.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/directives/editableList.html
index 21de4aa..5f482ef 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/directives/editableList.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/directives/editableList.html
@@ -19,7 +19,7 @@
<div class="editable-list-container well" ng-class="{'edit-mode' : editMode, 'disabled' : !editable}" ng-click="enableEditMode($event)">
<div class="items-box">
<ul class="items-list">
- <li class="item" ng-repeat="item in items | orderBy:identity"><span><a href>{{item}}</a><button ng-click="removeFromItems(item)" type="button" class="close"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button></span></li><li class="item add-item-input" ng-show="editMode">
+ <li class="item" ng-repeat="item in items | orderBy:identity"><span><a href>{{item}}</a><button ng-click="removeFromItems(item)" type="button" class="close"><span aria-hidden="true">×</span><span class="sr-only">{{'common.controls.close' | translate}}</span></button></span></li><li class="item add-item-input" ng-show="editMode">
<span contenteditable></span>
<div class="typeahead-box" ng-show="typeahead.length != 0">
<ul>
@@ -27,7 +27,7 @@
</ul>
</div>
</li>
- <li class="item add-item" ng-show="!editMode && !items.length">Add {{resourceType}}</li>
+ <li class="item add-item" ng-show="!editMode && !items.length">{{'common.add' | translate: '{term: resourceType}'}}</li>
</ul>
</div>
<div class="actions-panel" ng-show="editMode">
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/create.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/create.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/create.html
index f61aadfe..041a228 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/create.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/create.html
@@ -16,27 +16,27 @@
* limitations under the License.
-->
<ol class="breadcrumb">
- <li><a href="#/groups">Groups</a></li>
- <li class="active">Create Local Group</li>
+ <li><a href="#/groups">{{'common.groups' | translate}}</a></li>
+ <li class="active">{{'groups.createLocal' | translate}}</li>
</ol>
<hr>
<form class="form-horizontal" role="form" novalidate name="form" autocomplete="off">
<div class="form-group" ng-class="{'has-error' : (form.group_name.$error.required || form.group_name.$error.pattern) && form.submitted}">
- <label for="groupname" class="col-sm-2 control-label">Group name</label>
+ <label for="groupname" class="col-sm-2 control-label">{{'groups.name' | translate}}</label>
<div class="col-sm-10">
- <input type="text" id="groupname" class="form-control groupname-input" name="group_name" placeholder="Group name" ng-model="group.group_name" required ng-pattern="/^([a-zA-Z0-9._\s]+)$/" autocomplete="off">
+ <input type="text" id="groupname" class="form-control groupname-input" name="group_name" placeholder="{{'groups.name' | translate}}" ng-model="group.group_name" required ng-pattern="/^([a-zA-Z0-9._\s]+)$/" autocomplete="off">
<div class="alert alert-danger top-margin" ng-show="form.group_name.$error.required && form.submitted">
- This field is required.
+ {{'common.alerts.fieldIsRequired' | translate}}
</div>
<div class="alert alert-danger top-margin" ng-show="form.group_name.$error.pattern && form.submitted">
- Must contain only simple characters.
+ {{'groups.alerts.onlySimpleChars' | translate}}
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
- <button class="btn btn-primary groupcreate-btn pull-right left-margin" ng-click="createGroup()">Save</button>
- <a href ng-click="cancel()" class="btn btn-default pull-right cancel-button">Cancel</a>
+ <button class="btn btn-primary groupcreate-btn pull-right left-margin" ng-click="createGroup()">{{'common.controls.save' | translate}}</button>
+ <a href ng-click="cancel()" class="btn btn-default pull-right cancel-button">{{'common.controls.cancel' | translate}}</a>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/83ea508b/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/edit.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/edit.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/edit.html
index ad571b8..8271432 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/edit.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/edit.html
@@ -18,13 +18,13 @@
<div class="clearfix">
<ol class="breadcrumb pull-left">
- <li><a href="#/groups">Groups</a></li>
+ <li><a href="#/groups">{{'common.groups' | translate}}</a></li>
<li class="active">{{group.group_name}}</li>
</ol>
<div class="pull-right top-margin-4">
<div ng-switch="group.ldap_group">
- <button ng-switch-when="true" class="btn disabled deletegroup-btn deleteuser-btn" tooltip="Cannot Delete Group">Delete Group</button>
- <button ng-switch-when="false" class="btn btn-danger deletegroup-btn" ng-click="deleteGroup(group)">Delete Group</button>
+ <button ng-switch-when="true" class="btn disabled deletegroup-btn deleteuser-btn" tooltip="{{'common.cannotDelete' | translate: '{term: constants.group}'}}">{{'common.delete' | translate: '{term: constants.group}'}}</button>
+ <button ng-switch-when="false" class="btn btn-danger deletegroup-btn" ng-click="deleteGroup(group)" tooltip="{{'common.cannotDelete' | translate: '{term: constants.group}'}}">{{'common.delete' | translate: '{term: constants.group}'}}</button>
</div>
</div>
@@ -32,26 +32,26 @@
<hr>
<form class="form-horizontal group-edit" role="form" novalidate name="form" >
<div class="form-group">
- <label for="" class="col-sm-2 control-label">Type</label>
+ <label for="" class="col-sm-2 control-label">{{'common.type' | translate}}</label>
<div class="col-sm-10">
- <label for="" class="control-label">{{group.ldap_group ? 'LDAP' : 'Local'}}</label>
+ <label for="" class="control-label">{{'common.' + (group.ldap_group ? 'ldap' : 'local') | translate}}</label>
</div>
</div>
<div class="form-group">
- <label for="members" class="col-sm-2 control-label">{{group.ldap_group ? 'LDAP Members' : 'Local Members'}}</label>
+ <label for="members" class="col-sm-2 control-label">{{'common.' + (group.ldap_group ? 'ldap' : 'local') | translate}} {{'groups.members' | translate}}</label>
<div class="col-sm-10">
<editable-list items-source="group.editingUsers" resource-type="User" editable="!group.ldap_group"></editable-list>
</div>
</div>
<div class="form-group">
- <label for="" class="col-sm-2 control-label">Privileges</label>
+ <label for="" class="col-sm-2 control-label">{{'common.privileges' | translate}}</label>
<div class="col-sm-10">
<table class="table" ng-hide="hidePrivileges">
<thead>
<tr>
- <th>Cluster</th>
- <th>Cluster Role</th>
+ <th>{{'common.cluster' | translate}}</th>
+ <th>{{'common.clusterRole' | translate}}</th>
</tr>
</thead>
<tbody>
@@ -65,13 +65,13 @@
</td>
</tr>
<tr>
- <td ng-show="noClusterPriv">No cluster privileges</td>
+ <td ng-show="noClusterPriv">{{'common.alerts.noPrivileges' | translate: '{term: constants.cluster}'}}</td>
</tr>
</tbody>
<thead class="view-permission-header">
<tr>
- <th>View</th>
- <th>View Permissions</th>
+ <th>{{'common.view' | translate}}</th>
+ <th>{{'common.viewPermissions' | translate}}</th>
</tr>
</thead>
<tbody>
@@ -85,11 +85,11 @@
</td>
</tr>
<tr>
- <td ng-show="noViewPriv">No view privileges</td>
+ <td ng-show="noViewPriv">{{'common.alerts.noPrivileges' | translate: '{term: constants.view}'}}</td>
</tr>
</tbody>
</table>
- <div class="alert alert-info hide-soft" ng-class="{'visible' : !privileges}">This group does not have any privileges.</div>
+ <div class="alert alert-info hide-soft" ng-class="{'visible' : !privileges}">{{'common.alerts.noPrivilegesDescription' | translate: '{term: constants.group.toLowerCase()}'}}</div>
</div>
</div>
</form>
\ No newline at end of file
[31/50] [abbrv] ambari git commit: AMBARI-14524 HDFS Recommendation:
dfs.datanode.du.reserved should be set to 10%-15% of volume size (dsen)
Posted by nc...@apache.org.
AMBARI-14524 HDFS Recommendation: dfs.datanode.du.reserved should be set to 10%-15% of volume size (dsen)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ce4e4ea3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ce4e4ea3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ce4e4ea3
Branch: refs/heads/branch-dev-patch-upgrade
Commit: ce4e4ea305f0ede6fa7129063751d37e19b72d03
Parents: df26764
Author: Dmytro Sen <ds...@apache.org>
Authored: Wed Dec 30 16:44:52 2015 +0200
Committer: Dmytro Sen <ds...@apache.org>
Committed: Wed Dec 30 16:44:52 2015 +0200
----------------------------------------------------------------------
.../HDFS/2.1.0.2.0/configuration/hdfs-site.xml | 6 +++
.../stacks/HDP/2.0.6/services/stack_advisor.py | 28 ++++++++++-
.../stacks/HDP/2.2/services/stack_advisor.py | 5 +-
.../stacks/HDP/2.3/services/stack_advisor.py | 6 ++-
.../stacks/2.0.6/common/test_stack_advisor.py | 42 ++++++++++++++--
.../stacks/2.1/common/test_stack_advisor.py | 15 +++++-
.../stacks/2.2/common/test_stack_advisor.py | 50 +++++++++++++++++---
.../stacks/2.3/common/test_stack_advisor.py | 44 ++++++++++-------
8 files changed, 164 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ce4e4ea3/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-site.xml b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-site.xml
index 3282522..ea5514d 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-site.xml
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-site.xml
@@ -278,6 +278,12 @@
<type>int</type>
<unit>bytes</unit>
</value-attributes>
+ <depends-on>
+ <property>
+ <type>hdfs-site</type>
+ <name>dfs.datanode.data.dir</name>
+ </property>
+ </depends-on>
</property>
<property>
http://git-wip-us.apache.org/repos/asf/ambari/blob/ce4e4ea3/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
index 7e2871b..a62e694 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
@@ -239,6 +239,27 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
if len(namenodes.split(',')) > 1:
putHDFSSitePropertyAttributes("dfs.namenode.rpc-address", "delete", "true")
+ #Initialize default 'dfs.datanode.data.dir' if needed
+ if (not hdfsSiteProperties) or ('dfs.datanode.data.dir' not in hdfsSiteProperties):
+ putHDFSSiteProperty('dfs.datanode.data.dir', '/hadoop/hdfs/data')
+ #dfs.datanode.du.reserved should be set to 10-15% of volume size
+ mountPoints = []
+ mountPointDiskAvailableSpace = [] #kBytes
+ for host in hosts["items"]:
+ for diskInfo in host["Hosts"]["disk_info"]:
+ mountPoints.append(diskInfo["mountpoint"])
+ mountPointDiskAvailableSpace.append(long(diskInfo["size"]))
+ maxFreeVolumeSize = 0l #kBytes
+ dataDirs = hdfsSiteProperties['dfs.datanode.data.dir'].split(",")
+ for dataDir in dataDirs:
+ mp = getMountPointForDir(dataDir, mountPoints)
+ for i in range(len(mountPoints)):
+ if mp == mountPoints[i]:
+ if mountPointDiskAvailableSpace[i] > maxFreeVolumeSize:
+ maxFreeVolumeSize = mountPointDiskAvailableSpace[i]
+
+ putHDFSSiteProperty('dfs.datanode.du.reserved', maxFreeVolumeSize * 1024 / 8) #Bytes
+
# recommendations for "hadoop.proxyuser.*.hosts", "hadoop.proxyuser.*.groups" properties in core-site
self.recommendHadoopProxyUsers(configurations, services, hosts)
@@ -787,7 +808,8 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
def getServiceConfigurationValidators(self):
return {
- "HDFS": {"hadoop-env": self.validateHDFSConfigurationsEnv},
+ "HDFS": { "hdfs-site": self.validateHDFSConfigurations,
+ "hadoop-env": self.validateHDFSConfigurationsEnv},
"MAPREDUCE2": {"mapred-site": self.validateMapReduce2Configurations},
"YARN": {"yarn-site": self.validateYARNConfigurations},
"HBASE": {"hbase-env": self.validateHbaseEnvConfigurations},
@@ -1291,6 +1313,10 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
{"config-name": "hbase_user", "item": self.validatorEqualsPropertyItem(properties, "hbase_user", hbase_site, "hbase.superuser")} ]
return self.toConfigurationValidationProblems(validationItems, "hbase-env")
+ def validateHDFSConfigurations(self, properties, recommendedDefaults, configurations, services, hosts):
+ validationItems = [{"config-name": 'dfs.datanode.du.reserved', "item": self.validatorLessThenDefaultValue(properties, recommendedDefaults, 'dfs.datanode.du.reserved')}]
+ return self.toConfigurationValidationProblems(validationItems, "hdfs-site")
+
def validateHDFSConfigurationsEnv(self, properties, recommendedDefaults, configurations, services, hosts):
validationItems = [ {"config-name": 'namenode_heapsize', "item": self.validatorLessThenDefaultValue(properties, recommendedDefaults, 'namenode_heapsize')},
{"config-name": 'namenode_opt_newsize', "item": self.validatorLessThenDefaultValue(properties, recommendedDefaults, 'namenode_opt_newsize')},
http://git-wip-us.apache.org/repos/asf/ambari/blob/ce4e4ea3/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
index 12f85b8..9e43865 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
@@ -1042,6 +1042,7 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
def validateHDFSConfigurations(self, properties, recommendedDefaults, configurations, services, hosts):
+ parentValidationProblems = super(HDP22StackAdvisor, self).validateHDFSConfigurations(properties, recommendedDefaults, configurations, services, hosts)
# We can not access property hadoop.security.authentication from the
# other config (core-site). That's why we are using another heuristics here
hdfs_site = properties
@@ -1179,7 +1180,9 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
"item": self.getWarnItem(
"Invalid property value: {0}. Valid values are {1}.".format(
data_transfer_protection_value, VALID_TRANSFER_PROTECTION_VALUES))})
- return self.toConfigurationValidationProblems(validationItems, "hdfs-site")
+ validationProblems = self.toConfigurationValidationProblems(validationItems, "hdfs-site")
+ validationProblems.extend(parentValidationProblems)
+ return validationProblems
def validateHiveServer2Configurations(self, properties, recommendedDefaults, configurations, services, hosts):
hive_server2 = properties
http://git-wip-us.apache.org/repos/asf/ambari/blob/ce4e4ea3/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
index 5ab05fd..f57debb 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
@@ -603,7 +603,7 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
return parentValidators
def validateHDFSConfigurations(self, properties, recommendedDefaults, configurations, services, hosts):
- super(HDP23StackAdvisor, self).validateHDFSConfigurations(properties, recommendedDefaults, configurations, services, hosts)
+ parentValidationProblems = super(HDP23StackAdvisor, self).validateHDFSConfigurations(properties, recommendedDefaults, configurations, services, hosts)
# We can not access property hadoop.security.authentication from the
# other config (core-site). That's why we are using another heuristics here
@@ -618,7 +618,9 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
validationItems.append({"config-name": 'dfs.namenode.inode.attributes.provider.class',
"item": self.getWarnItem(
"dfs.namenode.inode.attributes.provider.class needs to be set to 'org.apache.ranger.authorization.hadoop.RangerHdfsAuthorizer' if Ranger HDFS Plugin is enabled.")})
- return self.toConfigurationValidationProblems(validationItems, "hdfs-site")
+ validationProblems = self.toConfigurationValidationProblems(validationItems, "hdfs-site")
+ validationProblems.extend(parentValidationProblems)
+ return validationProblems
def validateHiveConfigurations(self, properties, recommendedDefaults, configurations, services, hosts):
http://git-wip-us.apache.org/repos/asf/ambari/blob/ce4e4ea3/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
index 6699e94..ec67a82 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
@@ -961,7 +961,11 @@ class TestHDP206StackAdvisor(TestCase):
"ph_cpu_count": 1,
"public_host_name": "c6401.ambari.apache.org",
"rack_info": "/default-rack",
- "total_mem": 2097152
+ "total_mem": 2097152,
+ "disk_info": [{
+ "size": '8',
+ "mountpoint": "/"
+ }]
}
}]}
@@ -1041,12 +1045,14 @@ class TestHDP206StackAdvisor(TestCase):
'falcon-env':
{'properties':
{'falcon_user': 'falcon'}},
+ 'hdfs-site':
+ {'properties':
+ {'dfs.datanode.data.dir': '/hadoop/hdfs/data',
+ 'dfs.datanode.du.reserved': '1024'}},
'hive-env':
{'properties':
{'hive_user': 'hive',
'webhcat_user': 'webhcat'}},
- 'hdfs-site':
- {'properties': {}},
'hadoop-env':
{'properties':
{'hdfs_user': 'hdfs',
@@ -1094,7 +1100,9 @@ class TestHDP206StackAdvisor(TestCase):
{'hive_user': 'hive',
'webhcat_user': 'webhcat'}},
'hdfs-site':
- {'properties': {}},
+ {'properties':
+ {'dfs.datanode.data.dir': '/hadoop/hdfs/data',
+ 'dfs.datanode.du.reserved': '1024'}},
'hadoop-env':
{'properties':
{'hdfs_user': 'hdfs1',
@@ -1110,8 +1118,11 @@ class TestHDP206StackAdvisor(TestCase):
configurations["hdfs-site"]["properties"]['dfs.nameservices'] = "mycluster"
configurations["hdfs-site"]["properties"]['dfs.ha.namenodes.mycluster'] = "nn1,nn2"
services['configurations'] = configurations
+
expected["hdfs-site"] = {
'properties': {
+ 'dfs.datanode.data.dir': '/hadoop/hdfs/data',
+ 'dfs.datanode.du.reserved': '1024',
'dfs.nameservices': 'mycluster',
'dfs.ha.namenodes.mycluster': 'nn1,nn2'
},
@@ -1188,6 +1199,29 @@ class TestHDP206StackAdvisor(TestCase):
expected = "zk.host1:2183,zk.host2:2183,zk.host3:2183"
self.assertEquals(result, expected)
+ def test_validateHDFSConfigurations(self):
+ configurations = {}
+ services = ''
+ hosts = ''
+ #Default configuration
+ recommendedDefaults = {'dfs.datanode.du.reserved': '1024'}
+ properties = {'dfs.datanode.du.reserved': '1024'}
+ res = self.stackAdvisor.validateHDFSConfigurations(properties,
+ recommendedDefaults, configurations, services, hosts)
+ self.assertFalse(res)
+ #Value is less then expected
+ recommendedDefaults = {'dfs.datanode.du.reserved': '1024'}
+ properties = {'dfs.datanode.du.reserved': '512'}
+ res = self.stackAdvisor.validateHDFSConfigurations(properties,
+ recommendedDefaults, configurations, services, hosts)
+ self.assertTrue(res)
+ #Value is begger then expected
+ recommendedDefaults = {'dfs.datanode.du.reserved': '1024'}
+ properties = {'dfs.datanode.du.reserved': '2048'}
+ res = self.stackAdvisor.validateHDFSConfigurations(properties,
+ recommendedDefaults, configurations, services, hosts)
+ self.assertFalse(res)
+
def test_validateHDFSConfigurationsEnv(self):
configurations = {}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ce4e4ea3/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
index 63d34af..0ca31a5 100644
--- a/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
@@ -251,7 +251,16 @@ class TestHDP21StackAdvisor(TestCase):
}
}
}
-
+ hosts = {
+ "items": [
+ {
+ "Hosts": {
+ "disk_info": [{
+ "size": '8',
+ "mountpoint": "/"
+ }]
+ }
+ }]}
services = {
"services": [
{
@@ -282,11 +291,13 @@ class TestHDP21StackAdvisor(TestCase):
},
"hdfs-site": {
"properties": {
+ 'dfs.datanode.data.dir': '/hadoop/hdfs/data',
+ 'dfs.datanode.du.reserved': '1024'
}
}
}
- self.stackAdvisor.recommendHDFSConfigurations(configurations, clusterData, services, '')
+ self.stackAdvisor.recommendHDFSConfigurations(configurations, clusterData, services, hosts)
self.assertEquals(configurations, expected)
def test_validateHDFSConfigurationsEnv(self):
http://git-wip-us.apache.org/repos/asf/ambari/blob/ce4e4ea3/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
index 4e5458e..5f95b6d 100644
--- a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
@@ -206,7 +206,9 @@ class TestHDP22StackAdvisor(TestCase):
def test_validateHDFSConfigurations(self):
- recommendedDefaults = None
+ recommendedDefaults = {
+ 'dfs.datanode.du.reserved': '1024'
+ }
unsecure_cluster_core_site = {
'hadoop.security.authentication': 'simple',
@@ -220,6 +222,7 @@ class TestHDP22StackAdvisor(TestCase):
# TEST CASE: Unsecured cluster, secure ports
properties = { # hdfs-site
+ 'dfs.datanode.du.reserved': '1024',
'dfs.datanode.address': '0.0.0.0:1019',
'dfs.datanode.http.address': '0.0.0.0:1022',
}
@@ -247,6 +250,7 @@ class TestHDP22StackAdvisor(TestCase):
# TEST CASE: Unsecured cluster, unsecure ports
properties = { # hdfs-site
+ 'dfs.datanode.du.reserved': '1024',
'dfs.datanode.address': '0.0.0.0:55555',
'dfs.datanode.http.address': '0.0.0.0:55555',
}
@@ -276,6 +280,7 @@ class TestHDP22StackAdvisor(TestCase):
# TEST CASE: Secure cluster, invalid dfs.http.policy value
properties = { # hdfs-site
+ 'dfs.datanode.du.reserved': '1024',
'dfs.http.policy': 'WRONG_VALUE',
'dfs.datanode.address': '0.0.0.0:1019',
'dfs.datanode.http.address': '0.0.0.0:1022',
@@ -310,6 +315,7 @@ class TestHDP22StackAdvisor(TestCase):
# TEST CASE: Secure cluster, dfs.http.policy=HTTPS_ONLY, https address not defined
properties = { # hdfs-site
+ 'dfs.datanode.du.reserved': '1024',
'dfs.http.policy': 'HTTPS_ONLY',
'dfs.datanode.address': '0.0.0.0:1019',
}
@@ -339,6 +345,7 @@ class TestHDP22StackAdvisor(TestCase):
# TEST CASE: Secure cluster, dfs.http.policy=HTTPS_ONLY, https address defined and secure
properties = { # hdfs-site
+ 'dfs.datanode.du.reserved': '1024',
'dfs.http.policy': 'HTTPS_ONLY',
'dfs.datanode.address': '0.0.0.0:1019',
'dfs.datanode.https.address': '0.0.0.0:1022',
@@ -369,6 +376,7 @@ class TestHDP22StackAdvisor(TestCase):
# TEST CASE: Secure cluster, dfs.http.policy=HTTPS_ONLY, https address defined and non secure
properties = { # hdfs-site
+ 'dfs.datanode.du.reserved': '1024',
'dfs.http.policy': 'HTTPS_ONLY',
'dfs.datanode.address': '0.0.0.0:1019',
'dfs.datanode.https.address': '0.0.0.0:50475',
@@ -399,6 +407,7 @@ class TestHDP22StackAdvisor(TestCase):
# TEST CASE: Secure cluster, dfs.http.policy=HTTPS_ONLY, non secure dfs port, https property not defined
properties = { # hdfs-site
+ 'dfs.datanode.du.reserved': '1024',
'dfs.http.policy': 'HTTPS_ONLY',
'dfs.datanode.address': '0.0.0.0:50010',
}
@@ -450,6 +459,7 @@ class TestHDP22StackAdvisor(TestCase):
# TEST CASE: Secure cluster, dfs.http.policy=HTTPS_ONLY, non secure dfs port, https defined and secure
properties = { # hdfs-site
+ 'dfs.datanode.du.reserved': '1024',
'dfs.http.policy': 'HTTPS_ONLY',
'dfs.datanode.address': '0.0.0.0:50010',
'dfs.datanode.https.address': '0.0.0.0:1022',
@@ -499,6 +509,7 @@ class TestHDP22StackAdvisor(TestCase):
# TEST CASE: Secure cluster, dfs.http.policy=HTTPS_ONLY, valid non-root configuration
properties = { # hdfs-site
+ 'dfs.datanode.du.reserved': '1024',
'dfs.http.policy': 'HTTPS_ONLY',
'dfs.datanode.address': '0.0.0.0:50010',
'dfs.datanode.https.address': '0.0.0.0:50475',
@@ -523,6 +534,7 @@ class TestHDP22StackAdvisor(TestCase):
# TEST CASE: Secure cluster, dfs.http.policy=HTTP_ONLY, insecure port
properties = { # hdfs-site
+ 'dfs.datanode.du.reserved': '1024',
'dfs.http.policy': 'HTTP_ONLY',
'dfs.datanode.address': '0.0.0.0:1019',
'dfs.datanode.http.address': '0.0.0.0:50475',
@@ -564,6 +576,7 @@ class TestHDP22StackAdvisor(TestCase):
# TEST CASE: Secure cluster, dfs.http.policy=HTTP_ONLY, valid configuration
properties = { # hdfs-site
+ 'dfs.datanode.du.reserved': '1024',
'dfs.http.policy': 'HTTP_ONLY',
'dfs.datanode.address': '0.0.0.0:1019',
'dfs.datanode.http.address': '0.0.0.0:1022',
@@ -587,6 +600,7 @@ class TestHDP22StackAdvisor(TestCase):
# TEST CASE: Secure cluster, absent dfs.http.policy (typical situation)
properties = { # hdfs-site
+ 'dfs.datanode.du.reserved': '1024',
'dfs.datanode.address': '0.0.0.0:1019',
'dfs.datanode.http.address': '0.0.0.0:1022',
}
@@ -609,6 +623,7 @@ class TestHDP22StackAdvisor(TestCase):
# TEST CASE: Secure cluster, dfs.http.policy=HTTP_ONLY, misusage of dfs.data.transfer.protection warning
properties = { # hdfs-site
+ 'dfs.datanode.du.reserved': '1024',
'dfs.http.policy': 'HTTP_ONLY',
'dfs.datanode.address': '0.0.0.0:1019',
'dfs.datanode.http.address': '0.0.0.0:1022',
@@ -638,6 +653,7 @@ class TestHDP22StackAdvisor(TestCase):
# TEST CASE: Secure cluster, dfs.http.policy=HTTPS_ONLY, wrong dfs.data.transfer.protection value
properties = { # hdfs-site
+ 'dfs.datanode.du.reserved': '1024',
'dfs.http.policy': 'HTTPS_ONLY',
'dfs.datanode.address': '0.0.0.0:50010',
'dfs.datanode.https.address': '0.0.0.0:50475',
@@ -667,6 +683,7 @@ class TestHDP22StackAdvisor(TestCase):
# TEST CASE: Hadoop wire encryption enabled
properties = { # hdfs-site
+ 'dfs.datanode.du.reserved': '1024',
'dfs.encrypt.data.transfer': 'true', # Wire encryption
'dfs.datanode.address': '0.0.0.0:1019',
'dfs.datanode.http.address': '0.0.0.0:1022',
@@ -2753,6 +2770,7 @@ class TestHDP22StackAdvisor(TestCase):
},
'hdfs-site': {
'properties': {
+ 'dfs.datanode.du.reserved': '1024',
'dfs.datanode.max.transfer.threads': '16384',
'dfs.namenode.safemode.threshold-pct': '1.000',
'dfs.datanode.failed.volumes.tolerated': '1',
@@ -2879,7 +2897,11 @@ class TestHDP22StackAdvisor(TestCase):
"ph_cpu_count" : 1,
"public_host_name" : "host1",
"rack_info" : "/default-rack",
- "total_mem" : 2097152
+ "total_mem" : 2097152,
+ "disk_info": [{
+ "size": '8',
+ "mountpoint": "/"
+ }]
}
},
{
@@ -2892,7 +2914,11 @@ class TestHDP22StackAdvisor(TestCase):
"ph_cpu_count" : 1,
"public_host_name" : "host2",
"rack_info" : "/default-rack",
- "total_mem" : 10485760
+ "total_mem" : 10485760,
+ "disk_info": [{
+ "size": '8',
+ "mountpoint": "/"
+ }]
}
},
]
@@ -2916,7 +2942,11 @@ class TestHDP22StackAdvisor(TestCase):
"ph_cpu_count" : 1,
"public_host_name" : hostname,
"rack_info" : "/default-rack",
- "total_mem" : 2097152
+ "total_mem" : 2097152,
+ "disk_info": [{
+ "size": '8',
+ "mountpoint": "/"
+ }]
}
}
)
@@ -2939,7 +2969,11 @@ class TestHDP22StackAdvisor(TestCase):
"ph_cpu_count" : 1,
"public_host_name" : hostname,
"rack_info" : "/default-rack",
- "total_mem" : 2097152
+ "total_mem" : 2097152,
+ "disk_info": [{
+ "size": '8',
+ "mountpoint": "/"
+ }]
}
}
)
@@ -2964,7 +2998,11 @@ class TestHDP22StackAdvisor(TestCase):
"ph_cpu_count" : 1,
"public_host_name" : hostname,
"rack_info" : "/default-rack",
- "total_mem" : 2097152
+ "total_mem" : 2097152,
+ "disk_info": [{
+ "size": '8',
+ "mountpoint": "/"
+ }]
}
}
)
http://git-wip-us.apache.org/repos/asf/ambari/blob/ce4e4ea3/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
index db61f5f..67ac25f 100644
--- a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
@@ -284,13 +284,34 @@ class TestHDP23StackAdvisor(TestCase):
def test_recommendHDFSConfigurations(self):
- configurations = {}
+ configurations = {
+ "hdfs-site": {
+ "properties": {
+ "dfs.namenode.inode.attributes.provider.class": "org.apache.ranger.authorization.hadoop.RangerHdfsAuthorizer",
+ }
+ },
+ "ranger-hdfs-plugin-properties": {
+ "properties": {
+ "ranger-hdfs-plugin-enabled": "No"
+ }
+ }
+ }
clusterData = {
"totalAvailableRam": 2048,
"hBaseInstalled": True,
"hbaseRam": 112,
"reservedRam": 128
}
+ hosts = {
+ "items": [
+ {
+ "Hosts": {
+ "disk_info": [{
+ "size": '8',
+ "mountpoint": "/"
+ }]
+ }
+ }]}
services = {
"services":
[
@@ -298,35 +319,26 @@ class TestHDP23StackAdvisor(TestCase):
"StackServices": {
"service_name" : "HDFS",
"service_version" : "2.6.0.2.2"
- }
+ },
+ "components": [
+ ]
}
],
"Versions": {
"stack_version": "2.3"
},
- "configurations": {
- "hdfs-site": {
- "properties": {
- "dfs.namenode.inode.attributes.provider.class": "org.apache.ranger.authorization.hadoop.RangerHdfsAuthorizer"
- }
- },
- "ranger-hdfs-plugin-properties": {
- "properties": {
- "ranger-hdfs-plugin-enabled": "No"
- }
- }
- }
+ "configurations": configurations
}
# Test with Ranger HDFS plugin disabled
- self.stackAdvisor.recommendHDFSConfigurations(configurations, clusterData, services, None)
+ self.stackAdvisor.recommendHDFSConfigurations(configurations, clusterData, services, hosts)
self.assertEquals(configurations['hdfs-site']['property_attributes']['dfs.namenode.inode.attributes.provider.class'], {'delete': 'true'}, "Test with Ranger HDFS plugin is disabled")
# Test with Ranger HDFS plugin is enabled
configurations['hdfs-site']['properties'] = {}
configurations['hdfs-site']['property_attributes'] = {}
services['configurations']['ranger-hdfs-plugin-properties']['properties']['ranger-hdfs-plugin-enabled'] = 'Yes'
- self.stackAdvisor.recommendHDFSConfigurations(configurations, clusterData, services, None)
+ self.stackAdvisor.recommendHDFSConfigurations(configurations, clusterData, services, hosts)
self.assertEquals(configurations['hdfs-site']['properties']['dfs.namenode.inode.attributes.provider.class'], 'org.apache.ranger.authorization.hadoop.RangerHdfsAuthorizer', "Test with Ranger HDFS plugin is enabled")
def test_recommendYARNConfigurations(self):
[19/50] [abbrv] ambari git commit: AMBARI-14508. Upgrade from
1.6.1(and possibly other < 2.0.0) to 2.2.1 failed. (dlysnichenko)
Posted by nc...@apache.org.
AMBARI-14508. Upgrade from 1.6.1(and possibly other < 2.0.0) to 2.2.1 failed. (dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2b9bfd98
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2b9bfd98
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2b9bfd98
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 2b9bfd982f7203a6fc7f4f2432a93376e0cf52b3
Parents: 65752c9
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Tue Dec 29 14:16:45 2015 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Tue Dec 29 14:17:45 2015 +0200
----------------------------------------------------------------------
.../org/apache/ambari/server/upgrade/UpgradeCatalog221.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b9bfd98/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java
index 1257f70..b33d44e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java
@@ -139,8 +139,12 @@ public class UpgradeCatalog221 extends AbstractUpgradeCatalog {
clusterID, "hive_server_process");
List<AlertDefinitionEntity> hiveAlertDefinitions = new ArrayList();
- hiveAlertDefinitions.add(hiveMetastoreProcessAlertDefinitionEntity);
- hiveAlertDefinitions.add(hiveServerProcessAlertDefinitionEntity);
+ if(hiveMetastoreProcessAlertDefinitionEntity != null) {
+ hiveAlertDefinitions.add(hiveMetastoreProcessAlertDefinitionEntity);
+ }
+ if(hiveServerProcessAlertDefinitionEntity != null) {
+ hiveAlertDefinitions.add(hiveServerProcessAlertDefinitionEntity);
+ }
for(AlertDefinitionEntity alertDefinition : hiveAlertDefinitions){
String source = alertDefinition.getSource();
[26/50] [abbrv] ambari git commit: AMBARI-14519. GET calls to
/requests become very slow after installing packages on 900 node cluster.
(mpapirkovskyy)
Posted by nc...@apache.org.
AMBARI-14519. GET calls to /requests become very slow after installing packages on 900 node cluster. (mpapirkovskyy)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8a748ffd
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8a748ffd
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8a748ffd
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 8a748ffd9829cc25350ea79ed9f44abe0a98b012
Parents: 9022bfb
Author: Myroslav Papirkovskyy <mp...@hortonworks.com>
Authored: Tue Dec 29 16:45:15 2015 +0200
Committer: Myroslav Papirkovskyy <mp...@hortonworks.com>
Committed: Tue Dec 29 19:45:27 2015 +0200
----------------------------------------------------------------------
.../ambari/server/topology/AmbariContext.java | 4 +++
.../ambari/server/topology/HostRequest.java | 4 +++
.../ambari/server/topology/LogicalRequest.java | 35 +++++++++++++++++---
.../server/upgrade/UpgradeCatalog221.java | 6 +++-
.../main/resources/Ambari-DDL-Derby-CREATE.sql | 5 +++
.../main/resources/Ambari-DDL-MySQL-CREATE.sql | 5 +++
.../main/resources/Ambari-DDL-Oracle-CREATE.sql | 5 +++
.../resources/Ambari-DDL-Postgres-CREATE.sql | 5 +++
.../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql | 5 +++
.../resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 5 +++
.../resources/Ambari-DDL-SQLServer-CREATE.sql | 5 +++
.../server/upgrade/UpgradeCatalog221Test.java | 31 +++++++++++++++++
12 files changed, 110 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a748ffd/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
index 0a2bd18..6bfee93 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
@@ -145,6 +145,10 @@ public class AmbariContext {
return getController().getActionManager().getTaskById(id);
}
+ public Collection<HostRoleCommand> getPhysicalTasks(Collection<Long> ids) {
+ return getController().getActionManager().getTasks(ids);
+ }
+
public void createAmbariResources(ClusterTopology topology, String clusterName, SecurityType securityType) {
Stack stack = topology.getBlueprint().getStack();
createAmbariClusterResource(clusterName, stack.getName(), stack.getVersion(), securityType);
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a748ffd/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java
index 7f178f4..440638c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java
@@ -387,6 +387,10 @@ public class HostRequest implements Comparable<HostRequest> {
return physicalTasks.get(logicalTaskId);
}
+ public Map<Long, Long> getPhysicalTaskMapping() {
+ return new HashMap<>(physicalTasks);
+ }
+
//todo: since this is used to determine equality, using hashCode() isn't safe as it can return the same
//todo: value for 2 unequal requests
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a748ffd/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java
index fb6b774..bd9f2e0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java
@@ -195,6 +195,7 @@ public class LogicalRequest extends Request {
}
// currently we are just returning all stages for all requests
+ //TODO technically StageEntity is simply a container for HostRequest info with additional redundant transformations
public Collection<StageEntity> getStageEntities() {
Collection<StageEntity> stages = new ArrayList<StageEntity>();
for (HostRequest hostRequest : allHostRequests) {
@@ -232,7 +233,32 @@ public class LogicalRequest extends Request {
public Map<Long, HostRoleCommandStatusSummaryDTO> getStageSummaries() {
Map<Long, HostRoleCommandStatusSummaryDTO> summaryMap = new HashMap<Long, HostRoleCommandStatusSummaryDTO>();
- for (StageEntity stage : getStageEntities()) {
+ Map<Long, Collection<HostRoleCommand>> stageTasksMap = new HashMap<>();
+
+ Map<Long, Long> taskToStageMap = new HashMap<>();
+
+
+ for (HostRequest hostRequest : getHostRequests()) {
+ Map<Long, Long> physicalTaskMapping = hostRequest.getPhysicalTaskMapping();
+ Collection<Long> stageTasks = physicalTaskMapping.values();
+ for (Long stageTask : stageTasks) {
+ taskToStageMap.put(stageTask, hostRequest.getStageId());
+ }
+ }
+
+ Collection<HostRoleCommand> physicalTasks = topology.getAmbariContext().getPhysicalTasks(taskToStageMap.keySet());
+
+ for (HostRoleCommand physicalTask : physicalTasks) {
+ Long stageId = taskToStageMap.get(physicalTask.getTaskId());
+ Collection<HostRoleCommand> stageTasks = stageTasksMap.get(stageId);
+ if (stageTasks == null) {
+ stageTasks = new ArrayList<>();
+ stageTasksMap.put(stageId, stageTasks);
+ }
+ stageTasks.add(physicalTask);
+ }
+
+ for (Long stageId : stageTasksMap.keySet()) {
//Number minStartTime = 0;
//Number maxEndTime = 0;
int aborted = 0;
@@ -248,7 +274,7 @@ public class LogicalRequest extends Request {
int skippedFailed = 0;
//todo: where does this logic belong?
- for (HostRoleCommandEntity task : stage.getHostRoleCommands()) {
+ for (HostRoleCommand task : stageTasksMap.get(stageId)) {
HostRoleStatus taskStatus = task.getStatus();
switch (taskStatus) {
@@ -291,12 +317,13 @@ public class LogicalRequest extends Request {
}
HostRoleCommandStatusSummaryDTO stageSummary = new HostRoleCommandStatusSummaryDTO(
- stage.isSkippable() ? 1 : 0, 0, 0, stage.getStageId(), aborted, completed, failed,
+ 0, 0, 0, stageId, aborted, completed, failed,
holding, holdingFailed, holdingTimedout, inProgress, pending, queued, timedout,
skippedFailed);
- summaryMap.put(stage.getStageId(), stageSummary);
+ summaryMap.put(stageId, stageSummary);
}
+
return summaryMap;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a748ffd/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java
index b33d44e..c4216bd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java
@@ -109,7 +109,11 @@ public class UpgradeCatalog221 extends AbstractUpgradeCatalog {
@Override
protected void executeDDLUpdates() throws AmbariException, SQLException {
- //To change body of implemented methods use File | Settings | File Templates.
+ // indices to improve request status calc performance
+ dbAccessor.createIndex("idx_stage_request_id", "stage", "request_id");
+ dbAccessor.createIndex("idx_hrc_request_id", "host_role_command", "request_id");
+ dbAccessor.createIndex("idx_rsc_request_id", "role_success_criteria", "request_id");
+
}
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a748ffd/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
index 0e534b7..d93a3c2 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -653,6 +653,11 @@ CREATE TABLE topology_logical_task (
PRIMARY KEY (id)
);
+-- tasks indices --
+CREATE INDEX idx_stage_request_id ON stage (request_id);
+CREATE INDEX idx_hrc_request_id ON host_role_command (request_id);
+CREATE INDEX idx_rsc_request_id ON role_success_criteria (request_id);
+
--------altering tables by creating unique constraints----------
ALTER TABLE users ADD CONSTRAINT UNQ_users_0 UNIQUE (user_name, user_type);
ALTER TABLE clusterconfig ADD CONSTRAINT UQ_config_type_tag UNIQUE (version_tag, type_name, cluster_id);
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a748ffd/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
index fcfcb93..aa8ced1 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -660,6 +660,11 @@ CREATE TABLE topology_logical_task (
PRIMARY KEY (id)
);
+-- tasks indices --
+CREATE INDEX idx_stage_request_id ON stage (request_id);
+CREATE INDEX idx_hrc_request_id ON host_role_command (request_id);
+CREATE INDEX idx_rsc_request_id ON role_success_criteria (request_id);
+
-- altering tables by creating unique constraints----------
ALTER TABLE users ADD CONSTRAINT UNQ_users_0 UNIQUE (user_name, user_type);
ALTER TABLE groups ADD CONSTRAINT UNQ_groups_0 UNIQUE (group_name, ldap_group);
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a748ffd/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
index 4305a4c..b534344 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -649,6 +649,11 @@ CREATE TABLE topology_logical_task (
PRIMARY KEY (id)
);
+-- tasks indices --
+CREATE INDEX idx_stage_request_id ON stage (request_id);
+CREATE INDEX idx_hrc_request_id ON host_role_command (request_id);
+CREATE INDEX idx_rsc_request_id ON role_success_criteria (request_id);
+
--------altering tables by creating unique constraints----------
ALTER TABLE users ADD CONSTRAINT UNQ_users_0 UNIQUE (user_name, user_type);
ALTER TABLE groups ADD CONSTRAINT UNQ_groups_0 UNIQUE (group_name, ldap_group);
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a748ffd/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index 32fd2a6..941fc6e 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -653,6 +653,11 @@ CREATE TABLE topology_logical_task (
PRIMARY KEY (id)
);
+-- tasks indices --
+CREATE INDEX idx_stage_request_id ON stage (request_id);
+CREATE INDEX idx_hrc_request_id ON host_role_command (request_id);
+CREATE INDEX idx_rsc_request_id ON role_success_criteria (request_id);
+
--------altering tables by creating unique constraints----------
ALTER TABLE users ADD CONSTRAINT UNQ_users_0 UNIQUE (user_name, user_type);
ALTER TABLE clusterconfig ADD CONSTRAINT UQ_config_type_tag UNIQUE (cluster_id, type_name, version_tag);
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a748ffd/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
index 7894c43..dd517f8 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
@@ -734,6 +734,11 @@ CREATE TABLE ambari.topology_logical_task (
);
GRANT ALL PRIVILEGES ON TABLE ambari.topology_logical_task TO :username;
+-- tasks indices --
+CREATE INDEX idx_stage_request_id ON ambari.stage (request_id);
+CREATE INDEX idx_hrc_request_id ON ambari.host_role_command (request_id);
+CREATE INDEX idx_rsc_request_id ON ambari.role_success_criteria (request_id);
+
--------altering tables by creating unique constraints----------
ALTER TABLE ambari.users ADD CONSTRAINT UNQ_users_0 UNIQUE (user_name, user_type);
ALTER TABLE ambari.clusterconfig ADD CONSTRAINT UQ_config_type_tag UNIQUE (cluster_id, type_name, version_tag);
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a748ffd/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
index 6df1569..f837f9e 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
@@ -650,6 +650,11 @@ CREATE TABLE topology_logical_task (
PRIMARY KEY (id)
);
+-- tasks indices --
+CREATE INDEX idx_stage_request_id ON stage (request_id);
+CREATE INDEX idx_hrc_request_id ON host_role_command (request_id);
+CREATE INDEX idx_rsc_request_id ON role_success_criteria (request_id);
+
-- altering tables by creating unique constraints----------
ALTER TABLE users ADD CONSTRAINT UNQ_users_0 UNIQUE (user_name, user_type);
ALTER TABLE groups ADD CONSTRAINT UNQ_groups_0 UNIQUE (group_name, ldap_group);
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a748ffd/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
index 83b2a7e..239d27e 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
@@ -758,6 +758,11 @@ CREATE TABLE topology_logical_task (
PRIMARY KEY CLUSTERED (id)
);
+-- tasks indices --
+CREATE INDEX idx_stage_request_id ON stage (request_id);
+CREATE INDEX idx_hrc_request_id ON host_role_command (request_id);
+CREATE INDEX idx_rsc_request_id ON role_success_criteria (request_id);
+
-- altering tables by creating unique constraints----------
--------altering tables to add constraints----------
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a748ffd/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
index bbae7a7..5bd8f2a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
@@ -22,8 +22,10 @@ package org.apache.ambari.server.upgrade;
import com.google.inject.AbstractModule;
import com.google.common.collect.Maps;
import com.google.gson.Gson;
+import com.google.inject.Binder;
import com.google.inject.Guice;
import com.google.inject.Injector;
+import com.google.inject.Module;
import com.google.inject.Provider;
import com.google.inject.persist.PersistService;
import junit.framework.Assert;
@@ -60,6 +62,7 @@ import java.util.Map;
import static org.easymock.EasyMock.createMockBuilder;
import static org.easymock.EasyMock.createNiceMock;
import static org.easymock.EasyMock.createStrictMock;
+import static org.easymock.EasyMock.eq;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
import static org.easymock.EasyMock.replay;
@@ -101,6 +104,34 @@ public class UpgradeCatalog221Test {
}
@Test
+ public void testExecuteDDLUpdates() throws Exception{
+ final DBAccessor dbAccessor = createNiceMock(DBAccessor.class);
+
+ dbAccessor.createIndex(eq("idx_stage_request_id"), eq("stage"), eq("request_id"));
+ expectLastCall().once();
+ dbAccessor.createIndex(eq("idx_hrc_request_id"), eq("host_role_command"), eq("request_id"));
+ expectLastCall().once();
+ dbAccessor.createIndex(eq("idx_rsc_request_id"), eq("role_success_criteria"), eq("request_id"));
+ expectLastCall().once();
+
+
+ replay(dbAccessor);
+ Module module = new Module() {
+ @Override
+ public void configure(Binder binder) {
+ binder.bind(DBAccessor.class).toInstance(dbAccessor);
+ binder.bind(OsFamily.class).toInstance(createNiceMock(OsFamily.class));
+ binder.bind(EntityManager.class).toInstance(entityManager);
+ }
+ };
+
+ Injector injector = Guice.createInjector(module);
+ UpgradeCatalog221 upgradeCatalog221 = injector.getInstance(UpgradeCatalog221.class);
+ upgradeCatalog221.executeDDLUpdates();
+ verify(dbAccessor);
+ }
+
+ @Test
public void testExecuteDMLUpdates() throws Exception {
Method addNewConfigurationsFromXml = AbstractUpgradeCatalog.class.getDeclaredMethod("addNewConfigurationsFromXml");
Method updateAlerts = UpgradeCatalog221.class.getDeclaredMethod("updateAlerts");
[39/50] [abbrv] ambari git commit: AMBARI-14531. Improve Ambari UI UT
(p.4) (onechiporenko)
Posted by nc...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/wizard/step6_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step6_test.js b/ambari-web/test/controllers/wizard/step6_test.js
index 1654958..f2c7332 100644
--- a/ambari-web/test/controllers/wizard/step6_test.js
+++ b/ambari-web/test/controllers/wizard/step6_test.js
@@ -116,25 +116,27 @@ describe('App.WizardStep6Controller', function () {
});
describe('#selectAllNodes', function () {
+
+ var hostsObj = Em.A([Em.Object.create({
+ hasMaster: false,
+ isInstalled: false,
+ checkboxes: Em.A([
+ Em.Object.create({
+ title: 'l1',
+ component: 'name',
+ isInstalled: false,
+ checked: false
+ })
+ ])
+ })]);
+ var obj = Em.Object.create({
+ context: {
+ name: "name"
+ }
+ });
+ var clientComponents = Em.A([{component_name: "name1"}]);
+
it('should make checkbox checked', function () {
- var hostsObj = Em.A([Em.Object.create({
- hasMaster: false,
- isInstalled: false,
- checkboxes: Em.A([
- Em.Object.create({
- title: 'l1',
- component: 'name',
- isInstalled: false,
- checked: false
- })
- ])
- })]);
- var obj = Em.Object.create({
- context: {
- name: "name"
- }
- });
- var clientComponents = Em.A([{component_name: "name1"}]);
controller.set('hosts', hostsObj);
controller.set('content.clients', clientComponents);
controller.selectAllNodes(obj);
@@ -154,25 +156,27 @@ describe('App.WizardStep6Controller', function () {
});
describe('#deselectAllNodes', function () {
+
+ var hostsObj = Em.A([Em.Object.create({
+ hasMaster: false,
+ isInstalled: false,
+ checkboxes: Em.A([
+ Em.Object.create({
+ title: 'l1',
+ component: 'name',
+ isInstalled: false,
+ checked: true
+ })
+ ])
+ })]);
+ var obj = Em.Object.create({
+ context: {
+ name: "name"
+ }
+ });
+ var clientComponents = Em.A([{component_name: "name1"}]);
+
it('should uncheck checkbox', function () {
- var hostsObj = Em.A([Em.Object.create({
- hasMaster: false,
- isInstalled: false,
- checkboxes: Em.A([
- Em.Object.create({
- title: 'l1',
- component: 'name',
- isInstalled: false,
- checked: true
- })
- ])
- })]);
- var obj = Em.Object.create({
- context: {
- name: "name"
- }
- });
- var clientComponents = Em.A([{component_name: "name1"}]);
controller.set('hosts', hostsObj);
controller.set('content.clients', clientComponents);
controller.deselectAllNodes(obj);
@@ -558,6 +562,31 @@ describe('App.WizardStep6Controller', function () {
});
describe('#updateValidationsSuccessCallback', function () {
+
+ var hosts = Em.A([Em.Object.create({
+ warnMessages: "warn",
+ errorMessages: "error",
+ anyMessage: true,
+ checkboxes: Em.A([Em.Object.create({
+ hasWarnMessage: true,
+ hasErrorMessage: true
+ })])
+ })]);
+
+ var validationData = Em.Object.create({
+ resources: Em.A([
+ Em.Object.create({
+ items: Em.A([
+ Em.Object.create({
+ "component-name": 'HDFS_CLIENT',
+ host: "1",
+ isMaster: true
+ })
+ ])
+ })
+ ])
+ });
+
beforeEach(function () {
sinon.stub(validationUtils, 'filterNotInstalledComponents', function () {
return Em.A([Em.Object.create({
@@ -626,51 +655,49 @@ describe('App.WizardStep6Controller', function () {
})
];
});
+ controller.set('hosts', hosts);
+ controller.updateValidationsSuccessCallback(validationData);
});
+
afterEach(function () {
App.StackServiceComponent.find.restore();
validationUtils.filterNotInstalledComponents.restore();
});
- it('should return modified hosts', function () {
- var hosts = Em.A([Em.Object.create({
- warnMessages: "warn",
- errorMessages: "error",
- anyMessage: true,
- checkboxes: Em.A([Em.Object.create({
- hasWarnMessage: true,
- hasErrorMessage: true
- })])
- })]);
- controller.set('hosts', hosts);
- var validationData = Em.Object.create({
- resources: Em.A([
- Em.Object.create({
- items: Em.A([
- Em.Object.create({
- "component-name": 'HDFS_CLIENT',
- host: "1",
- isMaster: true
- })
- ])
- })
- ])
- });
- controller.updateValidationsSuccessCallback(validationData);
+
+ it('no generalErrorMessages', function () {
expect(controller.get('generalErrorMessages').length).to.equal(0);
+ });
+
+ it('no generalWarningMessages', function () {
expect(controller.get('generalWarningMessages').length).to.equal(0);
- expect(JSON.parse(JSON.stringify(controller.get('hosts')))).to.eql(JSON.parse(JSON.stringify(Em.A([Em.Object.create({
+ });
+
+ it('hosts info is valid', function () {
+ var cHosts = JSON.parse(JSON.stringify(controller.get('hosts')));
+ var expected = [{
warnMessages: [null],
errorMessages: [null],
anyMessage: true,
- checkboxes: Em.A([Em.Object.create({
+ checkboxes: [{
hasWarnMessage: true,
hasErrorMessage: true
- })])
- })]))));
+ }]
+ }];
+ expect(cHosts).to.eql(expected);
});
});
describe('#clearError', function () {
+
+ var headers = Em.A([
+ Em.Object.create({name: "c1", label: 't1'}),
+ Em.Object.create({name: "c2", label: 't2'})]);
+
+ beforeEach(function () {
+ controller.set('errorMessage', 'error');
+ controller.set('headers', headers);
+ });
+
it('both checkboxes are checked', function () {
var hosts = Em.A([
Em.Object.create({
@@ -687,12 +714,8 @@ describe('App.WizardStep6Controller', function () {
})])
})
]);
- var headers = Em.A([
- Em.Object.create({name: "c1"}),
- Em.Object.create({name: "c2"})]);
- controller.set('errorMessage', 'error');
+
controller.set('hosts', hosts);
- controller.set('headers', headers);
controller.clearError();
expect(controller.get('errorMessage')).to.equal('');
});
@@ -715,12 +738,8 @@ describe('App.WizardStep6Controller', function () {
})])
})
]);
- var headers = Em.A([
- Em.Object.create({name: "c1", label: 't1'}),
- Em.Object.create({name: "c2", label: 't2'})]);
- controller.set('errorMessage', 'error');
+
controller.set('hosts', hosts);
- controller.set('headers', headers);
controller.set('isAddHostWizard', true);
controller.clearError();
expect(controller.get('errorMessage')).to.equal('error');
@@ -921,14 +940,23 @@ describe('App.WizardStep6Controller', function () {
}
}
]).forEach(function (test) {
- it(test.m, function () {
- controller.clearStep();
- controller.set('headers', test.headers);
- controller.set('hosts', test.hosts);
- controller.checkCallback(test.component);
- var header = controller.get('headers').findProperty('name', test.component);
- expect(header.get('allChecked')).to.equal(test.e.allChecked);
- expect(header.get('noChecked')).to.equal(test.e.noChecked);
+ describe(test.m, function () {
+
+ beforeEach(function () {
+ controller.clearStep();
+ controller.set('headers', test.headers);
+ controller.set('hosts', test.hosts);
+ controller.checkCallback(test.component);
+ this.header = controller.get('headers').findProperty('name', test.component);
+ });
+
+ it('allChecked is ' + test.e.allChecked, function () {
+ expect(this.header.get('allChecked')).to.equal(test.e.allChecked);
+ });
+
+ it('noChecked is ' + test.e.noChecked, function () {
+ expect(this.header.get('noChecked')).to.equal(test.e.noChecked);
+ });
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/wizard/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js
index ac7b3c3..c6796aa 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -287,7 +287,8 @@ describe('App.InstallerStep7Controller', function () {
});
describe('#checkDatabaseConnectionTest', function () {
- it('should return promise in process', function () {
+
+ beforeEach(function () {
installerStep7Controller.set('content', {
services: Em.A([
Em.Object.create({isSelected: true, isInstalled: false, serviceName: 'OOZIE', ignored: []}),
@@ -302,10 +303,13 @@ describe('App.InstallerStep7Controller', function () {
});
var obj = Em.Object.create({name:'oozie_database',value:"aa"});
installerStep7Controller.set('stepConfigs',Em.A([Em.Object.create({serviceName: 'OOZIE', configs: Em.A([obj]) })]));
- var deffer = installerStep7Controller.checkDatabaseConnectionTest();
- expect(deffer.isResolved()).to.equal(false);
- deffer.resolve(true);
- deffer.done(function(data) {
+ this.deffer = installerStep7Controller.checkDatabaseConnectionTest();
+ });
+
+ it('should return promise in process', function () {
+ expect(this.deffer.isResolved()).to.equal(false);
+ this.deffer.resolve(true);
+ this.deffer.done(function(data) {
expect(data).to.equal(true);
});
});
@@ -684,48 +688,67 @@ describe('App.InstallerStep7Controller', function () {
expect(updatedConfig.get('overrides')).to.be.null;
});
- it('no overrideToAdd', function () {
- var isDefault = true,
- name = 'n1',
- config = Em.Object.create({overrides: null, name: name, flag: 'flag'}),
- overrides = Em.A([
- Em.Object.create({name: name, value: 'v1'}),
- Em.Object.create({name: name, value: 'v2'}),
- Em.Object.create({name: 'n2', value: 'v3'})
- ]);
- installerStep7Controller.reopen({
- overrideToAdd: null,
- selectedConfigGroup: Em.Object.create({
- isDefault: isDefault
- })
+ describe('no overrideToAdd', function () {
+ var isDefault;
+ beforeEach(function () {
+ isDefault = true;
+ var name = 'n1',
+ config = Em.Object.create({overrides: null, name: name, flag: 'flag'}),
+ overrides = Em.A([
+ Em.Object.create({name: name, value: 'v1'}),
+ Em.Object.create({name: name, value: 'v2'}),
+ Em.Object.create({name: 'n2', value: 'v3'})
+ ]);
+ installerStep7Controller.reopen({
+ overrideToAdd: null,
+ selectedConfigGroup: Em.Object.create({
+ isDefault: isDefault
+ })
+ });
+ this.updatedConfig = installerStep7Controller._setOverrides(config, overrides);
+ });
+
+ it('2 overrides', function () {
+ expect(this.updatedConfig.get('overrides.length')).to.equal(2);
+ });
+ it('each isEditable is ' + !isDefault, function () {
+ expect(this.updatedConfig.get('overrides').everyProperty('isEditable', !isDefault)).to.equal(true);
+ });
+ it('each parentSCP.flag is `flag`', function () {
+ expect(this.updatedConfig.get('overrides').everyProperty('parentSCP.flag', 'flag')).to.equal(true);
});
- var updatedConfig = installerStep7Controller._setOverrides(config, overrides);
- expect(updatedConfig.get('overrides.length')).to.equal(2);
- expect(updatedConfig.get('overrides').everyProperty('isEditable', !isDefault)).to.equal(true);
- expect(updatedConfig.get('overrides').everyProperty('parentSCP.flag', 'flag')).to.equal(true);
});
- it('overrideToAdd exists', function () {
- var isDefault = true,
- name = 'n1',
- config = Em.Object.create({overrides: null, name: name, flag: 'flag'}),
- overrides = Em.A([
- Em.Object.create({name: name, value: 'v1'}),
- Em.Object.create({name: name, value: 'v2'}),
- Em.Object.create({name: 'n2', value: 'v3'})
- ]);
- installerStep7Controller.reopen({
- overrideToAdd: Em.Object.create({name: name}),
- selectedService: {configGroups: [Em.Object.create({name: 'n', properties: []})]},
- selectedConfigGroup: Em.Object.create({
- isDefault: isDefault,
- name: 'n'
- })
+ describe('overrideToAdd exists', function () {
+ var isDefault = true;
+ beforeEach(function () {
+ var name = 'n1',
+ config = Em.Object.create({overrides: null, name: name, flag: 'flag'}),
+ overrides = Em.A([
+ Em.Object.create({name: name, value: 'v1'}),
+ Em.Object.create({name: name, value: 'v2'}),
+ Em.Object.create({name: 'n2', value: 'v3'})
+ ]);
+ installerStep7Controller.reopen({
+ overrideToAdd: Em.Object.create({name: name}),
+ selectedService: {configGroups: [Em.Object.create({name: 'n', properties: []})]},
+ selectedConfigGroup: Em.Object.create({
+ isDefault: isDefault,
+ name: 'n'
+ })
+ });
+ this.updatedConfig = installerStep7Controller._setOverrides(config, overrides);
+ });
+
+ it('3 overrides', function () {
+ expect(this.updatedConfig.get('overrides.length')).to.equal(3);
+ });
+ it('each isEditable is ' + !isDefault, function () {
+ expect(this.updatedConfig.get('overrides').everyProperty('isEditable', !isDefault)).to.equal(true);
+ });
+ it('each parentSCP.flag is `flag`', function () {
+ expect(this.updatedConfig.get('overrides').everyProperty('parentSCP.flag', 'flag')).to.equal(true);
});
- var updatedConfig = installerStep7Controller._setOverrides(config, overrides);
- expect(updatedConfig.get('overrides.length')).to.equal(3);
- expect(updatedConfig.get('overrides').everyProperty('isEditable', !isDefault)).to.equal(true);
- expect(updatedConfig.get('overrides').everyProperty('parentSCP.flag', 'flag')).to.equal(true);
});
});
@@ -1721,25 +1744,27 @@ describe('App.InstallerStep7Controller', function () {
expectedNewValue: dfsNameservices + '/hawq_data'
}
]).forEach(function (test) {
- it(test.serviceName + ' ' + test.configToUpdate, function () {
- var serviceConfigs = [App.ServiceConfig.create({
- serviceName: test.serviceName,
+
+ var serviceConfigs = [App.ServiceConfig.create({
+ serviceName: test.serviceName,
+ configs: [
+ Em.Object.create({
+ name: test.configToUpdate,
+ value: test.oldValue
+ })
+ ]
+ }),
+ App.ServiceConfig.create({
+ serviceName: 'HDFS',
configs: [
Em.Object.create({
- name: test.configToUpdate,
- value: test.oldValue
+ name: 'dfs.nameservices',
+ value: dfsNameservices
})
]
- }),
- App.ServiceConfig.create({
- serviceName: 'HDFS',
- configs: [
- Em.Object.create({
- name: 'dfs.nameservices',
- value: dfsNameservices
- })
- ]
- })];
+ })];
+
+ it(test.serviceName + ' ' + test.configToUpdate, function () {
installerStep7Controller.reopen({
selectedServiceNames: [test.serviceName, 'HDFS']
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/wizard/step8_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step8_test.js b/ambari-web/test/controllers/wizard/step8_test.js
index 576e303..cbf259f 100644
--- a/ambari-web/test/controllers/wizard/step8_test.js
+++ b/ambari-web/test/controllers/wizard/step8_test.js
@@ -240,7 +240,8 @@ describe('App.WizardStep8Controller', function () {
});
describe('#createCoreSiteObj', function () {
- it('should return config', function () {
+
+ beforeEach(function () {
var content = Em.Object.create({
services: Em.A([
Em.Object.create({
@@ -306,6 +307,9 @@ describe('App.WizardStep8Controller', function () {
])
})
]));
+ });
+
+ it('should return config', function () {
var expected = {
"type": "core-site",
"tag": "version1",
@@ -321,6 +325,7 @@ describe('App.WizardStep8Controller', function () {
});
describe('#createConfigurationGroups', function () {
+ var content;
beforeEach(function() {
sinon.stub(App.router,'get').returns(Em.Object.create({
getDBProperty: function() {
@@ -335,12 +340,7 @@ describe('App.WizardStep8Controller', function () {
},
createSiteObj: App.MainServiceInfoConfigsController.create({}).createSiteObj.bind(App.MainServiceInfoConfigsController.create({}))
}));
- });
- afterEach(function() {
- App.router.get.restore();
- });
- it('should push group in properties', function () {
- var content = Em.Object.create({
+ content = Em.Object.create({
configGroups: Em.A([
Em.Object.create({
is_default: true,
@@ -398,6 +398,12 @@ describe('App.WizardStep8Controller', function () {
installerStep8Controller.set('ajaxRequestsQueue', App.ajaxQueue.create());
installerStep8Controller.get('ajaxRequestsQueue').clear();
installerStep8Controller.createConfigurationGroups();
+ });
+ afterEach(function() {
+ App.router.get.restore();
+ });
+
+ it('should push group in properties', function () {
var expected = [
{
"value": "p3",
@@ -434,7 +440,8 @@ describe('App.WizardStep8Controller', function () {
});
describe('#loadServices', function () {
- it('should load services', function () {
+
+ beforeEach(function () {
var services = Em.A([
Em.Object.create({
serviceName: 's1',
@@ -503,6 +510,9 @@ describe('App.WizardStep8Controller', function () {
installerStep8Controller.set('services', Em.A([]));
installerStep8Controller.reopen({selectedServices: selectedServices});
installerStep8Controller.loadServices();
+ });
+
+ it('should load services', function () {
var expected = [
{
"service_name": "s1",
@@ -537,7 +547,8 @@ describe('App.WizardStep8Controller', function () {
});
describe('#removeClientsFromList', function () {
- it('should remove h1', function () {
+
+ beforeEach(function () {
installerStep8Controller.set('content', Em.Object.create({
hosts: Em.Object.create({
h1: Em.Object.create({
@@ -552,6 +563,9 @@ describe('App.WizardStep8Controller', function () {
})
})
}));
+ });
+
+ it('should remove h1', function () {
var hostList = Em.A(['h1','h2']);
installerStep8Controller.removeClientsFromList('h1', hostList);
expect(JSON.parse(JSON.stringify(hostList))).to.eql(["h2"]);
@@ -559,7 +573,8 @@ describe('App.WizardStep8Controller', function () {
});
describe('#createSlaveAndClientsHostComponents', function () {
- it('should return non install object', function () {
+
+ beforeEach(function () {
installerStep8Controller.set('content', Em.Object.create({
masterComponentHosts: Em.A([
Em.Object.create({
@@ -615,13 +630,17 @@ describe('App.WizardStep8Controller', function () {
}));
installerStep8Controller.set('ajaxRequestsQueue', App.ajaxQueue.create());
installerStep8Controller.get('ajaxRequestsQueue').clear();
+ });
+
+ it('should return non install object', function () {
installerStep8Controller.createSlaveAndClientsHostComponents();
expect(installerStep8Controller.get('content.clients')[0].isInstalled).to.be.false;
});
});
describe('#createAdditionalClientComponents', function () {
- it('should bes equal to content.cluster.name', function () {
+
+ beforeEach(function () {
installerStep8Controller.set('content', Em.Object.create({
masterComponentHosts: Em.A([
Em.Object.create({
@@ -669,6 +688,10 @@ describe('App.WizardStep8Controller', function () {
installerStep8Controller.set('ajaxRequestsQueue', App.ajaxQueue.create());
installerStep8Controller.get('ajaxRequestsQueue').clear();
installerStep8Controller.createAdditionalClientComponents();
+ });
+
+ it('should bes equal to content.cluster.name', function () {
+
var result = [
{
"hostNames": "name",
@@ -1526,60 +1549,82 @@ describe('App.WizardStep8Controller', function () {
installerStep8Controller.registerHostsToComponent.restore();
});
- it('should add components with isRequiredOnAllHosts == true (1)', function() {
- installerStep8Controller.reopen({
- getRegisteredHosts: function() {
- return [{hostName: 'h1'}, {hostName: 'h2'}];
- },
- content: {
- services: [
- Em.Object.create({
- serviceName: 'GANGLIA', isSelected: true, isInstalled: false, serviceComponents: [
- Em.Object.create({
- componentName: 'GANGLIA_MONITOR',
- isRequiredOnAllHosts: true
- }),
- Em.Object.create({
- componentName: 'GANGLIA_SERVER',
- isRequiredOnAllHosts: false
- })
- ]
- })
- ]
- }
+ describe('should add components with isRequiredOnAllHosts == true (1)', function() {
+
+ beforeEach(function () {
+ installerStep8Controller.reopen({
+ getRegisteredHosts: function() {
+ return [{hostName: 'h1'}, {hostName: 'h2'}];
+ },
+ content: {
+ services: [
+ Em.Object.create({
+ serviceName: 'GANGLIA', isSelected: true, isInstalled: false, serviceComponents: [
+ Em.Object.create({
+ componentName: 'GANGLIA_MONITOR',
+ isRequiredOnAllHosts: true
+ }),
+ Em.Object.create({
+ componentName: 'GANGLIA_SERVER',
+ isRequiredOnAllHosts: false
+ })
+ ]
+ })
+ ]
+ }
+ });
+ installerStep8Controller.createAdditionalHostComponents();
+ });
+
+ it('registerHostsToComponent is called once', function () {
+ expect(installerStep8Controller.registerHostsToComponent.calledOnce).to.equal(true);
+ });
+ it('hosts are ["h1", "h2"]', function () {
+ expect(installerStep8Controller.registerHostsToComponent.args[0][0]).to.eql(['h1', 'h2']);
+ });
+ it('component is GANGLIA_MONITOR', function () {
+ expect(installerStep8Controller.registerHostsToComponent.args[0][1]).to.equal('GANGLIA_MONITOR');
});
- installerStep8Controller.createAdditionalHostComponents();
- expect(installerStep8Controller.registerHostsToComponent.calledOnce).to.equal(true);
- expect(installerStep8Controller.registerHostsToComponent.args[0][0]).to.eql(['h1', 'h2']);
- expect(installerStep8Controller.registerHostsToComponent.args[0][1]).to.equal('GANGLIA_MONITOR');
+
});
- it('should add components with isRequiredOnAllHosts == true (2)', function() {
- installerStep8Controller.reopen({
- getRegisteredHosts: function() {
- return [{hostName: 'h1', isInstalled: true}, {hostName: 'h2', isInstalled: false}];
- },
- content: {
- services: [
- Em.Object.create({
- serviceName: 'GANGLIA', isSelected: true, isInstalled: true, serviceComponents: [
- Em.Object.create({
- componentName: 'GANGLIA_MONITOR',
- isRequiredOnAllHosts: true
- }),
- Em.Object.create({
- componentName: 'GANGLIA_SERVER',
- isRequiredOnAllHosts: false
- })
- ]
- })
- ]
- }
+ describe('should add components with isRequiredOnAllHosts == true (2)', function() {
+
+ beforeEach(function () {
+ installerStep8Controller.reopen({
+ getRegisteredHosts: function() {
+ return [{hostName: 'h1', isInstalled: true}, {hostName: 'h2', isInstalled: false}];
+ },
+ content: {
+ services: [
+ Em.Object.create({
+ serviceName: 'GANGLIA', isSelected: true, isInstalled: true, serviceComponents: [
+ Em.Object.create({
+ componentName: 'GANGLIA_MONITOR',
+ isRequiredOnAllHosts: true
+ }),
+ Em.Object.create({
+ componentName: 'GANGLIA_SERVER',
+ isRequiredOnAllHosts: false
+ })
+ ]
+ })
+ ]
+ }
+ });
+ installerStep8Controller.createAdditionalHostComponents();
+ });
+
+ it('registerHostsToComponent is called once', function () {
+ expect(installerStep8Controller.registerHostsToComponent.calledOnce).to.equal(true);
+ });
+ it('hosts are ["h2"]', function () {
+ expect(installerStep8Controller.registerHostsToComponent.args[0][0]).to.eql(['h2']);
+ });
+ it('component is GANGLIA_MONITOR', function () {
+ expect(installerStep8Controller.registerHostsToComponent.args[0][1]).to.equal('GANGLIA_MONITOR');
});
- installerStep8Controller.createAdditionalHostComponents();
- expect(installerStep8Controller.registerHostsToComponent.calledOnce).to.equal(true);
- expect(installerStep8Controller.registerHostsToComponent.args[0][0]).to.eql(['h2']);
- expect(installerStep8Controller.registerHostsToComponent.args[0][1]).to.equal('GANGLIA_MONITOR');
+
});
var newDatabases = [
@@ -1592,28 +1637,38 @@ describe('App.WizardStep8Controller', function () {
];
newDatabases.forEach(function (db) {
- it('should add {0}'.format(db.component), function() {
- installerStep8Controller.reopen({
- getRegisteredHosts: function() {
- return [{hostName: 'h1'}, {hostName: 'h2'}];
- },
- content: {
- masterComponentHosts: [
- {component: 'HIVE_SERVER', hostName: 'h1'},
- {component: 'HIVE_SERVER', hostName: 'h2'}
- ],
- services: [
- Em.Object.create({serviceName: 'HIVE', isSelected: true, isInstalled: false, serviceComponents: []})
- ],
- serviceConfigProperties: [
- {name: 'hive_database', value: db.name}
- ]
- }
+ describe('should add {0}'.format(db.component), function() {
+
+ beforeEach(function () {
+ installerStep8Controller.reopen({
+ getRegisteredHosts: function() {
+ return [{hostName: 'h1'}, {hostName: 'h2'}];
+ },
+ content: {
+ masterComponentHosts: [
+ {component: 'HIVE_SERVER', hostName: 'h1'},
+ {component: 'HIVE_SERVER', hostName: 'h2'}
+ ],
+ services: [
+ Em.Object.create({serviceName: 'HIVE', isSelected: true, isInstalled: false, serviceComponents: []})
+ ],
+ serviceConfigProperties: [
+ {name: 'hive_database', value: db.name}
+ ]
+ }
+ });
+ installerStep8Controller.createAdditionalHostComponents();
+ });
+
+ it('registerHostsToComponent is called once', function () {
+ expect(installerStep8Controller.registerHostsToComponent.calledOnce).to.equal(true);
+ });
+ it('hosts are ["h1", "h2"]', function () {
+ expect(installerStep8Controller.registerHostsToComponent.args[0][0]).to.eql(['h1', 'h2']);
+ });
+ it('component is ' + db.component, function () {
+ expect(installerStep8Controller.registerHostsToComponent.args[0][1]).to.equal(db.component);
});
- installerStep8Controller.createAdditionalHostComponents();
- expect(installerStep8Controller.registerHostsToComponent.calledOnce).to.equal(true);
- expect(installerStep8Controller.registerHostsToComponent.args[0][0]).to.eql(['h1', 'h2']);
- expect(installerStep8Controller.registerHostsToComponent.args[0][1]).to.equal(db.component);
});
});
@@ -1687,7 +1742,7 @@ describe('App.WizardStep8Controller', function () {
hosts: Em.A([
Em.Object.create({hostName: 'h1', isInstalled: false}),
Em.Object.create({hostName: 'h2', isInstalled: false})
- ]),
+ ])
}),
Em.Object.create({
componentName: 'CLIENT',
@@ -1733,93 +1788,99 @@ describe('App.WizardStep8Controller', function () {
});
});
- it('should not add components with isRequiredOnAllHosts == false (2)', function() {
- installerStep8Controller.reopen({
- getRegisteredHosts: function() {
- return [{hostName: 'h1'}, {hostName: 'h2'}];
- },
- content: {
- services: Em.A([
- Em.Object.create({
- serviceName: 'ANYSERVICE', isSelected: true, isInstalled: false, serviceComponents: [
- // set isRequiredOnAllHosts = false for all components
- Em.Object.create({
- componentName: 'ANYSERVICE_MASTER',
- isMaster: true,
- isRequiredOnAllHosts: false
- }),
- Em.Object.create({
- componentName: 'ANYSERVICE_SLAVE',
- isSlave: true,
- isRequiredOnAllHosts: false
- }),
- Em.Object.create({
- componentName: 'ANYSERVICE_SLAVE2',
- isSlave: true,
- isRequiredOnAllHosts: false
- }),
- Em.Object.create({
- componentName: 'ANYSERVICE_CLIENT',
- isClient: true,
- isRequiredOnAllHosts: false
- })
- ]
- })
- ]),
- masterComponentHosts: Em.A([
- Em.Object.create({
- componentName: 'ANYSERVICE_MASTER',
- component: 'ANYSERVICE_MASTER',
- hosts: Em.A([
- Em.Object.create({hostName: 'h1', isInstalled: true})
- ])
- })
- ]),
- slaveComponentHosts: Em.A([
- Em.Object.create({
- componentName: 'ANYSERVICE_SLAVE',
- hosts: Em.A([
- Em.Object.create({hostName: 'h1', isInstalled: false}),
- Em.Object.create({hostName: 'h2', isInstalled: false})
- ])
- }),
- Em.Object.create({
- componentName: 'ANYSERVICE_SLAVE2',
- hosts: Em.A([
- Em.Object.create({hostName: 'h1', isInstalled: false}),
- Em.Object.create({hostName: 'h2', isInstalled: false})
- ]),
- }),
- Em.Object.create({
- componentName: 'CLIENT',
- hosts: Em.A([
- Em.Object.create({hostName: 'h1', isInstalled: false}),
- Em.Object.create({hostName: 'h2', isInstalled: false})
- ])
- })
- ]),
- clients: Em.A([
- Em.Object.create({
- component_name: 'ANYSERVICE_CLIENT',
- isInstalled: false,
- hosts: Em.A([
- Em.Object.create({hostName: 'h1', isInstalled: false}),
- Em.Object.create({hostName: 'h2', isInstalled: false})
- ])
- })
- ])
- }
+ describe('should not add components with isRequiredOnAllHosts == false (2)', function() {
+
+ beforeEach(function () {
+ installerStep8Controller.reopen({
+ getRegisteredHosts: function() {
+ return [{hostName: 'h1'}, {hostName: 'h2'}];
+ },
+ content: {
+ services: Em.A([
+ Em.Object.create({
+ serviceName: 'ANYSERVICE', isSelected: true, isInstalled: false, serviceComponents: [
+ // set isRequiredOnAllHosts = false for all components
+ Em.Object.create({
+ componentName: 'ANYSERVICE_MASTER',
+ isMaster: true,
+ isRequiredOnAllHosts: false
+ }),
+ Em.Object.create({
+ componentName: 'ANYSERVICE_SLAVE',
+ isSlave: true,
+ isRequiredOnAllHosts: false
+ }),
+ Em.Object.create({
+ componentName: 'ANYSERVICE_SLAVE2',
+ isSlave: true,
+ isRequiredOnAllHosts: false
+ }),
+ Em.Object.create({
+ componentName: 'ANYSERVICE_CLIENT',
+ isClient: true,
+ isRequiredOnAllHosts: false
+ })
+ ]
+ })
+ ]),
+ masterComponentHosts: Em.A([
+ Em.Object.create({
+ componentName: 'ANYSERVICE_MASTER',
+ component: 'ANYSERVICE_MASTER',
+ hosts: Em.A([
+ Em.Object.create({hostName: 'h1', isInstalled: true})
+ ])
+ })
+ ]),
+ slaveComponentHosts: Em.A([
+ Em.Object.create({
+ componentName: 'ANYSERVICE_SLAVE',
+ hosts: Em.A([
+ Em.Object.create({hostName: 'h1', isInstalled: false}),
+ Em.Object.create({hostName: 'h2', isInstalled: false})
+ ])
+ }),
+ Em.Object.create({
+ componentName: 'ANYSERVICE_SLAVE2',
+ hosts: Em.A([
+ Em.Object.create({hostName: 'h1', isInstalled: false}),
+ Em.Object.create({hostName: 'h2', isInstalled: false})
+ ]),
+ }),
+ Em.Object.create({
+ componentName: 'CLIENT',
+ hosts: Em.A([
+ Em.Object.create({hostName: 'h1', isInstalled: false}),
+ Em.Object.create({hostName: 'h2', isInstalled: false})
+ ])
+ })
+ ]),
+ clients: Em.A([
+ Em.Object.create({
+ component_name: 'ANYSERVICE_CLIENT',
+ isInstalled: false,
+ hosts: Em.A([
+ Em.Object.create({hostName: 'h1', isInstalled: false}),
+ Em.Object.create({hostName: 'h2', isInstalled: false})
+ ])
+ })
+ ])
+ }
+ });
+ installerStep8Controller.set('ajaxRequestsQueue', App.ajaxQueue.create());
+ installerStep8Controller.get('ajaxRequestsQueue').clear();
+ installerStep8Controller.createAdditionalHostComponents();
+ });
+
+ it('registerHostsToComponent is not called', function () {
+ // isRequiredOnAllHosts = false for all components, implies that
+ // registerHostsToComponent would be done via
+ // createMasterHostComponents() or createSlaveAndClientsHostComponents()
+ // or createAdditionalClientComponents()
+ // BUT NOT createAdditionalHostComponents()
+ expect(installerStep8Controller.registerHostsToComponent.callCount).to.equal(0);
});
- installerStep8Controller.set('ajaxRequestsQueue', App.ajaxQueue.create());
- installerStep8Controller.get('ajaxRequestsQueue').clear();
- installerStep8Controller.createAdditionalHostComponents();
- // isRequiredOnAllHosts = false for all components, implies that
- // registerHostsToComponent would be done via
- // createMasterHostComponents() or createSlaveAndClientsHostComponents()
- // or createAdditionalClientComponents()
- // BUT NOT createAdditionalHostComponents()
- expect(installerStep8Controller.registerHostsToComponent.callCount).to.equal(0);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/wizard/step9_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step9_test.js b/ambari-web/test/controllers/wizard/step9_test.js
index d60b24a..9bfe00d 100644
--- a/ambari-web/test/controllers/wizard/step9_test.js
+++ b/ambari-web/test/controllers/wizard/step9_test.js
@@ -458,61 +458,74 @@ describe('App.InstallerStep9Controller', function () {
});
describe('#setIsServicesInstalled', function () {
- it('Should return 100% completed', function () {
- var polledData = Em.A([
- Em.Object.create({
- Tasks: Em.Object.create({
- status: 'NONE'
- })
- }),
- Em.Object.create({
- Tasks: Em.Object.create({
- status: 'NONE'
- })
- })
- ]);
- c.setProperties({
- status: 'failed',
- isPolling: true,
- hosts: Em.A([
+
+ Em.A([
+ {
+ m: 'Should return 100% completed',
+ c: {
+ status: 'failed',
+ isPolling: true,
+ hosts: Em.A([
+ Em.Object.create({
+ progress: 0
+ })
+ ])
+ },
+ polledData: Em.A([
Em.Object.create({
- progress: 0
- })
- ])
- });
- c.setIsServicesInstalled(polledData);
- expect(c.get('progress')).to.equal('100');
- expect(c.get('isPolling')).to.be.false;
- });
- it('Should return 34% completed', function () {
- var polledData = Em.A([
- Em.Object.create({
- Tasks: Em.Object.create({
- status: 'NONE'
+ Tasks: Em.Object.create({
+ status: 'NONE'
+ })
+ }),
+ Em.Object.create({
+ Tasks: Em.Object.create({
+ status: 'NONE'
+ })
})
- }),
- Em.Object.create({
- Tasks: Em.Object.create({
- status: 'NONE'
+ ]),
+ e: {
+ progress: '100',
+ isPolling: false
+ }
+ },
+ {
+ m: 'Should return 34% completed',
+ c: {
+ status: '',
+ isPolling: true,
+ hosts: Em.A([
+ Em.Object.create({
+ progress: 0
+ })
+ ]),
+ content: Em.Object.create({
+ controllerName: 'installerController'
})
- })
- ]);
- c.setProperties({
- status: '',
- isPolling: true,
- hosts: Em.A([
+ },
+ polledData: Em.A([
+ Em.Object.create({
+ Tasks: Em.Object.create({
+ status: 'NONE'
+ })
+ }),
Em.Object.create({
- progress: 0
+ Tasks: Em.Object.create({
+ status: 'NONE'
+ })
})
]),
- content: Em.Object.create({
- controllerName: 'installerController'
- })
+ e: {
+ progress: '34',
+ isPolling: true
+ }
+ }
+ ]).forEach(function (test) {
+ it(test.m, function () {
+ c.setProperties(test.c);
+ c.setIsServicesInstalled(test.polledData);
});
- c.setIsServicesInstalled(polledData);
- expect(c.get('progress')).to.equal('34');
- expect(c.get('isPolling')).to.be.true;
});
+
});
describe('#launchStartServices', function () {
@@ -1005,20 +1018,29 @@ describe('App.InstallerStep9Controller', function () {
}
]);
tests.forEach(function (test) {
- it(test.m, function () {
- var actions = [];
- for (var prop in test.actions) {
- if (test.actions.hasOwnProperty(prop) && test.actions[prop]) {
- for (var i = 0; i < test.actions[prop]; i++) {
- actions.push({Tasks: {status: prop}});
+ describe(test.m, function () {
+
+ beforeEach(function () {
+ var actions = [];
+ for (var prop in test.actions) {
+ if (test.actions.hasOwnProperty(prop) && test.actions[prop]) {
+ for (var i = 0; i < test.actions[prop]; i++) {
+ actions.push({Tasks: {status: prop}});
+ }
}
}
- }
- c.reopen({content: {cluster: {status: test.cluster.status}}});
- App.set('supports.skipComponentStartAfterInstall', test.s);
- var progress = c.progressPerHost(actions, test.host);
- expect(progress).to.equal(test.e.progress);
- expect(test.host.progress).to.equal(test.e.progress.toString());
+ c.reopen({content: {cluster: {status: test.cluster.status}}});
+ App.set('supports.skipComponentStartAfterInstall', test.s);
+ this.progress = c.progressPerHost(actions, test.host);
+ });
+
+ it('progress is ' + test.e.progress, function () {
+ expect(this.progress).to.equal(test.e.progress);
+ });
+
+ it('host progress is ' + test.e.progress.toString(), function () {
+ expect(test.host.progress).to.equal(test.e.progress.toString());
+ });
});
});
});
@@ -1243,8 +1265,9 @@ describe('App.InstallerStep9Controller', function () {
it(test.m, function () {
c.reopen({hosts: [Em.Object.create({logTasks: test.tasks})]});
c.setLogTasksStatePerHost(test.tasksPerHost, c.get('hosts')[0]);
- expect(c.get('hosts')[0].get('logTasks').everyProperty('Tasks.status', test.e.m)).to.equal(true);
- expect(c.get('hosts')[0].get('logTasks.length')).to.equal(test.e.l);
+ var host = c.get('hosts')[0];
+ expect(host.get('logTasks').everyProperty('Tasks.status', test.e.m)).to.equal(true);
+ expect(host.get('logTasks.length')).to.equal(test.e.l);
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/controllers/wizard_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard_test.js b/ambari-web/test/controllers/wizard_test.js
index dced13c..08d9d89 100644
--- a/ambari-web/test/controllers/wizard_test.js
+++ b/ambari-web/test/controllers/wizard_test.js
@@ -1208,8 +1208,7 @@ describe('App.WizardController', function () {
describe('#enableStep', function () {
- it('should update appropriate value in isStepDisabled', function () {
-
+ beforeEach(function () {
c.set('isStepDisabled', [
Em.Object.create({step: 1, value: true}),
Em.Object.create({step: 2, value: true}),
@@ -1219,10 +1218,14 @@ describe('App.WizardController', function () {
Em.Object.create({step: 6, value: true}),
Em.Object.create({step: 7, value: true})
]);
+ });
+ it('should update 1st value in isStepDisabled', function () {
c.enableStep(1);
expect(c.get('isStepDisabled')[0].get('value')).to.be.false;
+ });
+ it('should update 6th value in isStepDisabled', function () {
c.enableStep(7);
expect(c.get('isStepDisabled')[6].get('value')).to.be.false;
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/helpers.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/helpers.js b/ambari-web/test/helpers.js
index eaa5363..4c2a671 100644
--- a/ambari-web/test/helpers.js
+++ b/ambari-web/test/helpers.js
@@ -15,6 +15,8 @@
* the License.
*/
+/*eslint-disable mocha-cleanup/no-assertions-outside-it */
+
module.exports = {
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/mappers/stack_service_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/stack_service_mapper_test.js b/ambari-web/test/mappers/stack_service_mapper_test.js
index 0d13925..4bc36fe 100644
--- a/ambari-web/test/mappers/stack_service_mapper_test.js
+++ b/ambari-web/test/mappers/stack_service_mapper_test.js
@@ -15,6 +15,8 @@
* the License.
*/
+/*eslint-disable */
+
var App = require('app');
require('mappers/stack_service_mapper');
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/mixins/common/serverValidator_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/serverValidator_test.js b/ambari-web/test/mixins/common/serverValidator_test.js
index a17698f..e663e7c 100644
--- a/ambari-web/test/mixins/common/serverValidator_test.js
+++ b/ambari-web/test/mixins/common/serverValidator_test.js
@@ -158,19 +158,28 @@ describe('App.ServerValidatorMixin', function() {
e: false
}
].forEach(function(test) {
- it('controller "name": {0} using "EnhancedConfigsMixin": {1} recommendations called: {2}'.format(test.controllerName, test.injectEnhancedConfigsMixin, test.e), function() {
+ describe('controller "name": {0} using "EnhancedConfigsMixin": {1} recommendations called: {2}'.format(test.controllerName, test.injectEnhancedConfigsMixin, test.e), function() {
var mixed;
- if (test.injectEnhancedConfigsMixin) {
- mixed = Em.Object.extend(App.EnhancedConfigsMixin, App.ServerValidatorMixin);
- } else {
- mixed = Em.Object.extend(App.ServerValidatorMixin);
- }
- // mock controller name in mixed object directly
- mixed.create({name: test.controllerName}).loadServerSideConfigsRecommendations();
- expect(App.ajax.send.calledOnce).to.be.eql(test.e);
+ beforeEach(function () {
+ if (test.injectEnhancedConfigsMixin) {
+ mixed = Em.Object.extend(App.EnhancedConfigsMixin, App.ServerValidatorMixin);
+ } else {
+ mixed = Em.Object.extend(App.ServerValidatorMixin);
+ }
+ // mock controller name in mixed object directly
+ mixed.create({name: test.controllerName}).loadServerSideConfigsRecommendations();
+ });
+
+ it('request is ' + (test.e ? '' : 'not') + ' sent', function () {
+ expect(App.ajax.send.calledOnce).to.be.eql(test.e);
+ });
+
if (test.e) {
- expect(App.ajax.send.args[0][0].name).to.be.eql('config.recommendations');
+ it('request is valid', function () {
+ expect(App.ajax.send.args[0][0].name).to.be.eql('config.recommendations');
+ });
}
+
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/models/form_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/form_test.js b/ambari-web/test/models/form_test.js
index 3ba7c10..18c86c6 100644
--- a/ambari-web/test/models/form_test.js
+++ b/ambari-web/test/models/form_test.js
@@ -19,7 +19,7 @@
var App = require('app');
require('models/form');
-
+/*eslint-disable mocha-cleanup/no-assertions-outside-it */
var form,
field,
formField,
@@ -75,6 +75,7 @@ var form,
formField.validate();
expect(formField.get('errorMessage')).to.equal(message);
};
+/*eslint-enable mocha-cleanup/no-assertions-outside-it */
describe('App.Form', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/utils/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/config_test.js b/ambari-web/test/utils/config_test.js
index 84231d7..c88c745 100644
--- a/ambari-web/test/utils/config_test.js
+++ b/ambari-web/test/utils/config_test.js
@@ -724,25 +724,36 @@ describe('App.config', function () {
expect(App.config.createOverride.bind(App.config, null, {}, group)).to.throw(Error, 'serviceConfigProperty can\' be null');
});
- it('updates originalSCP object ', function() {
- configProperty.set('overrides', null);
- configProperty.set('overrideValues', []);
- configProperty.set('overrideIsFinalValues', []);
-
- var overridenTemplate2 = {
- value: "v12",
- recommendedValue: "rv12",
- savedValue: "sv12",
- isFinal: true,
- recommendedIsFinal: false,
- savedIsFinal: false
- };
+ describe('updates originalSCP object ', function() {
+
+ var overridenTemplate2;
+ var override;
+
+ beforeEach(function () {
+ configProperty.set('overrides', null);
+ configProperty.set('overrideValues', []);
+ configProperty.set('overrideIsFinalValues', []);
+ overridenTemplate2 = {
+ value: "v12",
+ recommendedValue: "rv12",
+ savedValue: "sv12",
+ isFinal: true,
+ recommendedIsFinal: false,
+ savedIsFinal: false
+ };
+ override = App.config.createOverride(configProperty, overridenTemplate2, group);
+ });
- var override = App.config.createOverride(configProperty, overridenTemplate2, group);
+ it('overrides.0 is valid', function () {
+ expect(configProperty.get('overrides')[0]).to.be.eql(override);
+ });
+ it('overrideValues is valid', function () {
+ expect(configProperty.get('overrideValues')).to.be.eql([overridenTemplate2.value]);
+ });
+ it('overrideIsFinalValues is valid', function () {
+ expect(configProperty.get('overrideIsFinalValues')).to.be.eql([overridenTemplate2.isFinal]);
+ });
- expect(configProperty.get('overrides')[0]).to.be.eql(override);
- expect(configProperty.get('overrideValues')).to.be.eql([overridenTemplate2.value]);
- expect(configProperty.get('overrideIsFinalValues')).to.be.eql([overridenTemplate2.isFinal]);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/utils/configs/config_initializer_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/configs/config_initializer_test.js b/ambari-web/test/utils/configs/config_initializer_test.js
index b98581a..f8eb825 100644
--- a/ambari-web/test/utils/configs/config_initializer_test.js
+++ b/ambari-web/test/utils/configs/config_initializer_test.js
@@ -359,19 +359,29 @@ describe('App.ConfigInitializer', function () {
cases['hive_database'].forEach(function (item) {
var title = 'hive_database value should be set to {0}';
- it(title.format(item.value), function () {
- this.stub
- .withArgs('supports.alwaysEnableManagedMySQLForHive').returns(item.alwaysEnableManagedMySQLForHive)
- .withArgs('router.currentState.name').returns(item.currentStateName)
- .withArgs('isManagedMySQLForHiveEnabled').returns(item.isManagedMySQLForHiveEnabled);
- serviceConfigProperty.setProperties({
- name: 'hive_database',
- value: item.receivedValue,
- options: item.options
+ describe(title.format(item.value), function () {
+
+ beforeEach(function () {
+ this.stub
+ .withArgs('supports.alwaysEnableManagedMySQLForHive').returns(item.alwaysEnableManagedMySQLForHive)
+ .withArgs('router.currentState.name').returns(item.currentStateName)
+ .withArgs('isManagedMySQLForHiveEnabled').returns(item.isManagedMySQLForHiveEnabled);
+ serviceConfigProperty.setProperties({
+ name: 'hive_database',
+ value: item.receivedValue,
+ options: item.options
+ });
+ App.ConfigInitializer.initialValue(serviceConfigProperty, {}, []);
+ });
+
+ it('value is ' + item.value, function () {
+ expect(serviceConfigProperty.get('value')).to.equal(item.value);
});
- App.ConfigInitializer.initialValue(serviceConfigProperty, {}, []);
- expect(serviceConfigProperty.get('value')).to.equal(item.value);
- expect(serviceConfigProperty.get('options').findProperty('displayName', 'New MySQL Database').hidden).to.equal(item.hidden);
+
+ it('`New MySQL Database` is ' + (item.hidden ? '' : 'not') + ' hidden', function () {
+ expect(serviceConfigProperty.get('options').findProperty('displayName', 'New MySQL Database').hidden).to.equal(item.hidden);
+ });
+
});
});
@@ -808,19 +818,30 @@ describe('App.ConfigInitializer', function () {
expectedValue: 'thrift://h1:9083,thrift://h2:9083'
}
]).forEach(function (test) {
- it(test.m || test.config, function () {
- serviceConfigProperty.setProperties({
- name: test.config,
- recommendedValue: test.rValue,
- filename: test.filename
+ describe(test.m || test.config, function () {
+
+ beforeEach(function () {
+ serviceConfigProperty.setProperties({
+ name: test.config,
+ recommendedValue: test.rValue,
+ filename: test.filename
+ });
+ App.ConfigInitializer.initialValue(serviceConfigProperty, test.localDB, test.dependencies);
+ });
+
+ it('value is ' + test.expectedValue, function () {
+ expect(serviceConfigProperty.get('value')).to.eql(test.expectedValue);
});
- App.ConfigInitializer.initialValue(serviceConfigProperty, test.localDB, test.dependencies);
- expect(serviceConfigProperty.get('value')).to.eql(test.expectedValue);
+
if (Em.isNone(test.expectedRValue)) {
- expect(serviceConfigProperty.get('recommendedValue')).to.eql(test.expectedValue);
+ it('recommendedValue is ' + test.expectedValue, function () {
+ expect(serviceConfigProperty.get('recommendedValue')).to.eql(test.expectedValue);
+ });
}
else {
- expect(serviceConfigProperty.get('recommendedValue')).to.eql(test.expectedRValue);
+ it('recommendedValue is ' + test.expectedRValue, function () {
+ expect(serviceConfigProperty.get('recommendedValue')).to.eql(test.expectedRValue);
+ });
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js b/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js
index ed43a1b..3fc02a7 100644
--- a/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/config_widget_view_test.js
@@ -180,7 +180,7 @@ describe('App.ConfigWidgetView', function () {
view = App.ConfigWidgetView.create({
controller: Em.Object.extend(App.EnhancedConfigsMixin, {
}).create({
- updateDependentConfigs: function() {},
+ updateDependentConfigs: function() {}
}),
config: Em.Object.create({ name: 'config1'})
});
@@ -215,37 +215,60 @@ describe('App.ConfigWidgetView', function () {
});
});
- it('when dependent configs has multiple parents appropriate parent config should be removed', function() {
- view.set('controller.recommendations', [
- {name: 'dependent1', parentConfigs: ['config1', 'config2']},
- {name: 'dependent2', parentConfigs: ['config2', 'config1']},
- {name: 'dependent3', parentConfigs: ['config1']}
- ]);
- view.restoreDependentConfigs(view.get('config'));
- expect(view.get('controller.recommendations').findProperty('name', 'dependent1').parentConfigs.toArray()).to.be.eql(["config2"]);
- expect(view.get('controller.recommendations').findProperty('name', 'dependent2').parentConfigs.toArray()).to.be.eql(["config2"]);
- expect(view.get('controller.recommendations.length')).to.be.eql(2);
+ describe('when dependent configs has multiple parents appropriate parent config should be removed', function() {
+
+ beforeEach(function () {
+ view.set('controller.recommendations', [
+ {name: 'dependent1', parentConfigs: ['config1', 'config2']},
+ {name: 'dependent2', parentConfigs: ['config2', 'config1']},
+ {name: 'dependent3', parentConfigs: ['config1']}
+ ]);
+ view.restoreDependentConfigs(view.get('config'));
+ });
+
+ it('2 recommendations', function () {
+ expect(view.get('controller.recommendations.length')).to.be.equal(2);
+ });
+
+ it('dependent1 parent is ["config2"]', function () {
+ expect(view.get('controller.recommendations').findProperty('name', 'dependent1').parentConfigs.toArray()).to.be.eql(["config2"]);
+ });
+ it('dependent2 parent is ["config2"]', function () {
+ expect(view.get('controller.recommendations').findProperty('name', 'dependent2').parentConfigs.toArray()).to.be.eql(["config2"]);
+ });
+
});
- it('dependent config value should be set with inital or saved when it has one parent', function() {
- var ctrl = view.get('controller');
- ctrl.set('stepConfigs', [
- Em.Object.create({
- configs: Em.A([
- Em.Object.create({ name: 'dependent3', savedValue: '1', value: 2, filename: 'some-file.xml' }),
- Em.Object.create({ name: 'dependent2', savedValue: '4', value: '10', filename: 'some-file.xml' })
- ])
- })
- ]);
- view.set('controller.recommendations', [
- {propertyName: 'dependent1', parentConfigs: ['config1', 'config2'], fileName: 'some-file' },
- {propertyName: 'dependent2', parentConfigs: ['config2', 'config1'], fileName: 'some-file'},
- {propertyName: 'dependent3', parentConfigs: ['config1'], fileName: 'some-file' }
- ]);
- view.restoreDependentConfigs(view.get('config'));
- expect(view.get('controller').findConfigProperty('dependent3', 'some-file.xml').get('value')).to.be.eql('1');
- // config with multi dependency should not be updated
- expect(view.get('controller').findConfigProperty('dependent2', 'some-file.xml').get('value')).to.be.eql('10');
+ describe('dependent config value should be set with inital or saved when it has one parent', function() {
+ var ctrl;
+
+ beforeEach(function () {
+ ctrl = view.get('controller');
+ ctrl.set('stepConfigs', [
+ Em.Object.create({
+ configs: Em.A([
+ Em.Object.create({ name: 'dependent3', savedValue: '1', value: 2, filename: 'some-file.xml' }),
+ Em.Object.create({ name: 'dependent2', savedValue: '4', value: '10', filename: 'some-file.xml' })
+ ])
+ })
+ ]);
+ view.set('controller.recommendations', [
+ {propertyName: 'dependent1', parentConfigs: ['config1', 'config2'], fileName: 'some-file' },
+ {propertyName: 'dependent2', parentConfigs: ['config2', 'config1'], fileName: 'some-file'},
+ {propertyName: 'dependent3', parentConfigs: ['config1'], fileName: 'some-file' }
+ ]);
+ view.restoreDependentConfigs(view.get('config'));
+ });
+
+ it('dependent3 value is `1`', function () {
+ expect(view.get('controller').findConfigProperty('dependent3', 'some-file.xml').get('value')).to.be.equal('1');
+ });
+
+ it('dependent2 value is `10`', function () {
+ // config with multi dependency should not be updated
+ expect(view.get('controller').findConfigProperty('dependent2', 'some-file.xml').get('value')).to.be.equal('10');
+ });
+
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js b/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js
index 4e1caa1..47dfc5d 100644
--- a/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js
@@ -136,11 +136,12 @@ describe('App.ListConfigWidgetView', function () {
view.sendRequestRorDependentConfigs.restore();
});
it('value updates if some option', function () {
- view.toggleOption({context: view.get('options')[2]});
+ var options = view.get('options');
+ view.toggleOption({context: options[2]});
expect(view.get('config.value')).to.equal('2,1,3');
- view.toggleOption({context: view.get('options')[1]});
+ view.toggleOption({context: options[1]});
expect(view.get('config.value')).to.equal('1,3');
- view.toggleOption({context: view.get('options')[1]});
+ view.toggleOption({context: options[1]});
expect(view.get('config.value')).to.equal('1,3,2');
});
@@ -161,13 +162,14 @@ describe('App.ListConfigWidgetView', function () {
view.sendRequestRorDependentConfigs.restore();
});
it('should restore saved value', function () {
- view.toggleOption({context: view.get('options')[0]});
- view.toggleOption({context: view.get('options')[1]});
- view.toggleOption({context: view.get('options')[2]});
+ var options = view.get('options');
+ view.toggleOption({context: options[0]});
+ view.toggleOption({context: options[1]});
+ view.toggleOption({context: options[2]});
expect(view.get('config.value')).to.equal('3');
view.restoreValue();
expect(view.get('config.value')).to.equal('2,1');
- expect(view.get('controller.removeCurrentFromDependentList')).to.be.called
+ expect(view.get('controller.removeCurrentFromDependentList')).to.be.called;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js b/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
index 3214c5b..a996e69 100644
--- a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
@@ -544,28 +544,35 @@ describe('App.SliderConfigWidgetView', function () {
];
tests.forEach(function(test) {
- it('should generate ticks: {0} - tick labels: {1}'.format(test.e.ticks, test.e.ticksLabels), function() {
+ describe('should generate ticks: {0} - tick labels: {1}'.format(test.e.ticks, test.e.ticksLabels), function() {
var ticks, ticksLabels;
- this.view.reopen(test.viewSetup);
- this.view.set('controller', {
- isCompareMode: test.viewSetup.isCompareMode
- });
- var sliderCopy = window.Slider.prototype;
- window.Slider = function(a, b) {
- ticks = b.ticks;
- ticksLabels = b.ticks_labels;
- return {
- on: function() {
- return this;
- }
+ beforeEach(function () {
+ this.view.reopen(test.viewSetup);
+ this.view.set('controller', {
+ isCompareMode: test.viewSetup.isCompareMode
+ });
+ var sliderCopy = window.Slider.prototype;
+ window.Slider = function(a, b) {
+ ticks = b.ticks;
+ ticksLabels = b.ticks_labels;
+ return {
+ on: function() {
+ return this;
+ }
+ };
};
- };
+ this.view.willInsertElement();
+ this.view.initSlider();
+ window.Slider.prototype = sliderCopy;
+ });
- this.view.willInsertElement();
- this.view.initSlider();
- window.Slider.prototype = sliderCopy;
- expect(ticks.toArray()).to.be.eql(test.e.ticks);
- expect(ticksLabels.toArray()).to.be.eql(test.e.ticksLabels);
+ it('ticks are ' + test.e.ticks, function () {
+ expect(ticks.toArray()).to.be.eql(test.e.ticks);
+ });
+
+ it('ticksLabels are ' + test.e.ticksLabels, function () {
+ expect(ticksLabels.toArray()).to.be.eql(test.e.ticksLabels);
+ });
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js b/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js
index 93a0f01..44d8322 100644
--- a/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js
@@ -89,8 +89,8 @@ describe('App.ToggleConfigWidgetView', function () {
isValid: true
});
expect(this.view.isValueCompatibleWithWidget()).to.be.false;
- expect(this.view.get('warnMessage')).to.have.property('length').that.is.least(1);
- expect(this.view.get('issueMessage')).to.have.property('length').that.is.least(1);
+ expect(this.view.get('warnMessage')).to.be.not.empty;
+ expect(this.view.get('issueMessage')).to.be.not.empty;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/views/common/controls_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/controls_view_test.js b/ambari-web/test/views/common/controls_view_test.js
index cb7a475..a097151 100644
--- a/ambari-web/test/views/common/controls_view_test.js
+++ b/ambari-web/test/views/common/controls_view_test.js
@@ -295,23 +295,34 @@ describe('App.ServiceConfigRadioButtons', function () {
});
cases.forEach(function (item) {
- it(item.title, function () {
- this.stub.withArgs('currentStackVersion').returns(item.currentStackVersion);
- rangerVersion = item.rangerVersion;
- view.reopen({controller: item.controller});
- view.setProperties({
- categoryConfigsAll: item.controller.get('selectedService.configs'),
- serviceConfig: item.serviceConfig
- });
+ describe(item.title, function () {
+
+ var additionalView1, additionalView2;
+ beforeEach(function () {
+ this.stub.withArgs('currentStackVersion').returns(item.currentStackVersion);
+ rangerVersion = item.rangerVersion;
+ view.reopen({controller: item.controller});
+ view.setProperties({
+ categoryConfigsAll: item.controller.get('selectedService.configs'),
+ serviceConfig: item.serviceConfig
+ });
- var additionalView1 = view.get('categoryConfigsAll').findProperty('name', item.propertyAppendTo1).get('additionalView'),
+ additionalView1 = view.get('categoryConfigsAll').findProperty('name', item.propertyAppendTo1).get('additionalView');
additionalView2 = view.get('categoryConfigsAll').findProperty('name', item.propertyAppendTo2).get('additionalView');
+ });
- expect(Em.isNone(additionalView1)).to.equal(item.isAdditionalView1Null);
- expect(Em.isNone(additionalView2)).to.equal(item.isAdditionalView2Null);
+ it('additionalView1 is ' + (item.isAdditionalView1Null ? '' : 'not') + ' null', function () {
+ expect(Em.isNone(additionalView1)).to.equal(item.isAdditionalView1Null);
+ });
+
+ it('additionalView2 is ' + (item.isAdditionalView2Null ? '' : 'not') + ' null', function () {
+ expect(Em.isNone(additionalView2)).to.equal(item.isAdditionalView2Null);
+ });
if (!item.isAdditionalView2Null) {
- expect(additionalView2.create().get('message')).to.equal(Em.I18n.t('services.service.config.database.msg.jdbcSetup').format(item.dbType, item.driver));
+ it('additionalView2.message is valid', function () {
+ expect(additionalView2.create().get('message')).to.equal(Em.I18n.t('services.service.config.database.msg.jdbcSetup').format(item.dbType, item.driver));
+ });
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/views/common/rolling_restart_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/rolling_restart_view_test.js b/ambari-web/test/views/common/rolling_restart_view_test.js
index 694f876..2f06f48 100644
--- a/ambari-web/test/views/common/rolling_restart_view_test.js
+++ b/ambari-web/test/views/common/rolling_restart_view_test.js
@@ -69,15 +69,24 @@ describe('App.RollingRestartView', function () {
];
testCases.forEach(function (test) {
- it(test.restartHostComponents.length + ' components to restart', function () {
- view.set('batchSize', -1);
- view.set('interBatchWaitTimeSeconds', -1);
- view.set('tolerateSize', -1);
- view.set('hostComponentName', test.hostComponentName);
- view.set('restartHostComponents', test.restartHostComponents);
- view.initialize();
- expect(view.get('batchSize')).to.equal(test.result.batchSize);
- expect(view.get('tolerateSize')).to.equal(test.result.tolerateSize);
+ describe(test.restartHostComponents.length + ' components to restart', function () {
+
+ beforeEach(function () {
+ view.set('batchSize', -1);
+ view.set('interBatchWaitTimeSeconds', -1);
+ view.set('tolerateSize', -1);
+ view.set('hostComponentName', test.hostComponentName);
+ view.set('restartHostComponents', test.restartHostComponents);
+ view.initialize();
+ });
+
+ it('batchSize is ' + test.result.batchSize, function() {
+ expect(view.get('batchSize')).to.equal(test.result.batchSize);
+ });
+
+ it('tolerateSize is ' + test.result.tolerateSize, function() {
+ expect(view.get('tolerateSize')).to.equal(test.result.tolerateSize);
+ });
})
}, this);
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js
index 94c8fe9..a5b0def 100644
--- a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js
+++ b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js
@@ -679,16 +679,28 @@ describe('App.upgradeWizardView', function () {
});
cases.forEach(function (item) {
- it(item.title, function () {
- view.set('controller.areSkippedServiceChecksLoaded', item.areSkippedServiceChecksLoaded);
- view.reopen({
- isFinalizeItem: item.isFinalizeItem
+ describe(item.title, function () {
+
+ beforeEach(function () {
+ view.set('controller.areSkippedServiceChecksLoaded', item.areSkippedServiceChecksLoaded);
+ view.reopen({
+ isFinalizeItem: item.isFinalizeItem
+ });
+ view.propertyDidChange('isFinalizeItem');
+ });
+
+ it('request is sent ' + item.ajaxSendCallCount + ' times', function (){
+ expect(App.ajax.send.callCount).to.equal(item.ajaxSendCallCount);
});
- view.propertyDidChange('isFinalizeItem');
- expect(App.ajax.send.callCount).to.equal(item.ajaxSendCallCount);
- expect(view.get('controller.areSkippedServiceChecksLoaded')).to.equal(item.areSkippedServiceChecksLoadedResult);
+
+ it('areSkippedServiceChecksLoaded is ' + item.areSkippedServiceChecksLoaded, function () {
+ expect(view.get('controller.areSkippedServiceChecksLoaded')).to.equal(item.areSkippedServiceChecksLoadedResult);
+ });
+
if (item.ajaxSendCallCount) {
- expect(App.ajax.send.firstCall.args[0].data.upgradeId).to.equal(1);
+ it('upgradeId is 1', function () {
+ expect(App.ajax.send.firstCall.args[0].data.upgradeId).to.equal(1);
+ });
}
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/views/main/alerts/manage_alert_groups/select_definitions_popup_body_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/alerts/manage_alert_groups/select_definitions_popup_body_view_test.js b/ambari-web/test/views/main/alerts/manage_alert_groups/select_definitions_popup_body_view_test.js
index 4ddaf50..d0002a0 100644
--- a/ambari-web/test/views/main/alerts/manage_alert_groups/select_definitions_popup_body_view_test.js
+++ b/ambari-web/test/views/main/alerts/manage_alert_groups/select_definitions_popup_body_view_test.js
@@ -228,15 +228,25 @@ describe('App.SelectDefinitionsPopupBodyView', function () {
}
];
testCases.forEach(function (test) {
- it(test.title, function () {
- view.set('parentView.availableDefs', test.data.defs);
- view.set('showOnlySelectedDefs', test.data.showOnlySelectedDefs);
- view.set('filterComponent', test.data.filterComponent);
- view.set('filterService', test.data.filterService);
+ describe(test.title, function () {
+
+ beforeEach(function () {
+ view.set('parentView.availableDefs', test.data.defs);
+ view.set('showOnlySelectedDefs', test.data.showOnlySelectedDefs);
+ view.set('filterComponent', test.data.filterComponent);
+ view.set('filterService', test.data.filterService);
+
+ view.filterDefs();
+ });
+
+ it('availableDefs.@each.filtered is ' + test.result, function () {
+ expect(view.get('parentView.availableDefs').mapProperty('filtered')).to.eql(test.result);
+ });
+
+ it('startIndex is 1', function () {
+ expect(view.get('startIndex')).to.equal(1);
+ });
- view.filterDefs();
- expect(view.get('parentView.availableDefs').mapProperty('filtered')).to.eql(test.result);
- expect(view.get('startIndex')).to.equal(1);
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/views/main/dashboard/widget_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widget_test.js b/ambari-web/test/views/main/dashboard/widget_test.js
index 39b2a48..e27d0f7 100644
--- a/ambari-web/test/views/main/dashboard/widget_test.js
+++ b/ambari-web/test/views/main/dashboard/widget_test.js
@@ -335,15 +335,28 @@ describe('App.DashboardWidgetView', function () {
}
];
testCases.forEach(function (test) {
- it("thresh1 - " + test.data.thresh1 + ', maxValue - ' + test.data.maxValue, function () {
- widget.set('isThresh2Error', false);
- widget.set('thresh2', test.data.thresh2 || "");
- widget.set('thresh1', test.data.thresh1);
- widget.set('maxValue', test.data.maxValue);
- widget.observeThresh1Value();
- expect(widget.get('isThresh1Error')).to.equal(test.result.isThresh1Error);
- expect(widget.get('errorMessage1')).to.equal(test.result.errorMessage1);
- expect(widget.updateSlider.called).to.be.true;
+ describe("thresh1 - " + test.data.thresh1 + ', maxValue - ' + test.data.maxValue, function () {
+
+ beforeEach(function () {
+ widget.set('isThresh2Error', false);
+ widget.set('thresh2', test.data.thresh2 || "");
+ widget.set('thresh1', test.data.thresh1);
+ widget.set('maxValue', test.data.maxValue);
+ widget.observeThresh1Value();
+ });
+
+ it('isThresh1Error is ' + test.result.isThresh1Error, function () {
+ expect(widget.get('isThresh1Error')).to.equal(test.result.isThresh1Error);
+ });
+
+ it('errorMessage1 is ' + test.result.errorMessage1, function () {
+ expect(widget.get('errorMessage1')).to.equal(test.result.errorMessage1);
+ });
+
+ it('updateSlider is called', function () {
+ expect(widget.updateSlider.called).to.be.true;
+ });
+
});
});
});
@@ -408,13 +421,25 @@ describe('App.DashboardWidgetView', function () {
}
];
testCases.forEach(function (test) {
- it("thresh2 - " + test.data.thresh2 + ', maxValue - ' + test.data.maxValue, function () {
- widget.set('thresh2', test.data.thresh2 || "");
- widget.set('maxValue', test.data.maxValue);
- widget.observeThresh2Value();
- expect(widget.get('isThresh2Error')).to.equal(test.result.isThresh2Error);
- expect(widget.get('errorMessage2')).to.equal(test.result.errorMessage2);
- expect(widget.updateSlider.called).to.be.true;
+ describe("thresh2 - " + test.data.thresh2 + ', maxValue - ' + test.data.maxValue, function () {
+
+ beforeEach(function () {
+ widget.set('thresh2', test.data.thresh2 || "");
+ widget.set('maxValue', test.data.maxValue);
+ widget.observeThresh2Value();
+ });
+
+ it('isThresh2Error is ' + test.result.isThresh2Error, function () {
+ expect(widget.get('isThresh2Error')).to.equal(test.result.isThresh2Error);
+ });
+
+ it('errorMessage2 is ' + JSON.stringify(test.result.errorMessage2), function () {
+ expect(widget.get('errorMessage2')).to.equal(test.result.errorMessage2);
+ });
+
+ it('updateSlider is called', function () {
+ expect(widget.updateSlider.called).to.be.true;
+ });
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/views/main/dashboard/widgets_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets_test.js b/ambari-web/test/views/main/dashboard/widgets_test.js
index 311bf21..35f0673 100644
--- a/ambari-web/test/views/main/dashboard/widgets_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets_test.js
@@ -115,14 +115,24 @@ describe('App.MainDashboardWidgetsView', function () {
}
]);
tests.forEach(function (test) {
- it(test.m, function () {
- view.set('host_metrics_model', test.models.host_metrics_model);
- view.set('hdfs_model', test.models.hdfs_model);
- view.set('hbase_model', test.models.hbase_model);
- view.set('yarn_model', test.models.yarn_model);
- view.setInitPrefObject();
- expect(view.get('initPrefObject.visible.length')).to.equal(test.e.visibleL);
- expect(view.get('initPrefObject.hidden.length')).to.equal(test.e.hiddenL);
+ describe(test.m, function () {
+
+ beforeEach(function () {
+ view.set('host_metrics_model', test.models.host_metrics_model);
+ view.set('hdfs_model', test.models.hdfs_model);
+ view.set('hbase_model', test.models.hbase_model);
+ view.set('yarn_model', test.models.yarn_model);
+ view.setInitPrefObject();
+ });
+
+ it('visible.length is ' + test.e.visibleL, function () {
+ expect(view.get('initPrefObject.visible.length')).to.equal(test.e.visibleL);
+ });
+
+ it('hidden.length is ' + test.e.hiddenL, function () {
+ expect(view.get('initPrefObject.hidden.length')).to.equal(test.e.hiddenL);
+ });
+
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/views/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/host/details_test.js b/ambari-web/test/views/main/host/details_test.js
index 34f4c28..857b644 100644
--- a/ambari-web/test/views/main/host/details_test.js
+++ b/ambari-web/test/views/main/host/details_test.js
@@ -132,8 +132,11 @@ describe('App.MainHostDetailsView', function () {
App.set('services', Em.K);
});
- it('should get only clients with configs', function() {
+ it('should get only clients with configs (1)', function() {
expect(view.get('clientsWithConfigs')).to.have.length(1);
+ });
+
+ it('should get only clients with configs (2)', function() {
view.get('content.hostComponents').pushObject(Em.Object.create({
isClient: true,
service: Em.Object.create({
@@ -141,6 +144,9 @@ describe('App.MainHostDetailsView', function () {
})
}));
expect(view.get('clientsWithConfigs')).to.have.length(1);
+ });
+
+ it('should get only clients with configs (3)', function() {
view.get('content.hostComponents').pushObject(Em.Object.create({
isClient: true,
service: Em.Object.create({
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8aede2a/ambari-web/test/views/wizard/step5_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/step5_view_test.js b/ambari-web/test/views/wizard/step5_view_test.js
index 824d67e..5f3cd0d 100644
--- a/ambari-web/test/views/wizard/step5_view_test.js
+++ b/ambari-web/test/views/wizard/step5_view_test.js
@@ -105,14 +105,19 @@ describe('App.WizardStep5View', function() {
});
describe('#shouldUseInputs', function() {
- it('should based on hosts count', function() {
- view.set('controller.hosts', d3.range(0, 25).map(function() {return {};}));
- expect(view.get('shouldUseInputs')).to.be.false;
- view.set('controller.hosts', d3.range(0, 26).map(function() {return {};}));
- expect(view.get('shouldUseInputs')).to.be.true;
- view.set('controller.hosts', d3.range(0, 24).map(function() {return {};}));
- expect(view.get('shouldUseInputs')).to.be.false;
+
+ Em.A([
+ {range: 25, e: false},
+ {range: 26, e: true},
+ {range: 24, e: false}
+ ]).forEach(function (test) {
+ it(test.e + ' for ' + test.range + ' hosts', function () {
+ view.set('controller.hosts', d3.range(0, test.range).map(function() {return {};}));
+ expect(view.get('shouldUseInputs')).to.be.equal(test.e);
+ });
+
});
+
});
});
[03/50] [abbrv] ambari git commit: AMBARI-14495. Improve Ambari UI UT
(p.2) (onechiporenko)
Posted by nc...@apache.org.
AMBARI-14495. Improve Ambari UI UT (p.2) (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f8213edb
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f8213edb
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f8213edb
Branch: refs/heads/branch-dev-patch-upgrade
Commit: f8213edb4fe67fb0c6f9b3c8f881430aeb188e2d
Parents: bc841dc
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Fri Dec 25 13:34:34 2015 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Fri Dec 25 16:27:53 2015 +0200
----------------------------------------------------------------------
.../test/controllers/wizard/step10_test.js | 51 ++-
.../test/controllers/wizard/step2_test.js | 30 +-
.../test/controllers/wizard/step3_test.js | 300 ++++++-------
.../test/controllers/wizard/step4_test.js | 93 ++--
.../test/controllers/wizard/step5_test.js | 217 ++++++---
.../test/controllers/wizard/step6_test.js | 41 +-
.../test/controllers/wizard/step7_test.js | 355 +++++++++------
.../test/controllers/wizard/step8_test.js | 438 +++++++++++--------
.../test/controllers/wizard/step9_test.js | 89 ++--
ambari-web/test/controllers/wizard_test.js | 131 ++++--
.../test/data/HDP2.2/site_properties_test.js | 26 +-
.../test/data/HDP2.3/site_properties_test.js | 26 +-
.../test/data/HDP2/site_properties_test.js | 26 +-
.../alert_definition_summary_mapper_test.js | 165 +++++--
.../service_config_version_mapper_test.js | 83 +++-
.../stack_config_properties_mapper_test.js | 382 +++++++++-------
.../test/mappers/configs/themes_mapper_test.js | 180 ++++----
ambari-web/test/mappers/service_mapper_test.js | 15 +-
ambari-web/test/mappers/stack_mapper_test.js | 24 +-
ambari-web/test/utils/blueprint_test.js | 10 +-
ambari-web/test/utils/helper_test.js | 5 +-
.../alerts/manage_alert_groups_view_test.js | 59 ---
.../views/main/service/info/summary_test.js | 15 +-
23 files changed, 1633 insertions(+), 1128 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/controllers/wizard/step10_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step10_test.js b/ambari-web/test/controllers/wizard/step10_test.js
index 8238e89..d6ce4b4 100644
--- a/ambari-web/test/controllers/wizard/step10_test.js
+++ b/ambari-web/test/controllers/wizard/step10_test.js
@@ -98,14 +98,24 @@ describe('App.WizardStep10Controller', function () {
}
]);
testsForLoadInstallTime.forEach(function(test) {
- it('loadMasterComponents: ' + test.loadMasterComponents.toString() + ' loadStartedServices: ' + test.loadStartedServices.toString(), function() {
- controller.set('content.controllerName', 'installerController');
- sinon.stub(controller, 'loadMasterComponents', function() {return test.loadMasterComponents;});
- sinon.stub(controller, 'loadStartedServices', function() {return test.loadStartedServices;});
- controller.loadStep();
- expect(controller.loadInstallTime.called).to.equal(test.e);
- controller.loadMasterComponents.restore();
- controller.loadStartedServices.restore();
+ describe('loadMasterComponents: ' + test.loadMasterComponents.toString() + ' loadStartedServices: ' + test.loadStartedServices.toString(), function() {
+
+ beforeEach(function () {
+ controller.set('content.controllerName', 'installerController');
+ sinon.stub(controller, 'loadMasterComponents', function() {return test.loadMasterComponents;});
+ sinon.stub(controller, 'loadStartedServices', function() {return test.loadStartedServices;});
+ controller.loadStep();
+ });
+
+ afterEach(function () {
+ controller.loadMasterComponents.restore();
+ controller.loadStartedServices.restore();
+ });
+
+ it('loadInstallTime was ' + (test.e ? '' : 'not') + ' called', function () {
+ expect(controller.loadInstallTime.called).to.equal(test.e);
+ });
+
});
});
});
@@ -426,22 +436,37 @@ describe('App.WizardStep10Controller', function () {
});
describe('#loadRegisteredHosts', function() {
- it('should add object to clusterInfo', function() {
- var masterComponentHosts = [{hostName: 'h1'}, {hostName: 'h2'}, {hostName: 'h3'}],
- slaveComponentHosts = [{hosts: [{hostName: 'h1'}, {hostName: 'h4'}]}, {hosts: [{hostName: 'h2'}, {hostName: 'h5'}]}],
- hosts = [{hostName: 'h6'}, {hostName: 'h3'}, {hostName: 'h7'}];
+ var masterComponentHosts = [{hostName: 'h1'}, {hostName: 'h2'}, {hostName: 'h3'}],
+ slaveComponentHosts = [{hosts: [{hostName: 'h1'}, {hostName: 'h4'}]}, {hosts: [{hostName: 'h2'}, {hostName: 'h5'}]}],
+ hosts = [{hostName: 'h6'}, {hostName: 'h3'}, {hostName: 'h7'}];
+ var obj;
+ beforeEach(function () {
controller.set('content.masterComponentHosts', masterComponentHosts);
controller.set('content.slaveComponentHosts', slaveComponentHosts);
controller.set('clusterInfo', []);
sinon.stub(App.Host, 'find', function() {
return hosts;
});
- var obj = controller.loadRegisteredHosts();
+ obj = controller.loadRegisteredHosts();
+ });
+
+ afterEach(function () {
App.Host.find.restore();
+ });
+
+ it('id = 1', function() {
expect(obj.id).to.equal(1);
+ });
+ it('color = text-info', function () {
expect(obj.color).to.equal('text-info');
+ });
+ it('displayStatement is valid', function () {
expect(obj.displayStatement).to.equal(Em.I18n.t('installer.step10.hostsSummary').format(7));
+ });
+ it('status is []', function () {
expect(obj.status).to.eql([]);
+ });
+ it('clusterInfo.firstObject is valid', function () {
expect(controller.get('clusterInfo.firstObject')).to.eql(obj);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/controllers/wizard/step2_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step2_test.js b/ambari-web/test/controllers/wizard/step2_test.js
index 8869444..843e4c2 100644
--- a/ambari-web/test/controllers/wizard/step2_test.js
+++ b/ambari-web/test/controllers/wizard/step2_test.js
@@ -270,13 +270,17 @@ describe('App.WizardStep2Controller', function () {
describe('#agentUserError', function () {
+ beforeEach(function () {
+ this.stub = sinon.stub(App, 'get');
+ });
+
afterEach(function () {
App.get.restore();
});
userErrorTests.forEach(function(test) {
it('Ambari Agent user account customize enabled', function() {
- sinon.stub(App, 'get').withArgs('supports.customizeAgentUserAccount').returns(true);
+ this.stub.withArgs('supports.customizeAgentUserAccount').returns(true);
var controller = App.WizardStep2Controller.create({content: {installOptions: {manualInstall: test.manualInstall, agentUser: test.user}}});
if(Em.isNone(test.e)) {
expect(controller.get('agentUserError')).to.be.null;
@@ -289,7 +293,7 @@ describe('App.WizardStep2Controller', function () {
userErrorTests.forEach(function(test) {
it('Ambari Agent user account customize disabled', function() {
- sinon.stub(App, 'get').withArgs('supports.customizeAgentUserAccount').returns(false);
+ this.stub.withArgs('supports.customizeAgentUserAccount').returns(false);
var controller = App.WizardStep2Controller.create({content: {installOptions: {manualInstall: test.manualInstall, agentUser: test.user}}});
expect(controller.get('agentUserError')).to.be.null;
});
@@ -428,14 +432,24 @@ describe('App.WizardStep2Controller', function () {
describe('#proceedNext()', function () {
+ beforeEach(function () {
+ sinon.stub(c, 'warningPopup', Em.K);
+ sinon.stub(c, 'manualInstallPopup', Em.K);
+ sinon.stub(App.router, 'send', Em.K);
+ });
+
+ afterEach(function () {
+ c.warningPopup.restore();
+ c.manualInstallPopup.restore();
+ App.router.send.restore();
+ });
+
it('should call warningPopup if not isAllHostNamesValid and no warningConfirmed', function() {
c.reopen({
isAllHostNamesValid: function() {
return false;
- },
- warningPopup: Em.K
+ }
});
- sinon.spy(c, 'warningPopup');
var r = c.proceedNext(false);
expect(r).to.equal(false);
expect(c.warningPopup.calledOnce).to.equal(true);
@@ -444,17 +458,14 @@ describe('App.WizardStep2Controller', function () {
it('should call manualInstallPopup if manualInstall is true', function () {
c.reopen({
hostNames: '',
- manualInstall: true,
- manualInstallPopup: Em.K
+ manualInstall: true
});
- sinon.spy(c, 'manualInstallPopup');
var r = c.proceedNext(true);
expect(r).to.equal(false);
expect(c.manualInstallPopup.calledOnce).to.equal(true);
});
it ('should save hosts and proceed next if manualInstall is false', function() {
- sinon.stub(App.router, 'send', Em.K);
c.reopen({
hostNameArr: ['h1'],
manualInstall: false,
@@ -468,7 +479,6 @@ describe('App.WizardStep2Controller', function () {
expect(r).to.equal(true);
expect(Em.keys(c.get('content.hosts'))).to.eql(['h1']);
expect(App.router.send.calledWith('next')).to.equal(true);
- App.router.send.restore();
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/controllers/wizard/step3_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step3_test.js b/ambari-web/test/controllers/wizard/step3_test.js
index 6262678..309d658 100644
--- a/ambari-web/test/controllers/wizard/step3_test.js
+++ b/ambari-web/test/controllers/wizard/step3_test.js
@@ -155,23 +155,15 @@ describe('App.WizardStep3Controller', function () {
describe('#isWarningsBoxVisible', function () {
- afterEach(function () {
- App.get.restore();
+ beforeEach(function () {
+ sinon.stub(App, 'get').withArgs('testMode').returns(false);
});
- it('for testMode should be always true', function () {
- sinon.stub(App, 'get', function (k) {
- if ('testMode' === k) return true;
- return Em.get(App, k);
- });
- expect(c.get('isWarningsBoxVisible')).to.equal(true);
+ afterEach(function () {
+ App.get.restore();
});
it('for "real" mode should be based on isRegistrationInProgress', function () {
- sinon.stub(App, 'get', function (k) {
- if ('testMode' === k) return false;
- return Em.get(App, k);
- });
c.set('isRegistrationInProgress', false);
expect(c.get('isWarningsBoxVisible')).to.equal(true);
c.set('isRegistrationInProgress', true);
@@ -218,11 +210,6 @@ describe('App.WizardStep3Controller', function () {
expect(c.get('isSubmitDisabled')).to.equal(true);
});
- it('should set isSubmitDisabled to true', function () {
- c.set('isRetryDisabled', false);
- c.clearStep();
- expect(c.get('isRetryDisabled')).to.equal(true);
- });
});
describe('#loadStep', function () {
@@ -306,7 +293,7 @@ describe('App.WizardStep3Controller', function () {
expect(c.get('hosts').everyProperty('bootStatus', 'PENDING')).to.equal(true);
});
- it('should set bootStatus PENDING on "real" mode and when installOptions.manualInstall is not selected', function () {
+ it('should set bootStatus PENDING on "real" mode and when installOptions.manualInstall is not selected (2)', function () {
App.set('testMode', true);
c.set('content', {hosts: {c: {name: 'name'}, d: {name: 'name1'}}});
c.loadHosts();
@@ -527,29 +514,39 @@ describe('App.WizardStep3Controller', function () {
});
agentUserCases.forEach(function (item) {
- it(item.title, function () {
- var controller = App.WizardStep3Controller.create({
- content: {
- installOptions: {
- sshKey: 'key',
- sshUser: 'root',
- sshPort: '123',
- agentUser: 'user'
- },
- hosts: { "host0": { "name": "host0" }, "host1": { "name": "host1" } }
- }
+ describe(item.title, function () {
+ var controller;
+ beforeEach(function () {
+ controller = App.WizardStep3Controller.create({
+ content: {
+ installOptions: {
+ sshKey: 'key',
+ sshUser: 'root',
+ sshPort: '123',
+ agentUser: 'user'
+ },
+ hosts: { "host0": { "name": "host0" }, "host1": { "name": "host1" } }
+ }
+ });
+ sinon.stub(App, 'get').withArgs('supports.customizeAgentUserAccount').returns(item.customizeAgentUserAccount);
+ controller.setupBootStrap();
});
- sinon.stub(App, 'get').withArgs('supports.customizeAgentUserAccount').returns(item.customizeAgentUserAccount);
- controller.setupBootStrap();
- App.get.restore();
- expect(installer.launchBootstrap.firstCall.args[0]).to.equal(JSON.stringify({
- verbose: true,
- sshKey: 'key',
- hosts: ['host0', 'host1'],
- user: 'root',
- sshPort: '123',
- userRunAs: item.userRunAs
- }));
+
+ afterEach(function () {
+ App.get.restore();
+ });
+
+ it('launchBootstrap is called with correct arguments', function () {
+ expect(installer.launchBootstrap.firstCall.args[0]).to.equal(JSON.stringify({
+ verbose: true,
+ sshKey: 'key',
+ hosts: ['host0', 'host1'],
+ user: 'root',
+ sshPort: '123',
+ userRunAs: item.userRunAs
+ }));
+ });
+
});
});
});
@@ -631,7 +628,7 @@ describe('App.WizardStep3Controller', function () {
expect(c.get('registrationStartedAt')).to.be.null;
});
- it('should drop numPolls and registrationStartedAt', function () {
+ it('should drop numPolls and registrationStartedAt (2)', function () {
c.set('hosts', Em.A([
{name: 'c1'},
{name: 'c2'}
@@ -770,7 +767,7 @@ describe('App.WizardStep3Controller', function () {
expect(c.get('registrationStartedAt')).to.equal(1234);
});
- it('shouldn\'t do nothing if registrationStartedAt isn\'t null', function () {
+ it('shouldn\'t do nothing if registrationStartedAt isn\'t null (2)', function () {
c.set('registrationStartedAt', null);
c.startRegistration();
expect(c.isHostsRegistered.calledOnce).to.equal(true);
@@ -2276,62 +2273,50 @@ describe('App.WizardStep3Controller', function () {
});
});
- it('should set test data if testMode is true', function () {
- c.reopen({
- isLoaded: true,
- hosts: [
- {},
- {},
- {}
- ],
- content: {
- installedHosts: [],
- installOptions: {
- manualInstall: true
- }
- },
- setRegistrationInProgress: Em.K
+ describe('should start registration', function () {
+
+ beforeEach(function () {
+ c.reopen({
+ isLoaded: true,
+ hosts: [
+ {},
+ {},
+ {}
+ ],
+ content: {
+ installedHosts: [],
+ installOptions: {
+ manualInstall: true
+ }
+ },
+ setRegistrationInProgress: Em.K,
+ startRegistration: Em.K
+ });
+ sinon.stub(App, 'get', function (k) {
+ if ('testMode' === k) return false;
+ return Em.get(App, k);
+ });
+ sinon.spy(c, 'startRegistration');
+ c.navigateStep();
});
- sinon.stub(App, 'get', function (k) {
- if ('testMode' === k) return true;
- return Em.get(App, k);
+
+
+ afterEach(function () {
+ App.get.restore();
+ c.startRegistration.restore();
});
- c.navigateStep();
- App.get.restore();
- expect(c.get('bootHosts.length')).to.equal(c.get('hosts.length'));
- expect(c.get('bootHosts').everyProperty('cpu', '2')).to.equal(true);
- expect(c.get('bootHosts').everyProperty('memory', '2000000')).to.equal(true);
- expect(c.get('isSubmitDisabled')).to.equal(false);
- });
- it('should start registration', function () {
- c.reopen({
- isLoaded: true,
- hosts: [
- {},
- {},
- {}
- ],
- content: {
- installedHosts: [],
- installOptions: {
- manualInstall: true
- }
- },
- setRegistrationInProgress: Em.K,
- startRegistration: Em.K
+ it('startRegistration is called once', function () {
+ expect(c.startRegistration.calledOnce).to.equal(true);
});
- sinon.stub(App, 'get', function (k) {
- if ('testMode' === k) return false;
- return Em.get(App, k);
+
+ it('all hosts are bootHosts', function () {
+ expect(c.get('bootHosts.length')).to.equal(c.get('hosts.length'));
+ });
+
+ it('registrationStartedAt is null', function () {
+ expect(c.get('registrationStartedAt')).to.be.null;
});
- sinon.spy(c, 'startRegistration');
- c.navigateStep();
- App.get.restore();
- expect(c.startRegistration.calledOnce).to.equal(true);
- c.startRegistration.restore();
- expect(c.get('bootHosts.length')).to.equal(c.get('hosts.length'));
- expect(c.get('registrationStartedAt')).to.be.null;
});
});
@@ -2506,12 +2491,29 @@ describe('App.WizardStep3Controller', function () {
describe('#getHostInfoSuccessCallback', function () {
+ var jsonData = {items: [
+ {Hosts: {host_name: 'h1'}}
+ ]};
+
+ var skipBootstrap = false;
+
beforeEach(function () {
sinon.stub(c, 'parseWarnings', Em.K);
sinon.stub(c, 'stopRegistration', Em.K);
sinon.stub(c, 'checkHostDiskSpace', Em.K);
sinon.stub(c, '_setHostDataFromLoadedHostInfo', Em.K);
sinon.spy(c, '_setHostDataWithSkipBootstrap');
+ sinon.stub(App, 'get', function (k) {
+ if ('skipBootstrap' === k) return skipBootstrap;
+ if ('testMode' === k) return false;
+ return Em.get(App, k);
+ });
+ c.reopen({
+ bootHosts: [Em.Object.create({name: 'h1'})]
+ });
+ sinon.stub(c, 'checkHostOSType', function () {
+ return 'not_null_value';
+ });
});
afterEach(function () {
@@ -2520,73 +2522,28 @@ describe('App.WizardStep3Controller', function () {
c.checkHostDiskSpace.restore();
c._setHostDataFromLoadedHostInfo.restore();
c._setHostDataWithSkipBootstrap.restore();
+ App.get.restore();
+ c.checkHostOSType.restore();
});
it('should call _setHostDataWithSkipBootstrap if skipBootstrap is true', function () {
- sinon.stub(App, 'get', function (k) {
- if ('skipBootstrap' === k) return true;
- if ('testMode' === k) return false;
- return Em.get(App, k);
- });
- c.reopen({
- bootHosts: [Em.Object.create({name: 'h1'})]
- });
- var jsonData = {items: [
- {Hosts: {host_name: 'h1'}}
- ]};
- c.getHostInfoSuccessCallback(jsonData);
- expect(c._setHostDataWithSkipBootstrap.calledOnce).to.equal(true);
- App.get.restore();
+ skipBootstrap = true;
+ c.getHostInfoSuccessCallback(jsonData);
+ expect(c._setHostDataWithSkipBootstrap.calledOnce).to.equal(true);
});
it('should add repo warnings', function () {
-
- var jsonData = {items: [
- {Hosts: {host_name: 'h1'}}
- ]};
-
- sinon.stub(c, 'checkHostOSType', function () {
- return 'not_null_value';
- });
- sinon.stub(App, 'get', function (k) {
- if ('skipBootstrap' === k) return false;
- if ('testMode' === k) return false;
- return Em.get(App, k);
- });
-
- c.reopen({
- bootHosts: [Em.Object.create({name: 'h1'})]
- });
-
+ skipBootstrap = false;
c.getHostInfoSuccessCallback(jsonData);
expect(c.get('repoCategoryWarnings.length')).to.equal(1);
expect(c.get('repoCategoryWarnings.firstObject.hostsNames').contains('h1')).to.equal(true);
-
- c.checkHostOSType.restore();
- App.get.restore();
});
it('should add disk warnings', function () {
-
- var jsonData = {items: [
- {Hosts: {host_name: 'h1'}}
- ]};
-
- sinon.stub(App, 'get', function (k) {
- if ('skipBootstrap' === k) return false;
- if ('testMode' === k) return false;
- return Em.get(App, k);
- });
-
- c.reopen({
- bootHosts: [Em.Object.create({name: 'h1'})]
- });
-
+ skipBootstrap = false;
c.getHostInfoSuccessCallback(jsonData);
expect(c.get('diskCategoryWarnings.length')).to.equal(1);
expect(c.get('diskCategoryWarnings.firstObject.hostsNames').contains('h1')).to.equal(true);
-
- App.get.restore();
});
});
@@ -2604,32 +2561,47 @@ describe('App.WizardStep3Controller', function () {
});
describe('#_setHostDataFromLoadedHostInfo', function () {
-
- it('should set data from hostInfo', function () {
- var host = Em.Object.create(),
- hostInfo = {
- Hosts: {
- cpu_count: 2,
- total_mem: 12345,
- os_type: 't1',
- os_arch: 'os1',
- os_family: 'osf1',
- ip: '0.0.0.0',
- disk_info: [
- {mountpoint: '/boot'},
- {mountpoint: '/usr'},
- {mountpoint: '/no-boot'},
- {mountpoint: '/boot'}
- ]
- }
- };
+ var host;
+ beforeEach(function () {
+ host = Em.Object.create();
+ var hostInfo = {
+ Hosts: {
+ cpu_count: 2,
+ total_mem: 12345,
+ os_type: 't1',
+ os_arch: 'os1',
+ os_family: 'osf1',
+ ip: '0.0.0.0',
+ disk_info: [
+ {mountpoint: '/boot'},
+ {mountpoint: '/usr'},
+ {mountpoint: '/no-boot'},
+ {mountpoint: '/boot'}
+ ]
+ }
+ };
c._setHostDataFromLoadedHostInfo(host, hostInfo);
+ });
+
+ it('cpu', function () {
expect(host.get('cpu')).to.equal(2);
+ });
+ it('os_type', function () {
expect(host.get('os_type')).to.equal('t1');
+ });
+ it('os_arch', function () {
expect(host.get('os_arch')).to.equal('os1');
+ });
+ it('os_family', function () {
expect(host.get('os_family')).to.equal('osf1');
+ });
+ it('ip', function () {
expect(host.get('ip')).to.equal('0.0.0.0');
+ });
+ it('memory', function () {
expect(host.get('memory')).to.equal('12345.00');
+ });
+ it('disk_info.length', function () {
expect(host.get('disk_info.length')).to.equal(2);
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/controllers/wizard/step4_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step4_test.js b/ambari-web/test/controllers/wizard/step4_test.js
index 8159498..69cc727 100644
--- a/ambari-web/test/controllers/wizard/step4_test.js
+++ b/ambari-web/test/controllers/wizard/step4_test.js
@@ -350,14 +350,23 @@ describe('App.WizardStep4Controller', function () {
});
sparkCases.forEach(function (item) {
- it(item.title, function () {
- sinon.stub(App, 'get').withArgs('currentStackName').returns(item.currentStackName).
- withArgs('currentStackVersionNumber').returns(item.currentStackVersionNumber);
- controller.set('errorStack', []);
- controller.set('content', generateSelectedServicesContent(['SPARK']));
- controller.validate();
- expect(controller.get('errorStack').someProperty('id', 'sparkWarning')).to.equal(item.sparkWarningExpected);
- App.get.restore();
+ describe(item.title, function () {
+
+ beforeEach(function () {
+ sinon.stub(App, 'get').withArgs('currentStackName').returns(item.currentStackName).
+ withArgs('currentStackVersionNumber').returns(item.currentStackVersionNumber);
+ controller.set('errorStack', []);
+ controller.set('content', generateSelectedServicesContent(['SPARK']));
+ controller.validate();
+ });
+
+ afterEach(function () {
+ App.get.restore();
+ });
+
+ it('sparkWarning ' + (item.sparkWarningExpected ? 'exists' : 'not exists'), function () {
+ expect(controller.get('errorStack').someProperty('id', 'sparkWarning')).to.equal(item.sparkWarningExpected);
+ });
});
});
@@ -406,37 +415,43 @@ describe('App.WizardStep4Controller', function () {
var message = 'Selected services: {0}. {1} errors should be confirmed'
.format(test.services.join(', '), test.confirmPopupCount);
- it(message, function() {
+ describe(message, function() {
var runValidations = function() {
c.serviceDependencyValidation();
c.fileSystemServiceValidation();
};
- c.set('content', generateSelectedServicesContent(test.services));
- runValidations();
- // errors count validation
- expect(c.get('errorStack.length')).to.equal(test.confirmPopupCount);
- // if errors detected than it should be shown
+ beforeEach(function () {
+ c.set('content', generateSelectedServicesContent(test.services));
+ runValidations();
+ });
+
+ it('errors count validation', function () {
+ expect(c.get('errorStack.length')).to.equal(test.confirmPopupCount);
+ });
+
if (test.errorsExpected) {
- test.errorsExpected.forEach(function(error, index, errors) {
- // validate current error
- var currentErrorObject = c.get('errorStack').findProperty('isShown', false);
- if (currentErrorObject) {
- expect(test.errorsExpected).to.contain(currentErrorObject.id);
- // show current error
- var popup = c.showError(currentErrorObject);
- // submit popup
- popup.onPrimary();
- // onPrimaryPopupCallback should be called
- expect(c.onPrimaryPopupCallback.called).to.equal(true);
- // submit called
- expect(c.submit.called).to.equal(true);
- if (c.get('errorStack').length) {
- // current error isShown flag changed to true
- expect(currentErrorObject.isShown).to.equal(true);
+ it('if errors detected than it should be shown', function () {
+ test.errorsExpected.forEach(function(error, index, errors) {
+ // validate current error
+ var currentErrorObject = c.get('errorStack').findProperty('isShown', false);
+ if (currentErrorObject) {
+ expect(test.errorsExpected).to.contain(currentErrorObject.id);
+ // show current error
+ var popup = c.showError(currentErrorObject);
+ // submit popup
+ popup.onPrimary();
+ // onPrimaryPopupCallback should be called
+ expect(c.onPrimaryPopupCallback.called).to.equal(true);
+ // submit called
+ expect(c.submit.called).to.equal(true);
+ if (c.get('errorStack').length) {
+ // current error isShown flag changed to true
+ expect(currentErrorObject.isShown).to.equal(true);
+ }
+ runValidations();
}
- runValidations();
- }
+ });
});
}
});
@@ -445,6 +460,15 @@ describe('App.WizardStep4Controller', function () {
});
describe('#needToAddServicePopup', function() {
+
+ beforeEach(function () {
+ sinon.stub(controller, 'submit', Em.K);
+ });
+
+ afterEach(function () {
+ controller.submit.restore();
+ });
+
Em.A([
{
m: 'one service',
@@ -461,12 +485,10 @@ describe('App.WizardStep4Controller', function () {
}
]).forEach(function (test) {
it(test.m, function () {
- sinon.stub(controller, 'submit', Em.K);
controller.set('content', test.content);
controller.needToAddServicePopup(test.services, '').onPrimary();
expect(controller.submit.calledOnce).to.equal(true);
expect(controller.mapProperty('isSelected')).to.eql(test.e);
- controller.submit.restore();
});
});
});
@@ -765,6 +787,7 @@ describe('App.WizardStep4Controller', function () {
beforeEach(function() {
controller.clear();
controller.set('errorStack', []);
+ this.stub = sinon.stub(App, 'get');
});
afterEach(function () {
@@ -773,7 +796,7 @@ describe('App.WizardStep4Controller', function () {
cases.forEach(function (item) {
it(item.title, function () {
- sinon.stub(App, 'get').withArgs('currentStackName').returns(item.currentStackName).
+ this.stub.withArgs('currentStackName').returns(item.currentStackName).
withArgs('currentStackVersionNumber').returns(item.currentStackVersionNumber);
controller.set('content', generateSelectedServicesContent(item.services));
var spark = controller.findProperty('serviceName', 'SPARK');
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/controllers/wizard/step5_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step5_test.js b/ambari-web/test/controllers/wizard/step5_test.js
index 6f2e0e1..09da19e 100644
--- a/ambari-web/test/controllers/wizard/step5_test.js
+++ b/ambari-web/test/controllers/wizard/step5_test.js
@@ -293,21 +293,30 @@ describe('App.WizardStep5Controller', function () {
]);
tests.forEach(function (test) {
- it(test.m, function () {
- sinon.stub(App.StackServiceComponent, 'find', function () {
- return test.serviceComponents;
+ describe(test.m, function () {
+
+ beforeEach(function () {
+ sinon.stub(App.StackServiceComponent, 'find', function () {
+ return test.serviceComponents;
+ });
+ c.reopen({
+ content: Em.Object.create({
+ controllerName: test.controllerName
+ }),
+ selectedServicesMasters: test.selectedServicesMasters,
+ hosts: test.hosts
+ });
+ c.updateComponent(test.componentName);
});
- c.reopen({
- content: Em.Object.create({
- controllerName: test.controllerName
- }),
- selectedServicesMasters: test.selectedServicesMasters,
- hosts: test.hosts
+
+ afterEach(function () {
+ App.StackServiceComponent.find.restore();
});
- c.updateComponent(test.componentName);
- App.StackServiceComponent.find.restore();
+
Em.keys(test.e).forEach(function (k) {
- expect(c.last(test.componentName).get(k)).to.equal(test.e[k]);
+ it(k, function () {
+ expect(c.last(test.componentName).get(k)).to.equal(test.e[k]);
+ });
});
});
@@ -372,32 +381,52 @@ describe('App.WizardStep5Controller', function () {
}
]);
tests.forEach(function (test) {
- beforeEach(function () {
- App.reopen({isHaEnabled: test.isHaEnabled});
- });
- it(test.m, function () {
- modelSetup.setupStackServiceComponent();
- sinon.stub(App.StackService, 'find', function () {
- return test.services;
+ describe(test.m, function () {
+
+ beforeEach(function () {
+ sinon.stub(App, 'get').withArgs('isHaEnabled').returns(test.isHaEnabled);
+ sinon.stub(App.StackService, 'find', function () {
+ return test.services;
+ });
+ modelSetup.setupStackServiceComponent();
+ c.reopen({
+ content: Em.Object.create({
+ services: test.services,
+ controllerName: test.controllerName,
+ reassign: {component_name: test.component_name}
+ })
+ });
+ c.renderComponents(test.masterComponents);
});
- App.set('isHaEnabled', test.isHaEnabled);
- c.reopen({
- content: Em.Object.create({
- services: test.services,
- controllerName: test.controllerName,
- reassign: {component_name: test.component_name}
- })
+
+ afterEach(function () {
+ App.get.restore();
+ App.StackService.find.restore();
+ modelSetup.cleanStackServiceComponent();
});
- c.renderComponents(test.masterComponents);
- App.StackService.find.restore();
- modelSetup.cleanStackServiceComponent();
- expect(c.get('selectedServicesMasters').mapProperty('component_name')).to.eql(test.e.selectedServicesMasters);
- expect(c.get('servicesMasters').mapProperty('component_name')).to.eql(test.e.servicesMasters);
- expect(c.get('selectedServicesMasters').mapProperty('showRemoveControl')).to.eql(test.e.showRemoveControl);
- expect(c.get('selectedServicesMasters').mapProperty('serviceComponentId')).to.eql(test.e.serviceComponentId);
- if (c.get('isReasignController')) {
- expect(c.get('servicesMasters').mapProperty('isInstalled')).to.eql(test.e.isInstalled);
- }
+
+ it('all selectedServicesMasters.component_name are valid', function () {
+ expect(c.get('selectedServicesMasters').mapProperty('component_name')).to.eql(test.e.selectedServicesMasters);
+ });
+
+ it('all servicesMasters.component_name are valid', function () {
+ expect(c.get('servicesMasters').mapProperty('component_name')).to.eql(test.e.servicesMasters);
+ });
+
+ it('all showRemoveControl are valid', function () {
+ expect(c.get('selectedServicesMasters').mapProperty('showRemoveControl')).to.eql(test.e.showRemoveControl);
+ });
+
+ it('all serviceComponentId are valid', function () {
+ expect(c.get('selectedServicesMasters').mapProperty('serviceComponentId')).to.eql(test.e.serviceComponentId);
+ });
+
+ it('servicesMasters.@each.isInstalled is valid', function () {
+ if (c.get('isReasignController')) {
+ expect(c.get('servicesMasters').mapProperty('isInstalled')).to.eql(test.e.isInstalled);
+ }
+ });
+
});
});
});
@@ -528,15 +557,34 @@ describe('App.WizardStep5Controller', function () {
}
]);
tests.forEach(function (test) {
- it(test.m, function () {
- c.set('selectedServicesMasters', test.selectedServicesMasters);
- c.set('hosts', test.hosts);
- expect(c.removeComponent(test.componentName, test.serviceComponentId)).to.equal(test.e);
+ describe(test.m, function () {
+
+ beforeEach(function () {
+ c.set('selectedServicesMasters', JSON.parse(JSON.stringify(test.selectedServicesMasters)));
+ c.set('hosts', test.hosts);
+ this.result = c.removeComponent(test.componentName, test.serviceComponentId);
+ });
+
+ it('removeComponent returns ' + test.e, function () {
+ expect(this.result).to.equal(test.e);
+ });
+
if (test.e) {
- expect(c.get('selectedServicesMasters.lastObject.showRemoveControl')).to.equal(test.showRemoveControl);
- expect(c.get('selectedServicesMasters.lastObject.showAddControl')).to.equal(test.showAddControl);
- expect(c.get('componentToRebalance')).to.equal(test.componentName);
- expect(c.get('lastChangedComponent')).to.equal(test.componentName);
+ it('showRemoveControl is correct', function () {
+ expect(c.get('selectedServicesMasters.lastObject.showRemoveControl')).to.equal(test.showRemoveControl);
+ });
+
+ it('showAddControl is correct', function () {
+ expect(c.get('selectedServicesMasters.lastObject.showAddControl')).to.equal(test.showAddControl);
+ });
+
+ it('componentToRebalance is correct', function () {
+ expect(c.get('componentToRebalance')).to.equal(test.componentName);
+ });
+
+ it('lastChangedComponent is correct', function () {
+ expect(c.get('lastChangedComponent')).to.equal(test.componentName);
+ });
}
})
});
@@ -641,17 +689,26 @@ describe('App.WizardStep5Controller', function () {
]
}
]).forEach(function (test) {
- it(test.m, function () {
- c.reopen({
- selectedServicesMasters: test.selectedServicesMasters,
- hosts: test.hosts
+ describe(test.m, function () {
+ var result;
+ beforeEach(function () {
+ c.reopen({
+ selectedServicesMasters: test.selectedServicesMasters,
+ hosts: test.hosts
+ });
+ result = c.get('masterHostMapping');
});
- var result = c.get('masterHostMapping');
- expect(result.length).to.equal(test.e.length);
- result.forEach(function (r, i) {
- expect(r.get('host_name')).to.equal(test.e[i].host_name);
- expect(r.get('masterServices.length')).to.equal(test.e[i].masterServices.length);
- expect(r.get('hostInfo')).to.be.an.object;
+
+ it('all needed hosts are mapped', function () {
+ expect(result.length).to.equal(test.e.length);
+ });
+
+ it('all needed hosts have valid data', function () {
+ result.forEach(function (r, i) {
+ expect(r.get('host_name')).to.equal(test.e[i].host_name);
+ expect(r.get('masterServices.length')).to.equal(test.e[i].masterServices.length);
+ expect(r.get('hostInfo')).to.be.an.object;
+ });
});
});
});
@@ -959,13 +1016,20 @@ describe('App.WizardStep5Controller', function () {
}
}
]).forEach(function (test, i) {
- it('test #' + i, function () {
- sinon.stub(App.StackServiceComponent, 'find', function () {
- return test.stackServiceComponents;
+ describe('test #' + i, function () {
+
+ beforeEach(function () {
+ sinon.stub(App.StackServiceComponent, 'find', function () {
+ return test.stackServiceComponents;
+ });
+ c.set('mastersToMove', test.mastersToMove);
+ c.set('content', {controllerName: test.controllerName});
});
- c.set('mastersToMove', test.mastersToMove);
- c.set('content', {controllerName: test.controllerName});
- expect(c.createComponentInstallationObject(test.fullComponent, test.hostName, test.savedComponent)).to.eql(test.e);
+
+ it('component-object is valid', function () {
+ expect(c.createComponentInstallationObject(test.fullComponent, test.hostName, test.savedComponent)).to.eql(test.e);
+ });
+
});
});
@@ -1122,7 +1186,7 @@ describe('App.WizardStep5Controller', function () {
App.HostComponent.find.restore();
});
- it('should map messages to generalErrorMessages, generalWarningMessages', function() {
+ describe('should map messages to generalErrorMessages, generalWarningMessages', function() {
var data = [
{
@@ -1159,14 +1223,31 @@ describe('App.WizardStep5Controller', function () {
Em.Object.create({selectedHost: 'h2', component_name: 'c2'})
];
- c.set('servicesMasters', servicesMasters);
- c.updateValidationsSuccessCallback({resources: [{items: data}]});
+ beforeEach(function () {
+ c.set('servicesMasters', servicesMasters);
+ c.updateValidationsSuccessCallback({resources: [{items: data}]});
+ });
+
+ it('submitDisabled is false', function () {
+ expect(c.get('submitDisabled')).to.equal(false);
+ });
+
+ it('errorMessage for c1 is `m1`', function () {
+ expect(c.get('servicesMasters').findProperty('component_name', 'c1').get('errorMessage')).to.equal('m1');
+ });
+
+ it('errorMessage for c2 is `m2`', function () {
+ expect(c.get('servicesMasters').findProperty('component_name', 'c2').get('warnMessage')).to.equal('m2');
+ });
+
+ it('no general errors', function () {
+ expect(c.get('generalErrorMessages')).to.be.empty;
+ });
+
+ it('no general warnings', function () {
+ expect(c.get('generalWarningMessages')).to.be.empty;
+ });
- expect(c.get('submitDisabled')).to.equal(false);
- expect(c.get('servicesMasters').findProperty('component_name', 'c1').get('errorMessage')).to.equal('m1');
- expect(c.get('servicesMasters').findProperty('component_name', 'c2').get('warnMessage')).to.equal('m2');
- expect(c.get('generalErrorMessages')).to.be.empty;
- expect(c.get('generalWarningMessages')).to.be.empty;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/controllers/wizard/step6_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step6_test.js b/ambari-web/test/controllers/wizard/step6_test.js
index 24c3153..1654958 100644
--- a/ambari-web/test/controllers/wizard/step6_test.js
+++ b/ambari-web/test/controllers/wizard/step6_test.js
@@ -671,7 +671,7 @@ describe('App.WizardStep6Controller', function () {
});
describe('#clearError', function () {
- it('true if is one of checkboxes checked false', function () {
+ it('both checkboxes are checked', function () {
var hosts = Em.A([
Em.Object.create({
checkboxes: Em.A([
@@ -696,6 +696,7 @@ describe('App.WizardStep6Controller', function () {
controller.clearError();
expect(controller.get('errorMessage')).to.equal('');
});
+
it('true if is one of checkboxes checked false', function () {
var hosts = Em.A([
Em.Object.create({
@@ -1553,20 +1554,36 @@ describe('App.WizardStep6Controller', function () {
});
cases.forEach(function (item) {
- it(item.controllerName, function () {
- controller.set('hosts', item.hosts);
- controller.set('content.controllerName', item.controllerName);
- controller.callServerSideValidation();
- expect(controller.get('content.recommendationsHostGroups.blueprint.host_groups.length')).to.equal(expectedHostGroups.length);
- expect(controller.get('content.recommendationsHostGroups.blueprint_cluster_binding.host_groups.length')).to.equal(expectedHostGroups.length);
- controller.get('content.recommendationsHostGroups.blueprint.host_groups').forEach(function (group, index) {
- expect(group.components.mapProperty('name').sort()).to.eql(item.expected[index]);
+ describe(item.controllerName, function () {
+
+ beforeEach(function () {
+ controller.set('hosts', item.hosts);
+ controller.set('content.controllerName', item.controllerName);
+ controller.callServerSideValidation();
});
+
+ it('blueprint.host_groups count is correct', function () {
+ expect(controller.get('content.recommendationsHostGroups.blueprint.host_groups.length')).to.equal(expectedHostGroups.length);
+ });
+
+ it('blueprint_cluster_binding.host_groups count is correct', function () {
+ expect(controller.get('content.recommendationsHostGroups.blueprint_cluster_binding.host_groups.length')).to.equal(expectedHostGroups.length);
+ });
+
+ it('components are valid for each group', function () {
+ controller.get('content.recommendationsHostGroups.blueprint.host_groups').forEach(function (group, index) {
+ expect(group.components.mapProperty('name').sort()).to.eql(item.expected[index]);
+ });
+ });
+
expectedHostGroups.forEach(function (group) {
- var bpGroup = controller.get('content.recommendationsHostGroups.blueprint_cluster_binding.host_groups').findProperty('name', group.name);
- expect(bpGroup.hosts).to.have.length(1);
- expect(bpGroup.hosts[0].fqdn).to.equal(group.fqdn);
+ it(group.name, function () {
+ var bpGroup = controller.get('content.recommendationsHostGroups.blueprint_cluster_binding.host_groups').findProperty('name', group.name);
+ expect(bpGroup.hosts).to.have.length(1);
+ expect(bpGroup.hosts[0].fqdn).to.equal(group.fqdn);
+ });
});
+
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/controllers/wizard/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js
index 19c0196..3c23c54 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -674,6 +674,7 @@ describe('App.InstallerStep7Controller', function () {
});
describe('#_setOverrides', function () {
+
it('shouldn\'t update config if no selectedConfigGroup', function () {
installerStep7Controller.reopen({
selectedConfigGroup: null
@@ -682,6 +683,7 @@ describe('App.InstallerStep7Controller', function () {
var updatedConfig = installerStep7Controller._setOverrides(config, []);
expect(updatedConfig.get('overrides')).to.be.null;
});
+
it('no overrideToAdd', function () {
var isDefault = true,
name = 'n1',
@@ -702,6 +704,7 @@ describe('App.InstallerStep7Controller', function () {
expect(updatedConfig.get('overrides').everyProperty('isEditable', !isDefault)).to.equal(true);
expect(updatedConfig.get('overrides').everyProperty('parentSCP.flag', 'flag')).to.equal(true);
});
+
it('overrideToAdd exists', function () {
var isDefault = true,
name = 'n1',
@@ -727,6 +730,7 @@ describe('App.InstallerStep7Controller', function () {
});
describe('#switchConfigGroupConfigs', function () {
+
it('if selectedConfigGroup is null, serviceConfigs shouldn\'t be changed', function () {
installerStep7Controller.reopen({
selectedConfigGroup: null,
@@ -739,7 +743,9 @@ describe('App.InstallerStep7Controller', function () {
installerStep7Controller.switchConfigGroupConfigs();
expect(installerStep7Controller.get('serviceConfigs.configs').everyProperty('overrides.length', 0)).to.equal(true);
});
- it('should set configs for serviceConfigs', function () {
+
+ describe('should set configs for serviceConfigs', function () {
+
var configGroups = [
Em.Object.create({
properties: [
@@ -748,27 +754,44 @@ describe('App.InstallerStep7Controller', function () {
]
})
];
- sinon.stub(installerStep7Controller, '_getDisplayedConfigGroups', function () {
- return configGroups;
+
+ beforeEach(function () {
+ sinon.stub(installerStep7Controller, '_getDisplayedConfigGroups', function () {
+ return configGroups;
+ });
+ sinon.stub(installerStep7Controller, '_setEditableValue', function (config) {
+ config.set('isEditable', true);
+ return config;
+ });
+ installerStep7Controller.reopen({
+ selectedConfigGroup: Em.Object.create({isDefault: true, name: 'g1'}),
+ content: {services: []},
+ selectedService: {configs: Em.A([Em.Object.create({name: 'g1', overrides: [], properties: []}), Em.Object.create({name: 'g2', overrides: []})])},
+ serviceConfigs: {configs: [Em.Object.create({name: 'g1'})]}
+ });
+ installerStep7Controller.switchConfigGroupConfigs();
+ this.configs = installerStep7Controller.get('selectedService.configs');
});
- sinon.stub(installerStep7Controller, '_setEditableValue', function (config) {
- config.set('isEditable', true);
- return config;
+
+ afterEach(function () {
+ installerStep7Controller._getDisplayedConfigGroups.restore();
+ installerStep7Controller._setEditableValue.restore();
});
- installerStep7Controller.reopen({
- selectedConfigGroup: Em.Object.create({isDefault: true, name: 'g1'}),
- content: {services: []},
- selectedService: {configs: Em.A([Em.Object.create({name: 'g1', overrides: [], properties: []}), Em.Object.create({name: 'g2', overrides: []})])},
- serviceConfigs: {configs: [Em.Object.create({name: 'g1'})]}
+
+ it('g1 has 1 override', function () {
+ expect(this.configs.findProperty('name', 'g1').get('overrides').length).to.equal(1);
});
- installerStep7Controller.switchConfigGroupConfigs();
- var configs = installerStep7Controller.get('selectedService.configs');
- expect(configs.findProperty('name', 'g1').get('overrides').length).to.equal(1);
- expect(configs.findProperty('name', 'g2').get('overrides').length).to.equal(1);
- expect(configs.everyProperty('isEditable', true)).to.equal(true);
- installerStep7Controller._getDisplayedConfigGroups.restore();
- installerStep7Controller._setEditableValue.restore();
+
+ it('g2 has 1 override', function () {
+ expect(this.configs.findProperty('name', 'g2').get('overrides').length).to.equal(1);
+ });
+
+ it('all configs are editable', function () {
+ expect(this.configs.everyProperty('isEditable', true)).to.equal(true);
+ });
+
});
+
});
describe('#selectProperService', function () {
@@ -792,23 +815,32 @@ describe('App.InstallerStep7Controller', function () {
e: 'n3'
}
]).forEach(function (test) {
- it(test.name, function () {
- sinon.stub(installerStep7Controller, 'selectedServiceObserver', Em.K);
- installerStep7Controller.reopen({
- wizardController: Em.Object.create({
- name: test.name
- }),
- stepConfigs: test.stepConfigs
+ describe(test.name, function () {
+
+ beforeEach(function () {
+ sinon.stub(installerStep7Controller, 'selectedServiceObserver', Em.K);
+ installerStep7Controller.reopen({
+ wizardController: Em.Object.create({
+ name: test.name
+ }),
+ stepConfigs: test.stepConfigs
+ });
+ installerStep7Controller.selectProperService();
+ });
+
+ afterEach(function () {
+ installerStep7Controller.selectedServiceObserver.restore();
+ });
+
+ it('selected service name is valid', function () {
+ expect(installerStep7Controller.get('selectedService.name')).to.equal(test.e);
});
- installerStep7Controller.selectProperService();
- expect(installerStep7Controller.get('selectedService.name')).to.equal(test.e);
- installerStep7Controller.selectedServiceObserver.restore();
});
});
});
describe.skip('#setStepConfigs', function () {
-
+ var serviceConfigs;
beforeEach(function () {
installerStep7Controller.reopen({
content: {services: []},
@@ -818,45 +850,39 @@ describe('App.InstallerStep7Controller', function () {
}
})
});
+ sinon.stub(installerStep7Controller, 'renderConfigs', function () {
+ return serviceConfigs;
+ });
+ this.stub = sinon.stub(App, 'get');
});
afterEach(function () {
installerStep7Controller.renderConfigs.restore();
+ App.get.restore();
});
it('if wizard isn\'t addService, should set output of installerStep7Controller.renderConfigs', function () {
- var serviceConfigs = Em.A([
+ serviceConfigs = Em.A([
{serviceName:'HDFS', configs: []},
{}
]);
- sinon.stub(installerStep7Controller, 'renderConfigs', function () {
- return serviceConfigs;
- });
installerStep7Controller.set('wizardController.name', 'installerController');
installerStep7Controller.setStepConfigs([], []);
expect(installerStep7Controller.get('stepConfigs')).to.eql(serviceConfigs);
});
it('addServiceWizard used', function () {
- var serviceConfigs = Em.A([Em.Object.create({serviceName: 'HDFS', configs: []}), Em.Object.create({serviceName: 's2'})]);
+ serviceConfigs = Em.A([Em.Object.create({serviceName: 'HDFS', configs: []}), Em.Object.create({serviceName: 's2'})]);
installerStep7Controller.set('wizardController.name', 'addServiceController');
installerStep7Controller.reopen({selectedServiceNames: ['s2']});
- sinon.stub(installerStep7Controller, 'renderConfigs', function () {
- return serviceConfigs;
- });
installerStep7Controller.setStepConfigs([], []);
expect(installerStep7Controller.get('stepConfigs').everyProperty('showConfig', true)).to.equal(true);
expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 's2').get('selected')).to.equal(true);
});
it('addServiceWizard used, HA enabled', function () {
- sinon.stub(App, 'get', function (k) {
- if (k === 'isHaEnabled') {
- return true;
- }
- return Em.get(App, k);
- });
- var serviceConfigs = Em.A([
+ this.stub.withArgs('isHaEnabled').returns(true);
+ serviceConfigs = Em.A([
Em.Object.create({
serviceName: 'HDFS',
configs: [
@@ -871,23 +897,18 @@ describe('App.InstallerStep7Controller', function () {
);
installerStep7Controller.set('wizardController.name', 'addServiceController');
installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
- sinon.stub(installerStep7Controller, 'renderConfigs', function () {
- return serviceConfigs;
- });
installerStep7Controller.setStepConfigs([], []);
expect(installerStep7Controller.get('stepConfigs').everyProperty('showConfig', true)).to.equal(true);
expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 'HDFS').get('selected')).to.equal(true);
expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 'HDFS').get('configs').length).to.equal(5);
- App.get.restore();
});
it('not windows stack', function () {
- var s = sinon.stub(App, 'get');
- s.withArgs('isHadoopWindowsStack').returns(false);
- s.withArgs('isHaEnabled').returns(false);
+ this.stub.withArgs('isHadoopWindowsStack').returns(false);
+ this.stub.withArgs('isHaEnabled').returns(false);
- var serviceConfigs = Em.A([
+ serviceConfigs = Em.A([
Em.Object.create({
serviceName: 'HDFS',
configs: [
@@ -897,26 +918,17 @@ describe('App.InstallerStep7Controller', function () {
}),
Em.Object.create({serviceName: 's2'})]
);
-
installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
- sinon.stub(installerStep7Controller, 'renderConfigs', function () {
- return serviceConfigs;
- });
installerStep7Controller.setStepConfigs([], []);
-
expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 'HDFS').get('configs').length).to.equal(2);
-
- s.restore();
-
});
it('windows stack', function () {
- var s = sinon.stub(App, 'get');
- s.withArgs('isHadoopWindowsStack').returns(true);
- s.withArgs('isHaEnabled').returns(false);
+ this.stub.withArgs('isHadoopWindowsStack').returns(true);
+ this.stub.withArgs('isHaEnabled').returns(false);
- var serviceConfigs = Em.A([
+ serviceConfigs = Em.A([
Em.Object.create({
serviceName: 'HDFS',
configs: [
@@ -929,15 +941,10 @@ describe('App.InstallerStep7Controller', function () {
installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
installerStep7Controller.set('installedServiceNames',['HDFS', 's2', 's3']);
- sinon.stub(installerStep7Controller, 'renderConfigs', function () {
- return serviceConfigs;
- });
installerStep7Controller.setStepConfigs([], []);
expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 'HDFS').get('configs').length).to.equal(2);
- s.restore();
-
});
});
@@ -946,6 +953,10 @@ describe('App.InstallerStep7Controller', function () {
beforeEach(function () {
sinon.stub(installerStep7Controller, 'loadConfigGroups', Em.K);
sinon.stub(installerStep7Controller, 'loadInstalledServicesConfigGroups', Em.K);
+ sinon.stub(App, 'get', function (k) {
+ if (k === 'supports.hostOverridesInstaller') return false;
+ return Em.get(App, k);
+ });
});
afterEach(function () {
installerStep7Controller.loadConfigGroups.restore();
@@ -980,29 +991,37 @@ describe('App.InstallerStep7Controller', function () {
}
}
]).forEach(function (test) {
- it(test.m, function () {
- sinon.stub(App, 'get', function (k) {
- if (k === 'supports.hostOverridesInstaller') return test.hostOverridesInstaller;
- return Em.get(App, k);
- });
- installerStep7Controller.reopen({
- installedServiceNames: test.installedServiceNames,
- wizardController: {
- areInstalledConfigGroupsLoaded: test.areInstalledConfigGroupsLoaded
- }
+ describe(test.m, function () {
+
+ beforeEach(function () {
+ installerStep7Controller.reopen({
+ installedServiceNames: test.installedServiceNames,
+ wizardController: {
+ areInstalledConfigGroupsLoaded: test.areInstalledConfigGroupsLoaded
+ }
+ });
+ installerStep7Controller.checkHostOverrideInstaller();
});
- installerStep7Controller.checkHostOverrideInstaller();
+
if (test.e.loadConfigGroups) {
- expect(installerStep7Controller.loadConfigGroups.calledOnce).to.equal(true);
+ it('loadConfigGroups is called once', function () {
+ expect(installerStep7Controller.loadConfigGroups.calledOnce).to.equal(true);
+ });
}
else {
- expect(installerStep7Controller.loadConfigGroups.called).to.equal(false);
+ it('loadConfigGroups is not called', function () {
+ expect(installerStep7Controller.loadConfigGroups.called).to.equal(false);
+ });
}
if (test.e.loadInstalledServicesConfigGroups) {
- expect(installerStep7Controller.loadInstalledServicesConfigGroups.calledOnce).to.equal(true);
+ it('loadInstalledServicesConfigGroups is called once', function () {
+ expect(installerStep7Controller.loadInstalledServicesConfigGroups.calledOnce).to.equal(true);
+ });
}
else {
- expect(installerStep7Controller.loadInstalledServicesConfigGroups.called).to.equal(false);
+ it('loadInstalledServicesConfigGroups is not called', function () {
+ expect(installerStep7Controller.loadInstalledServicesConfigGroups.called).to.equal(false);
+ });
}
});
});
@@ -1081,7 +1100,9 @@ describe('App.InstallerStep7Controller', function () {
}
}
});
+ installerStep7Controller.applyServicesConfigs([{name: 'configs'}]);
});
+
afterEach(function () {
App.config.fileConfigsIntoTextarea.restore();
installerStep7Controller.loadServerSideConfigsRecommendations.restore();
@@ -1091,11 +1112,16 @@ describe('App.InstallerStep7Controller', function () {
App.StackService.find.restore();
});
- it('should run some methods' , function () {
- installerStep7Controller.applyServicesConfigs([{name: 'configs'}]);
+ it('loadServerSideConfigsRecommendations is called once' , function () {
expect(installerStep7Controller.loadServerSideConfigsRecommendations.calledOnce).to.equal(true);
+ });
+ it('isRecommendedLoaded is true' , function () {
expect(installerStep7Controller.get('isRecommendedLoaded')).to.equal(true);
+ });
+ it('checkHostOverrideInstalleris called once' , function () {
expect(installerStep7Controller.checkHostOverrideInstaller.calledOnce).to.equal(true);
+ });
+ it('selectProperServiceis called once' , function () {
expect(installerStep7Controller.selectProperService.calledOnce).to.equal(true);
});
@@ -1176,44 +1202,77 @@ describe('App.InstallerStep7Controller', function () {
expect(serviceConfigProperty.get('overrides')).to.eql(Em.A([]));
});
- it('host overrides not supported', function () {
+ describe('host overrides not supported', function () {
var serviceConfigProperty = Em.Object.create({
overrides: [
{value: 'new value'}
]
- }), component = Em.Object.create({selectedConfigGroup: {isDefault: false}});
- installerStep7Controller._updateOverridesForConfig(serviceConfigProperty, component);
- expect(serviceConfigProperty.get('overrides').length).to.equal(1);
- expect(serviceConfigProperty.get('overrides.firstObject.value')).to.equal('new value');
- expect(serviceConfigProperty.get('overrides.firstObject.isOriginalSCP')).to.equal(false);
- expect(serviceConfigProperty.get('overrides.firstObject.parentSCP')).to.eql(serviceConfigProperty);
- });
+ });
+ var component = Em.Object.create({selectedConfigGroup: {isDefault: false}});
- it('host overrides supported', function () {
- sinon.stub(App, 'get', function (k) {
- if (k === 'supports.hostOverrides') return true;
- return Em.get(App, k);
+ beforeEach(function () {
+ installerStep7Controller._updateOverridesForConfig(serviceConfigProperty, component);
});
- var serviceConfigProperty = Em.Object.create({
+ it('there is 1 override', function () {
+ expect(serviceConfigProperty.get('overrides').length).to.equal(1);
+ });
+ it('override value is valid', function () {
+ expect(serviceConfigProperty.get('overrides.firstObject.value')).to.equal('new value');
+ });
+ it('override is not original SCP', function () {
+ expect(serviceConfigProperty.get('overrides.firstObject.isOriginalSCP')).to.equal(false);
+ });
+ it('override is linked to parent', function () {
+ expect(serviceConfigProperty.get('overrides.firstObject.parentSCP')).to.eql(serviceConfigProperty);
+ });
+ });
+
+ describe('host overrides supported', function () {
+ var serviceConfigProperty;
+ var component;
+ beforeEach(function () {
+ sinon.stub(App, 'get', function (k) {
+ if (k === 'supports.hostOverrides') return true;
+ return Em.get(App, k);
+ });
+ serviceConfigProperty = Em.Object.create({
overrides: [
{value: 'new value', group: Em.Object.create({name: 'n1'})}
]
- }),
+ });
component = Em.Object.create({
selectedConfigGroup: {isDefault: true},
configGroups: Em.A([
Em.Object.create({name: 'n1', properties: []})
])
});
- installerStep7Controller._updateOverridesForConfig(serviceConfigProperty, component);
- App.get.restore();
- expect(serviceConfigProperty.get('overrides').length).to.equal(1);
- expect(serviceConfigProperty.get('overrides.firstObject.value')).to.equal('new value');
- expect(serviceConfigProperty.get('overrides.firstObject.isOriginalSCP')).to.equal(false);
- expect(serviceConfigProperty.get('overrides.firstObject.parentSCP')).to.eql(serviceConfigProperty);
- expect(component.get('configGroups.firstObject.properties').length).to.equal(1);
- expect(component.get('configGroups.firstObject.properties.firstObject.isEditable')).to.equal(false);
- expect(component.get('configGroups.firstObject.properties.firstObject.group')).to.be.object;
+ installerStep7Controller._updateOverridesForConfig(serviceConfigProperty, component);
+ });
+
+ afterEach(function () {
+ App.get.restore();
+ });
+ it('there is 1 override', function () {
+ expect(serviceConfigProperty.get('overrides').length).to.equal(1);
+ });
+ it('override.value is valid', function () {
+ expect(serviceConfigProperty.get('overrides.firstObject.value')).to.equal('new value');
+ });
+ it('override is not original SCP', function () {
+ expect(serviceConfigProperty.get('overrides.firstObject.isOriginalSCP')).to.equal(false);
+ });
+ it('override.parentSCP is valid', function () {
+ expect(serviceConfigProperty.get('overrides.firstObject.parentSCP')).to.eql(serviceConfigProperty);
+ });
+ it('there is 1 property in the config group', function () {
+ expect(component.get('configGroups.firstObject.properties').length).to.equal(1);
+ });
+ it('property in the config group is not editable', function () {
+ expect(component.get('configGroups.firstObject.properties.firstObject.isEditable')).to.equal(false);
+ });
+ it('property in the config group is linked to it', function () {
+ expect(component.get('configGroups.firstObject.properties.firstObject.group')).to.be.object;
+ });
});
});
@@ -1259,14 +1318,27 @@ describe('App.InstallerStep7Controller', function () {
],
installedServiceNames = ['HBASE', 'AMBARI_METRICS'];
- it('should handle properties with the same name', function () {
- controller.setInstalledServiceConfigs(configs, configsByTags, installedServiceNames);
- var properties = configs.filterProperty('name', 'hbase.client.scanner.caching');
- expect(properties).to.have.length(2);
- expect(properties.findProperty('filename', 'hbase-site.xml').value).to.equal('1500');
- expect(properties.findProperty('filename', 'hbase-site.xml').savedValue).to.equal('1500');
- expect(properties.findProperty('filename', 'ams-hbase-site.xml').value).to.equal('2500');
- expect(properties.findProperty('filename', 'ams-hbase-site.xml').savedValue).to.equal('2500');
+ describe('should handle properties with the same name', function () {
+ var properties;
+ beforeEach(function () {
+ controller.setInstalledServiceConfigs(configs, configsByTags, installedServiceNames);
+ properties = configs.filterProperty('name', 'hbase.client.scanner.caching');
+ });
+ it('there are 2 properties', function () {
+ expect(properties).to.have.length(2);
+ });
+ it('hbase-site/ value is valid', function () {
+ expect(properties.findProperty('filename', 'hbase-site.xml').value).to.equal('1500');
+ });
+ it('hbase-site/ savedValue is valid', function () {
+ expect(properties.findProperty('filename', 'hbase-site.xml').savedValue).to.equal('1500');
+ });
+ it('ams-hbase-site/ value is valid', function () {
+ expect(properties.findProperty('filename', 'ams-hbase-site.xml').value).to.equal('2500');
+ });
+ it('ams-hbase-site/ savedValue is valid', function () {
+ expect(properties.findProperty('filename', 'ams-hbase-site.xml').savedValue).to.equal('2500');
+ });
});
});
@@ -1370,13 +1442,22 @@ describe('App.InstallerStep7Controller', function () {
});
cases.forEach(function (item) {
- it(item.title, function () {
- var popup = installerStep7Controller.showDatabaseConnectionWarningPopup(serviceNames, dfd);
- expect(popup.get('body')).to.equal(Em.I18n.t('installer.step7.popup.database.connection.body').format(bodyMessage));
- popup[item.method]();
- expect(testObject.isResolved).to.equal(item.isResolved);
- expect(testObject.isRejected).to.equal(item.isRejected);
- expect(installerStep7Controller.get('submitButtonClicked')).to.equal(item.submitButtonClicked);
+ describe(item.title, function () {
+ var popup;
+ beforeEach(function () {
+ popup = installerStep7Controller.showDatabaseConnectionWarningPopup(serviceNames, dfd);
+ });
+
+ it('popup body is valid', function () {
+ expect(popup.get('body')).to.equal(Em.I18n.t('installer.step7.popup.database.connection.body').format(bodyMessage));
+ });
+
+ it('after ' + item.method + ' execution', function () {
+ popup[item.method]();
+ expect(testObject.isResolved).to.equal(item.isResolved);
+ expect(testObject.isRejected).to.equal(item.isRejected);
+ expect(installerStep7Controller.get('submitButtonClicked')).to.equal(item.submitButtonClicked);
+ });
});
});
@@ -1600,10 +1681,12 @@ describe('App.InstallerStep7Controller', function () {
describe('#showOozieDerbyWarning', function() {
var controller;
+
beforeEach(function() {
controller = App.WizardStep7Controller.create({});
sinon.stub(App.ModalPopup, 'show', Em.K);
});
+
afterEach(function() {
App.ModalPopup.show.restore();
});
@@ -1628,15 +1711,23 @@ describe('App.InstallerStep7Controller', function () {
m: 'Oozie selected, mysql database used, warning popup should be sk'
}
]).forEach(function(test) {
- it(test.m, function() {
- var callback = sinon.spy();
- sinon.stub(controller, 'findConfigProperty').returns(Em.Object.create({ value: test.databaseType}));
- controller.reopen({
- selectedServiceNames: test.selectedServiceNames
+ describe(test.m, function() {
+
+ beforeEach(function () {
+ sinon.stub(controller, 'findConfigProperty').returns(Em.Object.create({ value: test.databaseType}));
+ controller.reopen({
+ selectedServiceNames: test.selectedServiceNames
+ });
+ controller.showOozieDerbyWarningPopup(Em.K);
+ });
+
+ afterEach(function () {
+ controller.findConfigProperty.restore();
+ });
+
+ it('modal popup is shown needed number of times', function () {
+ expect(App.ModalPopup.show.calledOnce).to.equal(test.e);
});
- controller.showOozieDerbyWarningPopup(callback);
- controller.findConfigProperty.restore();
- expect(App.ModalPopup.show.calledOnce).to.equal(test.e);
});
});
});
[48/50] [abbrv] ambari git commit: AMBARI-14533. User should be able
to secure hawq after it has been deployed (odiachenko).
Posted by nc...@apache.org.
AMBARI-14533. User should be able to secure hawq after it has been deployed (odiachenko).
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/32c8cfa8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/32c8cfa8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/32c8cfa8
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 32c8cfa852e3cf618d8c0fcb471eb120d93e0b95
Parents: 1d76f95
Author: Oleksandr Diachenko <od...@pivotal.io>
Authored: Mon Jan 4 10:27:44 2016 -0800
Committer: Oleksandr Diachenko <od...@pivotal.io>
Committed: Mon Jan 4 10:28:00 2016 -0800
----------------------------------------------------------------------
.../HAWQ/2.0.0/package/scripts/master_helper.py | 13 ++++++++----
.../HAWQ/2.0.0/package/scripts/params.py | 21 ++++++++++++++++++++
2 files changed, 30 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/32c8cfa8/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py
index cf7dc77..e15b64d 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py
@@ -84,9 +84,10 @@ def __create_local_dirs():
Execute("chmod 700 {0}".format(params.hawq_master_dir), user=hawq_constants.root_user, timeout=hawq_constants.default_exec_timeout)
-def __create_hdfs_dirs():
+def __setup_hdfs_dirs():
"""
- Creates the required HDFS directories for HAWQ
+ Creates the required HDFS directories for HAWQ if they don't exist
+ or sets proper owner/mode if directory exists
"""
import params
@@ -97,6 +98,7 @@ def __create_hdfs_dirs():
action="create_on_execute",
owner=data_dir_owner,
group=hawq_constants.hawq_group,
+ recursive_chown = True,
mode=0755)
params.HdfsResource(None, action="execute")
@@ -105,7 +107,7 @@ def __init_active():
"""
Initializes the active master
"""
- __create_hdfs_dirs()
+ __setup_hdfs_dirs()
utils.exec_hawq_operation(hawq_constants.INIT, "{0} -a -v".format(hawq_constants.MASTER))
@@ -129,6 +131,9 @@ def __start_local_master():
"""
import params
component_name = __get_component_name()
+
+ __setup_hdfs_dirs()
+
utils.exec_hawq_operation(
hawq_constants.START,
"{0} -a -v".format(component_name),
@@ -203,4 +208,4 @@ def __is_active_master():
Finds if this node is the active master
"""
import params
- return params.hostname == common.get_local_hawq_site_property("hawq_master_address_host")
+ return params.hostname == common.get_local_hawq_site_property("hawq_master_address_host")
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/32c8cfa8/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/params.py
index 1c247ba..d92cc7f 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/params.py
@@ -16,11 +16,19 @@ See the License for the specific language governing permissions and
limitations under the License.
"""
+import os
import functools
from resource_management import Script
from resource_management.libraries.functions.default import default
from resource_management.libraries.resources.hdfs_resource import HdfsResource
+from resource_management.libraries.resources.execute_hadoop import ExecuteHadoop
from resource_management.libraries.functions import get_kinit_path
+from resource_management.libraries.functions import conf_select
+try:
+ from resource_management.libraries.functions import hdp_select as hadoop_select
+except ImportError:
+ from resource_management.libraries.functions import phd_select as hadoop_select
+
config = Script.get_config()
@@ -57,6 +65,9 @@ security_enabled = config['configurations']['cluster-env']['security_enabled']
hdfs_user_keytab = config['configurations']['hadoop-env']['hdfs_user_keytab']
kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))
hdfs_principal_name = config['configurations']['hadoop-env']['hdfs_principal_name']
+hadoop_conf_dir = conf_select.get_hadoop_conf_dir()
+hadoop_bin_dir = hadoop_select.get_hadoop_dir("bin")
+execute_path = os.environ['PATH'] + os.pathsep + hadoop_bin_dir
# HDFSResource partial function
HdfsResource = functools.partial(HdfsResource,
@@ -68,6 +79,16 @@ HdfsResource = functools.partial(HdfsResource,
hdfs_site=hdfs_site,
default_fs=default_fs)
+# ExecuteHadoop partial function
+ExecuteHadoop = functools.partial(ExecuteHadoop,
+ user=hdfs_superuser,
+ logoutput=True,
+ conf_dir=hadoop_conf_dir,
+ security_enabled=security_enabled,
+ kinit_path_local=kinit_path_local,
+ keytab=hdfs_user_keytab,
+ principal=hdfs_principal_name,
+ bin_dir=execute_path)
# YARN
# Note: YARN is not mandatory for HAWQ. It is required only when the users set HAWQ to use YARN as resource manager
[22/50] [abbrv] ambari git commit: AMBARI-14515. Improve Ambari UI UT
(p.3) (onechiporenko)
Posted by nc...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_test.js b/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_test.js
index 0ab3ea3..2babb01 100644
--- a/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_test.js
+++ b/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_test.js
@@ -77,38 +77,70 @@ describe('MainChartHeatmapMetric', function () {
});
describe('#generateSlot()', function () {
+
beforeEach(function () {
sinon.stub(mainChartHeatmapMetric, 'formatLegendNumber').returns('val');
sinon.stub(date, 'timingFormat').returns('time');
});
+
afterEach(function () {
mainChartHeatmapMetric.formatLegendNumber.restore();
date.timingFormat.restore();
});
- it('label suffix is empty', function () {
- expect(mainChartHeatmapMetric.generateSlot(0, 1, '', {r: 0, g: 0, b: 0})).to.eql(Em.Object.create({
- "from": "val",
- "to": "val",
- "label": "val - val",
- "cssStyle": "background-color:rgb(0,0,0)"
- }));
-
- expect(mainChartHeatmapMetric.formatLegendNumber.getCall(0).args).to.eql([0]);
- expect(mainChartHeatmapMetric.formatLegendNumber.getCall(1).args).to.eql([1]);
+
+ describe('label suffix is empty', function () {
+
+ beforeEach(function () {
+ this.result = mainChartHeatmapMetric.generateSlot(0, 1, '', {r: 0, g: 0, b: 0});
+ });
+
+ it('generateSlot result is valid', function () {
+ expect(this.result).to.eql(Em.Object.create({
+ "from": "val",
+ "to": "val",
+ "label": "val - val",
+ "cssStyle": "background-color:rgb(0,0,0)"
+ }));
+ });
+
+ it('formatLegendNumber 1st call with valid arguments', function () {
+ expect(mainChartHeatmapMetric.formatLegendNumber.getCall(0).args).to.eql([0]);
+ });
+
+ it('formatLegendNumber 2nd call with valid arguments', function () {
+ expect(mainChartHeatmapMetric.formatLegendNumber.getCall(1).args).to.eql([1]);
+ });
});
- it('label suffix is "ms"', function () {
- expect(mainChartHeatmapMetric.generateSlot(0, 1, 'ms', {r: 0, g: 0, b: 0})).to.eql(Em.Object.create({
- "from": "val",
- "to": "val",
- "label": "time - time",
- "cssStyle": "background-color:rgb(0,0,0)"
- }));
-
- expect(mainChartHeatmapMetric.formatLegendNumber.getCall(0).args).to.eql([0]);
- expect(mainChartHeatmapMetric.formatLegendNumber.getCall(1).args).to.eql([1]);
- expect(date.timingFormat.getCall(0).args).to.eql(['val', 'zeroValid']);
- expect(date.timingFormat.getCall(1).args).to.eql(['val', 'zeroValid']);
+
+ describe('label suffix is "ms"', function () {
+
+ beforeEach(function () {
+ this.result = mainChartHeatmapMetric.generateSlot(0, 1, 'ms', {r: 0, g: 0, b: 0});
+ });
+
+ it('generateSlot result is valid', function () {
+ expect(this.result).to.eql(Em.Object.create({
+ "from": "val",
+ "to": "val",
+ "label": "time - time",
+ "cssStyle": "background-color:rgb(0,0,0)"
+ }));
+ });
+ it('formatLegendNumber 1st call with valid arguments', function () {
+ expect(mainChartHeatmapMetric.formatLegendNumber.getCall(0).args).to.eql([0]);
+ });
+ it('formatLegendNumber 2nd call with valid arguments', function () {
+ expect(mainChartHeatmapMetric.formatLegendNumber.getCall(1).args).to.eql([1]);
+ });
+ it('timingFormat 1st call with valid arguments', function () {
+ expect(date.timingFormat.getCall(0).args).to.eql(['val', 'zeroValid']);
+ });
+ it('timingFormat 2nd call with valid arguments', function () {
+ expect(date.timingFormat.getCall(1).args).to.eql(['val', 'zeroValid']);
+ });
+
});
+
});
describe('#getHatchStyle()', function () {
@@ -159,6 +191,15 @@ describe('MainChartHeatmapMetric', function () {
});
describe('#hostToSlotMap', function () {
+
+ beforeEach(function () {
+ this.stub = sinon.stub(mainChartHeatmapMetric, 'calculateSlot');
+ });
+
+ afterEach(function () {
+ this.stub.restore();
+ });
+
it('hostToValueMap is null', function () {
mainChartHeatmapMetric.set('hostToValueMap', null);
mainChartHeatmapMetric.set('hostNames', []);
@@ -174,20 +215,18 @@ describe('MainChartHeatmapMetric', function () {
it('slot greater than -1', function () {
mainChartHeatmapMetric.set('hostToValueMap', {});
mainChartHeatmapMetric.set('hostNames', ['host1']);
- sinon.stub(mainChartHeatmapMetric, 'calculateSlot').returns(0);
+ this.stub.returns(0);
mainChartHeatmapMetric.propertyDidChange('hostToSlotMap');
expect(mainChartHeatmapMetric.get('hostToSlotMap')).to.eql({'host1': 0});
expect(mainChartHeatmapMetric.calculateSlot.calledWith({}, 'host1')).to.be.true;
- mainChartHeatmapMetric.calculateSlot.restore();
});
it('slot equal to -1', function () {
mainChartHeatmapMetric.set('hostToValueMap', {});
mainChartHeatmapMetric.set('hostNames', ['host1']);
- sinon.stub(mainChartHeatmapMetric, 'calculateSlot').returns('-1');
+ this.stub.returns('-1');
mainChartHeatmapMetric.propertyDidChange('hostToSlotMap');
expect(mainChartHeatmapMetric.get('hostToSlotMap')).to.be.empty;
expect(mainChartHeatmapMetric.calculateSlot.calledWith({}, 'host1')).to.be.true;
- mainChartHeatmapMetric.calculateSlot.restore();
});
});
@@ -272,10 +311,20 @@ describe('MainChartHeatmapMetric', function () {
];
testCases.forEach(function (test) {
- it(test.title, function () {
- sinon.stub(mainChartHeatmapMetric, 'get').withArgs('slotDefinitions').returns(test.data.slotDefinitions);
- expect(mainChartHeatmapMetric.calculateSlot(test.data.hostToValueMap, test.data.hostName)).to.equal(test.result);
- mainChartHeatmapMetric.get.restore();
+ describe(test.title, function () {
+
+ beforeEach(function () {
+ sinon.stub(mainChartHeatmapMetric, 'get').withArgs('slotDefinitions').returns(test.data.slotDefinitions);
+ });
+
+ afterEach(function () {
+ mainChartHeatmapMetric.get.restore();
+ });
+
+ it('calculateSlot result is valid', function () {
+ expect(mainChartHeatmapMetric.calculateSlot(test.data.hostToValueMap, test.data.hostName)).to.equal(test.result);
+ });
+
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/charts/heatmap_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/charts/heatmap_test.js b/ambari-web/test/controllers/main/charts/heatmap_test.js
index 1dca028..2e3f9de 100644
--- a/ambari-web/test/controllers/main/charts/heatmap_test.js
+++ b/ambari-web/test/controllers/main/charts/heatmap_test.js
@@ -53,11 +53,11 @@ describe('MainChartsHeatmapController', function () {
controller.set("inputMaximum", 'qwerty');
expect(controller.get('selectedMetric.maximumValue')).to.equal(100);
});
- it('should not set maximumValue if inputMaximum consists not only of digits', function () {
+ it('should not set maximumValue if inputMaximum consists not only of digits (2)', function () {
controller.set("inputMaximum", '100%');
expect(controller.get('selectedMetric.maximumValue')).to.equal(100);
});
- it('should set maximumValue if inputMaximum consists only of digits', function () {
+ it('should set maximumValue if inputMaximum consists only of digits (2)', function () {
controller.set("inputMaximum", 1000);
expect(controller.get('selectedMetric.maximumValue')).to.equal(1000);
})
@@ -361,16 +361,14 @@ describe('MainChartsHeatmapController', function () {
});
describe("#toList()", function() {
- it("", function() {
- var rackMap = {'r1': {
- name: 'r1',
- rackId: 'r1',
- hosts: [{rack: 'r1'}, {rack: 'r1'}]
- }};
- expect(controller.toList(rackMap)).to.eql([Em.Object.create({
- name: 'r1',
- rackId: 'r1',
- hosts: [{rack: 'r1'}, {rack: 'r1'}],
+ var rackMap = {'r1': {
+ name: 'r1',
+ rackId: 'r1',
+ hosts: [{rack: 'r1'}, {rack: 'r1'}]
+ }};
+
+ it('toList result is valid', function() {
+ expect(controller.toList(rackMap)).to.eql([Em.Object.create(rackMap.r1, {
isLoaded: false,
index: 0
})]);
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/dashboard/config_history_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/dashboard/config_history_controller_test.js b/ambari-web/test/controllers/main/dashboard/config_history_controller_test.js
index 24497b6..7467bca 100644
--- a/ambari-web/test/controllers/main/dashboard/config_history_controller_test.js
+++ b/ambari-web/test/controllers/main/dashboard/config_history_controller_test.js
@@ -113,30 +113,20 @@ describe('MainConfigHistoryController', function () {
}
}
});
+ sinon.stub(App, 'get', function(k) {
+ if ('testMode' === k) return false;
+ return Em.get(App, k);
+ });
});
afterEach(function () {
App.router.get.restore();
App.get.restore();
});
- it('testMode is true', function () {
- sinon.stub(App, 'get', function(k) {
- if ('testMode' === k) return true;
- return Em.get(App, k);
- });
- expect(controller.getUrl()).to.equal('/data/configurations/service_versions.json');
- });
it('query params is empty', function () {
- sinon.stub(App, 'get', function(k) {
- if ('testMode' === k) return false;
- return Em.get(App, k);
- });
+
expect(controller.getUrl()).to.equal('/api/v1/clusters/mycluster/configurations/service_config_versions?fields=service_config_version,user,group_id,group_name,is_current,createtime,service_name,hosts,service_config_version_note,is_cluster_compatible,stack_id&minimal_response=true');
});
it('query params is correct', function () {
- sinon.stub(App, 'get', function(k) {
- if ('testMode' === k) return false;
- return Em.get(App, k);
- });
expect(controller.getUrl({})).to.equal('/api/v1/clusters/mycluster/configurations/service_config_versions?params&fields=service_config_version,user,group_id,group_name,is_current,createtime,service_name,hosts,service_config_version_note,is_cluster_compatible,stack_id&minimal_response=true');
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/host/configs_service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/configs_service_test.js b/ambari-web/test/controllers/main/host/configs_service_test.js
index 616574c..d715df7 100644
--- a/ambari-web/test/controllers/main/host/configs_service_test.js
+++ b/ambari-web/test/controllers/main/host/configs_service_test.js
@@ -118,17 +118,23 @@ describe('App.MainHostServiceConfigsController', function () {
});
describe("#renderServiceConfigs()", function () {
+
+ beforeEach(function () {
+ sinon.stub(controller, 'filterServiceConfigs', function () {
+ this._super = Em.K;
+ });
+ });
+
+ afterEach(function () {
+ controller.filterServiceConfigs.restore();
+ });
+
it("should call filterServiceConfigs", function () {
var serviceConfigs = {
configCategories: 'val'
};
- sinon.stub(controller, 'filterServiceConfigs', function () {
- this._super = Em.K;
- });
controller.renderServiceConfigs(serviceConfigs);
-
expect(controller.filterServiceConfigs.calledWith('val')).to.be.true;
- controller.filterServiceConfigs.restore();
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index 947ec82..27bd38f 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -50,32 +50,51 @@ describe('App.MainHostDetailsController', function () {
App.TestAliases.testAsComputedFilterBy(getController(), 'serviceNonClientActiveComponents', 'serviceActiveComponents', 'isClient', false);
describe('#routeHome()', function () {
- it('transiotion to dashboard', function () {
+
+ beforeEach(function () {
sinon.stub(App.router, 'transitionTo', Em.K);
+ });
+
+ afterEach(function () {
+ App.router.transitionTo.restore();
+ });
+
+ it('transition to dashboard', function () {
controller.routeHome();
expect(App.router.transitionTo.calledWith('main.dashboard.index')).to.be.true;
- App.router.transitionTo.restore();
});
});
describe('#startComponent()', function () {
- it('call sendComponentCommand', function () {
- var event = {
- context: Em.Object.create({
- displayName: 'comp'
- })
- };
+
+ var event = {
+ context: Em.Object.create({
+ displayName: 'comp'
+ })
+ };
+
+ beforeEach(function () {
sinon.stub(App, 'showConfirmationPopup', function (callback) {
callback();
});
sinon.stub(controller, 'sendComponentCommand');
controller.startComponent(event);
+ });
+
+ afterEach(function () {
+ App.showConfirmationPopup.restore();
+ controller.sendComponentCommand.restore();
+ });
+
+ it('configmation popup is shown', function () {
expect(App.showConfirmationPopup.calledOnce).to.be.true;
+ });
+
+ it('call sendComponentCommand', function () {
expect(controller.sendComponentCommand.calledWith(Em.Object.create({
displayName: 'comp'
})), Em.I18n.t('requestInfo.startHostComponent') + " comp", App.HostComponentStatus.started).to.be.true;
- App.showConfirmationPopup.restore();
- controller.sendComponentCommand.restore();
+
});
});
@@ -181,65 +200,45 @@ describe('App.MainHostDetailsController', function () {
});
describe('#sendComponentCommandSuccessCallback()', function () {
+
+ var params = {
+ component: Em.Object.create({}),
+ HostRoles: {
+ state: App.HostComponentStatus.stopped
+ }
+ };
+
beforeEach(function () {
sinon.stub(controller, 'mimicWorkStatusChange', Em.K);
sinon.stub(controller, 'showBackgroundOperationsPopup', Em.K);
+ sinon.stub(App, 'get').withArgs('testMode').returns(false);
+ controller.sendComponentCommandSuccessCallback({}, {}, params);
});
+
afterEach(function () {
controller.showBackgroundOperationsPopup.restore();
controller.mimicWorkStatusChange.restore();
+ App.get.restore();
});
- it('testMode, starting component', function () {
- var params = {
- component: Em.Object.create({}),
- HostRoles: {
- state: App.HostComponentStatus.started
- }
- };
-
- App.set('testMode', true);
- controller.sendComponentCommandSuccessCallback({}, {}, params);
- expect(controller.mimicWorkStatusChange.calledWith(Em.Object.create({
- workStatus: App.HostComponentStatus.starting
- }), App.HostComponentStatus.starting, App.HostComponentStatus.started)).to.be.true;
- expect(controller.showBackgroundOperationsPopup.calledOnce).to.be.true;
- });
- it('testMode, stopping component', function () {
- var params = {
- component: Em.Object.create({}),
- HostRoles: {
- state: App.HostComponentStatus.stopped
- }
- };
-
- App.set('testMode', true);
- controller.sendComponentCommandSuccessCallback({}, {}, params);
- expect(controller.mimicWorkStatusChange.calledWith(Em.Object.create({
- workStatus: App.HostComponentStatus.stopping
- }), App.HostComponentStatus.stopping, App.HostComponentStatus.stopped)).to.be.true;
- expect(controller.showBackgroundOperationsPopup.calledOnce).to.be.true;
- });
- it('testMode, stopping component', function () {
- var params = {
- component: Em.Object.create({}),
- HostRoles: {
- state: App.HostComponentStatus.stopped
- }
- };
- App.set('testMode', false);
- controller.sendComponentCommandSuccessCallback({}, {}, params);
+ it('mimicWorkStatusChange is not called', function () {
expect(controller.mimicWorkStatusChange.called).to.be.false;
+ });
+ it('showBackgroundOperationsPopup is called once', function () {
expect(controller.showBackgroundOperationsPopup.calledOnce).to.be.true;
});
});
describe('#ajaxErrorCallback()', function () {
- it('call mainServiceItemController.ajaxErrorCallback', function () {
+ beforeEach(function () {
sinon.stub(controller, 'ajaxErrorCallback', Em.K);
+ });
+ afterEach(function () {
+ controller.ajaxErrorCallback.restore();
+ });
+ it('call mainServiceItemController.ajaxErrorCallback', function () {
controller.ajaxErrorCallback('request', 'ajaxOptions', 'error', 'opt', 'params');
expect(controller.ajaxErrorCallback.calledWith('request', 'ajaxOptions', 'error', 'opt', 'params')).to.be.true;
- controller.ajaxErrorCallback.restore();
});
});
@@ -252,6 +251,7 @@ describe('App.MainHostDetailsController', function () {
var bgController = {
showPopup: Em.K
};
+
beforeEach(function () {
var stub = sinon.stub(App.router, 'get');
stub.withArgs('userSettingsController').returns({
@@ -262,25 +262,28 @@ describe('App.MainHostDetailsController', function () {
stub.withArgs('backgroundOperationsController').returns(bgController);
sinon.spy(bgController, 'showPopup');
sinon.spy(mock, 'done');
+ this.callback = sinon.stub();
});
+
afterEach(function () {
bgController.showPopup.restore();
mock.done.restore();
App.router.get.restore();
});
+
it('initValue is true, callback is undefined', function () {
mock.initValue = true;
controller.showBackgroundOperationsPopup();
expect(mock.done.calledOnce).to.be.true;
expect(bgController.showPopup.calledOnce).to.be.true;
});
+
it('initValue is false, callback is defined', function () {
mock.initValue = false;
- var callback = sinon.stub();
- controller.showBackgroundOperationsPopup(callback);
+ controller.showBackgroundOperationsPopup(this.callback);
expect(mock.done.calledOnce).to.be.true;
expect(bgController.showPopup.calledOnce).to.be.false;
- expect(callback.calledOnce).to.be.true;
+ expect(this.callback.calledOnce).to.be.true;
});
});
@@ -901,6 +904,7 @@ describe('App.MainHostDetailsController', function () {
App.Service.find().clear();
expect(controller.constructConfigUrlParams(data)).to.eql([]);
});
+
it('isHaEnabled = true', function () {
App.store.load(App.Service, {
id: 'HDFS',
@@ -916,6 +920,7 @@ describe('App.MainHostDetailsController', function () {
});
App.set('currentStackVersion', 'HDP-2.0.1');
});
+
it('HBASE is installed', function () {
App.store.load(App.Service, {
id: 'HBASE',
@@ -926,6 +931,7 @@ describe('App.MainHostDetailsController', function () {
expect(controller.constructConfigUrlParams(data)).to.eql(['(type=hbase-site&tag=1)']);
App.Service.find().clear();
});
+
it('HIVE is installed', function () {
App.store.load(App.Service, {
id: 'HIVE',
@@ -935,6 +941,7 @@ describe('App.MainHostDetailsController', function () {
expect(controller.constructConfigUrlParams(data)).to.eql(['(type=webhcat-site&tag=1)', '(type=hive-site&tag=1)']);
App.Service.find().clear();
});
+
it('STORM is installed', function () {
App.store.load(App.Service, {
id: 'STORM',
@@ -944,6 +951,7 @@ describe('App.MainHostDetailsController', function () {
expect(controller.constructConfigUrlParams(data)).to.eql(['(type=storm-site&tag=1)']);
App.Service.find().clear();
});
+
it('YARN for 2.2 stack is installed', function () {
App.set('currentStackVersion', 'HDP-2.2.0');
App.store.load(App.Service, {
@@ -955,11 +963,20 @@ describe('App.MainHostDetailsController', function () {
App.set('currentStackVersion', 'HDP-2.0.1');
App.Service.find().clear();
});
- it('isRMHaEnabled true', function () {
- sinon.stub(App, 'get').withArgs('isRMHaEnabled').returns(true);
- var data = {Clusters: {desired_configs: {'yarn-site': {tag: 1}, 'zoo.cfg': {tag: 1}}}};
- expect(controller.constructConfigUrlParams(data)).to.eql(['(type=yarn-site&tag=1)', '(type=zoo.cfg&tag=1)']);
- App.get.restore();
+
+ describe('isRMHaEnabled true', function () {
+ beforeEach(function () {
+ sinon.stub(App, 'get').withArgs('isRMHaEnabled').returns(true);
+ });
+ afterEach(function () {
+ App.get.restore();
+ });
+
+ it('params are valid', function () {
+ var data = {Clusters: {desired_configs: {'yarn-site': {tag: 1}, 'zoo.cfg': {tag: 1}}}};
+ expect(controller.constructConfigUrlParams(data)).to.eql(['(type=yarn-site&tag=1)', '(type=zoo.cfg&tag=1)']);
+ });
+
});
});
@@ -1056,20 +1073,33 @@ describe('App.MainHostDetailsController', function () {
});
yarnCases.forEach(function (item) {
- it(item.title, function () {
+ describe(item.title, function () {
var servicesMock = item.isYARNInstalled ? [
{
serviceName: 'YARN'
}
] : [];
- sinon.stub(App, 'get').withArgs('isHadoop22Stack').returns(item.isHadoop22Stack).
- withArgs('isRMHaEnabled').returns(item.isRMHaEnabled);
- sinon.stub(App.Service, 'find').returns(servicesMock);
- controller.saveZkConfigs(yarnData);
- expect(controller.saveConfigsBatch.firstCall.args[0].someProperty('properties.yarn-site')).to.equal(item.shouldYarnSiteBeModified);
- expect(controller.saveConfigsBatch.firstCall.args[0].someProperty('properties_attributes.yarn-site')).to.equal(item.shouldYarnSiteBeModified);
- App.get.restore();
- App.Service.find.restore();
+
+ beforeEach(function () {
+ sinon.stub(App, 'get').withArgs('isHadoop22Stack').returns(item.isHadoop22Stack).
+ withArgs('isRMHaEnabled').returns(item.isRMHaEnabled);
+ sinon.stub(App.Service, 'find').returns(servicesMock);
+ controller.saveZkConfigs(yarnData);
+ });
+
+ afterEach(function () {
+ App.get.restore();
+ App.Service.find.restore();
+ });
+
+ it('some properties.yarn-site = true (' + item.shouldYarnSiteBeModified + ')', function () {
+ expect(controller.saveConfigsBatch.firstCall.args[0].someProperty('properties.yarn-site')).to.equal(item.shouldYarnSiteBeModified);
+ });
+
+ it('some properties_attributes.yarn-site = true (' + item.shouldYarnSiteBeModified + ')', function () {
+ expect(controller.saveConfigsBatch.firstCall.args[0].someProperty('properties_attributes.yarn-site')).to.equal(item.shouldYarnSiteBeModified);
+ });
+
});
});
@@ -1346,24 +1376,38 @@ describe('App.MainHostDetailsController', function () {
];
tests.forEach(function(test) {
- it(test.m, function() {
- if (test.appGetterStubs) {
- Em.keys(test.appGetterStubs).forEach(function(key) {
- sinon.stub(App, 'get').withArgs(key).returns(test.appGetterStubs[key]);
- });
- }
- if (test.ctrlStubs) {
- var stub = sinon.stub(controller, 'get');
- Em.keys(test.ctrlStubs).forEach(function(key) {
- stub.withArgs(key).returns(test.ctrlStubs[key]);
- });
- }
- sinon.stub(App.HostComponent, 'find').returns(test.hostComponentModel);
- controller.updateZkConfigs(test.configs);
- expect(test.configs).to.be.eql(test.e.configs);
- if (test.ctrlStubs) controller.get.restore();
- if (test.appGetterStubs) App.get.restore();
- App.HostComponent.find.restore();
+ describe(test.m, function() {
+
+ beforeEach(function() {
+ if (test.appGetterStubs) {
+ Em.keys(test.appGetterStubs).forEach(function(key) {
+ sinon.stub(App, 'get').withArgs(key).returns(test.appGetterStubs[key]);
+ });
+ }
+ if (test.ctrlStubs) {
+ var stub = sinon.stub(controller, 'get');
+ Em.keys(test.ctrlStubs).forEach(function(key) {
+ stub.withArgs(key).returns(test.ctrlStubs[key]);
+ });
+ }
+ sinon.stub(App.HostComponent, 'find').returns(test.hostComponentModel);
+ controller.updateZkConfigs(test.configs);
+ });
+
+ afterEach(function () {
+ if (test.ctrlStubs) {
+ controller.get.restore();
+ }
+ if (test.appGetterStubs) {
+ App.get.restore();
+ }
+ App.HostComponent.find.restore();
+ });
+
+ it('configs are mapped correctly', function () {
+ expect(test.configs).to.be.eql(test.e.configs);
+ });
+
});
});
});
@@ -1445,12 +1489,23 @@ describe('App.MainHostDetailsController', function () {
controller.runDecommission('host1', 'YARN');
expect(controller.doDecommission.calledWith('host1', 'YARN', "RESOURCEMANAGER", "NODEMANAGER")).to.be.true;
});
- it('HBASE service', function () {
- sinon.stub(controller, 'warnBeforeDecommission', Em.K);
- controller.runDecommission('host1', 'HBASE');
- expect(controller.warnBeforeDecommission.calledWith('host1')).to.be.true;
- controller.warnBeforeDecommission.restore();
+
+ describe('HBASE service', function () {
+
+ beforeEach(function () {
+ sinon.stub(controller, 'warnBeforeDecommission', Em.K);
+ });
+
+ afterEach(function () {
+ controller.warnBeforeDecommission.restore();
+ });
+ it('warnBeforeDecommission is called with valid arguments', function () {
+ controller.runDecommission('host1', 'HBASE');
+ expect(controller.warnBeforeDecommission.calledWith('host1')).to.be.true;
+ });
+
});
+
});
describe('#runRecommission()', function () {
@@ -1934,14 +1989,27 @@ describe('App.MainHostDetailsController', function () {
toDecommissionComponents: []
};
+ beforeEach(function () {
+ this.stub = sinon.stub(App.HostComponent, 'find').returns([{
+ id: 'TASKTRACKER_host1',
+ componentName: 'TASKTRACKER'
+ }]);;
+ });
+
+ afterEach(function () {
+ this.stub.restore();
+ });
+
it('content.hostComponents is null', function () {
controller.set('content', {hostComponents: null});
expect(controller.getHostComponentsInfo()).to.eql(result);
});
+
it('content.hostComponents is empty', function () {
controller.set('content', {hostComponents: []});
expect(controller.getHostComponentsInfo()).to.eql(result);
});
+
it('content.hostComponents has ZOOKEEPER_SERVER', function () {
App.HostComponent.find().clear();
controller.set('content', {
@@ -1953,15 +2021,8 @@ describe('App.MainHostDetailsController', function () {
});
expect(controller.getHostComponentsInfo().zkServerInstalled).to.be.true;
});
+
it('content.hostComponents has last component', function () {
- sinon.stub(App.HostComponent, 'find', function () {
- return [
- {
- id: 'TASKTRACKER_host1',
- componentName: 'TASKTRACKER'
- }
- ];
- });
controller.set('content', {
hostComponents: [Em.Object.create({
componentName: 'TASKTRACKER',
@@ -1971,17 +2032,9 @@ describe('App.MainHostDetailsController', function () {
})]
});
expect(controller.getHostComponentsInfo().lastComponents).to.eql(['TaskTracker']);
- App.HostComponent.find.restore();
});
+
it('content.hostComponents has master non-deletable component', function () {
- sinon.stub(App.HostComponent, 'find', function () {
- return [
- {
- id: 'TASKTRACKER_host1',
- componentName: 'TASKTRACKER'
- }
- ];
- });
controller.set('content', {
hostComponents: [Em.Object.create({
componentName: 'TASKTRACKER',
@@ -1993,17 +2046,9 @@ describe('App.MainHostDetailsController', function () {
});
expect(controller.getHostComponentsInfo().masterComponents).to.eql(['ZK1']);
expect(controller.getHostComponentsInfo().nonDeletableComponents).to.eql(['ZK1']);
- App.HostComponent.find.restore();
});
+
it('content.hostComponents has running component', function () {
- sinon.stub(App.HostComponent, 'find', function () {
- return [
- {
- id: 'TASKTRACKER_host1',
- componentName: 'TASKTRACKER'
- }
- ];
- });
controller.set('content', {
hostComponents: [Em.Object.create({
componentName: 'TASKTRACKER',
@@ -2013,17 +2058,9 @@ describe('App.MainHostDetailsController', function () {
})]
});
expect(controller.getHostComponentsInfo().runningComponents).to.eql(['ZK1']);
- App.HostComponent.find.restore();
});
+
it('content.hostComponents has non-deletable component', function () {
- sinon.stub(App.HostComponent, 'find', function () {
- return [
- {
- id: 'TASKTRACKER_host1',
- componentName: 'TASKTRACKER'
- }
- ];
- });
controller.set('content', {
hostComponents: [Em.Object.create({
componentName: 'TASKTRACKER',
@@ -2033,17 +2070,9 @@ describe('App.MainHostDetailsController', function () {
})]
});
expect(controller.getHostComponentsInfo().nonDeletableComponents).to.eql(['ZK1']);
- App.HostComponent.find.restore();
});
+
it('content.hostComponents has component with UNKNOWN state', function () {
- sinon.stub(App.HostComponent, 'find', function () {
- return [
- {
- id: 'TASKTRACKER_host1',
- componentName: 'TASKTRACKER'
- }
- ];
- });
controller.set('content', {
hostComponents: [Em.Object.create({
componentName: 'TASKTRACKER',
@@ -2053,8 +2082,8 @@ describe('App.MainHostDetailsController', function () {
})]
});
expect(controller.getHostComponentsInfo().unknownComponents).to.eql(['ZK1']);
- App.HostComponent.find.restore();
});
+
});
describe('#validateAndDeleteHost()', function () {
@@ -2171,16 +2200,22 @@ describe('App.MainHostDetailsController', function () {
});
describe('#confirmDeleteHost()', function () {
- it('Popup should be displayed', function () {
+
+ beforeEach(function () {
sinon.spy(App.ModalPopup, "show");
sinon.stub(controller, 'doDeleteHost');
+ });
+
+ afterEach(function () {
+ App.ModalPopup.show.restore();
+ controller.doDeleteHost.restore();
+ });
+ it('Popup should be displayed', function () {
var popup = controller.confirmDeleteHost({toDecommissionComponents:[]});
expect(App.ModalPopup.show.calledOnce).to.be.true;
popup.onPrimary();
expect(controller.doDeleteHost.calledOnce).to.be.true;
- App.ModalPopup.show.restore();
- controller.doDeleteHost.restore();
});
});
@@ -2550,11 +2585,18 @@ describe('App.MainHostDetailsController', function () {
});
describe('#refreshComponentConfigsSuccessCallback()', function () {
- it('call showBackgroundOperationsPopup', function () {
+
+ beforeEach(function () {
sinon.stub(controller, 'showBackgroundOperationsPopup', Em.K);
+ });
+
+ afterEach(function () {
+ controller.showBackgroundOperationsPopup.restore();
+ });
+
+ it('call showBackgroundOperationsPopup', function () {
controller.refreshComponentConfigsSuccessCallback();
expect(controller.showBackgroundOperationsPopup.calledOnce).to.be.true;
- controller.showBackgroundOperationsPopup.restore();
});
});
@@ -2562,24 +2604,25 @@ describe('App.MainHostDetailsController', function () {
beforeEach(function () {
sinon.stub(controller, 'removeObserver');
sinon.stub(controller, 'loadConfigs');
- sinon.stub(controller, 'isServiceMetricsLoaded', function (callback) {
- callback();
- });
+ sinon.stub(controller, 'isServiceMetricsLoaded', Em.clb);
+ this.stub = sinon.stub(App.router, 'get');
});
afterEach(function () {
controller.loadConfigs.restore();
controller.removeObserver.restore();
controller.isServiceMetricsLoaded.restore();
- App.router.get.restore();
+ this.stub.restore();
});
+
it('No operations of ZOOKEEPER_SERVER', function () {
- sinon.stub(App.router, 'get').withArgs('backgroundOperationsController.services').returns([]);
+ this.stub.withArgs('backgroundOperationsController.services').returns([]);
controller.checkZkConfigs();
expect(controller.removeObserver.called).to.be.false;
expect(controller.loadConfigs.called).to.be.false;
});
+
it('Operation of ZOOKEEPER_SERVER running', function () {
- sinon.stub(App.router, 'get').withArgs('backgroundOperationsController.services').returns([Em.Object.create({
+ this.stub.withArgs('backgroundOperationsController.services').returns([Em.Object.create({
id: 1,
isRunning: true
})]);
@@ -2588,17 +2631,28 @@ describe('App.MainHostDetailsController', function () {
expect(controller.removeObserver.called).to.be.false;
expect(controller.loadConfigs.called).to.be.false;
});
- it('Operation of ZOOKEEPER_SERVER finished', function () {
- sinon.stub(App.router, 'get').withArgs('backgroundOperationsController.services').returns([Em.Object.create({
- id: 1
- })]);
- var clock = sinon.useFakeTimers();
- controller.set('zkRequestId', 1);
- controller.checkZkConfigs();
- expect(controller.removeObserver.calledWith('App.router.backgroundOperationsController.serviceTimestamp', controller, controller.checkZkConfigs)).to.be.true;
- clock.tick(App.get('componentsUpdateInterval'));
- expect(controller.loadConfigs.calledOnce).to.be.true;
- clock.restore();
+
+ describe('Operation of ZOOKEEPER_SERVER finished', function () {
+
+ beforeEach(function () {
+ this.stub.withArgs('backgroundOperationsController.services').returns([Em.Object.create({
+ id: 1
+ })]);
+ this.clock = sinon.useFakeTimers();
+ controller.set('zkRequestId', 1);
+ controller.checkZkConfigs();
+ });
+
+ afterEach(function () {
+ this.clock.restore();
+ });
+
+ it('loadConfigs is called after `componentsUpdateInterval`', function () {
+ expect(controller.removeObserver.calledWith('App.router.backgroundOperationsController.serviceTimestamp', controller, controller.checkZkConfigs)).to.be.true;
+ this.clock.tick(App.get('componentsUpdateInterval'));
+ expect(controller.loadConfigs.calledOnce).to.be.true;
+ });
+
});
});
@@ -2613,21 +2667,15 @@ describe('App.MainHostDetailsController', function () {
beforeEach(function () {
sinon.stub(controller, 'showBackgroundOperationsPopup', Em.K);
sinon.stub(controller, 'mimicWorkStatusChange', Em.K);
+ sinon.stub(App, 'get').withArgs('testMode').returns(false);
});
afterEach(function () {
controller.mimicWorkStatusChange.restore();
controller.showBackgroundOperationsPopup.restore();
+ App.get.restore();
});
- it('testMode is true', function () {
- App.set('testMode', true);
- controller.installComponentSuccessCallback({}, {}, {component: "COMP"});
- expect(controller.mimicWorkStatusChange.calledWith("COMP", App.HostComponentStatus.installing, App.HostComponentStatus.stopped)).to.be.true;
- expect(controller.showBackgroundOperationsPopup.calledOnce).to.be.true;
- });
it('testMode is false', function () {
- App.set('testMode', false);
-
controller.installComponentSuccessCallback({}, {}, {component: "COMP"});
expect(controller.mimicWorkStatusChange.called).to.be.false;
expect(controller.showBackgroundOperationsPopup.calledOnce).to.be.true;
@@ -2635,21 +2683,35 @@ describe('App.MainHostDetailsController', function () {
});
describe('#showHbaseActiveWarning()', function () {
- it('popup should be displayed', function () {
+
+ beforeEach(function () {
sinon.spy(App.ModalPopup, "show");
- var popup = controller.showHbaseActiveWarning(Em.Object.create({service: {}}));
- expect(App.ModalPopup.show.calledOnce).to.be.true;
+ });
+
+ afterEach(function () {
App.ModalPopup.show.restore();
});
+
+ it('popup should be displayed', function () {
+ controller.showHbaseActiveWarning(Em.Object.create({service: {}}));
+ expect(App.ModalPopup.show.calledOnce).to.be.true;
+ });
});
describe('#updateHost()', function () {
- it('popup should be displayed', function () {
+
+ beforeEach(function () {
sinon.stub(batchUtils, "infoPassiveState", Em.K);
+ });
+
+ afterEach(function () {
+ batchUtils.infoPassiveState.restore();
+ });
+
+ it('popup should be displayed', function () {
controller.updateHost({}, {}, {passive_state: 'state'});
expect(controller.get('content.passiveState')).to.equal('state');
expect(batchUtils.infoPassiveState.calledWith('state')).to.be.true;
- batchUtils.infoPassiveState.restore();
});
});
@@ -2671,16 +2733,24 @@ describe('App.MainHostDetailsController', function () {
});
describe('#updateHostComponent()', function () {
- it('popup should be displayed', function () {
+
+ var params = {
+ component: Em.Object.create(),
+ passive_state: 'state'
+ };
+
+ beforeEach(function () {
sinon.stub(batchUtils, "infoPassiveState", Em.K);
- var params = {
- component: Em.Object.create(),
- passive_state: 'state'
- };
+ });
+
+ afterEach(function () {
+ batchUtils.infoPassiveState.restore();
+ });
+
+ it('popup should be displayed', function () {
controller.updateHostComponent({}, {}, params);
expect(params.component.get('passiveState')).to.equal('state');
expect(batchUtils.infoPassiveState.calledWith('state')).to.be.true;
- batchUtils.infoPassiveState.restore();
});
});
@@ -2833,40 +2903,69 @@ describe('App.MainHostDetailsController', function () {
});
cases.forEach(function (item) {
- it(item.title, function () {
- sinon.stub(controller, 'checkComponentDependencies', function (componentName, params) {
- return item.dependencies[componentName];
+ describe(item.title, function () {
+
+ beforeEach(function () {
+ sinon.stub(controller, 'checkComponentDependencies', function (componentName, params) {
+ return item.dependencies[componentName];
+ });
+ controller.installClients({
+ context: item.context
+ });
+ });
+
+ it('getSecurityType is ' + (item.getKDCSessionStateCalled ? '' : 'not') + ' called', function() {
+ expect(App.get('router.mainAdminKerberosController').getSecurityType.calledOnce).to.equal(item.getKDCSessionStateCalled);
+ });
+
+ it('getKDCSessionState is ' + (item.getKDCSessionStateCalled ? '' : 'not') + ' called', function() {
+ expect(App.get('router.mainAdminKerberosController').getKDCSessionState.calledOnce).to.equal(item.getKDCSessionStateCalled);
+ });
+
+ it('sendComponentCommand is ' + (item.sendComponentCommandCalled ? '' : 'not') + ' called', function() {
+ expect(controller.sendComponentCommand.calledOnce).to.equal(item.sendComponentCommandCalled);
});
- controller.installClients({
- context: item.context
+
+ it('showAlertPopup is ' + (item.showAlertPopupCalled ? '' : 'not') + ' called', function() {
+ expect(App.showAlertPopup.calledOnce).to.equal(item.showAlertPopupCalled);
});
- expect(App.get('router.mainAdminKerberosController').getSecurityType.calledOnce).to.equal(item.getKDCSessionStateCalled);
- expect(App.get('router.mainAdminKerberosController').getKDCSessionState.calledOnce).to.equal(item.getKDCSessionStateCalled);
- expect(controller.sendComponentCommand.calledOnce).to.equal(item.sendComponentCommandCalled);
- expect(App.showAlertPopup.calledOnce).to.equal(item.showAlertPopupCalled);
+
});
});
});
describe("#executeCustomCommandSuccessCallback()", function () {
- it("BO popup should be shown", function () {
- var mock = {
- showPopup: Em.K
- };
- sinon.stub(App.router, 'get').returns(mock);
- sinon.spy(mock, 'showPopup');
- var data = {
+
+ var data;
+ var mock;
+
+ beforeEach(function () {
+ data = {
Requests: {
id: 1
}
};
+ mock = {
+ showPopup: Em.K
+ };
+ sinon.stub(App.router, 'get').returns(mock);
+ sinon.spy(mock, 'showPopup');
controller.executeCustomCommandSuccessCallback(data, {}, {});
+ });
- expect(App.router.get.calledWith('backgroundOperationsController')).to.be.true;
- expect(mock.showPopup.calledOnce).to.be.true;
+ afterEach(function () {
App.router.get.restore();
mock.showPopup.restore();
});
+
+ it('App.router.get is called with `backgroundOperationsController`', function () {
+ expect(App.router.get.calledWith('backgroundOperationsController')).to.be.true;
+ });
+
+ it('showPopup is called once', function () {
+ expect(mock.showPopup.calledOnce).to.be.true;
+ });
+
});
describe("#executeCustomCommandErrorCallback()", function () {
@@ -2893,7 +2992,7 @@ describe('App.MainHostDetailsController', function () {
expect(App.showAlertPopup.calledWith(Em.I18n.t('services.service.actions.run.executeCustomCommand.error'), Em.I18n.t('services.service.actions.run.executeCustomCommand.error'))).to.be.true;
expect($.parseJSON.called).to.be.false;
});
- it("data empty", function () {
+ it("data empty (2)", function () {
var data = {
responseText: "test"
};
@@ -2936,8 +3035,9 @@ describe('App.MainHostDetailsController', function () {
});
describe("#deleteHostSuccessCallback", function () {
- it("call updateHost", function () {
- var mock = {
+ var mock;
+ beforeEach(function () {
+ mock = {
updateHost: function (callback) {
callback();
},
@@ -2948,18 +3048,11 @@ describe('App.MainHostDetailsController', function () {
sinon.spy(mock, 'getAllHostNames');
sinon.stub(controller, 'loadConfigs', Em.K);
sinon.stub(App.router, 'transitionTo', Em.K);
- sinon.stub(controller, 'isServiceMetricsLoaded', function (callback) {
- callback();
- });
-
+ sinon.stub(controller, 'isServiceMetricsLoaded', Em.clb);
controller.deleteHostSuccessCallback();
- expect(App.router.get.calledWith('updateController')).to.be.true;
- expect(mock.updateHost.calledOnce).to.be.true;
- expect(controller.loadConfigs.called).to.be.false;
- expect(App.router.transitionTo.calledWith('hosts.index')).to.be.true;
- expect(App.router.get.calledWith('clusterController')).to.be.true;
- expect(mock.getAllHostNames.calledOnce).to.be.true;
+ });
+ afterEach(function () {
App.router.get.restore();
mock.updateHost.restore();
mock.getAllHostNames.restore();
@@ -2967,25 +3060,51 @@ describe('App.MainHostDetailsController', function () {
controller.isServiceMetricsLoaded.restore();
App.router.transitionTo.restore();
});
+
+ it('updateController is used', function () {
+ expect(App.router.get.calledWith('updateController')).to.be.true;
+ });
+ it('updateHost is called once', function () {
+ expect(mock.updateHost.calledOnce).to.be.true;
+ });
+ it('loadConfigs is not called', function () {
+ expect(controller.loadConfigs.called).to.be.false;
+ });
+ it('user is moved to the hosts', function () {
+ expect(App.router.transitionTo.calledWith('hosts.index')).to.be.true;
+ });
+ it('clusterController is used', function () {
+ expect(App.router.get.calledWith('clusterController')).to.be.true;
+ });
+ it('getAllHostNames is called once', function () {
+ expect(mock.getAllHostNames.calledOnce).to.be.true;
+ });
});
describe("#deleteHostErrorCallback", function () {
- it("call defaultErrorHandler", function () {
+
+ beforeEach(function () {
sinon.stub(controller, 'loadConfigs', Em.K);
sinon.stub(App.ajax, 'defaultErrorHandler', Em.K);
- sinon.stub(controller, 'isServiceMetricsLoaded', function (callback) {
- callback();
- });
+ sinon.stub(controller, 'isServiceMetricsLoaded', Em.clb);
controller.deleteHostErrorCallback({
status: 'status',
statusText: "statusText"
}, 'textStatus', 'errorThrown', {url: 'url'});
- expect(controller.loadConfigs.calledOnce).to.be.true;
- expect(App.ajax.defaultErrorHandler.calledOnce).to.be.true;
+ });
+
+ afterEach(function () {
App.ajax.defaultErrorHandler.restore();
controller.loadConfigs.restore();
controller.isServiceMetricsLoaded.restore();
});
+
+ it('loadConfigs is called once', function () {
+ expect(controller.loadConfigs.calledOnce).to.be.true;
+ });
+ it('defaultErrorHandler is called once', function () {
+ expect(App.ajax.defaultErrorHandler.calledOnce).to.be.true;
+ });
});
describe('#installVersionConfirmation()', function () {
@@ -3157,19 +3276,33 @@ describe('App.MainHostDetailsController', function () {
});
cases.forEach(function (item) {
- it(item.title, function () {
- Em.keys(item.input).forEach(function (key) {
- controller.set(key, item.input[key]);
+ describe(item.title, function () {
+
+ beforeEach(function () {
+ Em.keys(item.input).forEach(function (key) {
+ controller.set(key, item.input[key]);
+ });
+ this.hostsMap = controller.getHiveHosts().toArray();
+ this.expectedHosts = this.hostsMap.filter(function(hostInfo) {
+ return ['WEBHCAT_SERVER', 'HIVE_METASTORE'].contains(hostInfo.component) && hostInfo.isInstalled === true;
+ }).mapProperty('hostName').uniq();
+ });
+
+ it(JSON.stringify(item.hiveHosts) + ' are in the list', function () {
+ expect(this.expectedHosts).to.include.same.members(item.hiveHosts);
+ });
+ it('hiveMetastoreHost is empty', function () {
+ expect(controller.get('hiveMetastoreHost')).to.be.empty;
+ });
+ it('webhcatServerHost is empty', function () {
+ expect(controller.get('webhcatServerHost')).to.be.empty;
+ });
+ it('fromDeleteHost is false', function () {
+ expect(controller.get('fromDeleteHost')).to.be.false;
+ });
+ it('deleteHiveMetaStore is false', function () {
+ expect(controller.get('deleteHiveMetaStore')).to.be.false;
});
- var hostsMap = controller.getHiveHosts().toArray();
- var expectedHosts = hostsMap.filter(function(hostInfo) {
- return ['WEBHCAT_SERVER', 'HIVE_METASTORE'].contains(hostInfo.component) && hostInfo.isInstalled === true;
- }).mapProperty('hostName').uniq();
- expect(expectedHosts).to.include.same.members(item.hiveHosts);
- expect(controller.get('hiveMetastoreHost')).to.be.empty;
- expect(controller.get('webhcatServerHost')).to.be.empty;
- expect(controller.get('fromDeleteHost')).to.be.false;
- expect(controller.get('deleteHiveMetaStore')).to.be.false;
});
});
@@ -3225,9 +3358,8 @@ describe('App.MainHostDetailsController', function () {
});
cases.forEach(function (item) {
- it(item.title, function () {
- controller.set('rangerKMSServerHost', item.hostToInstall);
- sinon.stub(controller, 'getRangerKMSServerHosts').returns(item.kmsHosts);
+ describe(item.title, function () {
+
var data = {
items: [
{
@@ -3244,8 +3376,16 @@ describe('App.MainHostDetailsController', function () {
}
]
};
- controller.onLoadRangerConfigs(data);
- expect(controller.saveConfigsBatch.calledWith(item.result, 'RANGER_KMS_SERVER', item.hostToInstall)).to.be.true;
+
+ beforeEach(function () {
+ controller.set('rangerKMSServerHost', item.hostToInstall);
+ sinon.stub(controller, 'getRangerKMSServerHosts').returns(item.kmsHosts);
+ controller.onLoadRangerConfigs(data);
+ });
+
+ it('saveConfigsBatch is called with valid arguments', function () {
+ expect(controller.saveConfigsBatch.calledWith(item.result, 'RANGER_KMS_SERVER', item.hostToInstall)).to.be.true;
+ });
});
});
@@ -3757,26 +3897,40 @@ describe('App.MainHostDetailsController', function () {
];
tests.forEach(function(test) {
- it(test.m.format(inlineComponentHostInfo(test.hostComponentModel), test.ctrlStubs ? JSON.stringify(test.ctrlStubs) : 'None'), function() {
- if (test.appGetterStubs) {
- Em.keys(test.appGetterStubs).forEach(function(key) {
- sinon.stub(App, 'get').withArgs(key).returns(test.appGetterStubs[key]);
- });
- }
- if (test.ctrlStubs) {
- var stub = sinon.stub(controller, 'get');
- Em.keys(test.ctrlStubs).forEach(function(key) {
- stub.withArgs(key).returns(test.ctrlStubs[key]);
- });
- }
- sinon.stub(App.HostComponent, 'find').returns(test.hostComponentModel);
- controller.onLoadHiveConfigs(test.configs);
- var configs = controller.saveConfigsBatch.args[0];
- var properties = configs[0];
- expect(properties).to.be.eql(test.e.configs);
- if (test.ctrlStubs) controller.get.restore();
- if (test.appGetterStubs) App.get.restore();
- App.HostComponent.find.restore();
+ describe(test.m.format(inlineComponentHostInfo(test.hostComponentModel), test.ctrlStubs ? JSON.stringify(test.ctrlStubs) : 'None'), function() {
+
+ beforeEach(function () {
+ if (test.appGetterStubs) {
+ Em.keys(test.appGetterStubs).forEach(function(key) {
+ sinon.stub(App, 'get').withArgs(key).returns(test.appGetterStubs[key]);
+ });
+ }
+ if (test.ctrlStubs) {
+ var stub = sinon.stub(controller, 'get');
+ Em.keys(test.ctrlStubs).forEach(function(key) {
+ stub.withArgs(key).returns(test.ctrlStubs[key]);
+ });
+ }
+ sinon.stub(App.HostComponent, 'find').returns(test.hostComponentModel);
+ });
+
+ afterEach(function () {
+ if (test.ctrlStubs) {
+ controller.get.restore();
+ }
+ if (test.appGetterStubs) {
+ App.get.restore();
+ }
+ App.HostComponent.find.restore();
+ });
+
+ it('saveConfigsBatch is called with correct configs', function () {
+ controller.onLoadHiveConfigs(test.configs);
+ var configs = controller.saveConfigsBatch.args[0];
+ var properties = configs[0];
+ expect(properties).to.be.eql(test.e.configs);
+ });
+
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/service/add_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/add_controller_test.js b/ambari-web/test/controllers/main/service/add_controller_test.js
index 58f930f..1ec367e 100644
--- a/ambari-web/test/controllers/main/service/add_controller_test.js
+++ b/ambari-web/test/controllers/main/service/add_controller_test.js
@@ -150,16 +150,31 @@ describe('App.AddServiceController', function() {
var message = '{0} installed, {1} selected. Installed list should be {2} and selected - {3}';
tests.forEach(function(test) {
+
var installed = test.appService.mapProperty('serviceName');
var selected = test.stepCtrlContent.get('content').filterProperty('isSelected', true)
.filterProperty('isInstalled', false).mapProperty('serviceName');
- it(message.format(installed, selected, test.e.installed, test.e.selected), function() {
- sinon.stub(App.Service, 'find').returns(test.appService);
- addServiceController.saveServices(test.stepCtrlContent);
- App.Service.find.restore();
- var savedServices = addServiceController.setDBProperty.withArgs('services').args[0][1];
- expect(savedServices.selectedServices).to.have.members(test.e.selected);
- expect(savedServices.installedServices).to.have.members(test.e.installed);
+
+ describe(message.format(installed, selected, test.e.installed, test.e.selected), function() {
+
+ beforeEach(function () {
+ sinon.stub(App.Service, 'find').returns(test.appService);
+ addServiceController.saveServices(test.stepCtrlContent);
+ this.savedServices = addServiceController.setDBProperty.withArgs('services').args[0][1];
+ });
+
+ afterEach(function () {
+ App.Service.find.restore();
+ });
+
+ it(JSON.stringify(test.e.selected) + ' are in the selectedServices', function () {
+ expect(this.savedServices.selectedServices).to.have.members(test.e.selected);
+ });
+
+ it(JSON.stringify(test.e.installed) + ' are in the installedServices', function () {
+ expect(this.savedServices.installedServices).to.have.members(test.e.installed);
+ });
+
});
});
});
@@ -193,10 +208,16 @@ describe('App.AddServiceController', function() {
});
cases.forEach(function (item) {
- it(item.title, function () {
- sinon.stub(addServiceController, 'getDBProperty').withArgs('hosts').returns(item.hosts);
- addServiceController.loadHosts();
- expect(App.ajax.send.calledOnce).to.equal(item.isAjaxRequestSent);
+ describe(item.title, function () {
+
+ beforeEach(function () {
+ sinon.stub(addServiceController, 'getDBProperty').withArgs('hosts').returns(item.hosts);
+ addServiceController.loadHosts();
+ });
+
+ it('request is ' + (item.isAjaxRequestSent ? '' : 'not') + ' sent', function () {
+ expect(App.ajax.send.calledOnce).to.equal(item.isAjaxRequestSent);
+ });
});
});
@@ -407,22 +428,40 @@ describe('App.AddServiceController', function() {
];
tests.forEach(function(test) {
- it(test.m, function() {
- this.mockStackService.returns(test.appStackService);
- this.mockService.returns(test.appService);
- this.mockGetDBProperty.withArgs('services').returns(test.servicesFromDB);
- this.controller.set('serviceToInstall', test.serviceToInstall);
- this.controller.loadServices();
- if (!test.servicesFromDB) {
- // verify saving to local db on first enter to the wizard
- expect(mock.db.selectedServices).to.be.eql(test.e.selectedServices);
- expect(mock.db.installedServices).to.be.eql(test.e.installedServices);
- } else {
+ describe(test.m, function() {
+
+ beforeEach(function () {
+ this.mockStackService.returns(test.appStackService);
+ this.mockService.returns(test.appService);
+ this.mockGetDBProperty.withArgs('services').returns(test.servicesFromDB);
+ this.controller.set('serviceToInstall', test.serviceToInstall);
+ this.controller.loadServices();
+ });
+
+ if (test.servicesFromDB) {
// verify values for App.StackService
- expect(test.appStackService.filterProperty('isSelected', true).mapProperty('serviceName')).to.be.eql(test.e.selectedServices);
- expect(test.appStackService.filterProperty('isInstalled', true).mapProperty('serviceName')).to.be.eql(test.e.installedServices);
+ it(JSON.stringify(test.e.selectedServices) + ' are selected', function () {
+ expect(test.appStackService.filterProperty('isSelected', true).mapProperty('serviceName')).to.be.eql(test.e.selectedServices);
+ });
+ it(JSON.stringify(test.e.installedServices) + ' are installed', function () {
+ expect(test.appStackService.filterProperty('isInstalled', true).mapProperty('serviceName')).to.be.eql(test.e.installedServices);
+ });
+ }
+ else {
+ // verify saving to local db on first enter to the wizard
+ it('selectedServices are saced', function () {
+ expect(mock.db.selectedServices).to.be.eql(test.e.selectedServices);
+ });
+ it('installedServices are saved', function () {
+ expect(mock.db.installedServices).to.be.eql(test.e.installedServices);
+ });
+
}
- expect(this.controller.get('serviceToInstall')).to.be.null;
+
+ it('serviceToInstall is null', function () {
+ expect(this.controller.get('serviceToInstall')).to.be.null;
+ });
+
});
}, this);
});
@@ -461,11 +500,21 @@ describe('App.AddServiceController', function() {
});
cases.forEach(function (item) {
- it(item.title, function () {
- sinon.stub(App, 'get').withArgs('isKerberosEnabled').returns(item.securityEnabled);
- addServiceController.checkSecurityStatus();
- expect(addServiceController.get('skipConfigureIdentitiesStep')).to.equal(item.skipConfigureIdentitiesStep);
- expect(addServiceController.get('isStepDisabled').findProperty('step', 5).get('value')).to.equal(item.isStep5Disabled);
+ describe(item.title, function () {
+
+ beforeEach(function () {
+ sinon.stub(App, 'get').withArgs('isKerberosEnabled').returns(item.securityEnabled);
+ addServiceController.checkSecurityStatus();
+ });
+
+ it('skipConfigureIdentitiesStep is ' + item.skipConfigureIdentitiesStep, function () {
+ expect(addServiceController.get('skipConfigureIdentitiesStep')).to.equal(item.skipConfigureIdentitiesStep);
+ });
+
+ it('step 5 is ' + (item.isStep5Disabled ? 'disabved' : 'enabled'), function () {
+ expect(addServiceController.get('isStepDisabled').findProperty('step', 5).get('value')).to.equal(item.isStep5Disabled);
+ });
+
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/service/info/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/info/config_test.js b/ambari-web/test/controllers/main/service/info/config_test.js
index ba8f1d3..60aa8d6 100644
--- a/ambari-web/test/controllers/main/service/info/config_test.js
+++ b/ambari-web/test/controllers/main/service/info/config_test.js
@@ -134,6 +134,7 @@ describe("App.MainServiceInfoConfigsController", function () {
return "hash"
});
});
+
afterEach(function () {
mainServiceInfoConfigsController.get.restore();
mainServiceInfoConfigsController.restartServicePopup.restore();
@@ -142,24 +143,45 @@ describe("App.MainServiceInfoConfigsController", function () {
tests.forEach(function (t) {
t.results.forEach(function (r) {
- it(t.m + " " + r.method + " " + r.field, function () {
- if (t.callback) {
- t.callback = sinon.stub();
- }
- if (t.transitionCallback) {
- t.transitionCallback = sinon.stub();
- }
- mainServiceInfoConfigsController.showSavePopup(t.transitionCallback, t.callback)[t.action]();
+ describe(t.m + " " + r.method + " " + r.field, function () {
+
+ beforeEach(function () {
+ if (t.callback) {
+ t.callback = sinon.stub();
+ }
+ if (t.transitionCallback) {
+ t.transitionCallback = sinon.stub();
+ }
+ mainServiceInfoConfigsController.showSavePopup(t.transitionCallback, t.callback)[t.action]();
+ });
+
+
if (r.method) {
if (r.method === 'callback') {
- expect(t.callback.calledOnce).to.equal(r.called);
- } else if (r.method === 'transitionCallback') {
- expect(t.transitionCallback.calledOnce).to.equal(r.called);
- } else {
- expect(mainServiceInfoConfigsController[r.method].calledOnce).to.equal(r.called);
+ it('callback is ' + (r.called ? '' : 'not') + ' called once', function () {
+ expect(t.callback.calledOnce).to.equal(r.called);
+ });
+ }
+ else {
+ if (r.method === 'transitionCallback') {
+ it('transitionCallback is ' + (r.called ? '' : 'not') + ' called once', function () {
+ expect(t.transitionCallback.calledOnce).to.equal(r.called);
+ });
+ }
+ else {
+ it(r.method + ' is ' + (r.called ? '' : 'not') + ' called once', function () {
+ expect(mainServiceInfoConfigsController[r.method].calledOnce).to.equal(r.called);
+ });
+ }
+ }
+ }
+ else {
+ if (r.field) {
+ it(r.field + ' is equal to ' + r.value, function () {
+ expect(mainServiceInfoConfigsController.get(r.field)).to.equal(r.value);
+ });
+
}
- } else if (r.field) {
- expect(mainServiceInfoConfigsController.get(r.field)).to.equal(r.value);
}
}, this);
});
@@ -324,17 +346,21 @@ describe("App.MainServiceInfoConfigsController", function () {
});
describe("#restartAllStaleConfigComponents", function () {
+
beforeEach(function () {
sinon.stub(batchUtils, "restartAllServiceHostComponents", Em.K);
});
+
afterEach(function () {
batchUtils.restartAllServiceHostComponents.restore();
});
+
it("trigger restartAllServiceHostComponents", function () {
mainServiceInfoConfigsController.restartAllStaleConfigComponents().onPrimary();
expect(batchUtils.restartAllServiceHostComponents.calledOnce).to.equal(true);
});
- it("trigger check last check point warning before triggering restartAllServiceHostComponents", function () {
+
+ describe("trigger check last check point warning before triggering restartAllServiceHostComponents", function () {
var mainConfigsControllerHdfsStarted = App.MainServiceInfoConfigsController.create({
content: {
serviceName: "HDFS",
@@ -349,20 +375,30 @@ describe("App.MainServiceInfoConfigsController", function () {
}
});
var mainServiceItemController = App.MainServiceItemController.create({});
- sinon.stub(mainServiceItemController, 'checkNnLastCheckpointTime', function() {
- return true;
+
+ beforeEach(function () {
+ sinon.stub(mainServiceItemController, 'checkNnLastCheckpointTime', function() {
+ return true;
+ });
+ sinon.stub(App.router, 'get', function(k) {
+ if ('mainServiceItemController' === k) {
+ return mainServiceItemController;
+ }
+ return Em.get(App.router, k);
+ });
+ mainConfigsControllerHdfsStarted.restartAllStaleConfigComponents();
});
- sinon.stub(App.router, 'get', function(k) {
- if ('mainServiceItemController' === k) {
- return mainServiceItemController;
- }
- return Em.get(App.router, k);
+
+ afterEach(function () {
+ mainServiceItemController.checkNnLastCheckpointTime.restore();
+ App.router.get.restore();
+ });
+
+ it('checkNnLastCheckpointTime is called once', function () {
+ expect(mainServiceItemController.checkNnLastCheckpointTime.calledOnce).to.equal(true);
});
- mainConfigsControllerHdfsStarted.restartAllStaleConfigComponents();
- expect(mainServiceItemController.checkNnLastCheckpointTime.calledOnce).to.equal(true);
- mainServiceItemController.checkNnLastCheckpointTime.restore();
- App.router.get.restore();
+
});
});
@@ -713,10 +749,10 @@ describe("App.MainServiceInfoConfigsController", function () {
it("expect that serviceConfig.compareConfigs will be getComparisonConfig", function() {
expect(mainServiceInfoConfigsController.setCompareDefaultGroupConfig({isUserProperty: true}, {})).to.eql({compareConfigs: ["compConfig"], isUserProperty: true, isComparison: true, hasCompareDiffs: true});
});
- it("expect that serviceConfig.compareConfigs will be getComparisonConfig", function() {
+ it("expect that serviceConfig.compareConfigs will be getComparisonConfig (2)", function() {
expect(mainServiceInfoConfigsController.setCompareDefaultGroupConfig({isReconfigurable: true}, {})).to.eql({compareConfigs: ["compConfig"], isReconfigurable: true, isComparison: true, hasCompareDiffs: true});
});
- it("expect that serviceConfig.compareConfigs will be getComparisonConfig", function() {
+ it("expect that serviceConfig.compareConfigs will be getComparisonConfig (3)", function() {
expect(mainServiceInfoConfigsController.setCompareDefaultGroupConfig({isReconfigurable: true, isMock: true}, {})).to.eql({compareConfigs: ["compConfig"], isReconfigurable: true, isMock: true, isComparison: true, hasCompareDiffs: true});
});
it("property was created during upgrade and have no comparison, compare with 'Undefined' value should be created", function() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js
index 8794661..4be23c9 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -107,15 +107,27 @@ describe('App.MainServiceItemController', function () {
];
tests.forEach(function (test) {
- it(test.m, function () {
- sinon.stub(App.router, 'get', function(k) {
- if ('backgroundOperationsController.services' === k) return test.backgroundOperationsController.services;
- return Em.get(App.router, k);
+ describe(test.m, function () {
+
+ var mainServiceItemController;
+
+ beforeEach(function () {
+ sinon.stub(App.router, 'get', function(k) {
+ if ('backgroundOperationsController.services' === k) return test.backgroundOperationsController.services;
+ return Em.get(App.router, k);
+ });
+ mainServiceItemController = App.MainServiceItemController.create({content: {serviceName: test.serviceController.serviceName}});
+ mainServiceItemController.setStartStopState();
+ });
+
+ afterEach(function () {
+ App.router.get.restore();
+ });
+
+ it('isPending is ' + test.isPending, function () {
+ expect(mainServiceItemController.get('isPending')).to.equal(test.isPending);
});
- var mainServiceItemController = App.MainServiceItemController.create({content: {serviceName: test.serviceController.serviceName}});
- mainServiceItemController.setStartStopState();
- App.router.get.restore();
- expect(mainServiceItemController.get('isPending')).to.equal(test.isPending);
+
});
})
});
@@ -141,34 +153,41 @@ describe('App.MainServiceItemController', function () {
];
tests.forEach(function (test) {
- var reassignMasterController = App.ReassignMasterController.create({currentStep: ''});
+ describe(test.m, function () {
- beforeEach(function () {
- sinon.stub(reassignMasterController, 'saveComponentToReassign', Em.K);
- sinon.stub(reassignMasterController, 'setCurrentStep', Em.K);
- });
+ var reassignMasterController = App.ReassignMasterController.create({currentStep: ''});
- afterEach(function () {
- reassignMasterController.saveComponentToReassign.restore();
- reassignMasterController.setCurrentStep.restore();
- });
+ beforeEach(function () {
+ sinon.stub(reassignMasterController, 'saveComponentToReassign', Em.K);
+ sinon.stub(reassignMasterController, 'setCurrentStep', Em.K);
+ sinon.stub(App.router, 'transitionTo', Em.K);
+ var mainServiceItemController = App.MainServiceItemController.create({});
+ sinon.stub(App.HostComponent, 'find', function() {
+ return test.host_components
+ });
+ sinon.stub(App.router, 'get', function(k) {
+ if ('reassignMasterController' === k) return reassignMasterController;
+ return Em.get(App.router, k);
+ });
+ mainServiceItemController.reassignMaster(test.componentName);
+ });
- it(test.m, function () {
- sinon.stub(App.router, 'transitionTo', Em.K);
- var mainServiceItemController = App.MainServiceItemController.create({});
- sinon.stub(App.HostComponent, 'find', function() {
- return test.host_components
+ afterEach(function () {
+ reassignMasterController.saveComponentToReassign.restore();
+ reassignMasterController.setCurrentStep.restore();
+ App.HostComponent.find.restore();
+ App.router.transitionTo.restore();
+ App.router.get.restore();
});
- sinon.stub(App.router, 'get', function(k) {
- if ('reassignMasterController' === k) return reassignMasterController;
- return Em.get(App.router, k);
+
+ it('saveComponentToReassign is ' + (test.result ? '' : 'not') + ' called once', function () {
+ expect(reassignMasterController.saveComponentToReassign.calledOnce).to.equal(test.result);
});
- mainServiceItemController.reassignMaster(test.componentName);
- expect(reassignMasterController.saveComponentToReassign.calledOnce).to.equal(test.result);
- expect(reassignMasterController.setCurrentStep.calledOnce).to.equal(test.result);
- App.HostComponent.find.restore();
- App.router.transitionTo.restore();
- App.router.get.restore();
+
+ it('setCurrentStep is ' + (test.result ? '' : 'not') + ' called once', function () {
+ expect(reassignMasterController.setCurrentStep.calledOnce).to.equal(test.result);
+ });
+
});
}, this);
});
@@ -966,7 +985,8 @@ describe('App.MainServiceItemController', function () {
});
describe("#runRebalancer", function () {
- it("run rebalancer", function () {
+
+ beforeEach(function () {
sinon.stub(App.router, 'get', function(k) {
if ('applicationController' === k) {
return Em.Object.create({
@@ -977,15 +997,22 @@ describe('App.MainServiceItemController', function () {
}
return Em.get(App.router, k);
});
+ });
+
+ afterEach(function () {
+ App.router.get.restore();
+ });
+
+ it("run rebalancer", function () {
var mainServiceItemController = App.MainServiceItemController.create({content: {runRebalancer: false}});
mainServiceItemController.runRebalancer().onPrimary();
expect(mainServiceItemController.get("content.runRebalancer")).to.equal(true);
- App.router.get.restore();
});
});
describe("#runCompaction", function () {
- it("run compaction", function () {
+
+ beforeEach(function () {
sinon.stub(App.router, 'get', function(k) {
if ('applicationController' === k) {
return Em.Object.create({
@@ -996,10 +1023,16 @@ describe('App.MainServiceItemController', function () {
}
return Em.get(App.router, k);
});
+ });
+
+ afterEach(function () {
+ App.router.get.restore();
+ });
+
+ it("run compaction", function () {
var mainServiceItemController = App.MainServiceItemController.create({content: {runCompaction: false}});
mainServiceItemController.runCompaction().onPrimary();
expect(mainServiceItemController.get("content.runCompaction")).to.equal(true);
- App.router.get.restore();
});
});
@@ -1049,19 +1082,35 @@ describe('App.MainServiceItemController', function () {
var mainServiceItemController = App.MainServiceItemController.create({content: {serviceName: test.data.serviceName,
displayName: test.data.displayName}});
- beforeEach(function () {
- mainServiceItemController.set("runSmokeTestErrorCallBack", Em.K);
- mainServiceItemController.set("runSmokeTestSuccessCallBack", Em.K);
- });
+ describe('send request to run smoke test for ' + test.data.serviceName, function () {
- it('send request to run smoke test for ' + test.data.serviceName, function () {
- mainServiceItemController.runSmokeTestPrimary(test.data.query);
- expect($.ajax.calledOnce).to.equal(true);
+ beforeEach(function () {
+ mainServiceItemController.set("runSmokeTestErrorCallBack", Em.K);
+ mainServiceItemController.set("runSmokeTestSuccessCallBack", Em.K);
+ mainServiceItemController.runSmokeTestPrimary(test.data.query);
+ this.data = JSON.parse($.ajax.args[0][0].data);
+ });
+
+ it('ajax request is sent', function () {
+ expect($.ajax.calledOnce).to.equal(true);
+ });
+
+ it('RequestInfo.context is valid', function () {
+ expect(this.data.RequestInfo.context).to.equal(test.RequestInfo.context);
+ });
+
+ it('RequestInfo.command is valid', function () {
+ expect(this.data.RequestInfo.command).to.equal(test.RequestInfo.command);
+ });
+
+ it('Requests/resource_filter.0.serviceName is valid', function () {
+ expect(this.data["Requests/resource_filters"][0].serviceName).to.equal(test["Requests/resource_filters"][0].serviceName);
+ });
+
+ it('RequestInfo.operation_level is valid', function () {
+ expect(this.data.RequestInfo.operation_level).to.be.deep.equal(test.RequestInfo.operation_level);
+ });
- expect(JSON.parse($.ajax.args[0][0].data).RequestInfo.context).to.equal(test.RequestInfo.context);
- expect(JSON.parse($.ajax.args[0][0].data).RequestInfo.command).to.equal(test.RequestInfo.command);
- expect(JSON.parse($.ajax.args[0][0].data)["Requests/resource_filters"][0].serviceName).to.equal(test["Requests/resource_filters"][0].serviceName);
- expect(JSON.parse($.ajax.args[0][0].data).RequestInfo.operation_level).to.be.deep.equal(test.RequestInfo.operation_level);
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js b/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js
index 15d22fd..699f0a2 100644
--- a/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js
+++ b/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js
@@ -213,6 +213,7 @@ describe('App.ManageConfigGroupsController', function() {
});
describe("#onPrimaryWizard()", function () {
+
var ctrl = Em.Object.create({
selectedService: Em.Object.create({
selected: false
@@ -220,6 +221,7 @@ describe('App.ManageConfigGroupsController', function() {
selectedServiceObserver: Em.K,
setGroupsToDelete: Em.K
});
+
beforeEach(function () {
sinon.spy(ctrl, 'selectedServiceObserver');
sinon.spy(ctrl, 'setGroupsToDelete');
@@ -227,6 +229,7 @@ describe('App.ManageConfigGroupsController', function() {
sinon.stub(popup, 'updateConfigGroupOnServicePage', Em.K);
sinon.stub(popup, 'hide', Em.K);
});
+
afterEach(function () {
ctrl.setGroupsToDelete.restore();
ctrl.selectedServiceObserver.restore();
@@ -234,44 +237,110 @@ describe('App.ManageConfigGroupsController', function() {
popup.updateConfigGroupOnServicePage.restore();
popup.hide.restore();
});
- it("groups deleted on 7th step", function () {
- ctrl.set('name', 'wizardStep7Controller');
- popup.onPrimaryWizard(ctrl, {toDelete: [1]});
- expect(ctrl.selectedServiceObserver.calledOnce).to.be.true;
- expect(ctrl.setGroupsToDelete.calledWith([1])).to.be.true;
- expect(manageConfigGroupsController.persistConfigGroups.calledOnce).to.be.true;
- expect(popup.updateConfigGroupOnServicePage.calledOnce).to.be.true;
- expect(popup.hide.calledOnce).to.be.true;
+
+ describe("groups deleted on 7th step", function () {
+
+ beforeEach(function () {
+ ctrl.set('name', 'wizardStep7Controller');
+ popup.onPrimaryWizard(ctrl, {toDelete: [1]});
+ });
+
+ it('selectedServiceObserver is called once', function () {
+ expect(ctrl.selectedServiceObserver.calledOnce).to.be.true;
+ });
+ it('setGroupsToDelete is called with [1]', function () {
+ expect(ctrl.setGroupsToDelete.calledWith([1])).to.be.true;
+ });
+ it('persistConfigGroups is called once', function () {
+ expect(manageConfigGroupsController.persistConfigGroups.calledOnce).to.be.true;
+ });
+ it('updateConfigGroupOnServicePage is called once', function () {
+ expect(popup.updateConfigGroupOnServicePage.calledOnce).to.be.true;
+ });
+ it('hide is called once', function () {
+ expect(popup.hide.calledOnce).to.be.true;
+ });
});
- it("wizard not on 7th step", function () {
- ctrl.set('name', '');
- popup.onPrimaryWizard(ctrl, {});
- expect(ctrl.selectedServiceObserver.calledOnce).to.be.true;
- expect(ctrl.setGroupsToDelete.called).to.be.false;
- expect(manageConfigGroupsController.persistConfigGroups.called).to.be.false;
- expect(popup.updateConfigGroupOnServicePage.called).to.be.false;
- expect(popup.hide.calledOnce).to.be.true;
+
+ describe("wizard not on 7th step", function () {
+
+ beforeEach(function () {
+ ctrl.set('name', '');
+ popup.onPrimaryWizard(ctrl, {});
+ });
+
+ it('selectedServiceObserver is called once', function () {
+ expect(ctrl.selectedServiceObserver.calledOnce).to.be.true;
+ });
+
+ it('setGroupsToDelete is not called', function () {
+ expect(ctrl.setGroupsToDelete.called).to.be.false;
+ });
+
+ it('persistConfigGroups is not called', function () {
+ expect(manageConfigGroupsController.persistConfigGroups.called).to.be.false;
+ });
+
+ it('updateConfigGroupOnServicePage is not called', function () {
+ expect(popup.updateConfigGroupOnServicePage.called).to.be.false;
+ });
+
+ it('hide is called once', function () {
+ expect(popup.hide.calledOnce).to.be.true;
+ });
});
- it("wizard on 7th step, service selected", function () {
- ctrl.set('name', 'wizardStep7Controller');
- ctrl.set('selectedService.selected', true);
- popup.onPrimaryWizard(ctrl, {toDelete: [1]});
- expect(ctrl.selectedServiceObserver.calledOnce).to.be.true;
- expect(ctrl.setGroupsToDelete.called).to.be.false;
- expect(manageConfigGroupsController.persistConfigGroups.calledOnce).to.be.true;
- expect(popup.updateConfigGroupOnServicePage.calledOnce).to.be.true;
- expect(popup.hide.calledOnce).to.be.true;
+
+ describe("wizard on 7th step, service selected", function () {
+
+ beforeEach(function () {
+ ctrl.set('name', 'wizardStep7Controller');
+ ctrl.set('selectedService.selected', true);
+ popup.onPrimaryWizard(ctrl, {toDelete: [1]});
+ });
+
+ it('selectedServiceObserver is called once', function () {
+ expect(ctrl.selectedServiceObserver.calledOnce).to.be.true;
+ });
+ it('setGroupsToDelete is not called', function () {
+ expect(ctrl.setGroupsToDelete.called).to.be.false;
+ });
+ it('persistConfigGroups is called once', function () {
+ expect(manageConfigGroupsController.persistConfigGroups.calledOnce).to.be.true;
+ });
+ it('updateConfigGroupOnServicePage is called once', function () {
+ expect(popup.updateConfigGroupOnServicePage.calledOnce).to.be.true;
+ });
+ it('hide is called once', function () {
+ expect(popup.hide.calledOnce).to.be.true;
+ });
});
- it("wizard on 7th step, no groups to delete", function () {
- ctrl.set('name', 'wizardStep7Controller');
- ctrl.set('selectedService.selected', false);
- popup.onPrimaryWizard(ctrl, {toDelete: []});
- expect(ctrl.selectedServiceObserver.calledOnce).to.be.true;
- expect(ctrl.setGroupsToDelete.called).to.be.false;
- expect(manageConfigGroupsController.persistConfigGroups.calledOnce).to.be.true;
- expect(popup.updateConfigGroupOnServicePage.calledOnce).to.be.true;
- expect(popup.hide.calledOnce).to.be.true;
+
+ describe("wizard on 7th step, no groups to delete", function () {
+
+ beforeEach(function () {
+ ctrl.set('name', 'wizardStep7Controller');
+ ctrl.set('selectedService.selected', false);
+ popup.onPrimaryWizard(ctrl, {toDelete: []});
+ });
+
+ it('selectedServiceObserver is called once', function () {
+ expect(ctrl.selectedServiceObserver.calledOnce).to.be.true;
+ });
+ it('setGroupsToDelete is not called', function () {
+ expect(ctrl.setGroupsToDelete.called).to.be.false;
+ });
+ it('persistConfigGroups is called once', function () {
+ expect(manageConfigGroupsController.persistConfigGroups.calledOnce).to.be.true;
+ });
+ it('updateConfigGroupOnServicePage is called once', function () {
+ expect(popup.updateConfigGroupOnServicePage.calledOnce).to.be.true;
+ });
+ it('hide is called once', function () {
+ expect(popup.hide.calledOnce).to.be.true;
+ });
+
});
+
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js
index ff52a35..dee3251 100644
--- a/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js
@@ -35,10 +35,12 @@ describe('App.ReassignMasterWizardStep1Controller', function () {
describe('#loadConfigTags', function() {
beforeEach(function() {
sinon.stub(App.ajax, 'send', Em.K);
+ this.stub = sinon.stub(App.router, 'get');
});
afterEach(function() {
App.ajax.send.restore();
+ this.stub.restore();
});
it('tests loadConfigTags', function() {
@@ -48,47 +50,31 @@ describe('App.ReassignMasterWizardStep1Controller', function () {
});
it('tests saveDatabaseType with type', function() {
- sinon.stub(App.router, 'get', function() {
- return { saveDatabaseType: Em.K};
- });
+ this.stub.returns({ saveDatabaseType: Em.K});
controller.saveDatabaseType(true);
expect(App.router.get.calledOnce).to.be.true;
-
- App.router.get.restore();
});
it('tests saveDatabaseType without type', function() {
- sinon.stub(App.router, 'get', function() {
- return { saveDatabaseType: Em.K};
- });
+ this.stub.returns({ saveDatabaseType: Em.K});
controller.saveDatabaseType(false);
expect(App.router.get.called).to.be.false;
-
- App.router.get.restore();
});
- it('tests saveServiceProperties with propertie', function() {
- sinon.stub(App.router, 'get', function() {
- return { saveServiceProperties: Em.K};
- });
+ it('tests saveServiceProperties with properties', function() {
+ this.stub.returns({ saveServiceProperties: Em.K});
controller.saveServiceProperties(true);
expect(App.router.get.calledOnce).to.be.true;
-
- App.router.get.restore();
});
it('tests saveServiceProperties without properties', function() {
- sinon.stub(App.router, 'get', function() {
- return { saveServiceProperties: Em.K};
- });
+ this.stub.returns({ saveServiceProperties: Em.K});
controller.saveServiceProperties(false);
expect(App.router.get.called).to.be.false;
-
- App.router.get.restore();
});
it('tests getDatabaseHost', function() {
[13/50] [abbrv] ambari git commit: AMBARI-14510. Ambari Admin: fix
'clear filters' link display condition in Versions table and apply it to
other tables. (alexantonenko)
Posted by nc...@apache.org.
AMBARI-14510. Ambari Admin: fix 'clear filters' link display condition in Versions table and apply it to other tables. (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4a58cd46
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4a58cd46
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4a58cd46
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 4a58cd46fdfadd5deb5038db9849dd89cc289b80
Parents: 2365392
Author: Alex Antonenko <hi...@gmail.com>
Authored: Mon Dec 28 20:47:29 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Mon Dec 28 21:17:57 2015 +0200
----------------------------------------------------------------------
.../controllers/clusters/UserAccessListCtrl.js | 24 ++
.../controllers/groups/GroupsListCtrl.js | 22 ++
.../stackVersions/StackVersionsListCtrl.js | 5 +
.../scripts/controllers/users/UsersListCtrl.js | 27 ++-
.../resources/ui/admin-web/app/styles/main.css | 4 +-
.../app/views/clusters/userAccessList.html | 6 +-
.../ui/admin-web/app/views/groups/list.html | 6 +-
.../admin-web/app/views/stackVersions/list.html | 4 +-
.../ui/admin-web/app/views/users/list.html | 8 +-
.../clusters/UserAccessListCtrl_test.js | 223 +++++++++++++++++++
.../controllers/groups/GroupsListCtrl_test.js | 129 +++++++++++
.../stackVersions/StackversionsListCtrl_test.js | 119 +++++++++-
.../controllers/users/UsersListCtrl_test.js | 223 +++++++++++++++++++
13 files changed, 786 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a58cd46/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/UserAccessListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/UserAccessListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/UserAccessListCtrl.js
index f15607b..1da4aff 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/UserAccessListCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/UserAccessListCtrl.js
@@ -29,6 +29,12 @@ function($scope, $location, Cluster, $modal, $rootScope, $routeParams, Permissio
$scope.maxVisiblePages = 20;
$scope.roles = [];
$scope.clusterId = $routeParams.id;
+ $scope.tableInfo = {
+ total: 0,
+ showed: 0,
+ filtered: 0
+ };
+ $scope.isNotEmptyFilter = true;
$scope.pageChanged = function() {
$scope.loadUsers();
@@ -54,6 +60,8 @@ function($scope, $location, Cluster, $modal, $rootScope, $routeParams, Permissio
user.PrivilegeInfo.url = type == 'user'? (type + 's/' + name) : (type + 's/' + name + '/edit');
return user.PrivilegeInfo;
});
+ $scope.tableInfo.total = data.itemTotal;
+ $scope.tableInfo.showed = data.items.length;
$scope.loadRoles();
});
};
@@ -120,9 +128,25 @@ function($scope, $location, Cluster, $modal, $rootScope, $routeParams, Permissio
];
$scope.currentTypeFilter = $scope.typeFilterOptions[0];
+ $scope.clearFilters = function () {
+ $scope.currentNameFilter = '';
+ $scope.currentTypeFilter = $scope.typeFilterOptions[0];
+ $scope.currentRoleFilter = $scope.roleFilterOptions[0];
+ $scope.resetPagination();
+ };
$scope.loadUsers();
+ $scope.$watch(
+ function (scope) {
+ return Boolean(scope.currentNameFilter || (scope.currentTypeFilter && scope.currentTypeFilter.value)
+ || (scope.currentRoleFilter && scope.currentRoleFilter.value));
+ },
+ function (newValue, oldValue, scope) {
+ scope.isNotEmptyFilter = newValue;
+ }
+ );
+
$rootScope.$watch(function(scope) {
return scope.LDAPSynced;
}, function(LDAPSynced) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a58cd46/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsListCtrl.js
index df63b8c..330d3c2 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsListCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsListCtrl.js
@@ -27,6 +27,11 @@ angular.module('ambariAdminConsole')
$scope.totalGroups = 1;
$scope.currentNameFilter = '';
$scope.maxVisiblePages=20;
+ $scope.tableInfo = {
+ total: 0,
+ showed: 0
+ };
+ $scope.isNotEmptyFilter = true;
$scope.pageChanged = function() {
loadGroups();
@@ -49,6 +54,8 @@ angular.module('ambariAdminConsole')
}).then(function(groups) {
$scope.totalGroups = groups.itemTotal;
$scope.groups = groups;
+ $scope.tableInfo.total = groups.itemTotal;
+ $scope.tableInfo.showed = groups.length;
})
.catch(function(data) {
console.error($t('groups.alerts.getGroupsListError'));
@@ -61,9 +68,24 @@ angular.module('ambariAdminConsole')
{label: $t('common.ldap'), value:true}
];
$scope.currentTypeFilter = $scope.typeFilterOptions[0];
+
+ $scope.clearFilters = function () {
+ $scope.currentNameFilter = '';
+ $scope.currentTypeFilter = $scope.typeFilterOptions[0];
+ $scope.resetPagination();
+ };
loadGroups();
+ $scope.$watch(
+ function (scope) {
+ return Boolean(scope.currentNameFilter || (scope.currentTypeFilter && scope.currentTypeFilter.value !== '*'));
+ },
+ function (newValue, oldValue, scope) {
+ scope.isNotEmptyFilter = newValue;
+ }
+ );
+
$rootScope.$watch(function(scope) {
return scope.LDAPSynced;
}, function(LDAPSynced) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a58cd46/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
index e3178df..583468c 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
@@ -28,6 +28,7 @@ angular.module('ambariAdminConsole')
current: null
}
};
+ $scope.isNotEmptyFilter = true;
$scope.pagination = {
totalRepos: 10,
@@ -125,4 +126,8 @@ angular.module('ambariAdminConsole')
};
$scope.loadAllData();
+
+ $scope.$watch('filter', function (filter) {
+ $scope.isNotEmptyFilter = Boolean(filter.version || (filter.cluster.current && filter.cluster.current.value));
+ }, true);
}]);
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a58cd46/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js
index bde9297..dfbd008 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersListCtrl.js
@@ -26,6 +26,11 @@ angular.module('ambariAdminConsole')
$scope.totalUsers = 1;
$scope.currentNameFilter = '';
$scope.maxVisiblePages=20;
+ $scope.tableInfo = {
+ total: 0,
+ showed: 0
+ };
+ $scope.isNotEmptyFilter = true;
$scope.pageChanged = function() {
$scope.loadUsers();
@@ -45,6 +50,8 @@ angular.module('ambariAdminConsole')
}).then(function(data) {
$scope.totalUsers = data.data.itemTotal;
$scope.users = data.data.items.map(User.makeUser);
+ $scope.tableInfo.showed = data.data.items.length;
+ $scope.tableInfo.total = data.data.itemTotal;
});
};
@@ -53,12 +60,12 @@ angular.module('ambariAdminConsole')
$scope.loadUsers();
};
- $scope.actvieFilterOptions = [
+ $scope.activeFilterOptions = [
{label: $t('common.all'), value: '*'},
{label: $t('users.active'), value: true},
{label: $t('users.inactive'), value:false}
];
- $scope.currentActiveFilter = $scope.actvieFilterOptions[0];
+ $scope.currentActiveFilter = $scope.activeFilterOptions[0];
$scope.typeFilterOptions = [{ label: $t('common.all'), value: '*'}]
.concat(Object.keys(UserConstants.TYPES).map(function(key) {
@@ -77,9 +84,25 @@ angular.module('ambariAdminConsole')
$scope.loadUsers();
};
+ $scope.clearFilters = function () {
+ $scope.currentNameFilter = '';
+ $scope.currentTypeFilter = $scope.typeFilterOptions[0];
+ $scope.currentActiveFilter = $scope.activeFilterOptions[0];
+ $scope.resetPagination();
+ };
$scope.loadUsers();
+ $scope.$watch(
+ function (scope) {
+ return Boolean(scope.currentNameFilter || (scope.currentActiveFilter && scope.currentActiveFilter.value !== '*')
+ || (scope.currentTypeFilter && scope.currentTypeFilter.value !== '*'));
+ },
+ function (newValue, oldValue, scope) {
+ scope.isNotEmptyFilter = newValue;
+ }
+ );
+
$rootScope.$watch(function(scope) {
return scope.LDAPSynced;
}, function(LDAPSynced) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a58cd46/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css b/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
index 602c56c..e380706 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
@@ -1259,13 +1259,13 @@ accordion .panel-group .panel{
width: 30%
}
-#stack-versions .table-bar {
+.table-bar {
padding-top: 4px;
border: 1px solid #E4E4E4;
color: #7B7B7B;
}
-#stack-versions .table-bar .filtered-info {
+.table-bar .filtered-info {
margin-top: 8px;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a58cd46/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/userAccessList.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/userAccessList.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/userAccessList.html
index 6ef6041..969f479 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/userAccessList.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/userAccessList.html
@@ -75,7 +75,11 @@
<div class="alert alert-info col-sm-12" ng-show="!users.length">
No users to display.
</div>
- <div class="col-sm-12">
+ <div class="col-sm-12 table-bar">
+ <div class="pull-left filtered-info">
+ <span>{{tableInfo.showed}} of {{tableInfo.total}} users showing</span>
+ <span ng-show="isNotEmptyFilter">- <a href ng-click="clearFilters()">clear filters</a></span>
+ </div>
<div class="pull-right left-margin">
<pagination class="paginator" total-items="totalUsers" max-size="maxVisiblePages" items-per-page="usersPerPage" ng-model="currentPage" ng-change="pageChanged()"></pagination>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a58cd46/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/list.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/list.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/list.html
index ab268d3..d0df0fa 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/list.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/list.html
@@ -61,7 +61,11 @@
<div class="alert alert-info col-sm-12" ng-show="!groups.length">
No groups to display.
</div>
- <div class="col-sm-12">
+ <div class="col-sm-12 table-bar">
+ <div class="pull-left filtered-info">
+ <span>{{tableInfo.showed}} of {{tableInfo.total}} groups showing</span>
+ <span ng-show="isNotEmptyFilter">- <a href ng-click="clearFilters()">clear filters</a></span>
+ </div>
<div class="pull-right left-margin">
<pagination class="paginator" total-items="totalGroups" max-size="maxVisiblePages" items-per-page="groupsPerPage" ng-model="currentPage" ng-change="pageChanged()"></pagination>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a58cd46/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
index 1fa5aed..ed014d8 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
@@ -90,8 +90,8 @@
</div>
<div class="col-sm-12 table-bar">
<div class="pull-left filtered-info">
- <span>{{tableInfo.showed}} of {{tableInfo.total}} versions showing - </span>
- <a href ng-click="clearFilters()">clear filters</a>
+ <span>{{tableInfo.showed}} of {{tableInfo.total}} versions showing</span>
+ <span ng-show="isNotEmptyFilter">- <a href ng-click="clearFilters()">clear filters</a></span>
</div>
<div class="pull-right left-margin">
<pagination class="paginator"
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a58cd46/ambari-admin/src/main/resources/ui/admin-web/app/views/users/list.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/users/list.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/users/list.html
index 3305306..3885978 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/users/list.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/users/list.html
@@ -56,7 +56,7 @@
<label for="">Status</label>
<select class="form-control statusfilter"
ng-model="currentActiveFilter"
- ng-options="item.label for item in actvieFilterOptions"
+ ng-options="item.label for item in activeFilterOptions"
ng-change="resetPagination()">
</select>
</th>
@@ -78,7 +78,11 @@
<div class="alert alert-info col-sm-12" ng-show="!users.length">
No users to display.
</div>
- <div class="col-sm-12">
+ <div class="col-sm-12 table-bar">
+ <div class="pull-left filtered-info">
+ <span>{{tableInfo.showed}} of {{tableInfo.total}} users showing</span>
+ <span ng-show="isNotEmptyFilter">- <a href ng-click="clearFilters()">clear filters</a></span>
+ </div>
<div class="pull-right left-margin">
<pagination class="paginator" total-items="totalUsers" max-size="maxVisiblePages" items-per-page="usersPerPage" ng-model="currentPage" ng-change="pageChanged()"></pagination>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a58cd46/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/clusters/UserAccessListCtrl_test.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/clusters/UserAccessListCtrl_test.js b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/clusters/UserAccessListCtrl_test.js
new file mode 100644
index 0000000..6f28aa5
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/clusters/UserAccessListCtrl_test.js
@@ -0,0 +1,223 @@
+/**
+ * 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.
+ */
+
+describe('#Cluster', function () {
+
+ describe('UserAccessListCtrl', function() {
+
+ var scope, ctrl, $t, $httpBackend;
+
+ beforeEach(module('ambariAdminConsole', function () {}));
+
+ beforeEach(inject(function($rootScope, $controller, _$translate_, _$httpBackend_) {
+ scope = $rootScope.$new();
+ $t = _$translate_.instant;
+ $httpBackend = _$httpBackend_;
+ ctrl = $controller('UserAccessListCtrl', {
+ $scope: scope
+ });
+ }));
+
+ describe('#clearFilters()', function () {
+
+ it('should clear filters and reset pagination', function () {
+ scope.currentPage = 2;
+ scope.currentNameFilter = 'a';
+ scope.currentRoleFilter = {
+ label: $t('users.roles.clusterUser'),
+ value: 'CLUSTER.USER'
+ };
+ scope.currentTypeFilter = {
+ label: $t('common.group'),
+ value: 'GROUP'
+ };
+ scope.clearFilters();
+ expect(scope.currentNameFilter).toEqual('');
+ expect(scope.currentRoleFilter).toEqual({
+ label: $t('common.all'),
+ value: ''
+ });
+ expect(scope.currentTypeFilter).toEqual({
+ label: $t('common.all'),
+ value: ''
+ });
+ expect(scope.currentPage).toEqual(1);
+ });
+
+ });
+
+ describe('#isNotEmptyFilter', function () {
+
+ var cases = [
+ {
+ currentNameFilter: '',
+ currentTypeFilter: null,
+ currentRoleFilter: null,
+ isNotEmptyFilter: false,
+ title: 'no filters'
+ },
+ {
+ currentNameFilter: '',
+ currentTypeFilter: {
+ value: ''
+ },
+ currentRoleFilter: {
+ value: ''
+ },
+ isNotEmptyFilter: false,
+ title: 'empty filters'
+ },
+ {
+ currentNameFilter: 'a',
+ currentTypeFilter: {
+ value: ''
+ },
+ currentRoleFilter: {
+ value: ''
+ },
+ isNotEmptyFilter: true,
+ title: 'name filter'
+ },
+ {
+ currentNameFilter: '0',
+ currentTypeFilter: {
+ value: ''
+ },
+ currentRoleFilter: {
+ value: ''
+ },
+ isNotEmptyFilter: true,
+ title: 'name filter with "0" as string'
+ },
+ {
+ currentNameFilter: '',
+ currentTypeFilter: {
+ value: 'GROUP'
+ },
+ currentRoleFilter: {
+ value: ''
+ },
+ isNotEmptyFilter: true,
+ title: 'type filter'
+ },
+ {
+ currentNameFilter: '',
+ currentTypeFilter: {
+ value: ''
+ },
+ currentRoleFilter: {
+ value: 'CLUSTER.USER'
+ },
+ isNotEmptyFilter: true,
+ title: 'role filter'
+ },
+ {
+ currentNameFilter: 'a',
+ currentTypeFilter: {
+ value: 'GROUP'
+ },
+ currentRoleFilter: {
+ value: ''
+ },
+ isNotEmptyFilter: true,
+ title: 'name and type filters'
+ },
+ {
+ currentNameFilter: 'a',
+ currentTypeFilter: {
+ value: ''
+ },
+ currentRoleFilter: {
+ value: 'CLUSTER.USER'
+ },
+ isNotEmptyFilter: true,
+ title: 'name and role filters'
+ },
+ {
+ currentNameFilter: '0',
+ currentTypeFilter: {
+ value: 'GROUP'
+ },
+ currentRoleFilter: {
+ value: ''
+ },
+ isNotEmptyFilter: true,
+ title: 'name and type filters with "0" as string'
+ },
+ {
+ currentNameFilter: '0',
+ currentTypeFilter: {
+ value: ''
+ },
+ currentRoleFilter: {
+ value: 'CLUSTER.USER'
+ },
+ isNotEmptyFilter: true,
+ title: 'name and role filters with "0" as string'
+ },
+ {
+ currentNameFilter: '',
+ currentTypeFilter: {
+ value: 'GROUP'
+ },
+ currentRoleFilter: {
+ value: 'CLUSTER.USER'
+ },
+ isNotEmptyFilter: true,
+ title: 'type and role filters'
+ },
+ {
+ currentNameFilter: 'a',
+ currentTypeFilter: {
+ value: 'CLUSTER.USER'
+ },
+ currentRoleFilter: {
+ value: 'GROUP'
+ },
+ isNotEmptyFilter: true,
+ title: 'all filters'
+ },
+ {
+ currentNameFilter: '0',
+ currentTypeFilter: {
+ value: 'CLUSTER.USER'
+ },
+ currentRoleFilter: {
+ value: 'GROUP'
+ },
+ isNotEmptyFilter: true,
+ title: 'all filters with "0" as string'
+ }
+ ];
+
+ cases.forEach(function (item) {
+ it(item.title, function () {
+ $httpBackend.expectGET(/\/api\/v1\/clusters\/\w+\/privileges/).respond(200);
+ scope.currentNameFilter = item.currentNameFilter;
+ scope.currentRoleFilter = item.currentRoleFilter;
+ scope.currentTypeFilter = item.currentTypeFilter;
+ scope.$digest();
+ expect(scope.isNotEmptyFilter).toEqual(item.isNotEmptyFilter);
+ });
+ });
+
+ });
+
+ });
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a58cd46/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/groups/GroupsListCtrl_test.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/groups/GroupsListCtrl_test.js b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/groups/GroupsListCtrl_test.js
new file mode 100644
index 0000000..8ed228b
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/groups/GroupsListCtrl_test.js
@@ -0,0 +1,129 @@
+/**
+ * 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.
+ */
+
+describe('#Cluster', function () {
+
+ describe('GroupsListCtrl', function() {
+
+ var scope, ctrl, $t, $httpBackend;
+
+ beforeEach(module('ambariAdminConsole', function () {}));
+
+ beforeEach(inject(function($rootScope, $controller, _$translate_, _$httpBackend_) {
+ scope = $rootScope.$new();
+ $t = _$translate_.instant;
+ $httpBackend = _$httpBackend_;
+ ctrl = $controller('GroupsListCtrl', {
+ $scope: scope
+ });
+ }));
+
+ describe('#clearFilters()', function () {
+
+ it('should clear filters and reset pagination', function () {
+ scope.currentPage = 2;
+ scope.currentNameFilter = 'a';
+ scope.currentTypeFilter = {
+ label: $t('common.local'),
+ value: false
+ };
+ scope.clearFilters();
+ expect(scope.currentNameFilter).toEqual('');
+ expect(scope.currentTypeFilter).toEqual({
+ label: $t('common.all'),
+ value: '*'
+ });
+ expect(scope.currentPage).toEqual(1);
+ });
+
+ });
+
+ describe('#isNotEmptyFilter', function () {
+
+ var cases = [
+ {
+ currentNameFilter: '',
+ currentTypeFilter: null,
+ isNotEmptyFilter: false,
+ title: 'no filters'
+ },
+ {
+ currentNameFilter: '',
+ currentTypeFilter: {
+ value: '*'
+ },
+ isNotEmptyFilter: false,
+ title: 'empty filters'
+ },
+ {
+ currentNameFilter: 'a',
+ currentTypeFilter: {
+ value: '*'
+ },
+ isNotEmptyFilter: true,
+ title: 'name filter'
+ },
+ {
+ currentNameFilter: '0',
+ currentTypeFilter: {
+ value: '*'
+ },
+ isNotEmptyFilter: true,
+ title: 'name filter with "0" as string'
+ },
+ {
+ currentNameFilter: '',
+ currentTypeFilter: {
+ value: false
+ },
+ isNotEmptyFilter: true,
+ title: 'type filter'
+ },
+ {
+ currentNameFilter: 'a',
+ currentTypeFilter: {
+ value: false
+ },
+ isNotEmptyFilter: true,
+ title: 'both filters'
+ },
+ {
+ currentNameFilter: '0',
+ currentTypeFilter: {
+ value: false
+ },
+ isNotEmptyFilter: true,
+ title: 'both filters with "0" as string'
+ }
+ ];
+
+ cases.forEach(function (item) {
+ it(item.title, function () {
+ $httpBackend.expectGET(/\/api\/v1\/groups/).respond(200);
+ scope.currentNameFilter = item.currentNameFilter;
+ scope.currentTypeFilter = item.currentTypeFilter;
+ scope.$digest();
+ expect(scope.isNotEmptyFilter).toEqual(item.isNotEmptyFilter);
+ });
+ });
+
+ });
+
+ });
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a58cd46/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/stackVersions/StackversionsListCtrl_test.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/stackVersions/StackversionsListCtrl_test.js b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/stackVersions/StackversionsListCtrl_test.js
index f7a778a..1e47c20 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/stackVersions/StackversionsListCtrl_test.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/stackVersions/StackversionsListCtrl_test.js
@@ -18,18 +18,19 @@
describe('#Cluster', function () {
describe('StackVersionsListCtrl', function() {
- var scope, ctrl;
+ var scope, ctrl, $httpBackend;
beforeEach(module('ambariAdminConsole', function($provide) {
}));
- beforeEach(inject(function($rootScope, $controller) {
+ beforeEach(inject(function($rootScope, $controller, _$httpBackend_) {
scope = $rootScope.$new();
ctrl = $controller('StackVersionsListCtrl', {$scope: scope});
+ $httpBackend = _$httpBackend_;
}));
- describe('fetchRepos()', function () {
+ describe('#fetchRepos()', function () {
it('saves list of stacks', function() {
scope.fetchRepos().then(function() {
@@ -39,7 +40,7 @@ describe('#Cluster', function () {
});
- describe('fillClusters()', function () {
+ describe('#fillClusters()', function () {
var clusters = [
{
@@ -81,5 +82,115 @@ describe('#Cluster', function () {
});
+ describe('#isNotEmptyFilter', function () {
+
+ var cases = [
+ {
+ filter: {
+ version: '',
+ cluster: {
+ current: null
+ }
+ },
+ isNotEmptyFilter: false,
+ title: 'no filters'
+ },
+ {
+ filter: {
+ version: '',
+ cluster: {
+ current: {
+ value: ''
+ }
+ }
+ },
+ isNotEmptyFilter: false,
+ title: 'empty filters'
+ },
+ {
+ filter: {
+ version: 'a',
+ cluster: {
+ current: {
+ value: ''
+ }
+ }
+ },
+ isNotEmptyFilter: true,
+ title: 'version filter'
+ },
+ {
+ filter: {
+ version: '0',
+ cluster: {
+ current: {
+ value: ''
+ }
+ }
+ },
+ isNotEmptyFilter: true,
+ title: 'version filter with "0" as string'
+ },
+ {
+ filter: {
+ version: '',
+ cluster: {
+ current: {
+ value: 'a'
+ }
+ }
+ },
+ isNotEmptyFilter: true,
+ title: 'cluster filter'
+ },
+ {
+ filter: {
+ version: '',
+ cluster: {
+ current: {
+ value: '0'
+ }
+ }
+ },
+ isNotEmptyFilter: true,
+ title: 'cluster filter with "0" as string'
+ },
+ {
+ filter: {
+ version: 'a',
+ cluster: {
+ current: {
+ value: 'a'
+ }
+ }
+ },
+ isNotEmptyFilter: true,
+ title: 'both filters'
+ },
+ {
+ filter: {
+ version: '0',
+ cluster: {
+ current: {
+ value: '0'
+ }
+ }
+ },
+ isNotEmptyFilter: true,
+ title: 'both filters with "0" as string'
+ }
+ ];
+
+ cases.forEach(function (item) {
+ it(item.title, function () {
+ $httpBackend.expectGET(/\/api\/v1\/clusters\?_=\d+/).respond(200);
+ scope.filter = item.filter;
+ scope.$digest();
+ expect(scope.isNotEmptyFilter).toEqual(item.isNotEmptyFilter);
+ });
+ });
+
+ });
+
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a58cd46/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/users/UsersListCtrl_test.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/users/UsersListCtrl_test.js b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/users/UsersListCtrl_test.js
new file mode 100644
index 0000000..4b3b101
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/users/UsersListCtrl_test.js
@@ -0,0 +1,223 @@
+/**
+ * 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.
+ */
+
+describe('#Cluster', function () {
+
+ describe('UsersListCtrl', function() {
+
+ var scope, ctrl, $t, $httpBackend;
+
+ beforeEach(module('ambariAdminConsole', function () {}));
+
+ beforeEach(inject(function($rootScope, $controller, _$translate_, _$httpBackend_) {
+ scope = $rootScope.$new();
+ $t = _$translate_.instant;
+ $httpBackend = _$httpBackend_;
+ ctrl = $controller('UsersListCtrl', {
+ $scope: scope
+ });
+ }));
+
+ describe('#clearFilters()', function () {
+
+ it('should clear filters and reset pagination', function () {
+ scope.currentPage = 2;
+ scope.currentNameFilter = 'a';
+ scope.currentActiveFilter = {
+ label: $t('common.local'),
+ value: false
+ };
+ scope.currentTypeFilter = {
+ label: $t('common.local'),
+ value: 'LOCAL'
+ };
+ scope.clearFilters();
+ expect(scope.currentNameFilter).toEqual('');
+ expect(scope.currentActiveFilter).toEqual({
+ label: $t('common.all'),
+ value: '*'
+ });
+ expect(scope.currentTypeFilter).toEqual({
+ label: $t('common.all'),
+ value: '*'
+ });
+ expect(scope.currentPage).toEqual(1);
+ });
+
+ });
+
+ describe('#isNotEmptyFilter', function () {
+
+ var cases = [
+ {
+ currentNameFilter: '',
+ currentTypeFilter: null,
+ currentActiveFilter: null,
+ isNotEmptyFilter: false,
+ title: 'no filters'
+ },
+ {
+ currentNameFilter: '',
+ currentTypeFilter: {
+ value: '*'
+ },
+ currentActiveFilter: {
+ value: '*'
+ },
+ isNotEmptyFilter: false,
+ title: 'empty filters'
+ },
+ {
+ currentNameFilter: 'a',
+ currentTypeFilter: {
+ value: '*'
+ },
+ currentActiveFilter: {
+ value: '*'
+ },
+ isNotEmptyFilter: true,
+ title: 'name filter'
+ },
+ {
+ currentNameFilter: '0',
+ currentTypeFilter: {
+ value: '*'
+ },
+ currentActiveFilter: {
+ value: '*'
+ },
+ isNotEmptyFilter: true,
+ title: 'name filter with "0" as string'
+ },
+ {
+ currentNameFilter: '',
+ currentTypeFilter: {
+ value: 'LOCAL'
+ },
+ currentActiveFilter: {
+ value: '*'
+ },
+ isNotEmptyFilter: true,
+ title: 'type filter'
+ },
+ {
+ currentNameFilter: '',
+ currentTypeFilter: {
+ value: '*'
+ },
+ currentActiveFilter: {
+ value: false
+ },
+ isNotEmptyFilter: true,
+ title: 'activity filter'
+ },
+ {
+ currentNameFilter: 'a',
+ currentTypeFilter: {
+ value: 'LOCAL'
+ },
+ currentActiveFilter: {
+ value: '*'
+ },
+ isNotEmptyFilter: true,
+ title: 'name and type filters'
+ },
+ {
+ currentNameFilter: 'a',
+ currentTypeFilter: {
+ value: '*'
+ },
+ currentActiveFilter: {
+ value: false
+ },
+ isNotEmptyFilter: true,
+ title: 'name and activity filters'
+ },
+ {
+ currentNameFilter: '0',
+ currentTypeFilter: {
+ value: 'LOCAL'
+ },
+ currentActiveFilter: {
+ value: '*'
+ },
+ isNotEmptyFilter: true,
+ title: 'name and type filters with "0" as string'
+ },
+ {
+ currentNameFilter: '0',
+ currentTypeFilter: {
+ value: '*'
+ },
+ currentActiveFilter: {
+ value: false
+ },
+ isNotEmptyFilter: true,
+ title: 'name and activity filters with "0" as string'
+ },
+ {
+ currentNameFilter: '',
+ currentTypeFilter: {
+ value: 'LOCAL'
+ },
+ currentActiveFilter: {
+ value: false
+ },
+ isNotEmptyFilter: true,
+ title: 'type and activity filters'
+ },
+ {
+ currentNameFilter: 'a',
+ currentTypeFilter: {
+ value: false
+ },
+ currentActiveFilter: {
+ value: 'LOCAL'
+ },
+ isNotEmptyFilter: true,
+ title: 'all filters'
+ },
+ {
+ currentNameFilter: '0',
+ currentTypeFilter: {
+ value: false
+ },
+ currentActiveFilter: {
+ value: 'LOCAL'
+ },
+ isNotEmptyFilter: true,
+ title: 'all filters with "0" as string'
+ }
+ ];
+
+ cases.forEach(function (item) {
+ it(item.title, function () {
+ $httpBackend.expectGET(/\/api\/v1\/users/).respond(200);
+ scope.currentNameFilter = item.currentNameFilter;
+ scope.currentActiveFilter = item.currentActiveFilter;
+ scope.currentTypeFilter = item.currentTypeFilter;
+ scope.$digest();
+ expect(scope.isNotEmptyFilter).toEqual(item.isNotEmptyFilter);
+ });
+ });
+
+ });
+
+ });
+
+});
[08/50] [abbrv] ambari git commit: Revert "AMBARI-14504. Role command
order is parsed incorrectly causing Hive Service Check fail on 'Start all'
(aonishuk)"
Posted by nc...@apache.org.
Revert "AMBARI-14504. Role command order is parsed incorrectly causing Hive Service Check fail on 'Start all' (aonishuk)"
This reverts commit 48604428b05e8baa1c71e3a013f510aa5bb3a61e.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/30e6c684
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/30e6c684
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/30e6c684
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 30e6c68420da78c27f5527f8ae69776873918781
Parents: 4860442
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Mon Dec 28 16:22:16 2015 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Mon Dec 28 16:22:16 2015 +0200
----------------------------------------------------------------------
ambari-server/pom.xml | 11 ++
.../ambari/server/stack/StackDirectory.java | 6 +-
.../src/main/resources/role_command_order.json | 104 +++++++++++++++++++
3 files changed, 119 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/30e6c684/ambari-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index 9c0ba26..17d3aae 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -531,6 +531,9 @@
<source>
<location>${project.build.directory}/DBConnectionVerification.jar</location>
</source>
+ <source>
+ <location>src/main/resources/role_command_order.json</location>
+ </source>
</sources>
</mapping>
<mapping>
@@ -1003,6 +1006,14 @@
</mapper>
</data>
<data>
+ <src>src/main/resources/role_command_order.json</src>
+ <type>file</type>
+ <mapper>
+ <type>perm</type>
+ <prefix>/var/lib/ambari-server/resources</prefix>
+ </mapper>
+ </data>
+ <data>
<src>src/main/resources/scripts</src>
<type>directory</type>
<mapper>
http://git-wip-us.apache.org/repos/asf/ambari/blob/30e6c684/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
index c552e41..9cfeffe 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
@@ -487,8 +487,10 @@ public class StackDirectory extends StackDefinitionDirectory {
result = mapper.readValue(file, rcoElementTypeReference);
LOG.info("Role command order info was loaded from file: {}", file.getAbsolutePath());
} else {
- LOG.info("Stack '{}' doesn't contain role command order file", getPath());
- result = new HashMap<String, Object>();
+ InputStream rcoInputStream = ClassLoader.getSystemResourceAsStream(ROLE_COMMAND_ORDER_FILE);
+ result = mapper.readValue(rcoInputStream, rcoElementTypeReference);
+ LOG.info("Role command order info was loaded from classpath: " +
+ ClassLoader.getSystemResource(ROLE_COMMAND_ORDER_FILE));
}
roleCommandOrder = new StackRoleCommandOrder(result);
parseRoleCommandOrdersForServices();
http://git-wip-us.apache.org/repos/asf/ambari/blob/30e6c684/ambari-server/src/main/resources/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/role_command_order.json b/ambari-server/src/main/resources/role_command_order.json
new file mode 100644
index 0000000..870a537
--- /dev/null
+++ b/ambari-server/src/main/resources/role_command_order.json
@@ -0,0 +1,104 @@
+{
+ "_comment" : "Record format:",
+ "_comment" : "blockedRole-blockedCommand: [blockerRole1-blockerCommand1, blockerRole2-blockerCommand2, ...]",
+ "general_deps" : {
+ "_comment" : "dependencies for all cases",
+ "HBASE_MASTER-START": ["ZOOKEEPER_SERVER-START"],
+ "HBASE_REGIONSERVER-START": ["HBASE_MASTER-START"],
+ "OOZIE_SERVER-START": ["JOBTRACKER-START", "TASKTRACKER-START"],
+ "WEBHCAT_SERVER-START": ["TASKTRACKER-START", "HIVE_SERVER-START"],
+ "WEBHCAT_SERVER-RESTART": ["TASKTRACKER-RESTART", "HIVE_SERVER-RESTART"],
+ "HIVE_METASTORE-START": ["MYSQL_SERVER-START"],
+ "HIVE_METASTORE-RESTART": ["MYSQL_SERVER-RESTART"],
+ "HIVE_SERVER-START": ["TASKTRACKER-START", "MYSQL_SERVER-START"],
+ "HIVE_SERVER-RESTART": ["TASKTRACKER-RESTART", "MYSQL_SERVER-RESTART"],
+ "HUE_SERVER-START": ["HIVE_SERVER-START", "HCAT-START", "OOZIE_SERVER-START"],
+ "FLUME_HANDLER-START": ["OOZIE_SERVER-START"],
+ "ACCUMULO_MASTER-START": ["ZOOKEEPER_SERVER-START", "NAMENODE-START", "DATANODE-START"],
+ "ACCUMULO_TSERVER-START": ["ACCUMULO_MASTER-START"],
+ "ACCUMULO_MONITOR-START": ["ACCUMULO_MASTER-START"],
+ "ACCUMULO_GC-START": ["ACCUMULO_MASTER-START"],
+ "ACCUMULO_TRACER-START": ["ACCUMULO_MASTER-START", "ACCUMULO_TSERVER-START"],
+ "MAPREDUCE_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
+ "OOZIE_SERVICE_CHECK-SERVICE_CHECK": ["OOZIE_SERVER-START"],
+ "WEBHCAT_SERVICE_CHECK-SERVICE_CHECK": ["WEBHCAT_SERVER-START"],
+ "HBASE_SERVICE_CHECK-SERVICE_CHECK": ["HBASE_MASTER-START", "HBASE_REGIONSERVER-START"],
+ "HIVE_SERVICE_CHECK-SERVICE_CHECK": ["HIVE_SERVER-START", "HIVE_METASTORE-START"],
+ "HCAT_SERVICE_CHECK-SERVICE_CHECK": ["HIVE_SERVER-START"],
+ "PIG_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
+ "SQOOP_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
+ "ACCUMULO_SERVICE_CHECK-SERVICE_CHECK": ["ACCUMULO_MASTER-START", "ACCUMULO_TSERVER-START", "ACCUMULO_TRACER-START"],
+ "ZOOKEEPER_SERVICE_CHECK-SERVICE_CHECK": ["ZOOKEEPER_SERVER-START"],
+ "ZOOKEEPER_QUORUM_SERVICE_CHECK-SERVICE_CHECK": ["ZOOKEEPER_SERVER-START"],
+ "ZOOKEEPER_SERVER-STOP" : ["HBASE_MASTER-STOP", "HBASE_REGIONSERVER-STOP", "ACCUMULO_MASTER-STOP", "ACCUMULO_TSERVER-STOP", "ACCUMULO_GC-STOP"],
+ "ACCUMULO_MONITOR-STOP" : ["ACCUMULO_MASTER-STOP"],
+ "ACCUMULO_MASTER-STOP" : ["ACCUMULO_TSERVER-STOP"],
+ "ACCUMULO_TSERVER-STOP" : ["ACCUMULO_TRACER-STOP", "ACCUMULO_GC-STOP"],
+ "HBASE_MASTER-STOP": ["HBASE_REGIONSERVER-STOP"],
+ "TASKTRACKER-UPGRADE": ["JOBTRACKER-UPGRADE"],
+ "MAPREDUCE_CLIENT-UPGRADE": ["TASKTRACKER-UPGRADE", "JOBTRACKER-UPGRADE"],
+ "ZOOKEEPER_SERVER-UPGRADE": ["MAPREDUCE_CLIENT-UPGRADE"],
+ "ZOOKEEPER_CLIENT-UPGRADE": ["ZOOKEEPER_SERVER-UPGRADE"],
+ "HBASE_MASTER-UPGRADE": ["ZOOKEEPER_CLIENT-UPGRADE"],
+ "HBASE_REGIONSERVER-UPGRADE": ["HBASE_MASTER-UPGRADE"],
+ "HBASE_CLIENT-UPGRADE": ["HBASE_REGIONSERVER-UPGRADE"],
+ "HIVE_SERVER-UPGRADE" : ["HBASE_CLIENT-UPGRADE"],
+ "HIVE_METASTORE-UPGRADE" : ["HIVE_SERVER-UPGRADE"],
+ "MYSQL_SERVER-UPGRADE": ["HIVE_METASTORE-UPGRADE"],
+ "HIVE_CLIENT-UPGRADE": ["MYSQL_SERVER-UPGRADE"],
+ "HCAT-UPGRADE": ["HIVE_CLIENT-UPGRADE"],
+ "OOZIE_SERVER-UPGRADE" : ["HCAT-UPGRADE"],
+ "OOZIE_CLIENT-UPGRADE" : ["OOZIE_SERVER-UPGRADE"],
+ "WEBHCAT_SERVER-UPGRADE" : ["OOZIE_CLIENT-UPGRADE"],
+ "PIG-UPGRADE" : ["WEBHCAT_SERVER-UPGRADE"],
+ "SQOOP-UPGRADE" : ["PIG-UPGRADE"],
+ "GANGLIA_SERVER-UPGRADE" : ["SQOOP-UPGRADE"],
+ "GANGLIA_MONITOR-UPGRADE" : ["GANGLIA_SERVER-UPGRADE"]
+ },
+ "_comment" : "GLUSTERFS-specific dependencies",
+ "optional_glusterfs": {
+ "HBASE_MASTER-START": ["PEERSTATUS-START"],
+ "JOBTRACKER-START": ["PEERSTATUS-START"],
+ "TASKTRACKER-START": ["PEERSTATUS-START"],
+ "GLUSTERFS_SERVICE_CHECK-SERVICE_CHECK": ["PEERSTATUS-START"],
+ "JOBTRACKER-UPGRADE": ["GLUSTERFS_CLIENT-UPGRADE"]
+ },
+ "_comment" : "Dependencies that are used when GLUSTERFS is not present in cluster",
+ "optional_no_glusterfs": {
+ "SECONDARY_NAMENODE-START": ["NAMENODE-START"],
+ "RESOURCEMANAGER-START": ["NAMENODE-START", "DATANODE-START"],
+ "NODEMANAGER-START": ["NAMENODE-START", "DATANODE-START", "RESOURCEMANAGER-START"],
+ "HISTORYSERVER-START": ["NAMENODE-START", "DATANODE-START"],
+ "HBASE_MASTER-START": ["NAMENODE-START", "DATANODE-START"],
+ "JOBTRACKER-START": ["NAMENODE-START", "DATANODE-START"],
+ "TASKTRACKER-START": ["NAMENODE-START", "DATANODE-START"],
+ "HIVE_SERVER-START": ["DATANODE-START"],
+ "WEBHCAT_SERVER-START": ["DATANODE-START"],
+ "HDFS_SERVICE_CHECK-SERVICE_CHECK": ["NAMENODE-START", "DATANODE-START",
+ "SECONDARY_NAMENODE-START"],
+ "MAPREDUCE2_SERVICE_CHECK-SERVICE_CHECK": ["NODEMANAGER-START",
+ "RESOURCEMANAGER-START", "HISTORYSERVER-START", "YARN_SERVICE_CHECK-SERVICE_CHECK"],
+ "YARN_SERVICE_CHECK-SERVICE_CHECK": ["NODEMANAGER-START", "RESOURCEMANAGER-START"],
+ "RESOURCEMANAGER_SERVICE_CHECK-SERVICE_CHECK": ["RESOURCEMANAGER-START"],
+ "PIG_SERVICE_CHECK-SERVICE_CHECK": ["RESOURCEMANAGER-START", "NODEMANAGER-START"],
+ "NAMENODE-STOP": ["JOBTRACKER-STOP", "TASKTRACKER-STOP", "RESOURCEMANAGER-STOP",
+ "NODEMANAGER-STOP", "HISTORYSERVER-STOP", "HBASE_MASTER-STOP"],
+ "DATANODE-STOP": ["JOBTRACKER-STOP", "TASKTRACKER-STOP", "RESOURCEMANAGER-STOP",
+ "NODEMANAGER-STOP", "HISTORYSERVER-STOP", "HBASE_MASTER-STOP"],
+ "SECONDARY_NAMENODE-UPGRADE": ["NAMENODE-UPGRADE"],
+ "DATANODE-UPGRADE": ["SECONDARY_NAMENODE-UPGRADE"],
+ "HDFS_CLIENT-UPGRADE": ["DATANODE-UPGRADE"],
+ "JOBTRACKER-UPGRADE": ["HDFS_CLIENT-UPGRADE"]
+ },
+ "_comment" : "Dependencies that are used in HA NameNode cluster",
+ "namenode_optional_ha": {
+ "NAMENODE-START": ["JOURNALNODE-START", "ZOOKEEPER_SERVER-START"],
+ "ZKFC-START": ["NAMENODE-START"],
+ "HDFS_SERVICE_CHECK-SERVICE_CHECK": ["ZKFC-START"]
+ },
+ "_comment" : "Dependencies that are used in ResourceManager HA cluster",
+ "resourcemanager_optional_ha" : {
+ "RESOURCEMANAGER-START": ["ZOOKEEPER_SERVER-START"]
+ }
+}
+