use of org.apache.jena.sparql.modify.UpdateProcessRemoteBase in project jena by apache.
the class TestAuth method update_with_auth_08.
@Test(expected = HttpException.class)
public void update_with_auth_08() {
UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemoteForm(updates, authServiceUpdate);
// Auth credentials for valid user with correct password BUT not in
// correct role
ue.setClient(withBasicAuth(ANY, "forbidden", "password"));
ue.execute();
}
use of org.apache.jena.sparql.modify.UpdateProcessRemoteBase in project jena by apache.
the class TestAuth method update_with_auth_09.
@Test(expected = HttpException.class)
public void update_with_auth_09() throws URISyntaxException {
UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
// Auth credentials for valid user with correct password but scoped to
// wrong URI
ue.setClient(withBasicAuth(new AuthScope("example", authPort), "allowed", "password"));
ue.execute();
}
use of org.apache.jena.sparql.modify.UpdateProcessRemoteBase in project jena by apache.
the class TestAuth method update_with_auth_05.
@Test(expected = HttpException.class)
public void update_with_auth_05() {
UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemoteForm(updates, authServiceUpdate);
// No auth credentials should result in an error
ue.execute();
}
use of org.apache.jena.sparql.modify.UpdateProcessRemoteBase in project jena by apache.
the class TestAuth method update_with_auth_04.
@Test(expected = HttpException.class)
public void update_with_auth_04() {
UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
// Auth credentials for valid user with correct password BUT not in
// correct role
ue.setClient(withBasicAuth(ANY, "forbidden", "password"));
ue.execute();
}
use of org.apache.jena.sparql.modify.UpdateProcessRemoteBase in project jena by apache.
the class TestService method update_service_context_application_02.
@SuppressWarnings("unchecked")
@Test
public void update_service_context_application_02() {
// This test requires no service context to be set
Map<String, Context> serviceContextMap = (Map<String, Context>) ARQ.getContext().get(Service.serviceContext);
if (serviceContextMap == null) {
ARQ.getContext().put(Service.serviceContext, new HashMap<String, Context>());
serviceContextMap = (Map<String, Context>) ARQ.getContext().get(Service.serviceContext);
}
if (serviceContextMap.get(SERVICE) == null) {
serviceContextMap.put(SERVICE, new Context(ARQ.getContext()));
}
Context serviceContext = serviceContextMap.get(SERVICE);
try {
HttpClient testClient = HttpClients.custom().build();
serviceContext.put(Service.queryClient, testClient);
UpdateRequest updates = UpdateFactory.create("CREATE GRAPH <http://example>");
UpdateProcessRemoteBase engine = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, SERVICE);
Assert.assertNotNull(engine);
// Check that client settings were changed
Assert.assertEquals(testClient, engine.getClient());
} finally {
serviceContext.remove(Service.queryClient);
}
}
Aggregations