1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/test_resource_invitation_constraints_quota_recurring.sh Mon Feb 08 22:03:57 2016 +0100
1.3 @@ -0,0 +1,148 @@
1.4 +#!/bin/sh
1.5 +
1.6 +. "`dirname \"$0\"`/common.sh"
1.7 +
1.8 +USER="mailto:resource-car-porsche911@example.com"
1.9 +SENDER="mailto:paul.boddie@example.com"
1.10 +FBFILE="$STORE/$USER/freebusy"
1.11 +FBSENDERFILE="$STORE/$SENDER/freebusy"
1.12 +QUOTA="$USER"
1.13 +JOURNALFILE="$JOURNAL/$QUOTA/journal/$SENDER"
1.14 +
1.15 +mkdir -p "$PREFS/$USER"
1.16 +echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
1.17 +echo 'share' > "$PREFS/$USER/freebusy_sharing"
1.18 +cat > "$PREFS/$USER/scheduling_function" <<EOF
1.19 +schedule_in_freebusy
1.20 +check_quota
1.21 +EOF
1.22 +cat > "$PREFS/$USER/confirmation_function" <<EOF
1.23 +add_to_quota
1.24 +EOF
1.25 +cat > "$PREFS/$USER/retraction_function" <<EOF
1.26 +remove_from_quota
1.27 +EOF
1.28 +
1.29 +# Employ a user-specific quota (no argument with the functions above).
1.30 +
1.31 +mkdir -p "$JOURNAL/$QUOTA"
1.32 +echo '* PT10H' > "$JOURNAL/$QUOTA/limits"
1.33 +
1.34 + "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-car-all.txt" 2>> $ERROR \
1.35 +| "$SHOWMAIL" \
1.36 +> out0.tmp
1.37 +
1.38 + grep -q 'METHOD:REPLY' out0.tmp \
1.39 +&& ! grep -q '^FREEBUSY' out0.tmp \
1.40 +&& echo "Success" \
1.41 +|| echo "Failed"
1.42 +
1.43 +# Attempt to schedule an event.
1.44 +
1.45 +"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-car-recurring.txt" 2>> $ERROR
1.46 +
1.47 + grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBSENDERFILE" \
1.48 +&& grep -q "^20141206T150000Z${TAB}20141206T160000Z" "$FBSENDERFILE" \
1.49 +&& echo "Success" \
1.50 +|| echo "Failed"
1.51 +
1.52 +# Present the request to the resource.
1.53 +
1.54 + "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-car-recurring.txt" 2>> $ERROR \
1.55 +| tee out1r.tmp \
1.56 +| "$SHOWMAIL" \
1.57 +> out1.tmp
1.58 +
1.59 + grep -q 'METHOD:REPLY' out1.tmp \
1.60 +&& grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out1.tmp \
1.61 +&& echo "Success" \
1.62 +|| echo "Failed"
1.63 +
1.64 + ! [ -e "$FBFILE" ] \
1.65 +|| ( ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \
1.66 + && ! grep -q "^20141206T150000Z${TAB}20141206T160000Z" "$FBFILE" ) \
1.67 +&& echo "Success" \
1.68 +|| echo "Failed"
1.69 +
1.70 +# Check the quota (event is not confirmed).
1.71 +
1.72 + ! [ -e "$JOURNALFILE" ] \
1.73 +|| ! grep -q "event24@example.com" "$JOURNALFILE" \
1.74 +&& echo "Success" \
1.75 +|| echo "Failed"
1.76 +
1.77 +# Modify the event and attempt to schedule it again.
1.78 +
1.79 + sed 's/FREQ=DAILY/FREQ=DAILY;COUNT=11/;' "$TEMPLATES/event-request-car-recurring.txt" \
1.80 +| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
1.81 +
1.82 + grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBSENDERFILE" \
1.83 + grep -q "^20141205T150000Z${TAB}20141205T160000Z" "$FBSENDERFILE" \
1.84 +&& grep -q "^20141206T150000Z${TAB}20141206T160000Z" "$FBSENDERFILE" \
1.85 +&& echo "Success" \
1.86 +|| echo "Failed"
1.87 +
1.88 +# Present the request to the resource.
1.89 +
1.90 + sed 's/FREQ=DAILY/FREQ=DAILY;COUNT=11/;' "$TEMPLATES/event-request-car-recurring.txt" \
1.91 +| "$RESOURCE_SCRIPT" $ARGS 2>> $ERROR \
1.92 +| tee out2r.tmp \
1.93 +| "$SHOWMAIL" \
1.94 +> out2.tmp
1.95 +
1.96 + grep -q 'METHOD:REPLY' out2.tmp \
1.97 +&& grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out2.tmp \
1.98 +&& echo "Success" \
1.99 +|| echo "Failed"
1.100 +
1.101 + ! [ -e "$FBFILE" ] \
1.102 +|| ( ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \
1.103 + && ! grep -q "^20141205T150000Z${TAB}20141205T160000Z" "$FBFILE" \
1.104 + && ! grep -q "^20141206T150000Z${TAB}20141206T160000Z" "$FBFILE" ) \
1.105 +&& echo "Success" \
1.106 +|| echo "Failed"
1.107 +
1.108 +# Check the quota (event is confirmed).
1.109 +
1.110 + ! [ -e "$JOURNALFILE" ] \
1.111 +|| ! grep -q "event24@example.com" "$JOURNALFILE" \
1.112 +&& echo "Success" \
1.113 +|| echo "Failed"
1.114 +
1.115 +# Modify the event and attempt to schedule it again.
1.116 +
1.117 + sed 's/FREQ=DAILY/FREQ=DAILY;COUNT=10/;' "$TEMPLATES/event-request-car-recurring.txt" \
1.118 +| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
1.119 +
1.120 + grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBSENDERFILE" \
1.121 + grep -q "^20141205T150000Z${TAB}20141205T160000Z" "$FBSENDERFILE" \
1.122 +&& ! grep -q "^20141206T150000Z${TAB}20141206T160000Z" "$FBSENDERFILE" \
1.123 +&& echo "Success" \
1.124 +|| echo "Failed"
1.125 +
1.126 +# Present the request to the resource.
1.127 +
1.128 + sed 's/FREQ=DAILY/FREQ=DAILY;COUNT=10/;' "$TEMPLATES/event-request-car-recurring.txt" \
1.129 +| "$RESOURCE_SCRIPT" $ARGS 2>> $ERROR \
1.130 +| tee out2r.tmp \
1.131 +| "$SHOWMAIL" \
1.132 +> out2.tmp
1.133 +
1.134 + grep -q 'METHOD:REPLY' out2.tmp \
1.135 +&& grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out2.tmp \
1.136 +&& echo "Success" \
1.137 +|| echo "Failed"
1.138 +
1.139 + [ -e "$FBFILE" ] \
1.140 +&& grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \
1.141 +&& grep -q "^20141205T150000Z${TAB}20141205T160000Z" "$FBFILE" \
1.142 +&& ! grep -q "^20141206T150000Z${TAB}20141206T160000Z" "$FBFILE" \
1.143 +&& echo "Success" \
1.144 +|| echo "Failed"
1.145 +
1.146 +# Check the quota (event is confirmed).
1.147 +
1.148 + [ -e "$JOURNALFILE" ] \
1.149 +&& grep -q "event24@example.com" "$JOURNALFILE" \
1.150 +&& echo "Success" \
1.151 +|| echo "Failed"