Example usage for org.apache.commons.configuration CompositeConfiguration getProperties

List of usage examples for org.apache.commons.configuration CompositeConfiguration getProperties

Introduction

In this page you can find the example usage for org.apache.commons.configuration CompositeConfiguration getProperties.

Prototype

public Properties getProperties(String key, Properties defaults) 

Source Link

Document

Get a list of properties associated with the given configuration key.

Usage

From source file:org.xwiki.rendering.test.cts.TestDataParser.java

/**
 * Parse Test configuration by looking for a {@code config.properties} file in the Syntax directory.
 *
 * @param syntaxDirectory the syntax directory under which to look for the configuration file
 * @param ctsRootPackageName the root of the CTS resources
 * @param classLoader the class loader from which the test configuration is read from
 * @return the configuration/*from  w  w  w.jav a2  s  .  c  o  m*/
 * @throws Exception in case of error while reading test configuration
 */
public TestDataConfiguration parseTestConfiguration(String syntaxDirectory, String ctsRootPackageName,
        ClassLoader classLoader) throws Exception {
    TestDataConfiguration configuration = new TestDataConfiguration();

    CompositeConfiguration compositeConfiguration = new CompositeConfiguration();
    addConfigurationData(compositeConfiguration, ctsRootPackageName, classLoader);
    addConfigurationData(compositeConfiguration, syntaxDirectory, classLoader);

    // TODO: Remove these unsafe casts, need to find out how to do that nicely...
    configuration.notApplicableTests = (List<String>) (List<?>) compositeConfiguration
            .getList("notApplicableTests", Collections.emptyList());
    configuration.failingTests = (List<String>) (List<?>) compositeConfiguration.getList("failingTests",
            Collections.emptyList());
    configuration.testDescriptions = compositeConfiguration.getProperties("testDescriptions", new Properties());
    configuration.inheritSyntax = compositeConfiguration.getString("inheritSyntax");

    return configuration;
}