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