paul@655 | 1 | #!/bin/sh |
paul@655 | 2 | |
paul@1024 | 3 | . "`dirname \"$0\"`/common.sh" |
paul@655 | 4 | |
paul@655 | 5 | USER="mailto:resource-room-sauna@example.com" |
paul@743 | 6 | SENDER="mailto:paul.boddie@example.com" |
paul@743 | 7 | RIVALSENDER="mailto:vincent.vole@example.com" |
paul@710 | 8 | FBFILE="$STORE/$USER/freebusy" |
paul@710 | 9 | FBOFFERFILE="$STORE/$USER/freebusy-offers" |
paul@743 | 10 | FBSENDERFILE="$STORE/$SENDER/freebusy" |
paul@743 | 11 | FBSENDEROTHERFILE="$STORE/$SENDER/freebusy-other/$USER" |
paul@747 | 12 | FBSENDERREQUESTS="$STORE/$SENDER/requests" |
paul@743 | 13 | FBRIVALSENDERFILE="$STORE/$RIVALSENDER/freebusy" |
paul@655 | 14 | |
paul@655 | 15 | mkdir -p "$PREFS/$USER" |
paul@655 | 16 | echo 'Europe/Oslo' > "$PREFS/$USER/TZID" |
paul@655 | 17 | echo 'share' > "$PREFS/$USER/freebusy_sharing" |
paul@938 | 18 | echo 'schedule_corrected_in_freebusy' > "$PREFS/$USER/scheduling_function" |
paul@669 | 19 | echo '10,12,14,16,18:0,15,30,45' > "$PREFS/$USER/permitted_times" |
paul@759 | 20 | echo 'PT60S' > "$PREFS/$USER/freebusy_offers" |
paul@655 | 21 | |
paul@655 | 22 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \ |
paul@655 | 23 | | "$SHOWMAIL" \ |
paul@655 | 24 | > out0.tmp |
paul@655 | 25 | |
paul@655 | 26 | grep -q 'METHOD:REPLY' out0.tmp \ |
paul@655 | 27 | && ! grep -q '^FREEBUSY' out0.tmp \ |
paul@655 | 28 | && echo "Success" \ |
paul@655 | 29 | || echo "Failed" |
paul@655 | 30 | |
paul@743 | 31 | # Attempt to schedule an event. |
paul@743 | 32 | |
paul@743 | 33 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR |
paul@743 | 34 | |
paul@743 | 35 | grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBSENDERFILE" \ |
paul@743 | 36 | && echo "Success" \ |
paul@743 | 37 | || echo "Failed" |
paul@743 | 38 | |
paul@743 | 39 | # Present the request to the resource. |
paul@743 | 40 | |
paul@655 | 41 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR \ |
paul@802 | 42 | | tee out1r.tmp \ |
paul@655 | 43 | | "$SHOWMAIL" \ |
paul@742 | 44 | > out1.tmp |
paul@655 | 45 | |
paul@742 | 46 | grep -q 'METHOD:COUNTER' out1.tmp \ |
paul@742 | 47 | && grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161500' out1.tmp \ |
paul@655 | 48 | && echo "Success" \ |
paul@655 | 49 | || echo "Failed" |
paul@655 | 50 | |
paul@710 | 51 | ! [ -e "$FBFILE" ] \ |
paul@742 | 52 | || ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBFILE" \ |
paul@742 | 53 | && echo "Success" \ |
paul@742 | 54 | || echo "Failed" |
paul@742 | 55 | |
paul@742 | 56 | grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBOFFERFILE" \ |
paul@710 | 57 | && echo "Success" \ |
paul@710 | 58 | || echo "Failed" |
paul@710 | 59 | |
paul@743 | 60 | # Present the response to the organiser. |
paul@742 | 61 | |
paul@802 | 62 | "$PERSON_SCRIPT" $ARGS < out1r.tmp 2>> $ERROR \ |
paul@743 | 63 | | tee out2r.tmp \ |
paul@742 | 64 | | "$SHOWMAIL" \ |
paul@742 | 65 | > out2.tmp |
paul@742 | 66 | |
paul@866 | 67 | ( ! [ -e "$FBSENDEROTHERFILE" ] \ |
paul@866 | 68 | || ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBSENDEROTHERFILE") \ |
paul@743 | 69 | && echo "Success" \ |
paul@743 | 70 | || echo "Failed" |
paul@743 | 71 | |
paul@866 | 72 | grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161000' "$STORE/$SENDER/objects/event13@example.com" \ |
paul@747 | 73 | && echo "Success" \ |
paul@747 | 74 | || echo "Failed" |
paul@747 | 75 | |
paul@760 | 76 | grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161500' "$STORE/$SENDER/counters/objects/event13@example.com/$USER" \ |
paul@747 | 77 | && echo "Success" \ |
paul@747 | 78 | || echo "Failed" |
paul@747 | 79 | |
paul@747 | 80 | grep -q 'event13@example.com' "$FBSENDERREQUESTS" \ |
paul@710 | 81 | && echo "Success" \ |
paul@710 | 82 | || echo "Failed" |
paul@710 | 83 | |
paul@743 | 84 | # Attempt to schedule an event in the proposed period. |
paul@743 | 85 | |
paul@743 | 86 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-rival.txt" 2>> $ERROR |
paul@743 | 87 | |
paul@743 | 88 | ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBRIVALSENDERFILE" \ |
paul@743 | 89 | && grep -q "^20141126T153000Z${TAB}20141126T154500Z" "$FBRIVALSENDERFILE" \ |
paul@743 | 90 | && echo "Success" \ |
paul@743 | 91 | || echo "Failed" |
paul@743 | 92 | |
paul@743 | 93 | # Present the request to the resource. |
paul@743 | 94 | |
paul@743 | 95 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-rival.txt" 2>> $ERROR \ |
paul@655 | 96 | | "$SHOWMAIL" \ |
paul@655 | 97 | > out3.tmp |
paul@655 | 98 | |
paul@655 | 99 | grep -q 'METHOD:REPLY' out3.tmp \ |
paul@746 | 100 | && grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out3.tmp \ |
paul@743 | 101 | && echo "Success" \ |
paul@743 | 102 | || echo "Failed" |
paul@743 | 103 | |
paul@743 | 104 | # Present the response to the organiser. |
paul@743 | 105 | |
paul@743 | 106 | "$PERSON_SCRIPT" $ARGS < out3.tmp 2>> $ERROR \ |
paul@743 | 107 | | tee out4r.tmp \ |
paul@743 | 108 | | "$SHOWMAIL" \ |
paul@743 | 109 | > out4.tmp |
paul@743 | 110 | |
paul@743 | 111 | ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBRIVALSENDERFILE" \ |
paul@743 | 112 | && grep -q "^20141126T153000Z${TAB}20141126T154500Z" "$FBRIVALSENDERFILE" \ |
paul@743 | 113 | && echo "Success" \ |
paul@743 | 114 | || echo "Failed" |
paul@743 | 115 | |
paul@746 | 116 | grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' "$STORE/$RIVALSENDER/objects/event18@example.com" \ |
paul@655 | 117 | && echo "Success" \ |
paul@655 | 118 | || echo "Failed" |
paul@655 | 119 | |
paul@743 | 120 | # Check the free/busy state of the resource so far. |
paul@743 | 121 | |
paul@743 | 122 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \ |
paul@743 | 123 | | "$SHOWMAIL" \ |
paul@743 | 124 | > out5.tmp |
paul@743 | 125 | |
paul@743 | 126 | grep -q 'METHOD:REPLY' out5.tmp \ |
paul@743 | 127 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151000Z/20141126T154500Z' out5.tmp \ |
paul@743 | 128 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T154500Z' out5.tmp \ |
paul@743 | 129 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T154500Z' out5.tmp \ |
paul@743 | 130 | && echo "Success" \ |
paul@743 | 131 | || echo "Failed" |
paul@743 | 132 | |
paul@743 | 133 | # Attempt to schedule again in response to the counter-proposal. |
paul@743 | 134 | |
paul@743 | 135 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-good.txt" 2>> $ERROR |
paul@743 | 136 | |
paul@743 | 137 | ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBSENDERFILE" \ |
paul@743 | 138 | && ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBSENDERFILE" \ |
paul@743 | 139 | && ! grep -q "^20141126T153000Z${TAB}20141126T154500Z" "$FBSENDERFILE" \ |
paul@743 | 140 | && echo "Success" \ |
paul@743 | 141 | || echo "Failed" |
paul@743 | 142 | |
paul@760 | 143 | [ ! -e "$STORE/$SENDER/counters/objects/event13@example.com/$USER" ] \ |
paul@747 | 144 | && echo "Success" \ |
paul@747 | 145 | || echo "Failed" |
paul@747 | 146 | |
paul@747 | 147 | ! grep -q 'event13@example.com' "$FBSENDERREQUESTS" \ |
paul@747 | 148 | && echo "Success" \ |
paul@747 | 149 | || echo "Failed" |
paul@747 | 150 | |
paul@743 | 151 | # Present the request to the resource. |
paul@743 | 152 | |
paul@655 | 153 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-good.txt" 2>> $ERROR \ |
paul@655 | 154 | | "$SHOWMAIL" \ |
paul@743 | 155 | > out6.tmp |
paul@655 | 156 | |
paul@743 | 157 | grep -q 'METHOD:REPLY' out6.tmp \ |
paul@746 | 158 | && grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out6.tmp \ |
paul@655 | 159 | && echo "Success" \ |
paul@655 | 160 | || echo "Failed" |
paul@655 | 161 | |
paul@742 | 162 | grep -q "^20141126T150000Z${TAB}20141126T154500Z" "$FBFILE" \ |
paul@710 | 163 | && echo "Success" \ |
paul@710 | 164 | || echo "Failed" |
paul@710 | 165 | |
paul@742 | 166 | ! grep -q "^20141126T150000Z${TAB}20141126T154500Z" "$FBOFFERFILE" \ |
paul@742 | 167 | && ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBOFFERFILE" \ |
paul@742 | 168 | && ! grep -q "^20141126T153000Z${TAB}20141126T154500Z" "$FBOFFERFILE" \ |
paul@710 | 169 | && echo "Success" \ |
paul@710 | 170 | || echo "Failed" |
paul@710 | 171 | |
paul@743 | 172 | # Present the response to the organiser. |
paul@743 | 173 | |
paul@743 | 174 | "$PERSON_SCRIPT" $ARGS < out6.tmp 2>> $ERROR \ |
paul@743 | 175 | | tee out7r.tmp \ |
paul@743 | 176 | | "$SHOWMAIL" \ |
paul@743 | 177 | > out7.tmp |
paul@743 | 178 | |
paul@743 | 179 | grep -q "^20141126T150000Z${TAB}20141126T154500Z" "$FBSENDERFILE" \ |
paul@743 | 180 | && ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBSENDERFILE" \ |
paul@743 | 181 | && ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBSENDERFILE" \ |
paul@743 | 182 | && ! grep -q "^20141126T153000Z${TAB}20141126T154500Z" "$FBSENDERFILE" \ |
paul@743 | 183 | && echo "Success" \ |
paul@743 | 184 | || echo "Failed" |
paul@743 | 185 | |
paul@760 | 186 | [ ! -e "$STORE/$SENDER/counters/objects/event13@example.com/$USER" ] \ |
paul@747 | 187 | && echo "Success" \ |
paul@747 | 188 | || echo "Failed" |
paul@747 | 189 | |
paul@747 | 190 | ! grep -q 'event13@example.com' "$FBSENDERREQUESTS" \ |
paul@747 | 191 | && echo "Success" \ |
paul@747 | 192 | || echo "Failed" |
paul@747 | 193 | |
paul@743 | 194 | # Check the free/busy state of the resource again. |
paul@743 | 195 | |
paul@655 | 196 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \ |
paul@655 | 197 | | "$SHOWMAIL" \ |
paul@655 | 198 | > out6.tmp |
paul@655 | 199 | |
paul@655 | 200 | grep -q 'METHOD:REPLY' out6.tmp \ |
paul@742 | 201 | && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T154500Z' out6.tmp \ |
paul@743 | 202 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151000Z/20141126T154500Z' out6.tmp \ |
paul@742 | 203 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T154500Z' out6.tmp \ |
paul@742 | 204 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T154500Z' out6.tmp \ |
paul@655 | 205 | && echo "Success" \ |
paul@655 | 206 | || echo "Failed" |