imip-agent

Annotated tests/test_resource_invitation_group.sh

871:b38466ae1e51
2015-10-18 Paul Boddie Handle rule-based occurrences as exceptions when removed by attendees for counter-proposals.
paul@716 1
#!/bin/sh
paul@716 2
paul@716 3
THIS_DIR=`dirname $0`
paul@716 4
paul@716 5
TEMPLATES="$THIS_DIR/templates"
paul@716 6
RESOURCE_SCRIPT="$THIS_DIR/../imip_resource.py"
paul@716 7
SHOWMAIL="$THIS_DIR/../tools/showmail.py"
paul@716 8
STORE=/tmp/store
paul@716 9
STATIC=/tmp/static
paul@716 10
PREFS=/tmp/prefs
paul@716 11
ARGS="-S $STORE -P $STATIC -p $PREFS -d"
paul@716 12
USER="mailto:resource-room-confroom@example.com"
paul@716 13
paul@716 14
ERROR=err.tmp
paul@716 15
paul@716 16
rm -r $STORE
paul@716 17
rm -r $STATIC
paul@716 18
rm -r $PREFS
paul@716 19
rm $ERROR
paul@716 20
rm out*.tmp
paul@716 21
paul@716 22
mkdir -p "$PREFS/$USER"
paul@716 23
echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
paul@716 24
echo 'share' > "$PREFS/$USER/freebusy_sharing"
paul@716 25
paul@716 26
for N in `seq 1 5` ; do
paul@716 27
  SENDER="mailto:person-$N@example.com"
paul@716 28
  mkdir -p "$PREFS/$SENDER"
paul@716 29
  echo 'Europe/Oslo' > "$PREFS/$SENDER/TZID"
paul@716 30
done
paul@716 31
paul@716 32
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-all.txt" 2>> $ERROR \
paul@716 33
| "$SHOWMAIL" \
paul@716 34
> out0.tmp
paul@716 35
paul@716 36
   grep -q 'METHOD:REPLY' out0.tmp \
paul@716 37
&& ! grep -q '^FREEBUSY' out0.tmp \
paul@716 38
&& echo "Success" \
paul@716 39
|| echo "Failed"
paul@716 40
paul@719 41
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-day.txt" 2>> $ERROR \
paul@716 42
| "$SHOWMAIL" \
paul@716 43
> out1.tmp
paul@716 44
paul@716 45
   grep -q 'METHOD:REPLY' out1.tmp \
paul@716 46
&& ! grep -q '^FREEBUSY' out1.tmp \
paul@716 47
&& echo "Success" \
paul@716 48
|| echo "Failed"
paul@716 49
paul@716 50
# Loop until all requests have been satisfied.
paul@716 51
paul@716 52
while [ ! -e outP1.tmp ] || [ `grep 'PARTSTAT' outP*.tmp | grep 'ACCEPTED' | wc -l` != '5' ] ; do
paul@716 53
paul@716 54
  # Request free/busy information.
paul@716 55
paul@716 56
  FBRESULT="outfbP.tmp"
paul@716 57
  export SENDER="mailto:person-N@example.com"
paul@716 58
  export SENDERADDRESS="person-N@example.com"
paul@716 59
paul@716 60
    envsubst < "$TEMPLATES/fb-request-group.txt" \
paul@716 61
  | tee "infbP.tmp" \
paul@716 62
  | "$RESOURCE_SCRIPT" $ARGS 2>> $ERROR \
paul@716 63
  | "$SHOWMAIL" 2>> $ERROR \
paul@716 64
  > "$FBRESULT"
paul@716 65
paul@716 66
  # Set the requesters on a race to book with this information.
paul@716 67
paul@716 68
  seq 1 5 | xargs -P0 -I{} "$THIS_DIR/resource_request.sh" {} "$FBRESULT"
paul@716 69
  wait
paul@716 70
  echo "Accepted: `grep 'ACCEPTED' outP*.tmp | wc -l`"
paul@716 71
paul@716 72
done
paul@716 73
paul@716 74
   [ `grep 'PARTSTAT' outP*.tmp | grep 'ACCEPTED' | wc -l` = '5' ] \
paul@716 75
&& echo "Success" \
paul@716 76
|| echo "Failed"
paul@719 77
paul@719 78
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-day.txt" 2>> $ERROR \
paul@719 79
| "$SHOWMAIL" \
paul@719 80
> out2.tmp
paul@719 81
paul@719 82
   grep -q 'METHOD:REPLY' out2.tmp \
paul@719 83
&& [ `grep '^FREEBUSY' out2.tmp | sort -u | wc -l` = '5' ] \
paul@719 84
&& echo "Success" \
paul@719 85
|| echo "Failed"