paul@746 | 1 | #!/bin/sh |
paul@746 | 2 | |
paul@1024 | 3 | . "`dirname \"$0\"`/common.sh" |
paul@746 | 4 | |
paul@746 | 5 | USER="mailto:resource-room-sauna@example.com" |
paul@746 | 6 | SENDER="mailto:paul.boddie@example.com" |
paul@746 | 7 | RIVALSENDER="mailto:vincent.vole@example.com" |
paul@746 | 8 | FBFILE="$STORE/$USER/freebusy" |
paul@746 | 9 | FBOFFERFILE="$STORE/$USER/freebusy-offers" |
paul@746 | 10 | FBSENDERFILE="$STORE/$SENDER/freebusy" |
paul@746 | 11 | FBSENDEROTHERFILE="$STORE/$SENDER/freebusy-other/$USER" |
paul@747 | 12 | FBSENDERREQUESTS="$STORE/$SENDER/requests" |
paul@746 | 13 | FBRIVALSENDERFILE="$STORE/$RIVALSENDER/freebusy" |
paul@746 | 14 | |
paul@746 | 15 | mkdir -p "$PREFS/$USER" |
paul@746 | 16 | echo 'Europe/Oslo' > "$PREFS/$USER/TZID" |
paul@746 | 17 | echo 'share' > "$PREFS/$USER/freebusy_sharing" |
paul@938 | 18 | echo 'schedule_corrected_in_freebusy' > "$PREFS/$USER/scheduling_function" |
paul@746 | 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@746 | 21 | |
paul@746 | 22 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \ |
paul@746 | 23 | | "$SHOWMAIL" \ |
paul@746 | 24 | > out0.tmp |
paul@746 | 25 | |
paul@746 | 26 | grep -q 'METHOD:REPLY' out0.tmp \ |
paul@746 | 27 | && ! grep -q '^FREEBUSY' out0.tmp \ |
paul@746 | 28 | && echo "Success" \ |
paul@746 | 29 | || echo "Failed" |
paul@746 | 30 | |
paul@746 | 31 | # Attempt to schedule an event. |
paul@746 | 32 | |
paul@746 | 33 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR |
paul@746 | 34 | |
paul@746 | 35 | grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBSENDERFILE" \ |
paul@746 | 36 | && echo "Success" \ |
paul@746 | 37 | || echo "Failed" |
paul@746 | 38 | |
paul@746 | 39 | # Present the request to the resource. |
paul@746 | 40 | |
paul@746 | 41 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR \ |
paul@746 | 42 | | "$SHOWMAIL" \ |
paul@746 | 43 | > out1.tmp |
paul@746 | 44 | |
paul@746 | 45 | grep -q 'METHOD:COUNTER' out1.tmp \ |
paul@746 | 46 | && grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161500' out1.tmp \ |
paul@746 | 47 | && echo "Success" \ |
paul@746 | 48 | || echo "Failed" |
paul@746 | 49 | |
paul@746 | 50 | ! [ -e "$FBFILE" ] \ |
paul@746 | 51 | || ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBFILE" \ |
paul@746 | 52 | && echo "Success" \ |
paul@746 | 53 | || echo "Failed" |
paul@746 | 54 | |
paul@746 | 55 | grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBOFFERFILE" \ |
paul@746 | 56 | && echo "Success" \ |
paul@746 | 57 | || echo "Failed" |
paul@746 | 58 | |
paul@746 | 59 | # Present the response to the organiser. |
paul@746 | 60 | |
paul@746 | 61 | "$PERSON_SCRIPT" $ARGS < out1.tmp 2>> $ERROR \ |
paul@746 | 62 | | tee out2r.tmp \ |
paul@746 | 63 | | "$SHOWMAIL" \ |
paul@746 | 64 | > out2.tmp |
paul@746 | 65 | |
paul@746 | 66 | [ ! -e "$FBSENDEROTHERFILE" ] \ |
paul@746 | 67 | || ( ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBSENDEROTHERFILE" \ |
paul@746 | 68 | && ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBSENDEROTHERFILE" ) \ |
paul@746 | 69 | && echo "Success" \ |
paul@746 | 70 | || echo "Failed" |
paul@746 | 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@746 | 81 | && echo "Success" \ |
paul@746 | 82 | || echo "Failed" |
paul@746 | 83 | |
paul@746 | 84 | # Decline the counter-proposal. |
paul@746 | 85 | |
paul@746 | 86 | sed 's/COUNTER/DECLINECOUNTER/' < out1.tmp \ |
paul@746 | 87 | | sed 's/^From: calendar/To: resource-room-sauna/' \ |
paul@746 | 88 | | sed 's/^To: paul.boddie/From: paul.boddie/' \ |
paul@746 | 89 | > out3.tmp |
paul@746 | 90 | |
paul@746 | 91 | "$OUTGOING_SCRIPT" $ARGS < out3.tmp 2>> $ERROR |
paul@746 | 92 | |
paul@746 | 93 | "$RESOURCE_SCRIPT" $ARGS < out3.tmp 2>> $ERROR \ |
paul@746 | 94 | | "$SHOWMAIL" \ |
paul@746 | 95 | > out4.tmp |
paul@746 | 96 | |
paul@746 | 97 | ! [ -e "$FBFILE" ] \ |
paul@746 | 98 | || ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBFILE" \ |
paul@746 | 99 | && echo "Success" \ |
paul@746 | 100 | || echo "Failed" |
paul@746 | 101 | |
paul@746 | 102 | ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBOFFERFILE" \ |
paul@746 | 103 | && echo "Success" \ |
paul@746 | 104 | || echo "Failed" |
paul@746 | 105 | |
paul@746 | 106 | # Attempt to schedule an event in the proposed period. |
paul@746 | 107 | |
paul@746 | 108 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-rival.txt" 2>> $ERROR |
paul@746 | 109 | |
paul@746 | 110 | ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBRIVALSENDERFILE" \ |
paul@746 | 111 | && grep -q "^20141126T153000Z${TAB}20141126T154500Z" "$FBRIVALSENDERFILE" \ |
paul@746 | 112 | && echo "Success" \ |
paul@746 | 113 | || echo "Failed" |
paul@746 | 114 | |
paul@746 | 115 | # Present the request to the resource. |
paul@746 | 116 | |
paul@746 | 117 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-rival.txt" 2>> $ERROR \ |
paul@746 | 118 | | "$SHOWMAIL" \ |
paul@746 | 119 | > out5.tmp |
paul@746 | 120 | |
paul@746 | 121 | grep -q 'METHOD:REPLY' out5.tmp \ |
paul@746 | 122 | && grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out5.tmp \ |
paul@746 | 123 | && echo "Success" \ |
paul@746 | 124 | || echo "Failed" |
paul@746 | 125 | |
paul@746 | 126 | grep -q "^20141126T153000Z${TAB}20141126T154500Z" "$FBFILE" \ |
paul@746 | 127 | && echo "Success" \ |
paul@746 | 128 | || echo "Failed" |
paul@746 | 129 | |
paul@746 | 130 | ! grep -q "^20141126T153000Z${TAB}20141126T154500Z" "$FBOFFERFILE" \ |
paul@746 | 131 | && echo "Success" \ |
paul@746 | 132 | || echo "Failed" |
paul@746 | 133 | |
paul@746 | 134 | # Present the response to the organiser. |
paul@746 | 135 | |
paul@746 | 136 | "$PERSON_SCRIPT" $ARGS < out5.tmp 2>> $ERROR \ |
paul@746 | 137 | | "$SHOWMAIL" \ |
paul@746 | 138 | > out6.tmp |
paul@746 | 139 | |
paul@746 | 140 | ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBRIVALSENDERFILE" \ |
paul@746 | 141 | && ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBRIVALSENDERFILE" \ |
paul@746 | 142 | && grep -q "^20141126T153000Z${TAB}20141126T154500Z" "$FBRIVALSENDERFILE" \ |
paul@746 | 143 | && echo "Success" \ |
paul@746 | 144 | || echo "Failed" |
paul@746 | 145 | |
paul@746 | 146 | grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' "$STORE/$RIVALSENDER/objects/event18@example.com" \ |
paul@746 | 147 | && echo "Success" \ |
paul@746 | 148 | || echo "Failed" |
paul@746 | 149 | |
paul@746 | 150 | # Check the free/busy state of the resource so far. |
paul@746 | 151 | |
paul@746 | 152 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \ |
paul@746 | 153 | | "$SHOWMAIL" \ |
paul@746 | 154 | > out7.tmp |
paul@746 | 155 | |
paul@746 | 156 | grep -q 'METHOD:REPLY' out7.tmp \ |
paul@746 | 157 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151000Z/20141126T154500Z' out7.tmp \ |
paul@746 | 158 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T154500Z' out7.tmp \ |
paul@746 | 159 | && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T154500Z' out7.tmp \ |
paul@746 | 160 | && echo "Success" \ |
paul@746 | 161 | || echo "Failed" |