1 #!/bin/sh 2 3 THIS_DIR=`dirname $0` 4 5 TEMPLATES="$THIS_DIR/templates" 6 RESOURCE_SCRIPT="$THIS_DIR/../imip_resource.py" 7 SHOWMAIL="$THIS_DIR/../tools/showmail.py" 8 STORE=/tmp/store 9 STATIC=/tmp/static 10 PREFS=/tmp/prefs 11 ARGS="-S $STORE -P $STATIC -p $PREFS -d" 12 USER="mailto:resource-room-confroom@example.com" 13 ERROR=err.tmp 14 15 rm -r $STORE 16 rm -r $STATIC 17 rm -r $PREFS 18 rm $ERROR 19 rm out*.tmp 20 21 mkdir -p "$PREFS/$USER" 22 echo 'Europe/Oslo' > "$PREFS/$USER/TZID" 23 echo 'share' > "$PREFS/$USER/freebusy_sharing" 24 25 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-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 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-day.txt" 2>> $ERROR \ 35 | "$SHOWMAIL" \ 36 > out1.tmp 37 38 grep -q 'METHOD:REPLY' out1.tmp \ 39 && ! grep -q '^FREEBUSY' out1.tmp \ 40 && echo "Success" \ 41 || echo "Failed" 42 43 # Recover from a bad DTSTAMP. 44 45 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-bad-dtstamp.txt" 2>> $ERROR \ 46 | "$SHOWMAIL" \ 47 > out2.tmp 48 49 grep -q 'METHOD:REPLY' out2.tmp \ 50 && grep -q 'ATTENDEE;PARTSTAT=ACCEPTED' out2.tmp \ 51 && echo "Success" \ 52 || echo "Failed" 53 54 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-day.txt" 2>> $ERROR \ 55 | "$SHOWMAIL" \ 56 > out3.tmp 57 58 grep -q 'METHOD:REPLY' out3.tmp \ 59 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T080000Z/20141126T090000Z' out3.tmp \ 60 && echo "Success" \ 61 || echo "Failed" 62 63 # Reject a bad DTSTART. 64 65 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-bad-dtstart.txt" 2>> $ERROR \ 66 | "$SHOWMAIL" \ 67 > out4.tmp 68 69 ! grep -q 'METHOD:REPLY' out4.tmp \ 70 && echo "Success" \ 71 || echo "Failed" 72 73 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-day.txt" 2>> $ERROR \ 74 | "$SHOWMAIL" \ 75 > out5.tmp 76 77 grep -q 'METHOD:REPLY' out5.tmp \ 78 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T090000Z/20141126T100000Z' out5.tmp \ 79 && echo "Success" \ 80 || echo "Failed" 81 82 # Reject a bad DTEND. 83 84 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-bad-dtend.txt" 2>> $ERROR \ 85 | "$SHOWMAIL" \ 86 > out6.tmp 87 88 ! grep -q 'METHOD:REPLY' out6.tmp \ 89 && echo "Success" \ 90 || echo "Failed" 91 92 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-day.txt" 2>> $ERROR \ 93 | "$SHOWMAIL" \ 94 > out7.tmp 95 96 grep -q 'METHOD:REPLY' out7.tmp \ 97 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T100000Z/20141126T110000Z' out7.tmp \ 98 && echo "Success" \ 99 || echo "Failed"