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 | |
paul@640 | 8 | mkdir -p "$PREFS/$USER" |
paul@640 | 9 | echo 'Europe/Oslo' > "$PREFS/$USER/TZID" |
paul@640 | 10 | echo 'share' > "$PREFS/$USER/freebusy_sharing" |
paul@640 | 11 | |
paul@685 | 12 | mkdir -p "$PREFS/$SENDER" |
paul@1133 | 13 | echo 'Europe/Oslo' > "$PREFS/$SENDER/TZID" |
paul@685 | 14 | |
paul@685 | 15 | # Test free/busy responses. |
paul@685 | 16 | |
paul@602 | 17 | "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \ |
paul@594 | 18 | | "$SHOWMAIL" \ |
paul@594 | 19 | > out0.tmp |
paul@594 | 20 | |
paul@594 | 21 | grep -q 'METHOD:REPLY' out0.tmp \ |
paul@594 | 22 | && ! grep -q '^FREEBUSY' out0.tmp \ |
paul@594 | 23 | && echo "Success" \ |
paul@594 | 24 | || echo "Failed" |
paul@594 | 25 | |
paul@602 | 26 | "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person.txt" 2>> $ERROR \ |
paul@594 | 27 | | "$SHOWMAIL" \ |
paul@594 | 28 | > out1.tmp |
paul@594 | 29 | |
paul@594 | 30 | grep -q 'METHOD:REPLY' out1.tmp \ |
paul@594 | 31 | && ! grep -q '^FREEBUSY' out1.tmp \ |
paul@594 | 32 | && echo "Success" \ |
paul@594 | 33 | || echo "Failed" |
paul@594 | 34 | |
paul@685 | 35 | # Publish an event, testing registration in the outgoing handler. |
paul@685 | 36 | |
paul@685 | 37 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR |
paul@685 | 38 | |
paul@1088 | 39 | "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ |
paul@1088 | 40 | > out1f.tmp |
paul@1088 | 41 | |
paul@1088 | 42 | grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out1f.tmp" \ |
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@1088 | 56 | "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ |
paul@1088 | 57 | > out2f.tmp |
paul@1088 | 58 | |
paul@1088 | 59 | ! grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out2f.tmp" \ |
paul@594 | 60 | && echo "Success" \ |
paul@594 | 61 | || echo "Failed" |
paul@594 | 62 | |
paul@1088 | 63 | "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \ |
paul@1088 | 64 | > out2o.tmp |
paul@1088 | 65 | |
paul@1088 | 66 | grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out2o.tmp" \ |
paul@594 | 67 | && echo "Success" \ |
paul@594 | 68 | || echo "Failed" |
paul@594 | 69 | |
paul@685 | 70 | # Test acceptance and registration in the outgoing handler. |
paul@685 | 71 | |
paul@673 | 72 | "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \ |
paul@594 | 73 | | tee out3.tmp \ |
paul@673 | 74 | | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR |
paul@594 | 75 | |
paul@1088 | 76 | "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ |
paul@1088 | 77 | > out3f.tmp |
paul@1088 | 78 | |
paul@1088 | 79 | grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out3f.tmp" \ |
paul@594 | 80 | && echo "Success" \ |
paul@594 | 81 | || echo "Failed" |
paul@594 | 82 | |
paul@685 | 83 | # Test recurrence cancellation in the outgoing handler. |
paul@685 | 84 | |
paul@685 | 85 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring-instance.txt" 2>> $ERROR |
paul@685 | 86 | |
paul@1088 | 87 | "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ |
paul@1088 | 88 | > out3s.tmp |
paul@1088 | 89 | |
paul@1088 | 90 | [ `grep "event8@example.com" "out3s.tmp" | wc -l` = '2' ] \ |
paul@1088 | 91 | && ! grep -q "^20141114T090000Z${TAB}20141114T100000Z" "out3s.tmp" \ |
paul@685 | 92 | && echo "Success" \ |
paul@685 | 93 | || echo "Failed" |
paul@685 | 94 | |
paul@685 | 95 | # Test cancellation in the incoming handler. |
paul@685 | 96 | |
paul@602 | 97 | "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring-instance.txt" 2>> $ERROR \ |
paul@594 | 98 | | "$SHOWMAIL" \ |
paul@594 | 99 | > out4.tmp |
paul@594 | 100 | |
paul@594 | 101 | ! grep -q 'METHOD:REPLY' out4.tmp \ |
paul@594 | 102 | && echo "Success" \ |
paul@594 | 103 | || echo "Failed" |
paul@594 | 104 | |
paul@1088 | 105 | "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ |
paul@1088 | 106 | > out4f.tmp |
paul@1088 | 107 | |
paul@1088 | 108 | [ `grep "event8@example.com" "out4f.tmp" | wc -l` = '2' ] \ |
paul@1088 | 109 | && ! grep -q "^20141114T090000Z${TAB}20141114T100000Z" "out4f.tmp" \ |
paul@594 | 110 | && echo "Success" \ |
paul@594 | 111 | || echo "Failed" |
paul@594 | 112 | |
paul@1088 | 113 | "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \ |
paul@1088 | 114 | > out4o.tmp |
paul@1088 | 115 | |
paul@1088 | 116 | [ `grep "event8@example.com" "out4o.tmp" | wc -l` = '2' ] \ |
paul@1088 | 117 | && ! grep -q "^20141114T090000Z${TAB}20141114T100000Z" "out4o.tmp" \ |
paul@594 | 118 | && echo "Success" \ |
paul@594 | 119 | || echo "Failed" |
paul@594 | 120 | |
paul@685 | 121 | # Test rescheduling in the outgoing handler. |
paul@685 | 122 | |
paul@685 | 123 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-reschedule-instance.txt" 2>> $ERROR |
paul@685 | 124 | |
paul@1088 | 125 | "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ |
paul@1088 | 126 | > out4s.tmp |
paul@1088 | 127 | |
paul@1088 | 128 | grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out4s.tmp" \ |
paul@1088 | 129 | && ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out4s.tmp" \ |
paul@685 | 130 | && echo "Success" \ |
paul@685 | 131 | || echo "Failed" |
paul@685 | 132 | |
paul@685 | 133 | # Test rescheduling in the incoming handler. |
paul@685 | 134 | |
paul@602 | 135 | "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-reschedule-instance.txt" 2>> $ERROR \ |
paul@594 | 136 | | "$SHOWMAIL" \ |
paul@594 | 137 | > out5.tmp |
paul@594 | 138 | |
paul@594 | 139 | ! grep -q 'METHOD:REPLY' out5.tmp \ |
paul@594 | 140 | && echo "Success" \ |
paul@594 | 141 | || echo "Failed" |
paul@594 | 142 | |
paul@1088 | 143 | "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ |
paul@1088 | 144 | > out5f.tmp |
paul@1088 | 145 | |
paul@1088 | 146 | ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out5f.tmp" \ |
paul@1088 | 147 | && grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out5f.tmp" \ |
paul@594 | 148 | && echo "Success" \ |
paul@594 | 149 | || echo "Failed" |
paul@594 | 150 | |
paul@1088 | 151 | "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \ |
paul@1088 | 152 | > out5o.tmp |
paul@1088 | 153 | |
paul@1088 | 154 | grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out5o.tmp" \ |
paul@1088 | 155 | && ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out5o.tmp" \ |
paul@594 | 156 | && echo "Success" \ |
paul@594 | 157 | || echo "Failed" |
paul@594 | 158 | |
paul@685 | 159 | # Test rescheduling acceptance in the outgoing handler. |
paul@685 | 160 | |
paul@673 | 161 | "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" "20141010T080000Z" 2>> $ERROR \ |
paul@594 | 162 | | tee out6.tmp \ |
paul@673 | 163 | | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR |
paul@594 | 164 | |
paul@1088 | 165 | "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ |
paul@1088 | 166 | > out6f.tmp |
paul@1088 | 167 | |
paul@1088 | 168 | grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out6f.tmp" \ |
paul@1088 | 169 | && ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out6f.tmp" \ |
paul@594 | 170 | && echo "Success" \ |
paul@594 | 171 | || echo "Failed" |
paul@594 | 172 | |
paul@685 | 173 | # Test complete cancellation in the outgoing handler. |
paul@685 | 174 | |
paul@685 | 175 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring.txt" 2>> $ERROR |
paul@685 | 176 | |
paul@1088 | 177 | "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ |
paul@1088 | 178 | > out6s.tmp |
paul@1088 | 179 | |
paul@1088 | 180 | ! grep -q "event8@example.com" "out6s.tmp" \ |
paul@685 | 181 | && echo "Success" \ |
paul@685 | 182 | || echo "Failed" |
paul@685 | 183 | |
paul@685 | 184 | # Test complete cancellation in the incoming handler. |
paul@685 | 185 | |
paul@602 | 186 | "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring.txt" 2>> $ERROR \ |
paul@594 | 187 | | "$SHOWMAIL" \ |
paul@1088 | 188 | > out7.tmp |
paul@594 | 189 | |
paul@1088 | 190 | ! grep -q 'METHOD:REPLY' out7.tmp \ |
paul@594 | 191 | && echo "Success" \ |
paul@594 | 192 | || echo "Failed" |
paul@594 | 193 | |
paul@1088 | 194 | "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ |
paul@1088 | 195 | > out7f.tmp |
paul@1088 | 196 | |
paul@1088 | 197 | ! grep -q "event8@example.com" "out7f.tmp" \ |
paul@594 | 198 | && echo "Success" \ |
paul@594 | 199 | || echo "Failed" |
paul@594 | 200 | |
paul@1088 | 201 | "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \ |
paul@1088 | 202 | > out7o.tmp |
paul@1088 | 203 | |
paul@1088 | 204 | ! grep -q "event8@example.com" "out7o.tmp" \ |
paul@594 | 205 | && echo "Success" \ |
paul@594 | 206 | || echo "Failed" |
paul@644 | 207 | |
paul@644 | 208 | # Switch time zones. |
paul@644 | 209 | |
paul@644 | 210 | echo 'Europe/Mariehamn' > "$PREFS/$USER/TZID" |
paul@644 | 211 | |
paul@685 | 212 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR |
paul@685 | 213 | |
paul@1088 | 214 | "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ |
paul@1088 | 215 | > out7s.tmp |
paul@1088 | 216 | |
paul@1088 | 217 | grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out7s.tmp" \ |
paul@685 | 218 | && echo "Success" \ |
paul@685 | 219 | || echo "Failed" |
paul@685 | 220 | |
paul@644 | 221 | "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR \ |
paul@644 | 222 | | "$SHOWMAIL" \ |
paul@1088 | 223 | > out8.tmp |
paul@644 | 224 | |
paul@1088 | 225 | ! grep -q 'METHOD:REPLY' out8.tmp \ |
paul@644 | 226 | && echo "Success" \ |
paul@644 | 227 | || echo "Failed" |
paul@644 | 228 | |
paul@1088 | 229 | "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ |
paul@1088 | 230 | > out8f.tmp |
paul@1088 | 231 | |
paul@1088 | 232 | ! grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out8f.tmp" \ |
paul@644 | 233 | && echo "Success" \ |
paul@644 | 234 | || echo "Failed" |
paul@644 | 235 | |
paul@1088 | 236 | "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \ |
paul@1088 | 237 | > out8o.tmp |
paul@1088 | 238 | |
paul@1088 | 239 | grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out8o.tmp" \ |
paul@644 | 240 | && echo "Success" \ |
paul@644 | 241 | || echo "Failed" |
paul@644 | 242 | |
paul@673 | 243 | "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \ |
paul@1088 | 244 | | tee out9.tmp \ |
paul@673 | 245 | | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR |
paul@644 | 246 | |
paul@1088 | 247 | "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ |
paul@1088 | 248 | > out9f.tmp |
paul@1088 | 249 | |
paul@1088 | 250 | grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out9f.tmp" \ |
paul@644 | 251 | && echo "Success" \ |
paul@644 | 252 | || echo "Failed" |
paul@644 | 253 | |
paul@685 | 254 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring.txt" 2>> $ERROR |
paul@685 | 255 | |
paul@1088 | 256 | "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ |
paul@1088 | 257 | > out9s.tmp |
paul@1088 | 258 | |
paul@1088 | 259 | ! grep -q "event8@example.com" "out9s.tmp" \ |
paul@685 | 260 | && echo "Success" \ |
paul@685 | 261 | || echo "Failed" |
paul@685 | 262 | |
paul@644 | 263 | "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring.txt" 2>> $ERROR \ |
paul@644 | 264 | | "$SHOWMAIL" \ |
paul@1088 | 265 | > out10.tmp |
paul@644 | 266 | |
paul@1088 | 267 | ! grep -q 'METHOD:REPLY' out10.tmp \ |
paul@644 | 268 | && echo "Success" \ |
paul@644 | 269 | || echo "Failed" |
paul@644 | 270 | |
paul@1088 | 271 | "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ |
paul@1088 | 272 | > out10f.tmp |
paul@1088 | 273 | |
paul@1088 | 274 | ! grep -q "event8@example.com" "out10f.tmp" \ |
paul@644 | 275 | && echo "Success" \ |
paul@644 | 276 | || echo "Failed" |
paul@644 | 277 | |
paul@1088 | 278 | "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \ |
paul@1088 | 279 | > out10o.tmp |
paul@1088 | 280 | |
paul@1088 | 281 | ! grep -q "event8@example.com" "out10o.tmp" \ |
paul@644 | 282 | && echo "Success" \ |
paul@644 | 283 | || echo "Failed" |
paul@644 | 284 | |
paul@685 | 285 | # Test floating dates. Here, the outgoing interpretation is different because |
paul@685 | 286 | # the sender is in a different time zone. |
paul@685 | 287 | |
paul@685 | 288 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-day-floating.txt" 2>> $ERROR |
paul@685 | 289 | |
paul@1088 | 290 | "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ |
paul@1088 | 291 | > out10s.tmp |
paul@1088 | 292 | |
paul@1088 | 293 | grep -q "^20141211T230000Z${TAB}20141212T230000Z" "out10s.tmp" \ |
paul@685 | 294 | && echo "Success" \ |
paul@685 | 295 | || echo "Failed" |
paul@685 | 296 | |
paul@644 | 297 | "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-day-floating.txt" 2>> $ERROR \ |
paul@644 | 298 | | "$SHOWMAIL" \ |
paul@1088 | 299 | > out11.tmp |
paul@644 | 300 | |
paul@1088 | 301 | ! grep -q 'METHOD:REPLY' out11.tmp \ |
paul@644 | 302 | && echo "Success" \ |
paul@644 | 303 | || echo "Failed" |
paul@644 | 304 | |
paul@1088 | 305 | "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ |
paul@1088 | 306 | > out11f.tmp |
paul@1088 | 307 | |
paul@1088 | 308 | ! grep -q "^20141211T220000Z${TAB}20141212T220000Z" "out11f.tmp" \ |
paul@644 | 309 | && echo "Success" \ |
paul@644 | 310 | || echo "Failed" |
paul@644 | 311 | |
paul@697 | 312 | # (The organiser is not attending.) |
paul@697 | 313 | |
paul@1088 | 314 | "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \ |
paul@1088 | 315 | > out11o.tmp |
paul@1088 | 316 | |
paul@1088 | 317 | ! grep -q "^20141211T220000Z${TAB}20141212T220000Z" "out11o.tmp" \ |
paul@644 | 318 | && echo "Success" \ |
paul@644 | 319 | || echo "Failed" |
paul@644 | 320 | |
paul@673 | 321 | "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event12@example.com" 2>> $ERROR \ |
paul@1088 | 322 | | tee out12.tmp \ |
paul@673 | 323 | | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR |
paul@644 | 324 | |
paul@1088 | 325 | "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ |
paul@1088 | 326 | > out12f.tmp |
paul@1088 | 327 | |
paul@1088 | 328 | grep -q "^20141211T220000Z${TAB}20141212T220000Z" "out12f.tmp" \ |
paul@644 | 329 | && echo "Success" \ |
paul@644 | 330 | || echo "Failed" |