imip-agent

tests/test_resource_invitation_group.sh

1028:7f4bd7d4236a
2016-01-29 Paul Boddie Added support for additional scheduling modules, moving the existing functionality into the freebusy module, providing initial functionality for an access-based module, and introducing a mechanism to update the registry of modules explicitly. Added a test of combining scheduling functions.
     1 #!/bin/sh     2      3 . "`dirname \"$0\"`/common.sh"     4      5 USER="mailto:resource-room-confroom@example.com"     6      7 mkdir -p "$PREFS/$USER"     8 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"     9 echo 'share' > "$PREFS/$USER/freebusy_sharing"    10     11 for N in `seq 1 5` ; do    12   SENDER="mailto:person-$N@example.com"    13   mkdir -p "$PREFS/$SENDER"    14   echo 'Europe/Oslo' > "$PREFS/$SENDER/TZID"    15 done    16     17   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-all.txt" 2>> $ERROR \    18 | "$SHOWMAIL" \    19 > out0.tmp    20     21    grep -q 'METHOD:REPLY' out0.tmp \    22 && ! grep -q '^FREEBUSY' out0.tmp \    23 && echo "Success" \    24 || echo "Failed"    25     26   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-day.txt" 2>> $ERROR \    27 | "$SHOWMAIL" \    28 > out1.tmp    29     30    grep -q 'METHOD:REPLY' out1.tmp \    31 && ! grep -q '^FREEBUSY' out1.tmp \    32 && echo "Success" \    33 || echo "Failed"    34     35 # Loop until all requests have been satisfied.    36     37 while [ ! -e outP1.tmp ] || [ `grep 'PARTSTAT' outP*.tmp | grep 'ACCEPTED' | wc -l` != '5' ] ; do    38     39   # Request free/busy information.    40     41   FBRESULT="outfbP.tmp"    42   export SENDER="mailto:person-N@example.com"    43   export SENDERADDRESS="person-N@example.com"    44     45     envsubst < "$TEMPLATES/fb-request-group.txt" \    46   | tee "infbP.tmp" \    47   | "$RESOURCE_SCRIPT" $ARGS 2>> $ERROR \    48   | "$SHOWMAIL" 2>> $ERROR \    49   > "$FBRESULT"    50     51   # Set the requesters on a race to book with this information.    52     53   seq 1 5 | xargs -P0 -I{} "$THIS_DIR/resource_request.sh" {} "$FBRESULT"    54   wait    55   echo "Accepted: `grep 'ACCEPTED' outP*.tmp | wc -l`"    56     57 done    58     59    [ `grep 'PARTSTAT' outP*.tmp | grep 'ACCEPTED' | wc -l` = '5' ] \    60 && echo "Success" \    61 || echo "Failed"    62     63   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-day.txt" 2>> $ERROR \    64 | "$SHOWMAIL" \    65 > out2.tmp    66     67    grep -q 'METHOD:REPLY' out2.tmp \    68 && [ `grep '^FREEBUSY' out2.tmp | sort -u | wc -l` = '5' ] \    69 && echo "Success" \    70 || echo "Failed"