Repository: ambari Updated Branches: refs/heads/trunk 37137ac96 -> 78a0d5acd
AMBARI-4864: Add unit tests for site_properties.js file. (jaimin) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/78a0d5ac Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/78a0d5ac Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/78a0d5ac Branch: refs/heads/trunk Commit: 78a0d5acdc920ee0bb912f9899530e12388e41ef Parents: 37137ac Author: Jaimin Jetly <[email protected]> Authored: Fri Feb 28 13:28:23 2014 -0800 Committer: Jaimin Jetly <[email protected]> Committed: Fri Feb 28 13:28:23 2014 -0800 ---------------------------------------------------------------------- ambari-web/app/assets/test/tests.js | 1 + .../test/data/HDP2/site_properties_test.js | 75 ++++++++++++++++++++ 2 files changed, 76 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/78a0d5ac/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 4bf8c78..bd6fcdb 100644 --- a/ambari-web/app/assets/test/tests.js +++ b/ambari-web/app/assets/test/tests.js @@ -17,6 +17,7 @@ */ require('test/app_test'); +require('test/data/HDP2/site_properties_test'); require('test/controllers/global/background_operations_test'); require('test/controllers/global/cluster_controller_test'); require('test/controllers/main/app_contoller_test'); http://git-wip-us.apache.org/repos/asf/ambari/blob/78a0d5ac/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 new file mode 100644 index 0000000..ae658fd --- /dev/null +++ b/ambari-web/test/data/HDP2/site_properties_test.js @@ -0,0 +1,75 @@ +/** + * 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('utils/helper'); +var siteProperties = require('data/HDP2/site_properties').configProperties; + +describe('hdp2SiteProperties', function () { + + + //@TODO: log4j propeties should not be a part of site properties file. A separate file should address this logic. site_properties.js should be used only to provide ui attributes to existing stack properties + //Exclude log4j properties from unit tests for now + siteProperties = siteProperties.filter(function(item, index){ + return !(item.filename && item.filename.endsWith('log4j.xml')); + }); + // No site properties should be made invisible + siteProperties.forEach(function(siteProperty){ + it('Check invisible attribute of "' + siteProperty.name + '"' + '. It should not be defined ', function () { + expect(siteProperty.isVisible).to.equal(undefined); + }); + }); + + // No site properties should have value and defaultValue defined on client side. + // These should be always retrieved from server. + + siteProperties.forEach(function(siteProperty){ + it('Check value and defaultValue attribute of "' + siteProperty.name + '"' + '. It should not be defined ', function () { + expect(siteProperty.value).to.equal(undefined); + expect(siteProperty.defaultValue).to.equal(undefined); + }); + }); + + // No site properties should have description field duplicated on client side. + // These should be always retrieved from server. + siteProperties.forEach(function(siteProperty){ + it('Check description attribute of "' + siteProperty.name + '"' + '. It should not be defined ', function () { + expect(siteProperty.description).to.equal(undefined); + }); + }); + + // All the site properties should be persisted in the configuration tag + // So isRequiredByAgent should be never defined over here + // These should be always retrieved from server and saved in the correct configuration resource via API. + siteProperties.forEach(function(siteProperty){ + it('Check isRequiredByAgent attribute of "' + siteProperty.name + '"' + '. It should not be defined ', function () { + expect(siteProperty.isRequiredByAgent).to.equal(undefined); + }); + }); + + // All Falcon site properties should be mapped to site file. There is a property with same name (*.domain) + // in different site files of Falcon service + + var falconSiteProperties = siteProperties.filterProperty('serviceName','FALCON'); + falconSiteProperties.forEach(function(siteProperty){ + it('Check filename attribute for "' + siteProperty.name + '"' + ' property of Falcon service. It should be defined ', function () { + expect(siteProperty).to.have.property('filename'); + }); + }); + +}); \ No newline at end of file
