Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
119 additions
and 398 deletions.
- +1 −2 KnoraBuild.sbt
- +3 −5 Makefile
- +0 −1 webapi/scripts/fuseki-ci-prepare.sh
- +1 −1 webapi/scripts/fuseki-dump-repository.sh
- +94 −0 webapi/scripts/fuseki-functions.sh
- +3 −82 webapi/scripts/fuseki-init-knora-test-minimal.sh
- +3 −82 webapi/scripts/fuseki-init-knora-test-unit-minimal.sh
- +4 −82 webapi/scripts/fuseki-init-knora-test-unit.sh
- +4 −82 webapi/scripts/fuseki-init-knora-test.sh
- +0 −54 webapi/scripts/fuseki-knora-test-repository-config.ttl
- +4 −5 ...pi/scripts/{fuseki-knora-test-unit-repository-config.ttl → fuseki-repository-config.ttl.template}
- +2 −2 webapi/src/main/scala/org/knora/webapi/store/triplestore/http/HttpTriplestoreConnector.scala
@@ -0,0 +1,94 @@ | ||
#!/usr/bin/env bash | ||
|
||
#set -x | ||
|
||
POSITIONAL=() | ||
while [[ $# -gt 0 ]]; do | ||
key="$1" | ||
|
||
case $key in | ||
-r | --repository) | ||
REPOSITORY="$2" | ||
shift # past argument | ||
shift # past value | ||
;; | ||
-u | --username) | ||
USERNAME="$2" | ||
shift # past argument | ||
shift # past value | ||
;; | ||
-p | --password) | ||
PASSWORD="$2" | ||
shift # past argument | ||
shift # past value | ||
;; | ||
-h | --host) | ||
HOST="$2" | ||
shift # past argument | ||
shift # past value | ||
;; | ||
*) # unknown option | ||
POSITIONAL+=("$1") # save it in an array for later | ||
shift # past argument | ||
;; | ||
esac | ||
done | ||
set -- "${POSITIONAL[@]}" # restore positional parameters | ||
|
||
FILE="$1" | ||
|
||
if [[ -z "${REPOSITORY}" ]]; then | ||
REPOSITORY="knora-test" | ||
fi | ||
|
||
if [[ -z "${HOST}" ]]; then | ||
HOST="localhost:3030" | ||
fi | ||
|
||
if [[ -z "${USERNAME}" ]]; then | ||
USERNAME="admin" | ||
fi | ||
|
||
if [[ -z "${PASSWORD}" ]]; then | ||
PASSWORD="test" | ||
fi | ||
|
||
delete-repository() { | ||
STATUS=$(curl -s -o /dev/null -w '%{http_code}' -u ${USERNAME}:${PASSWORD} -X DELETE http://${HOST}/\$/datasets/${REPOSITORY}) | ||
|
||
if [ "${STATUS}" -eq 200 ]; then | ||
echo "==> delete repository done" | ||
return 0 | ||
else | ||
echo "==> delete repository failed" | ||
return 1 | ||
fi | ||
} | ||
|
||
create-repository() { | ||
REPOSITORY_CONFIG=$(sed "s/@REPOSITORY@/${REPOSITORY}/g" ./fuseki-repository-config.ttl.template) | ||
STATUS=$(curl -s -o /dev/null -w '%{http_code}' -u ${USERNAME}:${PASSWORD} -H "Content-Type:text/turtle; charset=utf-8" --data-raw "${REPOSITORY_CONFIG}" -X POST http://${HOST}/\$/datasets) | ||
|
||
if [ "${STATUS}" -eq 200 ]; then | ||
echo "==> create repository done" | ||
return 0 | ||
else | ||
echo "==> create repository failed" | ||
return 1 | ||
fi | ||
} | ||
|
||
upload-graph() { | ||
STATUS=$(curl -s -o /dev/null -w '%{http_code}' -u ${USERNAME}:${PASSWORD} -H "Content-Type:text/turtle; charset=utf-8" --data-binary @$1 -X PUT http://${HOST}/${REPOSITORY}\?graph\="$2") | ||
|
||
if [ "${STATUS}" -eq 201 ]; then | ||
echo "==> 201 Created: $1 -> $2" | ||
return 0 | ||
elif [ "${STATUS}" -eq 200 ]; then | ||
echo "==> 200 OK: $1 -> $2" | ||
return 0 | ||
else | ||
echo "==> failed with status code ${STATUS}: $1 -> $2" | ||
return 1 | ||
fi | ||
} |
Oops, something went wrong.