paul@594 | 1 | #!/bin/sh |
paul@594 | 2 | |
paul@1024 | 3 | . "`dirname \"$0\"`/common.sh" |
paul@594 | 4 | |
paul@594 | 5 | USER="mailto:vincent.vole@example.com" |
paul@594 | 6 | SENDER="mailto:paul.boddie@example.com" |
paul@594 | 7 | FBFILE="$STORE/$USER/freebusy" |
paul@594 | 8 | FBOTHERFILE="$STORE/$USER/freebusy-other/$SENDER" |
paul@685 | 9 | FBSENDERFILE="$STORE/$SENDER/freebusy" |
paul@594 | 10 | |
paul@640 | 11 | mkdir -p "$PREFS/$USER" |
paul@640 | 12 | echo 'Europe/Oslo' > "$PREFS/$USER/TZID" |
paul@640 | 13 | echo 'share' > "$PREFS/$USER/freebusy_sharing" |
paul@640 | 14 | |
paul@685 | 15 | mkdir -p "$PREFS/$SENDER" |
paul@685 | 16 | echo 'Europe/Oslo' > "$PREFS/$USER/TZID" |
paul@685 | 17 | |
paul@685 | 18 | # Test free/busy responses. |
paul@685 | 19 | |
paul@602 | 20 | "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \ |
paul@594 | 21 | | "$SHOWMAIL" \ |
paul@594 | 22 | > out0.tmp |
paul@594 | 23 | |
paul@594 | 24 | grep -q 'METHOD:REPLY' out0.tmp \ |
paul@594 | 25 | && ! grep -q '^FREEBUSY' out0.tmp \ |
paul@594 | 26 | && echo "Success" \ |
paul@594 | 27 | || echo "Failed" |
paul@594 | 28 | |
paul@602 | 29 | "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person.txt" 2>> $ERROR \ |
paul@594 | 30 | | "$SHOWMAIL" \ |
paul@594 | 31 | > out1.tmp |
paul@594 | 32 | |
paul@594 | 33 | grep -q 'METHOD:REPLY' out1.tmp \ |
paul@594 | 34 | && ! grep -q '^FREEBUSY' out1.tmp \ |
paul@594 | 35 | && echo "Success" \ |
paul@594 | 36 | || echo "Failed" |
paul@594 | 37 | |
paul@685 | 38 | # Publish an event, testing registration in the outgoing handler. |
paul@685 | 39 | |
paul@685 | 40 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR |
paul@685 | 41 | |
paul@685 | 42 | grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDERFILE" \ |
paul@685 | 43 | && echo "Success" \ |
paul@685 | 44 | || echo "Failed" |
paul@685 | 45 | |
paul@685 | 46 | # Test registration in the incoming handler for the recipient. |
paul@685 | 47 | |
paul@602 | 48 | "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR \ |
paul@594 | 49 | | "$SHOWMAIL" \ |
paul@594 | 50 | > out2.tmp |
paul@594 | 51 | |
paul@594 | 52 | ! grep -q 'METHOD:REPLY' out2.tmp \ |
paul@594 | 53 | && echo "Success" \ |
paul@594 | 54 | || echo "Failed" |
paul@594 | 55 | |
paul@708 | 56 | ! [ -e "$FBFILE" ] \ |
paul@708 | 57 | || ! grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \ |
paul@594 | 58 | && echo "Success" \ |
paul@594 | 59 | || echo "Failed" |
paul@594 | 60 | |
paul@594 | 61 | grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBOTHERFILE" \ |
paul@594 | 62 | && echo "Success" \ |
paul@594 | 63 | || echo "Failed" |
paul@594 | 64 | |
paul@685 | 65 | # Test acceptance and registration in the outgoing handler. |
paul@685 | 66 | |
paul@673 | 67 | "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \ |
paul@594 | 68 | | tee out3.tmp \ |
paul@673 | 69 | | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR |
paul@594 | 70 | |
paul@594 | 71 | grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \ |
paul@594 | 72 | && echo "Success" \ |
paul@594 | 73 | || echo "Failed" |
paul@594 | 74 | |
paul@685 | 75 | # Test recurrence cancellation in the outgoing handler. |
paul@685 | 76 | |
paul@685 | 77 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring-instance.txt" 2>> $ERROR |
paul@685 | 78 | |
paul@685 | 79 | [ `grep "event8@example.com" "$FBSENDERFILE" | wc -l` = '2' ] \ |
paul@685 | 80 | && ! grep -q "^20141114T090000Z${TAB}20141114T100000Z" "$FBSENDERFILE" \ |
paul@685 | 81 | && echo "Success" \ |
paul@685 | 82 | || echo "Failed" |
paul@685 | 83 | |
paul@685 | 84 | # Test cancellation in the incoming handler. |
paul@685 | 85 | |
paul@602 | 86 | "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring-instance.txt" 2>> $ERROR \ |
paul@594 | 87 | | "$SHOWMAIL" \ |
paul@594 | 88 | > out4.tmp |
paul@594 | 89 | |
paul@594 | 90 | ! grep -q 'METHOD:REPLY' out4.tmp \ |
paul@594 | 91 | && echo "Success" \ |
paul@594 | 92 | || echo "Failed" |
paul@594 | 93 | |
paul@594 | 94 | [ `grep "event8@example.com" "$FBFILE" | wc -l` = '2' ] \ |
paul@594 | 95 | && ! grep -q "^20141114T090000Z${TAB}20141114T100000Z" "$FBFILE" \ |
paul@594 | 96 | && echo "Success" \ |
paul@594 | 97 | || echo "Failed" |
paul@594 | 98 | |
paul@594 | 99 | [ `grep "event8@example.com" "$FBOTHERFILE" | wc -l` = '2' ] \ |
paul@594 | 100 | && ! grep -q "^20141114T090000Z${TAB}20141114T100000Z" "$FBOTHERFILE" \ |
paul@594 | 101 | && echo "Success" \ |
paul@594 | 102 | || echo "Failed" |
paul@594 | 103 | |
paul@685 | 104 | # Test rescheduling in the outgoing handler. |
paul@685 | 105 | |
paul@685 | 106 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-reschedule-instance.txt" 2>> $ERROR |
paul@685 | 107 | |
paul@685 | 108 | grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBSENDERFILE" \ |
paul@685 | 109 | && ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBSENDERFILE" \ |
paul@685 | 110 | && echo "Success" \ |
paul@685 | 111 | || echo "Failed" |
paul@685 | 112 | |
paul@685 | 113 | # Test rescheduling in the incoming handler. |
paul@685 | 114 | |
paul@602 | 115 | "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-reschedule-instance.txt" 2>> $ERROR \ |
paul@594 | 116 | | "$SHOWMAIL" \ |
paul@594 | 117 | > out5.tmp |
paul@594 | 118 | |
paul@594 | 119 | ! grep -q 'METHOD:REPLY' out5.tmp \ |
paul@594 | 120 | && echo "Success" \ |
paul@594 | 121 | || echo "Failed" |
paul@594 | 122 | |
paul@594 | 123 | ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBFILE" \ |
paul@594 | 124 | && grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBFILE" \ |
paul@594 | 125 | && echo "Success" \ |
paul@594 | 126 | || echo "Failed" |
paul@594 | 127 | |
paul@594 | 128 | grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBOTHERFILE" \ |
paul@594 | 129 | && ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBOTHERFILE" \ |
paul@594 | 130 | && echo "Success" \ |
paul@594 | 131 | || echo "Failed" |
paul@594 | 132 | |
paul@685 | 133 | # Test rescheduling acceptance in the outgoing handler. |
paul@685 | 134 | |
paul@673 | 135 | "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" "20141010T080000Z" 2>> $ERROR \ |
paul@594 | 136 | | tee out6.tmp \ |
paul@673 | 137 | | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR |
paul@594 | 138 | |
paul@594 | 139 | grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBFILE" \ |
paul@594 | 140 | && ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBFILE" \ |
paul@594 | 141 | && echo "Success" \ |
paul@594 | 142 | || echo "Failed" |
paul@594 | 143 | |
paul@685 | 144 | # Test complete cancellation in the outgoing handler. |
paul@685 | 145 | |
paul@685 | 146 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring.txt" 2>> $ERROR |
paul@685 | 147 | |
paul@685 | 148 | ! grep -q "event8@example.com" "$FBSENDERFILE" \ |
paul@685 | 149 | && echo "Success" \ |
paul@685 | 150 | || echo "Failed" |
paul@685 | 151 | |
paul@685 | 152 | # Test complete cancellation in the incoming handler. |
paul@685 | 153 | |
paul@602 | 154 | "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring.txt" 2>> $ERROR \ |
paul@594 | 155 | | "$SHOWMAIL" \ |
paul@594 | 156 | > out6.tmp |
paul@594 | 157 | |
paul@594 | 158 | ! grep -q 'METHOD:REPLY' out6.tmp \ |
paul@594 | 159 | && echo "Success" \ |
paul@594 | 160 | || echo "Failed" |
paul@594 | 161 | |
paul@594 | 162 | ! grep -q "event8@example.com" "$FBFILE" \ |
paul@594 | 163 | && echo "Success" \ |
paul@594 | 164 | || echo "Failed" |
paul@594 | 165 | |
paul@594 | 166 | ! grep -q "event8@example.com" "$FBOTHERFILE" \ |
paul@594 | 167 | && echo "Success" \ |
paul@594 | 168 | || echo "Failed" |
paul@644 | 169 | |
paul@644 | 170 | # Switch time zones. |
paul@644 | 171 | |
paul@644 | 172 | echo 'Europe/Mariehamn' > "$PREFS/$USER/TZID" |
paul@644 | 173 | |
paul@685 | 174 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR |
paul@685 | 175 | |
paul@685 | 176 | grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDERFILE" \ |
paul@685 | 177 | && echo "Success" \ |
paul@685 | 178 | || echo "Failed" |
paul@685 | 179 | |
paul@644 | 180 | "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR \ |
paul@644 | 181 | | "$SHOWMAIL" \ |
paul@644 | 182 | > out7.tmp |
paul@644 | 183 | |
paul@644 | 184 | ! grep -q 'METHOD:REPLY' out7.tmp \ |
paul@644 | 185 | && echo "Success" \ |
paul@644 | 186 | || echo "Failed" |
paul@644 | 187 | |
paul@644 | 188 | ! grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \ |
paul@644 | 189 | && echo "Success" \ |
paul@644 | 190 | || echo "Failed" |
paul@644 | 191 | |
paul@644 | 192 | grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBOTHERFILE" \ |
paul@644 | 193 | && echo "Success" \ |
paul@644 | 194 | || echo "Failed" |
paul@644 | 195 | |
paul@673 | 196 | "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \ |
paul@644 | 197 | | tee out8.tmp \ |
paul@673 | 198 | | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR |
paul@644 | 199 | |
paul@644 | 200 | grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \ |
paul@644 | 201 | && echo "Success" \ |
paul@644 | 202 | || echo "Failed" |
paul@644 | 203 | |
paul@685 | 204 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring.txt" 2>> $ERROR |
paul@685 | 205 | |
paul@685 | 206 | ! grep -q "event8@example.com" "$FBSENDERFILE" \ |
paul@685 | 207 | && echo "Success" \ |
paul@685 | 208 | || echo "Failed" |
paul@685 | 209 | |
paul@644 | 210 | "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring.txt" 2>> $ERROR \ |
paul@644 | 211 | | "$SHOWMAIL" \ |
paul@644 | 212 | > out9.tmp |
paul@644 | 213 | |
paul@644 | 214 | ! grep -q 'METHOD:REPLY' out9.tmp \ |
paul@644 | 215 | && echo "Success" \ |
paul@644 | 216 | || echo "Failed" |
paul@644 | 217 | |
paul@644 | 218 | ! grep -q "event8@example.com" "$FBFILE" \ |
paul@644 | 219 | && echo "Success" \ |
paul@644 | 220 | || echo "Failed" |
paul@644 | 221 | |
paul@644 | 222 | ! grep -q "event8@example.com" "$FBOTHERFILE" \ |
paul@644 | 223 | && echo "Success" \ |
paul@644 | 224 | || echo "Failed" |
paul@644 | 225 | |
paul@685 | 226 | # Test floating dates. Here, the outgoing interpretation is different because |
paul@685 | 227 | # the sender is in a different time zone. |
paul@685 | 228 | |
paul@685 | 229 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-day-floating.txt" 2>> $ERROR |
paul@685 | 230 | |
paul@685 | 231 | grep -q "^20141211T230000Z${TAB}20141212T230000Z" "$FBSENDERFILE" \ |
paul@685 | 232 | && echo "Success" \ |
paul@685 | 233 | || echo "Failed" |
paul@685 | 234 | |
paul@644 | 235 | "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-day-floating.txt" 2>> $ERROR \ |
paul@644 | 236 | | "$SHOWMAIL" \ |
paul@644 | 237 | > out10.tmp |
paul@644 | 238 | |
paul@644 | 239 | ! grep -q 'METHOD:REPLY' out10.tmp \ |
paul@644 | 240 | && echo "Success" \ |
paul@644 | 241 | || echo "Failed" |
paul@644 | 242 | |
paul@644 | 243 | ! grep -q "^20141211T220000Z${TAB}20141212T220000Z" "$FBFILE" \ |
paul@644 | 244 | && echo "Success" \ |
paul@644 | 245 | || echo "Failed" |
paul@644 | 246 | |
paul@697 | 247 | # (The organiser is not attending.) |
paul@697 | 248 | |
paul@697 | 249 | ! grep -q "^20141211T220000Z${TAB}20141212T220000Z" "$FBOTHERFILE" \ |
paul@644 | 250 | && echo "Success" \ |
paul@644 | 251 | || echo "Failed" |
paul@644 | 252 | |
paul@673 | 253 | "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event12@example.com" 2>> $ERROR \ |
paul@644 | 254 | | tee out11.tmp \ |
paul@673 | 255 | | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR |
paul@644 | 256 | |
paul@644 | 257 | grep -q "^20141211T220000Z${TAB}20141212T220000Z" "$FBFILE" \ |
paul@644 | 258 | && echo "Success" \ |
paul@644 | 259 | || echo "Failed" |