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