/** Add a file locator which uses dir as its working directory */ public void addLocatorFile(String dir) { LocatorFile fLoc = new LocatorFile(dir) ; addLocator(fLoc) ; }
/** Add a URL locator */ public void addLocatorURL() { Locator loc = new LocatorURL() ; addLocator(loc) ; }
/** Add a zip file locator */ public void addLocatorZip(String zfn) { Locator loc = new LocatorZip(zfn) ; addLocator(loc) ; }
public void testCache2() { FileManager fileManager = FileManager.get() ; fileManager.addLocatorFile(testingDir) ; fileManager.setModelCaching(true) ; Model m1 = fileManager.loadModel(fileModel) ; Model m2 = fileManager.loadModel(fileModel) ; assertSame(m1, m2) ; }
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) ; }
public void testLocationMapperToModel2() { LocationMapper locMap1 = new LocationMapper(mapping) ; LocationMapper locMap2 = new LocationMapper(mapping) ; locMap1 = new LocationMapper(locMap1.toModel()) ; locMap2.addAltEntry("file:nowhere", "file:somewhere") ; assertFalse(locMap1.equals(locMap2)) ; assertFalse(locMap2.equals(locMap1)) ; } }
public void testLocationMapperURLtoFile() { LocationMapper locMap = new LocationMapper(mapping) ; String alt = locMap.altMapping("http://example.org/file") ; assertNotNull(alt) ; assertEquals(alt, "file:"+testingDir+"/location-mapping-test-file") ; }
public void testClear() { OneToManyMap<String, String> map0 = new OneToManyMap<>(); map0.put( s0, s1 ); assertTrue( map0.contains( s0, s1 ) ); assertFalse( map0.isEmpty() ); map0.clear(); assertFalse( map0.contains( s0, s1 ) ); assertTrue( map0.isEmpty() ); }
public void testLocationMapperToModel1() { LocationMapper locMap1 = new LocationMapper(mapping) ; LocationMapper locMap2 = new LocationMapper(locMap1.toModel()) ; assertEquals(locMap1, locMap2) ; assertEquals(locMap1.hashCode(), locMap2.hashCode()) ; }
public void testGuessLangLowerCase() { assertEquals(FileUtils.langN3, FileUtils.guessLang("simple.n3")); assertEquals(FileUtils.langN3, FileUtils.guessLang("hello.there.n3")); assertEquals(FileUtils.langTurtle, FileUtils.guessLang("simple.ttl")); assertEquals(FileUtils.langTurtle, FileUtils .guessLang("hello.there.ttl")); assertEquals(FileUtils.langNTriple, FileUtils.guessLang("simple.nt")); assertEquals(FileUtils.langNTriple, FileUtils.guessLang("whats.up.nt")); assertEquals(FileUtils.langXML, FileUtils.guessLang("poggle.rdf")); assertEquals(FileUtils.langXML, FileUtils.guessLang("wise.owl")); assertEquals(FileUtils.langXML, FileUtils.guessLang("dotless")); }
public void testRemove0() { OneToManyMap<String, String> map0 = new OneToManyMap<>(); map0.put( s0, s1 ); map0.put( s3, s4 ); map0.remove( s0 ); map0.remove( s3 ); assertTrue( map0.isEmpty() ); }
public void testLocationMapperEquals1() { LocationMapper locMap1 = new LocationMapper(mapping) ; LocationMapper locMap2 = new LocationMapper(mapping) ; assertEquals(locMap1, locMap2) ; assertEquals(locMap1.hashCode(), locMap2.hashCode()) ; }
public void testLocatorFileEquality() { Locator A1 = new LocatorFile( "foo/bar" ); Locator A2 = new LocatorFile( "foo/bar" ); Locator B = new LocatorFile( "bill/ben" ); testLocatorEquality( A1, A2, B ); }
public void testClassLoaderLocatorEquality() { Locator A1 = new LocatorClassLoader( systemClassLoader ); Locator A2 = new LocatorClassLoader( systemClassLoader ); Locator B = new LocatorClassLoader( otherClassLoader ); testLocatorEquality( A1, A2, B ); }
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) ; }
public void testLocationMapper() { LocationMapper locMap = new LocationMapper(mapping) ; String alt = locMap.altMapping(filename1) ; assertNotNull(alt) ; assertEquals(alt, filename2) ; }
public void testGuessLangMixedCase() { assertEquals(FileUtils.langN3, FileUtils.guessLang("simple.N3")); assertEquals(FileUtils.langN3, FileUtils.guessLang("hello.there.N3")); assertEquals(FileUtils.langTurtle, FileUtils.guessLang("simple.TTL")); assertEquals(FileUtils.langTurtle, FileUtils .guessLang("hello.there.TTL")); assertEquals(FileUtils.langNTriple, FileUtils.guessLang("simple.NT")); assertEquals(FileUtils.langNTriple, FileUtils.guessLang("whats.up.Nt")); assertEquals(FileUtils.langXML, FileUtils.guessLang("poggle.rDf")); assertEquals(FileUtils.langXML, FileUtils.guessLang("wise.OwL")); assertEquals(FileUtils.langXML, FileUtils.guessLang("dotless")); }
public void testFileManagerFileLocator() { FileManager fileManager = new FileManager() ; fileManager.addLocatorFile() ; InputStream in = fileManager.open(testingDir+"/"+filename) ; assertNotNull(in) ; closeInputStream(in) ; }
public void testLocationMapperMiss() { LocationMapper locMap = new LocationMapper(mapping) ; String alt = locMap.altMapping(notFilename) ; assertNotNull(alt) ; assertEquals(alt, notFilename) ; }
public void testGuessLangFallback() { assertEquals("spoo", FileUtils.guessLang("noSuffix", "spoo")); assertEquals("pots", FileUtils.guessLang("suffix.unknown", "pots")); assertEquals(FileUtils.langXML, FileUtils.guessLang("rdf.rdf", "spoo")); assertEquals(FileUtils.langXML, FileUtils.guessLang("rdf.owl", "spoo")); }