Search in sources :

Example 26 with Weld

use of org.jboss.weld.environment.se.Weld in project jersey by jersey.

the class RequestScopedResourceTest method before.

@BeforeClass
public static void before() throws Exception {
    weld = new Weld();
    weld.initialize();
}
Also used : Weld(org.jboss.weld.environment.se.Weld) BeforeClass(org.junit.BeforeClass)

Example 27 with Weld

use of org.jboss.weld.environment.se.Weld in project jetty.project by eclipse.

the class AbstractWeldTest method initWeld.

@BeforeClass
public static void initWeld() {
    weld = new Weld();
    container = weld.initialize();
}
Also used : Weld(org.jboss.weld.environment.se.Weld) BeforeClass(org.junit.BeforeClass)

Example 28 with Weld

use of org.jboss.weld.environment.se.Weld in project indy by Commonjava.

the class WeldJUnit4Runner method createTest.

@Override
protected Object createTest() throws Exception {
    this.weld = new Weld();
    this.container = weld.initialize();
    return container.instance().select(getTestClass().getJavaClass()).get();
}
Also used : Weld(org.jboss.weld.environment.se.Weld)

Example 29 with Weld

use of org.jboss.weld.environment.se.Weld in project indy by Commonjava.

the class DefaultIndyConfigFactoryTest method weldInjection_IterateIndyConfigurators.

@Test
public void weldInjection_IterateIndyConfigurators() {
    Weld weld = new Weld();
    WeldContainer container = weld.initialize();
    List<String> sections = new ArrayList<>();
    container.instance().select(IndyConfigInfo.class).iterator().forEachRemaining((instance) -> {
        String section = ConfigUtils.getSectionName(instance);
        System.out.printf("Got instance: %s with section: %s\n", instance, section);
        sections.add(section);
    });
    System.out.println(sections);
    assertThat(sections.contains(ConfigurationSectionListener.DEFAULT_SECTION), equalTo(true));
    assertThat(sections.contains("flatfiles"), equalTo(true));
    assertThat(sections.contains("ui"), equalTo(true));
    assertThat(sections.contains("storage-default"), equalTo(true));
}
Also used : WeldContainer(org.jboss.weld.environment.se.WeldContainer) ArrayList(java.util.ArrayList) Weld(org.jboss.weld.environment.se.Weld) Test(org.junit.Test)

Example 30 with Weld

use of org.jboss.weld.environment.se.Weld in project indy by Commonjava.

the class DefaultIndyConfigFactoryTest method weldInjection_writeDefaults.

@Test
public void weldInjection_writeDefaults() throws IOException, ConfigurationException {
    Weld weld = new Weld();
    WeldContainer container = weld.initialize();
    DefaultIndyConfigFactory factory = container.instance().select(DefaultIndyConfigFactory.class).get();
    File dir = temp.newFolder("indy-config");
    dir.mkdirs();
    factory.writeDefaultConfigs(dir);
    assertThat(new File(dir, "main.conf").exists(), equalTo(true));
}
Also used : WeldContainer(org.jboss.weld.environment.se.WeldContainer) File(java.io.File) Weld(org.jboss.weld.environment.se.Weld) Test(org.junit.Test)

Aggregations

Weld (org.jboss.weld.environment.se.Weld)36 WeldContainer (org.jboss.weld.environment.se.WeldContainer)12 Test (org.junit.Test)9 BeforeClass (org.junit.BeforeClass)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 PrintStream (java.io.PrintStream)3 ArrayList (java.util.ArrayList)2 KieServicesImpl (org.drools.compiler.kie.builder.impl.KieServicesImpl)2 Before (org.junit.Before)2 File (java.io.File)1 IOException (java.io.IOException)1 URL (java.net.URL)1 URLClassLoader (java.net.URLClassLoader)1 Bean (javax.enterprise.inject.spi.Bean)1 BeanManager (javax.enterprise.inject.spi.BeanManager)1 Extension (javax.enterprise.inject.spi.Extension)1 Bus (org.apache.cxf.Bus)1 BootOptions (org.commonjava.indy.boot.BootOptions)1 BootStatus (org.commonjava.indy.boot.BootStatus)1 KieContainerImpl (org.drools.compiler.kie.builder.impl.KieContainerImpl)1