Search in sources :

Example 1 with WeldConfiguration

use of org.jboss.weld.config.WeldConfiguration in project core by weld.

the class Reports method addConfiguration.

private static void addConfiguration(HtmlTag body, BeanManagerImpl manager) {
    body.add(HtmlTag.aname(CONFIG));
    body.add(HtmlTag.h2(TITLE_CONFIG));
    HtmlTag table = HtmlTag.stripedTable().appendTo(HtmlTag.div(CONFIG).appendTo(body));
    HtmlTag.tr().add(HtmlTag.th(""), HtmlTag.th("Key"), HtmlTag.th("Default Value"), HtmlTag.th("Value"), HtmlTag.th("Description")).appendTo(table);
    int idx = 0;
    WeldConfiguration configuration = manager.getServices().get(WeldConfiguration.class);
    for (ConfigurationKey key : getSortedConfigurationKeys()) {
        Object defaultValue = key.getDefaultValue();
        Object value = getValue(key, configuration);
        if (value == null) {
            // Unsupported property type
            continue;
        }
        if (!defaultValue.equals(value)) {
            String desc = getDesc(key);
            table.add(HtmlTag.tr().add(HtmlTag.td(++idx + "."), HtmlTag.td(key.get()), HtmlTag.td(defaultValue.toString()), HtmlTag.td(value.toString()), HtmlTag.td().add(desc != null ? SafeString.of(desc) : "")));
        }
    }
}
Also used : ConfigurationKey(org.jboss.weld.config.ConfigurationKey) SafeString(org.jboss.weld.probe.HtmlTag.SafeString) WeldConfiguration(org.jboss.weld.config.WeldConfiguration) InjectionPoint(javax.enterprise.inject.spi.InjectionPoint)

Example 2 with WeldConfiguration

use of org.jboss.weld.config.WeldConfiguration in project core by weld.

the class PropertiesFilesConfigTest method testConfiguration.

@Test
public void testConfiguration() {
    WeldConfiguration configuration = beanManager.getServices().get(WeldConfiguration.class);
    // Multiple definitions but the same values
    assertEquals(false, configuration.getBooleanProperty(ConfigurationKey.CONCURRENT_DEPLOYMENT));
    assertEquals(Integer.valueOf(5), configuration.getIntegerProperty(ConfigurationKey.PRELOADER_THREAD_POOL_SIZE));
    // Unique values
    assertEquals("FIXED_TIMEOUT", configuration.getStringProperty(ConfigurationKey.EXECUTOR_THREAD_POOL_TYPE));
    assertEquals(Long.valueOf(1000), configuration.getLongProperty(ConfigurationKey.RESOLUTION_CACHE_SIZE));
    // Default value
    assertEquals(ConfigurationKey.NON_PORTABLE_MODE.getDefaultValue(), configuration.getBooleanProperty(ConfigurationKey.NON_PORTABLE_MODE));
}
Also used : WeldConfiguration(org.jboss.weld.config.WeldConfiguration) Test(org.junit.Test)

Example 3 with WeldConfiguration

use of org.jboss.weld.config.WeldConfiguration in project core by weld.

the class SystemPropertiesConfigTest method testPropertiesLoadedAndPropagatedToWeldConfiguration.

@Test
@OperateOnDeployment(WAR_DEPLOYMENT)
public void testPropertiesLoadedAndPropagatedToWeldConfiguration() {
    WeldConfiguration configuration = beanManager.getServices().get(WeldConfiguration.class);
    assertEquals(false, configuration.getBooleanProperty(ConfigurationKey.CONCURRENT_DEPLOYMENT));
    assertEquals(true, configuration.getBooleanProperty(ConfigurationKey.INJECTABLE_REFERENCE_OPTIMIZATION));
}
Also used : WeldConfiguration(org.jboss.weld.config.WeldConfiguration) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

Example 4 with WeldConfiguration

use of org.jboss.weld.config.WeldConfiguration in project core by weld.

the class CombinedPropertiesFilesConfigTest method testWeldPropertiesFilePriorityInConfiguration.

@Test
@OperateOnDeployment(WAR_DEPLOYMENT)
public void testWeldPropertiesFilePriorityInConfiguration() {
    WeldConfiguration configuration = beanManager.getServices().get(WeldConfiguration.class);
    // Multiple definitions but the same values
    assertEquals(false, configuration.getBooleanProperty(ConfigurationKey.CONCURRENT_DEPLOYMENT));
    assertEquals(Integer.valueOf(5), configuration.getIntegerProperty(ConfigurationKey.PRELOADER_THREAD_POOL_SIZE));
    // Unique values
    assertEquals("FIXED_TIMEOUT", configuration.getStringProperty(ConfigurationKey.EXECUTOR_THREAD_POOL_TYPE));
    assertEquals(Long.valueOf(1000), configuration.getLongProperty(ConfigurationKey.RESOLUTION_CACHE_SIZE));
}
Also used : WeldConfiguration(org.jboss.weld.config.WeldConfiguration) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

Example 5 with WeldConfiguration

use of org.jboss.weld.config.WeldConfiguration in project core by weld.

the class CombinedPropertiesFilesConfigTest method testDefault.

@Test
@OperateOnDeployment(WAR_DEPLOYMENT)
public void testDefault() {
    WeldConfiguration configuration = beanManager.getServices().get(WeldConfiguration.class);
    // Default value
    assertEquals(ConfigurationKey.NON_PORTABLE_MODE.getDefaultValue(), configuration.getBooleanProperty(ConfigurationKey.NON_PORTABLE_MODE));
}
Also used : WeldConfiguration(org.jboss.weld.config.WeldConfiguration) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

Aggregations

WeldConfiguration (org.jboss.weld.config.WeldConfiguration)15 Test (org.junit.Test)8 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)3 SimpleServiceRegistry (org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry)2 ConfigurationKey (org.jboss.weld.config.ConfigurationKey)2 GlobalObserverNotifierService (org.jboss.weld.event.GlobalObserverNotifierService)2 ResourceInjectionFactory (org.jboss.weld.injection.ResourceInjectionFactory)2 BeanManagerImpl (org.jboss.weld.manager.BeanManagerImpl)2 MetaAnnotationStore (org.jboss.weld.metadata.cache.MetaAnnotationStore)2 ClassTransformer (org.jboss.weld.resources.ClassTransformer)2 BeanIdentifierIndex (org.jboss.weld.serialization.BeanIdentifierIndex)2 ContextualStoreImpl (org.jboss.weld.serialization.ContextualStoreImpl)2 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 ArrayList (java.util.ArrayList)1 Bean (javax.enterprise.inject.spi.Bean)1 InjectionPoint (javax.enterprise.inject.spi.InjectionPoint)1 SlimAnnotatedTypeStoreImpl (org.jboss.weld.annotated.slim.SlimAnnotatedTypeStoreImpl)1 AbstractClassBean (org.jboss.weld.bean.AbstractClassBean)1 AbstractProducerBean (org.jboss.weld.bean.AbstractProducerBean)1 SessionBean (org.jboss.weld.bean.SessionBean)1