### Question:
OzoneConfiguration extends Configuration implements MutableConfigurationSource { @Override public Properties getAllPropertiesByTag(String tag) { Properties updatedProps = getProps(); Properties propertiesByTag = super.getAllPropertiesByTag(tag); Properties props = new Properties(); Enumeration properties = propertiesByTag.propertyNames(); while (properties.hasMoreElements()) { Object propertyName = properties.nextElement(); Object value = updatedProps.getProperty(propertyName.toString()); if (value != null) { props.put(propertyName, value); } } return props; } OzoneConfiguration();  OzoneConfiguration(Configuration conf); static OzoneConfiguration of(ConfigurationSource source); static OzoneConfiguration of(OzoneConfiguration source); static OzoneConfiguration of(Configuration conf); static T newInstanceOf(Class<T> configurationClass); static OzoneConfiguration fromObject(T configObject); List<Property> readPropertyFromXml(URL url); static void activate(); @Override Properties getAllPropertiesByTag(String tag); @Override Collection<String> getConfigKeys(); @Override Map<String, String> getPropsWithPrefix(String confPrefix);  }### Answer:
@Test public void testGetAllPropertiesByTags() throws Exception { File coreDefault = tempConfigs.newFile("core-default-test.xml"); File coreSite = tempConfigs.newFile("core-site-test.xml"); try (BufferedWriter out = new BufferedWriter(new FileWriter(coreDefault))) { startConfig(out); appendProperty(out, "hadoop.tags.system", "YARN,HDFS,NAMENODE"); appendProperty(out, "hadoop.tags.custom", "MYCUSTOMTAG"); appendPropertyByTag(out, "dfs.cblock.trace.io", "false", "YARN"); appendPropertyByTag(out, "dfs.replication", "1", "HDFS"); appendPropertyByTag(out, "dfs.namenode.logging.level", "INFO", "NAMENODE"); appendPropertyByTag(out, "dfs.random.key", "XYZ", "MYCUSTOMTAG"); endConfig(out); Path fileResource = new Path(coreDefault.getAbsolutePath()); conf.addResource(fileResource); Assert.assertEquals("XYZ", conf.getAllPropertiesByTag("MYCUSTOMTAG") .getProperty("dfs.random.key")); } try (BufferedWriter out = new BufferedWriter(new FileWriter(coreSite))) { startConfig(out); appendProperty(out, "dfs.random.key", "ABC"); appendProperty(out, "dfs.replication", "3"); appendProperty(out, "dfs.cblock.trace.io", "true"); endConfig(out); Path fileResource = new Path(coreSite.getAbsolutePath()); conf.addResource(fileResource); } Assert.assertEquals("3", conf.getAllPropertiesByTag("HDFS") .getProperty("dfs.replication")); Assert.assertEquals("ABC", conf.getAllPropertiesByTag("MYCUSTOMTAG") .getProperty("dfs.random.key")); Assert.assertEquals("true", conf.getAllPropertiesByTag("YARN") .getProperty("dfs.cblock.trace.io")); }