imip-agent

Annotated tests/test_resource_invitation_group.sh

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