super.setUp();
mManager = new ResourceManager_impl();
mManager.setDataPath(TEST_DATAPATH_WITH_SPACES);
// initialize sample resources
ResourceManagerConfiguration cfg = new ResourceManagerConfiguration_impl();
// simple data resource
FileResourceSpecifier_impl spec = new FileResourceSpecifier_impl();
spec.setFileUrl(TEST_DATA_FILE.toURL().toString());
ExternalResourceDescription desc = new ExternalResourceDescription_impl();
desc.setName("myData");
desc.setResourceSpecifier(spec);
// data resource with custom interface and implementation class
ExternalResourceDescription desc2 = new ExternalResourceDescription_impl();
desc2.setName("myCustomObject");
desc2.setResourceSpecifier(spec);
desc2.setImplementationName(TestResourceInterface_impl.class.getName());
// parameterized (language-based) resource
FileLanguageResourceSpecifier langSpec = new FileLanguageResourceSpecifier_impl();
File baseDir = JUnitExtension.getFile("ResourceTest");
langSpec.setFileUrlPrefix(new File(baseDir, "FileLanguageResource_implTest_data_").toURL()
.toString());
langSpec.setFileUrlSuffix(".dat");
ExternalResourceDescription desc3 = new ExternalResourceDescription_impl();
desc3.setName("myLanguageResource");
desc3.setResourceSpecifier(langSpec);
// parameterized resource with custom impl class
ExternalResourceDescription desc4 = new ExternalResourceDescription_impl();
desc4.setName("myLanguageResourceObject");
desc4.setResourceSpecifier(langSpec);
desc4.setImplementationName(TestResourceInterface_impl.class.getName());
// resource path with space in it (tests proper URL encoding of spaces)
FileResourceSpecifier_impl spec2 = new FileResourceSpecifier_impl();
spec2.setFileUrl(TEST_FILE_IN_DATAPATH);
ExternalResourceDescription desc5 = new ExternalResourceDescription_impl();
desc5.setName("myResourceWithSpaceInPath");
desc5.setResourceSpecifier(spec2);
// resource path as filename instead of URL
ExternalResourceDescription desc6 = new ExternalResourceDescription_impl();
FileResourceSpecifier_impl fileSpec = new FileResourceSpecifier_impl();
fileSpec.setFileUrl(TEST_DATA_FILE.getAbsolutePath());
desc6.setResourceSpecifier(fileSpec);
desc6.setName("myResourceWithFilePathNotUrl");
cfg.setExternalResources(new ExternalResourceDescription[] { desc, desc2, desc3, desc4,
desc5, desc6 });
// define bindings
ExternalResourceBinding binding1 = new ExternalResourceBinding_impl();
binding1.setKey("myDataKey");
binding1.setResourceName("myData");
ExternalResourceBinding binding2 = new ExternalResourceBinding_impl();
binding2.setKey("myCustomObjectKey");
binding2.setResourceName("myCustomObject");
ExternalResourceBinding binding3 = new ExternalResourceBinding_impl();
binding3.setKey("myLanguageResourceKey");
binding3.setResourceName("myLanguageResource");
ExternalResourceBinding binding4 = new ExternalResourceBinding_impl();
binding4.setKey("myLanguageResourceObjectKey");
binding4.setResourceName("myLanguageResourceObject");
ExternalResourceBinding binding5 = new ExternalResourceBinding_impl();
binding5.setKey("myResourceWithSpaceInPathKey");
binding5.setResourceName("myResourceWithSpaceInPath");
ExternalResourceBinding binding6 = new ExternalResourceBinding_impl();
binding6.setKey("myResourceWithFilePathNotUrl");
binding6.setResourceName("myResourceWithFilePathNotUrl");
cfg.setExternalResourceBindings(new ExternalResourceBinding[] { binding1, binding2, binding3,
binding4, binding5, binding6 });
mManager.initializeExternalResources(cfg, TEST_CONTEXT_NAME, null);
} catch (Exception e) {