imip-agent

tests/test_resource_invitation_constraints_next_free.sh

1277:d2d07acdcfda
2017-09-30 Paul Boddie Added editing state to assist with client data presentation. client-editing-simplification
     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_next_available_in_freebusy' > "$PREFS/$USER/scheduling_function"    13 echo 'PT60S' > "$PREFS/$USER/freebusy_offers"    14     15   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \    16 | "$SHOWMAIL" \    17 > out0.tmp    18     19    grep -q 'METHOD:REPLY' out0.tmp \    20 && ! grep -q '^FREEBUSY' out0.tmp \    21 && echo "Success" \    22 || echo "Failed"    23     24 # Let the rival sender book the resource.    25     26 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-busy.txt" 2>> $ERROR    27     28    "$LIST_SCRIPT" $LIST_ARGS "$RIVALSENDER" "freebusy" \    29 >  out0s.tmp    30     31    [ `grep "event19@example.com" "out0s.tmp" | wc -l` = '5' ] \    32 && grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out0s.tmp" \    33 && echo "Success" \    34 || echo "Failed"    35     36 # Present the request to the resource.    37     38   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-busy.txt" 2>> $ERROR \    39 | tee out1r.tmp \    40 | "$SHOWMAIL" \    41 > out1.tmp    42     43    grep -q 'METHOD:REPLY' out1.tmp \    44 && grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T160000' out1.tmp \    45 && echo "Success" \    46 || echo "Failed"    47     48    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \    49 >  out1f.tmp    50     51    [ `grep "event19@example.com" "out1f.tmp" | wc -l` = '5' ] \    52 && grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out1f.tmp" \    53 && echo "Success" \    54 || echo "Failed"    55     56 # Present the response to the rival sender.    57     58   "$PERSON_SCRIPT" $ARGS < out1r.tmp 2>> $ERROR \    59 | tee out2r.tmp \    60 | "$SHOWMAIL" \    61 > out2.tmp    62     63 # Publish some conflicting periods as busy.    64     65   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-publish-conflicts.txt" 2>> $ERROR \    66 | "$SHOWMAIL" \    67 > out3.tmp    68     69    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \    70 >  out3f.tmp    71     72    grep -q "^20141126T160000Z${TAB}20141126T170000Z" "out3f.tmp" \    73 && grep -q "^20141126T180000Z${TAB}20141126T190000Z" "out3f.tmp" \    74 && echo "Success" \    75 || echo "Failed"    76     77 # Attempt to schedule an event with the resource.    78     79 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-good.txt" 2>> $ERROR    80     81    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \    82 |  tee out3s.tmp \    83 |  grep -q "^20141126T150000Z${TAB}20141126T154500Z" \    84 && echo "Success" \    85 || echo "Failed"    86     87 # Present the request to the resource. This should cause the event to be    88 # proposed not just after the requested period, but also after the busy periods    89 # published to the resource.    90     91   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-good.txt" 2>> $ERROR \    92 | tee out6r.tmp \    93 | "$SHOWMAIL" \    94 > out6.tmp    95     96    grep -q 'METHOD:COUNTER' out6.tmp \    97 && ! grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out6.tmp \    98 && echo "Success" \    99 || echo "Failed"   100    101    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \   102 >  out6o.tmp   103    104    ! grep -q "^20141126T150000Z${TAB}20141126T154500Z" "out6o.tmp" \   105 && ! grep -q "^20141126T160000Z${TAB}20141126T164500Z" "out6o.tmp" \   106 && ! grep -q "^20141126T170000Z${TAB}20141126T174500Z" "out6o.tmp" \   107 && ! grep -q "^20141126T180000Z${TAB}20141126T184500Z" "out6o.tmp" \   108 && ! grep -q "^20141126T190000Z${TAB}20141126T194500Z" "out6o.tmp" \   109 && grep -q "^20141126T200000Z${TAB}20141126T204500Z" "out6o.tmp" \   110 && echo "Success" \   111 || echo "Failed"   112    113 # Present the response to the organiser.   114    115   "$PERSON_SCRIPT" $ARGS < out6r.tmp 2>> $ERROR \   116 | tee out7r.tmp \   117 | "$SHOWMAIL" \   118 > out7.tmp   119    120    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \   121 >  out7s.tmp   122    123    grep -q "^20141126T150000Z${TAB}20141126T154500Z" "out7s.tmp" \   124 && ! grep -q "^20141126T160000Z${TAB}20141126T164500Z" "out7s.tmp" \   125 && echo "Success" \   126 || echo "Failed"   127    128    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "countered_object" "event13@example.com" "$USER" \   129 |  tee out7C.tmp \   130 |  grep -q "event13@example.com" \   131 && echo "Success" \   132 || echo "Failed"   133    134    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "requests" \   135 |  tee out7R.tmp \   136 |  grep -q 'event13@example.com' \   137 && echo "Success" \   138 || echo "Failed"   139    140 # Reschedule the event by accepting the counter-proposal.   141    142   sed 's/COUNTER/REQUEST/' < out6.tmp \   143 | sed 's/^From: calendar/To: resource-room-sauna/' \   144 | sed 's/^To: paul.boddie/From: paul.boddie/' \   145 > out8.tmp   146    147 "$OUTGOING_SCRIPT" $ARGS < out8.tmp 2>> $ERROR   148    149    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \   150 >  out8s.tmp   151    152    ! grep -q "^20141126T150000Z${TAB}20141126T154500Z" "out8s.tmp" \   153 && grep -q "^20141126T200000Z${TAB}20141126T204500Z" "out8s.tmp" \   154 && echo "Success" \   155 || echo "Failed"   156    157    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "countered_object" "event13@example.com" "$USER" \   158 >  out8C.tmp   159    160    ! grep -q "event13@example.com" "out8C.tmp" \   161 && echo "Success" \   162 || echo "Failed"   163    164    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "requests" \   165 >  out8R.tmp   166    167    ! grep -q 'event13@example.com' "out8R.tmp" \   168 && echo "Success" \   169 || echo "Failed"   170    171   "$RESOURCE_SCRIPT" $ARGS < out8.tmp 2>> $ERROR \   172 | "$SHOWMAIL" \   173 > out9.tmp   174    175    grep -q 'METHOD:REPLY' out9.tmp \   176 && grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T210000' out9.tmp \   177 && echo "Success" \   178 || echo "Failed"   179    180    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \   181 >  out9o.tmp   182    183    ! grep -q "^20141126T150000Z${TAB}20141126T154500Z" "out9o.tmp" \   184 && ! grep -q "^20141126T160000Z${TAB}20141126T164500Z" "out9o.tmp" \   185 && ! grep -q "^20141126T170000Z${TAB}20141126T174500Z" "out9o.tmp" \   186 && ! grep -q "^20141126T180000Z${TAB}20141126T184500Z" "out9o.tmp" \   187 && ! grep -q "^20141126T190000Z${TAB}20141126T194500Z" "out9o.tmp" \   188 && ! grep -q "^20141126T200000Z${TAB}20141126T204500Z" "out9o.tmp" \   189 && echo "Success" \   190 || echo "Failed"   191    192    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \   193 >  out9f.tmp   194    195    [ `grep "event19@example.com" "out9f.tmp" | wc -l` = '5' ] \   196 && [ `grep "event13@example.com" "out9f.tmp" | wc -l` = '1' ] \   197 && grep -q "^20141126T200000Z${TAB}20141126T204500Z" "out9f.tmp" \   198 && echo "Success" \   199 || echo "Failed"   200    201 # Test updating the event to see if the resource can handle this.   202    203   "$RESOURCE_SCRIPT" $ARGS < out8.tmp 2>> $ERROR \   204 | "$SHOWMAIL" \   205 > out10.tmp   206    207    grep -q 'METHOD:REPLY' out10.tmp \   208 && grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T210000' out10.tmp \   209 && echo "Success" \   210 || echo "Failed"   211    212    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \   213 >  out10o.tmp   214    215    ! grep -q "^20141126T150000Z${TAB}20141126T154500Z" "out10o.tmp" \   216 && ! grep -q "^20141126T160000Z${TAB}20141126T164500Z" "out10o.tmp" \   217 && ! grep -q "^20141126T170000Z${TAB}20141126T174500Z" "out10o.tmp" \   218 && ! grep -q "^20141126T180000Z${TAB}20141126T184500Z" "out10o.tmp" \   219 && ! grep -q "^20141126T190000Z${TAB}20141126T194500Z" "out10o.tmp" \   220 && ! grep -q "^20141126T200000Z${TAB}20141126T204500Z" "out10o.tmp" \   221 && echo "Success" \   222 || echo "Failed"   223    224    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \   225 >  out10f.tmp   226    227    [ `grep "event19@example.com" "out10f.tmp" | wc -l` = '5' ] \   228 && [ `grep "event13@example.com" "out10f.tmp" | wc -l` = '1' ] \   229 && grep -q "^20141126T200000Z${TAB}20141126T204500Z" "out10f.tmp" \   230 && echo "Success" \   231 || echo "Failed"   232    233 # Test scheduling again with a different period. This should disregard the   234 # existing event periods when computing availability in order to be able to   235 # offer them again. Otherwise, an offer would be made for even later periods.   236    237   sed 's/20141126T160000/20141126T161500/' < "$TEMPLATES/event-request-sauna-good.txt" \   238 | tee out11.tmp \   239 | "$RESOURCE_SCRIPT" $ARGS 2>> $ERROR \   240 | "$SHOWMAIL" \   241 > out12.tmp   242    243    grep -q 'METHOD:COUNTER' out12.tmp \   244 && grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T210000' out12.tmp \   245 && echo "Success" \   246 || echo "Failed"   247    248 # Note that the duration is different now.   249    250    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \   251 >  out12o.tmp   252    253    ! grep -q "^20141126T150000Z${TAB}20141126T154500Z" "out12o.tmp" \   254 && ! grep -q "^20141126T160000Z${TAB}20141126T164500Z" "out12o.tmp" \   255 && ! grep -q "^20141126T170000Z${TAB}20141126T174500Z" "out12o.tmp" \   256 && ! grep -q "^20141126T180000Z${TAB}20141126T184500Z" "out12o.tmp" \   257 && ! grep -q "^20141126T190000Z${TAB}20141126T194500Z" "out12o.tmp" \   258 && grep -q "^20141126T200000Z${TAB}20141126T203000Z" "out12o.tmp" \   259 && echo "Success" \   260 || echo "Failed"   261    262    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \   263 >  out12f.tmp   264    265    [ `grep "event19@example.com" "out12f.tmp" | wc -l` = '5' ] \   266 && [ `grep "event13@example.com" "out12f.tmp" | wc -l` = '1' ] \   267 && grep -q "^20141126T200000Z${TAB}20141126T204500Z" "out12f.tmp" \   268 && echo "Success" \   269 || echo "Failed"