def setUpCalendarStore(test): test.root = FilePath(test.mktemp()) test.root.createDirectory() storeRootPath = test.storeRootPath = test.root.child("store") calendarPath = storeRootPath.child("calendars").child("__uids__") calendarPath.parent().makedirs() storePath.copyTo(calendarPath) # Set year values to current year nowYear = DateTime.getToday().getYear() for home in calendarPath.child("ho").child("me").children(): if not home.basename().startswith("."): for calendar in home.children(): if not calendar.basename().startswith("."): for resource in calendar.children(): if resource.basename().endswith(".ics"): resource.setContent(resource.getContent() % {"now": nowYear}) testID = test.id() test.counter = 0 test.notifierFactory = StubNotifierFactory() test.calendarStore = CalendarStore( storeRootPath, {"push": test.notifierFactory} if test.notifierFactory else {}, None, # must create directory later quota=deriveQuota(test), ) test.directory = buildTestDirectory(test.calendarStore, test.mktemp()) test.txn = test.calendarStore.newTransaction(testID + "(old)") assert test.calendarStore is not None, "No calendar store?"
def setUp(self): yield super(MultiStoreConduitTest, self).setUp() # Store 1 serversDB1 = ServersDB() server1a = Server("A", "http://127.0.0.1:8008", "A", True) serversDB1.addServer(server1a) server1b = Server("B", "http://127.0.0.1:8108", "B", False) serversDB1.addServer(server1b) yield self.buildStoreAndDirectory(serversDB=serversDB1) self.store.queryCacher = None # Cannot use query caching self.store.conduit = self.makeConduit(self.store) # Store 2 serversDB2 = ServersDB() server2a = Server("A", "http://127.0.0.1:8008", "A", False) serversDB2.addServer(server2a) server2b = Server("B", "http://127.0.0.1:8108", "B", True) serversDB2.addServer(server2b) self.store2 = yield self.buildStore(self.theStoreBuilder2) directory2 = buildTestDirectory( self.store2, self.mktemp(), serversDB=serversDB2 ) self.store2.setDirectoryService(directory2) self.store2.queryCacher = None # Cannot use query caching self.store2.conduit = self.makeConduit(self.store2) FakeConduitRequest.addServerStore(server1a, self.store) FakeConduitRequest.addServerStore(server2b, self.store2)
def setUp(self): yield super(MultiStoreConduitTest, self).setUp() # Store 1 serversDB1 = ServersDB() server1a = Server("A", "http://127.0.0.1:8008", "A", True) serversDB1.addServer(server1a) server1b = Server("B", "http://127.0.0.1:8108", "B", False) serversDB1.addServer(server1b) yield self.buildStoreAndDirectory(serversDB=serversDB1) self.store.queryCacher = None # Cannot use query caching self.store.conduit = self.makeConduit(self.store) # Store 2 serversDB2 = ServersDB() server2a = Server("A", "http://127.0.0.1:8008", "A", False) serversDB2.addServer(server2a) server2b = Server("B", "http://127.0.0.1:8108", "B", True) serversDB2.addServer(server2b) self.store2 = yield self.buildStore(self.theStoreBuilder2) directory2 = buildTestDirectory(self.store2, self.mktemp(), serversDB=serversDB2) self.store2.setDirectoryService(directory2) self.store2.queryCacher = None # Cannot use query caching self.store2.conduit = self.makeConduit(self.store2) FakeConduitRequest.addServerStore(server1a, self.store) FakeConduitRequest.addServerStore(server2b, self.store2)
def setUp(self): yield super(MultiStoreConduitTest, self).setUp() # Stores for i in range(self.numberOfStores): serversDB = ServersDB() for j in range(self.numberOfStores): letter = chr(ord("A") + j) port = 8008 + 100 * j server = Server(letter, "http://127.0.0.1:{}".format(port), letter, j == i) serversDB.addServer(server) if i == 0: yield self.buildStoreAndDirectory( serversDB=serversDB, storeBuilder=self.theStoreBuilders[i]) self.theStores[i] = self.store else: self.theStores[i] = yield self.buildStore( self.theStoreBuilders[i]) directory = buildTestDirectory(self.theStores[i], self.mktemp(), serversDB=serversDB) self.theStores[i].setDirectoryService(directory) self.theStores[i].queryCacher = None # Cannot use query caching self.theStores[i].conduit = self.makeConduit(self.theStores[i]) FakeConduitRequest.addServerStore( serversDB.getServerById(chr(ord("A") + i)), self.theStores[i])
def setUp(self): yield super(MultiStoreConduitTest, self).setUp() # Stores for i in range(self.numberOfStores): serversDB = ServersDB() for j in range(self.numberOfStores): letter = chr(ord("A") + j) port = 8008 + 100 * j server = Server( letter, "http://127.0.0.1:{}".format(port), letter, j == i ) serversDB.addServer(server) if i == 0: yield self.buildStoreAndDirectory( serversDB=serversDB, storeBuilder=self.theStoreBuilders[i], accounts=self.accounts, augments=self.augments, ) self.theStores[i] = self.store else: self.theStores[i] = yield self.buildStore( self.theStoreBuilders[i] ) directory = buildTestDirectory( self.theStores[i], self.mktemp(), serversDB=serversDB, accounts=self.accounts, augments=self.augments, ) self.theStores[i].setDirectoryService(directory) self.theStores[i].queryCacher = None # Cannot use query caching self.theStores[i].conduit = self.makeConduit(self.theStores[i]) FakeConduitRequest.addServerStore( serversDB.getServerById(chr(ord("A") + i)), self.theStores[i] )