Search in sources :

Example 11 with UpdateProcessRemoteBase

use of org.apache.jena.sparql.modify.UpdateProcessRemoteBase in project jena by apache.

the class TestAuth method update_with_auth_01.

@Test(expected = HttpException.class)
public void update_with_auth_01() {
    UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
    UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
    // No auth credentials should result in an error
    ue.execute();
}
Also used : UpdateRequest(org.apache.jena.update.UpdateRequest) UpdateProcessRemoteBase(org.apache.jena.sparql.modify.UpdateProcessRemoteBase) Test(org.junit.Test)

Example 12 with UpdateProcessRemoteBase

use of org.apache.jena.sparql.modify.UpdateProcessRemoteBase in project jena by apache.

the class TestAuth method update_with_auth_07.

@Test
public void update_with_auth_07() {
    UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
    UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemoteForm(updates, authServiceUpdate);
    // Auth credentials for valid user with correct password
    ue.setClient(withBasicAuth(ANY, "allowed", "password"));
    ue.execute();
}
Also used : UpdateRequest(org.apache.jena.update.UpdateRequest) UpdateProcessRemoteBase(org.apache.jena.sparql.modify.UpdateProcessRemoteBase) Test(org.junit.Test)

Example 13 with UpdateProcessRemoteBase

use of org.apache.jena.sparql.modify.UpdateProcessRemoteBase in project jena by apache.

the class TestAuth method update_with_auth_03.

@Test
public void update_with_auth_03() {
    UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
    UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
    // Auth credentials for valid user with correct password
    ue.setClient(withBasicAuth(ANY, "allowed", "password"));
    ue.execute();
}
Also used : UpdateRequest(org.apache.jena.update.UpdateRequest) UpdateProcessRemoteBase(org.apache.jena.sparql.modify.UpdateProcessRemoteBase) Test(org.junit.Test)

Aggregations

UpdateProcessRemoteBase (org.apache.jena.sparql.modify.UpdateProcessRemoteBase)13 UpdateRequest (org.apache.jena.update.UpdateRequest)13 Test (org.junit.Test)13 AuthScope (org.apache.http.auth.AuthScope)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 HttpClient (org.apache.http.client.HttpClient)2 Context (org.apache.jena.sparql.util.Context)2 URI (java.net.URI)1 HttpHost (org.apache.http.HttpHost)1 UsernamePasswordCredentials (org.apache.http.auth.UsernamePasswordCredentials)1 AuthCache (org.apache.http.client.AuthCache)1 HttpClientContext (org.apache.http.client.protocol.HttpClientContext)1 BasicScheme (org.apache.http.impl.auth.BasicScheme)1 BasicAuthCache (org.apache.http.impl.client.BasicAuthCache)1 BasicCredentialsProvider (org.apache.http.impl.client.BasicCredentialsProvider)1 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)1