Search in sources :

Example 1 with BodyPublisher

use of java.net.http.HttpRequest.BodyPublisher in project jena by apache.

the class TestWebappServerReadOnly method gsp_w_readonly_POST.

@Test
public void gsp_w_readonly_POST() {
    // Try to write
    HttpTest.execWithHttpException(HttpSC.METHOD_NOT_ALLOWED_405, () -> {
        BodyPublisher bodyPublisher = BodyPublishers.ofString("");
        HttpOp.httpPost(ServerCtl.serviceGSP() + "?default", null, bodyPublisher);
    });
}
Also used : BodyPublisher(java.net.http.HttpRequest.BodyPublisher) FusekiTest(org.apache.jena.fuseki.test.FusekiTest) Test(org.junit.Test) HttpTest(org.apache.jena.fuseki.test.HttpTest)

Example 2 with BodyPublisher

use of java.net.http.HttpRequest.BodyPublisher in project jena by apache.

the class TestWebappServerReadOnly method dataset_w_readonly_PUT.

@Test
public void dataset_w_readonly_PUT() {
    // Try to write
    HttpTest.execWithHttpException(HttpSC.METHOD_NOT_ALLOWED_405, () -> {
        BodyPublisher bodyPublisher = BodyPublishers.ofString("");
        HttpOp.httpPut(ServerCtl.urlDataset(), null, bodyPublisher);
    });
}
Also used : BodyPublisher(java.net.http.HttpRequest.BodyPublisher) FusekiTest(org.apache.jena.fuseki.test.FusekiTest) Test(org.junit.Test) HttpTest(org.apache.jena.fuseki.test.HttpTest)

Example 3 with BodyPublisher

use of java.net.http.HttpRequest.BodyPublisher in project jena by apache.

the class TestWebappServerReadOnly method gsp_w_readonly_PUT.

@Test
public void gsp_w_readonly_PUT() {
    // Try to write
    HttpTest.execWithHttpException(HttpSC.METHOD_NOT_ALLOWED_405, () -> {
        BodyPublisher bodyPublisher = BodyPublishers.ofString("");
        HttpOp.httpPut(ServerCtl.serviceGSP() + "?default", null, bodyPublisher);
    });
}
Also used : BodyPublisher(java.net.http.HttpRequest.BodyPublisher) FusekiTest(org.apache.jena.fuseki.test.FusekiTest) Test(org.junit.Test) HttpTest(org.apache.jena.fuseki.test.HttpTest)

Example 4 with BodyPublisher

use of java.net.http.HttpRequest.BodyPublisher in project jena by apache.

the class TestWebappServerReadOnly method dataset_w_readonly_POST.

@Test
public void dataset_w_readonly_POST() {
    // Try to write
    HttpTest.execWithHttpException(HttpSC.METHOD_NOT_ALLOWED_405, () -> {
        BodyPublisher bodyPublisher = BodyPublishers.ofString("");
        HttpOp.httpPost(ServerCtl.urlDataset(), null, bodyPublisher);
    });
}
Also used : BodyPublisher(java.net.http.HttpRequest.BodyPublisher) FusekiTest(org.apache.jena.fuseki.test.FusekiTest) Test(org.junit.Test) HttpTest(org.apache.jena.fuseki.test.HttpTest)

Example 5 with BodyPublisher

use of java.net.http.HttpRequest.BodyPublisher in project jena by apache.

the class TestAdmin method addTestDataset.

private static void addTestDataset(String filename) {
    try {
        Path f = Path.of(filename);
        BodyPublisher body = BodyPublishers.ofFile(f);
        String ct = WebContent.contentTypeTurtle;
        httpPost(ServerCtl.urlRoot() + "$/" + opDatasets, ct, body);
    } catch (FileNotFoundException e) {
        IO.exception(e);
    }
}
Also used : Path(java.nio.file.Path) BodyPublisher(java.net.http.HttpRequest.BodyPublisher) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

BodyPublisher (java.net.http.HttpRequest.BodyPublisher)12 FusekiTest (org.apache.jena.fuseki.test.FusekiTest)4 HttpTest (org.apache.jena.fuseki.test.HttpTest)4 Test (org.junit.Test)4 FileNotFoundException (java.io.FileNotFoundException)2 Path (java.nio.file.Path)2 InputStream (java.io.InputStream)1 URI (java.net.URI)1 Builder (java.net.http.HttpRequest.Builder)1 Collection (java.util.Collection)1 Graph (org.apache.jena.graph.Graph)1 StreamRDF (org.apache.jena.riot.system.StreamRDF)1 NotFoundException (org.apache.jena.shared.NotFoundException)1 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)1