Search in sources :

Example 31 with TypedInputStream

use of org.apache.jena.atlas.web.TypedInputStream in project jena by apache.

the class TestFusekiTestAuth method testServer_auth.

@Test
public void testServer_auth() {
    BasicCredentialsProvider credsProvider = new BasicCredentialsProvider();
    Credentials credentials = new UsernamePasswordCredentials(USER, PASSWORD);
    credsProvider.setCredentials(AuthScope.ANY, credentials);
    HttpClient client = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build();
    try (TypedInputStream in = HttpOp.execHttpGet(FusekiTestAuth.urlDataset(), "*/*", client, null)) {
    }
}
Also used : BasicCredentialsProvider(org.apache.http.impl.client.BasicCredentialsProvider) HttpClient(org.apache.http.client.HttpClient) TypedInputStream(org.apache.jena.atlas.web.TypedInputStream) UsernamePasswordCredentials(org.apache.http.auth.UsernamePasswordCredentials) Credentials(org.apache.http.auth.Credentials) UsernamePasswordCredentials(org.apache.http.auth.UsernamePasswordCredentials) Test(org.junit.Test)

Example 32 with TypedInputStream

use of org.apache.jena.atlas.web.TypedInputStream in project jena by apache.

the class TestAdmin method list_datasets_2.

@Test
public void list_datasets_2() {
    try (TypedInputStream in = execHttpGet(ServerCtl.urlRoot() + "$/" + opDatasets)) {
        assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType());
        JsonValue v = JSON.parseAny(in);
        assertNotNull(v.getAsObject().get("datasets"));
        checkJsonDatasetsAll(v);
    }
}
Also used : JsonValue(org.apache.jena.atlas.json.JsonValue) TypedInputStream(org.apache.jena.atlas.web.TypedInputStream) Test(org.junit.Test)

Aggregations

TypedInputStream (org.apache.jena.atlas.web.TypedInputStream)32 Test (org.junit.Test)11 BaseTest (org.apache.jena.atlas.junit.BaseTest)8 HttpException (org.apache.jena.atlas.web.HttpException)7 ContentType (org.apache.jena.atlas.web.ContentType)6 InputStream (java.io.InputStream)4 UsernamePasswordCredentials (org.apache.http.auth.UsernamePasswordCredentials)4 HttpClient (org.apache.http.client.HttpClient)4 BasicCredentialsProvider (org.apache.http.impl.client.BasicCredentialsProvider)4 IOException (java.io.IOException)3 MalformedURLException (java.net.MalformedURLException)3 URL (java.net.URL)3 JsonValue (org.apache.jena.atlas.json.JsonValue)3 HttpEntity (org.apache.http.HttpEntity)2 Credentials (org.apache.http.auth.Credentials)2 FusekiTestAuth.assertAuthHttpException (org.apache.jena.fuseki.embedded.FusekiTestAuth.assertAuthHttpException)2 Model (org.apache.jena.rdf.model.Model)2 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)2 NoSuchFileException (java.nio.file.NoSuchFileException)1 AccessControlException (java.security.AccessControlException)1