cConf.clear(); cConf.addResource(cConfFile.toURI().toURL());
cConf.clear(); cConf.addResource(cConfFile.toURI().toURL());
cConf.clear(); cConf.addResource(new File(systemArgs.getOption(ProgramOptionConstants.CDAP_CONF_FILE)).toURI().toURL());
if (result != null && !result.isEmpty()) { CConfiguration conf = CConfiguration.create(); conf.clear(); Map<byte[], byte[]> kvs = result.getFamilyMap(FAMILY); for (Map.Entry<byte[], byte[]> e : kvs.entrySet()) {
if (result != null && !result.isEmpty()) { CConfiguration conf = CConfiguration.create(); conf.clear(); Map<byte[], byte[]> kvs = result.getFamilyMap(FAMILY); for (Map.Entry<byte[], byte[]> e : kvs.entrySet()) {
cConf.clear(); cConf.addResource(new File(systemArgs.getOption(ProgramOptionConstants.CDAP_CONF_FILE)).toURI().toURL());
@Test public void testDeprecatedConfigProperties() throws Exception { CConfiguration conf = CConfiguration.create(); Map<String, String[]> deprecated = conf.getDeprecatedProps(); if (!deprecated.isEmpty()) { Map.Entry<String, String[]> property = deprecated.entrySet().iterator().next(); // Test a deprecated property on loading from resources InputStream resource = new ByteArrayInputStream(Bytes.toBytes( String.format("<configuration><property><name>%s</name><value>%s</value></property></configuration>", property.getKey(), DEPRECATED_PROPERTY_VALUE))); conf.addResource(resource); conf.reloadConfiguration(); // Validate new properties, which should be used instead of deprecated for (String newProperty : property.getValue()) { Assert.assertEquals(DEPRECATED_PROPERTY_VALUE, conf.get(newProperty)); } // Clear the Config before next test conf.clear(); // Test a deprecated property on set from the code conf.set(property.getKey(), DEPRECATED_PROPERTY_VALUE); // Validate new properties, which should be used instead of deprecated for (String newProperty : property.getValue()) { Assert.assertEquals(DEPRECATED_PROPERTY_VALUE, conf.get(newProperty)); } // Close the InputStream Closeables.closeQuietly(resource); } }