Package org.jboss.weld.environment.se

Examples of org.jboss.weld.environment.se.WeldContainer


         ContainerServiceExtension extension = new ContainerServiceExtension(container, addon);

         weld = new ModularWeld(scanResult);
         weld.addExtension(extension);
         weld.addExtension(new ContainerBeanRegistrant());
         WeldContainer container = weld.initialize();

         manager = container.getBeanManager();
         Assert.notNull(manager, "BeanManager was null");

         AddonRepositoryProducer repositoryProducer = BeanManagerUtils.getContextualInstance(manager,
                  AddonRepositoryProducer.class);
         repositoryProducer.setRepository(addon.getRepository());
View Full Code Here


    private static final String NL = System.getProperty("line.separator");

    @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());
View Full Code Here

    private static final String NL = System.getProperty("line.separator");

    @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());
View Full Code Here

    private static final String NL = System.getProperty("line.separator");

    @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());
View Full Code Here

* Generates the JUnit test methods used to check that all the Showcase dashboard KPIs.
*/
public class ShowcaseKPITestsGenerator {

    public static void main(String[] args) throws Exception {
        WeldContainer container = new Weld().initialize();
        CDIBeanLocator.beanManager = container.getBeanManager();
        CodeBlockTrace.RUNTIME_CONTRAINTS_ENABLED = false;

        File rootDir = MavenProjectHelper.getModuleDir("dashboard-samples");
        File webAppDir = new File(rootDir, "src/main/webapp");
        Application.lookup().setBaseAppDirectory(webAppDir.getAbsolutePath());
View Full Code Here

    }

    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();
    }
View Full Code Here

    @Test
    public void testCDI() {
        // DROOLS-34
        Weld w = new Weld();
        WeldContainer wc = w.initialize();

        CDIBean bean = wc.instance().select(CDIBean.class).get();
        bean.test(env);

        w.shutdown();
    }
View Full Code Here

  @Test
  public void shouldCheckNumberIsMock() {

    Weld weld = new Weld();
    WeldContainer container = weld.initialize();

    BookService bookService = container.instance().select(BookService.class).get();

    Book book = bookService.createBook("H2G2", 12.5f, "Geeky scifi Book");

    assertTrue(book.getNumber().startsWith("MOCK"));
View Full Code Here

public class Main {

  public static void main(String[] args) {

    Weld weld = new Weld();
    WeldContainer container = weld.initialize();

    BookService bookService = container.instance().select(BookService.class).get();

    Book book = bookService.createBook("H2G2", 12.5f, "Geeky scifi Book");

    System.out.println(book);
View Full Code Here

                                                 "org.drools.compiler.cdi.test.KProjectTestClassjar1",
                                                 "org.drools.compiler.cdi.test.KProjectTestClassjar2",
                                                 "org.drools.compiler.cdi.test.KProjectTestClassjar3",
                                                 "org.drools.compiler.cdi.test.KProjectTestClassfol4");
            ((KieServicesImpl) KieServices.Factory.get()).nullKieClasspathContainer();
            WeldContainer container = weld.initialize();           
           
            Set<Bean< ? >> beans = container.getBeanManager().getBeans( KProjectTestClass.class, new KPTestLiteral( "jar1" ) );
            Bean bean = (Bean) beans.toArray()[0];
            KProjectTestClass o1 = (KProjectTestClass) bean.create( container.getBeanManager().createCreationalContext( null ) );
            assertNotNull( o1 );           
            testEntry(o1, "jar1");
           
            beans = container.getBeanManager().getBeans( KProjectTestClass.class, new KPTestLiteral( "jar2" ) );
            bean = (Bean) beans.toArray()[0];
            KProjectTestClass o2 = (KProjectTestClass) bean.create( container.getBeanManager().createCreationalContext( null ) );
            assertNotNull( o2 );           
            testEntry(o2, "jar2");
           
            beans = container.getBeanManager().getBeans( KProjectTestClass.class, new KPTestLiteral( "jar3" ) );
            bean = (Bean) beans.toArray()[0];
            KProjectTestClass o3 = (KProjectTestClass) bean.create( container.getBeanManager().createCreationalContext( null ) );
            assertNotNull( o3 );           
            testEntry(o3, "jar3");

            beans = container.getBeanManager().getBeans( KProjectTestClass.class, new KPTestLiteral( "fol4" ) );
            bean = (Bean) beans.toArray()[0];
            KProjectTestClass o4 = (KProjectTestClass) bean.create( container.getBeanManager().createCreationalContext( null ) );
            assertNotNull( o4 );           
            testEntry(o4, "fol4");
           
            weld.shutdown();
        } finally {
View Full Code Here

TOP

Related Classes of org.jboss.weld.environment.se.WeldContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.