예제 #1
0
 @Test
 public void testClearNamespaces() throws Exception {
   con.begin();
   con.setNamespace("rdf", RDF.NAMESPACE);
   con.setNamespace("rdfs", RDFS.NAMESPACE);
   con.clearNamespaces();
   con.commit();
   assertTrue(!con.getNamespaces().hasNext());
 }
예제 #2
0
 @Test
 public void testGetNamespace() throws Exception {
   con.begin();
   con.setNamespace("rdf", RDF.NAMESPACE);
   con.commit();
   assertEquals(RDF.NAMESPACE, con.getNamespace("rdf"));
 }
예제 #3
0
 @Test
 public void testRemoveNamespaces() throws Exception {
   con.begin();
   con.setNamespace("rdf", RDF.NAMESPACE);
   con.removeNamespace("rdf");
   con.commit();
   assertNull(con.getNamespace("rdf"));
 }
예제 #4
0
 @Test
 public void testNullNamespaceDisallowed() throws Exception {
   try {
     con.setNamespace("foo", null);
     fail("Expected NullPointerException");
   } catch (NullPointerException e) {
     // expected
   }
 }
예제 #5
0
  @Test
  public void testGetNamespaces() throws Exception {
    con.begin();
    con.setNamespace("rdf", RDF.NAMESPACE);
    con.commit();

    CloseableIteration<? extends Namespace, SailException> namespaces = con.getNamespaces();
    try {
      assertTrue(namespaces.hasNext());
      Namespace rdf = namespaces.next();
      assertEquals("rdf", rdf.getPrefix());
      assertEquals(RDF.NAMESPACE, rdf.getName());
      assertTrue(!namespaces.hasNext());
    } finally {
      namespaces.close();
    }
  }
예제 #6
0
 @Test
 public void testNullPrefixDisallowed() throws Exception {
   try {
     con.setNamespace(null, "foo");
     fail("Expected NullPointerException");
   } catch (NullPointerException e) {
     // expected
   }
   try {
     con.getNamespace(null);
     fail("Expected NullPointerException");
   } catch (NullPointerException e) {
     // expected
   }
   try {
     con.removeNamespace(null);
     fail("Expected NullPointerException");
   } catch (NullPointerException e) {
     // expected
   }
 }