1 #!/bin/sh 2 3 . "`dirname \"$0\"`/common.sh" 4 5 USER="mailto:resource-car-porsche911@example.com" 6 SENDER="mailto:paul.boddie@example.com" 7 QUOTA="$USER" 8 9 mkdir -p "$PREFS/$USER" 10 echo 'Europe/Oslo' > "$PREFS/$USER/TZID" 11 echo 'share' > "$PREFS/$USER/freebusy_sharing" 12 cat > "$PREFS/$USER/scheduling_function" <<EOF 13 schedule_in_freebusy 14 check_quota 15 EOF 16 17 # Employ a user-specific quota (no argument with the functions above). 18 19 "$SET_QUOTA_LIMIT" "$QUOTA" '*' 'PT10H' $SET_QUOTA_LIMIT_ARGS 20 21 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-car-all.txt" 2>> $ERROR \ 22 | "$SHOWMAIL" \ 23 > out0.tmp 24 25 grep -q 'METHOD:REPLY' out0.tmp \ 26 && ! grep -q '^FREEBUSY' out0.tmp \ 27 && echo "Success" \ 28 || echo "Failed" 29 30 # Attempt to schedule an event. 31 32 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-car-recurring.txt" 2>> $ERROR 33 34 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ 35 > out0f.tmp 36 37 grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out0f.tmp" \ 38 && grep -q "^20141206T150000Z${TAB}20141206T160000Z" "out0f.tmp" \ 39 && echo "Success" \ 40 || echo "Failed" 41 42 # Present the request to the resource. 43 44 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-car-recurring.txt" 2>> $ERROR \ 45 | tee out1r.tmp \ 46 | "$SHOWMAIL" \ 47 > out1.tmp 48 49 grep -q 'METHOD:REPLY' out1.tmp \ 50 && grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out1.tmp \ 51 && echo "Success" \ 52 || echo "Failed" 53 54 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ 55 > out1f.tmp 56 57 ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out1f.tmp" \ 58 && ! grep -q "^20141206T150000Z${TAB}20141206T160000Z" "out1f.tmp" \ 59 && echo "Success" \ 60 || echo "Failed" 61 62 # Check the quota (event is not confirmed). 63 64 "$LIST_SCRIPT" $LIST_ARGS "$QUOTA" "entries" "$SENDER" \ 65 > out1e.tmp 66 67 ! grep -q "event24@example.com" "out1e.tmp" \ 68 && echo "Success" \ 69 || echo "Failed" 70 71 # Modify the event and attempt to schedule it again. 72 73 sed 's/FREQ=DAILY/FREQ=DAILY;COUNT=11/;' "$TEMPLATES/event-request-car-recurring.txt" \ 74 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR 75 76 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ 77 > out1s.tmp 78 79 grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out1s.tmp" \ 80 && grep -q "^20141205T150000Z${TAB}20141205T160000Z" "out1s.tmp" \ 81 && grep -q "^20141206T150000Z${TAB}20141206T160000Z" "out1s.tmp" \ 82 && echo "Success" \ 83 || echo "Failed" 84 85 # Present the request to the resource. 86 87 sed 's/FREQ=DAILY/FREQ=DAILY;COUNT=11/;' "$TEMPLATES/event-request-car-recurring.txt" \ 88 | "$RESOURCE_SCRIPT" $ARGS 2>> $ERROR \ 89 | tee out2r.tmp \ 90 | "$SHOWMAIL" \ 91 > out2.tmp 92 93 grep -q 'METHOD:REPLY' out2.tmp \ 94 && grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out2.tmp \ 95 && echo "Success" \ 96 || echo "Failed" 97 98 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ 99 > out2f.tmp 100 101 ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out2f.tmp" \ 102 && ! grep -q "^20141205T150000Z${TAB}20141205T160000Z" "out2f.tmp" \ 103 && ! grep -q "^20141206T150000Z${TAB}20141206T160000Z" "out2f.tmp" \ 104 && echo "Success" \ 105 || echo "Failed" 106 107 # Check the quota (event is confirmed). 108 109 "$LIST_SCRIPT" $LIST_ARGS "$QUOTA" "entries" "$SENDER" \ 110 > out2e.tmp 111 112 ! grep -q "event24@example.com" "out2e.tmp" \ 113 && echo "Success" \ 114 || echo "Failed" 115 116 # Modify the event and attempt to schedule it again. 117 118 sed 's/FREQ=DAILY/FREQ=DAILY;COUNT=10/;' "$TEMPLATES/event-request-car-recurring.txt" \ 119 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR 120 121 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ 122 > out2s.tmp 123 124 grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out2s.tmp" \ 125 && grep -q "^20141205T150000Z${TAB}20141205T160000Z" "out2s.tmp" \ 126 && ! grep -q "^20141206T150000Z${TAB}20141206T160000Z" "out2s.tmp" \ 127 && echo "Success" \ 128 || echo "Failed" 129 130 # Present the request to the resource. 131 132 sed 's/FREQ=DAILY/FREQ=DAILY;COUNT=10/;' "$TEMPLATES/event-request-car-recurring.txt" \ 133 | "$RESOURCE_SCRIPT" $ARGS 2>> $ERROR \ 134 | tee out3r.tmp \ 135 | "$SHOWMAIL" \ 136 > out3.tmp 137 138 grep -q 'METHOD:REPLY' out3.tmp \ 139 && grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out3.tmp \ 140 && echo "Success" \ 141 || echo "Failed" 142 143 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ 144 > out3f.tmp 145 146 grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out3f.tmp" \ 147 && grep -q "^20141205T150000Z${TAB}20141205T160000Z" "out3f.tmp" \ 148 && ! grep -q "^20141206T150000Z${TAB}20141206T160000Z" "out3f.tmp" \ 149 && echo "Success" \ 150 || echo "Failed" 151 152 # Check the quota (event is confirmed). 153 154 "$LIST_SCRIPT" $LIST_ARGS "$QUOTA" "entries" "$SENDER" \ 155 > out3e.tmp 156 157 grep -q "event24@example.com" "out3e.tmp" \ 158 && echo "Success" \ 159 || echo "Failed"