protected void runTest() throws Throwable {
OMXMLParserWrapper builder = metaFactory.createOMBuilder(metaFactory.getOMFactory(),
TEST_PARSER_CONFIGURATION, new InputSource(file.getUrl().toString()));
try {
OMContainer container = containerFactory.getContainer(builder);
// We need to clone the InputSource objects so that we can dump their contents
// if the test fails
InputSource control[] = duplicateInputSource(containerFactory.getControl(file.getAsStream()));
InputSource actual[] = duplicateInputSource(serializationMethod.serialize(container));
try {
// Configure the InputSources such that external entities can be resolved
String systemId = new URL(file.getUrl(), "dummy.xml").toString();
control[0].setSystemId(systemId);
actual[0].setSystemId(systemId);
XMLAssert.assertXMLIdentical(XMLUnit.compareXML(control[0], actual[0]), true);
} catch (Throwable ex) {
System.out.println("Control:");
dumpInputSource(control[1]);
System.out.println("Actual:");
dumpInputSource(actual[1]);
throw ex;
}
if (serializationMethod.isCaching()) {
assertTrue(container.isComplete());
} else {
// TODO: need to investigate why assertConsumed is not working here
assertFalse(container.isComplete());
// assertConsumed(element);
}
} finally {
builder.close();
}