You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2015/11/06 17:08:22 UTC
ambari git commit: AMBARI-13776. Remove hardcoded logic for handling
db properties (akovalenko)
Repository: ambari
Updated Branches:
refs/heads/trunk d6c7038b8 -> 62ff7acfe
AMBARI-13776. Remove hardcoded logic for handling db properties (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/62ff7acf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/62ff7acf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/62ff7acf
Branch: refs/heads/trunk
Commit: 62ff7acfe7f8e209364f49dd4a2b07e97ffafe00
Parents: d6c7038
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Fri Nov 6 18:03:43 2015 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri Nov 6 18:03:43 2015 +0200
----------------------------------------------------------------------
ambari-web/app/views/common/controls_view.js | 15 ++---
.../test/views/common/controls_view_test.js | 69 ++++++++++++++++++++
2 files changed, 73 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/62ff7acf/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 1d11ad3..02f7cda 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -455,18 +455,11 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
* properties with these names don'use handleDBConnectionProperty method
*/
dontUseHandleDbConnection: function () {
- var version = App.get('currentStackVersion').match(/(\d+)[\.,]?(\d+)?/),
- majorVersion = version?version[1]: 0,
- minorVersion = version? version[2]: 0;
- // functionality added in HDP 2.3
+ // functionality added in Ranger 0.5
// remove DB_FLAVOR so it can handle DB Connection checks
- // PHD-2.3 and SAPHD-1.0 is based on HDP-2.3
- var supportFromMap = {
- 'HDP': 2.3,
- 'PHD': 3.3,
- 'SAPHD': 1.0
- };
- if (Number(majorVersion + '.' + minorVersion) < supportFromMap[App.get('currentStackName')]){
+ var rangerService = App.StackService.find().findProperty('serviceName', 'RANGER');
+ var rangerVersion = rangerService ? rangerService.get('serviceVersion') : '';
+ if (rangerVersion && rangerVersion.split('.')[0] < 1 && rangerVersion.split('.')[1] < 5) {
return ['DB_FLAVOR', 'authentication_method'];
}
return ['ranger.authentication.method'];
http://git-wip-us.apache.org/repos/asf/ambari/blob/62ff7acf/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 b1914c0..6443cf5 100644
--- a/ambari-web/test/views/common/controls_view_test.js
+++ b/ambari-web/test/views/common/controls_view_test.js
@@ -110,6 +110,7 @@ describe('App.ServiceConfigRadioButtons', function () {
}
}),
currentStackVersion: 'HDP-2.2',
+ rangerVersion: '0.4.0',
propertyAppendTo1: 'javax.jdo.option.ConnectionURL',
propertyAppendTo2: 'hive_database',
isAdditionalView1Null: true,
@@ -139,6 +140,7 @@ describe('App.ServiceConfigRadioButtons', function () {
}
}),
currentStackVersion: 'HDP-2.2',
+ rangerVersion: '0.4.0',
propertyAppendTo1: 'javax.jdo.option.ConnectionURL',
propertyAppendTo2: 'hive_database',
isAdditionalView1Null: false,
@@ -168,6 +170,7 @@ describe('App.ServiceConfigRadioButtons', function () {
}
}),
currentStackVersion: 'HDP-2.2',
+ rangerVersion: '0.4.0',
propertyAppendTo1: 'oozie.service.JPAService.jdbc.url',
propertyAppendTo2: 'oozie_database',
isAdditionalView1Null: true,
@@ -197,6 +200,7 @@ describe('App.ServiceConfigRadioButtons', function () {
}
}),
currentStackVersion: 'HDP-2.2',
+ rangerVersion: '0.4.0',
propertyAppendTo1: 'oozie.service.JPAService.jdbc.url',
propertyAppendTo2: 'oozie_database',
isAdditionalView1Null: false,
@@ -224,6 +228,7 @@ describe('App.ServiceConfigRadioButtons', function () {
}
}),
currentStackVersion: 'HDP-2.2',
+ rangerVersion: '0.4.0',
propertyAppendTo1: 'ranger.jpa.jdbc.url',
propertyAppendTo2: 'DB_FLAVOR',
isAdditionalView1Null: true,
@@ -251,6 +256,7 @@ describe('App.ServiceConfigRadioButtons', function () {
}
}),
currentStackVersion: 'HDP-2.3',
+ rangerVersion: '0.5.0',
propertyAppendTo1: 'ranger.jpa.jdbc.url',
propertyAppendTo2: 'DB_FLAVOR',
isAdditionalView1Null: false,
@@ -267,6 +273,7 @@ describe('App.ServiceConfigRadioButtons', function () {
afterEach(function () {
App.get.restore();
+ App.StackService.find.restore();
view.sendRequestRorDependentConfigs.restore();
});
@@ -277,6 +284,12 @@ describe('App.ServiceConfigRadioButtons', function () {
cases.forEach(function (item) {
it(item.title, function () {
sinon.stub(App, 'get').withArgs('currentStackName').returns('HDP').withArgs('currentStackVersion').returns(item.currentStackVersion);
+ sinon.stub(App.StackService, 'find', function() {
+ return [Em.Object.create({
+ serviceName: 'RANGER',
+ serviceVersion: item.rangerVersion || ''
+ })];
+ });
view.reopen({controller: item.controller});
sinon.stub(view, 'sendRequestRorDependentConfigs', Em.K);
view.setProperties({
@@ -404,6 +417,62 @@ describe('App.ServiceConfigRadioButtons', function () {
});
});
+
+ describe('#dontUseHandleDbConnection', function () {
+ var rangerService = Em.Object.create({
+ serviceName: 'RANGER'
+ });
+ beforeEach(function () {
+ sinon.stub(App.StackService, 'find', function () {
+ return [rangerService];
+ });
+ });
+
+ afterEach(function () {
+ App.StackService.find.restore();
+ });
+
+ var cases = [
+ {
+ title: 'Should return properties for old version of Ranger',
+ version: '0.1',
+ result: ['DB_FLAVOR', 'authentication_method']
+ },
+ {
+ title: 'Should return properties for old version of Ranger',
+ version: '0.4.0',
+ result: ['DB_FLAVOR', 'authentication_method']
+ },
+ {
+ title: 'Should return properties for old version of Ranger',
+ version: '0.4.9',
+ result: ['DB_FLAVOR', 'authentication_method']
+ },
+ {
+ title: 'Should return properties for new version of Ranger',
+ version: '0.5.0',
+ result: ['ranger.authentication.method']
+ },
+ {
+ title: 'Should return properties for new version of Ranger',
+ version: '1.0.0',
+ result: ['ranger.authentication.method']
+ },
+ {
+ title: 'Should return properties for new version of Ranger',
+ version: '0.5.0.1',
+ result: ['ranger.authentication.method']
+ }
+ ];
+
+ cases.forEach(function (test) {
+ it(test.title, function () {
+ rangerService.set('serviceVersion', test.version);
+ expect(view.get('dontUseHandleDbConnection')).to.eql(test.result);
+ });
+ });
+ });
+
});
describe('App.ServiceConfigRadioButton', function () {