}
public void testResolveAndValidateDependencies() throws Exception {
try {
// dependencies 1-4 are for the resource bindings created in setUp()
ExternalResourceDependency dep1 = new ExternalResourceDependency_impl();
dep1.setKey("myDataKey");
ExternalResourceDependency dep2 = new ExternalResourceDependency_impl();
dep2.setKey("myLanguageResourceKey");
ExternalResourceDependency dep3 = new ExternalResourceDependency_impl();
dep3.setKey("myCustomObjectKey");
dep3.setInterfaceName(TestResourceInterface.class.getName());
ExternalResourceDependency dep4 = new ExternalResourceDependency_impl();
dep4.setKey("myLanguageResourceObjectKey");
dep4.setInterfaceName(TestResourceInterface.class.getName());
// dependency 5 is an unbound but optional resource
ExternalResourceDependency dep5 = new ExternalResourceDependency_impl();
dep5.setKey("nonExsitentResource");
dep5.setOptional(true);
// dependency 6 is resolvable in the classpath
ExternalResourceDependency dep6 = new ExternalResourceDependency_impl();
dep6.setKey("org/apache/uima/resource/impl/ResourceInClasspath.txt");
mManager.resolveAndValidateResourceDependencies(new ExternalResourceDependency[] { dep1,
dep2, dep3, dep4, dep5, dep6 }, TEST_CONTEXT_NAME);
// at this point we should be able to look up dep6
Object r = mManager.getResource(TEST_CONTEXT_NAME + dep6.getKey());
assertTrue(r instanceof DataResource);
assertTrue(((DataResource) r).getUrl().toString().endsWith(dep6.getKey()));
} catch (Exception e) {
JUnitExtension.handleException(e);
}
}