assertNotNull("beanFactories MP", beanFactoriesMP);
Object beanFactoriesMPValue = beanFactoriesMP.getValue();
getLog().debug("beanFactories MP value: "+beanFactoriesMPValue);
assertTrue(beanFactoriesMPValue instanceof CollectionValue);
// The beanFactories
CollectionValue cv = CollectionValue.class.cast(beanFactoriesMPValue);
MetaValue[] cvs = cv.getElements();
assertEquals(3, cv.getSize());
// ABeanMetaData ManagedObject for SimpleBean#1
MetaValue mv0 = cvs[0];
assertTrue(mv0 instanceof GenericValue);
GenericValue gv0 = GenericValue.class.cast(mv0);
Object gv0Value = gv0.getValue();
assertTrue(gv0Value instanceof ManagedObject);
ManagedObject mo0 = ManagedObject.class.cast(gv0Value);
assertEquals(bean1, mo0.getAttachment());
ManagedProperty bigDecimalValueMP = mo0.getProperty("bigDecimalValue");
assertNotNull(bigDecimalValueMP);
assertEquals(SimpleValueSupport.wrap(new BigDecimal(123456)), bigDecimalValueMP.getValue());
bigDecimalValueMP.setValue(SimpleValueSupport.wrap(new BigDecimal(987654)));
assertEquals(new BigDecimal(987654), simple1.getBigDecimalValue());
// ABeanMetaData ManagedObject for SimpleBean#2
MetaValue mv1 = cvs[1];
assertTrue(mv1 instanceof GenericValue);
GenericValue gv1 = GenericValue.class.cast(mv1);
Object gv1Value = gv1.getValue();
assertTrue(gv1Value instanceof ManagedObject);
ManagedObject mo1 = ManagedObject.class.cast(gv1Value);
ManagedProperty bigDecimalValueMP1 = mo1.getProperty("bigDecimalValue");
assertNotNull(bigDecimalValueMP1);
assertEquals(SimpleValueSupport.wrap(new BigDecimal(222222)), bigDecimalValueMP1.getValue());
bigDecimalValueMP1.setValue(SimpleValueSupport.wrap(new BigDecimal(12222221)));
assertEquals(new BigDecimal(12222221), simple2.getBigDecimalValue());
// ABeanMetaData ManagedObject for SimpleUnannotated#3
MetaValue mv2 = cvs[2];
assertTrue(mv2 instanceof GenericValue);
GenericValue gv2 = GenericValue.class.cast(mv2);
Object gv2Value = gv2.getValue();
assertTrue(gv2Value instanceof ManagedObject);
ManagedObject mo2 = ManagedObject.class.cast(gv2Value);
ManagedProperty properties = mo2.getProperty("properties");
assertNotNull(properties);
assertTrue(properties.getMetaType().isCollection());
CollectionMetaType amt = (CollectionMetaType) properties.getMetaType();
MetaType etype = amt.getElementType();
if (etype == AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE)
{
CollectionValue avalue = (CollectionValue) properties.getValue();
assertNotNull(avalue);
MetaValue[] elements = avalue.getElements();
for(int n = 0; n < avalue.getSize(); n ++)
{
GenericValue gv = (GenericValue) elements[n];
ManagedObject propMO = (ManagedObject) gv.getValue();
//...
}