use of org.apache.jena.util.FileManager in project jena by apache.
the class TestFileManager method testCache2.
@Test
public void testCache2() {
FileManager.setGlobalFileManager(AdapterFileManager.get());
FileManager fileManager = FileManager.get();
fileManager.addLocatorFile(testingDir);
fileManager.setModelCaching(true);
Model m1 = fileManager.loadModel(fileModel);
Model m2 = fileManager.loadModel(fileModel);
assertSame(m1, m2);
}
use of org.apache.jena.util.FileManager in project jena by apache.
the class TestFileManager method testFileManagerLocatorClassLoader.
@Test
public void testFileManagerLocatorClassLoader() {
FileManager fileManager = new FileManager();
fileManager.addLocatorClassLoader(fileManager.getClass().getClassLoader());
InputStream in = fileManager.open("java/lang/String.class");
assertNotNull(in);
closeInputStream(in);
}
use of org.apache.jena.util.FileManager in project jena by apache.
the class TestFileManager method testLocationMappingURLtoFileOpenNotFound.
@Test
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) {
}
}
use of org.apache.jena.util.FileManager in project jena by apache.
the class TestDocumentManagerAssembler method testUsesFileManager.
public void testUsesFileManager() {
Resource root = resourceInModel("x rdf:type ja:DocumentManager; x ja:fileManager f");
Assembler a = new DocumentManagerAssembler();
FileManager fm = new FileManager();
Assembler mock = new NamedObjectAssembler(resource("f"), fm);
Object x = a.open(mock, root);
assertInstanceOf(OntDocumentManager.class, x);
assertSame(fm, ((OntDocumentManager) x).getFileManager());
}
use of org.apache.jena.util.FileManager in project jena by apache.
the class TestImportManager method testFollowOwlImports.
public void testFollowOwlImports() {
final Model modelToLoad = model("this hasMarker B5");
Model m = model("x ja:reasoner y; _x owl:imports eh:/loadMe");
FileManager fm = new FixedFileManager().add("eh:/loadMe", modelToLoad);
Model m2 = new ImportManager().withImports(fm, m);
assertInstanceOf(MultiUnion.class, m2.getGraph());
assertIsoModels(modelToLoad.union(m), m2);
}
Aggregations