Package org.jboss.beans.metadata.spi.factory

Examples of org.jboss.beans.metadata.spi.factory.BeanFactory


         bean = getBean("BeanConfiguredClassLoader");
         assertEquals(beanCL, getClassLoader(bean.getClass()));
         bean = getBean("NotConfiguredClassLoader");
         assertEquals(getClassLoader(getClass()), getClassLoader(bean.getClass()));
        
         BeanFactory factory = (BeanFactory) getBean("FactoryDeploymentConfiguredClassLoader");
         bean = factory.createBean();
         assertEquals(deploymentCL, getClassLoader(bean.getClass()));
         factory = (BeanFactory) getBean("FactoryBeanConfiguredClassLoader");
         bean = factory.createBean();
         assertEquals(beanCL, getClassLoader(bean.getClass()));
         factory = (BeanFactory) getBean("FactoryNotConfiguredClassLoader");
         bean = factory.createBean();
         assertEquals(getClassLoader(getClass()), getClassLoader(bean.getClass()));
      }
      finally
      {
         undeploy(deployment);
View Full Code Here


      super(name);
   }

   public void testGenericBeanFactoryLifecycle() throws Throwable
   {
      BeanFactory factory = (BeanFactory) getBean("Name1");
      SimpleBeanWithLifecycle bean = (SimpleBeanWithLifecycle) factory.createBean();
      assertTrue(bean.createInvoked);
      assertTrue(bean.startInvoked);
      assertFalse(bean.notCreateInvoked);
      assertFalse(bean.notStartInvoked);
      factory = (BeanFactory) getBean("Name2");
      bean = (SimpleBeanWithLifecycle) factory.createBean();
      assertFalse(bean.createInvoked);
      assertFalse(bean.startInvoked);
      assertTrue(bean.notCreateInvoked);
      assertTrue(bean.notStartInvoked);
   }
View Full Code Here

      super(name);
   }

   public void testContextualInjection() throws Throwable
   {
      BeanFactory bf = assertBean("FirstBean", BeanFactory.class);
      FirstBean2 bean = (FirstBean2)bf.createBean();
      assertNotNull(bean.getC());
      assertNotNull(bean.getTm());
   }
View Full Code Here

      assertEquals(123, bean2.getAnint());
   }

   public void testBeanFactoryFromBean() throws Throwable
   {
      BeanFactory factory = configureFromBean();
      assertFactory(factory);
   }
View Full Code Here

      return instantiate(factory);
   }

   public void testBeanFactoryFromFactory() throws Throwable
   {
      BeanFactory factory = configureFromFactory();
      assertFactory(factory);
   }
View Full Code Here

      return instantiate(factory);
   }

   public void testBeanFactoryFromStaticFactory() throws Throwable
   {
      BeanFactory factory = configureFromStaticFactory();
      assertFactory(factory);
   }
View Full Code Here

      return instantiate(factory);
   }

   public void testBeanFactoryWithNonExistingClass() throws Throwable
   {
      BeanFactory factory = configureFromIllegalClass();
      assertNotNull(factory);
      try
      {
         factory.createBean();
      }
      catch(Exception ex)
      {
         assertInstanceOf(ex, ClassNotFoundException.class);
      }
View Full Code Here

      return instantiate(factory);
   }

   public void testBeanFactoryDefinedFactoryClass() throws Throwable
   {
      BeanFactory factory = configureFromDefinedFactoryClass();
      assertNotNull(factory);
      assertInstanceOf(factory, MyBeanFactory.class);
      assertEquals("foobar", factory.createBean());
   }
View Full Code Here

      NameAwareBean nsb = (NameAwareBean)getBean(0, "set_name_bean");
      assertNotNull(nsb);
      assertEquals("set_name_bean", nsb.getName());

      BeanFactory nsf = (BeanFactory)getBean(1, "set_name_factory");
      assertNotNull(nsf);
      NameAwareBean b3 = (NameAwareBean)nsf.createBean();
      assertNotNull(b3);
      assertEquals("set_name_factory", b3.getName());
      NameAwareBean b4 = (NameAwareBean)nsf.createBean();
      assertNotNull(b4);
      assertEquals("set_name_factory", b4.getName());

      NameAwareBean alias = (NameAwareBean)getBean(2, "aliases");
      assertNotNull(alias);
View Full Code Here

      super(name);
   }

   public void testPrivilegedBean() throws Throwable
   {
      BeanFactory factory = assertBean("Factory", BeanFactory.class);
      Object object = factory.createBean();
     
      ClassLoader cl = assertBean("ClassLoader", ClassLoader.class);
      assertEquals(cl, object.getClass().getClassLoader());
   }
View Full Code Here

TOP

Related Classes of org.jboss.beans.metadata.spi.factory.BeanFactory

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.