<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[14369] CalendarServer/branches/release/CalendarServer-5.4-dev</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/14369">14369</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2015-02-04 17:52:07 -0800 (Wed, 04 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix unscheduled-split-scheduled scenario. Other splitting clean-up.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesreleaseCalendarServer54devcalendarservertoolstesttest_calverifypy">CalendarServer/branches/release/CalendarServer-5.4-dev/calendarserver/tools/test/test_calverify.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer54devtwistedcaldavstorebridgepy">CalendarServer/branches/release/CalendarServer-5.4-dev/twistedcaldav/storebridge.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer54devtxdavcaldavdatastoresqlpy">CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/sql.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer54devtxdavcaldavdatastoretesttest_sqlpy">CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/test/test_sql.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServerbranchesreleaseCalendarServer54devcalendarservertoolstesttest_calverifypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.4-dev/calendarserver/tools/test/test_calverify.py (14368 => 14369)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.4-dev/calendarserver/tools/test/test_calverify.py        2015-02-05 01:51:13 UTC (rev 14368)
+++ CalendarServer/branches/release/CalendarServer-5.4-dev/calendarserver/tools/test/test_calverify.py        2015-02-05 01:52:07 UTC (rev 14369)
</span><span class="lines">@@ -2842,8 +2842,8 @@
</span><span class="cx"> UID:INVITE_VALID_ORGANIZER_ICS
</span><span class="cx"> DTSTART:%(now)s
</span><span class="cx"> DURATION:PT1H
</span><del>-ATTENDEE:urn:uuid:%(uuid1)s
-ATTENDEE:urn:uuid:%(uuid2)s
</del><ins>+ATTENDEE;PARTSTAT=ACCPETED:urn:uuid:%(uuid1)s
+ATTENDEE;RSVP=TRUE:urn:uuid:%(uuid2)s
</ins><span class="cx"> ORGANIZER:urn:uuid:%(uuid1)s
</span><span class="cx"> RRULE:FREQ=DAILY
</span><span class="cx"> SUMMARY:INVITE_VALID_ORGANIZER_ICS
</span><span class="lines">@@ -2859,8 +2859,8 @@
</span><span class="cx"> UID:INVITE_VALID_ORGANIZER_ICS
</span><span class="cx"> DTSTART:%(now)s
</span><span class="cx"> DURATION:PT1H
</span><del>-ATTENDEE:urn:uuid:%(uuid1)s
-ATTENDEE:urn:uuid:%(uuid2)s
</del><ins>+ATTENDEE;PARTSTAT=ACCPETED:urn:uuid:%(uuid1)s
+ATTENDEE;RSVP=TRUE:urn:uuid:%(uuid2)s
</ins><span class="cx"> ORGANIZER:urn:uuid:%(uuid1)s
</span><span class="cx"> RRULE:FREQ=DAILY
</span><span class="cx"> SUMMARY:INVITE_VALID_ORGANIZER_ICS
</span><span class="lines">@@ -2876,8 +2876,8 @@
</span><span class="cx"> UID:INVITE_VALID_ORGANIZER_ICS
</span><span class="cx"> DTSTART:%(now_fwd11)s
</span><span class="cx"> DURATION:PT1H
</span><del>-ATTENDEE:urn:uuid:%(uuid1)s
-ATTENDEE:urn:uuid:%(uuid2)s
</del><ins>+ATTENDEE;PARTSTAT=ACCPETED:urn:uuid:%(uuid1)s
+ATTENDEE;RSVP=TRUE:urn:uuid:%(uuid2)s
</ins><span class="cx"> ORGANIZER:urn:uuid:%(uuid1)s
</span><span class="cx"> RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
</span><span class="cx"> RRULE:FREQ=DAILY
</span><span class="lines">@@ -2895,8 +2895,8 @@
</span><span class="cx"> UID:INVITE_VALID_ORGANIZER_ICS
</span><span class="cx"> DTSTART:%(now_fwd11)s
</span><span class="cx"> DURATION:PT1H
</span><del>-ATTENDEE:urn:uuid:%(uuid1)s
-ATTENDEE:urn:uuid:%(uuid2)s
</del><ins>+ATTENDEE;PARTSTAT=ACCPETED:urn:uuid:%(uuid1)s
+ATTENDEE;RSVP=TRUE:urn:uuid:%(uuid2)s
</ins><span class="cx"> ORGANIZER:urn:uuid:%(uuid1)s
</span><span class="cx"> RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
</span><span class="cx"> RRULE:FREQ=DAILY
</span><span class="lines">@@ -2914,8 +2914,8 @@
</span><span class="cx"> UID:%(relID)s
</span><span class="cx"> DTSTART:%(now)s
</span><span class="cx"> DURATION:PT1H
</span><del>-ATTENDEE:urn:uuid:%(uuid1)s
-ATTENDEE:urn:uuid:%(uuid2)s
</del><ins>+ATTENDEE;PARTSTAT=ACCPETED:urn:uuid:%(uuid1)s
+ATTENDEE;RSVP=TRUE:urn:uuid:%(uuid2)s
</ins><span class="cx"> ORGANIZER:urn:uuid:%(uuid1)s
</span><span class="cx"> RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
</span><span class="cx"> RRULE:FREQ=DAILY;UNTIL=%(now_fwd11_1)s
</span><span class="lines">@@ -2933,8 +2933,8 @@
</span><span class="cx"> UID:%(relID)s
</span><span class="cx"> DTSTART:%(now)s
</span><span class="cx"> DURATION:PT1H
</span><del>-ATTENDEE:urn:uuid:%(uuid1)s
-ATTENDEE:urn:uuid:%(uuid2)s
</del><ins>+ATTENDEE;PARTSTAT=ACCPETED:urn:uuid:%(uuid1)s
+ATTENDEE;RSVP=TRUE:urn:uuid:%(uuid2)s
</ins><span class="cx"> ORGANIZER:urn:uuid:%(uuid1)s
</span><span class="cx"> RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
</span><span class="cx"> RRULE:FREQ=DAILY;UNTIL=%(now_fwd11_1)s
</span></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer54devtwistedcaldavstorebridgepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.4-dev/twistedcaldav/storebridge.py (14368 => 14369)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.4-dev/twistedcaldav/storebridge.py        2015-02-05 01:51:13 UTC (rev 14368)
+++ CalendarServer/branches/release/CalendarServer-5.4-dev/twistedcaldav/storebridge.py        2015-02-05 01:52:07 UTC (rev 14369)
</span><span class="lines">@@ -2972,11 +2972,11 @@
</span><span class="cx"> 
</span><span class="cx">         try:
</span><span class="cx">             otherStoreObject = yield self._newStoreObject.splitAt(rid, pastUID)
</span><del>-        except InvalidSplit:
</del><ins>+        except InvalidSplit as e:
</ins><span class="cx">             raise HTTPError(ErrorResponse(
</span><span class="cx">                 FORBIDDEN,
</span><span class="cx">                 (calendarserver_namespace, &quot;invalid-split&quot;,),
</span><del>-                &quot;The rid parameter in the request-URI contains an invalid value&quot;,
</del><ins>+                str(e),
</ins><span class="cx">             ))
</span><span class="cx"> 
</span><span class="cx">         other = yield request.locateChildResource(self._parentResource, otherStoreObject.name())
</span></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer54devtxdavcaldavdatastoresqlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/sql.py (14368 => 14369)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/sql.py        2015-02-05 01:51:13 UTC (rev 14368)
+++ CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/sql.py        2015-02-05 01:52:07 UTC (rev 14369)
</span><span class="lines">@@ -1512,6 +1512,8 @@
</span><span class="cx">         self._cachedComponent = None
</span><span class="cx">         self._cachedCommponentPerUser = {}
</span><span class="cx"> 
</span><ins>+        self._lockedUID = False
+
</ins><span class="cx">     _allColumns = [
</span><span class="cx">         _objectSchema.RESOURCE_ID,
</span><span class="cx">         _objectSchema.RESOURCE_NAME,
</span><span class="lines">@@ -2125,15 +2127,27 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @inlineCallbacks
</span><del>-    def _lockUID(self, component, inserting, internal_state):
</del><ins>+    def _lockUID(self, uid, internal_state):
</ins><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Create a lock on the component's UID and verify, after getting the lock, that the incoming UID
</span><span class="cx">         meets the requirements of the store.
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx"> 
</span><ins>+        if not self._lockedUID and internal_state in (ComponentUpdateState.NORMAL, ComponentUpdateState.SPLIT_OWNER):
+            yield NamedLock.acquire(self._txn, &quot;ImplicitUIDLock:%s&quot; % (hashlib.md5(uid).hexdigest(),))
+            self._lockedUID = True
+
+
+    @inlineCallbacks
+    def _lockAndCheckUID(self, component, inserting, internal_state):
+        &quot;&quot;&quot;
+        Create a lock on the component's UID and verify, after getting the lock, that the incoming UID
+        meets the requirements of the store.
+        &quot;&quot;&quot;
+
+        # Lock it
</ins><span class="cx">         new_uid = component.resourceUID()
</span><del>-        if internal_state == ComponentUpdateState.NORMAL:
-            yield NamedLock.acquire(self._txn, &quot;ImplicitUIDLock:%s&quot; % (hashlib.md5(new_uid).hexdigest(),))
</del><ins>+        yield self._lockUID(new_uid, internal_state)
</ins><span class="cx"> 
</span><span class="cx">         # UID conflict check - note we do this after reserving the UID to avoid a race condition where two requests
</span><span class="cx">         # try to write the same calendar data to two different resource URIs.
</span><span class="lines">@@ -2203,9 +2217,27 @@
</span><span class="cx"> 
</span><span class="cx">             # Do scheduling only for owner split
</span><span class="cx">             if internal_state == ComponentUpdateState.SPLIT_OWNER:
</span><del>-                yield self.doImplicitScheduling(component, inserting, internal_state, split_details)
</del><ins>+                # UID lock - this will remain active until the end of the current txn
+                yield self._lockAndCheckUID(component, inserting, internal_state)
</ins><span class="cx"> 
</span><del>-            self.isScheduleObject = True
</del><ins>+                # Make sure various bits of scheduling meta-data are correctly setup to ensure the
+                # new resource created by a split has the proper state
+                implicit_result = yield self.doImplicitScheduling(component, inserting, internal_state, split_details)
+                if isinstance(implicit_result, int):
+                    msg = &quot;Invalid return status code from ImplicitScheduler during split: %s&quot; % (implicit_result,)
+                    log.error(msg)
+                    raise InvalidObjectResourceError(msg)
+
+                self.isScheduleObject, new_component, did_implicit_action, schedule_state = implicit_result
+                if new_component is not None:
+                    component = new_component
+                if did_implicit_action:
+                    self._componentChanged = True
+
+            elif internal_state == ComponentUpdateState.SPLIT_ATTENDEE:
+                # This must always be set since the only time we get is is during scheduling
+                self.isScheduleObject = True
+
</ins><span class="cx">             self.processScheduleTags(component, inserting, internal_state)
</span><span class="cx"> 
</span><span class="cx">         elif internal_state != ComponentUpdateState.RAW:
</span><span class="lines">@@ -2213,7 +2245,7 @@
</span><span class="cx">             yield self.fullValidation(component, inserting, internal_state)
</span><span class="cx"> 
</span><span class="cx">             # UID lock - this will remain active until the end of the current txn
</span><del>-            yield self._lockUID(component, inserting, internal_state)
</del><ins>+            yield self._lockAndCheckUID(component, inserting, internal_state)
</ins><span class="cx"> 
</span><span class="cx">             # Preserve private comments
</span><span class="cx">             yield self.preservePrivateComments(component, inserting, internal_state)
</span><span class="lines">@@ -3447,26 +3479,33 @@
</span><span class="cx">         @type pastuid: L{str}
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx"> 
</span><ins>+        # Cannot create one with the same UID as this
+        if pastUID and pastUID == self._uid:
+            raise InvalidSplit(&quot;Cannot split an event and re-use the same UID.&quot;)
+
</ins><span class="cx">         # Must be recurring
</span><span class="cx">         component = yield self.component()
</span><span class="cx">         if not component.isRecurring():
</span><del>-            raise InvalidSplit()
</del><ins>+            raise InvalidSplit(&quot;Cannot split a non-recurring event.&quot;)
</ins><span class="cx"> 
</span><span class="cx">         # Cannot be attendee
</span><span class="cx">         ownerPrincipal = self.calendar().ownerHome().directoryRecord()
</span><span class="cx">         organizer = component.getOrganizer()
</span><span class="cx">         organizerPrincipal = self.directoryService().recordWithCalendarUserAddress(organizer) if organizer else None
</span><span class="cx">         if organizer is not None and organizerPrincipal.uid != ownerPrincipal.uid:
</span><del>-            raise InvalidSplit()
</del><ins>+            raise InvalidSplit(&quot;Only organizers can split events.&quot;)
</ins><span class="cx"> 
</span><span class="cx">         # Determine valid split point
</span><span class="cx">         splitter = iCalSplitter(1024, 14)
</span><span class="cx">         rid = splitter.whereSplit(component, break_point=rid, allow_past_the_end=False)
</span><span class="cx">         if rid is None:
</span><del>-            raise InvalidSplit()
</del><ins>+            raise InvalidSplit(&quot;Cannot find a suitable recurrence-id to split at.&quot;)
</ins><span class="cx"> 
</span><span class="cx">         # Do split and return new resource
</span><del>-        olderObject = yield self.split(rid=rid, olderUID=pastUID)
</del><ins>+        try:
+            olderObject = yield self.split(rid=rid, olderUID=pastUID)
+        except (UIDExistsError, UIDExistsElsewhereError):
+            raise InvalidSplit(&quot;Chosen UID exists elsewhere.&quot;)
</ins><span class="cx">         returnValue(olderObject)
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -3492,7 +3531,7 @@
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx"> 
</span><span class="cx">         # First job is to grab a UID lock on this entire series of events
</span><del>-        yield NamedLock.acquire(self._txn, &quot;ImplicitUIDLock:%s&quot; % (hashlib.md5(self._uid).hexdigest(),))
</del><ins>+        yield self._lockUID(self._uid, internal_state=ComponentUpdateState.SPLIT_OWNER)
</ins><span class="cx"> 
</span><span class="cx">         # Find all other calendar objects on this server with the same UID
</span><span class="cx">         if onlyThis:
</span></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer54devtxdavcaldavdatastoretesttest_sqlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/test/test_sql.py (14368 => 14369)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/test/test_sql.py        2015-02-05 01:51:13 UTC (rev 14368)
+++ CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/test/test_sql.py        2015-02-05 01:52:07 UTC (rev 14369)
</span><span class="lines">@@ -5160,7 +5160,10 @@
</span><span class="cx"> 
</span><span class="cx">             responses = ScheduleResponseQueue(&quot;REQUEST&quot;, responsecode.OK)
</span><span class="cx">             for recipient in recipients:
</span><del>-                responses.add(recipient, responsecode.OK, reqstatus=iTIPRequestStatus.MESSAGE_DELIVERED)
</del><ins>+                if recipient.startswith(&quot;urn:uuid&quot;):
+                    responses.add(recipient, responsecode.OK, reqstatus=iTIPRequestStatus.MESSAGE_DELIVERED)
+                else:
+                    responses.add(recipient, responsecode.NOT_FOUND, reqstatus=iTIPRequestStatus.INVALID_CALENDAR_USER)
</ins><span class="cx">             return succeed(responses)
</span><span class="cx"> 
</span><span class="cx">         component = Component.fromString(data % self.subs)
</span><span class="lines">@@ -6261,13 +6264,13 @@
</span><span class="cx"> 
</span><span class="cx">         # Get the existing and new object data
</span><span class="cx">         cobj1 = yield self.calendarObjectUnderTest(name=&quot;data1.ics&quot;, calendar_name=&quot;calendar&quot;, home=&quot;user01&quot;)
</span><del>-        self.assertTrue(cobj1.isScheduleObject)
</del><ins>+        self.assertFalse(cobj1.isScheduleObject)
</ins><span class="cx">         ical1 = yield cobj1.component()
</span><span class="cx">         newUID = ical1.masterComponent().propertyValue(&quot;RELATED-TO&quot;)
</span><span class="cx"> 
</span><span class="cx">         cobj2 = yield self.calendarObjectUnderTest(name=oldname, calendar_name=&quot;calendar&quot;, home=&quot;user01&quot;)
</span><span class="cx">         self.assertTrue(cobj2 is not None)
</span><del>-        self.assertTrue(cobj2.isScheduleObject)
</del><ins>+        self.assertFalse(cobj2.isScheduleObject)
</ins><span class="cx"> 
</span><span class="cx">         ical_future = yield cobj1.component()
</span><span class="cx">         ical_past = yield cobj2.component()
</span><span class="lines">@@ -6404,7 +6407,57 @@
</span><span class="cx">         self.assertEqual(normalize_iCalStr(ical_inbox), normalize_iCalStr(data_inbox2) % relsubs, &quot;Failed inbox: %s&quot; % (title,))
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    @inlineCallbacks
+    def test_calendarObjectSplit_splitat_no_same_uid(self):
+        &quot;&quot;&quot;
+        Test that user triggered splitting of calendar objects does not work if the specified UID is the same
+        as the resource being split.
+        &quot;&quot;&quot;
</ins><span class="cx"> 
</span><ins>+        yield self._setupSplitAt()
+
+        # Update it
+        cobj = yield self.calendarObjectUnderTest(name=&quot;data1.ics&quot;, calendar_name=&quot;calendar&quot;, home=&quot;user01&quot;)
+        yield self.failUnlessFailure(cobj.splitAt(PyCalendarDateTime.parseText(&quot;%(now_back14)s&quot; % self.subs), pastUID=&quot;12345-67890&quot;), InvalidSplit)
+
+
+    @inlineCallbacks
+    def test_calendarObjectSplit_splitat_no_existing_uid(self):
+        &quot;&quot;&quot;
+        Test that user triggered splitting of calendar objects does not work if the specified UID is the same
+        as another resource.
+        &quot;&quot;&quot;
+
+        data_existing = &quot;&quot;&quot;BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-existing
+DTSTART:%(now_back28)s
+DURATION:PT1H
+DTSTAMP:20051222T210507Z
+RRULE:FREQ=DAILY;COUNT=50
+SUMMARY:1234567890123456789012345678901234567890
+ 1234567890123456789012345678901234567890
+ 1234567890123456789012345678901234567890
+ 1234567890123456789012345678901234567890
+END:VEVENT
+END:VCALENDAR
+&quot;&quot;&quot;
+
+        yield self._setupSplitAt()
+
+        calendar = yield self.calendarUnderTest(name=&quot;calendar&quot;, home=&quot;user01&quot;)
+        component = Component.fromString(data_existing % self.subs)
+        yield calendar.createCalendarObjectWithName(&quot;data2.ics&quot;, component)
+        yield self.commit()
+
+        # Update it
+        cobj = yield self.calendarObjectUnderTest(name=&quot;data1.ics&quot;, calendar_name=&quot;calendar&quot;, home=&quot;user01&quot;)
+        yield self.failUnlessFailure(cobj.splitAt(PyCalendarDateTime.parseText(&quot;%(now_back14)s&quot; % self.subs), pastUID=&quot;12345-67890-existing&quot;), InvalidSplit)
+
+
+
</ins><span class="cx"> class TimeRangeUpdateOptimization(CommonCommonTests, unittest.TestCase):
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     CalendarObject splitting tests
</span></span></pre>
</div>
</div>

</body>
</html>