[CalendarServer-changes] [10209] CalendarServer/branches/users/glyph/queue-locking-and-timing

source_changes at macosforge.org source_changes at macosforge.org
Fri Jan 4 16:38:17 PST 2013


Revision: 10209
          http://trac.calendarserver.org//changeset/10209
Author:   glyph at apple.com
Date:     2013-01-04 16:38:16 -0800 (Fri, 04 Jan 2013)
Log Message:
-----------
Start moving test fixtures into place.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/queue-locking-and-timing/twext/enterprise/test/test_queue.py

Property Changed:
----------------
    CalendarServer/branches/users/glyph/queue-locking-and-timing/

Modified: CalendarServer/branches/users/glyph/queue-locking-and-timing/twext/enterprise/test/test_queue.py
===================================================================
--- CalendarServer/branches/users/glyph/queue-locking-and-timing/twext/enterprise/test/test_queue.py	2013-01-05 00:38:15 UTC (rev 10208)
+++ CalendarServer/branches/users/glyph/queue-locking-and-timing/twext/enterprise/test/test_queue.py	2013-01-05 00:38:16 UTC (rev 10209)
@@ -1,4 +1,6 @@
 ##
+from twext.enterprise.dal.record import fromTable
+from twext.enterprise.queue import WorkItem
 # Copyright (c) 2012 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -8,6 +10,7 @@
 # http://www.apache.org/licenses/LICENSE-2.0
 #
 # Unless required by applicable law or agreed to in writing, software
+from twext.enterprise.dal.syntax import SchemaSyntax
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
@@ -19,10 +22,13 @@
 """
 
 from twisted.trial.unittest import TestCase
-from twisted.internet.defer import Deferred
+from twisted.internet.defer import Deferred, inlineCallbacks
 
-from twext.enterprise.queue import inTransaction
+from twext.enterprise.queue import inTransaction, PeerConnectionPool
 
+from txdav.common.datastore.test.util import buildStore
+from twext.enterprise.dal.test.test_parseschema import SchemaTestHelper
+
 class UtilityTests(TestCase):
     """
     Tests for supporting utilities.
@@ -67,3 +73,47 @@
         self.assertEquals(x, [35])
 
 
+
+class SimpleSchemaHelper(SchemaTestHelper):
+    def id(self):
+        return 'worker'
+
+schemaText = """
+    create table DUMMY_WORK_ITEM (alpha integer, beta timestamp);
+"""
+schema = SchemaSyntax(SimpleSchemaHelper().schemaFromString(schemaText))
+
+
+class DummyWorkItem(WorkItem, fromTable(schema.DUMMY_WORK_ITEM)):
+    pass
+
+
+
+class PeerConnectionPoolTests(TestCase):
+    """
+    L{PeerConnectionPool} is the service responsible for coordinating
+    eventually-consistent task queuing within a cluster.
+    """
+
+    @inlineCallbacks
+    def setUp(self):
+        """
+        L{PeerConnectionPool} requires access to a database and the reactor.
+        """
+        store = yield buildStore(self, None)
+        def doit(txn):
+            return txn.execSQL(schemaText)
+        yield inTransaction(lambda: store.newTransaction("bonus schema"), doit)
+        def deschema():
+            def deletestuff(txn):
+                return txn.execSQL("drop table DUMMY_WORK_ITEM")
+            return inTransaction(store.newTransaction, deletestuff)
+        self.addCleanup(deschema)
+
+
+    def test_nothing(self):
+        """
+        Just making sure that setup can run.
+        """
+
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130104/28e3b777/attachment.html>


More information about the calendarserver-changes mailing list