#
# PUT a calendar collection to user2 so we have some starting events
#
# There is no CalDAV defined behaviour for this.
#
TYPE=PUT
URL=http://regression.host/caldav.php/user2/home/
HEADER=User-Agent: RSCDS Testing/0.7.x
HEADER=Content-Type: text/calendar; charset=utf-8
HEADER=X-DAViCal-Flush-Cache: now
AUTH=admin:nimda

HEAD

BEGINDATA
BEGIN:VCALENDAR
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
X-WR-CALNAME:User 2's Calendar, as uploaded by Admin
VERSION:2.0

BEGIN:VTIMEZONE
TZID:Pacific/Auckland
X-LIC-LOCATION:Pacific/Auckland
BEGIN:DAYLIGHT
TZOFFSETFROM:+1200
TZOFFSETTO:+1300
TZNAME:NZDT
DTSTART:19700927T020000
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=9
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+1300
TZOFFSETTO:+1200
TZNAME:NZST
DTSTART:19700405T030000
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=4
END:STANDARD
END:VTIMEZONE

BEGIN:VEVENT
CREATED:20081023T054958Z
LAST-MODIFIED:20081023T055044Z
DTSTAMP:20081023T054958Z
UID:33169d69-2969-4a96-a3e1-2e312b7614e6
SUMMARY:Near Daily Action Meeting
RRULE:FREQ=DAILY;INTERVAL=1;BYDAY=MO,WE,FR
DTSTART;TZID=Pacific/Auckland:20081020T110000
DTEND;TZID=Pacific/Auckland:20081020T113000
X-MOZ-GENERATION:2
END:VEVENT

BEGIN:VEVENT
CREATED:20081023T054934Z
LAST-MODIFIED:20081023T055059Z
DTSTAMP:20081023T054934Z
UID:047871e3-6b70-4178-9af8-0ceb50f7b092
SUMMARY:Weekly Project Meeting
RRULE:FREQ=WEEKLY;INTERVAL=1
DTSTART;TZID=Pacific/Auckland:20081020T090000
DTEND;TZID=Pacific/Auckland:20081020T100000
X-MOZ-GENERATION:2
END:VEVENT

BEGIN:VEVENT
CREATED:20081023T055115Z
LAST-MODIFIED:20081023T055139Z
DTSTAMP:20081023T055115Z
UID:9429a973-2b13-4b1a-be09-948d75425c45
SUMMARY:Weekly catch-up
RRULE:FREQ=WEEKLY;INTERVAL=1
DTSTART;TZID=Pacific/Auckland:20081024T140000
DTEND;TZID=Pacific/Auckland:20081024T150000
X-MOZ-GENERATION:2
END:VEVENT

BEGIN:VTIMEZONE
TZID:America/Los_Angeles
X-TZINFO:America/Los_Angeles[2007g/Partial@883612800000]
BEGIN:DAYLIGHT
TZOFFSETTO:-0700
TZOFFSETFROM:-0800
TZNAME:America/Los_Angeles(DST)
DTSTART:19980405T020000
RRULE:FREQ=YEARLY;UNTIL=20060403T100000Z;BYMONTH=4;BYDAY=1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETTO:-0800
TZOFFSETFROM:-0700
TZNAME:America/Los_Angeles(STD)
DTSTART:19981025T020000
RRULE:FREQ=YEARLY;UNTIL=20061030T100000Z;BYMONTH=10;BYDAY=-1SU
END:STANDARD
BEGIN:DAYLIGHT
TZOFFSETTO:-0700
TZOFFSETFROM:-0800
TZNAME:America/Los_Angeles(DST)
DTSTART:20070311T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETTO:-0800
TZOFFSETFROM:-0700
TZNAME:America/Los_Angeles(STD)
DTSTART:20071104T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD
END:VTIMEZONE

BEGIN:VEVENT
LAST-MODIFIED:20080303T015422Z
SEQUENCE:5
UID:7d729xc0-0895-012d-124e-002421a2359e
SUMMARY:1st Monday, 2nd Tuesday, 3rd Thursday & Last Friday
RRULE:FREQ=MONTHLY;BYDAY=1MO,2TU,3TH,-1FR;INTERVAL=1
DESCRIPTION:An all day event on various days.
DTSTART;TZID=America/Los_Angeles:20081006T000000
CREATED:20080303T015329Z
DTSTAMP:20080303T015422Z
DURATION:P1D
END:VEVENT

BEGIN:VEVENT
LAST-MODIFIED:20081123T210725Z
SEQUENCE:6
UID:bd262d20-1cdb-012d-1264-002421a2359e
SUMMARY:Afternoon run
DESCRIPTION:
DTSTART;TZID=America/Los_Angeles:20081123T150000
CREATED:20081123T210644Z
DTSTAMP:20081123T210725Z
DURATION:PT1H
LOCATION:
RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=SU
END:VEVENT

BEGIN:VEVENT
LAST-MODIFIED:20110101T005414Z
SEQUENCE:12
URL;VALUE=URI:http://www.oregontrufflefestival.com
UID:56f0e0e0-f742-012d-680c-002421a2359e
SUMMARY:Willamette Valley Vineyards at the Oregon Truffle Festival
DESCRIPTION:The 6th Annual Oregon Truffle Festival will be held in and arou
 nd Eugene Oregon over three brisk winter days from January 28-30\, 2011. Cr
 eated to celebrate the magnificent Oregon truffles as they reach the peak o
 f ripeness in their native soil\, it is the first festival of its kind in N
 orth America\, dedicated to sharing the experience of the chefs\, foragers 
 and fans of Oregon\\'s wild truffles\, from their hidden source in the fore
 st to their glory on the table.\n\nThe theme for 2011 is "Slow Food"\, and 
 Willamette Valley Vineyards will be hosting a gourmet wine luncheon during 
 the festival. Please visit www.oregontrufflefestival.com for more info and 
 to purchase tickets.\n\n<img src="http://4.bp.blogspot.com/_nunnaUzLU1w/S7F
 WYsdewdI/AAAAAAAACj4/92TfhNIHKQI/s1600/wvv.jpg">
DTSTART;TZID=America/Los_Angeles:20110128
CREATED:20101231T193025Z
DTSTAMP:20110101T005414Z
DURATION:P1D
LOCATION:Eugene Oregon
X-VENUE:
X-EMAIL-RSVP-UPDATES:true
RRULE:FREQ=DAILY;COUNT=3;INTERVAL=1
END:VEVENT

END:VCALENDAR
ENDDATA

QUERY
SELECT caldav_data.user_no, caldav_type, logged_user, 
       uid, dtstamp, dtstart at time zone olson_name as dtstart, dtend at time zone olson_name as dtend, due, summary, location,
       description, priority, class, transp, rrule, url,
       percent_complete, tz_id, status,
       caldav_data AS "A1 CalDAV DATA"
FROM caldav_data JOIN calendar_item USING(dav_name) LEFT JOIN timezones ON (tz_id=tzid)
WHERE caldav_data.dav_name ~ '^/user2/home/'
ENDQUERY

QUERY
SELECT count(*)
  FROM caldav_data JOIN calendar_item USING(dav_name)
  WHERE caldav_data.dav_name ~ '^/user2/home/'
ENDQUERY

