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:io.fluo.stress.TrieMapRedIT.java

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

From source file:io.fluo.core.impl.AppConfigIT.java

@Override
protected void setAppConfig(Configuration config) {
    config.setProperty("myapp.sizeLimit", 50000);
}

From source file:io.mindmaps.graql.internal.analytics.CountMapReduce.java

@Override
public void storeState(final Configuration configuration) {
    configuration.setProperty(COUNT_MEMORY_KEY, this.memoryKey);
    configuration.setProperty(MAP_REDUCE, CountMapReduce.class.getName());
    Iterator iterator = selectedTypes.iterator();
    int count = 0;
    while (iterator.hasNext()) {
        configuration.addProperty(TYPE + "." + count, iterator.next());
        count++;//from   w w w  . jav a 2 s. c o m
    }
}

From source file:io.servicecomb.serviceregistry.config.TestPropertiesLoader.java

@Test
public void testExtendedClassCompatible() {
    Configuration configuration = new DynamicConfiguration();
    configuration.setProperty(CONFIG_SERVICE_DESCRIPTION_KEY + AbstractPropertiesLoader.EXTENDED_CLASS,
            "invalidClass");

    AbstractPropertiesLoader loader = MicroservicePropertiesLoader.INSTANCE;
    try {// w  w  w  .  j  a v  a  2s .c  om
        loader.loadProperties(configuration);
        Assert.fail("Must throw exception");
    } catch (Error e) {
        Assert.assertEquals(ClassNotFoundException.class, e.getCause().getClass());
        Assert.assertEquals("invalidClass", e.getCause().getMessage());
    }
}

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

@Test
public void testWithConfig() {
    Configuration config = new PropertiesConfiguration();
    final int workers = 5;
    final int runners = 2;

    config.setProperty(ResourceManager.QUERY_RUNNER_CONFIG_KEY, runners);
    config.setProperty(ResourceManager.QUERY_WORKER_CONFIG_KEY, workers);

    UnboundedResourceManager rm = new UnboundedResourceManager(config);
    assertEquals(rm.getNumQueryWorkerThreads(), workers);
    assertEquals(rm.getNumQueryRunnerThreads(), runners);
    assertEquals(rm.getTableThreadsHardLimit(), runners + workers);
    assertEquals(rm.getTableThreadsSoftLimit(), runners + workers);

    SchedulerGroupAccountant accountant = mock(SchedulerGroupAccountant.class);
    when(accountant.totalReservedThreads()).thenReturn(3);
    assertTrue(rm.canSchedule(accountant));

    when(accountant.totalReservedThreads()).thenReturn(workers + runners + 2);
    assertFalse(rm.canSchedule(accountant));
}

From source file:io.mindmaps.graql.internal.analytics.DegreeVertexProgram.java

@Override
public void storeState(final Configuration configuration) {
    configuration.setProperty(VERTEX_PROGRAM, DegreeVertexProgram.class.getName());
    Iterator iterator = selectedTypes.iterator();
    int count = 0;
    while (iterator.hasNext()) {
        configuration.addProperty(TYPE + "." + count, iterator.next());
        count++;/*from w w w  .jav  a2s  . c  om*/
    }
}

From source file:com.steelbridgelabs.oss.neo4j.structure.Neo4JGraphConfigurationBuilder.java

public Configuration build() {
    // create configuration instance
    Configuration configuration = new BaseConfiguration();
    // url//www . j  a v a 2 s  .co m
    configuration.setProperty(Neo4JUrlConfigurationKey, "bolt://" + hostname + ":" + port);
    // hostname
    configuration.setProperty(Neo4JHostnameConfigurationKey, hostname);
    // port
    configuration.setProperty(Neo4JPortConfigurationKey, port);
    // username
    configuration.setProperty(Neo4JUsernameConfigurationKey, username);
    // password
    configuration.setProperty(Neo4JPasswordConfigurationKey, password);
    // graphName
    configuration.setProperty(Neo4JGraphNameConfigurationKey, graphName);
    // vertex id provider
    configuration.setProperty(Neo4JVertexIdProviderClassNameConfigurationKey,
            vertexIdProviderClassName != null ? vertexIdProviderClassName : elementIdProviderClassName);
    // edge id provider
    configuration.setProperty(Neo4JEdgeIdProviderClassNameConfigurationKey,
            edgeIdProviderClassName != null ? edgeIdProviderClassName : elementIdProviderClassName);
    // property id provider
    configuration.setProperty(Neo4JPropertyIdProviderClassNameConfigurationKey,
            propertyIdProviderClassName != null ? propertyIdProviderClassName : elementIdProviderClassName);
    // return configuration
    return configuration;
}

From source file:io.mindmaps.graql.internal.analytics.DegreeAndPersistVertexProgram.java

@Override
public void storeState(final Configuration configuration) {
    configuration.setProperty(VERTEX_PROGRAM, DegreeAndPersistVertexProgram.class.getName());
    Iterator iterator = selectedTypes.iterator();
    int count = 0;
    while (iterator.hasNext()) {
        configuration.addProperty(TYPE + "." + count, iterator.next());
        count++;/*from  w  w  w  .j  a  va  2s.  com*/
    }
    configuration.setProperty(KEYSPACE, keySpace);
}

From source file:io.wcm.caravan.io.http.impl.CaravanHttpThreadPoolConfig.java

/**
 * Writes OSGi configuration to archaius configuration.
 * @param threadPoolName Thread pool name
 * @param config OSGi config//from w ww.ja v a  2  s  .co  m
 */
private void setArchiausProperties(String threadPoolName, Map<String, Object> config) {
    Configuration archaiusConfig = ArchaiusConfig.getConfiguration();
    // thread pool size
    archaiusConfig.setProperty(HYSTRIX_THREADPOOL_PREFIX + threadPoolName + HYSTRIX_PARAM_THREADPOOL_CORESIZE,
            PropertiesUtil.toInteger(config.get(HYSTRIX_THREADPOOL_CORESIZE_PROPERTY),
                    HYSTRIX_THREADPOOL_CORESIZE_DEFAULT));
    // maximum thread queue size
    archaiusConfig.setProperty(
            HYSTRIX_THREADPOOL_PREFIX + threadPoolName + HYSTRIX_PARAM_THREADPOOL_MAXQUEUESIZE,
            PropertiesUtil.toInteger(config.get(HYSTRIX_THREADPOOL_MAXQUEUESIZE_PROPERTY),
                    HYSTRIX_THREADPOOL_MAXQUEUESIZE_DEFAULT));
    // dynamic thread queue size
    archaiusConfig.setProperty(
            HYSTRIX_THREADPOOL_PREFIX + threadPoolName + HYSTRIX_PARAM_THREADPOOL_QUEUESIZEREJECTIONTHRESHOLD,
            PropertiesUtil.toInteger(config.get(HYSTRIX_THREADPOOL_QUEUESIZEREJECTIONTHRESHOLD_PROPERTY),
                    HYSTRIX_THREADPOOL_QUEUESIZEREJECTIONTHRESHOLD_DEFAULT));
}

From source file:ai.grakn.graql.internal.analytics.GraknVertexProgram.java

@Override
public void storeState(final Configuration configuration) {
    super.storeState(configuration);

    // store class name for reflection on spark executor
    configuration.setProperty(VERTEX_PROGRAM, this.getClass().getName());
}