use of com.twinsoft.convertigo.beans.common.XMLVector in project convertigo by convertigo.
the class DefaultInternalTranslator method buildInputDocument.
public void buildInputDocument(Context context, Object inputData) throws Exception {
Engine.logContext.debug("Making input document");
Map<String, Object> request = GenericUtils.cast(inputData);
InputDocumentBuilder inputDocumentBuilder = new InputDocumentBuilder(context);
// Indicates whether variable values were generated using strict mode or nor(text/childs only)
inputDocumentBuilder.transactionVariablesElement.setAttribute("strictMode", Boolean.toString(bStrictMode));
for (Entry<String, Object> entry : request.entrySet()) {
String parameterName = entry.getKey();
Object parameterObject = entry.getValue();
if (!inputDocumentBuilder.handleSpecialParameter(parameterName, parameterObject)) {
if (parameterObject instanceof String[]) {
inputDocumentBuilder.addVariable(parameterName, (String[]) parameterObject);
} else {
addParameterObject(context.inputDocument, inputDocumentBuilder.transactionVariablesElement, parameterName, parameterObject);
}
}
}
TestCase tc = TestCase.getTestCase(request, context.projectName);
if (tc != null) {
for (TestCaseVariable var : tc.getVariables()) {
String parameterName = var.getName();
Object parameterObject = var.getValueOrNull();
if (!request.containsKey(parameterName) && !inputDocumentBuilder.handleSpecialParameter(parameterName, parameterObject)) {
if (parameterObject instanceof XMLVector) {
String[] strings = ((XMLVector<?>) parameterObject).toArray(new String[0]);
inputDocumentBuilder.addVariable(parameterName, strings);
} else {
addParameterObject(context.inputDocument, inputDocumentBuilder.transactionVariablesElement, parameterName, parameterObject);
}
}
}
}
Engine.logContext.info("Input document created");
}
Aggregations