|
@@ -19,11 +19,49 @@
|
|
var App = require('app');
|
|
var App = require('app');
|
|
require('config');
|
|
require('config');
|
|
require('utils/config');
|
|
require('utils/config');
|
|
|
|
+require('models/service/hdfs');
|
|
|
|
+var setups = require('test/init_model_test');
|
|
|
|
+var modelSetup = setups.configs;
|
|
|
|
|
|
describe('App.config', function () {
|
|
describe('App.config', function () {
|
|
|
|
|
|
App.supports.capacitySchedulerUi = true;
|
|
App.supports.capacitySchedulerUi = true;
|
|
|
|
|
|
|
|
+ var loadServiceSpecificConfigs = function(context, serviceName) {
|
|
|
|
+ context.configGroups = modelSetup.setupConfigGroupsObject(serviceName);
|
|
|
|
+ context.advancedConfigs = modelSetup.setupAdvancedConfigsObject();
|
|
|
|
+ context.tags = modelSetup.setupServiceConfigTagsObject(serviceName);
|
|
|
|
+ context.result = App.config.mergePreDefinedWithLoaded(context.configGroups, context.advancedConfigs, context.tags, App.Service.find().findProperty('id', serviceName).get('serviceName'));
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ var loadAllServicesConfigs = function(context, serviceNames) {
|
|
|
|
+ context.configGroups = modelSetup.setupConfigGroupsObject();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var loadServiceModelsData = function(serviceNames) {
|
|
|
|
+ serviceNames.forEach(function(serviceName) {
|
|
|
|
+ App.store.load(App.Service, {
|
|
|
|
+ id: serviceName,
|
|
|
|
+ service_name: serviceName
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ var setupContentForMergeWithStored = function(context) {
|
|
|
|
+ loadServiceModelsData(context.installedServiceNames);
|
|
|
|
+ loadAllServicesConfigs(context);
|
|
|
|
+ setups.setupStackVersion(this, 'HDP-2.1');
|
|
|
|
+ context.result = App.config.mergePreDefinedWithStored(context.storedConfigs, modelSetup.setupAdvancedConfigsObject(), context.installedServiceNames);
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ var removeServiceModelData = function(serviceIds) {
|
|
|
|
+ serviceIds.forEach(function(serviceId) {
|
|
|
|
+ var record = App.Service.find(serviceId);
|
|
|
|
+ record.deleteRecord();
|
|
|
|
+ record.get('stateManager').transitionTo('loading');
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+
|
|
describe('#identifyCategory', function () {
|
|
describe('#identifyCategory', function () {
|
|
var data = {};
|
|
var data = {};
|
|
it('should return null if config doesn\'t have category', function () {
|
|
it('should return null if config doesn\'t have category', function () {
|
|
@@ -119,6 +157,86 @@ describe('App.config', function () {
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ describe('#capacitySchedulerFilter', function() {
|
|
|
|
+ var testMessage = 'filter should {0} detect `{1}` property';
|
|
|
|
+ describe('Stack version >= 2.0', function() {
|
|
|
|
+ before(function() {
|
|
|
|
+ setups.setupStackVersion(this, 'HDP-2.1');
|
|
|
|
+ });
|
|
|
|
+ var tests = [
|
|
|
|
+ {
|
|
|
|
+ config: {
|
|
|
|
+ name: 'yarn.scheduler.capacity.maximum-am-resource-percent'
|
|
|
|
+ },
|
|
|
|
+ e: false
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ config: {
|
|
|
|
+ name: 'yarn.scheduler.capacity.root.capacity'
|
|
|
|
+ },
|
|
|
|
+ e: false
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ config: {
|
|
|
|
+ name: 'yarn.scheduler.capacity.root.default.capacity'
|
|
|
|
+ },
|
|
|
|
+ e: true
|
|
|
|
+ }
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ tests.forEach(function(test){
|
|
|
|
+ it(testMessage.format( !!test.e ? '' : 'not', test.config.name), function() {
|
|
|
|
+ expect(App.config.get('capacitySchedulerFilter')(test.config)).to.eql(test.e);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ after(function() {
|
|
|
|
+ setups.restoreStackVersion(this);
|
|
|
|
+ })
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe('Stack version < 2.0', function() {
|
|
|
|
+ before(function() {
|
|
|
|
+ setups.setupStackVersion(this, 'HDP-1.3');
|
|
|
|
+ });
|
|
|
|
+ var tests = [
|
|
|
|
+ {
|
|
|
|
+ config: {
|
|
|
|
+ name: 'mapred.capacity-scheduler.maximum-system-jobs'
|
|
|
|
+ },
|
|
|
|
+ e: false
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ config: {
|
|
|
|
+ name: 'yarn.scheduler.capacity.root.capacity'
|
|
|
|
+ },
|
|
|
|
+ e: false
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ config: {
|
|
|
|
+ name: 'mapred.capacity-scheduler.queue.default.capacity'
|
|
|
|
+ },
|
|
|
|
+ e: true
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ config: {
|
|
|
|
+ name: 'mapred.queue.default.acl-administer-jobs'
|
|
|
|
+ },
|
|
|
|
+ e: true
|
|
|
|
+ }
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ tests.forEach(function(test){
|
|
|
|
+ it(testMessage.format( !!test.e ? '' : 'not', test.config.name), function() {
|
|
|
|
+ expect(App.config.get('capacitySchedulerFilter')(test.config)).to.eql(test.e);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ after(function() {
|
|
|
|
+ setups.restoreStackVersion(this);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
describe('#fileConfigsIntoTextarea', function () {
|
|
describe('#fileConfigsIntoTextarea', function () {
|
|
var filename = 'capacity-scheduler.xml';
|
|
var filename = 'capacity-scheduler.xml';
|
|
var configs = [
|
|
var configs = [
|
|
@@ -253,13 +371,387 @@ describe('App.config', function () {
|
|
{
|
|
{
|
|
html: 'LD_LIBRARY_PATH=/usr/lib/hadoop/lib/native:/usr/lib/hadoop/lib/native/`$JAVA_HOME/bin/java -d32 -version &> /dev/null;if [ $? -eq 0 ]; then echo Linux-i386-32; else echo Linux-amd64-64;fi`',
|
|
html: 'LD_LIBRARY_PATH=/usr/lib/hadoop/lib/native:/usr/lib/hadoop/lib/native/`$JAVA_HOME/bin/java -d32 -version &> /dev/null;if [ $? -eq 0 ]; then echo Linux-i386-32; else echo Linux-amd64-64;fi`',
|
|
json: 'LD_LIBRARY_PATH=/usr/lib/hadoop/lib/native:/usr/lib/hadoop/lib/native/`$JAVA_HOME/bin/java -d32 -version &> /dev/null;if [ $? -eq 0 ]; then echo Linux-i386-32; else echo Linux-amd64-64;fi`'
|
|
json: 'LD_LIBRARY_PATH=/usr/lib/hadoop/lib/native:/usr/lib/hadoop/lib/native/`$JAVA_HOME/bin/java -d32 -version &> /dev/null;if [ $? -eq 0 ]; then echo Linux-i386-32; else echo Linux-amd64-64;fi`'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ html: '&&&',
|
|
|
|
+ json: '&&&',
|
|
|
|
+ toXml: true
|
|
}
|
|
}
|
|
];
|
|
];
|
|
testConfigs.forEach(function(t){
|
|
testConfigs.forEach(function(t){
|
|
- it('parsing html ' + t.html, function () {
|
|
|
|
- expect(t.json).to.equal(App.config.escapeXMLCharacters(t.html));
|
|
|
|
|
|
+ it('parsing html ' + t.html + ' `toXml` param passed ' + !!t.toXml, function () {
|
|
|
|
+ expect(t.json).to.equal(App.config.escapeXMLCharacters(t.html, t.toXml));
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe('#mergePreDefinedWithLoaded()', function() {
|
|
|
|
+ before(function() {
|
|
|
|
+ loadServiceModelsData(['HDFS','STORM','ZOOKEEPER']);
|
|
|
|
+ setups.setupStackVersion(this, 'HDP-2.1');
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe('Load STORM configs: global, storm-site', function() {
|
|
|
|
+ before(function() {
|
|
|
|
+ loadServiceSpecificConfigs(this, "STORM");
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ it('site property with `masterHosts` display type should pass value validation', function() {
|
|
|
|
+ var property = this.result.configs.findProperty('name', 'storm.zookeeper.servers');
|
|
|
|
+ expect(property).to.be.ok;
|
|
|
|
+ expect(property.displayType).to.eql('masterHosts');
|
|
|
|
+ expect(property.value).to.eql(["c6401.ambari.apache.org", "c6402.ambari.apache.org"]);
|
|
|
|
+ expect(property.category).to.eql('General')
|
|
|
|
+ });
|
|
|
|
+ it('non-predefined global properties should not be displayed on UI', function() {
|
|
|
|
+ var property = this.result.globalConfigs.findProperty('name', 'nonexistent_property');
|
|
|
|
+ expect(property).to.be.a('object');
|
|
|
|
+ expect(property.isVisible).to.be.false;
|
|
|
|
+ });
|
|
|
|
+ it('non-predefined site properties should have displayType advanced/multiLine', function() {
|
|
|
|
+ var tests = [
|
|
|
|
+ {
|
|
|
|
+ property: 'single_line_property',
|
|
|
|
+ e: 'advanced'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ property: 'multi_line_property',
|
|
|
|
+ e: 'multiLine'
|
|
|
|
+ }
|
|
|
|
+ ];
|
|
|
|
+ tests.forEach(function(test) {
|
|
|
|
+ var property = this.result.configs.findProperty('name', test.property);
|
|
|
|
+ expect(property).to.be.ok;
|
|
|
|
+ expect(property.displayType).to.eql(test.e);
|
|
|
|
+ }, this);
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe('Load HDFS configs: global, hdfs-site, core-site', function() {
|
|
|
|
+ before(function() {
|
|
|
|
+ loadServiceSpecificConfigs(this, "HDFS");
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ it('Data Node, Name Node, SName Node directory properties should have sorted values', function() {
|
|
|
|
+ var tests = [
|
|
|
|
+ {
|
|
|
|
+ property: "dfs.datanode.data.dir",
|
|
|
|
+ e: '/a,/b'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ property: "dfs.namenode.name.dir",
|
|
|
|
+ e: '/a,/b,/c'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ property: "dfs.namenode.checkpoint.dir",
|
|
|
|
+ e: '/a'
|
|
|
|
+ }
|
|
|
|
+ ];
|
|
|
|
+ tests.forEach(function(test) {
|
|
|
|
+ var property = this.result.configs.findProperty('name', test.property);
|
|
|
|
+ expect(property).to.be.ok;
|
|
|
|
+ expect(property.value).to.eql(test.e);
|
|
|
|
+ }, this);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe('Load ZOOKEEPER configs: global, zoo.cfg', function() {
|
|
|
|
+ before(function() {
|
|
|
|
+ loadServiceSpecificConfigs(this, "ZOOKEEPER");
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ it('zoo.cfg configs should have non xml filename', function() {
|
|
|
|
+ expect(this.result.configs.findProperty('name', 'custom.zoo.cfg').filename).to.eql('zoo.cfg');
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ after(function() {
|
|
|
|
+ removeServiceModelData(['HDFS','STORM','ZOOKEEPER']);
|
|
|
|
+ setups.restoreStackVersion(this);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe('#syncOrderWithPredefined()', function() {
|
|
|
|
+ before(function() {
|
|
|
|
+ setups.setupStackVersion(this, 'HDP-2.1');
|
|
|
|
+ loadServiceModelsData(['HDFS','STORM','ZOOKEEPER']);
|
|
|
|
+ loadServiceSpecificConfigs(this, 'HDFS');
|
|
|
|
+ });
|
|
|
|
+ it('properties should be ordered according to position in predefined data', function() {
|
|
|
|
+ var result = App.config.syncOrderWithPredefined(this.result);
|
|
|
|
+ expect(result).to.be.a('object');
|
|
|
|
+ expect(result.configs.filterProperty('category','DataNode').mapProperty('name')).to.eql(['dfs.datanode.failed.volumes.tolerated', 'dfs.datanode.data.dir']);
|
|
|
|
+ });
|
|
|
|
+ after(function() {
|
|
|
|
+ removeServiceModelData(['HDFS','STORM','ZOOKEEPER']);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe('#mergePreDefinedWithStored()', function() {
|
|
|
|
+ describe('without `storedConfigs` parameter', function() {
|
|
|
|
+ before(function() {
|
|
|
|
+ this.installedServiceNames = ['HDFS','STORM', 'ZOOKEEPER'];
|
|
|
|
+ setupContentForMergeWithStored(this);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ var tests = [
|
|
|
|
+ {
|
|
|
|
+ property: 'dfs.datanode.data.dir',
|
|
|
|
+ e: '/hadoop/hdfs/data'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ property: 'dfs.datanode.failed.volumes.tolerated',
|
|
|
|
+ e: '2'
|
|
|
|
+ }
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ tests.forEach(function(test) {
|
|
|
|
+ it('should set value and defaultValue to ' + test.e + ' for `' + test.property + '`', function() {
|
|
|
|
+ expect(this.result.findProperty('name', test.property).value).to.eql(test.e);
|
|
|
|
+ expect(this.result.findProperty('name', test.property).defaultValue).to.eql(test.e);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ after(function() {
|
|
|
|
+ removeServiceModelData(this.installedServiceNames);
|
|
|
|
+ setups.restoreStackVersion(this);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe('with `storedConfigs` parameter', function() {
|
|
|
|
+ before(function() {
|
|
|
|
+ this.installedServiceNames = ['HDFS','STORM','ZOOKEEPER'];
|
|
|
|
+ this.storedConfigs = modelSetup.setupStoredConfigsObject();
|
|
|
|
+ setupContentForMergeWithStored(this);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ var tests = [
|
|
|
|
+ {
|
|
|
|
+ property: 'nonexistent_property',
|
|
|
|
+ stored: true,
|
|
|
|
+ e: {
|
|
|
|
+ value: 'some value',
|
|
|
|
+ isVisible: false,
|
|
|
|
+ category: 'Advanced',
|
|
|
|
+ displayType: 'advanced',
|
|
|
|
+ isRequired: true,
|
|
|
|
+ isOverridable: true
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ property: 'content',
|
|
|
|
+ filename: 'hdfs-log4j.xml',
|
|
|
|
+ stored: true,
|
|
|
|
+ predefined: true,
|
|
|
|
+ e: {
|
|
|
|
+ value: 'hdfs log4j content',
|
|
|
|
+ defaultValue: 'hdfs log4j content',
|
|
|
|
+ displayType: 'content'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ property: 'content',
|
|
|
|
+ filename: 'zookeeper-log4j.xml',
|
|
|
|
+ stored: false,
|
|
|
|
+ predefined: true,
|
|
|
|
+ e: {
|
|
|
|
+ value: 'zookeeper log4j.xml content',
|
|
|
|
+ defaultValue: 'zookeeper log4j.xml content',
|
|
|
|
+ displayType: 'content'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ tests.forEach(function(test) {
|
|
|
|
+ it('`{0}` should pass validation. stored/predefined: {1}/{2}'.format(test.property, !!test.stored, !!test.predefined), function() {
|
|
|
|
+ var property = test.property == 'content' ? this.result.filterProperty('name', 'content').findProperty('filename', test.filename) : this.result.findProperty('name', test.property);
|
|
|
|
+ for (var key in test.e) {
|
|
|
|
+ expect(property[key]).to.be.eql(test.e[key]);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ after(function(){
|
|
|
|
+ removeServiceModelData(this.installedServiceNames);
|
|
|
|
+ setups.restoreStackVersion(this);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe('#addAvancedConfigs()', function() {
|
|
|
|
+ before(function() {
|
|
|
|
+ this.storedConfigs = modelSetup.setupStoredConfigsObject();
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ it('`custom.zoo.cfg` absent in stored configs', function() {
|
|
|
|
+ expect(this.storedConfigs.findProperty('name', 'custom.zoo.cfg')).to.be.undefined;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ it('`custom.zoo.cfg.` from advanced configs should be added to stored configs', function() {
|
|
|
|
+ App.config.addAdvancedConfigs(this.storedConfigs, modelSetup.setupAdvancedConfigsObject(), 'ZOOKEEPER');
|
|
|
|
+ var property = this.storedConfigs.findProperty('name', 'custom.zoo.cfg');
|
|
|
|
+ expect(property).to.be.ok;
|
|
|
|
+ expect(property.category).to.eql('Advanced');
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ it('`capacity-scheduler.xml` configs related to `YARN` service should have category `CapacityScheduler`', function() {
|
|
|
|
+ App.config.addAdvancedConfigs(this.storedConfigs, modelSetup.setupAdvancedConfigsObject(), 'YARN');
|
|
|
|
+ expect(this.storedConfigs.filterProperty('filename', 'capacity-scheduler.xml').mapProperty('category').uniq()).to.eql(['CapacityScheduler']);
|
|
|
|
+ });
|
|
|
|
+ it('`capacity-scheduler.xml` property with name `content` should have `displayType` `multiLine`', function() {
|
|
|
|
+ expect(this.storedConfigs.filterProperty('filename', 'capacity-scheduler.xml').findProperty('name','content').displayType).to.eql('multiLine');
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe('#addCustomConfigs()', function() {
|
|
|
|
+ before(function() {
|
|
|
|
+ setups.setupStackVersion(this, 'HDP-2.1');
|
|
|
|
+ this.storedConfigs = modelSetup.setupStoredConfigsObject();
|
|
|
|
+ App.config.addAdvancedConfigs(this.storedConfigs, modelSetup.setupAdvancedConfigsObject(), 'ZOOKEEPER');
|
|
|
|
+ App.config.addAdvancedConfigs(this.storedConfigs, modelSetup.setupAdvancedConfigsObject(), 'YARN');
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ it('`yarn.scheduler.capacity.root.default.capacity` should have `isQueue` flag on', function() {
|
|
|
|
+ App.config.addCustomConfigs(this.storedConfigs);
|
|
|
|
+ expect(this.storedConfigs.findProperty('name','yarn.scheduler.capacity.root.default.capacity').isQueue).to.be.ok;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ after(function() {
|
|
|
|
+ setups.restoreStackVersion(this);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe('#createServiceConfig()', function() {
|
|
|
|
+ it('should create valid object for `HDFS`', function() {
|
|
|
|
+ var ServiceConfig = App.config.createServiceConfig('HDFS');
|
|
|
|
+ expect(ServiceConfig.configCategories.mapProperty('name')).to.include.members(["NameNode","SNameNode","DataNode"]);
|
|
|
|
+ });
|
|
|
|
+ it('should create valid object for `YARN` with capacity scheduler flag `on`', function() {
|
|
|
|
+ var ServiceConfig = App.config.createServiceConfig('YARN');
|
|
|
|
+ expect(ServiceConfig.configCategories.mapProperty('name')).to.include.members(["ResourceManager","NodeManager"]);
|
|
|
|
+ expect(ServiceConfig.configCategories.findProperty('name', 'CapacityScheduler').customView).to.be.a('Function');
|
|
|
|
+ expect(ServiceConfig.configCategories.findProperty('name', 'CapacityScheduler').isCustomView).to.true;
|
|
|
|
+ });
|
|
|
|
+ it('should create valid object for `YARN` with capacity scheduler flag `off`', function() {
|
|
|
|
+ App.supports.capacitySchedulerUi = false;
|
|
|
|
+ var ServiceConfig = App.config.createServiceConfig('YARN');
|
|
|
|
+ expect(ServiceConfig.configCategories.mapProperty('name')).to.include.members(["ResourceManager","NodeManager"]);
|
|
|
|
+ expect(ServiceConfig.configCategories.findProperty('name', 'CapacityScheduler').isCustomView).to.false;
|
|
|
|
+ App.supports.capacitySchedulerUi = true;
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe('#trimProperty',function() {
|
|
|
|
+ var testMessage = 'displayType `{0}`, value `{1}`{3} should return `{2}`';
|
|
|
|
+ var tests = [
|
|
|
|
+ {
|
|
|
|
+ config: {
|
|
|
|
+ displayType: 'directory',
|
|
|
|
+ value: ' /a /b /c'
|
|
|
|
+ },
|
|
|
|
+ e: '/a,/b,/c'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ config: {
|
|
|
|
+ displayType: 'directories',
|
|
|
|
+ value: ' /a /b '
|
|
|
|
+ },
|
|
|
|
+ e: '/a,/b'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ config: {
|
|
|
|
+ displayType: 'host',
|
|
|
|
+ value: ' localhost '
|
|
|
|
+ },
|
|
|
|
+ e: 'localhost'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ config: {
|
|
|
|
+ displayType: 'password',
|
|
|
|
+ value: ' passw ord '
|
|
|
|
+ },
|
|
|
|
+ e: ' passw ord '
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ config: {
|
|
|
|
+ displayType: 'advanced',
|
|
|
|
+ value: ' value'
|
|
|
|
+ },
|
|
|
|
+ e: ' value'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ config: {
|
|
|
|
+ displayType: 'advanced',
|
|
|
|
+ value: ' value'
|
|
|
|
+ },
|
|
|
|
+ e: ' value'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ config: {
|
|
|
|
+ displayType: 'advanced',
|
|
|
|
+ value: 'http://localhost ',
|
|
|
|
+ name: 'javax.jdo.option.ConnectionURL'
|
|
|
|
+ },
|
|
|
|
+ e: 'http://localhost'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ config: {
|
|
|
|
+ displayType: 'advanced',
|
|
|
|
+ value: 'http://localhost ',
|
|
|
|
+ name: 'oozie.service.JPAService.jdbc.url'
|
|
|
|
+ },
|
|
|
|
+ e: 'http://localhost'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ config: {
|
|
|
|
+ displayType: 'custom',
|
|
|
|
+ value: ' custom value '
|
|
|
|
+ },
|
|
|
|
+ e: ' custom value'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ config: {
|
|
|
|
+ displayType: 'masterHosts',
|
|
|
|
+ value: ['host1.com', 'host2.com']
|
|
|
|
+ },
|
|
|
|
+ e: ['host1.com', 'host2.com']
|
|
|
|
+ }
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ tests.forEach(function(test) {
|
|
|
|
+ it(testMessage.format(test.config.displayType, test.config.value, test.e, !!test.config.name ? ', name `' + test.config.name + '`' : ''), function() {
|
|
|
|
+ expect(App.config.trimProperty(test.config)).to.eql(test.e);
|
|
|
|
+ expect(App.config.trimProperty(Em.Object.create(test.config), true)).to.eql(test.e);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
+ });
|
|
|
|
|
|
|
|
+ describe('#OnNnHAHideSnn()', function() {
|
|
|
|
+ it('`SNameNode` category present in `ServiceConfig`. It should be removed.', function() {
|
|
|
|
+ App.store.load(App.HDFSService, {
|
|
|
|
+ 'id': 'HDFS'
|
|
|
|
+ });
|
|
|
|
+ var ServiceConfig = Em.Object.create({
|
|
|
|
+ configCategories: [ { name: 'SNameNode' } ]
|
|
|
|
+ });
|
|
|
|
+ expect(ServiceConfig.get('configCategories').findProperty('name','SNameNode')).to.ok;
|
|
|
|
+ App.config.OnNnHAHideSnn(ServiceConfig);
|
|
|
|
+ expect(ServiceConfig.get('configCategories').findProperty('name','SNameNode')).to.undefined;
|
|
|
|
+ var record = App.HDFSService.find('HDFS');
|
|
|
|
+ record.deleteRecord();
|
|
|
|
+ record.get('stateManager').transitionTo('loading');
|
|
|
|
+ });
|
|
|
|
+ it('`SNameNode` category absent in `ServiceConfig`. Nothing to do.', function() {
|
|
|
|
+ App.store.load(App.HDFSService, {
|
|
|
|
+ 'id': 'HDFS'
|
|
|
|
+ });
|
|
|
|
+ var ServiceConfig = Em.Object.create({
|
|
|
|
+ configCategories: [ { name: 'DataNode' } ]
|
|
|
|
+ });
|
|
|
|
+ App.config.OnNnHAHideSnn(ServiceConfig);
|
|
|
|
+ expect(ServiceConfig.get('configCategories').findProperty('name','DataNode')).to.ok;
|
|
|
|
+ expect(ServiceConfig.get('configCategories.length')).to.eql(1);
|
|
|
|
+ });
|
|
});
|
|
});
|
|
});
|
|
});
|