{
enableTrace("org.jboss.managed.plugins.factory");
ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
TxInstanceClassFactory icf = new TxInstanceClassFactory();
mof.setInstanceClassFactory(TxConnectionFactoryDeploymentMetaData.class, icf);
TxConnectionFactoryDeploymentMetaData txcf = new TxConnectionFactoryDeploymentMetaData();
ManagedObject mo = mof.initManagedObject(txcf, "TxConnectionFactoryDeploymentMetaData", null);
// Validate the expected property names
Set<String> expectedPropertyNames = new TreeSet<String>();
expectedPropertyNames.addAll(Arrays.asList(ManagedConnectionFactoryDeploymentMetaData_NAMES));
expectedPropertyNames.addAll(Arrays.asList(TxConnectionFactoryDeploymentMetaData_NAMES));
Set<String> propertyNames = mo.getPropertyNames();
TreeSet<String> sortedPropertyNames = new TreeSet<String>(propertyNames);
if(expectedPropertyNames.equals(sortedPropertyNames) == false)
{
Set<String> missingNames = new TreeSet<String>();
Set<String> extraNames = new TreeSet<String>();
analyzeDiffs(expectedPropertyNames, sortedPropertyNames,
missingNames, extraNames);
fail("Extra properties: "+extraNames+", missing properties: "+missingNames);
}
ManagedProperty connectionProperties = mo.getProperty("config-property");
MetaType cpType = connectionProperties.getMetaType();
assertTrue("connection-properties.type="+cpType, cpType instanceof CompositeMetaType);
Object cpValue = connectionProperties.getValue();
assertTrue("connection-properties.value="+cpValue, cpValue instanceof CompositeValue);
CompositeValue cvalue = (CompositeValue) cpValue;
// Now update the values
MapCompositeValueSupport map = (MapCompositeValueSupport) cvalue;
// Test simple property types
ManagedProperty xatx = mo.getProperty("xa-transaction");
xatx.setValue(SimpleValueSupport.wrap(true));
assertEquals(Boolean.TRUE, txcf.getXATransaction());
ManagedProperty xart = mo.getProperty("xa-resource-timeout");
xart.setValue(SimpleValueSupport.wrap(12345));
assertEquals(12345, txcf.getXaResourceTimeout());
}