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());