}
}
public final Document load(String source) {
SourceResolver resolver = null;
SAXParser parser = null;
Source assertionsource = null;
Document assertiondocument = null;
try {
resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
assertNotNull("Test lookup of source resolver", resolver);
parser = (SAXParser) this.manager.lookup(SAXParser.ROLE);
assertNotNull("Test lookup of parser", parser);
assertNotNull("Test if assertion document is not null",
source);
assertionsource = resolver.resolveURI(source);
assertNotNull("Test lookup of assertion source",
assertionsource);
assertTrue("Test if source exist", assertionsource.exists());
DOMBuilder builder = new DOMBuilder();
assertNotNull("Test if inputstream of the assertion source is not null",
assertionsource.getInputStream());
parser.parse(new InputSource(assertionsource.getInputStream()),
new WhitespaceFilter(builder),
builder);
assertiondocument = builder.getDocument();
assertNotNull("Test if assertion document exists", assertiondocument);
} catch (ComponentException ce) {
getLogger().error("Could not retrieve generator", ce);
fail("Could not retrieve generator: " + ce.toString());
} catch (Exception e) {
getLogger().error("Could not execute test", e);
fail("Could not execute test: " + e);
} finally {
if (resolver != null) {
resolver.release(assertionsource);
}
this.manager.release(resolver);
this.manager.release((Component) parser);
}