assertEquals(0, tmpNode.getChildNodes().getLength());
}
for (int k = 0, nArgCount = event.getArgumentCount(); k < nArgCount; ++k) // for each arg
{
Argument arg = event.getArgument(k);
QName type = XML.getQualifiedType(
arg.getType(), event.isVarArg() && arg.isCollection() && k == nArgCount - 1);
int nAttrCount = 2;
tmpNode = XMLUtil.findChildElementByName(node, arg.getName());
assertNotNull(tmpNode);
assertEquals(type.getPrefix() + ':' + type.getLocalPart(),
XMLUtil.getStringAttr(tmpNode, "type"));
if (!arg.isRequired())
{
assertEquals("0", XMLUtil.getStringAttr(tmpNode, "minOccurs"));
++nAttrCount;
}
if (arg.isCollection())
{
assertEquals("unbounded", XMLUtil.getStringAttr(tmpNode, "maxOccurs"));
++nAttrCount;
}
assertEquals(nAttrCount, tmpNode.getAttributes().getLength());
assertEquals(0, tmpNode.getChildNodes().getLength());
}
Argument result = event.getResult();
boolean bTyped = result != null;
QName type = XML.getQualifiedType((bTyped) ? result.getType() : Primitive.ANY);
int nAttrCount = 1;
element = XMLUtil.findChildElementByName(schema, sEvent + "_Response"); // response
assertNotNull(element);
if (bTyped && result.isCollection() && !result.isRequired())
{
assertEquals("true", XMLUtil.getStringAttr(element, "nillable"));
++nAttrCount;
}
assertEquals(nAttrCount, element.getAttributes().getLength());
assertEquals(1, element.getChildNodes().getLength());
node = element.getFirstChild();
assertEquals("complexType", node.getNodeName());
assertEquals(0, node.getAttributes().getLength());
assertEquals(1, node.getChildNodes().getLength());
node = node.getFirstChild();
assertEquals("sequence", node.getNodeName());
assertEquals(0, node.getAttributes().getLength());
assertEquals(1, node.getChildNodes().getLength());
node = node.getFirstChild();
nAttrCount = 2;
assertEquals("element", node.getNodeName());
assertEquals("item", XMLUtil.getStringAttr(node, "name"));
assertEquals(type.getPrefix() + ':' + type.getLocalPart(),
XMLUtil.getStringAttr(node, "type"));
if (!bTyped || result.isCollection())
{
assertEquals("true", XMLUtil.getStringAttr(node, "nillable"));
++nAttrCount;
}
if (bTyped && result.isCollection())
{
assertEquals("0", XMLUtil.getStringAttr(node, "minOccurs"));
assertEquals("unbounded", XMLUtil.getStringAttr(node, "maxOccurs"));
nAttrCount += 2;
}