1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/templates/event-cancel-cars-recurring.txt Mon Feb 08 23:26:28 2016 +0100
1.3 @@ -0,0 +1,38 @@
1.4 +Content-Type: multipart/alternative; boundary="===============0047278175=="
1.5 +MIME-Version: 1.0
1.6 +From: paul.boddie@example.com
1.7 +To: resource-car-porsche911@example.com, resource-car-fiat500@example.com
1.8 +Subject: Cancellation!
1.9 +
1.10 +Cancel the event completely.
1.11 +
1.12 +--===============0047278175==
1.13 +Content-Type: text/plain; charset="us-ascii"
1.14 +MIME-Version: 1.0
1.15 +Content-Transfer-Encoding: 7bit
1.16 +
1.17 +This message contains an event.
1.18 +--===============0047278175==
1.19 +MIME-Version: 1.0
1.20 +Content-Transfer-Encoding: 7bit
1.21 +Content-Type: text/calendar; charset="us-ascii"; method="CANCEL"
1.22 +
1.23 +BEGIN:VCALENDAR
1.24 +PRODID:-//imip-agent/test//EN
1.25 +METHOD:CANCEL
1.26 +VERSION:2.0
1.27 +BEGIN:VEVENT
1.28 +ORGANIZER:mailto:paul.boddie@example.com
1.29 +ATTENDEE:mailto:paul.boddie@example.com
1.30 +ATTENDEE;RSVP=TRUE:mailto:resource-car-porsche911@example.com
1.31 +ATTENDEE;RSVP=TRUE:mailto:resource-car-fiat500@example.com
1.32 +DTSTAMP:20141125T004600Z
1.33 +DTSTART;TZID=Europe/Oslo:20141126T160000
1.34 +DTEND;TZID=Europe/Oslo:20141126T170000
1.35 +RRULE:FREQ=DAILY
1.36 +SUMMARY:Test drives
1.37 +UID:event25@example.com
1.38 +END:VEVENT
1.39 +END:VCALENDAR
1.40 +
1.41 +--===============0047278175==--
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/tests/templates/event-request-cars-recurring.txt Mon Feb 08 23:26:28 2016 +0100
2.3 @@ -0,0 +1,37 @@
2.4 +Content-Type: multipart/alternative; boundary="===============0047278175=="
2.5 +MIME-Version: 1.0
2.6 +From: paul.boddie@example.com
2.7 +To: resource-car-porsche911@example.com, resource-car-fiat500@example.com
2.8 +Subject: Invitation!
2.9 +
2.10 +--===============0047278175==
2.11 +Content-Type: text/plain; charset="us-ascii"
2.12 +MIME-Version: 1.0
2.13 +Content-Transfer-Encoding: 7bit
2.14 +
2.15 +This message contains a recurring event reserving two resources at once.
2.16 +
2.17 +--===============0047278175==
2.18 +MIME-Version: 1.0
2.19 +Content-Transfer-Encoding: 7bit
2.20 +Content-Type: text/calendar; charset="us-ascii"; method="REQUEST"
2.21 +
2.22 +BEGIN:VCALENDAR
2.23 +PRODID:-//imip-agent/test//EN
2.24 +METHOD:REQUEST
2.25 +VERSION:2.0
2.26 +BEGIN:VEVENT
2.27 +ORGANIZER:mailto:paul.boddie@example.com
2.28 +ATTENDEE;ROLE=CHAIR:mailto:paul.boddie@example.com
2.29 +ATTENDEE;RSVP=TRUE:mailto:resource-car-porsche911@example.com
2.30 +ATTENDEE;RSVP=TRUE:mailto:resource-car-fiat500@example.com
2.31 +DTSTAMP:20141125T004600Z
2.32 +DTSTART;TZID=Europe/Oslo:20141126T160000
2.33 +DTEND;TZID=Europe/Oslo:20141126T170000
2.34 +RRULE:FREQ=DAILY
2.35 +SUMMARY:Test drives
2.36 +UID:event25@example.com
2.37 +END:VEVENT
2.38 +END:VCALENDAR
2.39 +
2.40 +--===============0047278175==--
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/tests/test_resource_invitation_constraints_quota_recurring_limits.sh Mon Feb 08 23:26:28 2016 +0100
3.3 @@ -0,0 +1,240 @@
3.4 +#!/bin/sh
3.5 +
3.6 +. "`dirname \"$0\"`/common.sh"
3.7 +
3.8 +USER1="mailto:resource-car-porsche911@example.com"
3.9 +USER2="mailto:resource-car-fiat500@example.com"
3.10 +SENDER1="mailto:paul.boddie@example.com"
3.11 +SENDER2="mailto:vincent.vole@example.com"
3.12 +SENDERADDRESS1="paul.boddie@example.com"
3.13 +SENDERADDRESS2="vincent.vole@example.com"
3.14 +FBFILE1="$STORE/$USER1/freebusy"
3.15 +FBFILE2="$STORE/$USER2/freebusy"
3.16 +FBSENDERFILE1="$STORE/$SENDER1/freebusy"
3.17 +FBSENDERFILE2="$STORE/$SENDER2/freebusy"
3.18 +QUOTA=cars
3.19 +JOURNALFILE1="$JOURNAL/$QUOTA/journal/$SENDER1"
3.20 +JOURNALFILE2="$JOURNAL/$QUOTA/journal/$SENDER2"
3.21 +
3.22 +mkdir -p "$PREFS/$USER1"
3.23 +echo 'Europe/Oslo' > "$PREFS/$USER1/TZID"
3.24 +echo 'share' > "$PREFS/$USER1/freebusy_sharing"
3.25 +cat > "$PREFS/$USER1/scheduling_function" <<EOF
3.26 +schedule_in_freebusy
3.27 +check_quota $QUOTA
3.28 +EOF
3.29 +cat > "$PREFS/$USER1/confirmation_function" <<EOF
3.30 +add_to_quota $QUOTA
3.31 +EOF
3.32 +cat > "$PREFS/$USER1/retraction_function" <<EOF
3.33 +remove_from_quota $QUOTA
3.34 +EOF
3.35 +
3.36 +mkdir -p "$PREFS/$USER2"
3.37 +echo 'Europe/Oslo' > "$PREFS/$USER2/TZID"
3.38 +echo 'share' > "$PREFS/$USER2/freebusy_sharing"
3.39 +cat > "$PREFS/$USER2/scheduling_function" <<EOF
3.40 +schedule_in_freebusy
3.41 +check_quota $QUOTA
3.42 +EOF
3.43 +cat > "$PREFS/$USER2/confirmation_function" <<EOF
3.44 +add_to_quota $QUOTA
3.45 +EOF
3.46 +cat > "$PREFS/$USER2/retraction_function" <<EOF
3.47 +remove_from_quota $QUOTA
3.48 +EOF
3.49 +
3.50 +mkdir -p "$JOURNAL/$QUOTA"
3.51 +cat > "$JOURNAL/$QUOTA/limits" <<EOF
3.52 +mailto:vincent.vole@example.com PT10H
3.53 +* PT5H
3.54 +EOF
3.55 +
3.56 + "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-car-all.txt" 2>> $ERROR \
3.57 +| "$SHOWMAIL" \
3.58 +> out0.tmp
3.59 +
3.60 + grep -q 'METHOD:REPLY' out0.tmp \
3.61 +&& ! grep -q '^FREEBUSY' out0.tmp \
3.62 +&& echo "Success" \
3.63 +|| echo "Failed"
3.64 +
3.65 +# Attempt to schedule an event.
3.66 +
3.67 +"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-cars-recurring.txt" 2>> $ERROR
3.68 +
3.69 + grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBSENDERFILE1" \
3.70 +&& grep -q "^20141206T150000Z${TAB}20141206T160000Z" "$FBSENDERFILE1" \
3.71 +&& echo "Success" \
3.72 +|| echo "Failed"
3.73 +
3.74 +# Present the request to the resource.
3.75 +
3.76 + "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-cars-recurring.txt" 2>> $ERROR \
3.77 +| tee out1r.tmp \
3.78 +| "$SHOWMAIL" \
3.79 +> out1.tmp
3.80 +
3.81 + grep -q 'METHOD:REPLY' out1.tmp \
3.82 +&& grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out1.tmp \
3.83 +&& echo "Success" \
3.84 +|| echo "Failed"
3.85 +
3.86 + ( ! [ -e "$FBFILE1" ] \
3.87 + || ( ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE1" \
3.88 + && ! grep -q "^20141206T150000Z${TAB}20141206T160000Z" "$FBFILE1" )) \
3.89 +&& ( ! [ -e "$FBFILE2" ] \
3.90 + || ( ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE2" \
3.91 + && ! grep -q "^20141206T150000Z${TAB}20141206T160000Z" "$FBFILE2" )) \
3.92 +&& echo "Success" \
3.93 +|| echo "Failed"
3.94 +
3.95 +# Check the quota (event is not confirmed).
3.96 +
3.97 + ! [ -e "$JOURNALFILE1" ] \
3.98 +|| ! grep -q "event25@example.com" "$JOURNALFILE1" \
3.99 +&& echo "Success" \
3.100 +|| echo "Failed"
3.101 +
3.102 +# Modify the event and attempt to schedule it again.
3.103 +
3.104 + sed 's/FREQ=DAILY/FREQ=DAILY;COUNT=5/;' "$TEMPLATES/event-request-cars-recurring.txt" \
3.105 +| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
3.106 +
3.107 + grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBSENDERFILE1" \
3.108 +&& grep -q "^20141130T150000Z${TAB}20141130T160000Z" "$FBSENDERFILE1" \
3.109 +&& echo "Success" \
3.110 +|| echo "Failed"
3.111 +
3.112 +# Present the request to the resource.
3.113 +
3.114 + sed 's/FREQ=DAILY/FREQ=DAILY;COUNT=5/;' "$TEMPLATES/event-request-cars-recurring.txt" \
3.115 +| "$RESOURCE_SCRIPT" $ARGS 2>> $ERROR \
3.116 +| tee out2r.tmp \
3.117 +| "$SHOWMAIL" \
3.118 +> out2.tmp
3.119 +
3.120 +# Since the email module used by showmail.py cannot stop after reading a single
3.121 +# message, the second message is obtained.
3.122 +
3.123 + grep -n '^From ' out2r.tmp \
3.124 +| tail -n 1 \
3.125 +| cut -d ':' -f 1 \
3.126 +| xargs -I{} tail -n +'{}' out2r.tmp \
3.127 +| "$SHOWMAIL" \
3.128 +>> out2.tmp
3.129 +
3.130 + grep -q 'METHOD:REPLY' out2.tmp \
3.131 +&& grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out2.tmp \
3.132 +&& grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out2.tmp \
3.133 +&& echo "Success" \
3.134 +|| echo "Failed"
3.135 +
3.136 + (( ! [ -e "$FBFILE1" ] \
3.137 + || ( ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE1" \
3.138 + && ! grep -q "^20141130T150000Z${TAB}20141130T160000Z" "$FBFILE1" )) \
3.139 + && [ -e "$FBFILE2" ] \
3.140 + && grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE2" \
3.141 + && grep -q "^20141130T150000Z${TAB}20141130T160000Z" "$FBFILE2" ) \
3.142 +|| (( ! [ -e "$FBFILE2" ] \
3.143 + || ( ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE2" \
3.144 + && ! grep -q "^20141130T150000Z${TAB}20141130T160000Z" "$FBFILE2" )) \
3.145 + && [ -e "$FBFILE1" ] \
3.146 + && grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE1" \
3.147 + && grep -q "^20141130T150000Z${TAB}20141130T160000Z" "$FBFILE1" ) \
3.148 +&& echo "Success" \
3.149 +|| echo "Failed"
3.150 +
3.151 +# Check the quota (event is confirmed for one resource).
3.152 +
3.153 + ! [ -e "$JOURNALFILE1" ] \
3.154 +|| grep -q "event25@example.com" "$JOURNALFILE1" \
3.155 +&& echo "Success" \
3.156 +|| echo "Failed"
3.157 +
3.158 +# Cancel the event.
3.159 +
3.160 +"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-cars-recurring.txt" 2>> $ERROR
3.161 +
3.162 + ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBSENDERFILE1" \
3.163 +&& ! grep -q "^20141130T150000Z${TAB}20141130T160000Z" "$FBSENDERFILE1" \
3.164 +&& echo "Success" \
3.165 +|| echo "Failed"
3.166 +
3.167 +# Present the request to the resource.
3.168 +
3.169 + "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-cars-recurring.txt" 2>> $ERROR \
3.170 +| tee out3r.tmp \
3.171 +| "$SHOWMAIL" \
3.172 +> out3.tmp
3.173 +
3.174 + ! grep -q 'METHOD:REPLY' out3.tmp \
3.175 +&& echo "Success" \
3.176 +|| echo "Failed"
3.177 +
3.178 + ( ! [ -e "$FBFILE1" ] \
3.179 + || ( ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE1" \
3.180 + && ! grep -q "^20141206T150000Z${TAB}20141206T160000Z" "$FBFILE1" )) \
3.181 +&& ( ! [ -e "$FBFILE2" ] \
3.182 + || ( ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE2" \
3.183 + && ! grep -q "^20141206T150000Z${TAB}20141206T160000Z" "$FBFILE2" )) \
3.184 +&& echo "Success" \
3.185 +|| echo "Failed"
3.186 +
3.187 +# Check the quota (event is retracted).
3.188 +
3.189 + ! [ -e "$JOURNALFILE1" ] \
3.190 +|| [ `grep "event25@example.com" "$JOURNALFILE1" | wc -l` = '2' ] \
3.191 +&& echo "Success" \
3.192 +|| echo "Failed"
3.193 +
3.194 +# Modify the event and attempt to schedule it again.
3.195 +
3.196 + sed 's/FREQ=DAILY/FREQ=DAILY;COUNT=5/;' "$TEMPLATES/event-request-cars-recurring.txt" \
3.197 +| sed "s/$SENDERADDRESS1/$SENDERADDRESS2/;" \
3.198 +| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
3.199 +
3.200 + grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBSENDERFILE2" \
3.201 +&& grep -q "^20141130T150000Z${TAB}20141130T160000Z" "$FBSENDERFILE2" \
3.202 +&& echo "Success" \
3.203 +|| echo "Failed"
3.204 +
3.205 +# Present the request to the resource.
3.206 +
3.207 + sed 's/FREQ=DAILY/FREQ=DAILY;COUNT=5/;' "$TEMPLATES/event-request-cars-recurring.txt" \
3.208 +| sed "s/$SENDERADDRESS1/$SENDERADDRESS2/;" \
3.209 +| "$RESOURCE_SCRIPT" $ARGS 2>> $ERROR \
3.210 +| tee out4r.tmp \
3.211 +| "$SHOWMAIL" \
3.212 +> out4.tmp
3.213 +
3.214 +# Since the email module used by showmail.py cannot stop after reading a single
3.215 +# message, the second message is obtained.
3.216 +
3.217 + grep -n '^From ' out4r.tmp \
3.218 +| tail -n 1 \
3.219 +| cut -d ':' -f 1 \
3.220 +| xargs -I{} tail -n +'{}' out4r.tmp \
3.221 +| "$SHOWMAIL" \
3.222 +>> out4.tmp
3.223 +
3.224 + grep -q 'METHOD:REPLY' out4.tmp \
3.225 +&& [ `grep 'ATTENDEE.*;PARTSTAT=ACCEPTED' out4.tmp | wc -l` = '2' ] \
3.226 +&& echo "Success" \
3.227 +|| echo "Failed"
3.228 +
3.229 + [ -e "$FBFILE1" ] \
3.230 +&& grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE1" \
3.231 +&& grep -q "^20141130T150000Z${TAB}20141130T160000Z" "$FBFILE1" \
3.232 +&& [ -e "$FBFILE2" ] \
3.233 +&& grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE2" \
3.234 +&& grep -q "^20141130T150000Z${TAB}20141130T160000Z" "$FBFILE2" \
3.235 +&& echo "Success" \
3.236 +|| echo "Failed"
3.237 +
3.238 +# Check the quota (event is confirmed for both resources).
3.239 +
3.240 + [ -e "$JOURNALFILE2" ] \
3.241 +&& [ `grep "event25@example.com" "$JOURNALFILE2" | wc -l` = '1' ] \
3.242 +&& echo "Success" \
3.243 +|| echo "Failed"