You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2014/12/19 00:31:54 UTC
ambari git commit: AMBARI-8802. Kerberos Wizard -> Configure
Identities page: Show properties for only installed services. (jaimin)
Repository: ambari
Updated Branches:
refs/heads/trunk 4b52b64d1 -> 438d6c244
AMBARI-8802. Kerberos Wizard -> Configure Identities page: Show properties for only installed services. (jaimin)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/438d6c24
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/438d6c24
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/438d6c24
Branch: refs/heads/trunk
Commit: 438d6c244f3135635aada9cc46b88ba71fa42730
Parents: 4b52b64
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Thu Dec 18 15:30:27 2014 -0800
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Thu Dec 18 15:30:32 2014 -0800
----------------------------------------------------------------------
.../main/admin/kerberos/step4_controller.js | 22 ++++-
.../admin/kerberos/step4_controller_test.js | 84 ++++++++++++++++++++
2 files changed, 102 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/438d6c24/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
index 53ff138..279ef58 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
@@ -61,18 +61,25 @@ App.KerberosWizardStep4Controller = App.WizardStep7Controller.extend(App.AddSecu
setStepConfigs: function(configs) {
var selectedService = App.StackService.find().findProperty('serviceName', 'KERBEROS');
var configCategories = selectedService.get('configCategories');
- this.prepareConfigProperties(configs);
- this.get('stepConfigs').pushObject(this.createServiceConfig(configCategories, configs));
+ this.get('stepConfigs').pushObject(this.createServiceConfig(configCategories, this.prepareConfigProperties(configs)));
this.set('selectedService', this.get('stepConfigs')[0]);
},
/**
- *
- * @param {} configs
+ * Filter configs by installed services. Set property value observer.
+ * Set realm property with value from previous configuration step.
+ * Set appropriate category for all configs.
+ *
+ * @param {App.ServiceCofigProperty[]} configs
+ * @returns {App.ServiceConfigProperty[]}
*/
prepareConfigProperties: function(configs) {
var self = this;
var realmValue = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'realm').value;
+ var installedServiceNames = ['Cluster'].concat(App.Service.find().mapProperty('serviceName'));
+ configs = configs.filter(function(item) {
+ return installedServiceNames.contains(item.get('serviceName'));
+ });
configs.findProperty('name', 'realm').set('value', realmValue);
configs.findProperty('name', 'realm').set('defaultValue', realmValue);
@@ -89,8 +96,15 @@ App.KerberosWizardStep4Controller = App.WizardStep7Controller.extend(App.AddSecu
if (property.get('serviceName') == 'Cluster') property.set('category', 'General');
else property.set('category', 'Advanced');
});
+
+ return configs;
},
+ /**
+ * Sync up values between inherited property and its reference.
+ *
+ * @param {App.ServiceConfigProperty} configProperty
+ */
spnegoPropertiesObserver: function(configProperty) {
var self = this;
this.get('stepConfigs')[0].get('configs').forEach(function(config) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/438d6c24/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 4bced94..eaf663b 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
@@ -49,5 +49,89 @@ describe('App.KerberosWizardStep4Controller', function() {
expect(controller.createServiceConfig([], [])).be.instanceof(App.ServiceConfig);
});
});
+
+ describe('#prepareConfigProperties', function() {
+
+ before(function() {
+ var controller = App.KerberosWizardStep4Controller.create({
+ wizardController: {
+ getDBProperty: function() {
+ return Em.A([
+ Em.Object.create({ name: 'realm', value: 'realm_value' })
+ ]);
+ }
+ }
+ });
+ sinon.stub(App.Service, 'find').returns(Em.A([
+ { serviceName: 'HDFS' }
+ ]));
+ this.result = controller.prepareConfigProperties(properties);
+ });
+
+ after(function() {
+ App.Service.find.restore();
+ });
+
+ var properties = Em.A([
+ Em.Object.create({ name: 'realm', value: '', serviceName: 'Cluster' }),
+ Em.Object.create({ name: 'spnego_keytab', value: 'spnego_keytab_value', serviceName: 'Cluster' }),
+ Em.Object.create({ name: 'hdfs_keytab', value: '', serviceName: 'HDFS', observesValueFrom: 'spnego_keytab' }),
+ Em.Object.create({ name: 'falcon_keytab', value: 'falcon_keytab_value', serviceName: 'FALCON' }),
+ Em.Object.create({ name: 'mapreduce_keytab', value: 'mapreduce_keytab_value', serviceName: 'MAPREDUCE2' }),
+ Em.Object.create({ name: 'hdfs_principal', value: 'hdfs_principal_value', serviceName: 'HDFS' })
+ ]);
+
+ var propertyValidationCases = [
+ {
+ property: 'spnego_keytab',
+ e: [
+ { key: 'category', value: 'General' },
+ { key: 'observesValueFrom', absent: true },
+ ]
+ },
+ {
+ property: 'realm',
+ e: [
+ { key: 'category', value: 'General' },
+ { key: 'value', value: 'realm_value' },
+ ]
+ },
+ {
+ property: 'hdfs_keytab',
+ e: [
+ { key: 'value', value: 'spnego_keytab_value' },
+ { key: 'observesValueFrom', value: 'spnego_keytab' },
+ ]
+ }
+ ];
+
+ var absentPropertiesTest = ['falcon_keytab', 'mapreduce_keytab'];
+
+ it('should contains properties only for installed services', function() {
+ expect(this.result.mapProperty('serviceName').uniq()).to.be.eql(['Cluster', 'HDFS']);
+ });
+
+ absentPropertiesTest.forEach(function(item) {
+ it('property `{0}` should be absent'.format(item), function() {
+ expect(this.result.findProperty('name', item)).to.be.undefined;
+ });
+ }, this);
+
+ propertyValidationCases.forEach(function(test) {
+ it('property {0} should be created'.format(test.property), function() {
+ expect(this.result.findProperty('name', test.property)).to.be.ok;
+ });
+ test.e.forEach(function(expected) {
+ it('property `{0}` should have `{1}` with value `{2}`'.format(test.property, expected.key, expected.value), function() {
+ if (!!expected.absent) {
+ expect(this.result.findProperty('name', test.property)).to.not.have.deep.property(expected.key);
+ } else {
+ expect(this.result.findProperty('name', test.property)).to.have.deep.property(expected.key, expected.value);
+ }
+ }, this);
+ }, this);
+ });
+
+ });
});