[CalendarServer-changes] [12959] CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools
source_changes at macosforge.org
source_changes at macosforge.org
Tue Mar 18 14:48:07 PDT 2014
Revision: 12959
http://trac.calendarserver.org//changeset/12959
Author: sagen at apple.com
Date: 2014-03-18 14:48:07 -0700 (Tue, 18 Mar 2014)
Log Message:
-----------
Start working on calverify
Modified Paths:
--------------
CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/calverify.py
CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/calverify/accounts.xml
CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/calverify/resources.xml
CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/test_gateway.py
Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/calverify.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/calverify.py 2014-03-18 21:24:52 UTC (rev 12958)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/calverify.py 2014-03-18 21:48:07 UTC (rev 12959)
@@ -63,7 +63,6 @@
from twistedcaldav.datafilters.peruserdata import PerUserDataFilter
from twistedcaldav.dateops import pyCalendarTodatetime
-from twistedcaldav.directory.directory import DirectoryService
from twistedcaldav.ical import Component, ignoredComponents, \
InvalidICalendarDataError, Property, PERUSER_COMPONENT
from txdav.caldav.datastore.scheduling.itip import iTipGenerator
@@ -76,7 +75,7 @@
from txdav.caldav.datastore.sql import CalendarStoreFeatures
from txdav.common.datastore.sql_tables import schema, _BIND_MODE_OWN
from txdav.common.icommondatastore import InternalDataStoreError
-
+from txdav.who.idirectory import RecordType as CalRecordType
from calendarserver.tools.cmdline import utilityMain, WorkerService
from calendarserver.tools import tables
@@ -966,7 +965,7 @@
)).ljust(80))
self.output.flush()
- record = self.directoryService().recordWithGUID(uid)
+ record = yield self.directoryService().recordWithUID(uid)
if record is None:
contents = yield self.countHomeContents(uid)
missing.append((uid, contents,))
@@ -1004,7 +1003,7 @@
table = tables.Table()
table.addHeader(("Owner UID", "Calendar Objects"))
for uid, count in sorted(wrong_server, key=lambda x: x[0]):
- record = self.directoryService().recordWithGUID(uid)
+ record = yield self.directoryService().recordWithUID(uid)
table.addRow((
"%s/%s (%s)" % (record.recordType if record else "-", record.shortNames[0] if record else "-", uid,),
count,
@@ -1018,7 +1017,7 @@
table = tables.Table()
table.addHeader(("Owner UID", "Calendar Objects"))
for uid, count in sorted(disabled, key=lambda x: x[0]):
- record = self.directoryService().recordWithGUID(uid)
+ record = yield self.directoryService().recordWithUID(uid)
table.addRow((
"%s/%s (%s)" % (record.recordType if record else "-", record.shortNames[0] if record else "-", uid,),
count,
@@ -1148,7 +1147,7 @@
table.addHeader(("Owner", "Event UID", "RID", "Problem",))
for item in sorted(results_bad, key=lambda x: (x[0], x[1])):
owner, uid, resid, message = item
- owner_record = self.directoryService().recordWithGUID(owner)
+ owner_record = yield self.directoryService().recordWithUID(owner)
table.addRow((
"%s/%s (%s)" % (owner_record.recordType if owner_record else "-", owner_record.shortNames[0] if owner_record else "-", owner,),
uid,
@@ -1456,7 +1455,7 @@
self.attended = []
self.attended_byuid = collections.defaultdict(list)
self.matched_attendee_to_organizer = collections.defaultdict(set)
- skipped, inboxes = self.buildResourceInfo(rows)
+ skipped, inboxes = yield self.buildResourceInfo(rows)
self.logResult("Number of organizer events to process", len(self.organized), self.total)
self.logResult("Number of attendee events to process", len(self.attended), self.total)
@@ -1484,6 +1483,7 @@
self.printSummary()
+ @inlineCallbacks
def buildResourceInfo(self, rows, onlyOrganizer=False, onlyAttendee=False):
"""
For each resource, determine whether it is an organizer or attendee event, and also
@@ -1502,7 +1502,7 @@
for owner, resid, uid, calname, md5, organizer, created, modified in rows:
# Skip owners not enabled for calendaring
- if not self.testForCalendaringUUID(owner):
+ if not (yield self.testForCalendaringUUID(owner)):
skipped += 1
continue
@@ -1526,9 +1526,10 @@
self.attended.append((owner, resid, uid, md5, organizer, created, modified,))
self.attended_byuid[uid].append((owner, resid, uid, md5, organizer, created, modified,))
- return skipped, inboxes
+ returnValue((skipped, inboxes))
+ @inlineCallbacks
def testForCalendaringUUID(self, uuid):
"""
Determine if the specified directory UUID is valid for calendaring. Keep a cache of
@@ -1541,9 +1542,9 @@
"""
if uuid not in self.validForCalendaringUUIDs:
- record = self.directoryService().recordWithGUID(uuid)
+ record = yield self.directoryService().recordWithUID(uuid)
self.validForCalendaringUUIDs[uuid] = record is not None and record.hasCalendars and record.thisServer()
- return self.validForCalendaringUUIDs[uuid]
+ returnValue(self.validForCalendaringUUIDs[uuid])
@inlineCallbacks
@@ -1618,7 +1619,7 @@
self.matched_attendee_to_organizer[uid].add(organizerAttendee)
# Skip attendees not enabled for calendaring
- if not self.testForCalendaringUUID(organizerAttendee):
+ if not (yield self.testForCalendaringUUID(organizerAttendee)):
continue
# Double check the missing attendee situation in case we missed it during the original query
@@ -1695,8 +1696,8 @@
results_missing.sort()
for item in results_missing:
uid, resid, organizer, attendee, created, modified = item
- organizer_record = self.directoryService().recordWithGUID(organizer)
- attendee_record = self.directoryService().recordWithGUID(attendee)
+ organizer_record = yield self.directoryService().recordWithUID(organizer)
+ attendee_record = yield self.directoryService().recordWithUID(attendee)
table.addRow((
"%s/%s (%s)" % (organizer_record.recordType if organizer_record else "-", organizer_record.shortNames[0] if organizer_record else "-", organizer,),
"%s/%s (%s)" % (attendee_record.recordType if attendee_record else "-", attendee_record.shortNames[0] if attendee_record else "-", attendee,),
@@ -1717,8 +1718,8 @@
results_mismatch.sort()
for item in results_mismatch:
uid, org_resid, organizer, org_created, org_modified, attendee, att_created, att_modified = item
- organizer_record = self.directoryService().recordWithGUID(organizer)
- attendee_record = self.directoryService().recordWithGUID(attendee)
+ organizer_record = yield self.directoryService().recordWithUID(organizer)
+ attendee_record = yield self.directoryService().recordWithUID(attendee)
table.addRow((
"%s/%s (%s)" % (organizer_record.recordType if organizer_record else "-", organizer_record.shortNames[0] if organizer_record else "-", organizer,),
"%s/%s (%s)" % (attendee_record.recordType if attendee_record else "-", attendee_record.shortNames[0] if attendee_record else "-", attendee,),
@@ -1785,14 +1786,14 @@
organizer = organizer[9:]
# Skip organizers not enabled for calendaring
- if not self.testForCalendaringUUID(organizer):
+ if not (yield self.testForCalendaringUUID(organizer)):
continue
# Double check the missing attendee situation in case we missed it during the original query
if uid not in self.organized_byuid:
# Try to reload the organizer info data
rows = yield self.getAllResourceInfoWithUID(uid)
- self.buildResourceInfo(rows, onlyOrganizer=True)
+ yield self.buildResourceInfo(rows, onlyOrganizer=True)
#if uid in self.organized_byuid:
# print("Reloaded missing organizer data: %s" % (uid,))
@@ -1845,9 +1846,9 @@
uid, attendee, organizer, resid, created, modified = item
unique_set.add(uid)
if organizer:
- organizerRecord = self.directoryService().recordWithGUID(organizer)
+ organizerRecord = yield self.directoryService().recordWithUID(organizer)
organizer = "%s/%s (%s)" % (organizerRecord.recordType if organizerRecord else "-", organizerRecord.shortNames[0] if organizerRecord else "-", organizer,)
- attendeeRecord = self.directoryService().recordWithGUID(attendee)
+ attendeeRecord = yield self.directoryService().recordWithUID(attendee)
table.addRow((
organizer,
"%s/%s (%s)" % (attendeeRecord.recordType if attendeeRecord else "-", attendeeRecord.shortNames[0] if attendeeRecord else "-", attendee,),
@@ -1870,9 +1871,9 @@
for item in mismatched:
uid, attendee, organizer, resid, att_created, att_modified = item
if organizer:
- organizerRecord = self.directoryService().recordWithGUID(organizer)
+ organizerRecord = yield self.directoryService().recordWithUID(organizer)
organizer = "%s/%s (%s)" % (organizerRecord.recordType if organizerRecord else "-", organizerRecord.shortNames[0] if organizerRecord else "-", organizer,)
- attendeeRecord = self.directoryService().recordWithGUID(attendee)
+ attendeeRecord = yield self.directoryService().recordWithUID(attendee)
table.addRow((
organizer,
"%s/%s (%s)" % (attendeeRecord.recordType if attendeeRecord else "-", attendeeRecord.shortNames[0] if attendeeRecord else "-", attendee,),
@@ -1976,7 +1977,7 @@
self.txn = self.store.newTransaction()
# Need to know whether the attendee is a location or resource with auto-accept set
- record = self.directoryService().recordWithGUID(attendee)
+ record = yield self.directoryService().recordWithUID(attendee)
if record.autoSchedule:
# Log details about the event so we can have a human manually process
self.fixedAutoAccepts.append(details)
@@ -2155,8 +2156,8 @@
self.txn = None
uuids = []
for uuid in sorted(homes):
- record = self.directoryService().recordWithGUID(uuid)
- if record is not None and record.recordType in (DirectoryService.recordType_locations, DirectoryService.recordType_resources):
+ record = yield self.directoryService().recordWithUID(uuid)
+ if record is not None and record.recordType in (CalRecordType.location, CalRecordType.resource):
uuids.append(uuid)
else:
uuids = [self.options["uuid"], ]
@@ -2168,13 +2169,13 @@
self.total = 0
count += 1
- record = self.directoryService().recordWithGUID(uuid)
+ record = yield self.directoryService().recordWithUID(uuid)
if record is None:
continue
if not record.thisServer() or not record.hasCalendars:
continue
- rname = record.fullName
+ rname = record.displayName
auto = record.autoSchedule
if len(uuids) > 1 and not self.options["summary"]:
@@ -2464,8 +2465,8 @@
if self.options["verbose"]:
self.output.write("%d uuids to check\n" % (len(homes,)))
for uuid in sorted(homes):
- record = self.directoryService().recordWithGUID(uuid)
- if record is not None and record.recordType in (DirectoryService.recordType_locations, DirectoryService.recordType_resources):
+ record = yield self.directoryService().recordWithUID(uuid)
+ if record is not None and record.recordType in (CalRecordType.location, CalRecordType.resource):
uuids.append(uuid)
else:
uuids = [self.options["uuid"], ]
@@ -2479,13 +2480,13 @@
self.total = 0
count += 1
- record = self.directoryService().recordWithGUID(uuid)
+ record = yield self.directoryService().recordWithUID(uuid)
if record is None:
continue
if not record.thisServer() or not record.hasCalendars:
continue
- rname = record.fullName
+ rname = record.displayName
if len(uuids) > 1 and not self.options["summary"]:
self.output.write("\n\n-----------------------------\n")
Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/calverify/accounts.xml
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/calverify/accounts.xml 2014-03-18 21:24:52 UTC (rev 12958)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/calverify/accounts.xml 2014-03-18 21:48:07 UTC (rev 12959)
@@ -18,40 +18,46 @@
<!DOCTYPE accounts SYSTEM "../../../conf/auth/accounts.dtd">
-<accounts realm="/Search">
- <user>
- <uid>example1</uid>
- <guid>D46F3D71-04B7-43C2-A7B6-6F92F92E61D0</guid>
+<directory realm="/Search">
+
+ <record type="user">
+ <short-name>example1</short-name>
+ <uid>D46F3D71-04B7-43C2-A7B6-6F92F92E61D0</uid>
<password>example</password>
- <name>Example User1</name>
- <email-address>example1 at example.com</email-address>
- </user>
- <user>
- <uid>example2</uid>
- <guid>47B16BB4-DB5F-4BF6-85FE-A7DA54230F92</guid>
+ <full-name>Example User1</full-name>
+ <email>example1 at example.com</email>
+ </record>
+
+ <record type="user">
+ <short-name>example2</short-name>
+ <uid>47B16BB4-DB5F-4BF6-85FE-A7DA54230F92</uid>
<password>example</password>
- <name>Example User2</name>
- <email-address>example2 at example.com</email-address>
- </user>
- <user>
- <uid>example3</uid>
- <guid>AC478592-7783-44D1-B2AE-52359B4E8415</guid>
+ <full-name>Example User2</full-name>
+ <email>example2 at example.com</email>
+ </record>
+
+ <record type="user">
+ <short-name>example3</short-name>
+ <uid>AC478592-7783-44D1-B2AE-52359B4E8415</uid>
<password>example</password>
- <name>Example User3</name>
- <email-address>example3 at example.com</email-address>
- </user>
- <user>
- <uid>example4</uid>
- <guid>A89E3A97-1658-4E45-A185-479F3E49D446</guid>
+ <full-name>Example User3</full-name>
+ <email>example3 at example.com</email>
+ </record>
+
+ <record type="user">
+ <short-name>example4</short-name>
+ <uid>A89E3A97-1658-4E45-A185-479F3E49D446</uid>
<password>example</password>
- <name>Example User4</name>
- <email-address>example4 at example.com</email-address>
- </user>
- <user>
+ <full-name>Example User4</full-name>
+ <email>example4 at example.com</email>
+ </record>
+
+ <record type="user">
<uid>home1</uid>
- <guid>home1</guid>
+ <short-name>home1</short-name>
<password>home1</password>
- <name>Home 1</name>
- <email-address>home1 at example.com</email-address>
- </user>
-</accounts>
+ <full-name>Home 1</full-name>
+ <email>home1 at example.com</email>
+ </record>
+
+</directory>
Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/calverify/resources.xml
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/calverify/resources.xml 2014-03-18 21:24:52 UTC (rev 12958)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/calverify/resources.xml 2014-03-18 21:48:07 UTC (rev 12959)
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
-<accounts realm="/Search">
- <location>
- <uid>location01</uid>
- <guid>75EA36BE-F71B-40F9-81F9-CF59BF40CA8F</guid>
+<directory realm="/Search">
+ <record type="location">
+ <short-name>location01</short-name>
+ <uid>75EA36BE-F71B-40F9-81F9-CF59BF40CA8F</uid>
<password>location01</password>
- <name>Room 01</name>
- </location>
-</accounts>
+ <full-name>Room 01</full-name>
+ </record>
+</directory>
Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/test_gateway.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/test_gateway.py 2014-03-18 21:24:52 UTC (rev 12958)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/test_gateway.py 2014-03-18 21:48:07 UTC (rev 12959)
@@ -26,14 +26,15 @@
from twistedcaldav.config import config
from twistedcaldav.test.util import TestCase, CapturingProcessProtocol
-from calendarserver.tools.util import getDirectory
import plistlib
+from twisted.trial.unittest import SkipTest
class RunCommandTestCase(TestCase):
def setUp(self):
super(RunCommandTestCase, self).setUp()
+ raise SkipTest("Needs porting to twext.who still")
testRoot = os.path.join(os.path.dirname(__file__), "gateway")
templateName = os.path.join(testRoot, "caldavd.plist")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140318/de129b69/attachment-0001.html>
More information about the calendarserver-changes
mailing list