imip-agent

tests/test_resource_invitation_constraints.sh

1069:37921ab84c01
2016-03-06 Paul Boddie Moved imip_store into a new imiptools.stores package as the file module.
     1 #!/bin/sh     2      3 . "`dirname \"$0\"`/common.sh"     4      5 USER="mailto:resource-room-sauna@example.com"     6 SENDER="mailto:paul.boddie@example.com"     7 RIVALSENDER="mailto:vincent.vole@example.com"     8 FBFILE="$STORE/$USER/freebusy"     9 FBOFFERFILE="$STORE/$USER/freebusy-offers"    10 FBSENDERFILE="$STORE/$SENDER/freebusy"    11 FBSENDEROTHERFILE="$STORE/$SENDER/freebusy-other/$USER"    12 FBSENDERREQUESTS="$STORE/$SENDER/requests"    13 FBRIVALSENDERFILE="$STORE/$RIVALSENDER/freebusy"    14     15 mkdir -p "$PREFS/$USER"    16 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"    17 echo 'share' > "$PREFS/$USER/freebusy_sharing"    18 echo 'schedule_corrected_in_freebusy' > "$PREFS/$USER/scheduling_function"    19 echo '10,12,14,16,18:0,15,30,45' > "$PREFS/$USER/permitted_times"    20 echo 'PT60S' > "$PREFS/$USER/freebusy_offers"    21     22   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \    23 | "$SHOWMAIL" \    24 > out0.tmp    25     26    grep -q 'METHOD:REPLY' out0.tmp \    27 && ! grep -q '^FREEBUSY' out0.tmp \    28 && echo "Success" \    29 || echo "Failed"    30     31 # Attempt to schedule an event.    32     33 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR    34     35    grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBSENDERFILE" \    36 && echo "Success" \    37 || echo "Failed"    38     39 # Present the request to the resource.    40     41   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR \    42 | tee out1r.tmp \    43 | "$SHOWMAIL" \    44 > out1.tmp    45     46    grep -q 'METHOD:COUNTER' out1.tmp \    47 && grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161500' out1.tmp \    48 && echo "Success" \    49 || echo "Failed"    50     51    ! [ -e "$FBFILE" ] \    52 || ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBFILE" \    53 && echo "Success" \    54 || echo "Failed"    55     56    grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBOFFERFILE" \    57 && echo "Success" \    58 || echo "Failed"    59     60 # Present the response to the organiser.    61     62   "$PERSON_SCRIPT" $ARGS < out1r.tmp 2>> $ERROR \    63 | tee out2r.tmp \    64 | "$SHOWMAIL" \    65 > out2.tmp    66     67    ( ! [ -e "$FBSENDEROTHERFILE" ] \    68   || ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBSENDEROTHERFILE") \    69 && echo "Success" \    70 || echo "Failed"    71     72    grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161000' "$STORE/$SENDER/objects/event13@example.com" \    73 && echo "Success" \    74 || echo "Failed"    75     76    grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161500' "$STORE/$SENDER/counters/objects/event13@example.com/$USER" \    77 && echo "Success" \    78 || echo "Failed"    79     80    grep -q 'event13@example.com' "$FBSENDERREQUESTS" \    81 && echo "Success" \    82 || echo "Failed"    83     84 # Attempt to schedule an event in the proposed period.    85     86 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-rival.txt" 2>> $ERROR    87     88    ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBRIVALSENDERFILE" \    89 && grep -q "^20141126T153000Z${TAB}20141126T154500Z" "$FBRIVALSENDERFILE" \    90 && echo "Success" \    91 || echo "Failed"    92     93 # Present the request to the resource.    94     95   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-rival.txt" 2>> $ERROR \    96 | "$SHOWMAIL" \    97 > out3.tmp    98     99    grep -q 'METHOD:REPLY' out3.tmp \   100 && grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out3.tmp \   101 && echo "Success" \   102 || echo "Failed"   103    104 # Present the response to the organiser.   105    106   "$PERSON_SCRIPT" $ARGS < out3.tmp 2>> $ERROR \   107 | tee out4r.tmp \   108 | "$SHOWMAIL" \   109 > out4.tmp   110    111    ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBRIVALSENDERFILE" \   112 && grep -q "^20141126T153000Z${TAB}20141126T154500Z" "$FBRIVALSENDERFILE" \   113 && echo "Success" \   114 || echo "Failed"   115    116    grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' "$STORE/$RIVALSENDER/objects/event18@example.com" \   117 && echo "Success" \   118 || echo "Failed"   119    120 # Check the free/busy state of the resource so far.   121    122   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \   123 | "$SHOWMAIL" \   124 > out5.tmp   125    126    grep -q 'METHOD:REPLY' out5.tmp \   127 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151000Z/20141126T154500Z' out5.tmp \   128 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T154500Z' out5.tmp \   129 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T154500Z' out5.tmp \   130 && echo "Success" \   131 || echo "Failed"   132    133 # Attempt to schedule again in response to the counter-proposal.   134    135 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-good.txt" 2>> $ERROR   136    137    ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBSENDERFILE" \   138 && ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBSENDERFILE" \   139 && ! grep -q "^20141126T153000Z${TAB}20141126T154500Z" "$FBSENDERFILE" \   140 && echo "Success" \   141 || echo "Failed"   142    143    [ ! -e "$STORE/$SENDER/counters/objects/event13@example.com/$USER" ] \   144 && echo "Success" \   145 || echo "Failed"   146    147    ! grep -q 'event13@example.com' "$FBSENDERREQUESTS" \   148 && echo "Success" \   149 || echo "Failed"   150    151 # Present the request to the resource.   152    153   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-good.txt" 2>> $ERROR \   154 | "$SHOWMAIL" \   155 > out6.tmp   156    157    grep -q 'METHOD:REPLY' out6.tmp \   158 && grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out6.tmp \   159 && echo "Success" \   160 || echo "Failed"   161    162    grep -q "^20141126T150000Z${TAB}20141126T154500Z" "$FBFILE" \   163 && echo "Success" \   164 || echo "Failed"   165    166    ! grep -q "^20141126T150000Z${TAB}20141126T154500Z" "$FBOFFERFILE" \   167 && ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBOFFERFILE" \   168 && ! grep -q "^20141126T153000Z${TAB}20141126T154500Z" "$FBOFFERFILE" \   169 && echo "Success" \   170 || echo "Failed"   171    172 # Present the response to the organiser.   173    174   "$PERSON_SCRIPT" $ARGS < out6.tmp 2>> $ERROR \   175 | tee out7r.tmp \   176 | "$SHOWMAIL" \   177 > out7.tmp   178    179    grep -q "^20141126T150000Z${TAB}20141126T154500Z" "$FBSENDERFILE" \   180 && ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBSENDERFILE" \   181 && ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBSENDERFILE" \   182 && ! grep -q "^20141126T153000Z${TAB}20141126T154500Z" "$FBSENDERFILE" \   183 && echo "Success" \   184 || echo "Failed"   185    186    [ ! -e "$STORE/$SENDER/counters/objects/event13@example.com/$USER" ] \   187 && echo "Success" \   188 || echo "Failed"   189    190    ! grep -q 'event13@example.com' "$FBSENDERREQUESTS" \   191 && echo "Success" \   192 || echo "Failed"   193    194 # Check the free/busy state of the resource again.   195    196   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \   197 | "$SHOWMAIL" \   198 > out6.tmp   199    200    grep -q 'METHOD:REPLY' out6.tmp \   201 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T154500Z' out6.tmp \   202 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151000Z/20141126T154500Z' out6.tmp \   203 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T154500Z' out6.tmp \   204 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T154500Z' out6.tmp \   205 && echo "Success" \   206 || echo "Failed"