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