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.linkedin.pinot.core.segment.index.loader.LoadersTest.java

@BeforeMethod
public void setUp() throws Exception {
    INDEX_DIR = Files.createTempDirectory(LoadersTest.class.getName() + "_segmentDir").toFile();
    final String filePath = TestUtils
            .getFileFromResourceUrl(Loaders.class.getClassLoader().getResource(AVRO_DATA));
    final SegmentGeneratorConfig config = SegmentTestUtils.getSegmentGenSpecWithSchemAndProjectedColumns(
            new File(filePath), INDEX_DIR, "daysSinceEpoch", TimeUnit.HOURS, "testTable");
    config.setSegmentNamePostfix("1");
    config.setTimeColumnName("daysSinceEpoch");
    final SegmentIndexCreationDriver driver = SegmentCreationDriverFactory.get(null);
    driver.init(config);/*from ww  w .ja  v  a  2s. com*/
    driver.build();
    segmentDirectory = new File(INDEX_DIR, driver.getSegmentName());
    Configuration tableConfig = new PropertiesConfiguration();
    tableConfig.addProperty(IndexLoadingConfigMetadata.KEY_OF_SEGMENT_FORMAT_VERSION, "v1");
    v1LoadingConfig = new IndexLoadingConfigMetadata(tableConfig);

    tableConfig.clear();
    tableConfig.addProperty(IndexLoadingConfigMetadata.KEY_OF_SEGMENT_FORMAT_VERSION, "v3");
    v3LoadingConfig = new IndexLoadingConfigMetadata(tableConfig);
}

From source file:com.comcast.viper.flume2storm.sink.StormSinkConfigurationTest.java

/**
 * Test invalid argument for {@link StormSinkConfiguration#setBatchSize(int)}
 * using the {@link StormSinkConfiguration#from(Configuration)}
 * /*  www  .  j a  v  a  2s.  c o  m*/
 * @throws F2SConfigurationException
 *           If value is invalid
 */
@Test(expected = F2SConfigurationException.class)
public void testInvalidBatchSize2() throws F2SConfigurationException {
    Configuration config = new BaseConfiguration();
    config.addProperty(StormSinkConfiguration.BATCH_SIZE, "not-a-number");
    StormSinkConfiguration.from(config);
}

From source file:com.comcast.viper.flume2storm.sink.StormSinkConfigurationTest.java

/**
 * Test invalid argument for {@link StormSinkConfiguration#setBatchSize(int)}
 * using the {@link StormSinkConfiguration#from(Configuration)}
 * /*from www  . j a va2s  .c o  m*/
 * @throws F2SConfigurationException
 *           If value is invalid
 */
@Test(expected = F2SConfigurationException.class)
public void testInvalidBatchSize3() throws F2SConfigurationException {
    Configuration config = new BaseConfiguration();
    config.addProperty(StormSinkConfiguration.BATCH_SIZE, "-1");
    StormSinkConfiguration.from(config);
}

From source file:com.comcast.viper.flume2storm.sink.StormSinkConfigurationTest.java

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

From source file:com.comcast.viper.flume2storm.sink.StormSinkConfigurationTest.java

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

From source file:com.comcast.viper.flume2storm.sink.StormSinkConfigurationTest.java

/**
 * Test invalid argument for/*from   ww w.ja va2  s  .c o m*/
 * {@link StormSinkConfiguration#setEventSenderFactoryClassName(String)}
 * 
 * @throws F2SConfigurationException
 *           If value is invalid
 */
@Test(expected = F2SConfigurationException.class)
public void testEventSenderFactoryClassName3() throws F2SConfigurationException {
    Configuration config = new BaseConfiguration();
    config.addProperty(StormSinkConfiguration.EVENT_SENDER_FACTORY_CLASS, "not-a-class");
    StormSinkConfiguration.from(config);
}

From source file:com.comcast.viper.flume2storm.sink.StormSinkConfigurationTest.java

/**
 * Test invalid argument for/*from  w  w  w . jav a 2  s  .  c o  m*/
 * {@link StormSinkConfiguration#seConnectionParametersFactoryClassName(String)}
 * 
 * @throws F2SConfigurationException
 *           If value is invalid
 */
@Test(expected = F2SConfigurationException.class)
public void testConnectionParametersFactoryClassName3() throws F2SConfigurationException {
    Configuration config = new BaseConfiguration();
    config.addProperty(StormSinkConfiguration.CONNECTION_PARAMETERS_FACTORY_CLASS, "not-a-class");
    StormSinkConfiguration.from(config);
}

From source file:cz.cas.lib.proarc.common.imports.ImportProfile.java

public Configuration getThumbnailProcessor() {
    String processor = config.getString(THUMBNAIL_PROCESSOR, "-");
    String confId = PROCESSOR + "." + processor;
    Configuration subset = config.subset(confId);
    if (!subset.isEmpty() && !subset.containsKey("id")) {
        subset.addProperty("id", confId);
    }/*from   www  .j  a v a  2  s  .c o m*/
    return subset;
}

From source file:it.geosolutions.opensdi2.configurations.model.converters.PropertiesConfigurationConverter.java

/**
 * This implementation expects an input object instance of OSDIConfigurationKVP otherwise an IllegalArgumentException is thrown. 
 * The concrete return type is always an instance of org.apache.commons.configuration.Configuration
 *///  w w  w  .ja v a  2  s .  c om
@Override
public Object buildConfig(OSDIConfiguration configToBeConverted) {
    if (!(configToBeConverted instanceof OSDIConfigurationKVP)) {
        throw new IllegalArgumentException(
                "You are using the class OSDIPropertiesConverter as implementation of the OSDIConfigConverter interface, you need to pass to this method an instance of OSDIConfigurationKVP");
    }
    OSDIConfigurationKVP inConfig = (OSDIConfigurationKVP) configToBeConverted;
    Configuration outConfig = new PropertiesConfiguration();

    Iterator<String> iter = inConfig.getAllKeys().iterator();
    String tmpKey = "";
    while (iter.hasNext()) {
        tmpKey = iter.next();
        outConfig.addProperty(tmpKey, inConfig.getValue(tmpKey));
    }
    return outConfig;
}

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

@Override
protected void overrideOfflineServerConf(Configuration configuration) {
    configuration.addProperty(CommonConstants.Server.CONFIG_OF_ENABLE_DEFAULT_COLUMNS, true);
}