Package org.jboss.test.kernel.deployment.support.container

Examples of org.jboss.test.kernel.deployment.support.container.Bean1Type


      getBean("BeanContainer1Type");
      BeanPool<Bean1Type> pool1 = (BeanPool<Bean1Type>) getBean("Bean1TypePool");
      BeanContainer<Bean2Type> container2 = (BeanContainer<Bean2Type>) getBean("BeanContainer2Type");
      Bean2Type bean21 = container2.getBean();
      getLog().debug("bean21: "+bean21);
      Bean1Type bean11 = bean21.getBean1();
      assertEquals(0, pool1.size());
      getLog().debug("bean11: "+bean11);
      assertNotNull(bean11);
      // Create another Bean2Type instance
      Bean2Type bean22 = container2.getBean();
      getLog().debug("bean22: "+bean22);
      assertTrue(bean22 != bean21);
      // The injected bean should not be the same as injected into bean21
      Bean1Type bean12 = bean22.getBean1();
      getLog().debug("bean12: "+bean12);
      assertNotNull(bean12);
      assertTrue(bean12 != bean11);

      // Create another bean 2 type, should fail
      Bean2Type bean23 = container2.getBean();
      getLog().debug("bean23: "+bean23);
      Bean1Type bean13Injected = bean23.getBean1();
      getLog().debug("bean13Injected: "+bean13Injected);
      assertNotNull(bean13Injected);
      deployer.shutdown();
   }
View Full Code Here


      assertNotNull(context);
      String contextName = contextInstance.getContextName();
      assertEquals("ComponentBeanFactory@ContextFactory#1", contextName);
      Object contextBean = getBean("ComponentBeanFactory@ContextFactory#1");
      assertTrue(contextBean == context);
      Bean1Type bean1 = (Bean1Type) getBean("ComponentBeanFactory@BeanInstance#1");
      assertTrue(bean1 == context.getInstance());
  
      Object interceptor = getBean("ComponentBeanFactory@Interceptor:0#1");
      assertNotNull(interceptor);
      List expectedInterceptors = new ArrayList();
      expectedInterceptors.add(interceptor);
      List interceptors = context.getInterceptors();
      assertEquals(interceptors, expectedInterceptors);

      factory.destroyComponents(contextInstance);
      expectedBeanNames.clear();
      expectedBeanNames.add("ComponentBeanFactory");
      // Only the ComponentBeanFactory should exist
      assertBeansExist(expectedBeanNames);
      contextInstance = null;

      // Create a second component instance
      ComponentInstance<BaseContext<Bean1Type, BeanContainer<Bean1Type>>> contextInstance2 =
         factory.createComponents("ComponentBeanFactory");
      // Validate the component bean names
      List<String> beanNames2 = contextInstance2.getComponentNames();
      getLog().info("createComponents(ComponentBeanFactory): "+beanNames2);
      expectedBeanNames = new HashSet<String>();
      expectedBeanNames.add("ComponentBeanFactory@ContextFactory#2");
      expectedBeanNames.add("ComponentBeanFactory@BeanInstance#2");
      expectedBeanNames.add("ComponentBeanFactory@Interceptor:0#2");
      assertEquals(expectedBeanNames, new HashSet<String>(beanNames2));
      compID = contextInstance2.getComponentID();
      assertEquals(2, compID);
      BaseContext<Bean1Type, BeanContainer<Bean1Type>> context2 = contextInstance2.getContext();
      assertNotNull(context2);
      String contextName2 = contextInstance2.getContextName();
      assertEquals("ComponentBeanFactory@ContextFactory#2", contextName2);
      Object contextBean2 = getBean("ComponentBeanFactory@ContextFactory#2");
      assertTrue(contextBean2 == context2);
      Bean1Type bean2 = (Bean1Type) getBean("ComponentBeanFactory@BeanInstance#2");
      assertTrue(bean2 == context2.getInstance());
      assertTrue(bean2 != bean1);
      Object interceptor2 = getBean("ComponentBeanFactory@Interceptor:0#2");
      assertNotNull(interceptor2);
View Full Code Here

TOP

Related Classes of org.jboss.test.kernel.deployment.support.container.Bean1Type

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.