*/
public final void testParseRequestWithIntegerParameters() {
XmlRpcInteger[] parameters = { new XmlRpcInteger(new Integer(54)),
new XmlRpcInteger(new Integer(438)) };
XmlRpcRequest expected = new XmlRpcRequest(this.serviceName,
this.methodName, parameters);
StringBuffer builder = new StringBuffer();
builder.append("<?xml version=\"1.0\"?>");
builder.append("<methodCall><methodName>");
builder.append(this.serviceAndMethodNames);
builder.append("</methodName><params>");
int parameterCount = parameters.length;
for (int i = 0; i < parameterCount; i++) {
XmlRpcInteger xmlRpcInteger = parameters[i];
Integer value = (Integer) xmlRpcInteger.getValue();
// even parameters will have "i4" as name, odd parameters will have "int"
// as name.
String elementName = (i % 2 == 0) ? "i4" : "int";
builder.append("<param><value><");
builder.append(elementName);
builder.append(">");
builder.append(value.toString());
builder.append("</");
builder.append(elementName);
builder.append("></value></param>");
}
builder.append("</params></methodCall>");
String request = builder.toString();
InputStream inputStream = new ByteArrayInputStream(request.getBytes());
XmlRpcRequest actual = this.parser.parseRequest(inputStream);
this.logger.info("XML-RPC request: " + request);
this.logger.info(actual);
assertEquals("<XML-RPC request>", expected, actual);