Package org.jboss.weld.environment.se

Examples of org.jboss.weld.environment.se.WeldContainer.instance()


        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


        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

        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

    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

    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

  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 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

    // All the components initialization and wiring is done here
    WeldContainer container = weld.initialize();
   
    // Get application instance
    // This instance will be initialized with all required components
    MyApplication app = container.instance().select(MyApplication.class).get();
   
    // Do your things
    app.doSomething();
   
    // Close container
View Full Code Here

    public void testBootstrapNotNeeded() throws Exception {

        // First boostrap Weld SE
        Weld weld = new Weld();
        WeldContainer container = weld.initialize();
        TestBean testBean = container.instance().select(TestBean.class).get();
        assertNotNull(testBean);

        // Then start Jetty
        Server server = new Server(InetSocketAddress.createUnresolved("localhost", 8080));
        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
View Full Code Here

    @Test
    public void testSingletonBeanLifecycle() {
        Weld weld = new Weld();
        WeldContainer container = weld.initialize();
        assertEquals("bar", container.instance().select(Translator.class).get().translate("hello"));
        assertTrue(Translator.isInitCallbackInvoked);
        assertTrue(Dictionary.isInitCallbackInvoked);
        weld.shutdown();
        assertTrue(Translator.isDestroyCallbackInvoked);
        assertTrue(Dictionary.isDestroyCallbackInvoked);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.