DConfigBeanRoot root = rarConfiguration.getDConfigBeanRoot(ddroot);
assertNotNull(root);
//resource adapter
DDBean resourceAdapterdd = ddroot.getChildBean(root.getXpaths()[0])[0];
ResourceAdapterDConfigBean resourceAdapterDConfigBean = (ResourceAdapterDConfigBean) root.getDConfigBean(resourceAdapterdd);
assertNotNull(resourceAdapterDConfigBean);
resourceAdapterDConfigBean.setResourceAdapterName("TestRAName");
DDBean[] resourceAdapterProperties = resourceAdapterdd.getChildBean(resourceAdapterDConfigBean.getXpaths()[0]);
assertEquals(1, resourceAdapterProperties.length);
ConfigPropertySettingDConfigBean resourceAdapterSetting = (ConfigPropertySettingDConfigBean)resourceAdapterDConfigBean.getDConfigBean(resourceAdapterProperties[0]);
assertNotNull(resourceAdapterSetting);
assertEquals("StringValue", resourceAdapterSetting.getConfigPropertyValue());
resourceAdapterSetting.setConfigPropertyValue("TestRAValue");
// //admin objects
// DDBean[] adminObjectdds = resourceAdapterdd.getChildBean(resourceAdapterDConfigBean.getXpaths()[2]);
// assertEquals(1, adminObjectdds.length);
// AdminObjectDConfigBean adminObjectDConfigBean = (AdminObjectDConfigBean)resourceAdapterDConfigBean.getDConfigBean(adminObjectdds[0]);
// assertNotNull(adminObjectDConfigBean);
// AdminObjectInstance adminObjectInstance1 = new AdminObjectInstance();
// adminObjectDConfigBean.setAdminObjectInstance(new AdminObjectInstance[] {adminObjectInstance1});
// ConfigPropertySettings adminObjectSetting1 = adminObjectInstance1.getConfigProperty()[0];
// adminObjectSetting1.setConfigPropertyValue("TestAOValue1");
//
// //add a second admin object in first position
// AdminObjectInstance adminObjectInstance2 = new AdminObjectInstance();
// adminObjectDConfigBean.setAdminObjectInstance(new AdminObjectInstance[] {adminObjectInstance2, adminObjectInstance1});
// ConfigPropertySettings adminObjectSetting2 = adminObjectInstance2.getConfigProperty()[0];
// adminObjectSetting2.setConfigPropertyValue("TestAOValue2");
//outbound
DDBean[] connectionDefinitiondds = resourceAdapterdd.getChildBean(resourceAdapterDConfigBean.getXpaths()[1]);
assertEquals(2, connectionDefinitiondds.length);
ConnectionDefinitionDConfigBean connectionDefinitionDConfigBean = (ConnectionDefinitionDConfigBean)resourceAdapterDConfigBean.getDConfigBean(connectionDefinitiondds[0]);
assertNotNull(connectionDefinitionDConfigBean);
ConnectionDefinitionInstance connectionDefinitionInstance1 = new ConnectionDefinitionInstance();
connectionDefinitionDConfigBean.setConnectionDefinitionInstance(new ConnectionDefinitionInstance[] {connectionDefinitionInstance1});
DDBean[] connectionDefinitionConfigPropDDs = connectionDefinitiondds[0].getChildBean("config-property");
assertEquals(4, connectionDefinitionConfigPropDDs.length);
ConfigPropertySettings connectionDefinitionSetting1 = connectionDefinitionInstance1.getConfigProperty()[0];
connectionDefinitionSetting1.setConfigPropertyValue("TestCDValue1");
//connection manager properties
// connectionDefinitionInstance1.setBlockingTimeout(3000);
//check the results
ByteArrayOutputStream baos = new ByteArrayOutputStream();
rarConfiguration.save(baos);
baos.flush();
byte[] bytes = baos.toByteArray();
baos.close();
InputStream is = new ByteArrayInputStream(bytes);
GerConnectorDocument gcDoc = GerConnectorDocument.Factory.parse(is);
GerResourceadapterType ra = gcDoc.getConnector().getResourceadapterArray()[0];
GerResourceadapterInstanceType rai = ra.getResourceadapterInstance();
assertEquals("TestRAName", rai.getResourceadapterName());
GerConfigPropertySettingType rasetting = rai.getConfigPropertySettingArray(0);
assertEquals("TestRAValue", rasetting.getStringValue());
//admin object
// GerAdminobjectType adminobjectType1 = ra.getAdminobjectArray(0);
// GerAdminobjectInstanceType adminobjectInstanceType2 = adminobjectType1.getAdminobjectInstanceArray(0);
// assertEquals("TestAOValue1", adminobjectInstanceType2.getConfigPropertySettingArray(0).getStringValue());
// GerAdminobjectInstanceType adminobjectInstanceType1 = adminobjectType1.getAdminobjectInstanceArray(1);
// assertEquals("TestAOValue2", adminobjectInstanceType1.getConfigPropertySettingArray(0).getStringValue());
//connection definition
GerConnectionDefinitionType connectionDefinitionType = ra.getOutboundResourceadapter().getConnectionDefinitionArray(0);
GerConnectiondefinitionInstanceType connectiondefinitionInstanceType = connectionDefinitionType.getConnectiondefinitionInstanceArray(0);
assertEquals("TestCDValue1", connectiondefinitionInstanceType.getConfigPropertySettingArray(0).getStringValue());
//connection manager
GerConnectionmanagerType connectionmanagerType = connectiondefinitionInstanceType.getConnectionmanager();
// assertEquals(3000, connectionmanagerType.getBlockingTimeout().intValue());
//and read back into dconfigbeans
rarConfiguration.restore(new ByteArrayInputStream(bytes));
//resource adapter
resourceAdapterDConfigBean = (ResourceAdapterDConfigBean) root.getDConfigBean(resourceAdapterdd);
assertNotNull(resourceAdapterDConfigBean);
assertEquals("TestRAName", resourceAdapterDConfigBean.getResourceAdapterName());
resourceAdapterSetting = (ConfigPropertySettingDConfigBean)resourceAdapterDConfigBean.getDConfigBean(resourceAdapterProperties[0]);
assertNotNull(resourceAdapterSetting);
assertEquals("TestRAValue", resourceAdapterSetting.getConfigPropertyValue());
// //admin objects
// adminObjectDConfigBean = (AdminObjectDConfigBean)resourceAdapterDConfigBean.getDConfigBean(adminObjectdds[0]);
// assertNotNull(adminObjectDConfigBean);
// AdminObjectInstance[] adminObjectInstances = adminObjectDConfigBean.getAdminObjectInstance();
// assertEquals(2, adminObjectInstances.length);
// adminObjectSetting1 = adminObjectInstances[1].getConfigProperty()[0];
// assertEquals("TestAOValue2", adminObjectSetting1.getConfigPropertyValue());
//
// //second admin object is in first position ..not any longer:-(((
// adminObjectSetting2 = adminObjectInstances[0].getConfigProperty()[0];
// assertEquals("TestAOValue1", adminObjectSetting2.getConfigPropertyValue());
//outbound
connectionDefinitionDConfigBean = (ConnectionDefinitionDConfigBean)resourceAdapterDConfigBean.getDConfigBean(connectionDefinitiondds[0]);
assertNotNull(connectionDefinitionDConfigBean);
ConnectionDefinitionInstance[] connectionDefinitionInstances = connectionDefinitionDConfigBean.getConnectionDefinitionInstance();
connectionDefinitionSetting1 = connectionDefinitionInstances[0].getConfigProperty()[0];
assertEquals("TestCDValue1", connectionDefinitionSetting1.getConfigPropertyValue());
//connection manager