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.
9 # This tests problem report nr. 23
11 #LD_LIBRARY_PATH=/usr/local/pqxx/lib
12 #export LD_LIBRARY_PATH
21 if psql gnucomo_test -q <../src/database/create.sql >/dev/null
23 # Prepare the database
25 psql gnucomo_test -q -c "insert into object (objectname) values ('example1.gnucomo.test')"
26 psql gnucomo_test -q -c "insert into object (objectname) values ('example2.gnucomo.test')"
27 psql gnucomo_test -q -c "delete from service"
29 # read logs for both objects
31 ../src/gcm_input/gcm_input -c gnucomo_test -h example1.gnucomo.test -d 'sep 5 2002 20:30:45' <messages.bad
32 ../src/gcm_input/gcm_input -c gnucomo_test -h example2.gnucomo.test -d 'sep 5 2002 20:30:45' <messages
34 # Make the notifications.
35 cd ../src/gcm_daemon; ./gcm_daemon.php -c gnucomo_test; cd ../../test
37 # Check the notifications, 3 for each object.
39 NR_NOTIF1=`psql gnucomo_test -q -t -c "select count(*) from notification where objectid=1"`
40 NR_NOTIF2=`psql gnucomo_test -q -t -c "select count(*) from notification where objectid=2"`
42 if [[ $NR_NOTIF1 -ne 3 ]]
44 echo "$NR_NOTIF1 notifications for object 1 (3 expected)."
48 if [[ $NR_NOTIF2 -ne 3 ]]
50 echo "$NR_NOTIF2 notifications for object 2 (3 expected)."
56 psql gnucomo_test -f ../src/database/destroy.sql -q
61 echo Can not create test database