Java Code Examples for org.apache.deltaspike.core.api.config.ConfigResolver

The following examples show how to use org.apache.deltaspike.core.api.config.ConfigResolver. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hola   Source File: HolaResource.java    License: Apache License 2.0 6 votes vote down vote up
@GET
@Path("/hola")
@Produces("text/plain")
@ApiOperation("Returns the greeting in Spanish")
public String hola() {
    String hostname = System.getenv().getOrDefault("HOSTNAME", "unknown");
    String translation = ConfigResolver
        .resolve("hello")
        .withDefault("Hola de %s")
        .logChanges(true)
        // 5 Seconds cache only for demo purpose
        .cacheFor(TimeUnit.SECONDS, 5)
        .getValue();
    return String.format(translation, hostname);

}
 
Example 2
Source Project: deltaspike   Source File: ServletConfigListener.java    License: Apache License 2.0 6 votes vote down vote up
private void setServletConfig(ServletConfigSource configSource, ServletContextEvent sce)
{
    ServletContext servletContext = sce.getServletContext();
    String servletContextName = servletContext.getServletContextName();
    if (servletContextName != null && servletContextName.length() > 0)
    {
        String oldAppName = ConfigResolver.getPropertyValue(ConfigResolver.DELTASPIKE_APP_NAME_CONFIG);

        // we first need to unregister the old MBean
        // as we don't know whether the CDI Extension or the Servlet Listener comes first.
        // It's simply not defined by the spec :/
        ConfigurationExtension.unRegisterConfigMBean(oldAppName);

        configSource.setPropertyValue(ConfigResolver.DELTASPIKE_APP_NAME_CONFIG, servletContextName);

        // and as we now did set the new name -> register again:
        ConfigurationExtension.registerConfigMBean();
    }
}
 
Example 3
/**
 * Load additional configuration from the Configuration system
 * and overload the basic settings with that info.
 *
 * The key is deltaspike.persistence.config.${persistenceUnitName}.${originalKey}
 *
 * @see #CONFIG_PREFIX
 * @since 1.8.0
 */
protected Properties addConfigProperties(Properties unitProperties, String persistenceUnitName)
{
    // we start with a copy of the original properties
    Properties mergedConfig = new Properties();
    mergedConfig.putAll(unitProperties);

    Set<String> allConfigKeys = ConfigResolver.getAllProperties().keySet();
    String unitPrefix = CONFIG_PREFIX + persistenceUnitName + ".";
    for (String configKey : allConfigKeys)
    {
        if (configKey.startsWith(unitPrefix))
        {
            mergedConfig.put(configKey.substring(unitPrefix.length()),
                    ConfigResolver.getProjectStageAwarePropertyValue(configKey));
        }
    }

    return mergedConfig;
}
 
Example 4
Source Project: deltaspike   Source File: AbstractQuartzScheduler.java    License: Apache License 2.0 6 votes vote down vote up
private String evaluateExpression(Scheduled scheduled)
{
    String expression = scheduled.cronExpression();

    if (expression.startsWith("{") && expression.endsWith("}"))
    {
        String configKey = expression.substring(1, expression.length() - 1);
        expression = ConfigResolver.getProjectStageAwarePropertyValue(configKey, null);

        if (expression == null)
        {
            throw new IllegalStateException("No config-value found for config-key: " + configKey);
        }
    }
    return expression;
}
 
Example 5
Source Project: deltaspike   Source File: BaseConfigPropertyProducer.java    License: Apache License 2.0 6 votes vote down vote up
public <T> ConfigResolver.TypedResolver<T> asResolver(final String key, final String stringDefault,
                                                      final Type ipCls,
                                                      final Class<? extends ConfigResolver.Converter> converterType,
                                                      final String parameterizedBy,
                                                      final boolean projectStageAware, final boolean evaluate)
{
    final ConfigResolver.UntypedResolver<String> untypedResolver = ConfigResolver.resolve(key);
    final ConfigResolver.TypedResolver<T> resolver =
            (ConfigResolver.Converter.class == converterType ?
                    untypedResolver.as(Class.class.cast(ipCls)) :
                    untypedResolver.as(ipCls, BeanProvider.getContextualReference(converterType)))
                    .withCurrentProjectStage(projectStageAware);
    if (!ConfigProperty.NULL.equals(stringDefault))
    {
        resolver.withStringDefault(stringDefault);
    }
    if (!ConfigProperty.NULL.equals(parameterizedBy))
    {
        resolver.parameterizedBy(parameterizedBy);
    }
    return resolver.evaluateVariables(evaluate);
}
 
Example 6
Source Project: deltaspike   Source File: ProjectStageProducer.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Resolves the project-stage configured for DeltaSpike
 * @return the resolved {@link ProjectStage} or <code>null</code> if none defined.
 */
protected ProjectStage resolveProjectStage()
{
    for (String configLocation : CONFIG_SETTING_KEYS)
    {
        String stageName = ConfigResolver.getPropertyValue(configLocation);

        if (stageName != null && !stageName.isEmpty())
        {
            return ProjectStage.valueOf(stageName);
        }

    }

    return null;
}
 
Example 7
Source Project: deltaspike   Source File: DefaultClassDeactivator.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Boolean isActivated(Class<? extends Deactivatable> targetClass)
{
    final String key = KEY_PREFIX + targetClass.getName();
    final String value = ConfigResolver.getPropertyValue(key);
    if (value == null)
    {
        return null;
    }
    else
    {
        if (LOG.isLoggable(Level.FINE))
        {
            LOG.log(Level.FINE, "Deactivation setting for {0} found to be {1} based on configuration.",
                    new Object[]{key, value});
        }
        return !Boolean.valueOf(value);
    }
}
 
Example 8
Source Project: deltaspike   Source File: DynamicMBeanWrapper.java    License: Apache License 2.0 6 votes vote down vote up
private String getDescription(final String description, String defaultDescription)
{
    if (description.isEmpty())
    {
        return defaultDescription;
    }

    String descriptionValue = description.trim();

    if (descriptionValue.startsWith("{") && descriptionValue.endsWith("}"))
    {
        return ConfigResolver.getPropertyValue(
            descriptionValue.substring(1, descriptionValue.length() - 1), defaultDescription);
    }
    return description;
}
 
Example 9
Source Project: deltaspike   Source File: DeltaSpikeConfigInfo.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public String[] getConfigSourcesAsString()
{
    ClassLoader originalCl = Thread.currentThread().getContextClassLoader();
    try
    {
        Thread.currentThread().setContextClassLoader(appConfigClassLoader);

        ConfigSource[] configSources = ConfigResolver.getConfigSources();
        List<String> configSourceInfo = new ArrayList<String>();
        for (ConfigSource configSource : configSources)
        {
            configSourceInfo.add(Integer.toString(configSource.getOrdinal())
                + " - " + configSource.getConfigName());
        }

        return configSourceInfo.toArray(new String[configSourceInfo.size()]);
    }
    finally
    {
        // set back the original TCCL
        Thread.currentThread().setContextClassLoader(originalCl);
    }

}
 
Example 10
Source Project: deltaspike   Source File: DeltaSpikeConfigInfo.java    License: Apache License 2.0 6 votes vote down vote up
private List<ConfigEntry> calculateConfigEntries()
{
    Map<String, String> allProperties = ConfigResolver.getAllProperties();
    List<ConfigEntry> configEntries = new ArrayList<ConfigEntry>(allProperties.size());
    ConfigSource[] configSources = ConfigResolver.getConfigSources();

    for (Map.Entry<String, String> configEntry : allProperties.entrySet())
    {
        String key = configEntry.getKey();
        String value = ConfigResolver.filterConfigValueForLog(key,
                                ConfigResolver.getProjectStageAwarePropertyValue(key));

        String fromConfigSource = getFromConfigSource(configSources, key);
        configEntries.add(new ConfigEntry(key, value, fromConfigSource));
    }

    return configEntries;
}
 
Example 11
Source Project: deltaspike   Source File: ConfigResolverTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testTypedResolver_NonExistingValue()
{
    final String key = "non.existing.key";

    ConfigResolver.TypedResolver<String> resolver = ConfigResolver.resolve(key)
        .logChanges(true);

    Assert.assertNull(resolver.getValue());

    setTestConfigSourceValue(key, "somevalue");
    Assert.assertEquals("somevalue", resolver.getValue());

    setTestConfigSourceValue(key, null);
    Assert.assertNull(resolver.getValue());
}
 
Example 12
Source Project: deltaspike   Source File: TypedResolverImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public ConfigResolver.TypedResolver<T> withStringDefault(String value)
{
    if (value == null || value.isEmpty())
    {
        throw new RuntimeException("Empty String or null supplied as string-default value for property "
                + keyOriginal);
    }

    if (isList)
    {
        defaultValue = splitAndConvertListValue(value);
    }
    else
    {
        defaultValue = convert(value);
    }
    withDefault = true;
    return this;
}
 
Example 13
Source Project: deltaspike   Source File: TypedResolverImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public ConfigResolver.TypedResolver<T> parameterizedBy(String propertyName)
{
    this.propertyParameter = propertyName;

    if (propertyParameter != null && !propertyParameter.isEmpty())
    {
        String parameterValue = ConfigResolver
                .resolve(propertyParameter)
                .withCurrentProjectStage(projectStageAware)
                .getValue();

        if (parameterValue != null && !parameterValue.isEmpty())
        {
            this.parameterValue = parameterValue;
        }
    }

    return this;
}
 
Example 14
Source Project: deltaspike   Source File: ConfigImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public ConfigSnapshot snapshotFor(ConfigResolver.TypedResolver<?>... typedResolvers)
{
    // we implement kind of optimistic Locking
    // Means we try multiple time to resolve all the given values
    // until the config didn't change inbetween.
    for (int tries = 1; tries < 5; tries++)
    {
        Map<ConfigResolver.TypedResolver<?>, Object> configValues = new HashMap<>();
        long startReadLastChanged = lastChanged;
        for (ConfigResolver.TypedResolver<?> typedResolver : typedResolvers)
        {
            configValues.put(typedResolver, typedResolver.getValue());
        }

        if (startReadLastChanged == lastChanged)
        {
            return new ConfigSnapshotImpl(configValues);
        }
    }

    throw new IllegalStateException(
            "Could not resolve ConfigTransaction as underlying values are permanently changing!");
}
 
Example 15
Source Project: deltaspike   Source File: ConfigurationExtension.java    License: Apache License 2.0 6 votes vote down vote up
public static void registerConfigMBean()
{
    String appName = ConfigResolver.getPropertyValue(ConfigResolver.DELTASPIKE_APP_NAME_CONFIG);
    if (appName != null && appName.length() > 0)
    {
        try
        {
            MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();

            ClassLoader tccl = ClassUtils.getClassLoader(ConfigurationExtension.class);
            DeltaSpikeConfigInfo cfgMBean = new DeltaSpikeConfigInfo(tccl);

            ObjectName name = new ObjectName("deltaspike.config." + appName + ":type=DeltaSpikeConfig");
            mBeanServer.registerMBean(cfgMBean, name);
        }
        catch (InstanceAlreadyExistsException iae)
        {
            // all fine, the CfgBean got already registered.
            // Most probably by the ServletConfigListener
        }
        catch (Exception e)
        {
            throw new RuntimeException(e);
        }
    }
}
 
Example 16
Source Project: deltaspike   Source File: ConfigHelperTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testDiffConfig() {
    ConfigResolver.ConfigHelper cfgHelper = ConfigResolver.getConfigProvider().getHelper();

    Map<String, String> oldVal = new HashMap<>();
    Map<String, String> newVal = new HashMap<>();

    oldVal.put("a", "1");

    newVal.put("b", "2");
    newVal.put("a", "1");

    assertAll(cfgHelper.diffConfig(null, newVal), "a", "b");
    assertAll(cfgHelper.diffConfig(oldVal, null), "a");
    assertAll(cfgHelper.diffConfig(oldVal, newVal), "b");
    assertAll(cfgHelper.diffConfig(oldVal, oldVal));
    assertAll(cfgHelper.diffConfig(newVal, newVal));

    newVal.put("a", "5");
    assertAll(cfgHelper.diffConfig(oldVal, newVal), "a", "b");

}
 
Example 17
Source Project: deltaspike   Source File: TypedResolverTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testValidTypes()
{
    Assert.assertEquals("configured", ConfigResolver.resolve("deltaspike.test.string-value").getValue());

    Assert.assertEquals(Boolean.FALSE, ConfigResolver.resolve("deltaspike.test.boolean-value").as(Boolean.class)
            .getValue());

    Assert.assertEquals(TestConfigSource.class, ConfigResolver.resolve("deltaspike.test.class-value").as(Class
            .class).getValue());

    Assert.assertEquals(5l, (int) ConfigResolver.resolve("deltaspike.test.integer-value").as(Integer.class)
            .getValue());

    Assert.assertEquals(8589934592l, (long) ConfigResolver.resolve("deltaspike.test.long-value").as(Long.class)
            .getValue());

    Assert.assertEquals(-1.1f, (float) ConfigResolver.resolve("deltaspike.test.float-value").as(Float.class)
            .getValue(), 0);

    Assert.assertEquals(4e40d, (double) ConfigResolver.resolve("deltaspike.test.double-value").as(Double.class)
            .getValue(), 0);
}
 
Example 18
Source Project: deltaspike   Source File: TypedResolverTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testProjectStageAware()
{
    Assert.assertEquals("unittestvalue",
            ConfigResolver.resolve("testkey")
                    .withCurrentProjectStage(true)
                    .getValue());

    Assert.assertEquals("testvalue",
            ConfigResolver.resolve("testkey")
                    .withCurrentProjectStage(false)
                    .getValue());

    // property without PS, with PS-aware
    Assert.assertEquals("testvalue",
            ConfigResolver.resolve("testkey2")
                    .withCurrentProjectStage(true)
                    .getValue());
}
 
Example 19
Source Project: deltaspike   Source File: ConfigResolverTest.java    License: Apache License 2.0 6 votes vote down vote up
private void setTestConfigSourceValue(String key, String value)
{
    ConfigSource[] configSources = ConfigResolver.getConfigSources();
    for (ConfigSource configSource : configSources)
    {
        if (configSource instanceof TestConfigSource)
        {
            if (value == null)
            {
                configSource.getProperties().remove(key);
            }
            else
            {
                configSource.getProperties().put(key, value);
            }

            break;
        }
    }
}
 
Example 20
Source Project: deltaspike   Source File: TypedResolverTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testStrict()
{
    Assert.assertEquals("TestDataSource",
            ConfigResolver.resolve("dataSource")
                    .withCurrentProjectStage(true)
                    .parameterizedBy("dbvendor")
                    .strictly(true)
                    .getValue());

    // no base.param, no value for base.param.ps
    Assert.assertEquals(null,
            ConfigResolver.resolve("dataSource")
                    .withCurrentProjectStage(true)
                    .parameterizedBy("dbvendor3")
                    .strictly(true)
                    .getValue());

    // valid base.param, but no base.param.ps
    Assert.assertEquals(null,
            ConfigResolver.resolve("dataSource")
                    .withCurrentProjectStage(true)
                    .parameterizedBy("dbvendor2")
                    .strictly(true)
                    .getValue());
}
 
Example 21
Source Project: deltaspike   Source File: TypedResolverTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testGets()
{
    ConfigResolver.TypedResolver<String> resolver = ConfigResolver.resolve("dataSource")
            .withCurrentProjectStage(true)
            .parameterizedBy("dbvendor")
            .withDefault("TESTDEFAULT");

    Assert.assertEquals("TestDataSource", resolver.getValue());
    Assert.assertEquals("dataSource", resolver.getKey());
    Assert.assertEquals("TESTDEFAULT", resolver.getDefaultValue());
    Assert.assertEquals("dataSource.mysql.UnitTest", resolver.getResolvedKey());


    ConfigResolver.TypedResolver<String> resolver2 = ConfigResolver.resolve("testkey2")
            .withCurrentProjectStage(true)
            .parameterizedBy("INVALIDPARAMETER");


    Assert.assertEquals("testvalue", resolver2.getValue());
    Assert.assertEquals("testkey2", resolver2.getResolvedKey());
}
 
Example 22
Source Project: deltaspike   Source File: TypedResolverTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testWithCacheTime() throws Exception
{
    ConfigResolver.TypedResolver<String> resolver = ConfigResolver.resolve("dataSource")
        .withCurrentProjectStage(true)
        .parameterizedBy("dbvendor")
        .cacheFor(TimeUnit.MILLISECONDS, 5)
        .withDefault("TESTDEFAULT");

    Assert.assertEquals("TestDataSource", resolver.getValue());
    Assert.assertEquals("TestDataSource", resolver.getValue());
    Assert.assertEquals("dataSource", resolver.getKey());
    Assert.assertEquals("TESTDEFAULT", resolver.getDefaultValue());
    Assert.assertEquals("dataSource.mysql.UnitTest", resolver.getResolvedKey());

    // because the clock steps in certain OS is only 16ms
    Thread.sleep(35L);
    Assert.assertEquals("TestDataSource", resolver.getValue());
}
 
Example 23
Source Project: deltaspike   Source File: ThreadPoolManagerTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test // this test validates we read the config properly but also it is lazy
public void configuredPool() throws ExecutionException, InterruptedException
{
    ConfigResolver.addConfigSources(Collections.<ConfigSource>singletonList(new PropertiesConfigSource(new Properties()
    {{
        setProperty("futureable.pool.custom.coreSize", "5");
    }})
    {
        @Override
        public String getConfigName()
        {
            return "configuredPool";
        }
    }));
    final ExecutorService custom = manager.find("custom");
    assertEquals(custom, custom);
    assertSame(custom, custom);
    assertEquals(5, ThreadPoolExecutor.class.cast(custom).getCorePoolSize());
    assertUsable(custom);
}
 
Example 24
Source Project: deltaspike   Source File: ConfigSourceTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testConfigViaSystemProperty()
{
    String key = "testProperty01";
    String value = "test_value_01";

    // the value is not yet configured
    String configuredValue = ConfigResolver.getPropertyValue(key);
    Assert.assertNull(configuredValue);

    String myDefaultValue = "theDefaultValueDummy";
    configuredValue = ConfigResolver.getPropertyValue(key, myDefaultValue);
    Assert.assertEquals(myDefaultValue, configuredValue);

    // now we set a value for the config key
    System.setProperty(key, value);
    configuredValue = ConfigResolver.getPropertyValue(key);
    Assert.assertEquals(value, configuredValue);

    System.setProperty(key, "");
    configuredValue = ConfigResolver.getPropertyValue(key);
    Assert.assertEquals("", configuredValue);

}
 
Example 25
Source Project: deltaspike   Source File: ConfigResolverTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testGetProjectStageAwarePropertyValue()
{
    ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);
    Assert.assertNull(ConfigResolver.getProjectStageAwarePropertyValue("notexisting", null));

    Assert.assertEquals("testvalue", ConfigResolver.getPropertyValue("testkey"));
    Assert.assertEquals("unittestvalue", ConfigResolver.getProjectStageAwarePropertyValue("testkey"));
    Assert.assertEquals("unittestvalue", ConfigResolver.getProjectStageAwarePropertyValue("testkey", null));

    Assert.assertEquals("testvalue", ConfigResolver.getPropertyValue("testkey2"));
    Assert.assertEquals("testvalue", ConfigResolver.getProjectStageAwarePropertyValue("testkey2"));
    Assert.assertEquals("testvalue", ConfigResolver.getProjectStageAwarePropertyValue("testkey2", null));

    Assert.assertEquals("testvalue", ConfigResolver.getPropertyValue("testkey3"));
    Assert.assertEquals("", ConfigResolver.getProjectStageAwarePropertyValue("testkey3"));
    Assert.assertEquals(DEFAULT_VALUE, ConfigResolver.getProjectStageAwarePropertyValue("testkey3", DEFAULT_VALUE));

    Assert.assertEquals(DEFAULT_VALUE, ConfigResolver.getProjectStageAwarePropertyValue("deltaspike.test.projectstagefallback", DEFAULT_VALUE));
    Assert.assertEquals("", ConfigResolver.getProjectStageAwarePropertyValue("deltaspike.test.projectstagefallback"));

    Assert.assertEquals(DEFAULT_VALUE, ConfigResolver.resolve("deltaspike.test.projectstagefallback").as(String.class).withDefault(DEFAULT_VALUE).withCurrentProjectStage(true).getValue());
    Assert.assertEquals("", ConfigResolver.resolve("deltaspike.test.projectstagefallback").as(String.class).withCurrentProjectStage(true).getValue());
}
 
Example 26
Source Project: deltaspike   Source File: ConfigResolverTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testConfigFilter()
{
    ConfigFilter configFilter = new TestConfigFilter();

    Assert.assertEquals("shouldGetDecrypted: value", configFilter.filterValue("somekey.encrypted", "value"));
    Assert.assertEquals("**********", configFilter.filterValueForLog("somekey.password", "value"));

    ConfigResolver.addConfigFilter(configFilter);

    Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getPropertyValue("testkey4.encrypted"));
    Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getProjectStageAwarePropertyValue("testkey4.encrypted"));
    Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getProjectStageAwarePropertyValue("testkey4.encrypted", null));
    Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getPropertyAwarePropertyValue("testkey4.encrypted", "dbvendor"));
    Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getPropertyAwarePropertyValue("testkey4.encrypted", "dbvendor", null));

    List<String> allPropertyValues = ConfigResolver.getAllPropertyValues("testkey4.encrypted");
    Assert.assertNotNull(allPropertyValues);
    Assert.assertEquals(1, allPropertyValues.size());
    Assert.assertEquals("shouldGetDecrypted: value", allPropertyValues.get(0));

}
 
Example 27
Source Project: deltaspike   Source File: ConfigResolverTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testConfiguredListValues_WithWhitespace() {
    List<String> emails = ConfigResolver.resolve("test.list.value.emails").asList().getValue();
    Assert.assertNotNull(emails);
    Assert.assertEquals(3, emails.size());
    Assert.assertTrue(emails.contains("[email protected]"));
    Assert.assertTrue(emails.contains("[email protected]"));
    Assert.assertTrue(emails.contains("[email protected]"));
}
 
Example 28
Source Project: datawave   Source File: ConnectionPoolConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
public ConnectionPoolConfiguration(String poolName) {
    username = ConfigResolver.getPropertyValue("dw." + poolName + ".accumulo.userName");
    password = ConfigResolver.getPropertyValue("dw." + poolName + ".accumulo.password");
    instance = ConfigResolver.getPropertyValue("dw." + poolName + ".instanceName");
    zookeepers = ConfigResolver.getPropertyValue("dw." + poolName + ".zookeepers");
    lowPriorityPoolSize = Integer.parseInt(ConfigResolver.getPropertyValue("dw." + poolName + ".pool.low.size", "25"));
    normalPriorityPoolSize = Integer.parseInt(ConfigResolver.getPropertyValue("dw." + poolName + ".pool.normal.size", "50"));
    highPriorityPoolSize = Integer.parseInt(ConfigResolver.getPropertyValue("dw." + poolName + ".pool.high.size", "100"));
    adminPriorityPoolSize = Integer.parseInt(ConfigResolver.getPropertyValue("dw." + poolName + ".pool.admin.size", "200"));
}
 
Example 29
Source Project: jpa-invoicer   Source File: UserSession.java    License: The Unlicense 5 votes vote down vote up
@PostConstruct
public void init() {
    final String propertyValue = ConfigResolver.getPropertyValue(
            "jpa-invoicer.gpluskey");
    // If no Google OAuth API key available, use fake login
    if (StringUtils.isEmpty(propertyValue)) {
        demoLogin();
    }
}
 
Example 30
Source Project: deltaspike   Source File: ConfigResolverTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testProjectStageAwarePropertyValueReference_2() {
    final String expected =
            "projectStageAware-exampleEntry-1-is-tomato-UnitTest";

    final String projectStageAwareExampleEntry1 =
            ConfigResolver.getProjectStageAwarePropertyValue(
            "deltaspike.test.exampleEntry-2", 
            "");

    Assert.assertEquals(expected, projectStageAwareExampleEntry1);
}