1 #!/bin/sh 2 3 THIS_DIR=`dirname $0` 4 BASE_DIR="$THIS_DIR/.." 5 6 TEMPLATES="$THIS_DIR/templates" 7 RESOURCE_SCRIPT="$BASE_DIR/imip_resource.py" 8 FREEBUSY_SCRIPT="$BASE_DIR/tools/make_freebusy.py" 9 SHOWMAIL="$BASE_DIR/tools/showmail.py" 10 STORE=/tmp/store 11 STATIC=/tmp/static 12 PREFS=/tmp/prefs 13 ARGS="-S $STORE -P $STATIC -p $PREFS -d" 14 FBARGS="-s -n" 15 USER="mailto:resource-room-confroom@example.com" 16 ERROR=err.tmp 17 18 rm -r $STORE 19 rm -r $STATIC 20 rm -r $PREFS 21 rm $ERROR 22 rm out*.tmp 23 24 mkdir -p "$PREFS/$USER" 25 echo 'Europe/Oslo' > "$PREFS/$USER/TZID" 26 echo 'share' > "$PREFS/$USER/freebusy_sharing" 27 28 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-all.txt" 2>> $ERROR \ 29 | "$SHOWMAIL" \ 30 > out0.tmp 31 32 grep -q 'METHOD:REPLY' out0.tmp \ 33 && ! grep -q '^FREEBUSY' out0.tmp \ 34 && echo "Success" \ 35 || echo "Failed" 36 37 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring-indefinitely.txt" 2>> $ERROR \ 38 | "$SHOWMAIL" \ 39 > out2.tmp 40 41 grep -q 'METHOD:REPLY' out2.tmp \ 42 && grep -q 'ATTENDEE;PARTSTAT=ACCEPTED' out2.tmp \ 43 && echo "Success" \ 44 || echo "Failed" 45 46 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-all.txt" 2>> $ERROR \ 47 | "$SHOWMAIL" \ 48 > out3.tmp 49 50 grep -q 'METHOD:REPLY' out3.tmp \ 51 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141114T090000Z/20141114T100000Z' out3.tmp \ 52 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141212T090000Z/20141212T100000Z' out3.tmp \ 53 && grep -q 'FREEBUSY;FBTYPE=BUSY:20150109T090000Z/20150109T100000Z' out3.tmp \ 54 && echo "Success" \ 55 || echo "Failed" 56 57 PYTHONPATH="$BASE_DIR" "$FREEBUSY_SCRIPT" "$USER" $FBARGS $ARGS 2>> $ERROR 58 59 grep -q 'event14@example.com' "$STORE/$USER/freebusy-providers" \ 60 && echo "Success" \ 61 || echo "Failed" 62 63 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-recurring-indefinitely.txt" 2>> $ERROR 64 echo "Cancel..." 65 66 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-all.txt" 2>> $ERROR \ 67 | "$SHOWMAIL" \ 68 > out4.tmp 69 70 grep -q 'METHOD:REPLY' out4.tmp \ 71 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141114T090000Z/20141114T100000Z' out4.tmp \ 72 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141212T090000Z/20141212T100000Z' out4.tmp \ 73 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20150109T090000Z/20150109T100000Z' out4.tmp \ 74 && echo "Success" \ 75 || echo "Failed" 76 77 ! grep -q 'event14@example.com' "$STORE/$USER/freebusy-providers" \ 78 && echo "Success" \ 79 || echo "Failed" 80 81 # Re-add event to test scheduling and presence in the freebusy-providers file. 82 83 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring-indefinitely.txt" 2>> $ERROR \ 84 | "$SHOWMAIL" \ 85 > out5.tmp 86 87 grep -q 'METHOD:REPLY' out5.tmp \ 88 && grep -q 'ATTENDEE;PARTSTAT=ACCEPTED' out5.tmp \ 89 && echo "Success" \ 90 || echo "Failed" 91 92 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-all.txt" 2>> $ERROR \ 93 | "$SHOWMAIL" \ 94 > out6.tmp 95 96 grep -q 'METHOD:REPLY' out6.tmp \ 97 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141114T090000Z/20141114T100000Z' out6.tmp \ 98 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141212T090000Z/20141212T100000Z' out6.tmp \ 99 && grep -q 'FREEBUSY;FBTYPE=BUSY:20150109T090000Z/20150109T100000Z' out6.tmp \ 100 && echo "Success" \ 101 || echo "Failed" 102 103 grep -q 'event14@example.com' "$STORE/$USER/freebusy-providers" \ 104 && echo "Success" \ 105 || echo "Failed"