use of org.apache.jena.util.FileManager in project jena by apache.
the class TestFileManager method testLocationMappingURLtoFileOpen.
public void testLocationMappingURLtoFileOpen() {
LocationMapper locMap = new LocationMapper(TestLocationMapper.mapping);
FileManager fileManager = new FileManager(locMap);
fileManager.addLocatorFile();
InputStream in = fileManager.open("http://example.org/file");
assertNotNull(in);
closeInputStream(in);
}
use of org.apache.jena.util.FileManager in project jena by apache.
the class TestFileManager method testFileManagerLocatorClassLoaderNotFound.
public void testFileManagerLocatorClassLoaderNotFound() {
FileManager fileManager = new FileManager();
fileManager.addLocatorClassLoader(fileManager.getClass().getClassLoader());
try {
InputStream in = fileManager.open("not/java/lang/String.class");
closeInputStream(in);
assertNull("Found non-existant class", in);
} catch (NotFoundException ex) {
}
}
use of org.apache.jena.util.FileManager in project jena by apache.
the class TestFileManager method testCache3.
public void testCache3() {
FileManager fileManager = FileManager.get();
fileManager.addLocatorFile(testingDir);
fileManager.setModelCaching(true);
Model m1 = fileManager.loadModel(fileModel);
Model m2 = fileManager.loadModel(fileModel);
assertSame(m1, m2);
fileManager.removeCacheModel(fileModel);
Model m3 = fileManager.loadModel(fileModel);
assertNotSame(m1, m3);
fileManager.resetCache();
Model m4 = fileManager.loadModel(fileModel);
Model m5 = fileManager.loadModel(fileModel);
assertSame(m4, m5);
assertNotSame(m1, m4);
assertNotSame(m3, m4);
}
use of org.apache.jena.util.FileManager in project jena by apache.
the class TestFileManager method testFileManagerFileLocator.
public void testFileManagerFileLocator() {
FileManager fileManager = new FileManager();
fileManager.addLocatorFile();
InputStream in = fileManager.open(testingDir + "/" + filename);
assertNotNull(in);
closeInputStream(in);
}
use of org.apache.jena.util.FileManager in project jena by apache.
the class TestFileManager method testFileManagerNoFile.
public void testFileManagerNoFile() {
FileManager fileManager = new FileManager();
fileManager.addLocatorFile();
try {
// Tests either way round - exception or a null return.
InputStream in = fileManager.open(filenameNonExistent);
closeInputStream(in);
assertNull("Found non-existant file: " + filenameNonExistent, in);
} catch (NotFoundException ex) {
}
}
Aggregations