-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest-datomic.sh
executable file
·60 lines (42 loc) · 1.36 KB
/
test-datomic.sh
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
set -e
server=http://localhost:3000
scratch=target/test
rules_in=../naga/data/family.lg
data_in=../naga/data/in.json
schema_in=../naga/data/in.schema
function log() {
echo $1
echo ""
}
log "Clearing programs."
curl -s -X DELETE ${server}/rules
log
log "Loading data"
curl -s -X POST -H "Content-Type: application/json" -d @${data_in} ${server}/store/data
log
log "Retrieving data"
curl -s -H "Accept: application/json" ${server}/store/data | jq .
log
log "Setting up database."
curl -s -X POST -H "Content-Type: application/json" -d '{"type": "datomic", "uri": "datomic:sql://naga?jdbc:postgresql://localhost:5432/datomic?user=datomic&password=datomic"}' ${server}/store
log "Loading schema"
curl -s -X POST -H "Content-Type: text/plain" --data-binary @${schema_in} ${server}/store/schema
log
log "Loading data"
curl -s -X POST -H "Content-Type: application/json" -d @${data_in} ${server}/store/data
log
log "Retrieving data"
curl -s -H "Accept: application/json" ${server}/store/data | jq .
log
uuid=`curl -s -X POST -f -H "Content-Type: text/plain" -d @$rules_in $server/rules || echo FAIL`
if [ "$uuid" == "FAIL" ]; then
echo "Program installation failed."
exit -1
fi
log "Program installed with UUID = $uuid"
log "Installed program is:"
curl -s $server/rules/$uuid
log
log "Evaluation Result:"
curl -s -X POST $server/rules/$uuid/eval | jq .