Search in sources :

Example 16 with LocationMapper

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

the class TestLocationMapper method testLocationMapperToModel2.

@Test
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));
}
Also used : LocationMapper(org.apache.jena.util.LocationMapper) Test(org.junit.Test)

Example 17 with LocationMapper

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

the class TestLocationMapper method testLocationMapper.

@Test
public void testLocationMapper() {
    LocationMapper locMap = new LocationMapper(mapping);
    String alt = locMap.altMapping(filename1);
    assertNotNull(alt);
    assertEquals(filename2, alt);
}
Also used : LocationMapper(org.apache.jena.util.LocationMapper) Test(org.junit.Test)

Example 18 with LocationMapper

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

the class TestLocationMapper method testLocationMapperEquals1.

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

Example 19 with LocationMapper

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

the class TestLocationMapper method testLocationMapperFromModel.

@Test
public void testLocationMapperFromModel() {
    Model model = RDFDataMgr.loadModel(testingDir + "/location-mapping-test.ttl");
    LocationMapper loc = new LocationMapper(model);
    // Light test that the two location mappers are "the same"
    LocationMapper locMap = new LocationMapper(mapping);
    for (Iterator<String> iter = loc.listAltEntries(); iter.hasNext(); ) {
        String e = iter.next();
        String v1 = locMap.getAltEntry(e);
        String v2 = loc.getAltEntry(e);
        assertEquals("Different entries", v1, v2);
    }
    for (Iterator<String> iter = loc.listAltPrefixes(); iter.hasNext(); ) {
        String e = iter.next();
        String v1 = locMap.getAltPrefix(e);
        String v2 = loc.getAltPrefix(e);
        assertEquals("Different entries", v1, v2);
    }
}
Also used : Model(org.apache.jena.rdf.model.Model) LocationMapper(org.apache.jena.util.LocationMapper) Test(org.junit.Test)

Example 20 with LocationMapper

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

the class TestLocationMapper method testLocationMapperEquals2.

@Test
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) Test(org.junit.Test)

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