1 #!/bin/sh 2 3 THIS_DIR=`dirname $0` 4 5 TEMPLATES="$THIS_DIR/templates" 6 RESOURCE_SCRIPT="$THIS_DIR/../imip_resource.py" 7 SHOWMAIL="$THIS_DIR/../tools/showmail.py" 8 STORE=/tmp/store 9 STATIC=/tmp/static 10 PREFS=/tmp/prefs 11 ARGS="-S $STORE -P $STATIC -p $PREFS -d" 12 USER="mailto:resource-room-confroom@example.com" 13 ERROR=err.tmp 14 15 rm -rf $STORE 16 rm -rf $STATIC 17 rm -rf $PREFS 18 rm -f $ERROR 19 rm -f out*.tmp 20 21 mkdir -p "$PREFS/$USER" 22 echo 'Europe/Oslo' > "$PREFS/$USER/TZID" 23 echo 'share' > "$PREFS/$USER/freebusy_sharing" 24 25 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-all.txt" 2>> $ERROR \ 26 | "$SHOWMAIL" \ 27 > out0.tmp 28 29 grep -q 'METHOD:REPLY' out0.tmp \ 30 && ! grep -q '^FREEBUSY' out0.tmp \ 31 && echo "Success" \ 32 || echo "Failed" 33 34 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring-exdate.txt" 2>> $ERROR \ 35 | "$SHOWMAIL" \ 36 > out2.tmp 37 38 grep -q 'METHOD:REPLY' out2.tmp \ 39 && grep -q 'ATTENDEE;PARTSTAT=ACCEPTED' out2.tmp \ 40 && echo "Success" \ 41 || echo "Failed" 42 43 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-all.txt" 2>> $ERROR \ 44 | "$SHOWMAIL" \ 45 > out3.tmp 46 47 grep -q 'METHOD:REPLY' out3.tmp \ 48 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141114T090000Z/20141114T100000Z' out3.tmp \ 49 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141212T090000Z/20141212T100000Z' out3.tmp \ 50 && grep -q 'FREEBUSY;FBTYPE=BUSY:20150109T090000Z/20150109T100000Z' out3.tmp \ 51 && echo "Success" \ 52 || echo "Failed" 53 54 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-recurring-exdate.txt" 2>> $ERROR 55 echo "Cancel..." 56 57 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-all.txt" 2>> $ERROR \ 58 | "$SHOWMAIL" \ 59 > out4.tmp 60 61 grep -q 'METHOD:REPLY' out4.tmp \ 62 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141114T090000Z/20141114T100000Z' out4.tmp \ 63 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20150109T090000Z/20150109T100000Z' out4.tmp \ 64 && echo "Success" \ 65 || echo "Failed" 66 67 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring-exdate-floating.txt" 2>> $ERROR \ 68 | "$SHOWMAIL" \ 69 > out5.tmp 70 71 grep -q 'METHOD:REPLY' out5.tmp \ 72 && grep -q 'ATTENDEE;PARTSTAT=ACCEPTED' out5.tmp \ 73 && echo "Success" \ 74 || echo "Failed" 75 76 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-all.txt" 2>> $ERROR \ 77 | "$SHOWMAIL" \ 78 > out6.tmp 79 80 grep -q 'METHOD:REPLY' out6.tmp \ 81 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141114T090000Z/20141114T100000Z' out6.tmp \ 82 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141212T090000Z/20141212T100000Z' out6.tmp \ 83 && grep -q 'FREEBUSY;FBTYPE=BUSY:20150109T090000Z/20150109T100000Z' out6.tmp \ 84 && echo "Success" \ 85 || echo "Failed" 86 87 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-recurring-exdate-floating.txt" 2>> $ERROR 88 echo "Cancel..." 89 90 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-all.txt" 2>> $ERROR \ 91 | "$SHOWMAIL" \ 92 > out7.tmp 93 94 grep -q 'METHOD:REPLY' out7.tmp \ 95 && ! grep -q '^FREEBUSY' out7.tmp \ 96 && echo "Success" \ 97 || echo "Failed" 98 99 # Switch time zones. 100 101 echo 'Europe/Mariehamn' > "$PREFS/$USER/TZID" 102 103 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring-exdate.txt" 2>> $ERROR \ 104 | "$SHOWMAIL" \ 105 > out8.tmp 106 107 grep -q 'METHOD:REPLY' out8.tmp \ 108 && grep -q 'ATTENDEE;PARTSTAT=ACCEPTED' out8.tmp \ 109 && echo "Success" \ 110 || echo "Failed" 111 112 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-all.txt" 2>> $ERROR \ 113 | "$SHOWMAIL" \ 114 > out9.tmp 115 116 grep -q 'METHOD:REPLY' out9.tmp \ 117 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141114T090000Z/20141114T100000Z' out9.tmp \ 118 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141212T090000Z/20141212T100000Z' out9.tmp \ 119 && grep -q 'FREEBUSY;FBTYPE=BUSY:20150109T090000Z/20150109T100000Z' out9.tmp \ 120 && echo "Success" \ 121 || echo "Failed" 122 123 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-recurring-exdate.txt" 2>> $ERROR 124 echo "Cancel..." 125 126 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-all.txt" 2>> $ERROR \ 127 | "$SHOWMAIL" \ 128 > out10.tmp 129 130 grep -q 'METHOD:REPLY' out10.tmp \ 131 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141114T090000Z/20141114T100000Z' out10.tmp \ 132 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20150109T090000Z/20150109T100000Z' out10.tmp \ 133 && echo "Success" \ 134 || echo "Failed" 135 136 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring-exdate-floating.txt" 2>> $ERROR \ 137 | "$SHOWMAIL" \ 138 > out11.tmp 139 140 grep -q 'METHOD:REPLY' out11.tmp \ 141 && grep -q 'ATTENDEE;PARTSTAT=ACCEPTED' out11.tmp \ 142 && echo "Success" \ 143 || echo "Failed" 144 145 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-all.txt" 2>> $ERROR \ 146 | "$SHOWMAIL" \ 147 > out12.tmp 148 149 grep -q 'METHOD:REPLY' out12.tmp \ 150 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141114T080000Z/20141114T090000Z' out12.tmp \ 151 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141212T080000Z/20141212T090000Z' out12.tmp \ 152 && grep -q 'FREEBUSY;FBTYPE=BUSY:20150109T080000Z/20150109T090000Z' out12.tmp \ 153 && echo "Success" \ 154 || echo "Failed"