/** Test the handler, returning the handler. */
private SetConnectorConfigHandler doTest(String xmlBody) throws Exception {
LOGGER.info("xmlBody: " + xmlBody);
String name = connectorName;
Configuration origConfig = null;
if (update) {
origConfig = manager.getConnectorConfiguration(connectorName);
} else {
// GSA 5.2 wants connectorNames to be lower case. The handler
// will lowercase for us, but only on new connectors; not on update.
name = name.toLowerCase();
}
SetConnectorConfigHandler hdl = new SetConnectorConfigHandler(
xmlBody, manager);
LOGGER.info("ConnectorName: " + hdl.getConnectorName() +
" this: " + connectorName);
LOGGER.info("ConnectorType: " + hdl.getConnectorType() +
" this: " + connectorType);
if (hdl.getStatus().isSuccess()) {
assertEquals(language, hdl.getLanguage());
assertEquals(name, hdl.getConnectorName());
assertEquals(connectorType, hdl.getConnectorType());
assertEquals(update, hdl.isUpdate());
assertEquals(configData, hdl.getConfigData());
Configuration config = manager.getConnectorConfiguration(name);
assertNotNull(config);
assertEquals(connectorType, config.getTypeName());
assertEquals(configData, config.getMap());
if (configXml != null) {
assertEquals(configXml, config.getXml());
assertEquals(configXml, hdl.getConfigXml());
} else if (origConfig != null) {
assertEquals(origConfig.getXml(), config.getXml());
} else {
assertEquals(manager.getConnectorInstancePrototype(connectorType),
config.getXml());
}
}
return hdl;
}