Examples of WeldContainer


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

     * Test of main method, of class StartMain when no command-line args are
     * provided.
     */
    @Test
    public void testMainEmptyArgs() {
        WeldContainer container = startMain.go();

        MainTestBean mainTestBean = container.instance().select(MainTestBean.class).get();
        assertNotNull(mainTestBean);

        ParametersTestBean paramsBean = mainTestBean.getParametersTestBean();
        assertNotNull(paramsBean);
        assertNotNull(paramsBean.getParameters());
View Full Code Here

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

     * the org.jboss.weld.environment.se.beans package are initialised as
     * expected.
     */
    @Test
    public void testMain() {
        WeldContainer container = startMain.go();

        MainTestBean mainTestBean = container.instance().select(MainTestBean.class).get();
        assertNotNull(mainTestBean);

        ParametersTestBean paramsBean = mainTestBean.getParametersTestBean();
        assertNotNull(paramsBean);
        assertNotNull(paramsBean.getParameters());
View Full Code Here

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

     */
    @Test
    public void testInitialize() {

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

        MainTestBean mainTestBean = container.instance().select(MainTestBean.class).get();
        assertNotNull(mainTestBean);

        ParametersTestBean paramsBean = mainTestBean.getParametersTestBean();
        assertNotNull(paramsBean);
        assertNotNull(paramsBean.getParameters());
View Full Code Here

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

        InitObserverTestBean.reset();
        ObserverTestBean.reset();

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

        container.event().select(CustomEvent.class).fire(new CustomEvent());

        assertTrue(ObserverTestBean.isBuiltInObserved());
        assertTrue(ObserverTestBean.isCustomObserved());
        assertTrue(ObserverTestBean.isInitializedObserved());
        assertFalse(ObserverTestBean.isDestroyedObserved());
View Full Code Here

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

         ContainerBeanRegistrant registrantExtension = new ContainerBeanRegistrant();

         weld = new ModularWeld(scanResult);
         weld.addExtension(serviceExtension);
         weld.addExtension(registrantExtension);
         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

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

*/
public final class SEArtifactFactory extends AbstractArtifactFactory {
    private final BeanManager beanManager;

    public SEArtifactFactory() {
        WeldContainer weldContainer = new Weld().initialize();
        beanManager = weldContainer.getBeanManager();
    }
View Full Code Here

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

               // FIXME this plugin loading scheme causes classloading issues w/weld because weld cannot load classes
               // from its own classloaders before plugins are loaded and pollute the classpath.
               // We can work around it by loading weld before we load plugins, then restarting weld, but this is SLOW.
               try
               {
                  WeldContainer container = weld.initialize();
                  manager = container.getBeanManager();
                  weld.shutdown();
               }
               catch (Exception e)
               {
               }

               try
               {
                  // TODO verify plugin API versions. only activate compatible plugins.
                  loadPlugins();
                  WeldContainer container = weld.initialize();
                  manager = container.getBeanManager();
               }
               catch (Throwable e)
               {
                  // Boot up with external plugins disabled.
                  System.out
                           .println("Plugin system disabled due to failure while loading one or more plugins; try removing offending plugins with \"forge remove-plugin <TAB>\".");
                  e.printStackTrace();

                  Thread.currentThread().setContextClassLoader(mainClassLoader);

                  initLogging();
                  WeldContainer container = weld.initialize();
                  manager = container.getBeanManager();
               }
               try
               {
                  manager.fireEvent(new PreStartup());
               }
View Full Code Here

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

    @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

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

    }

    public static void main(String[] args) {
        Weld w = new Weld();

        WeldContainer wc = w.initialize();
        CDIInstanceExample bean = wc.instance().select(CDIInstanceExample.class).get();
        bean.go(System.out);

        w.shutdown();
    }
View Full Code Here

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

  @Before
  public void setup() {
    // Start Weld - this initiates the CDI container
    weld = new Weld();
    WeldContainer container = weld.initialize();
    app = container.instance().select(CarServiceApp.class).get();
  }
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.