[CalendarServer-changes] [11445] CalendarServer/trunk/txdav
source_changes at macosforge.org
source_changes at macosforge.org
Mon Jul 1 12:21:24 PDT 2013
Revision: 11445
http://trac.calendarserver.org//changeset/11445
Author: gaya at apple.com
Date: 2013-07-01 12:21:24 -0700 (Mon, 01 Jul 2013)
Log Message:
-----------
fix shared group revisions for added test cases
Modified Paths:
--------------
CalendarServer/trunk/txdav/carddav/datastore/sql.py
CalendarServer/trunk/txdav/carddav/datastore/test/test_file.py
CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py
CalendarServer/trunk/txdav/common/datastore/sql_schema/current.sql
Modified: CalendarServer/trunk/txdav/carddav/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/carddav/datastore/sql.py 2013-06-28 20:21:00 UTC (rev 11444)
+++ CalendarServer/trunk/txdav/carddav/datastore/sql.py 2013-07-01 19:21:24 UTC (rev 11445)
@@ -191,9 +191,7 @@
@inlineCallbacks
def createdHome(self):
- # initialize synctoken
yield self.addressbook()._initSyncToken()
- yield self.addressbook()._initBindRevision()
@inlineCallbacks
@@ -366,7 +364,7 @@
@inlineCallbacks
- def _init_isShared(self):
+ def _initIsShared(self):
"""
Temporary hack to set isShared on the owner addressbook
1) This is not up to spec because an addressbook can be shared even without invitations
@@ -637,7 +635,7 @@
optimization for Depth:1 operations on the home.
"""
addressbook = home.addressbook()
- yield addressbook._init_isShared()
+ yield addressbook._initIsShared()
results = [addressbook]
ownerHomeToDataRowMap = {}
@@ -663,7 +661,6 @@
groupBindRow[0] = _BIND_MODE_WRITE
groupBindRow[3] = None # bindName
groupBindRow[4] = None # bindStatus
- groupBindRow[5] = 0 # bindRevision
groupBindRow[6] = None # bindMessage
ownerHomeToDataRowMap[ownerHome] = groupBindRow
@@ -726,7 +723,7 @@
"""
if accepted and name == home.addressbook().name():
addressbook = home.addressbook()
- yield addressbook._init_isShared()
+ yield addressbook._initIsShared()
returnValue(addressbook)
# all shared address books now
@@ -762,7 +759,6 @@
groupBindRow[0] = _BIND_MODE_WRITE
groupBindRow[3] = None # bindName
groupBindRow[4] = None # bindStatus
- groupBindRow[5] = 0 # bindRevision
groupBindRow[6] = None # bindMessage
groupBindRow.insert(cls.bindColumnCount, ownerAddressBook._resourceID)
groupBindRow.insert(cls.bindColumnCount + 1, cachedBindStatus)
@@ -861,7 +857,7 @@
"""
if home._resourceID == resourceID:
addressbook = home.addressbook()
- yield addressbook._init_isShared()
+ yield addressbook._initIsShared()
returnValue(addressbook)
bindRows = yield cls._bindForResourceIDAndHomeID.on(
@@ -1454,7 +1450,7 @@
@inlineCallbacks
- def _init_isShared(self):
+ def _initIsShared(self):
"""
Temporary hack to set isShared on the owner group
1) This is not up to spec because an group can be shared even without invitations
@@ -1552,7 +1548,7 @@
self._bindName = bindName
if self.owned():
- yield self._init_isShared()
+ yield self._initIsShared()
yield self._loadPropertyStore()
@@ -2368,8 +2364,8 @@
else:
if status == _BIND_STATUS_ACCEPTED:
shareeView = yield shareeHome.objectWithShareUID(bindName)
- yield shareeView.addressbook()._initSyncToken()
- yield shareeView.addressbook()._initBindRevision()
+ yield shareeView._initSyncToken()
+ yield shareeView._initBindRevision()
# Must send notification to ensure cache invalidation occurs
yield self.notifyChanged()
@@ -2378,6 +2374,28 @@
@inlineCallbacks
+ def _initSyncToken(self):
+ yield self.addressbook()._initSyncToken()
+
+
+ @inlineCallbacks
+ def _initBindRevision(self):
+ yield self.addressbook()._initBindRevision()
+
+ bind = self._bindSchema
+ yield Update(
+ {bind.BIND_REVISION : Parameter("revision"), },
+ Where=(bind.RESOURCE_ID == Parameter("resourceID")).And
+ (bind.HOME_RESOURCE_ID == Parameter("homeID")),
+ ).on(
+ self._txn,
+ revision=self.addressbook()._bindRevision,
+ resourceID=self._resourceID,
+ homeID=self.viewerHome()._resourceID,
+ )
+
+
+ @inlineCallbacks
#TODO: This is almost the same as AddressBook.updateShare(): combine
def updateShare(self, shareeView, mode=None, status=None, message=None, name=None):
"""
@@ -2441,8 +2459,8 @@
shareeView._bindStatus = columnMap[bind.BIND_STATUS]
if shareeView._bindStatus == _BIND_STATUS_ACCEPTED:
if 0 == previouslyAcceptedBindCount:
- yield shareeView.addressbook()._initSyncToken()
- yield shareeView.addressbook()._initBindRevision()
+ yield shareeView._initSyncToken()
+ yield shareeView._initBindRevision()
shareeView._home._children[shareeView.addressbook()._name] = shareeView._addressbook
shareeView._home._children[shareeView.addressbook()._resourceID] = shareeView._addressbook
elif shareeView._bindStatus != _BIND_STATUS_INVITED:
Modified: CalendarServer/trunk/txdav/carddav/datastore/test/test_file.py
===================================================================
--- CalendarServer/trunk/txdav/carddav/datastore/test/test_file.py 2013-06-28 20:21:00 UTC (rev 11444)
+++ CalendarServer/trunk/txdav/carddav/datastore/test/test_file.py 2013-07-01 19:21:24 UTC (rev 11445)
@@ -49,7 +49,6 @@
featureUnimplemented = lambda f: _todo(f, "Feature unimplemented")
testUnimplemented = lambda f: _todo(f, "Test unimplemented")
todo = lambda why: lambda f: _todo(f, why)
-fixFile = lambda f: _todo(f, "fix file implementation")
def setUpAddressBookStore(test):
@@ -460,21 +459,17 @@
yield self.test_addressbookObjects()
- @inlineCallbacks
- @fixFile
+ @testUnimplemented
def test_createAddressBookWithName_absent(self):
"""
L{IAddressBookHome.createAddressBookWithName} creates a new L{IAddressBook} that
can be retrieved with L{IAddressBookHome.addressbookWithName}.
"""
- pass
- @inlineCallbacks
- @fixFile
+ @testUnimplemented
def test_removeAddressBookWithName_exists(self):
"""
L{IAddressBookHome.removeAddressBookWithName} removes a addressbook that already
exists.
"""
- pass
Modified: CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py 2013-06-28 20:21:00 UTC (rev 11444)
+++ CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py 2013-07-01 19:21:24 UTC (rev 11445)
@@ -897,16 +897,14 @@
newGroupShareUID = yield group.shareWith(other, _BIND_MODE_WRITE)
yield self.commit()
- normalAB = yield self.addressbookUnderTest()
+ normalAB = yield self.addressbookUnderTest(home="home3")
self.assertEqual(normalAB._bindRevision, 0)
otherHome = yield self.homeUnderTest(name="home2")
otherGroup = yield otherHome.objectWithShareUID(newGroupShareUID)
- self.assertNotEqual(otherGroup.addressbook()._bindRevision, 0)
- self.assertNotEqual(otherHome.addressbook(), 0)
+ otherAB = otherGroup.addressbook()
+ self.assertNotEqual(otherAB._bindRevision, 0)
- test_shareGroupWithRevision.todo = "fix shared group revisions"
-
@inlineCallbacks
def test_updateShareRevision(self):
"""
@@ -954,8 +952,8 @@
self.assertEqual(normalAB._bindRevision, 0)
otherHome = yield self.homeUnderTest(name="home2")
otherGroup = yield otherHome.invitedObjectWithShareUID(newGroupShareUID)
-
- self.assertEqual(otherGroup.addressbook()._bindRevision, 0)
+ otherAB = otherGroup.addressbook()
+ self.assertEqual(otherAB._bindRevision, 0)
yield self.commit()
normalAB = yield self.addressbookUnderTest(home="home3")
@@ -969,8 +967,8 @@
self.assertEqual(normalAB._bindRevision, 0)
otherHome = yield self.homeUnderTest(name="home2")
otherGroup = yield otherHome.objectWithShareUID(newGroupShareUID)
- self.assertNotEqual(otherGroup.addressbook()._bindRevision, 0)
- test_updateSharedGroupRevision.todo = "fix shared group revisions"
+ otherAB = otherGroup.addressbook()
+ self.assertNotEqual(otherAB._bindRevision, 0)
@inlineCallbacks
@@ -1044,9 +1042,7 @@
self.assertEqual(len(changed), 0)
self.assertEqual(len(deleted), 0)
- test_sharedGroupRevisions.todo = "fix shared group revisions"
-
@inlineCallbacks
def test_addressbookRevisionChangeConcurrency(self):
"""
Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/current.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/current.sql 2013-06-28 20:21:00 UTC (rev 11444)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/current.sql 2013-07-01 19:21:24 UTC (rev 11445)
@@ -494,6 +494,11 @@
create sequence REVISION_SEQ;
+
+-------------------------------
+-- Calendar Object Revisions --
+-------------------------------
+
create table CALENDAR_OBJECT_REVISIONS (
CALENDAR_HOME_RESOURCE_ID integer not null references CALENDAR_HOME,
CALENDAR_RESOURCE_ID integer references CALENDAR,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130701/f06afb73/attachment-0001.html>
More information about the calendarserver-changes
mailing list