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

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

Introduction

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

Prototype

String getString(String key);

Source Link

Document

Get a string associated with the given configuration key.

Usage

From source file:com.boozallen.cognition.ingest.storm.bolt.logic.SkipBlankBoltTest.java

License:asdf

@Test
public void testConfigure(@Injectable Configuration conf) {
    new Expectations() {
        {//from w  ww .j  av a  2 s .  c o  m
            conf.getString(SkipBlankBolt.FIELD);
            result = "field0";
        }
    };
    bolt.configure(conf);
    assertThat(bolt.field, is("field0"));
}

From source file:edu.kit.dama.staging.adalapi.authenticator.KITDMAuthenticator.java

@Override
public void configure(URL pUrl, Configuration pConfig) {
    super.configure(pUrl, pConfig);
    //obtain user info
    context = pConfig.getString("repository.context");
    super.getUserInteractionVector().clear();
    createVector();//from  w w w.j  a  va  2s.c  o m
}

From source file:br.gov.frameworkdemoiselle.internal.implementation.ConfigurationClassValueExtractor.java

@Override
public Object getValue(String prefix, String key, Field field, Configuration configuration) throws Exception {
    Object value = null;/*  w w w .j  a v a 2s  .c o  m*/
    String canonicalName = configuration.getString(prefix + key);

    if (canonicalName != null) {
        value = Reflections.forName(canonicalName);
    }

    return value;
}

From source file:com.nesscomputing.config.LegacyConfigTest.java

@Test
public void testEnvironment() {
    PropertiesSaver ps = new PropertiesSaver(Config.CONFIG_PROPERTY_NAME, Config.CONFIG_LOCATION_PROPERTY_NAME);

    try {//from  w w  w . j a  v a  2s.c om
        System.setProperty(Config.CONFIG_PROPERTY_NAME, "main/override");
        System.setProperty(Config.CONFIG_LOCATION_PROPERTY_NAME, "classpath:/test-config/env");

        Config legacy = Config.getConfig();
        Configuration c = legacy.getConfiguration();
        Assert.assertEquals("main-value", c.getString("main-key"));
        Assert.assertEquals("override-value", c.getString("override-key"));
        Assert.assertEquals("main-override-value", c.getString("main-override-key"));

        Assert.assertEquals("main/override", c.getString(Config.CONFIG_PROPERTY_NAME));

    } finally {
        ps.apply();
    }
}

From source file:com.impetus.kundera.ycsb.runner.RedisRunner.java

public RedisRunner(final String propertyFile, final Configuration config) {
    super(propertyFile, config);
    this.redisServerLocation = config.getString("server.location");
    operationUtils = new RedisOperationUtils();
}

From source file:com.parallax.server.blocklyprop.servlets.PublicProfileServlet.java

@Inject
public void setConfiguration(Configuration configuration) {
    cloudSessionUserService = new CloudSessionUserService(configuration.getString("cloudsession.baseurl"));
}

From source file:com.impetus.kundera.ycsb.runner.CassandraRunner.java

public CassandraRunner(final String propertyFile, final Configuration config) {
    super(propertyFile, config);
    this.cassandraServerLocation = config.getString("server.location");
    operationUtils = new CassandraOperationUtils();
}

From source file:com.appeligo.amazon.AmazonSearcher.java

protected void loadProductSearcher() {
    Configuration config = ConfigUtils.getAmazonConfig();
    String indexLocation = config.getString("programIndex");
    try {// ww w  . j  a v a2  s .com
        productSearcher = new IndexSearcher(indexLocation);
    } catch (IOException e) {
        if (log.isErrorEnabled()) {
            log.error("Cannot load product index: " + indexLocation, e);
        }
    }
}

From source file:com.boozallen.cognition.ingest.storm.bolt.logic.SkipFieldValueBoltTest.java

License:asdf

@Test
public void testConfigure(@Injectable Configuration conf) {
    new Expectations() {
        {/*from ww w . jav  a 2s. c o m*/
            conf.getString(SkipFieldValueBolt.FIELD);
            result = "field0";
            conf.getString(SkipFieldValueBolt.VALUE);
            result = "value0";
        }
    };
    bolt.configure(conf);
    assertThat(bolt.field, is("field0"));
    assertThat(bolt.value, is("value0"));
}

From source file:com.evolveum.midpoint.init.AuditFactory.java

private String getFactoryClassName(Configuration config) {
    String className = config.getString(CONF_AUDIT_SERVICE_FACTORY);
    if (StringUtils.isEmpty(className)) {
        LOGGER.error("AuditServiceFactory implementation class name ({}) not found in configuration. "
                + "Provided configuration:\n{}", new Object[] { CONF_AUDIT_SERVICE_FACTORY, config });
        throw new SystemException("AuditServiceFactory implementation class name (" + CONF_AUDIT_SERVICE_FACTORY
                + ") not found in configuration. Provided configuration:\n" + config);
    }//from w w  w  . j a  v a 2 s  .  c om

    return className;
}