Search in sources :

Example 11 with Configuration

use of org.apache.commons.configuration.Configuration in project ribbon by Netflix.

the class ClientPropertiesTest method testNoExportToArchaius.

@Test
public void testNoExportToArchaius() {
    MyTransportFactory transportFactory = new MyTransportFactory(ClientConfigFactory.DEFAULT);
    RibbonResourceFactory resourceFactory = new DefaultResourceFactory(ClientConfigFactory.DEFAULT, transportFactory);
    RibbonDynamicProxy.newInstance(MovieService.class, resourceFactory, ClientConfigFactory.DEFAULT, transportFactory);
    IClientConfig clientConfig = transportFactory.getClientConfig();
    assertEquals(1000, clientConfig.get(Keys.ConnectTimeout).longValue());
    assertEquals(3000, clientConfig.get(Keys.ReadTimeout).longValue());
    assertEquals(0, clientConfig.get(Keys.MaxAutoRetriesNextServer).longValue());
    Configuration config = ConfigurationManager.getConfigInstance();
    assertNull(config.getProperty("MovieService.ribbon.ReadTimeout"));
    config.setProperty("MovieService.ribbon.ReadTimeout", "5000");
    assertEquals(5000, clientConfig.get(Keys.ReadTimeout).longValue());
}
Also used : Configuration(org.apache.commons.configuration.Configuration) DefaultResourceFactory(com.netflix.ribbon.DefaultResourceFactory) IClientConfig(com.netflix.client.config.IClientConfig) RibbonResourceFactory(com.netflix.ribbon.RibbonResourceFactory) Test(org.junit.Test)

Example 12 with Configuration

use of org.apache.commons.configuration.Configuration in project OpenAttestation by OpenAttestation.

the class TDPConfig method getJpaProperties.

public static Properties getJpaProperties() {
    Configuration config = getConfiguration();
    Properties prop = new Properties();
    prop.put("javax.persistence.jdbc.driver", config.getString("mountwilson.tdbp.db.driver", config.getString("mtwilson.db.driver", "com.mysql.jdbc.Driver")));
    prop.put("javax.persistence.jdbc.url", config.getString("mountwilson.tdbp.db.url", config.getString("mtwilson.db.url", String.format("jdbc:mysql://%s:%s/%s?autoReconnect=true", config.getString("mountwilson.tdbp.db.host", config.getString("mtwilson.db.host", "127.0.0.1")), config.getString("mountwilson.tdbp.db.port", config.getString("mtwilson.db.port", "3306")), config.getString("mountwilson.tdbp.db.schema", config.getString("mtwilson.db.schema", "mw_as"))))));
    prop.put("javax.persistence.jdbc.user", config.getString("mountwilson.tdbp.db.user", config.getString("mtwilson.db.user", "root")));
    prop.put("javax.persistence.jdbc.password", config.getString("mountwilson.tdbp.db.password", config.getString("mtwilson.db.password", "password")));
    return prop;
}
Also used : Configuration(org.apache.commons.configuration.Configuration) Properties(java.util.Properties)

Example 13 with Configuration

use of org.apache.commons.configuration.Configuration in project pinot by linkedin.

the class DefaultHelixStarterServerConfig method getDefaultHelixServerConfig.

public static ServerConf getDefaultHelixServerConfig(Configuration externalConfigs) {
    Configuration defaultConfigs = loadDefaultServerConf();
    @SuppressWarnings("unchecked") Iterator<String> iterable = externalConfigs.getKeys();
    while (iterable.hasNext()) {
        String key = iterable.next();
        defaultConfigs.setProperty(key, externalConfigs.getProperty(key));
        LOGGER.info("External config key: {}, value: {}", key, externalConfigs.getProperty(key));
    }
    return new ServerConf(defaultConfigs);
}
Also used : ServerConf(com.linkedin.pinot.server.conf.ServerConf) Configuration(org.apache.commons.configuration.Configuration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration)

Example 14 with Configuration

use of org.apache.commons.configuration.Configuration in project pinot by linkedin.

the class PerfBenchmarkDriver method startBroker.

private void startBroker() throws Exception {
    if (!_conf.isStartBroker()) {
        LOGGER.info("Skipping start broker step. Assumes broker is already started.");
        return;
    }
    Configuration brokerConfiguration = new PropertiesConfiguration();
    String brokerInstanceName = "Broker_localhost_" + CommonConstants.Helix.DEFAULT_BROKER_QUERY_PORT;
    brokerConfiguration.setProperty("instanceId", brokerInstanceName);
    LOGGER.info("Starting broker instance: {}", brokerInstanceName);
    new HelixBrokerStarter(_clusterName, _zkAddress, brokerConfiguration);
}
Also used : Configuration(org.apache.commons.configuration.Configuration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) HelixBrokerStarter(com.linkedin.pinot.broker.broker.helix.HelixBrokerStarter) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration)

Example 15 with Configuration

use of org.apache.commons.configuration.Configuration in project pinot by linkedin.

the class SegmentFetcherFactory method initSegmentFetcherFactory.

public static void initSegmentFetcherFactory(Configuration pinotHelixProperties) {
    Configuration segmentFetcherFactoryConfig = pinotHelixProperties.subset(CommonConstants.Server.PREFIX_OF_CONFIG_OF_SEGMENT_FETCHER_FACTORY);
    Iterator segmentFetcherFactoryConfigIterator = segmentFetcherFactoryConfig.getKeys();
    while (segmentFetcherFactoryConfigIterator.hasNext()) {
        Object configKeyObject = segmentFetcherFactoryConfigIterator.next();
        try {
            String segmentFetcherConfigKey = configKeyObject.toString();
            String protocol = segmentFetcherConfigKey.split(".", 2)[0];
            if (!SegmentFetcherFactory.containsProtocol(protocol)) {
                SegmentFetcherFactory.initSegmentFetcher(new ConfigurationMap(segmentFetcherFactoryConfig.subset(protocol)));
            }
        } catch (Exception e) {
            LOGGER.error("Got exception to process the key: " + configKeyObject);
        }
    }
}
Also used : Configuration(org.apache.commons.configuration.Configuration) Iterator(java.util.Iterator) ConfigurationMap(org.apache.commons.configuration.ConfigurationMap)

Aggregations

Configuration (org.apache.commons.configuration.Configuration)169 Test (org.junit.Test)42 PropertiesConfiguration (org.apache.commons.configuration.PropertiesConfiguration)39 ZapXmlConfiguration (org.zaproxy.zap.utils.ZapXmlConfiguration)23 Test (org.testng.annotations.Test)22 File (java.io.File)13 AbstractConfiguration (org.apache.commons.configuration.AbstractConfiguration)13 MidpointConfiguration (com.evolveum.midpoint.common.configuration.api.MidpointConfiguration)11 Properties (java.util.Properties)10 AtlasException (org.apache.atlas.AtlasException)9 ZkUtils (kafka.utils.ZkUtils)8 IndexLoadingConfigMetadata (com.linkedin.pinot.common.metadata.segment.IndexLoadingConfigMetadata)7 HashMap (java.util.HashMap)7 CompositeConfiguration (org.apache.commons.configuration.CompositeConfiguration)7 ArrayList (java.util.ArrayList)6 AtlasClient (org.apache.atlas.AtlasClient)6 BeforeClass (org.testng.annotations.BeforeClass)6 IOException (java.io.IOException)5 SimpleEntry (java.util.AbstractMap.SimpleEntry)5 ConfigurationException (org.apache.commons.configuration.ConfigurationException)5