Search in sources :

Example 31 with Weld

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

the class ClassUnwrapperTest method setUp.

@Before
public void setUp() {
    final Weld weld = new Weld();
    container = weld.initialize();
    bus = getBeanReference(Bus.class);
}
Also used : Bus(org.apache.cxf.Bus) Weld(org.jboss.weld.environment.se.Weld) Before(org.junit.Before)

Example 32 with Weld

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

the class CDIExample method main.

public static void main(String[] args) {
    Weld w = new Weld();
    WeldContainer wc = w.initialize();
    CDIExample bean = wc.instance().select(CDIExample.class).get();
    bean.go(System.out);
    w.shutdown();
}
Also used : WeldContainer(org.jboss.weld.environment.se.WeldContainer) Weld(org.jboss.weld.environment.se.Weld)

Example 33 with Weld

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

the class CDIExampleWithInclusionTest method testGo.

@Test
public void testGo() {
    Weld w = new Weld();
    WeldContainer wc = w.initialize();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    CDIExampleWithInclusion bean = wc.instance().select(CDIExampleWithInclusion.class).get();
    bean.go(ps);
    ps.close();
    String actual = new String(baos.toByteArray());
    String expected = "" + "Dave: Hello, HAL. Do you read me, HAL?" + NL + "HAL: Dave. I read you." + NL + "Dave: Open the pod bay doors, HAL." + NL + "HAL: I'm sorry, Dave. I'm afraid I can't do that." + NL;
    assertEquals(expected, actual);
    w.shutdown();
}
Also used : PrintStream(java.io.PrintStream) WeldContainer(org.jboss.weld.environment.se.WeldContainer) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Weld(org.jboss.weld.environment.se.Weld) Test(org.junit.Test)

Example 34 with Weld

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

the class CDIExampleTest method testGo.

@Test
public void testGo() {
    Weld w = new Weld();
    WeldContainer wc = w.initialize();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    CDIExample bean = wc.instance().select(CDIExample.class).get();
    bean.go(ps);
    ps.close();
    String actual = new String(baos.toByteArray());
    String expected = "" + "Dave: Hello, HAL. Do you read me, HAL?" + NL + "HAL: Dave. I read you." + NL;
    assertEquals(expected, actual);
    w.shutdown();
}
Also used : PrintStream(java.io.PrintStream) WeldContainer(org.jboss.weld.environment.se.WeldContainer) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Weld(org.jboss.weld.environment.se.Weld) Test(org.junit.Test)

Example 35 with Weld

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

the class CDIInstanceExampleTest method testGo.

@Test
public void testGo() {
    Weld w = new Weld();
    WeldContainer wc = w.initialize();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    CDIInstanceExample bean = wc.instance().select(CDIInstanceExample.class).get();
    bean.go(ps);
    ps.close();
    String actual = new String(baos.toByteArray());
    String expected = "" + "Dave: Hello, HAL. Do you read me, HAL?" + NL + "HAL: Dave. I read you." + NL;
    assertEquals(expected, actual);
    w.shutdown();
}
Also used : PrintStream(java.io.PrintStream) WeldContainer(org.jboss.weld.environment.se.WeldContainer) ByteArrayOutputStream(java.io.ByteArrayOutputStream) 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