imip-agent

tests/test_resource_invitation_constraints.sh

1164:53901bdc8b97
2016-05-10 Paul Boddie Fixed scheduling function reference.
     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      9 mkdir -p "$PREFS/$USER"    10 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"    11 echo 'share' > "$PREFS/$USER/freebusy_sharing"    12 echo 'schedule_corrected_in_freebusy' > "$PREFS/$USER/scheduling_function"    13 echo '10,12,14,16,18:0,15,30,45' > "$PREFS/$USER/permitted_times"    14 echo 'PT60S' > "$PREFS/$USER/freebusy_offers"    15     16   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \    17 | "$SHOWMAIL" \    18 > out0.tmp    19     20    grep -q 'METHOD:REPLY' out0.tmp \    21 && ! grep -q '^FREEBUSY' out0.tmp \    22 && echo "Success" \    23 || echo "Failed"    24     25 # Attempt to schedule an event.    26     27 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR    28     29    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \    30 |  tee out0f.tmp \    31 |  grep -q "^20141126T151000Z${TAB}20141126T154500Z" \    32 && echo "Success" \    33 || echo "Failed"    34     35 # Present the request to the resource.    36     37   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR \    38 | tee out1r.tmp \    39 | "$SHOWMAIL" \    40 > out1.tmp    41     42    grep -q 'METHOD:COUNTER' out1.tmp \    43 && grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161500' out1.tmp \    44 && echo "Success" \    45 || echo "Failed"    46     47    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \    48 >  out1f.tmp    49     50    ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "out1f.tmp" \    51 && echo "Success" \    52 || echo "Failed"    53     54    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \    55 |  tee out1o.tmp \    56 |  grep -q "^20141126T151500Z${TAB}20141126T154500Z" \    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    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy_other" "$USER" \    68 >  out2f.tmp    69     70    ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "out2f.tmp" \    71 && echo "Success" \    72 || echo "Failed"    73     74    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "object" "event13@example.com" \    75 |  tee out2O.tmp \    76 |  grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161000' \    77 && echo "Success" \    78 || echo "Failed"    79     80    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "countered_object" "event13@example.com" "$USER" \    81 |  tee out2C.tmp \    82 |  grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161500' \    83 && echo "Success" \    84 || echo "Failed"    85     86    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "requests" \    87 |  tee out2r.tmp \    88 |  grep -q 'event13@example.com' \    89 && echo "Success" \    90 || echo "Failed"    91     92 # Attempt to schedule an event in the proposed period.    93     94 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-rival.txt" 2>> $ERROR    95     96    "$LIST_SCRIPT" $LIST_ARGS "$RIVALSENDER" "freebusy" \    97 >  out2R.tmp    98     99    ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "out2R.tmp" \   100 && grep -q "^20141126T153000Z${TAB}20141126T154500Z" "out2R.tmp" \   101 && echo "Success" \   102 || echo "Failed"   103    104 # Present the request to the resource.   105    106   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-rival.txt" 2>> $ERROR \   107 | tee out3r.tmp \   108 | "$SHOWMAIL" \   109 > out3.tmp   110    111    grep -q 'METHOD:REPLY' out3.tmp \   112 && grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out3.tmp \   113 && echo "Success" \   114 || echo "Failed"   115    116 # Present the response to the organiser.   117    118   "$PERSON_SCRIPT" $ARGS < out3r.tmp 2>> $ERROR \   119 | tee out4r.tmp \   120 | "$SHOWMAIL" \   121 > out4.tmp   122    123    "$LIST_SCRIPT" $LIST_ARGS "$RIVALSENDER" "freebusy" \   124 >  out4R.tmp   125    126    ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "out4R.tmp" \   127 && grep -q "^20141126T153000Z${TAB}20141126T154500Z" "out4R.tmp" \   128 && echo "Success" \   129 || echo "Failed"   130    131    "$LIST_SCRIPT" $LIST_ARGS "$RIVALSENDER" "object" "event18@example.com" \   132 |  tee out4O.tmp \   133 |  grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' \   134 && echo "Success" \   135 || echo "Failed"   136    137 # Check the free/busy state of the resource so far.   138    139   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \   140 | "$SHOWMAIL" \   141 > out5.tmp   142    143    grep -q 'METHOD:REPLY' out5.tmp \   144 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151000Z/20141126T154500Z' out5.tmp \   145 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T154500Z' out5.tmp \   146 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T154500Z' out5.tmp \   147 && echo "Success" \   148 || echo "Failed"   149    150 # Attempt to schedule again in response to the counter-proposal.   151    152 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-good.txt" 2>> $ERROR   153    154    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \   155 >  out5f.tmp   156    157    ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "out5f.tmp" \   158 && ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "out5f.tmp" \   159 && ! grep -q "^20141126T153000Z${TAB}20141126T154500Z" "out5f.tmp" \   160 && echo "Success" \   161 || echo "Failed"   162    163    [ ! -e "$STORE/$SENDER/counters/objects/event13@example.com/$USER" ] \   164 && echo "Success" \   165 || echo "Failed"   166    167    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "requests" \   168 >  out5r.tmp   169    170    ! grep -q 'event13@example.com' "out5r.tmp" \   171 && echo "Success" \   172 || echo "Failed"   173    174 # Present the request to the resource.   175    176   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-good.txt" 2>> $ERROR \   177 | "$SHOWMAIL" \   178 > out6.tmp   179    180    grep -q 'METHOD:REPLY' out6.tmp \   181 && grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out6.tmp \   182 && echo "Success" \   183 || echo "Failed"   184    185    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \   186 |  tee out6f.tmp \   187 |  grep -q "^20141126T150000Z${TAB}20141126T154500Z" \   188 && echo "Success" \   189 || echo "Failed"   190    191    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \   192 >  out6o.tmp   193    194    ! grep -q "^20141126T150000Z${TAB}20141126T154500Z" "out6o.tmp" \   195 && ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "out6o.tmp" \   196 && ! grep -q "^20141126T153000Z${TAB}20141126T154500Z" "out6o.tmp" \   197 && echo "Success" \   198 || echo "Failed"   199    200 # Present the response to the organiser.   201    202   "$PERSON_SCRIPT" $ARGS < out6.tmp 2>> $ERROR \   203 | tee out7r.tmp \   204 | "$SHOWMAIL" \   205 > out7.tmp   206    207    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \   208 >  out7f.tmp   209    210    grep -q "^20141126T150000Z${TAB}20141126T154500Z" "out7f.tmp" \   211 && ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "out7f.tmp" \   212 && ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "out7f.tmp" \   213 && ! grep -q "^20141126T153000Z${TAB}20141126T154500Z" "out7f.tmp" \   214 && echo "Success" \   215 || echo "Failed"   216    217    [ ! -e "$STORE/$SENDER/counters/objects/event13@example.com/$USER" ] \   218 && echo "Success" \   219 || echo "Failed"   220    221    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "requests" \   222 >  out7r.tmp   223    224    ! grep -q 'event13@example.com' "out7r.tmp" \   225 && echo "Success" \   226 || echo "Failed"   227    228 # Check the free/busy state of the resource again.   229    230   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \   231 | "$SHOWMAIL" \   232 > out6.tmp   233    234    grep -q 'METHOD:REPLY' out6.tmp \   235 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T154500Z' out6.tmp \   236 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151000Z/20141126T154500Z' out6.tmp \   237 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T154500Z' out6.tmp \   238 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T154500Z' out6.tmp \   239 && echo "Success" \   240 || echo "Failed"