Search in sources :

Example 11 with QueryExecutionHTTP

use of org.apache.jena.sparql.exec.http.QueryExecutionHTTP in project jena by apache.

the class TestWebappAuthQuery_JDK method query_auth_jdk_02_bad_auth.

@Test
public void query_auth_jdk_02_bad_auth() {
    // Auth - bad password
    QueryExecutionHTTP qe = withAuthJDK(QueryExecutionHTTP.create().endpoint(authServiceQuery).query("ASK { }"), "allowed", "incorrect");
    HttpTest.expectQuery401(() -> qe.execAsk());
}
Also used : QueryExecutionHTTP(org.apache.jena.sparql.exec.http.QueryExecutionHTTP) Test(org.junit.Test) HttpTest(org.apache.jena.fuseki.test.HttpTest)

Example 12 with QueryExecutionHTTP

use of org.apache.jena.sparql.exec.http.QueryExecutionHTTP in project jena by apache.

the class TestAuthQuery_JDK method query_auth_jdk_02_bad_auth.

@Test
public void query_auth_jdk_02_bad_auth() {
    // Auth - bad password
    QueryExecutionHTTP qe = withAuthJDK(QueryExecutionHTTP.create().endpoint(databaseURL()).query("ASK { }"), "allowed", "incorrect");
    expectQuery401(() -> qe.execAsk());
}
Also used : QueryExecutionHTTP(org.apache.jena.sparql.exec.http.QueryExecutionHTTP) Test(org.junit.Test) HttpTest(org.apache.jena.fuseki.test.HttpTest)

Example 13 with QueryExecutionHTTP

use of org.apache.jena.sparql.exec.http.QueryExecutionHTTP in project jena by apache.

the class TestAuthQuery_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(databaseURL()).query("ASK { }"), "allowed", "password");
    Assert.assertTrue(qe.execAsk());
}
Also used : QueryExecutionHTTP(org.apache.jena.sparql.exec.http.QueryExecutionHTTP) Test(org.junit.Test) HttpTest(org.apache.jena.fuseki.test.HttpTest)

Aggregations

QueryExecutionHTTP (org.apache.jena.sparql.exec.http.QueryExecutionHTTP)13 HttpTest (org.apache.jena.fuseki.test.HttpTest)12 Test (org.junit.Test)12 URI (java.net.URI)6 CmdException (org.apache.jena.cmd.CmdException)1 Query (org.apache.jena.query.Query)1 QueryExceptionHTTP (org.apache.jena.sparql.engine.http.QueryExceptionHTTP)1 QuerySendMode (org.apache.jena.sparql.exec.http.QuerySendMode)1