forked from dbernstein/fcrepo-performance-test-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
n-children.sh
executable file
·37 lines (28 loc) · 901 Bytes
/
n-children.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
#!/bin/bash
if [ "$1" == "" ]; then
echo "There must be a exactly 1 argument!"
echo "- number objects"
exit 1;
fi
BASE=http://localhost:8080/rest/$RANDOM
curl -X PUT $BASE && echo
curl -X PUT -H "Content-Type: text/turtle" -d "
@prefix test: <http://www.example.org/ns/test#> .
<> a test:Container ." $BASE && echo
N=0
MAX=$1
while [ $N -lt $MAX ]; do
curl -s -X POST -H "Content-Type: text/turtle" -d "
@prefix test: <http://www.example.org/ns/test#> .
<> a test:Container ." $BASE/ > /dev/null
N=$(( $N + 1 ))
if [ $(( $N % 500 )) == 0 ]; then
echo $N objects
fi
done
echo retrieving $BASE to warm cache
time curl -s -H "Accept: application/n-triples" $BASE > /dev/null
echo retrieving $BASE
time curl -s -H "Accept: application/n-triples" $BASE > n-children.nt
CONTAINED=`grep -c 'ldp#contains' n-children.nt`
echo "Number of contained children: $CONTAINED"