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