4 # Create an object 'kithira.andromeda.nl' in the database and
5 # parse a piece of a XML file.
12 if psql gnucomo_test -q <../src/database/create.sql >/dev/null
14 psql gnucomo_test -q -c "insert into object (objectname) values ('kithira.andromeda.nl')"
16 # read logs from an XML file. 2 log entries are expected
17 echo "Read a good XML file"
18 ../src/gcm_input/gcm_input -v -c gnucomo_test <log.xml
19 NR_LOGS=`psql gnucomo_test -q -t -c "select count(*) from log"`
20 echo $NR_LOGS log entries in the datebase
22 # read a bad XML file, resulting in a parse error
23 psql gnucomo_test -q -t -c "delete from log"
24 echo "Read a bad XML file"
25 ../src/gcm_input/gcm_input -v -c gnucomo_test <log_bad.xml
27 echo "gcm_input returned $result"
29 if [[ $result -eq 1 ]]
31 # check if nothing was stored in the (existing) database
32 NR_LOGS=`psql gnucomo_test -q -t -c "select count(*) from log"`
33 if [[ $NR_LOGS -eq 0 ]]
35 echo "No log entries in database"
38 # check if the saved XML file exists
39 SAVEDFILE=`grep 'XML content stored' gcm_input.log |cut -d ' ' -f 12`
40 echo "Saved file is $SAVEDFILE"
41 if [[ ! -e $SAVEDFILE ]]
43 echo $SAVEDFILE does not exist.
46 rm $SAVEDFILE # cleanup
48 echo "gcm_input did not return an error"
52 psql gnucomo_test -f ../src/database/destroy.sql -q
54 echo Can not create test database