getMOF().addInstanceClassFactory(new ServiceMetaDataICF());
//
addComponentMapper(new TestMapper(getPersistenceFactory()));
// Initial parsing of the dataSource deployment
ManagedConnectionFactoryDeploymentGroup deployment = parseDataSource("profileservice/persistence/profileservice-test-ds.xml");
assertNotNull(deployment);
ManagedObject mo = getMOF().initManagedObject(deployment, null);
ManagedComponent c = createDSComponent(mo);
// Change values
c.getProperty("min-pool-size").setValue(SimpleValueSupport.wrap(13));
c.getProperty("max-pool-size").setValue(SimpleValueSupport.wrap(53));
PersistenceRoot root = updateComponent(mo, c);
assertNotNull(root);
// Recreate
deployment = parseDataSource("profileservice/persistence/profileservice-test-ds.xml");
// update the information
getPersistenceFactory().restorePersistenceRoot(root, deployment, null);
// Create the MO again
mo = getMOF().initManagedObject(deployment, null);
c = createDSComponent(mo);
assertEquals(SimpleValueSupport.wrap(13), c.getProperty("min-pool-size").getValue());
assertEquals(SimpleValueSupport.wrap(53), c.getProperty("max-pool-size").getValue());
// Assert the attachment
ManagedConnectionFactoryDeploymentGroup mcfdg = deployment;
assertNotNull(mcfdg);
// Assert services
assertServices(mcfdg.getServices());
// Assert deployments
assertDeployments(mcfdg.getDeployments());
// TODO Assert loader repository
assertNotNull(mcfdg.getLoaderRepositoryConfig());
}