Example usage for org.apache.commons.configuration SystemConfiguration setSystemProperties

List of usage examples for org.apache.commons.configuration SystemConfiguration setSystemProperties

Introduction

In this page you can find the example usage for org.apache.commons.configuration SystemConfiguration setSystemProperties.

Prototype

public static void setSystemProperties(PropertiesConfiguration systemConfig) 

Source Link

Document

Set System properties from a configuration file.

Usage

From source file:com.netflix.hystrix.contrib.metrics.controller.HystricsMetricsControllerTest.java

@Override
protected Application configure() {
    int port = 0;
    try {//w  w w.  j a  v  a2 s  . c o m
        final ServerSocket socket = new ServerSocket(0);
        port = socket.getLocalPort();
        socket.close();
    } catch (IOException e1) {
        throw new RuntimeException("Failed to find port to start test server");
    }
    set(TestProperties.CONTAINER_PORT, port);
    try {
        SystemConfiguration.setSystemProperties("test.properties");
    } catch (Exception e) {
        throw new RuntimeException("Failed to load config file");
    }
    return new ResourceConfig(HystricsMetricsControllerTest.class, HystrixStreamFeature.class);
}

From source file:org.wso2.ppaas.tools.artifactmigration.ConversionTool.java

/**
 * Method to get configuration details/*from ww  w  . j a v a  2 s . co m*/
 */
public static void readInitialConfiguration() throws ConfigurationException {
    final PropertiesConfiguration propsConfig = new PropertiesConfiguration(
            System.getProperty(Constants.CONFIGURATION_FILE_NAME));
    SystemConfiguration.setSystemProperties(propsConfig);
}