paul@573 | 1 | #!/bin/sh |
paul@573 | 2 | |
paul@1024 | 3 | . "`dirname \"$0\"`/common.sh" |
paul@573 | 4 | |
paul@1460 | 5 | SENDER="mailto:paul.boddie@example.com" |
paul@644 | 6 | ROOM="mailto:resource-room-confroom@example.com" |
paul@644 | 7 | CAR="mailto:resource-car-porsche911@example.com" |
paul@573 | 8 | |
paul@644 | 9 | mkdir -p "$PREFS/$ROOM" |
paul@644 | 10 | echo 'Europe/Oslo' > "$PREFS/$ROOM/TZID" |
paul@644 | 11 | echo 'share' > "$PREFS/$ROOM/freebusy_sharing" |
paul@644 | 12 | |
paul@644 | 13 | mkdir -p "$PREFS/$CAR" |
paul@644 | 14 | echo 'Europe/Mariehamn' > "$PREFS/$CAR/TZID" |
paul@644 | 15 | echo 'share' > "$PREFS/$CAR/freebusy_sharing" |
paul@640 | 16 | |
paul@1460 | 17 | # Test the recipient's initial free/busy state. |
paul@573 | 18 | |
paul@1460 | 19 | test_initial_freebusy 'resource' |
paul@1460 | 20 | test_initial_freebusy_limited 'resource' |
paul@1460 | 21 | |
paul@1460 | 22 | # Make a new event. |
paul@573 | 23 | |
paul@1460 | 24 | cat > "event_cmd.tmp" <<EOF |
paul@1460 | 25 | new |
paul@1460 | 26 | period 0 edit 20141126 16 00 00 Europe/Oslo 20141126 17 00 00 Europe/Oslo |
paul@1460 | 27 | attendance accept |
paul@1460 | 28 | attendee mailto:resource-room-confroom@example.com |
paul@1460 | 29 | attendee mailto:resource-car-porsche911@example.com |
paul@1460 | 30 | summary Test drive |
paul@1460 | 31 | finish |
paul@1460 | 32 | update event.tmp |
paul@1460 | 33 | publish event_self.tmp |
paul@1460 | 34 | UID event_uid.tmp |
paul@1460 | 35 | EOF |
paul@573 | 36 | |
paul@1460 | 37 | text_client "$SENDER" "event_cmd.tmp" |
paul@1460 | 38 | |
paul@1460 | 39 | # Obtain the event UID. |
paul@1460 | 40 | |
paul@1460 | 41 | read UID1 < "event_uid.tmp" |
paul@1460 | 42 | |
paul@1460 | 43 | # Register the event at the sender. |
paul@1460 | 44 | |
paul@1460 | 45 | outgoing_script "event_self.tmp" |
paul@1460 | 46 | |
paul@1460 | 47 | # Present the event to the recipient. |
paul@1460 | 48 | |
paul@1460 | 49 | resource_script "event.tmp" "out2.tmp" "out2r.tmp" |
paul@573 | 50 | |
paul@1460 | 51 | # Expect replies because each recipient handles the request. |
paul@1460 | 52 | |
paul@1460 | 53 | # Inspect the room's response. |
paul@1460 | 54 | |
paul@1460 | 55 | is_present 'METHOD:REPLY' "out2.tmp" && success || failed "out2.tmp" |
paul@1460 | 56 | is_present 'ATTENDEE;PARTSTAT=ACCEPTED' "out2.tmp" && success || failed "out2.tmp" |
paul@573 | 57 | |
paul@1460 | 58 | # Inspect the car's response. |
paul@1460 | 59 | |
paul@1460 | 60 | showmail "out2r.tmp" 1 | is_present 'METHOD:REPLY' "out2.tmp" && success || failed "out2.tmp" |
paul@1460 | 61 | showmail "out2r.tmp" 1 | is_present 'ATTENDEE;PARTSTAT=ACCEPTED' "out2.tmp" && success || failed "out2.tmp" |
paul@1460 | 62 | |
paul@1460 | 63 | # Expect free/busy periods for the recipients. |
paul@573 | 64 | |
paul@1460 | 65 | list_script "out2f1.tmp" "$ROOM" "freebusy" |
paul@1460 | 66 | test_freebusy '20141126T150000Z' '20141126T160000Z' "out2f1.tmp" |
paul@1460 | 67 | list_script "out2f2.tmp" "$CAR" "freebusy" |
paul@1460 | 68 | test_freebusy '20141126T150000Z' '20141126T160000Z' "out2f2.tmp" |
paul@1460 | 69 | |
paul@1460 | 70 | # Present a new free/busy request to the resources. |
paul@1460 | 71 | # NOTE: We might open the event and use that for the request. |
paul@573 | 72 | |
paul@1460 | 73 | cat > "fb_cmd.tmp" <<EOF |
paul@1460 | 74 | new |
paul@1460 | 75 | period 0 edit 20141126 16 00 00 Europe/Oslo 20141126 19 00 00 Europe/Oslo |
paul@1460 | 76 | attendee mailto:resource-room-confroom@example.com |
paul@1460 | 77 | attendee mailto:resource-car-porsche911@example.com |
paul@1460 | 78 | finish |
paul@1460 | 79 | freebusy fb.tmp |
paul@1460 | 80 | EOF |
paul@1460 | 81 | |
paul@1460 | 82 | text_client "$SENDER" "fb_cmd.tmp" |
paul@1460 | 83 | |
paul@1460 | 84 | # Present the request to the recipients. |
paul@573 | 85 | |
paul@1460 | 86 | resource_script "fb.tmp" "out4.tmp" "out4r.tmp" |
paul@1460 | 87 | |
paul@1460 | 88 | # Expect replies because each recipient handles the request. |
paul@1460 | 89 | |
paul@1460 | 90 | # Inspect the room's response. |
paul@573 | 91 | |
paul@1460 | 92 | is_present 'METHOD:REPLY' "out4.tmp" && success || failed "out4.tmp" |
paul@1460 | 93 | is_present 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' "out4.tmp" && success || failed "out4.tmp" |
paul@1460 | 94 | |
paul@1460 | 95 | # Inspect the car's response. |
paul@1460 | 96 | |
paul@1460 | 97 | showmail "out4r.tmp" 1 | is_present 'METHOD:REPLY' "out4.tmp" && success || failed "out4.tmp" |
paul@1460 | 98 | showmail "out4r.tmp" 1 | is_present 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' "out4.tmp" && success || failed "out4.tmp" |
paul@573 | 99 | |
paul@1460 | 100 | # Cancel the attendance of the conference room. |
paul@1460 | 101 | |
paul@1460 | 102 | cat > "event_cancel_cmd.tmp" <<EOF |
paul@1460 | 103 | attendee mailto:resource-room-confroom@example.com remove |
paul@1460 | 104 | finish |
paul@1460 | 105 | cancel event_cancel.tmp |
paul@1460 | 106 | EOF |
paul@573 | 107 | |
paul@1460 | 108 | text_client_specific "$SENDER" "event_cancel_cmd.tmp" "$UID1" |
paul@1460 | 109 | |
paul@1460 | 110 | # Present the request to the recipient. |
paul@1460 | 111 | |
paul@1460 | 112 | resource_script "event_cancel.tmp" "out5.tmp" |
paul@1460 | 113 | |
paul@1460 | 114 | # Present a new free/busy request to each resource. |
paul@573 | 115 | |
paul@1460 | 116 | cat > "fb_room_cmd.tmp" <<EOF |
paul@1460 | 117 | new |
paul@1460 | 118 | period 0 edit 20141126 16 00 00 Europe/Oslo 20141126 19 00 00 Europe/Oslo |
paul@1460 | 119 | attendee mailto:resource-room-confroom@example.com |
paul@1460 | 120 | finish |
paul@1460 | 121 | freebusy fb_room.tmp |
paul@1460 | 122 | EOF |
paul@573 | 123 | |
paul@1460 | 124 | text_client "$SENDER" "fb_room_cmd.tmp" |
paul@1460 | 125 | |
paul@1460 | 126 | # Present the request to the recipients. |
paul@1460 | 127 | |
paul@1460 | 128 | resource_script "fb_room.tmp" "out6.tmp" |
paul@1460 | 129 | |
paul@1460 | 130 | # Expect a reply but with no free/busy periods. |
paul@1460 | 131 | |
paul@1460 | 132 | is_present 'METHOD:REPLY' "out6.tmp" && success || failed "out6.tmp" |
paul@1460 | 133 | is_absent 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' "out6.tmp" && success || failed "out6.tmp" |
paul@573 | 134 | |
paul@1460 | 135 | # Present a new free/busy request to each resource. |
paul@1460 | 136 | |
paul@1460 | 137 | cat > "fb_car_cmd.tmp" <<EOF |
paul@1460 | 138 | new |
paul@1460 | 139 | period 0 edit 20141126 16 00 00 Europe/Oslo 20141126 19 00 00 Europe/Oslo |
paul@1460 | 140 | attendee mailto:resource-car-porsche911@example.com |
paul@1460 | 141 | finish |
paul@1460 | 142 | freebusy fb_car.tmp |
paul@1460 | 143 | EOF |
paul@573 | 144 | |
paul@1460 | 145 | text_client "$SENDER" "fb_car_cmd.tmp" |
paul@1460 | 146 | |
paul@1460 | 147 | # Present the request to the recipients. |
paul@573 | 148 | |
paul@1460 | 149 | resource_script "fb_car.tmp" "out7.tmp" |
paul@1460 | 150 | |
paul@1460 | 151 | # Expect a reply with free/busy periods. |
paul@1460 | 152 | |
paul@1460 | 153 | is_present 'METHOD:REPLY' "out7.tmp" && success || failed "out7.tmp" |
paul@1460 | 154 | is_present 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' "out7.tmp" && success || failed "out7.tmp" |