use of org.apache.commons.configuration.CompositeConfiguration in project whirr by apache.
the class VoldemortServiceTest method setUp.
@Before
public void setUp() throws Exception {
CompositeConfiguration config = new CompositeConfiguration();
if (System.getProperty("config") != null) {
config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
}
config.addConfiguration(new PropertiesConfiguration("whirr-voldemort-test.properties"));
clusterSpec = ClusterSpec.withTemporaryKeys(config);
controller = new ClusterController();
cluster = controller.launchCluster(clusterSpec);
waitForBootstrap();
}
use of org.apache.commons.configuration.CompositeConfiguration in project whirr by apache.
the class YarnConfigurationBuilder method build.
private static Configuration build(ClusterSpec clusterSpec, Cluster cluster, Configuration defaults, String prefix) throws ConfigurationException {
CompositeConfiguration config = new CompositeConfiguration();
Configuration sub = clusterSpec.getConfigurationForKeysWithPrefix(prefix);
config.setDelimiterParsingDisabled(true);
// remove prefix
config.addConfiguration(sub.subset(prefix));
config.addConfiguration(defaults.subset(prefix));
return config;
}
use of org.apache.commons.configuration.CompositeConfiguration in project wcomponents by BorderTech.
the class Config method loadConfiguration.
/**
* @return the configuration to use.
*/
private static synchronized Configuration loadConfiguration() {
// Find if there are classes implementing the ConfigurationLoader SPI.
ServiceLoader<ConfigurationLoader> loaders = ServiceLoader.load(ConfigurationLoader.class);
Iterator<ConfigurationLoader> iterator = loaders.iterator();
// Use a CompositeConfiguration if there are custom ConfigurationLoader implementations.
if (iterator.hasNext()) {
CompositeConfiguration compositeConfig = new CompositeConfiguration(new MapConfiguration(new HashMap<String, Object>()));
while (iterator.hasNext()) {
compositeConfig.addConfiguration(iterator.next().getConfiguration());
}
// Add the base WComponents configuration last so it is overridden.
compositeConfig.addConfiguration(new DefaultInternalConfiguration());
return compositeConfig;
} else {
// If no custom ConfigurationLoader is defined, return the default configuration.
return new DefaultInternalConfiguration();
}
}
use of org.apache.commons.configuration.CompositeConfiguration in project wcomponents by BorderTech.
the class AbstractWSelectList_Test method setUp.
@BeforeClass
public static void setUp() {
originalConfig = Config.getInstance();
CompositeConfiguration config = new CompositeConfiguration(originalConfig);
MapConfiguration overrides = new MapConfiguration(new HashMap<String, Object>());
overrides.setProperty(ConfigurationProperties.INTEGRITY_ERROR_MODE, "true");
config.addConfiguration(overrides);
Config.setConfiguration(config);
}
Aggregations