Search in sources :

Example 11 with DatasetAccessor

use of org.apache.jena.query.DatasetAccessor in project jena by apache.

the class TestDatasetAccessorHTTP method get_01.

@Test
public void get_01() {
    DatasetAccessor du = connectToService();
    Model graph = du.getModel();
    assertTrue(graph.isEmpty());
}
Also used : Model(org.apache.jena.rdf.model.Model) DatasetAccessor(org.apache.jena.query.DatasetAccessor) Test(org.junit.Test) AbstractFusekiTest(org.apache.jena.fuseki.AbstractFusekiTest) FusekiTest(org.apache.jena.fuseki.FusekiTest)

Example 12 with DatasetAccessor

use of org.apache.jena.query.DatasetAccessor in project jena by apache.

the class TestAuth method graphstore_with_auth_02.

@Test(expected = HttpException.class)
public void graphstore_with_auth_02() {
    // Incorrect auth credentials
    DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(authServiceREST, withBasicAuth(ANY, "allowed", "incorrect"));
    accessor.getModel();
}
Also used : DatasetAccessor(org.apache.jena.query.DatasetAccessor) Test(org.junit.Test)

Example 13 with DatasetAccessor

use of org.apache.jena.query.DatasetAccessor in project jena by apache.

the class TestFileUpload method dataset_accessor_02.

@Test
public void dataset_accessor_02() {
    FileSender x = new FileSender(ServerCtl.urlDataset());
    x.add("D.nq", "<http://example/s> <http://example/p> <http://example/o-456> <http://example/g> .", "application/n-quads");
    x.send("PUT");
    DatasetAccessor du = DatasetAccessorFactory.createHTTP(ServerCtl.serviceGSP());
    Model m = du.getModel("http://example/g");
    assertEquals(1, m.size());
    m = du.getModel();
    assertEquals(0, m.size());
}
Also used : Model(org.apache.jena.rdf.model.Model) DatasetAccessor(org.apache.jena.query.DatasetAccessor) Test(org.junit.Test)

Example 14 with DatasetAccessor

use of org.apache.jena.query.DatasetAccessor in project jena by apache.

the class TestAuth method graphstore_with_auth_01.

@Test(expected = HttpException.class)
public void graphstore_with_auth_01() {
    // No auth credentials
    DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(authServiceREST);
    accessor.getModel();
}
Also used : DatasetAccessor(org.apache.jena.query.DatasetAccessor) Test(org.junit.Test)

Example 15 with DatasetAccessor

use of org.apache.jena.query.DatasetAccessor in project jena by apache.

the class TestFileUpload method upload_gsp_02.

@Test
public void upload_gsp_02() {
    FileSender x = new FileSender(ServerCtl.serviceGSP() + "?default");
    x.add("D.ttl", "<http://example/s> <http://example/p> 123 .", "text/turtle");
    x.add("D.nt", "<http://example/s> <http://example/p> <http://example/o-456> .", "application/n-triples");
    x.send("PUT");
    // BUG
    DatasetAccessor du = DatasetAccessorFactory.createHTTP(ServerCtl.serviceGSP());
    Model m = du.getModel();
    assertEquals(2, m.size());
}
Also used : Model(org.apache.jena.rdf.model.Model) DatasetAccessor(org.apache.jena.query.DatasetAccessor) Test(org.junit.Test)

Aggregations

DatasetAccessor (org.apache.jena.query.DatasetAccessor)32 Test (org.junit.Test)31 AbstractFusekiTest (org.apache.jena.fuseki.AbstractFusekiTest)21 FusekiTest (org.apache.jena.fuseki.FusekiTest)21 Model (org.apache.jena.rdf.model.Model)20 AuthScope (org.apache.http.auth.AuthScope)2