assertEquals(2, nullCount);
ByteArrayOutputStream pout = new ByteArrayOutputStream();
dcbRoot.toXML(pout);
pout.close();
ByteArrayInputStream pin = new ByteArrayInputStream(pout.toByteArray());
GerConnectorDocument doc = GerConnectorDocument.Factory.parse(pin);
pin.close();
GerConfigPropertySettingType[] settings = doc.getConnector().getResourceadapterArray(0).
getOutboundResourceadapter().getConnectionDefinitionArray(0).
getConnectiondefinitionInstanceArray(0).getConfigPropertySettingArray();
assertEquals(2, settings.length);
Set seen = new HashSet();
for (int i = 0; i < settings.length; i++) {
GerConfigPropertySettingType setting = settings[i];
if(seen.contains(setting.getName())) {
fail("Duplicate for config property setting '"+setting.getName()+"'");
}
seen.add(setting.getName());
// These two are set to their defaults and now no longer appear
// if(setting.getName().equals("CommitBeforeAutocommit")) {
// assertEquals("false", setting.getStringValue());
// } else if(setting.getName().equals("ExceptionSorterClass")) {
// assertEquals("org.tranql.connector.AllExceptionsAreFatalSorter", setting.getStringValue());
if(setting.getName().equals("Driver")) {
assertEquals("org.apache.derby.jdbc.EmbeddedDriver", setting.getStringValue());
} else if(setting.getName().equals("ConnectionURL")) {
assertEquals("jdbc:derby:TestDatabase;create=true", setting.getStringValue());
} else fail("Unknown connection setting '"+setting.getName()+"'");
}
// Make sure the original objects didn't lose track of the null config settings
assertEquals(6, instance.getConfigPropertySetting().length);
// Now set them to blank
nullCount = 0;
for (int i = 0; i < 6; i++) {
if(instance.getConfigPropertySetting()[i].getValue() == null || instance.getConfigPropertySetting()[i].isSetToDefault()) {
instance.getConfigPropertySetting()[i].setValue("");
++nullCount;
}
}
assertEquals(4, nullCount);
// Now make sure we write out with 6
pout = new ByteArrayOutputStream();
dcbRoot.toXML(pout);
pout.close();
pin = new ByteArrayInputStream(pout.toByteArray());
doc = GerConnectorDocument.Factory.parse(pin);
pin.close();
settings = doc.getConnector().getResourceadapterArray(0).
getOutboundResourceadapter().getConnectionDefinitionArray(0).
getConnectiondefinitionInstanceArray(0).getConfigPropertySettingArray();
assertEquals(6, settings.length);
seen.clear();
for (int i = 0; i < settings.length; i++) {