[CalendarServer-changes] [9898] CalendarServer/branches/users/gaya/sharedgroups/txdav
source_changes at macosforge.org
source_changes at macosforge.org
Fri Oct 5 14:40:57 PDT 2012
Revision: 9898
http://trac.calendarserver.org//changeset/9898
Author: gaya at apple.com
Date: 2012-10-05 14:40:57 -0700 (Fri, 05 Oct 2012)
Log Message:
-----------
Remove SEEN_BY_OWNER, SEEN_BY_SHAREE, from CALENDER_BIND and ADDRESS_BOOK_BIND
Modified Paths:
--------------
CalendarServer/branches/users/gaya/sharedgroups/txdav/caldav/datastore/test/test_sql.py
CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/sql.py
CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/sql_schema/current.sql
Modified: CalendarServer/branches/users/gaya/sharedgroups/txdav/caldav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/txdav/caldav/datastore/test/test_sql.py 2012-10-05 18:29:42 UTC (rev 9897)
+++ CalendarServer/branches/users/gaya/sharedgroups/txdav/caldav/datastore/test/test_sql.py 2012-10-05 21:40:57 UTC (rev 9898)
@@ -30,13 +30,13 @@
from txdav.xml.rfc2518 import GETContentLanguage, ResourceType
from txdav.base.propertystore.base import PropertyName
-from txdav.caldav.datastore.test.common import CommonTests as CalendarCommonTests,\
+from txdav.caldav.datastore.test.common import CommonTests as CalendarCommonTests, \
test_event_text
from txdav.caldav.datastore.test.test_file import setUpCalendarStore
from txdav.caldav.datastore.util import _migrateCalendar, migrateHome
from txdav.common.datastore.sql import ECALENDARTYPE, CommonObjectResource
from txdav.common.datastore.sql_legacy import PostgresLegacyIndexEmulator
-from txdav.common.datastore.sql_tables import schema, _BIND_MODE_DIRECT,\
+from txdav.common.datastore.sql_tables import schema, _BIND_MODE_DIRECT, \
_BIND_STATUS_ACCEPTED
from txdav.common.datastore.test.util import buildStore, populateCalendarsFrom
from txdav.common.icommondatastore import NoSuchObjectResourceError
@@ -185,7 +185,7 @@
backed calendar. We need to test what happens when there is "bad" calendar data
present in the file-backed calendar with a broken recurrence-id that we can fix.
"""
-
+
self.storeUnderTest().setMigrating(True)
fromCalendar = yield (yield self.fileTransaction().calendarHomeWithUID(
"home_bad")).calendarWithName("calendar_fix_recurrence")
@@ -306,7 +306,7 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n") % self.nowYear)
-
+
toResource = yield toCalendar.calendarObjectWithName("3.ics")
caldata = yield toResource.component()
self.assertEqual(str(caldata), """BEGIN:VCALENDAR
@@ -353,7 +353,7 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n") % self.nowYear)
-
+
@inlineCallbacks
def test_migrateDuplicateAttachmentsCalendarFromFile(self):
"""
@@ -385,10 +385,10 @@
yield _migrateCalendar(fromCalendar, toCalendar,
lambda x: x.component())
- filter = caldavxml.Filter(
+ filter = caldavxml.Filter(
caldavxml.ComponentFilter(
caldavxml.ComponentFilter(
- caldavxml.TimeRange(start="%(now)s0201T000000Z" % self.nowYear, end="%(now)s0202T000000Z" % self.nowYear),
+ caldavxml.TimeRange(start="%(now)s0201T000000Z" % self.nowYear, end="%(now)s0202T000000Z" % self.nowYear),
name=("VEVENT", "VFREEBUSY", "VAVAILABILITY"),
),
name="VCALENDAR",
@@ -410,7 +410,7 @@
backend to another; in this specific case, from the file-based backend
to the SQL-based backend.
"""
-
+
# Need to turn of split calendar behavior just for this test
self.patch(config, "RestrictCalendarsToOneComponentType", False)
@@ -467,7 +467,7 @@
continue
result = yield calendar.getSupportedComponents()
supported_components.add(result)
-
+
self.assertEqual(supported_components, set(("VEVENT", "VTODO",)))
@inlineCallbacks
@@ -494,7 +494,7 @@
continue
result = yield calendar.getSupportedComponents()
supported_components.add(result)
-
+
self.assertEqual(supported_components, set(("VEVENT", "VTODO",)))
def test_calendarHomeVersion(self):
@@ -502,23 +502,23 @@
The DATAVERSION column for new calendar homes must match the
CALENDAR-DATAVERSION value.
"""
-
+
home = yield self.transactionUnderTest().calendarHomeWithUID("home_version")
self.assertTrue(home is not None)
yield self.transactionUnderTest().commit
-
+
txn = yield self.transactionUnderTest()
version = yield txn.calendarserverValue("CALENDAR-DATAVERSION")[0][0]
ch = schema.CALENDAR_HOME
homeVersion = yield Select(
- [ch.DATAVERSION,],
+ [ch.DATAVERSION, ],
From=ch,
Where=ch.OWNER_UID == "home_version",
).on(txn)[0][0]
self.assertEqual(int(homeVersion, version))
-
-
+
+
def test_eachCalendarHome(self):
"""
L{ICalendarStore.eachCalendarHome} is currently stubbed out by
@@ -779,7 +779,7 @@
calendar = yield home.createCalendarWithName(name)
resourceID = calendar._resourceID
calendarProperties = calendar.properties()
-
+
prop = caldavxml.CalendarDescription.fromString("Calendar to be removed")
calendarProperties[PropertyName.fromElement(prop)] = prop
yield self.commit()
@@ -862,7 +862,7 @@
# Create calendar object and add a property
home = yield self.homeUnderTest()
inbox = yield home.createCalendarWithName("inbox")
-
+
name = "test.ics"
component = VComponent.fromString(test_event_text)
metadata = {
@@ -960,23 +960,21 @@
"""
Test Calendar._transferSharingDetails to make sure sharing details are transferred.
"""
-
+
shareeHome = yield self.transactionUnderTest().calendarHomeWithUID("home_splits_shared")
calendar = yield (yield self.transactionUnderTest().calendarHomeWithUID(
"home_splits")).calendarWithName("calendar_1")
-
+
# Fake a shared binding on the original calendar
bind = calendar._bindSchema
_bindCreate = Insert({
bind.HOME_RESOURCE_ID: shareeHome._resourceID,
- bind.RESOURCE_ID: calendar._resourceID,
+ bind.RESOURCE_ID: calendar._resourceID,
bind.RESOURCE_NAME: "shared_1",
bind.MESSAGE: "Shared to you",
bind.BIND_MODE: _BIND_MODE_DIRECT,
bind.BIND_STATUS: _BIND_STATUS_ACCEPTED,
- bind.SEEN_BY_OWNER: True,
- bind.SEEN_BY_SHAREE: True,
})
yield _bindCreate.on(self.transactionUnderTest())
sharedCalendar = yield shareeHome.childWithName("shared_1")
@@ -1002,19 +1000,19 @@
"""
Test Calendar._transferSharingDetails to make sure sharing details are transferred.
"""
-
+
calendar1 = yield (yield self.transactionUnderTest().calendarHomeWithUID(
"home_splits")).calendarWithName("calendar_1")
calendar2 = yield (yield self.transactionUnderTest().calendarHomeWithUID(
"home_splits")).calendarWithName("calendar_2")
-
+
child = yield calendar2.calendarObjectWithName("5.ics")
-
+
yield calendar2.moveObjectResource(child, calendar1)
-
+
child = yield calendar2.calendarObjectWithName("5.ics")
self.assertTrue(child is None)
-
+
child = yield calendar1.calendarObjectWithName("5.ics")
self.assertTrue(child is not None)
@@ -1024,7 +1022,7 @@
Test Calendar.splitCollectionByComponentTypes to make sure components are split out,
sync information is updated.
"""
-
+
# calendar_2 add a dead property to make sure it gets copied over
home = yield self.transactionUnderTest().calendarHomeWithUID("home_splits")
calendar2 = yield home.calendarWithName("calendar_2")
@@ -1044,7 +1042,7 @@
child = yield home.calendarWithName("calendar_1-vtodo")
self.assertTrue(child is None)
- calendar1 = yield home.calendarWithName("calendar_1")
+ calendar1 = yield home.calendarWithName("calendar_1")
children = yield calendar1.listCalendarObjects()
self.assertEqual(len(children), 3)
new_sync_token1 = yield calendar1.syncToken()
@@ -1056,7 +1054,7 @@
# calendar_2 does split
home = yield self.transactionUnderTest().calendarHomeWithUID("home_splits")
- calendar2 = yield home.calendarWithName("calendar_2")
+ calendar2 = yield home.calendarWithName("calendar_2")
original_sync_token2 = yield calendar2.syncToken()
yield calendar2.splitCollectionByComponentTypes()
yield self.commit()
@@ -1075,7 +1073,7 @@
self.assertTrue(pkey in calendar2_vtodo.properties())
self.assertEqual(str(calendar2_vtodo.properties()[pkey]), "A birthday calendar")
- calendar2 = yield home.calendarWithName("calendar_2")
+ calendar2 = yield home.calendarWithName("calendar_2")
children = yield calendar2.listCalendarObjects()
self.assertEqual(len(children), 3)
new_sync_token2 = yield calendar2.syncToken()
@@ -1094,7 +1092,7 @@
Test CalendarHome.splitCalendars to make sure we end up with at least two collections
with different supported components.
"""
-
+
# Do split
home = yield self.transactionUnderTest().calendarHomeWithUID("home_no_splits")
calendars = yield home.calendars()
@@ -1111,7 +1109,7 @@
continue
result = yield calendar.getSupportedComponents()
supported_components.add(result)
-
+
self.assertEqual(supported_components, set(("VEVENT", "VTODO",)))
@inlineCallbacks
@@ -1120,14 +1118,14 @@
Test CommonObjectResource.lock to make sure it locks, raises on missing resource,
and raises when locked and wait=False used.
"""
-
+
# Valid object
resource = yield self.calendarObjectUnderTest()
-
+
# Valid lock
yield resource.lock()
self.assertTrue(resource._locked)
-
+
# Setup a new transaction to verify the lock and also verify wait behavior
newTxn = self._sqlCalendarStore.newTransaction()
newResource = yield self.calendarObjectUnderTest(txn=newTxn)
@@ -1142,19 +1140,19 @@
# Commit existing transaction and verify we can get the lock using
yield self.commit()
-
+
resource = yield self.calendarObjectUnderTest()
yield resource.lock()
self.assertTrue(resource._locked)
-
+
# Setup a new transaction to verify the lock but pass in an alternative txn directly
newTxn = self._sqlCalendarStore.newTransaction()
-
+
# FIXME: not sure why, but without this statement here, this portion of the test fails in a funny way.
# Basically the query in the try block seems to execute twice, failing each time, one of which is caught,
# and the other not - causing the test to fail. Seems like some state on newTxn is not being initialized?
yield self.calendarObjectUnderTest("2.ics", txn=newTxn)
-
+
try:
yield resource.lock(wait=False, useTxn=newTxn)
except:
@@ -1182,10 +1180,10 @@
"""
Test CalendarObjectResource.recurrenceMinMax to make sure it handles a None value.
"""
-
+
# Valid object
resource = yield self.calendarObjectUnderTest()
-
+
# Valid lock
rMin, rMax = yield resource.recurrenceMinMax()
self.assertEqual(rMin, None)
@@ -1197,14 +1195,14 @@
Test PostgresLegacyIndexEmulator.notExpandedWithin to make sure it returns the correct
result based on the ranges passed in.
"""
-
+
self.patch(config, "FreeBusyIndexDelayedExpand", False)
# Create the index on a new calendar
home = yield self.homeUnderTest()
newcalendar = yield home.createCalendarWithName("index_testing")
index = PostgresLegacyIndexEmulator(newcalendar)
-
+
# Create the calendar object to use for testing
nowYear = self.nowYear["now"]
caldata = """BEGIN:VCALENDAR
@@ -1300,15 +1298,15 @@
instances = yield calendarObject.instances()
self.assertNotEqual(len(instances), 0)
yield self.commit()
-
+
# Re-add event with re-indexing
calendar = yield self.calendarUnderTest()
calendarObject = yield self.calendarObjectUnderTest("indexing.ics")
yield calendarObject.setComponent(component)
instances2 = yield calendarObject.instances()
self.assertNotEqual(
- sorted(instances, key=lambda x:x[0])[0],
- sorted(instances2, key=lambda x:x[0])[0],
+ sorted(instances, key=lambda x:x[0])[0],
+ sorted(instances2, key=lambda x:x[0])[0],
)
yield self.commit()
@@ -1319,10 +1317,10 @@
yield calendarObject.setComponent(component)
instances3 = yield calendarObject.instances()
self.assertEqual(
- sorted(instances2, key=lambda x:x[0])[0],
- sorted(instances3, key=lambda x:x[0])[0],
+ sorted(instances2, key=lambda x:x[0])[0],
+ sorted(instances3, key=lambda x:x[0])[0],
)
-
+
yield calendar.removeCalendarObjectWithName("indexing.ics")
yield self.commit()
@@ -1337,19 +1335,19 @@
def _tests(cal):
resources = yield cal.objectResourcesWithNames(("1.ics",))
self.assertEqual(set([resource.name() for resource in resources]), set(("1.ics",)))
-
+
resources = yield cal.objectResourcesWithNames(("1.ics", "2.ics",))
self.assertEqual(set([resource.name() for resource in resources]), set(("1.ics", "2.ics",)))
-
+
resources = yield cal.objectResourcesWithNames(("1.ics", "2.ics", "3.ics",))
self.assertEqual(set([resource.name() for resource in resources]), set(("1.ics", "2.ics", "3.ics",)))
-
+
resources = yield cal.objectResourcesWithNames(("1.ics", "2.ics", "3.ics", "4.ics",))
self.assertEqual(set([resource.name() for resource in resources]), set(("1.ics", "2.ics", "3.ics", "4.ics",)))
-
+
resources = yield cal.objectResourcesWithNames(("bogus1.ics",))
self.assertEqual(set([resource.name() for resource in resources]), set())
-
+
resources = yield cal.objectResourcesWithNames(("bogus1.ics", "2.ics",))
self.assertEqual(set([resource.name() for resource in resources]), set(("2.ics",)))
@@ -1360,7 +1358,7 @@
# Adjust batch size and try again
self.patch(CommonObjectResource, "BATCH_LOAD_SIZE", 2)
yield _tests(cal)
-
+
yield self.commit()
# Tests on inbox - resources with properties
Modified: CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/sql.py 2012-10-05 18:29:42 UTC (rev 9897)
+++ CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/sql.py 2012-10-05 21:40:57 UTC (rev 9898)
@@ -2159,9 +2159,8 @@
newName = str(uuid4())
yield self._bindInsertQuery.on(
subt, homeID=shareeHome._resourceID,
- resourceID=self._resourceID, name=newName, mode=mode,
- seenByOwner=True, seenBySharee=True,
- bindStatus=status, message=message
+ resourceID=self._resourceID, name=newName,
+ mode=mode, bindStatus=status, message=message
)
returnValue(newName)
try:
@@ -2716,8 +2715,6 @@
bind.BIND_MODE: Parameter("mode"),
bind.BIND_STATUS: Parameter("bindStatus"),
bind.MESSAGE: Parameter("message"),
- bind.SEEN_BY_OWNER: Parameter("seenByOwner"),
- bind.SEEN_BY_SHAREE: Parameter("seenBySharee"),
})
@@ -2746,8 +2743,7 @@
# Bind table needs entry
yield cls._bindInsertQuery.on(
home._txn, homeID=home._resourceID, resourceID=resourceID,
- name=name, mode=_BIND_MODE_OWN, seenByOwner=True,
- seenBySharee=True, bindStatus=_BIND_STATUS_ACCEPTED,
+ name=name, mode=_BIND_MODE_OWN, bindStatus=_BIND_STATUS_ACCEPTED,
message=None,
)
Modified: CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/sql_schema/current.sql
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/sql_schema/current.sql 2012-10-05 18:29:42 UTC (rev 9897)
+++ CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/sql_schema/current.sql 2012-10-05 21:40:57 UTC (rev 9898)
@@ -116,15 +116,9 @@
create table CALENDAR_BIND (
CALENDAR_HOME_RESOURCE_ID integer not null references CALENDAR_HOME,
CALENDAR_RESOURCE_ID integer not null references CALENDAR on delete cascade,
-
- -- An invitation which hasn't been accepted yet will not yet have a resource
- -- name, so this field may be null.
-
- CALENDAR_RESOURCE_NAME varchar(255),
+ CALENDAR_RESOURCE_NAME varchar(255) not null,
BIND_MODE integer not null, -- enum CALENDAR_BIND_MODE
BIND_STATUS integer not null, -- enum CALENDAR_BIND_STATUS
- SEEN_BY_OWNER boolean not null,
- SEEN_BY_SHAREE boolean not null,
MESSAGE text,
primary key(CALENDAR_HOME_RESOURCE_ID, CALENDAR_RESOURCE_ID), -- implicit index
@@ -430,8 +424,6 @@
ADDRESSBOOK_RESOURCE_NAME varchar(255) not null,
BIND_MODE integer not null, -- enum CALENDAR_BIND_MODE
BIND_STATUS integer not null, -- enum CALENDAR_BIND_STATUS
- SEEN_BY_OWNER boolean not null, -- ### TODO: DELETE ROW ###
- SEEN_BY_SHAREE boolean not null, -- ### TODO: DELETE ROW ###
MESSAGE text, -- FIXME: xml?
primary key(ADDRESSBOOK_HOME_RESOURCE_ID, ADDRESSBOOK_RESOURCE_ID), -- implicit index
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20121005/d28052f0/attachment-0001.html>
More information about the calendarserver-changes
mailing list