VIVO-731 Start to create the acceptance tests for SPARQL query API.
This commit is contained in:
parent
e01127bc11
commit
b1c8c3939d
3 changed files with 92 additions and 0 deletions
|
@ -0,0 +1,6 @@
|
|||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
||||
@prefix auth: <http://vitro.mannlib.cornell.edu/ns/vitro/authorization#> .
|
||||
@prefix simplePermission: <java:edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission#> .
|
||||
|
||||
auth:ADMIN
|
||||
auth:hasPermission simplePermission:UseSparqlQueryApi ;
|
|
@ -0,0 +1,11 @@
|
|||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
||||
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
||||
@prefix vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> .
|
||||
@prefix vivo: <http://vivoweb.org/ontology/core#> .
|
||||
@prefix myDomain: <http://vivo.mydomain.edu/individual/> .
|
||||
|
||||
myDomain:SQapiPerson
|
||||
a foaf:Person;
|
||||
rdfs:label "Baker, Able "^^xsd:string ;
|
||||
vitro:mostSpecificType foaf:Person;
|
||||
vivo:overview "A simple bread-maker." .
|
75
utilities/acceptance-tests/testApp/TestSparqlQueryApi.html
Normal file
75
utilities/acceptance-tests/testApp/TestSparqlQueryApi.html
Normal file
|
@ -0,0 +1,75 @@
|
|||
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||
|
||||
<script src="js/jquery.js"></script>
|
||||
|
||||
<script>
|
||||
function TestLOD() {
|
||||
self = this;
|
||||
|
||||
this.setup = setupButtons;
|
||||
|
||||
function setupButtons() {
|
||||
document.getElementById("submit_button").onclick = function() {
|
||||
requestWithAcceptHeader(
|
||||
$("#acceptHeader").val(),
|
||||
$("#email").val(),
|
||||
$("#password").val(),
|
||||
$("#query").val());
|
||||
}
|
||||
}
|
||||
|
||||
function requestWithAcceptHeader(mimetype, email, password, query) {
|
||||
var parms = {
|
||||
type: "POST",
|
||||
url: "/vivo/api/sparqlQuery",
|
||||
headers: {Accept: mimetype},
|
||||
data: {query: query, email: email, password: password},
|
||||
dataType: "text",
|
||||
complete: displayResult
|
||||
};
|
||||
$.ajax(parms);
|
||||
}
|
||||
|
||||
function displayResult(xhr, status) {
|
||||
$("#responseCode").text(xhr.status);
|
||||
$("#mimeType").text(xhr.getResponseHeader("Content-Type"));
|
||||
$("#responseText").text(xhr.responseText);
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
new TestLOD().setup();
|
||||
});
|
||||
</script>
|
||||
|
||||
<h1>Test the Linked Open Data requests</h1>
|
||||
|
||||
<h3>Request data</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td>User email</td>
|
||||
<td><input type="text" size="25" id="email"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>User password</td>
|
||||
<td><input type="password" size="15" id="password"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Accept header</td>
|
||||
<td><input type="text" size="40" id="acceptHeader"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Query text</td>
|
||||
<td><textarea cols="60" rows="10" id="query"></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="submit" value="submit the request" id="submit_button"></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2>Response data</h2>
|
||||
<div>Response code is <b><span id="responseCode">000</span></b></div>
|
||||
<div>MIME type is <b><span id="mimeType">No type</span></b></div>
|
||||
<div>Text is:</div>
|
||||
<div><pre id="responseText" style="font-size:small; font-family:monospace">No text</pre></div>
|
Loading…
Add table
Add a link
Reference in a new issue