29ddde0073dab96745029344850c91c24af5edeb
[gnucomo.git] / test / t0009.sh
1 #!/bin/sh
2
3 #
4 #  Test the service and log check notifications.
5 #  Create a database with two objects and no services. After reading two
6 #  log file fragments for these two objects, gcm_daemon should create
7 #  several notifications, three for each object.
8 #
9 #  This tests problem report nr. 23
10
11 LD_LIBRARY_PATH=/usr/local/pqxx/lib
12 export LD_LIBRARY_PATH
13
14 cd ..
15
16 if psql gnucomo_test -f src/database/create.sql -q >/dev/null
17 then
18    #  Prepare the database
19
20    psql gnucomo_test -q -c "insert into object (objectname) values ('kithira.andromeda.nl')"
21    psql gnucomo_test -q -c "insert into object (objectname) values ('vd.wt.tno.nl')"
22    psql gnucomo_test -q -c "delete from service"
23
24    #  read logs for both objects
25
26    src/gcm_input/gcm_input -c gnucomo_test -h vd.wt.tno.nl -d 'sep 5 2002 20:30:45' <test/vd.messages
27    src/gcm_input/gcm_input -c gnucomo_test -h kithira.andromeda.nl -d 'sep 5 2002 20:30:45' <test/messages
28
29    # Make the notifications.
30    src/gcm_daemon/gcm_daemon.php -c gnucomo_test
31
32    # Check the notifications.
33
34    psql gnucomo_test -c "select notificationid,objectid,type_of_issueid from notification"
35
36    #  Clean up.
37
38    psql gnucomo_test -f src/database/destroy.sql -q
39
40    exit 0
41 else
42    echo Can not create test database
43    exit 1
44 fi