use of org.apache.jena.sparql.exec.http.QueryExecutionHTTP in project jena by apache.
the class TestWebappAuthQuery_JDK method query_authenv_02_prefix_good.
@Test
public void query_authenv_02_prefix_good() {
QueryExecutionHTTP qe = QueryExecutionHTTP.create().endpoint(authServiceQuery).query("ASK { }").build();
// Dataset URL.
String dsURL = "http://localhost:" + authPort + authDatasetPath;
URI uri = URI.create(dsURL);
AuthEnv.get().registerUsernamePassword(uri, "allowed", "password");
try {
Assert.assertTrue(qe.execAsk());
} finally {
AuthEnv.get().unregisterUsernamePassword(uri);
}
}
use of org.apache.jena.sparql.exec.http.QueryExecutionHTTP in project jena by apache.
the class TestWebappAuthQuery_JDK method query_authenv_01_good.
@Test
public void query_authenv_01_good() {
// Auth credentials for valid user with correct password
QueryExecutionHTTP qe = QueryExecutionHTTP.create().endpoint(authServiceQuery).query("ASK { }").build();
String dsURL = authServiceQuery;
URI uri = URI.create(dsURL);
AuthEnv.get().registerUsernamePassword(uri, "allowed", "password");
try {
Assert.assertTrue(qe.execAsk());
} finally {
AuthEnv.get().unregisterUsernamePassword(uri);
// AuthEnv.get().clearAuthRequestModifiers();
}
}
use of org.apache.jena.sparql.exec.http.QueryExecutionHTTP in project jena by apache.
the class TestWebappAuthQuery_JDK method query_auth_jdk_03_good_auth.
@Test
public void query_auth_jdk_03_good_auth() {
// Auth credentials for valid user with correct password
QueryExecutionHTTP qe = withAuthJDK(QueryExecutionHTTP.create().endpoint(authServiceQuery).query("ASK { }"), "allowed", "password");
Assert.assertTrue(qe.execAsk());
}
use of org.apache.jena.sparql.exec.http.QueryExecutionHTTP in project jena by apache.
the class TestAuthQuery_JDK method query_auth_jdk_01_no_auth.
@Test
public void query_auth_jdk_01_no_auth() {
QueryExecutionHTTP qe = QueryExecutionHTTP.create().endpoint(databaseURL()).query("ASK { }").build();
// No auth credentials should result in an error
expectQuery401(() -> qe.execAsk());
}
use of org.apache.jena.sparql.exec.http.QueryExecutionHTTP in project jena by apache.
the class TestAuthQuery_JDK method query_authenv_01_good.
@Test
public void query_authenv_01_good() {
// Auth credentials for valid user with correct password
QueryExecutionHTTP qe = QueryExecutionHTTP.create().endpoint(databaseURL()).query("ASK { }").build();
String dsURL = databaseURL();
URI uri = URI.create(dsURL);
AuthEnv.get().registerUsernamePassword(uri, "allowed", "password");
try {
Assert.assertTrue(qe.execAsk());
} finally {
AuthEnv.get().unregisterUsernamePassword(uri);
// AuthEnv.get().clearAuthRequestModifiers();
}
}
Aggregations