try
{
deployPackage(deploymentName);
ManagementView mgtView = getManagementView();
ManagedDeployment md = mgtView.getDeployment(deploymentName);
assertNotNull("Null managed deployment.", md);
ManagedComponent mc = md.getComponent("ProfileServiceTestDS");
assertNotNull("Null managed component", mc);
// This should work too
ManagedComponent comp = getManagedComponent(mgtView, "ProfileServiceTestDS");
assertNotNull(comp);
ManagedProperty jndiName = mc.getProperty("jndi-name");
// assert
assertEquals(jndiName.getValue(), SimpleValueSupport.wrap("ProfileServiceTestDS"));
// change value
jndiName.setValue(SimpleValueSupport.wrap("ChangedDsJNDIName"));
ManagedProperty property = mc.getProperty("prepared-statement-cache-size");
// assert
assertEquals("prepared-statement-cache-size: "+ property.getValue(), SimpleValueSupport.wrap(32), property.getValue());
// change value
property.setValue(SimpleValueSupport.wrap(34));
property = mc.getProperty("max-pool-size");
property.setValue(SimpleValueSupport.wrap(34));
ManagedProperty configProps = mc.getProperty("connection-properties");
assertNotNull(configProps);
CompositeValue collection = (CompositeValue) configProps.getValue();
configProps.setValue(collection);
// update component
mgtView.updateComponent(mc);
// See if the changes are reflected in the managedView after a reload
mgtView = getManagementView();
ManagedDeployment md2 = mgtView.getDeployment(deploymentName);
assertNotNull(md2);
ManagedComponent mc2 = md2.getComponent("ChangedDsJNDIName");
assertNotNull(mc2);