-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.xql
More file actions
37 lines (33 loc) · 811 Bytes
/
tests.xql
File metadata and controls
37 lines (33 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
xquery version "3.1";
import module namespace config="http://apps.jmmc.fr/exist/apps/oidb/config" at "modules/config.xqm";
let $doc := doc($config:app-root||"/tests.xml")
let $date := current-dateTime()
let $tests := <tests date="{$date}">
<user>{sm:id()}</user>
{(
<test><name>read-write-db</name>
{
try {
let $insert := if($doc//last) then () else update insert element last {"hello"} into $doc/*
let $op := update value $doc//last with $date
return
<ok/>
} catch * {
<error>{$err:description}</error>
}
}
</test>
,<test><name>app-root</name>
<info>{
$config:app-root
}</info>
</test>
,<test><name>data-root</name>
<info>{
$config:data-root
}</info>
</test>
)}</tests>
let $code := if ($tests//error) then 500 else 200
return
(response:set-status-code($code),$tests)