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