use of org.apache.jena.util.FileManager in project jena by apache.
the class TestFileManager method testFileManagerFileLocatorWithDir.
@Test
public void testFileManagerFileLocatorWithDir() {
FileManager fileManager = new FileManager();
fileManager.addLocatorFile(testingDir);
InputStream in = fileManager.open(filename);
assertNotNull(in);
closeInputStream(in);
}
use of org.apache.jena.util.FileManager in project jena by apache.
the class TestFileManager method testFileManagerClone.
@Test
public void testFileManagerClone() {
FileManager fileManager1 = new FileManager();
FileManager fileManager2 = fileManager1.clone();
// Should not affect fileManager2
fileManager1.addLocatorFile();
{
InputStream in = fileManager1.open(testingDir + "/" + filename);
assertNotNull(in);
closeInputStream(in);
}
// Should not work.
try {
InputStream in = fileManager2.open(testingDir + "/" + filename);
closeInputStream(in);
assertNull("Found file via wrong FileManager", in);
} catch (NotFoundException ex) {
}
}
use of org.apache.jena.util.FileManager in project jena by apache.
the class TestFileManager method testFileManagerLocatorZip.
@Test
public void testFileManagerLocatorZip() {
FileManager fileManager = new FileManager();
try {
fileManager.addLocatorZip(zipname);
} catch (Exception ex) {
fail("Failed to create a filemanager and add a zip locator");
}
InputStream in = fileManager.open(filename);
assertNotNull(in);
closeInputStream(in);
}
use of org.apache.jena.util.FileManager in project jena by apache.
the class TestImportManager method testCacheModels.
public void testCacheModels() {
ImportManager im = new ImportManager();
Model spec = model("_x owl:imports M1");
Model m1 = model("this isModel M1");
FileManager withM1 = new FixedFileManager().add("eh:/M1", m1);
Model A = im.withImports(withM1, spec);
FileManager none = new FixedFileManager();
Model B = im.withImports(none, spec);
assertIsoModels(A, B);
}
use of org.apache.jena.util.FileManager in project jena by apache.
the class TestFileManager method testLocationMappingURLtoFileOpenNotFound.
public void testLocationMappingURLtoFileOpenNotFound() {
LocationMapper locMap = new LocationMapper(TestLocationMapper.mapping);
FileManager fileManager = new FileManager(locMap);
fileManager.addLocatorClassLoader(fileManager.getClass().getClassLoader());
try {
InputStream in = fileManager.open("http://example.org/file");
closeInputStream(in);
assertNull("Found nont-existant URL", null);
} catch (NotFoundException ex) {
}
}
Aggregations