use of org.apache.jena.util.FileManager in project jena by apache.
the class TestFileManager method testFileManagerFileLocatorWithDir.
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 testFileManagerLocatorZip.
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 TestFileManager method testFileManagerClone.
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 testFileManagerLocatorClassLoader.
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 testFileManagerLocatorZipNonFound.
public void testFileManagerLocatorZipNonFound() {
FileManager fileManager = new FileManager();
try {
fileManager.addLocatorZip(zipname);
} catch (Exception ex) {
fail("Failed to create a filemanager and add a zip locator");
}
try {
InputStream in = fileManager.open(filenameNonExistent);
closeInputStream(in);
assertNull("Found non-existant zip file member", in);
} catch (NotFoundException ex) {
}
}
Aggregations