Package org.jboss.test.xml.pojoserver.metadata

Examples of org.jboss.test.xml.pojoserver.metadata.AbstractBeanMetaData


      AbstractKernelDeployment deployment = unmarshal();

      assertNotNull(deployment);
      assertEquals(2, deployment.getBeans().size());

      AbstractBeanMetaData genericBeanFactory = (AbstractBeanMetaData)deployment.getBeans().get(0);
      assertNotNull(genericBeanFactory);
      assertEquals("GenericBeanFactory", genericBeanFactory.getName());
      assertEquals(GenericBeanFactory.class.getName(), genericBeanFactory.getBean());
      assertNotNull(genericBeanFactory.getProperties());
      assertEquals(3, genericBeanFactory.getProperties().size());

      AbstractPropertyMetaData beanProp = null;
      AbstractPropertyMetaData ctorProp = null;
      AbstractPropertyMetaData propsProp = null;

      for(Iterator i = genericBeanFactory.getProperties().iterator(); i.hasNext();)
      {
         AbstractPropertyMetaData prop = (AbstractPropertyMetaData)i.next();
         if("bean".equals(prop.getName()))
         {
            beanProp = prop;
         }
         else if("constructor".equals(prop.getName()))
         {
            ctorProp = prop;
         }
         else if("properties".equals(prop.getName()))
         {
            propsProp = prop;
         }
         else
         {
            fail("Unexpected property: " + prop.getName());
         }
      }

      assertEquals("bean", beanProp.getName());
      assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", beanProp.getValue().getUnderlyingValue());

      // todo validation of property/parameter
      assertEquals("constructor", ctorProp.getName());

      assertEquals("properties", propsProp.getName());
      AbstractMapMetaData beanProps = (AbstractMapMetaData) propsProp.getValue();
      assertNotNull(beanProps);
      assertEquals(1, beanProps.size());
      Map.Entry entry = (Map.Entry) beanProps.entrySet().iterator().next();
      AbstractValueMetaData otherKey = (AbstractValueMetaData) entry.getKey();
      assertNotNull(otherKey);
      assertEquals("other", otherKey.getValue());
      AbstractValueMetaData otherValue = (AbstractValueMetaData) entry.getValue();
      assertNotNull(otherValue);
      AbstractDependencyValueMetaData dependency = (AbstractDependencyValueMetaData)otherValue.getValue();
      assertNotNull(dependency);
      assertEquals("SimpleBean2", dependency.getValue());

      AbstractBeanMetaData simpleBean2 = (AbstractBeanMetaData)deployment.getBeans().get(1);
      assertEquals("SimpleBean2", simpleBean2.getName());
      assertEquals("org.jboss.test.kernel.xml.support.SimpleBeanImpl", simpleBean2.getBean());
      ConstructorMetaData ctor = simpleBean2.getConstructor();
      assertNotNull(ctor);
      assertNotNull(ctor.getParameters());
      assertEquals(1, ctor.getParameters().size());
      AbstractParameterMetaData param = (AbstractParameterMetaData)ctor.getParameters().get(0);
      assertEquals(String.class.getName(), param.getType());
View Full Code Here


      AbstractKernelDeployment deployment = unmarshal();

      assertNotNull(deployment.getBeans());
      assertEquals(2, deployment.getBeans().size());

      AbstractBeanMetaData bean = (AbstractBeanMetaData)deployment.getBeans().get(0);
      assertEquals("SimpleBean1", bean.getName());
      assertEquals("org.jboss.test.kernel.xml.support.SimpleBeanImpl", bean.getBean());
      assertNotNull(bean.getProperties());
      assertEquals(1, bean.getProperties().size());
      AbstractPropertyMetaData prop = (AbstractPropertyMetaData)bean.getProperties().iterator().next();
      assertNotNull(prop);
      assertEquals("other", prop.getName());
      assertTrue(prop.getValue() instanceof AbstractDependencyValueMetaData);
      AbstractDependencyValueMetaData dependency = (AbstractDependencyValueMetaData)prop.getValue();
      assertEquals("SimpleBean2", dependency.getValue());

      bean = (AbstractBeanMetaData)deployment.getBeans().get(1);
      assertEquals("SimpleBean2", bean.getName());
      assertEquals("org.jboss.test.kernel.xml.support.SimpleBeanImpl", bean.getBean());
      assertNotNull(bean.getConstructor());
      ConstructorMetaData ctor = bean.getConstructor();
      assertNotNull(ctor.getParameters());
      assertEquals(1, ctor.getParameters().size());
      AbstractParameterMetaData param = (AbstractParameterMetaData)ctor.getParameters().get(0);
      assertEquals("java.lang.String", param.getType());
      assertEquals("Bean2", param.getValue().getUnderlyingValue());
View Full Code Here

      AbstractKernelDeployment deployment = unmarshal();

      assertNotNull(deployment.getBeans());
      assertEquals(2, deployment.getBeans().size());

      AbstractBeanMetaData bean = (AbstractBeanMetaData)deployment.getBeans().get(0);
      assertEquals("SimpleBean1", bean.getName());
      assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean());
      assertNotNull(bean.getProperties());
      assertEquals(1, bean.getProperties().size());
      AbstractPropertyMetaData prop = (AbstractPropertyMetaData)bean.getProperties().iterator().next();
      assertNotNull(prop);
      assertEquals("other", prop.getName());
      assertTrue(prop.getValue() instanceof AbstractDependencyValueMetaData);
      AbstractDependencyValueMetaData dependency = (AbstractDependencyValueMetaData)prop.getValue();
      assertEquals("SimpleBean2", dependency.getValue());

      bean = (AbstractBeanMetaData)deployment.getBeans().get(1);
      assertEquals("SimpleBean2", bean.getName());
      assertEquals("org.jboss.test.kernel.xml.support.SimpleBeanImpl", bean.getBean());
      assertNotNull(bean.getConstructor());
      ConstructorMetaData ctor = bean.getConstructor();
      assertNotNull(ctor.getParameters());
      assertEquals(1, ctor.getParameters().size());
      AbstractParameterMetaData param = (AbstractParameterMetaData)ctor.getParameters().get(0);
      assertEquals("java.lang.String", param.getType());
      assertEquals("Bean2", param.getValue().getUnderlyingValue());
View Full Code Here

      AbstractKernelDeployment deployment = unmarshal();

      assertNotNull(deployment.getBeans());
      assertEquals(1, deployment.getBeans().size());

      AbstractBeanMetaData bean = (AbstractBeanMetaData)deployment.getBeans().get(0);
      assertEquals("SimpleBean1", bean.getName());
      assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean());
      assertNotNull(bean.getProperties());
      assertEquals(18, bean.getProperties().size());

      for(Iterator i = bean.getProperties().iterator(); i.hasNext();)
      {
         AbstractPropertyMetaData prop = (AbstractPropertyMetaData)i.next();
         String name = prop.getName();
         Object value = prop.getValue().getUnderlyingValue();
         assertConfigureProperty(name, value);
View Full Code Here

      AbstractKernelDeployment deployment = unmarshal();

      assertNotNull(deployment.getBeans());
      assertEquals(1, deployment.getBeans().size());

      AbstractBeanMetaData bean = (AbstractBeanMetaData)deployment.getBeans().get(0);
      assertEquals("SimpleBean1", bean.getName());
      assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean());
      assertNotNull(bean.getProperties());
      assertEquals(19, bean.getProperties().size());

      for(Iterator i = bean.getProperties().iterator(); i.hasNext();)
      {
         AbstractPropertyMetaData prop = (AbstractPropertyMetaData)i.next();
         String name = prop.getName();
         if("other".equals(name))
         {
View Full Code Here

      AbstractKernelDeployment deployment = unmarshal();

      assertNotNull(deployment.getBeans());
      assertEquals(2, deployment.getBeans().size());

      AbstractBeanMetaData bean = (AbstractBeanMetaData)deployment.getBeans().get(0);
      assertEquals("SimpleBean1", bean.getName());
      assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean());
      assertNotNull(bean.getConstructor());
      ConstructorMetaData ctor = bean.getConstructor();
      assertNotNull(ctor.getParameters());
      assertEquals(1, ctor.getParameters().size());
      Object obj = ctor.getParameters().get(0);
      assertNotNull(obj);
      assertTrue(obj instanceof AbstractParameterMetaData);
      AbstractParameterMetaData param = (AbstractParameterMetaData) obj;
      assertEquals("org.jboss.test.kernel.xml.support.SimpleBean", param.getType());
      assertTrue(param.getValue() instanceof AbstractDependencyValueMetaData);
      AbstractDependencyValueMetaData dependency = (AbstractDependencyValueMetaData)param.getValue();
      assertEquals("SimpleBean2", dependency.getValue());

      bean = (AbstractBeanMetaData)deployment.getBeans().get(1);
      assertEquals("SimpleBean2", bean.getName());
      assertEquals("org.jboss.test.kernel.xml.support.SimpleBeanImpl", bean.getBean());
   }
View Full Code Here

      assertNotNull(deployment);
      assertNotNull(deployment.getBeans());
      assertEquals(3, deployment.getBeans().size());

      AbstractBeanMetaData bean = (AbstractBeanMetaData)deployment.getBeans().get(0);
      assertEquals("SimpleBean1", bean.getName());
      assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean());
      assertNotNull(bean.getDemands());
      assertEquals(2, bean.getDemands().size());
      for(Iterator i = bean.getDemands().iterator(); i.hasNext();)
      {
         Object object = i.next();
         assertTrue(object instanceof AbstractDemandMetaData);
         AbstractDemandMetaData demand = (AbstractDemandMetaData) object;
         Object value = demand.getDemand();
         if(!"SimpleBean2".equals(value) && !"XYZZY".equals(value))
         {
            fail("expected SimpleBean2 or XYZZY but got " + value);
         }
      }

      bean = (AbstractBeanMetaData)deployment.getBeans().get(1);
      assertEquals("SimpleBean2", bean.getName());
      assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean());

      bean = (AbstractBeanMetaData)deployment.getBeans().get(2);
      assertEquals("SimpleBean3", bean.getName());
      assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean());
      assertNotNull(bean.getSupplies());
      assertEquals(1, bean.getSupplies().size());
      AbstractSupplyMetaData supply = (AbstractSupplyMetaData)bean.getSupplies().iterator().next();
      assertEquals("XYZZY", supply.getSupply());
   }
View Full Code Here

      assertNotNull(deployment);
      assertNotNull(deployment.getBeans());
      assertEquals(2, deployment.getBeans().size());

      AbstractBeanMetaData bean = (AbstractBeanMetaData)deployment.getBeans().get(0);
      assertEquals("SimpleBean1", bean.getName());
      assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean());
      assertNotNull(bean.getDemands());
      assertEquals(1, bean.getDemands().size());
      Object object = bean.getDemands().iterator().next();
      assertTrue(object instanceof AbstractDemandMetaData);
      AbstractDemandMetaData demand = (AbstractDemandMetaData) object;
      assertEquals("SimpleBean2", demand.getDemand());
      /** TODO assertEquals(ControllerState.LIFECYCLE, demand.getWhenRequired()); */

      bean = (AbstractBeanMetaData)deployment.getBeans().get(1);
      assertEquals("SimpleBean2", bean.getName());
      assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean());
      assertNotNull(bean.getConstructor());
      ConstructorMetaData ctor = bean.getConstructor();
      assertNotNull(ctor.getParameters());
      assertEquals(1, ctor.getParameters().size());
      AbstractParameterMetaData param = (AbstractParameterMetaData)ctor.getParameters().get(0);
      assertEquals("java.lang.String", param.getType());
      assertEquals("whenRequired", param.getValue().getUnderlyingValue());
View Full Code Here

      assertNotNull(deployment);
      assertNotNull(deployment.getBeans());
      assertEquals(3, deployment.getBeans().size());

      AbstractBeanMetaData bean = (AbstractBeanMetaData)deployment.getBeans().get(0);
      assertEquals("SimpleBean1", bean.getName());
      assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean());
      assertNotNull(bean.getConstructor());
      ConstructorMetaData ctor = bean.getConstructor();
      assertEquals("createSimpleBean", ctor.getFactoryMethod());
      assertNotNull(ctor.getFactory());
      assertEquals("SimpleBeanFactory", ctor.getFactory().getUnderlyingValue());
      assertNotNull(ctor.getParameters());
      assertEquals(1, ctor.getParameters().size());
      AbstractParameterMetaData param = (AbstractParameterMetaData)ctor.getParameters().get(0);
      assertEquals("org.jboss.test.xml.pojoserver.SimpleBean", param.getType());
      assertTrue(param.getValue() instanceof AbstractDependencyValueMetaData);
      AbstractDependencyValueMetaData dependency = (AbstractDependencyValueMetaData)param.getValue();
      assertEquals("SimpleBean2", dependency.getValue());

      bean = (AbstractBeanMetaData)deployment.getBeans().get(1);
      assertEquals("SimpleBean2", bean.getName());
      assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean());

      bean = (AbstractBeanMetaData)deployment.getBeans().get(2);
      assertEquals("SimpleBeanFactory", bean.getName());
      assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanFactory", bean.getBean());
   }
View Full Code Here

      AbstractKernelDeployment deployment = unmarshal();

      assertNotNull(deployment);
      assertNotNull(deployment.getBeans());
      assertEquals(1, deployment.getBeans().size());
      AbstractBeanMetaData bean = (AbstractBeanMetaData)deployment.getBeans().get(0);
      assertEquals("SimpleBean1", bean.getName());
      assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean());

      assertNotNull(bean.getProperties());
      assertEquals(4, bean.getProperties().size());

      for(Iterator i = bean.getProperties().iterator(); i.hasNext();)
      {
         AbstractPropertyMetaData prop = (AbstractPropertyMetaData)i.next();
         String name = prop.getName();
         if("aList".equals(name))
         {
View Full Code Here

TOP

Related Classes of org.jboss.test.xml.pojoserver.metadata.AbstractBeanMetaData

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.