Search in sources :

Example 1 with LocatorFile

use of org.apache.jena.riot.system.stream.LocatorFile in project jena by apache.

the class TestLocators method locatorFile_01.

@Test
public void locatorFile_01() {
    LocatorFile loc = new LocatorFile();
    assertTrue(loc.exists("pom.xml"));
    assertTrue(loc.exists(testingDir + "data.ttl"));
    assertFalse(loc.exists("IDoNotExist"));
}
Also used : LocatorFile(org.apache.jena.riot.system.stream.LocatorFile) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 2 with LocatorFile

use of org.apache.jena.riot.system.stream.LocatorFile in project jena by apache.

the class TestLocators method locatorFile_03.

@Test
public void locatorFile_03() {
    String dir = new File(".").getAbsolutePath();
    LocatorFile loc = new LocatorFile(dir);
    assertTrue(loc.exists("pom.xml"));
    assertFalse(loc.exists("IDoNotExist"));
}
Also used : LocatorFile(org.apache.jena.riot.system.stream.LocatorFile) LocatorFile(org.apache.jena.riot.system.stream.LocatorFile) File(java.io.File) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 3 with LocatorFile

use of org.apache.jena.riot.system.stream.LocatorFile in project jena by apache.

the class TestRDFParser method source_streamManager.

@Test
public void source_streamManager() {
    StreamManager sMgr = new StreamManager();
    sMgr.addLocator(new LocatorFile(DIR));
    Graph graph = GraphFactory.createGraphMem();
    RDFParser.create().streamManager(sMgr).source("file:data.rdf").forceLang(Lang.TTL).parse(graph);
    assertEquals(3, graph.size());
}
Also used : Graph(org.apache.jena.graph.Graph) StreamManager(org.apache.jena.riot.system.stream.StreamManager) LocatorFile(org.apache.jena.riot.system.stream.LocatorFile) Test(org.junit.Test)

Example 4 with LocatorFile

use of org.apache.jena.riot.system.stream.LocatorFile in project jena by apache.

the class TestLocators method locatorFile_04.

@Test
public void locatorFile_04() {
    String dir = new File("src").getAbsolutePath();
    LocatorFile loc = new LocatorFile(dir);
    assertFalse(loc.exists("pom.xml"));
    assertTrue(loc.exists("main"));
    assertFalse(loc.exists(testingDir + "data.ttl"));
    assertTrue(loc.exists("../pom.xml"));
    assertFalse(loc.exists("/../" + testingDir + "data.ttl"));
}
Also used : LocatorFile(org.apache.jena.riot.system.stream.LocatorFile) LocatorFile(org.apache.jena.riot.system.stream.LocatorFile) File(java.io.File) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 5 with LocatorFile

use of org.apache.jena.riot.system.stream.LocatorFile in project jena by apache.

the class TestLocators method locatorFile_05.

@Test
public void locatorFile_05() {
    LocatorFile loc = new LocatorFile();
    TypedInputStream ts = loc.open(testingDir + "data.ttl");
    assertTrue("Not equal: " + WebContent.contentTypeTurtle + " != " + ts.getMediaType(), WebContent.contentTypeTurtle.equalsIgnoreCase(ts.getContentType()));
}
Also used : LocatorFile(org.apache.jena.riot.system.stream.LocatorFile) TypedInputStream(org.apache.jena.atlas.web.TypedInputStream) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Aggregations

LocatorFile (org.apache.jena.riot.system.stream.LocatorFile)7 Test (org.junit.Test)6 BaseTest (org.apache.jena.atlas.junit.BaseTest)5 File (java.io.File)2 StreamManager (org.apache.jena.riot.system.stream.StreamManager)2 TypedInputStream (org.apache.jena.atlas.web.TypedInputStream)1 Graph (org.apache.jena.graph.Graph)1 LocatorHTTP (org.apache.jena.riot.system.stream.LocatorHTTP)1 BeforeClass (org.junit.BeforeClass)1