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/$USER/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-rdate.txt" 2>> $ERROR 38 39 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ 40 > out1f.tmp 41 42 grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out1f.tmp" \ 43 && echo "Success" \ 44 || echo "Failed" 45 46 # There should be an event created by the sender. 47 48 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "object" "event26@example.com" \ 49 > out1O.tmp 50 51 grep -q 'event26@example.com' "out1O.tmp" \ 52 && echo "Success" \ 53 || echo "Failed" 54 55 # Test registration in the incoming handler for the recipient. 56 57 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-rdate.txt" 2>> $ERROR \ 58 | "$SHOWMAIL" \ 59 > out2.tmp 60 61 ! grep -q 'METHOD:REPLY' out2.tmp \ 62 && echo "Success" \ 63 || echo "Failed" 64 65 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ 66 > out2f.tmp 67 68 ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out2f.tmp" \ 69 && echo "Success" \ 70 || echo "Failed" 71 72 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \ 73 > out2o.tmp 74 75 grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out2o.tmp" \ 76 && echo "Success" \ 77 || echo "Failed" 78 79 # There should be an event created by the sender. 80 81 "$LIST_SCRIPT" $LIST_ARGS "$USER" "object" "event26@example.com" \ 82 > out2O.tmp 83 84 grep -q 'event26@example.com' "out2O.tmp" \ 85 && echo "Success" \ 86 || echo "Failed" 87 88 # Test acceptance and registration in the outgoing handler. 89 90 "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event26@example.com" 2>> $ERROR \ 91 | tee out3.tmp \ 92 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR 93 94 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ 95 > out3f.tmp 96 97 grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out3f.tmp" \ 98 && echo "Success" \ 99 || echo "Failed" 100 101 # Test registration in the incoming handler. 102 103 "$PERSON_SCRIPT" $ARGS < out3.tmp 2>> $ERROR \ 104 | "$SHOWMAIL" \ 105 > out4.tmp 106 107 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ 108 > out4f.tmp 109 110 [ `grep "event26@example.com" "out4f.tmp" | wc -l` = '2' ] \ 111 && grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out4f.tmp" \ 112 && echo "Success" \ 113 || echo "Failed" 114 115 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \ 116 > out4o.tmp 117 118 [ `grep "event26@example.com" "out4o.tmp" | wc -l` = '2' ] \ 119 && grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out4o.tmp" \ 120 && echo "Success" \ 121 || echo "Failed" 122 123 # Test recurrence declining in the outgoing handler. 124 125 "$DECLINE_SCRIPT" $DECLINE_ARGS "$USER" "20141011T100000" "20141011T110000" "event26@example.com" "20141011T100000" 2>> $ERROR \ 126 | tee out5.tmp \ 127 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR 128 129 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ 130 > out5s.tmp 131 132 [ `grep "event26@example.com" "out5s.tmp" | wc -l` = '1' ] \ 133 && ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out5s.tmp" \ 134 && echo "Success" \ 135 || echo "Failed" 136 137 # There should be a recurrence created by the user. 138 139 "$LIST_SCRIPT" $LIST_ARGS "$USER" "object" "event26@example.com" \ 140 > out5O.tmp 141 142 "$LIST_SCRIPT" $LIST_ARGS "$USER" "recurrence" "event26@example.com" "20141011T100000" \ 143 > out5R.tmp 144 145 grep -q 'event26@example.com' "out5O.tmp" \ 146 && grep -q 'event26@example.com' "out5R.tmp" \ 147 && echo "Success" \ 148 || echo "Failed" 149 150 # Test declining in the incoming handler. 151 152 "$PERSON_SCRIPT" $ARGS < out5.tmp 2>> $ERROR \ 153 | "$SHOWMAIL" \ 154 > out6.tmp 155 156 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ 157 > out6f.tmp 158 159 [ `grep "event26@example.com" "out6f.tmp" | wc -l` = '2' ] \ 160 && grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out6f.tmp" \ 161 && echo "Success" \ 162 || echo "Failed" 163 164 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy_other" "$USER" \ 165 > out6o.tmp 166 167 [ `grep "event26@example.com" "out6o.tmp" | wc -l` = '1' ] \ 168 && ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out6o.tmp" \ 169 && echo "Success" \ 170 || echo "Failed" 171 172 # There should be a recurrence created by the user. 173 174 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "object" "event26@example.com" \ 175 > out6O.tmp 176 177 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "recurrence" "event26@example.com" "20141011T100000" \ 178 > out6R.tmp 179 180 grep -q 'event26@example.com' "out6O.tmp" \ 181 && grep -q 'event26@example.com' "out6R.tmp" \ 182 && echo "Success" \ 183 || echo "Failed" 184 185 # Test recurrence acceptance in the outgoing handler. 186 187 "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "20141011T100000" "20141011T110000" "event26@example.com" "20141011T100000" 2>> $ERROR \ 188 | tee out7.tmp \ 189 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR 190 191 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ 192 > out7s.tmp 193 194 [ `grep "event26@example.com" "out7s.tmp" | wc -l` = '2' ] \ 195 && grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out7s.tmp" \ 196 && echo "Success" \ 197 || echo "Failed" 198 199 # There should still be a recurrence created by the user. 200 201 "$LIST_SCRIPT" $LIST_ARGS "$USER" "object" "event26@example.com" \ 202 > out7O.tmp 203 204 "$LIST_SCRIPT" $LIST_ARGS "$USER" "recurrence" "event26@example.com" "20141011T100000" \ 205 > out7R.tmp 206 207 grep -q 'event26@example.com' "out7O.tmp" \ 208 && grep -q 'event26@example.com' "out7R.tmp" \ 209 && echo "Success" \ 210 || echo "Failed" 211 212 # Test acceptance in the incoming handler. 213 214 "$PERSON_SCRIPT" $ARGS < out7.tmp 2>> $ERROR \ 215 | "$SHOWMAIL" \ 216 > out8.tmp 217 218 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ 219 > out8f.tmp 220 221 [ `grep "event26@example.com" "out8f.tmp" | wc -l` = '2' ] \ 222 && grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out8f.tmp" \ 223 && echo "Success" \ 224 || echo "Failed" 225 226 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy_other" "$USER" \ 227 > out8o.tmp 228 229 [ `grep "event26@example.com" "out8o.tmp" | wc -l` = '2' ] \ 230 && grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out8o.tmp" \ 231 && echo "Success" \ 232 || echo "Failed" 233 234 # There should be a recurrence created by the user. 235 236 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "object" "event26@example.com" \ 237 > out8O.tmp 238 239 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "recurrence" "event26@example.com" "20141011T100000" \ 240 > out8R.tmp 241 242 grep -q 'event26@example.com' "out8O.tmp" \ 243 && grep -q 'event26@example.com' "out8R.tmp" \ 244 && echo "Success" \ 245 || echo "Failed"