Search in sources :

Example 6 with DataService

use of org.apache.jena.fuseki.server.DataService in project jena by apache.

the class TestEmbeddedFuseki method embedded_21.

@Test
public void embedded_21() {
    DatasetGraph dsg = dataset();
    int port = FusekiLib.choosePort();
    DataService dSrv = new DataService(dsg);
    dSrv.addEndpoint(OperationName.Query, "q");
    dSrv.addEndpoint(OperationName.GSP_R, "gsp");
    FusekiEmbeddedServer server = FusekiEmbeddedServer.create().add("/dsrv1", dSrv).setStaticFileBase(DIR).setPort(port).build();
    server.start();
    try {
        query("http://localhost:" + port + "/dsrv1/q", "ASK{}", x -> {
        });
        String x1 = HttpOp.execHttpGetString("http://localhost:" + port + "/dsrv1/gsp");
        assertNotNull(x1);
        // Static
        String x2 = HttpOp.execHttpGetString("http://localhost:" + port + "/test.txt");
        assertNotNull(x2);
    } finally {
        server.stop();
    }
}
Also used : DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) DataService(org.apache.jena.fuseki.server.DataService) Test(org.junit.Test)

Aggregations

DataService (org.apache.jena.fuseki.server.DataService)6 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)3 Test (org.junit.Test)3 HttpEntity (org.apache.http.HttpEntity)1 TypedInputStream (org.apache.jena.atlas.web.TypedInputStream)1 FusekiConfigException (org.apache.jena.fuseki.FusekiConfigException)1 DataAccessPoint (org.apache.jena.fuseki.server.DataAccessPoint)1 Graph (org.apache.jena.graph.Graph)1 Dataset (org.apache.jena.query.Dataset)1 ResultSet (org.apache.jena.query.ResultSet)1 Literal (org.apache.jena.rdf.model.Literal)1 RDFNode (org.apache.jena.rdf.model.RDFNode)1 Resource (org.apache.jena.rdf.model.Resource)1 Quad (org.apache.jena.sparql.core.Quad)1 UpdateRequest (org.apache.jena.update.UpdateRequest)1