* @param element
*/
private UnitTest parseUnitTest(String tagName, Element element, boolean strict, String encoding)
throws IOException, DocumentException
{
UnitTest unitTest = new UnitTest();
unitTest.setModelEncoding( encoding );
java.util.Set parsed = new java.util.HashSet();
for ( Iterator i = element.nodeIterator(); i.hasNext(); )
{
Node node = (Node) i.next();
if ( node.getNodeType() != Node.ELEMENT_NODE )
{
}
else
{
Element childElement = (Element) node;
if ( childElement.getName().equals( "resources" ) )
{
if ( parsed.contains( "resources" ) )
{
throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
}
parsed.add( "resources" );
java.util.List resources = new java.util.ArrayList();
unitTest.setResources( resources );
for ( Iterator j = childElement.nodeIterator(); j.hasNext(); )
{
Node n = (Node) j.next();
if ( n.getNodeType() != Node.ELEMENT_NODE )
{
}
else
{
Element listElement = (Element) n;
if ( listElement.getName().equals( "resource" ) )
{
resources.add( parseResource( "resource", listElement, strict, encoding ) );
}
else
{
}
}
}
}
else if ( childElement.getName().equals( "includes" ) )
{
if ( parsed.contains( "includes" ) )
{
throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
}
parsed.add( "includes" );
java.util.List includes = new java.util.ArrayList();
unitTest.setIncludes( includes );
for ( Iterator j = childElement.nodeIterator(); j.hasNext(); )
{
Node n = (Node) j.next();
if ( n.getNodeType() != Node.ELEMENT_NODE )
{
}
else
{
Element listElement = (Element) n;
if ( listElement.getName().equals( "include" ) )
{
includes.add( getTrimmedValue( listElement.getText() ) );
}
else
{
}
}
}
}
else if ( childElement.getName().equals( "excludes" ) )
{
if ( parsed.contains( "excludes" ) )
{
throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
}
parsed.add( "excludes" );
java.util.List excludes = new java.util.ArrayList();
unitTest.setExcludes( excludes );
for ( Iterator j = childElement.nodeIterator(); j.hasNext(); )
{
Node n = (Node) j.next();
if ( n.getNodeType() != Node.ELEMENT_NODE )
{