Search in sources :

Example 1 with LocationMapper

use of org.apache.jena.util.LocationMapper in project jena by apache.

the class TestLocationMapper method testLocationMapperMiss.

public void testLocationMapperMiss() {
    LocationMapper locMap = new LocationMapper(mapping);
    String alt = locMap.altMapping(notFilename);
    assertNotNull(alt);
    assertEquals(alt, notFilename);
}
Also used : LocationMapper(org.apache.jena.util.LocationMapper)

Example 2 with LocationMapper

use of org.apache.jena.util.LocationMapper in project jena by apache.

the class TestLocationMapper method testLocationMapperClone2.

public void testLocationMapperClone2() {
    LocationMapper locMap1 = new LocationMapper(mapping);
    // See testLocationMapperURLtoFile
    //        String alt = locMap.altMapping("http://example.org/file") ;
    //        assertNotNull(alt) ;
    //        assertEquals(alt, "file:"+testingDir+"/location-mapping-test-file") ;
    LocationMapper locMap2 = new LocationMapper(locMap1);
    // Change this one
    locMap2.addAltPrefix("http://example.org/OTHER", "file:OTHER");
    {
        String alt = locMap2.altMapping("http://example.org/OTHER/f");
        assertNotNull(alt);
        assertEquals(alt, "file:OTHER/f");
    }
    // Not the other
    {
        String alt = locMap1.altMapping("http://example.org/OTHER/f");
        assertNotNull(alt);
        // Did not change
        assertEquals(alt, "http://example.org/OTHER/f");
    }
}
Also used : LocationMapper(org.apache.jena.util.LocationMapper)

Example 3 with LocationMapper

use of org.apache.jena.util.LocationMapper in project jena by apache.

the class TestLocationMapper method testLocationMapperToModel1.

public void testLocationMapperToModel1() {
    LocationMapper locMap1 = new LocationMapper(mapping);
    LocationMapper locMap2 = new LocationMapper(locMap1.toModel());
    assertEquals(locMap1, locMap2);
    assertEquals(locMap1.hashCode(), locMap2.hashCode());
}
Also used : LocationMapper(org.apache.jena.util.LocationMapper)

Example 4 with LocationMapper

use of org.apache.jena.util.LocationMapper in project jena by apache.

the class TestLocationMapper method testLocationMapperEquals2.

public void testLocationMapperEquals2() {
    LocationMapper locMap1 = new LocationMapper(mapping);
    LocationMapper locMap2 = new LocationMapper(mapping);
    locMap2.addAltEntry("file:nowhere", "file:somewhere");
    assertFalse(locMap1.equals(locMap2));
    assertFalse(locMap2.equals(locMap1));
}
Also used : LocationMapper(org.apache.jena.util.LocationMapper)

Example 5 with LocationMapper

use of org.apache.jena.util.LocationMapper in project jena by apache.

the class TestLocationMapper method testLocationMapperClone1.

public void testLocationMapperClone1() {
    LocationMapper locMap1 = new LocationMapper(mapping);
    // See testLocationMapperURLtoFile
    //        String alt = locMap.altMapping("http://example.org/file") ;
    //        assertNotNull(alt) ;
    //        assertEquals(alt, "file:"+testingDir+"/location-mapping-test-file") ;
    LocationMapper locMap2 = new LocationMapper(locMap1);
    // Remove from original
    locMap1.removeAltEntry("http://example.org/file");
    String alt = locMap2.altMapping("http://example.org/file");
    assertNotNull(alt);
    assertEquals(alt, "file:" + testingDir + "/location-mapping-test-file");
}
Also used : LocationMapper(org.apache.jena.util.LocationMapper)

Aggregations

LocationMapper (org.apache.jena.util.LocationMapper)22 Test (org.junit.Test)12 InputStream (java.io.InputStream)2 TestLocationMapper (org.apache.jena.riot.stream.TestLocationMapper)2 FileManager (org.apache.jena.util.FileManager)2 Model (org.apache.jena.rdf.model.Model)1 NotFoundException (org.apache.jena.shared.NotFoundException)1