Example usage for org.apache.commons.configuration Configuration setProperty

List of usage examples for org.apache.commons.configuration Configuration setProperty

Introduction

In this page you can find the example usage for org.apache.commons.configuration Configuration setProperty.

Prototype

void setProperty(String key, Object value);

Source Link

Document

Set a property, this will replace any previously set values.

Usage

From source file:com.linkedin.pinot.integration.tests.LLCRealtimeClusterSplitCommitIntegrationTest.java

@Override
public void startServer() {
    Configuration serverConfig = getDefaultServerConfiguration();
    serverConfig.setProperty(CommonConstants.Server.CONFIG_OF_ENABLE_SPLIT_COMMIT, true);
    startServer(serverConfig);//from w w w .  ja v  a 2s  .c om
}

From source file:com.germinus.easyconf.ConfigurationLearningTest.java

public void testSubset() {
    Configuration conf = new PropertiesConfiguration();
    conf.setProperty("prefix.key", "value");
    Configuration subset = conf.subset("prefix");
    assertTrue("The subset functionality does not work", subset.containsKey("key"));
}

From source file:co.turnus.trace.impl.SimpleTraceLoader.java

@Override
public Trace load(TraceProject project) {
    TraceFactory f = new SimpleTraceFactory();

    // create the configuration for this factory
    Configuration fConf = new BaseConfiguration();
    fConf.setProperty(SENS_FSM, getOption(SENS_FSM, true));
    fConf.setProperty(SENS_TOKENS, getOption(SENS_TOKENS, true));
    fConf.setProperty(SENS_GUARD, getOption(SENS_GUARD, true));
    fConf.setProperty(SENS_PORT, getOption(SENS_PORT, true));
    fConf.setProperty(SENS_STATEVAR, getOption(SENS_STATEVAR, true));
    f.setConfiguration(fConf);//from w  w w .ja  v  a 2s  .  c  om

    return new XmlTraceReader(project, f).read();
}

From source file:com.twitter.distributedlog.util.TestConfUtils.java

@Test
public void testLoadConfiguration() {
    Configuration conf1 = new CompositeConfiguration();
    conf1.setProperty("key1", "value1");
    conf1.setProperty("key2", "value2");
    conf1.setProperty("key3", "value3");

    Configuration conf2 = new CompositeConfiguration();
    conf2.setProperty("bkc.key1", "bkc.value1");
    conf2.setProperty("bkc.key4", "bkc.value4");

    assertEquals("value1", conf1.getString("key1"));
    assertEquals("value2", conf1.getString("key2"));
    assertEquals("value3", conf1.getString("key3"));
    assertEquals(null, conf1.getString("key4"));

    ConfUtils.loadConfiguration(conf1, conf2, "bkc.");

    assertEquals("bkc.value1", conf1.getString("key1"));
    assertEquals("value2", conf1.getString("key2"));
    assertEquals("value3", conf1.getString("key3"));
    assertEquals("bkc.value4", conf1.getString("key4"));
    assertEquals(null, conf1.getString("bkc.key1"));
    assertEquals(null, conf1.getString("bkc.key4"));
}

From source file:com.linkedin.pinot.core.query.scheduler.resources.ResourceManagerTest.java

private Configuration getConfig(int runners, int workers) {
    Configuration config = new PropertiesConfiguration();
    config.setProperty(ResourceManager.QUERY_RUNNER_CONFIG_KEY, runners);
    config.setProperty(ResourceManager.QUERY_WORKER_CONFIG_KEY, workers);
    return config;
}

From source file:com.linkedin.pinot.integration.tests.LLCRealtimeClusterIntegrationTest.java

@Override
protected void overrideServerConf(Configuration configuration) {
    configuration.setProperty(CommonConstants.Server.CONFIG_OF_REALTIME_OFFHEAP_ALLOCATION, true);
    configuration.setProperty(CommonConstants.Server.CONFIG_OF_REALTIME_OFFHEAP_DIRECT_ALLOCATION,
            _isDirectAlloc);//  ww  w  .  j ava2  s.c o  m
    if (_isConsumerDirConfigured) {
        configuration.setProperty(CommonConstants.Server.CONFIG_OF_CONSUMER_DIR, CONSUMER_DIRECTORY);
    }
}

From source file:co.turnus.trace.example.SimpleTraceExample.java

public TraceProject loadProject() {
    TurnusLogger.info("Load the causation trace");
    try {/* w w  w . j ava 2  s.c  o m*/

        File dir = new File(SimpleTraceExample.class.getResource("/co/turnus/trace/example/").toURI());
        TraceProject project = TraceProject.load(dir);

        Configuration config = new BaseConfiguration();
        config.setProperty(SENS_STATEVAR, false);

        project.loadTrace(config);

        trace = project.getTrace();
        decorator = project.getTraceDecorator();

        return project;

    } catch (Exception e) {
        throw new TurnusRuntimeException("Error loading the trace file", e.getCause());
    }

}

From source file:io.fluo.stress.TrieBasicIT.java

@Override
protected void setAppConfig(Configuration config) {
    config.setProperty(Constants.STOP_LEVEL_PROP, 0);
}

From source file:com.linkedin.pinot.integration.tests.PinotCluster.java

public PinotCluster() throws Exception {
    ZkStarter.startLocalZkServer(2181);/*w  w w . j av a 2  s  .  co  m*/
    ControllerTestUtils.startController(HELIX_CLUSTER_NAME, ZKString,
            ControllerTestUtils.getDefaultControllerConfiguration());
    Configuration defaultServerConfiguration = ServerTestUtils.getDefaultServerConfiguration();
    defaultServerConfiguration.setProperty(CommonConstants.Server.CONFIG_OF_INSTANCE_READ_MODE, "mmap");
    ServerTestUtils.startServer(HELIX_CLUSTER_NAME, ZKString, defaultServerConfiguration);
    BrokerTestUtils.startBroker(HELIX_CLUSTER_NAME, ZKString, BrokerTestUtils.getDefaultBrokerConfiguration());

    // Create a data resource
    addSchema(new File("/opt/pinot/audienx_index.schema.json"), "audienx_index");

    // Add table to resource
    addOfflineTable("/opt/pinot/audienx_index.table.json");

    uploadSegment("/opt/pinot/audienx_index");
}

From source file:io.servicecomb.transport.rest.servlet.TestServletConfig.java

@Test
public void testGetServletUrlPattern() {
    DynamicPropertyFactory.getInstance();
    Configuration configuration = (Configuration) DynamicPropertyFactory.getBackingConfigurationSource();
    configuration.setProperty(ServletConfig.KEY_SERVLET_URL_PATTERN, "/*");
    Assert.assertEquals("/*", ServletConfig.getServletUrlPattern());
}