Package org.jboss.weld.environment.se

Examples of org.jboss.weld.environment.se.Weld.initialize()


               // 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) {}
View Full Code Here


               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
View Full Code Here

                  e.printStackTrace();

                  Thread.currentThread().setContextClassLoader(mainClassLoader);

                  initLogging();
                  WeldContainer container = weld.initialize();
                  manager = container.getBeanManager();
               }

               manager.fireEvent(new PreStartup());
               manager.fireEvent(new Startup(workingDir, restarting));
View Full Code Here

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

public class SingletonContextTest {

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

    @Test
    public void testContainerIsolation() {

        Weld weld1 = new Weld("1");
        WeldContainer weldContainer1 = weld1.initialize();
        Foo foo1 = weldContainer1.instance().select(Foo.class).get();

        Weld weld2 = new Weld("2");
        WeldContainer weldContainer2 = weld2.initialize();
        Foo foo2 = weldContainer2.instance().select(Foo.class).get();
View Full Code Here

        Weld weld1 = new Weld("1");
        WeldContainer weldContainer1 = weld1.initialize();
        Foo foo1 = weldContainer1.instance().select(Foo.class).get();

        Weld weld2 = new Weld("2");
        WeldContainer weldContainer2 = weld2.initialize();
        Foo foo2 = weldContainer2.instance().select(Foo.class).get();

        foo1.setValue(1);
        foo2.setValue(2);
View Full Code Here

public class SimpleInstanceTest {
    @Test
    public void testSelect() throws Exception {
        Weld weld = new Weld();
        try {
            WeldContainer wc = weld.initialize();
            Assert.assertNotNull(wc.instance().select(KPT.class).select(new KPQLiteral()).get());
            Assert.assertNotNull(wc.instance().select(KPT.class, new KPQLiteral()).get());
        } finally {
            weld.shutdown();
        }
View Full Code Here

    Weld weld = new Weld();
    try {

      Plant.postConstructCalled = false;
      WeldContainer weldContainer = weld.initialize();
      weldContainer.instance().select(Tree.class).get();
      assertTrue(Plant.postConstructCalled);

    } finally {
      weld.shutdown();
View Full Code Here

            }
            else
            {
               final Weld weld = new ModularWeld(scanResult);
               WeldContainer container;
               container = weld.initialize();

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

               AddonRepositoryProducer repositoryProducer = BeanManagerUtils.getContextualInstance(manager,
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.