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

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

Introduction

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

Prototype

void addProperty(String key, Object value);

Source Link

Document

Add a property to the configuration.

Usage

From source file:com.comcast.viper.flume2storm.spout.FlumeSpoutConfigurationTest.java

/**
 * Test invalid argument for//from   w w  w  . j a  v a  2  s. c om
 * {@link FlumeSpoutConfiguration#setServiceProviderSerializationClassName(String)}
 * 
 * @throws F2SConfigurationException
 *           If value is invalid
 */
@Test(expected = F2SConfigurationException.class)
public void testServiceProviderSerializationClassName3() throws F2SConfigurationException {
    Configuration config = new BaseConfiguration();
    config.addProperty(FlumeSpoutConfiguration.SERVICE_PROVIDER_SERIALIZATION_CLASS, "not-a-class");
    FlumeSpoutConfiguration.from(config);
}

From source file:com.comcast.viper.flume2storm.spout.FlumeSpoutConfigurationTest.java

/**
 * Test invalid argument for/*from  w w w  . j  a v a  2s  . co m*/
 * {@link FlumeSpoutConfiguration#setEventReceptorFactoryClassName(String)}
 * 
 * @throws F2SConfigurationException
 *           If value is invalid
 */
@Test(expected = F2SConfigurationException.class)
public void testEventReceptorFactoryClassName3() throws F2SConfigurationException {
    Configuration config = new BaseConfiguration();
    config.addProperty(FlumeSpoutConfiguration.EVENT_RECEPTOR_FACTORY_CLASS, "not-a-class");
    FlumeSpoutConfiguration.from(config);
}

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

@Override
public void storeState(final Configuration configuration) {
    super.storeState(configuration);
    ofTypeIds.forEach(type -> configuration.addProperty(OF_TYPE_LABELS + "." + type, type));
}

From source file:fr.inria.atlanmod.neoemf.data.blueprints.tg.config.InternalBlueprintsTgConfiguration.java

@Override
public void putDefaultConfiguration(Configuration currentConfiguration, File dbLocation)
        throws IllegalArgumentException {
    if (isNull(currentConfiguration.getString(DIRECTORY))) {
        currentConfiguration.addProperty(DIRECTORY, dbLocation.getAbsolutePath());
    }/*from  w  ww .j  av  a  2s  . c o  m*/
    if (isNull(currentConfiguration.getString(FILE_TYPE))) {
        currentConfiguration.addProperty(FILE_TYPE, "GRAPHML");
    }
}

From source file:fr.inria.atlanmod.neoemf.graph.blueprints.tg.config.BlueprintsTgConfig.java

@Override
public void putDefaultConfiguration(Configuration currentConfiguration, File dbLocation)
        throws IllegalArgumentException {
    if (currentConfiguration.getString("blueprints.tg.directory") == null) {
        currentConfiguration.addProperty("blueprints.tg.directory", dbLocation.getAbsolutePath());
    }//from  ww w  .j  ava 2s.c o m
    if (currentConfiguration.getString("blueprints.tg.file-type") == null) {
        currentConfiguration.addProperty("blueprints.tg.file-type", "GRAPHML");
    }
}

From source file:com.comcast.viper.flume2storm.spout.FlumeSpoutConfigurationTest.java

/**
 * Test {@link FlumeSpoutConfiguration#from(Configuration)}
 *
 * @throws F2SConfigurationException/*  w  w w . j  a  va2  s.  c o  m*/
 *           If the configuration is invalid
 */
@Test
public void testFromConfiguration() throws F2SConfigurationException {
    String locationServiceFactoryClassName = SimpleLocationServiceFactory.class.getCanonicalName();
    String serviceProviderSerializationClassName = SimpleServiceProviderSerialization.class.getCanonicalName();
    String eventReceptorFactoryClassName = SimpleEventReceptorFactory.class.getCanonicalName();
    Configuration config = new BaseConfiguration();
    config.addProperty(FlumeSpoutConfiguration.LOCATION_SERVICE_FACTORY_CLASS, locationServiceFactoryClassName);
    config.addProperty(FlumeSpoutConfiguration.SERVICE_PROVIDER_SERIALIZATION_CLASS,
            serviceProviderSerializationClassName);
    config.addProperty(FlumeSpoutConfiguration.EVENT_RECEPTOR_FACTORY_CLASS, eventReceptorFactoryClassName);

    FlumeSpoutConfiguration flumeSpoutConfiguration = FlumeSpoutConfiguration.from(config);
    Assert.assertEquals(locationServiceFactoryClassName,
            flumeSpoutConfiguration.getLocationServiceFactoryClassName());
    Assert.assertEquals(serviceProviderSerializationClassName,
            flumeSpoutConfiguration.getServiceProviderSerializationClassName());
    Assert.assertEquals(eventReceptorFactoryClassName,
            flumeSpoutConfiguration.getEventReceptorFactoryClassName());
}

From source file:com.linkedin.pinot.core.data.manager.config.FileBasedInstanceDataManagerConfig.java

public FileBasedInstanceDataManagerConfig(Configuration serverConfig) throws ConfigurationException {
    _instanceDataManagerConfiguration = serverConfig;
    checkRequiredKeys();/*from  ww w  .  ja v  a  2 s  . c o m*/
    for (String tableName : getTableNames()) {
        Configuration tableConfig = _instanceDataManagerConfiguration.subset(tableName);
        tableConfig.addProperty(KEY_OF_TABLE_NAME, tableName);
        if (!tableConfig.containsKey(KEY_OF_TABLE_DATA_DIRECTORY)) {
            tableConfig.addProperty(KEY_OF_TABLE_DATA_DIRECTORY,
                    getInstanceDataDir() + "/" + tableName + "/index/node" + getInstanceId());
        }
        _tableDataManagerConfigMap.put(tableName, new TableDataManagerConfig(tableConfig));
    }
}

From source file:edu.cornell.med.icb.goby.config.GobyConfiguration.java

/**
 * Any default configuration item values if required should defined here.
 *
 * @return The default configuration to use.
 *//* ww  w . j av  a2s.c o m*/
private Configuration getDefaultConfiguration() {
    final Configuration defaultConfiguration = new BaseConfiguration();
    defaultConfiguration.addProperty(EXECUTABLE_PATH_LASTAG, "");
    defaultConfiguration.addProperty(EXECUTABLE_PATH_LAST, "");
    defaultConfiguration.addProperty(EXECUTABLE_PATH_BWA, "");
    defaultConfiguration.addProperty(EXECUTABLE_PATH_GSNAP, "");
    defaultConfiguration.addProperty(DATABASE_DIRECTORY, ".");
    defaultConfiguration.addProperty(WORK_DIRECTORY, SystemUtils.getJavaIoTmpDir().toString());
    return defaultConfiguration;
}

From source file:com.linkedin.pinot.core.startree.hll.HllIndexCreationTest.java

@BeforeMethod
public void setUp() throws Exception {
    hllConfig = new HllConfig(hllLog2m, columnsToDeriveHllFields, hllDeriveColumnSuffix);

    Configuration tableConfig = new PropertiesConfiguration();
    tableConfig.addProperty(IndexLoadingConfigMetadata.KEY_OF_SEGMENT_FORMAT_VERSION, "v1");
    v1LoadingConfig = new IndexLoadingConfigMetadata(tableConfig);

    tableConfig.clear();/*ww  w  . jav a2 s . c o m*/
    tableConfig.addProperty(IndexLoadingConfigMetadata.KEY_OF_SEGMENT_FORMAT_VERSION, "v3");
    v3LoadingConfig = new IndexLoadingConfigMetadata(tableConfig);
}

From source file:com.rapid7.diskstorage.dynamodb.TestGraphUtil.java

public CommonsConfiguration getWriteConfiguration(BackendDataModel model, List<String> extraStoreNames,
        int partitions) {
    Preconditions.checkArgument(partitions > 0);
    Configuration config = TestGraphUtil.instance().createTestGraphConfig(model);
    Configuration cache = config.subset("cache");
    if (model == BackendDataModel.SINGLE) { //TODO refactor
        //default: 20000, testEdgesExceedCacheSize fails at 16792, passes at 16791
        //this is the maximum number of edges supported for a vertex with no vertex partitioning.
        cache.setProperty("tx-cache-size", 16791);
    }/*  w ww.j a v  a 2 s. co m*/
    //necessary for simpleLogTest, simpleLogTestWithFailure
    for (String extraStoreName : extraStoreNames) {
        final int tps = TestGraphUtil.instance().getTps();
        final Configuration stores = config.subset("storage").subset("dynamodb").subset("stores");
        final Configuration ulog_test = stores.subset(extraStoreName);
        TestGraphUtil.configureStore(model.name(), tps, ulog_test, TestGraphUtil.instance().isUnlimitedIops());
    }
    if (partitions > 1) {
        final Configuration cluster = config.subset("cluster");
        cluster.addProperty("partition", "true");
        cluster.addProperty("max-partitions", Integer.toString(partitions));
    }
    CommonsConfiguration cc = new CommonsConfiguration(config);
    return cc;
}