1 #!/bin/sh 2 3 . "`dirname \"$0\"`/common.sh" 4 5 USER="mailto:resource-room-sauna@example.com" 6 SENDER="mailto:paul.boddie@example.net" 7 FBFILE="$STORE/$USER/freebusy" 8 FBOFFERFILE="$STORE/$USER/freebusy-offers" 9 FBSENDERFILE="$STORE/$SENDER/freebusy" 10 FBSENDEROTHERFILE="$STORE/$SENDER/freebusy-other/$USER" 11 FBSENDERREQUESTS="$STORE/$SENDER/requests" 12 13 mkdir -p "$PREFS/$USER" 14 echo 'Europe/Oslo' > "$PREFS/$USER/TZID" 15 echo 'share' > "$PREFS/$USER/freebusy_sharing" 16 cat > "$PREFS/$USER/scheduling_function" <<EOF 17 schedule_in_freebusy 18 same_domain_only 19 EOF 20 echo '10,12,14,16,18:0,15,30,45' > "$PREFS/$USER/permitted_times" 21 echo 'PT60S' > "$PREFS/$USER/freebusy_offers" 22 23 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \ 24 | "$SHOWMAIL" \ 25 > out0.tmp 26 27 grep -q 'METHOD:REPLY' out0.tmp \ 28 && ! grep -q '^FREEBUSY' out0.tmp \ 29 && echo "Success" \ 30 || echo "Failed" 31 32 # Attempt to schedule an event. 33 34 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-outsider.txt" 2>> $ERROR 35 36 grep -q "^20141126T150000Z${TAB}20141126T154500Z" "$FBSENDERFILE" \ 37 && echo "Success" \ 38 || echo "Failed" 39 40 # Present the request to the resource. 41 42 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-outsider.txt" 2>> $ERROR \ 43 | tee out1r.tmp \ 44 | "$SHOWMAIL" \ 45 > out1.tmp 46 47 grep -q 'METHOD:REPLY' out1.tmp \ 48 && grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out1.tmp \ 49 && echo "Success" \ 50 || echo "Failed" 51 52 ! [ -e "$FBFILE" ] \ 53 || ! grep -q "^20141126T150000Z${TAB}20141126T154500Z" "$FBFILE" \ 54 && echo "Success" \ 55 || echo "Failed" 56 57 # Relax the scheduling function. 58 59 cat > "$PREFS/$USER/scheduling_function" <<EOF 60 schedule_in_freebusy 61 EOF 62 63 # Present the request to the resource. 64 65 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-outsider.txt" 2>> $ERROR \ 66 | tee out2r.tmp \ 67 | "$SHOWMAIL" \ 68 > out2.tmp 69 70 grep -q 'METHOD:REPLY' out2.tmp \ 71 && grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out2.tmp \ 72 && echo "Success" \ 73 || echo "Failed" 74 75 [ -e "$FBFILE" ] \ 76 && grep -q "^20141126T150000Z${TAB}20141126T154500Z" "$FBFILE" \ 77 && echo "Success" \ 78 || echo "Failed" 79 80 # Check the free/busy state of the resource again. 81 82 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \ 83 | "$SHOWMAIL" \ 84 > out3.tmp 85 86 grep -q 'METHOD:REPLY' out3.tmp \ 87 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T154500Z' out3.tmp \ 88 && echo "Success" \ 89 || echo "Failed"