diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfigurationFieldsBase.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfigurationFieldsBase.java index 9007c20ccab..2367f21317c 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfigurationFieldsBase.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfigurationFieldsBase.java @@ -205,6 +205,12 @@ public abstract class TestConfigurationFieldsBase { if (!f.getType().getName().equals("java.lang.String")) { continue; } + + // filter out default-value fields + if (isFieldADefaultValue(f)) { + continue; + } + // Convert found member into String try { value = (String) f.get(null); @@ -331,6 +337,17 @@ public abstract class TestConfigurationFieldsBase { return retVal; } + /** + * Test if a field is a default value of another property by + * checking if its name starts with "DEFAULT_" or ends with + * "_DEFAULT". + * @param field the field to check + */ + private static boolean isFieldADefaultValue(Field field) { + return field.getName().startsWith("DEFAULT_") || + field.getName().endsWith("_DEFAULT"); + } + /** * Utility function to extract "public static final" default * member variables from a Configuration type class. @@ -363,8 +380,7 @@ public abstract class TestConfigurationFieldsBase { } // Special: Stuff any property beginning with "DEFAULT_" into a // different hash for later processing - if (f.getName().startsWith("DEFAULT_") || - f.getName().endsWith("_DEFAULT")) { + if (isFieldADefaultValue(f)) { if (retVal.containsKey(f.getName())) { continue; } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tools/TestHdfsConfigFields.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tools/TestHdfsConfigFields.java index 3bbb609a450..a089d395654 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tools/TestHdfsConfigFields.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tools/TestHdfsConfigFields.java @@ -57,12 +57,6 @@ public class TestHdfsConfigFields extends TestConfigurationFieldsBase { // Remove deprecated properties listed in Configuration#DeprecationDelta configurationPropsToSkipCompare.add(DFSConfigKeys.DFS_DF_INTERVAL_KEY); - // Remove default properties - configurationPropsToSkipCompare - .add(DFSConfigKeys.DFS_IMAGE_COMPRESSION_CODEC_DEFAULT); - configurationPropsToSkipCompare - .add(DFSConfigKeys.DFS_WEBHDFS_AUTHENTICATION_FILTER_DEFAULT); - // Remove support property configurationPropsToSkipCompare .add(DFSConfigKeys.DFS_NAMENODE_MIN_SUPPORTED_DATANODE_VERSION_KEY); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/test/java/org/apache/hadoop/yarn/conf/TestYarnConfigurationFields.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/test/java/org/apache/hadoop/yarn/conf/TestYarnConfigurationFields.java index db9364a8ec6..3da4babb8a7 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/test/java/org/apache/hadoop/yarn/conf/TestYarnConfigurationFields.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/test/java/org/apache/hadoop/yarn/conf/TestYarnConfigurationFields.java @@ -48,22 +48,6 @@ public class TestYarnConfigurationFields extends TestConfigurationFieldsBase { errorIfMissingXmlProps = true; // Specific properties to skip - configurationPropsToSkipCompare - .add(YarnConfiguration.DEFAULT_FS_NODE_LABELS_STORE_IMPL_CLASS); - configurationPropsToSkipCompare - .add(YarnConfiguration.DEFAULT_RM_CONFIGURATION_PROVIDER_CLASS); - configurationPropsToSkipCompare - .add(YarnConfiguration.DEFAULT_CLIENT_FAILOVER_PROXY_PROVIDER); - configurationPropsToSkipCompare - .add(YarnConfiguration.DEFAULT_IPC_RECORD_FACTORY_CLASS); - configurationPropsToSkipCompare - .add(YarnConfiguration.DEFAULT_IPC_CLIENT_FACTORY_CLASS); - configurationPropsToSkipCompare - .add(YarnConfiguration.DEFAULT_IPC_SERVER_FACTORY_CLASS); - configurationPropsToSkipCompare - .add(YarnConfiguration.DEFAULT_IPC_RPC_IMPL); - configurationPropsToSkipCompare - .add(YarnConfiguration.DEFAULT_RM_SCHEDULER); configurationPropsToSkipCompare .add(YarnConfiguration .YARN_SECURITY_SERVICE_AUTHORIZATION_APPLICATIONCLIENT_PROTOCOL); @@ -82,14 +66,6 @@ public class TestYarnConfigurationFields extends TestConfigurationFieldsBase { configurationPropsToSkipCompare .add(YarnConfiguration .YARN_SECURITY_SERVICE_AUTHORIZATION_RESOURCETRACKER_PROTOCOL); - configurationPropsToSkipCompare - .add(YarnConfiguration.DEFAULT_SCM_STORE_CLASS); - configurationPropsToSkipCompare - .add(YarnConfiguration.DEFAULT_SCM_APP_CHECKER_CLASS); - configurationPropsToSkipCompare - .add(YarnConfiguration.DEFAULT_SHARED_CACHE_CHECKSUM_ALGO_IMPL); - configurationPropsToSkipCompare - .add(YarnConfiguration.DEFAULT_AMRM_PROXY_INTERCEPTOR_CLASS_PIPELINE); configurationPropsToSkipCompare.add(YarnConfiguration.CURATOR_LEADER_ELECTOR); // Ignore blacklisting nodes for AM failures feature since it is still a