Commit 7b413ad4 authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

Merge branch 'develop' into feature/#64-healthcheck

parents 24b3f376 4c946d5f
Pipeline #158780 passed with stages
in 5 minutes and 54 seconds
......@@ -40,17 +40,21 @@ test_exist_app:
- ant -f exist-app/build.xml test
- bash exist-app/test/bin/startup.sh | tee output.log &
- while [ $(curl --head --silent http://localhost:8080 | grep -c "200 OK") == 0 ]; do sleep 1s; done
- header=$(curl --head -s http://localhost:8080/exist/restxq/trigger-tests)
- status=$(echo $header | head -n 1 | cut -d" " -f 2)
- echo "Current HTTP status is $status."
- if [[ "$status" != "200" ]]; then exit 1; fi
- curl http://localhost:8080/exist/restxq/trigger-tests
- sleep 60
- bash exist-app/test/bin/shutdown.sh
- failures=$(./get-unit-test-failures-and-errors.sh)
- echo -e "\033[1;33mThere is/are currently $failures failures or errors.\033[0m"
- if [[ "$failures" -gt 0 ]]; then exit 1; else exit 0; fi
- if [[ "$failures" -gt 0 || ! -f "exist-app/test/ahikar-test-results.xml" ]]; then exit 1; else exit 0; fi
artifacts:
paths:
- exist-app/test/test-results.xml
- exist-app/test/ahikar-test-results.xml
reports:
junit: exist-app/test/test-results.xml
junit: exist-app/test/ahikar-test-results.xml
build_exist_app-all:
image: docker.gitlab.gwdg.de/fontane-notizbuecher/build:latest
......
......@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.0.0] - 2020-11-06
### Changed
- The AnnotationAPI is now served at `/api/annotations` instead of `/api/textapi`.
## [1.13.1] - 2020-10-06
### Fixed
- Unit tests are executed again.
### Changed
- The CI tests if 1. the unit test API is available and 2. the XML file resulting from the test exists.
## [1.13.0] - 2020-10-13
### Added
......
project.name=https://ahikar-test.sub.uni-goettingen.de/
project.version=1.13.0
project.version=2.0.0
project.title=TextAPI for Ahikar
project.abbrev=ahikar-test
project.processorversion=5.2.0
......
......@@ -71,7 +71,7 @@ declare variable $anno:uris :=
: it has mainly been designed for Ahikar's main collection, 3r132.
:
: For retrieving annotation information about other collections cf. the endpoint
: /textapi/ahikar/{$collection}/{$document}/annotationCollection.json
: /annotations/ahikar/{$collection}/{$document}/annotationCollection.json
:
: @param $collection The URI of the collection, e.g. '3r132'
: @return An Annotation Collecion for the given collection
......@@ -79,7 +79,7 @@ declare variable $anno:uris :=
declare
%rest:GET
%rest:HEAD
%rest:path("/textapi/ahikar/{$collection}/annotationCollection.json")
%rest:path("/annotations/ahikar/{$collection}/annotationCollection.json")
%output:method("json")
function anno:collection-rest($collection as xs:string) {
if (anno:are-resources-available($collection)) then
......@@ -106,8 +106,8 @@ declare function anno:make-annotationCollection($collection as xs:string, $docum
at this point it is relevant if $document is actually a manifest or a collection.
we have to create different paths containing $first and $last for the two of them,
namely
$server || "/textapi/ahikar/" || $document || "/" || $first || "/annotationPage.json" for $document being a collection
$server || "/textapi/ahikar/" || $collection || "/" || $document || "-" || $first || "/annotationPage.json" for $document being a manifest :)
$server || "/annotations/ahikar/" || $document || "/" || $first || "/annotationPage.json" for $document being a collection
$server || "/annotations/ahikar/" || $collection || "/" || $document || "-" || $first || "/annotationPage.json" for $document being a manifest :)
if ($document and anno:find-in-map($anno:uris, $document) instance of map()) then
anno:get-information-for-collection-object($document, $server)
......@@ -117,8 +117,8 @@ declare function anno:make-annotationCollection($collection as xs:string, $docum
let $tei := anno:find-in-map($anno:uris, $document)
let $pages := anno:get-pages-in-TEI($tei)
let $title := anno:get-metadata-title($document)
let $first-entry := $server || "/api/textapi/ahikar/" || $collection || "/" || $document || "-" || $pages[1] || "/annotationPage.json"
let $last-entry := $server || "/api/textapi/ahikar/" || $collection || "/" || $document || "-" || $pages[last()] || "/annotationPage.json"
let $first-entry := $server || "/api/annotations/ahikar/" || $collection || "/" || $document || "-" || $pages[1] || "/annotationPage.json"
let $last-entry := $server || "/api/annotations/ahikar/" || $collection || "/" || $document || "-" || $pages[last()] || "/annotationPage.json"
return
anno:make-annotationCollection-map($document, $title, $first-entry, $last-entry)
......@@ -144,8 +144,8 @@ declare function anno:get-information-for-collection-object($collectionURI as xs
let $first := $child-keys[1]
let $last := $child-keys[last()]
let $title := anno:get-metadata-title($collectionURI)
let $first-entry := $server || "/api/textapi/ahikar/" || $collectionURI || "/" || $first || "/annotationPage.json"
let $last-entry := $server || "/api/textapi/ahikar/" || $collectionURI || "/" || $last || "/annotationPage.json"
let $first-entry := $server || "/api/annotations/ahikar/" || $collectionURI || "/" || $first || "/annotationPage.json"
let $last-entry := $server || "/api/annotations/ahikar/" || $collectionURI || "/" || $last || "/annotationPage.json"
return
anno:make-annotationCollection-map($collectionURI, $title, $first-entry, $last-entry)
......@@ -227,7 +227,7 @@ declare function anno:get-creator($uri as xs:string) as xs:string {
declare
%rest:GET
%rest:HEAD
%rest:path("/api/textapi/ahikar/{$collection}/{$document}/annotationPage.json")
%rest:path("/api/annotations/ahikar/{$collection}/{$document}/annotationPage.json")
%output:method("json")
function anno:annotationPage-for-collection-rest($collection as xs:string,
$document as xs:string) {
......@@ -304,7 +304,7 @@ $document as xs:string, $server as xs:string) {
declare
%rest:GET
%rest:HEAD
%rest:path("/api/textapi/ahikar/{$collection}/{$document}/annotationCollection.json")
%rest:path("/api/annotations/ahikar/{$collection}/{$document}/annotationCollection.json")
%output:method("json")
function anno:manifest-rest($collection as xs:string,
$document as xs:string) {
......@@ -335,7 +335,7 @@ $document as xs:string) {
declare
%rest:GET
%rest:HEAD
%rest:path("/api/textapi/ahikar/{$collection}/{$document}-{$page}/annotationCollection.json")
%rest:path("/api/annotations/ahikar/{$collection}/{$document}-{$page}/annotationCollection.json")
%output:method("json")
function anno:annotationCollection-for-manifest-rest($collection as xs:string,
$document as xs:string, $page as xs:string) {
......@@ -378,7 +378,7 @@ $document as xs:string, $page as xs:string, $server as xs:string) {
"label": "Ahikar annotations for textgrid:" || $document || ": " || $title || ", page " || $page,
"x-creator": anno:get-creator($document),
"total": anno:get-total-no-of-annotations($page),
"first": $server || "/api/textapi/ahikar/" || $collection || "/" || $document || "-" || $page || "/annotationPage.json"
"first": $server || "/api/annotations/ahikar/" || $collection || "/" || $document || "-" || $page || "/annotationPage.json"
}
}
};
......@@ -403,7 +403,7 @@ $document as xs:string, $page as xs:string, $server as xs:string) {
declare
%rest:GET
%rest:HEAD
%rest:path("/api/textapi/ahikar/{$collection}/{$document}-{$page}/annotationPage.json")
%rest:path("/api/annotations/ahikar/{$collection}/{$document}-{$page}/annotationPage.json")
%output:method("json")
function anno:annotationPage-for-manifest-rest($collection as xs:string,
$document as xs:string, $page as xs:string) {
......@@ -720,7 +720,7 @@ $document as xs:string?, $page as xs:string?, $server as xs:string) {
()
return
if ($document) then
$server || "/api/textapi/ahikar/" || $collection|| "/" || $document || $pageSuffix || "/annotationPage.json"
$server || "/api/annotations/ahikar/" || $collection|| "/" || $document || $pageSuffix || "/annotationPage.json"
else
()
};
......@@ -954,4 +954,4 @@ declare function anno:get-document($uri as xs:string, $type as xs:string) {
default return error(QName($anno:ns, "ANNO02"), "Unknown type " || $type)
return
doc($collection || $uri || ".xml")
};
\ No newline at end of file
};
......@@ -141,5 +141,5 @@ as xs:string {
declare function tapi-coll:make-annotationCollection-uri($server as xs:string,
$collection-uri as xs:string)
as xs:string {
$server || "/api/textapi/ahikar/" || $collection-uri || "/annotationCollection.json"
$server || "/api/annotations/ahikar/" || $collection-uri || "/annotationCollection.json"
};
......@@ -30,7 +30,7 @@ as element(object) {
<image>
<id>{tapi-item:make-facsimile-id($manifest-uri, $page, $server)}</id>
</image>
<annotationCollection>{$server}/api/textapi/ahikar/{$collection-uri}/{$manifest-uri}-{$page}/annotationCollection.json</annotationCollection>
<annotationCollection>{$server}/api/annotations/ahikar/{$collection-uri}/{$manifest-uri}-{$page}/annotationCollection.json</annotationCollection>
</object>
};
......
......@@ -29,7 +29,7 @@ as element(object) {
tapi-mani:make-current-location($manifest-uri)
}
<license>CC0-1.0</license>
<annotationCollection>{$server}/api/textapi/ahikar/{$collection-uri}/{$manifest-uri}/annotationCollection.json</annotationCollection>
<annotationCollection>{$server}/api/annotations/ahikar/{$collection-uri}/{$manifest-uri}/annotationCollection.json</annotationCollection>
{tapi-mani:make-sequences($collection-uri, $manifest-uri, $server)}
</object>
};
......@@ -139,4 +139,4 @@ element(x-location) {
return
<x-location>{$string}</x-location>
};
\ No newline at end of file
};
......@@ -14,12 +14,10 @@ module namespace testtrigger="http://ahikar.sub.uni-goettingen.de/ns/testtrigger
import module namespace rest="http://exquery.org/ns/restxq";
import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql";
import module namespace coll-tests="http://ahikar.sub.uni-goettingen.de/ns/coll-tests" at "../tests/collate-tests.xqm";
import module namespace ct="http://ahikar.sub.uni-goettingen.de/ns/commons-tests" at "../tests/commons-tests.xqm";
import module namespace t2ht="http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests" at "../tests/tei2html-tests.xqm";
import module namespace t2htextt="http://ahikar.sub.uni-goettingen.de/ns/tei2html-textprocessing-tests" at "../tests/tei2html-textprocessing-tests.xqm";
import module namespace ttt="http://ahikar.sub.uni-goettingen.de/ns/tapi/txt/tests" at "../tests/tapi-txt-tests.xqm";
import module namespace ct="http://ahikar.sub.uni-goettingen.de/ns/commons-tests" at "../tests/commons-tests.xqm";
import module namespace tct="http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests" at "../tests/tapi-collection-tests.xqm";
import module namespace thtmlt="http://ahikar.sub.uni-goettingen.de/ns/tapi/html/tests" at "../tests/tapi-html-tests.xqm";
import module namespace titemt="http://ahikar.sub.uni-goettingen.de/ns/tapi/item/tests" at "../tests/tapi-item-tests.xqm";
......@@ -35,6 +33,7 @@ import module namespace tt="http://ahikar.sub.uni-goettingen.de/ns/tapi/tests" a
:)
declare
%rest:GET
%rest:HEAD
%rest:path("/trigger-tests")
%rest:query-param("token", "{$token}")
function testtrigger:trigger($token)
......@@ -46,7 +45,6 @@ as item()? {
let $tests :=
(
test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/tests")),
test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/coll-tests")),
test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/commons-tests")),
test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tapi/collection/tests")),
test:suite(util:list-functions("http://ahikar.sub.uni-goettingen.de/ns/tei2html-tests")),
......@@ -62,7 +60,7 @@ as item()? {
let $testWrap := <tests time="{current-dateTime()}">{ $tests }</tests>
let $filename := $system-path || "test-results.xml"
let $filename := $system-path || "ahikar-test-results.xml"
let $file := file:serialize($testWrap, $filename, ())
return
......
......@@ -27,7 +27,16 @@ declare function local:move-and-rename($filename as xs:string) as item()* {
(: set admin password on deployment. Convert to string
so local development will not fail because of missing
env var. :)
sm:passwd("admin", string(environment-variable("EXIST_ADMIN_PW"))),
(
if(environment-variable("EXIST_ADMIN_PW_RIPEMD160"))
then
(update replace doc('/db/system/security/exist/accounts/admin.xml')//*:password/text() with text{ string(environment-variable("EXIST_ADMIN_PW_RIPEMD160")) },
update replace doc('/db/system/security/exist/accounts/admin.xml')//*:digestPassword/text() with text{ string(environment-variable("EXIST_ADMIN_PW_DIGEST")) })
else (: we do not have the env vars available, so we leave the configuration as it is :)
true()
),
(
(: register REST APIs :)
......
......@@ -198,7 +198,7 @@ function tct:make-sequence($collection-uri as xs:string) {
};
declare
%test:args("ahiqar_collection") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/textapi/ahikar/ahiqar_collection/annotationCollection.json")
%test:args("ahiqar_collection") %test:assertEquals("http://0.0.0.0:8080/exist/restxq/api/annotations/ahikar/ahiqar_collection/annotationCollection.json")
function tct:make-annotationCollection-uri($collection-uri as xs:string)
as xs:string {
tapi-coll:make-annotationCollection-uri($tc:server, $collection-uri)
......
......@@ -57,6 +57,7 @@ declare
%test:assertXPath("$result//*[local-name(.) = 'content'] = 'http://0.0.0.0:8080/exist/restxq/api/content/ahiqar_sample-82a.html' ")
(: checks if images connected to underlying pages are identified :)
%test:assertXPath("$result//*[local-name(.) = 'id'] = 'http://0.0.0.0:8080/exist/restxq/api/images/3r1nz' ")
%test:assertXPath("$result//*[local-name(.) = 'annotationCollection'] = 'http://0.0.0.0:8080/exist/restxq/api/annotations/ahikar/ahiqar_collection/ahiqar_agg-82a/annotationCollection.json' ")
function titemt:get-json($collection as xs:string,
$document as xs:string,
$page as xs:string)
......@@ -71,4 +72,4 @@ declare
%test:args("ahiqar_agg") %test:assertXPath("count($result[local-name(.) = 'lang']) = 2")
function titemt:make-language-elements($manifest-uri as xs:string) {
tapi-item:make-language-elements($manifest-uri)
};
\ No newline at end of file
};
......@@ -150,8 +150,10 @@ function tmt:get-valid-page-ids($manifest-uri as xs:string) {
};
declare
%test:args("ahiqar_collection", "ahiqar_agg") %test:assertXPath("$result//label = 'Beispieldatei zum Testen'")
%test:args("ahiqar_collection", "ahiqar_agg") %test:assertXPath("$result//id[matches(., '/api/textapi/ahikar/ahiqar_collection/ahiqar_agg/manifest.json')]")
%test:args("ahiqar_collection", "ahiqar_agg")
%test:assertXPath("$result//label = 'Beispieldatei zum Testen'")
%test:assertXPath("$result//id[matches(., '/api/textapi/ahikar/ahiqar_collection/ahiqar_agg/manifest.json')]")
%test:assertXPath("$result//annotationCollection[matches(., '/api/annotations/ahikar/ahiqar_collection/ahiqar_agg-82a/annotationCollection.json')] ")
function tmt:get-json($collection-uri as xs:string,
$manifest-uri as xs:string) {
tapi-mani:get-json($collection-uri, $manifest-uri, $tc:server)
......@@ -203,4 +205,3 @@ function tmt:get-json($collection-uri as xs:string,
$manifest-uri as xs:string) {
tapi-mani:get-json($collection-uri, $manifest-uri, $tc:server)
};
#!/bin/bash
failures=$(xmllint --xpath '/tests/testsuites/testsuite/@failures' exist-app/test/test-results.xml | egrep -o "[0-9]+")
errors=$(xmllint --xpath '/tests/testsuites/testsuite/@errors' exist-app/test/test-results.xml | egrep -o "[0-9]+")
failures=$(xmllint --xpath '/tests/testsuites/testsuite/@failures' exist-app/test/ahikar-test-results.xml | egrep -o "[0-9]+")
errors=$(xmllint --xpath '/tests/testsuites/testsuite/@errors' exist-app/test/ahikar-test-results.xml | egrep -o "[0-9]+")
problem_sum=0
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment