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.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 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request.txt" 2>> $ERROR \ 44 | "$SHOWMAIL" \ 45 > out2.tmp 46 47 grep -q 'METHOD:REPLY' out2.tmp \ 48 && grep -q 'ATTENDEE;PARTSTAT=ACCEPTED' out2.tmp \ 49 && echo "Success" \ 50 || echo "Failed" 51 52 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \ 53 | "$SHOWMAIL" \ 54 > out3.tmp 55 56 grep -q 'METHOD:REPLY' out3.tmp \ 57 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out3.tmp \ 58 && echo "Success" \ 59 || echo "Failed" 60 61 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-conflict.txt" 2>> $ERROR \ 62 | "$SHOWMAIL" \ 63 > out4.tmp 64 65 grep -q 'METHOD:REPLY' out4.tmp \ 66 && grep -q 'ATTENDEE;PARTSTAT=DECLINED' out4.tmp \ 67 && echo "Success" \ 68 || echo "Failed" 69 70 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-conflict-utc.txt" 2>> $ERROR \ 71 | "$SHOWMAIL" \ 72 > out5.tmp 73 74 grep -q 'METHOD:REPLY' out5.tmp \ 75 && grep -q 'ATTENDEE;PARTSTAT=DECLINED' out5.tmp \ 76 && echo "Success" \ 77 || echo "Failed" 78 79 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \ 80 | "$SHOWMAIL" \ 81 > out6.tmp 82 83 grep -q 'METHOD:REPLY' out6.tmp \ 84 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out6.tmp \ 85 && [ `grep 'FREEBUSY;FBTYPE=BUSY' out6.tmp | wc -l` = '1' ] \ 86 && echo "Success" \ 87 || echo "Failed" 88 89 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-cancel.txt" 2>> $ERROR 90 echo "Cancel..." 91 92 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \ 93 | "$SHOWMAIL" \ 94 > out7.tmp 95 96 grep -q 'METHOD:REPLY' out7.tmp \ 97 && ! grep -q '^FREEBUSY' out7.tmp \ 98 && echo "Success" \ 99 || echo "Failed" 100 101 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-spoofed.txt" 2>> $ERROR 102 echo "Spoof..." 103 104 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-all.txt" 2>> $ERROR \ 105 | "$SHOWMAIL" \ 106 > out8.tmp 107 108 grep -q 'METHOD:REPLY' out8.tmp \ 109 && ! grep -q '^FREEBUSY' out8.tmp \ 110 && echo "Success" \ 111 || echo "Failed"