def test_checkSystemVersion(self): """ The L{IService} returned by L{AxiomaticStart.makeService} calls L{checkSystemVersion} with its store when it is started. This is done for I{axiomatic start} rather than somewhere in the implementation of L{Store} so that it happens only once per server startup. The overhead of doing it whenever a store is opened is non-trivial. """ dbdir = self.mktemp() store = Store(dbdir) service = AxiomaticStart.makeService({'dbdir': dbdir, 'debug': False}) self.assertEqual(store.query(SystemVersion).count(), 0) service.startService() self.assertEqual(store.query(SystemVersion).count(), 1) return service.stopService()
def test_checkSystemVersion(self): """ The L{IService} returned by L{AxiomaticStart.makeService} calls L{checkSystemVersion} with its store when it is started. This is done for I{axiomatic start} rather than somewhere in the implementation of L{Store} so that it happens only once per server startup. The overhead of doing it whenever a store is opened is non-trivial. """ dbdir = self.mktemp() store = Store(dbdir) service = AxiomaticStart.makeService({'dbdir': dbdir, 'debug': False}) self.assertEqual(store.query(SystemVersion).count(), 0) service.startService() self.assertEqual(store.query(SystemVersion).count(), 1) return service.stopService()
def test_makeService(self): """ L{AxiomaticStart.makeService} returns the L{IService} powerup of the L{Store} at the directory in the options object it is passed. """ dbdir = FilePath(self.mktemp()) store = Store(dbdir) recorder = RecorderService(store=store) self.assertFalse(recorder.started) store.powerUp(recorder, IService) store.close() service = AxiomaticStart.makeService({"dbdir": dbdir, "debug": False}) service.startService() service.stopService() store = Store(dbdir) self.assertTrue(store.getItemByID(recorder.storeID).started)
def test_makeService(self): """ L{AxiomaticStart.makeService} returns the L{IService} powerup of the L{Store} at the directory in the options object it is passed. """ dbdir = FilePath(self.mktemp()) store = Store(dbdir) recorder = RecorderService(store=store) self.assertFalse(recorder.started) store.powerUp(recorder, IService) store.close() service = AxiomaticStart.makeService({"dbdir": dbdir, "debug": False}) service.startService() service.stopService() store = Store(dbdir) self.assertTrue(store.getItemByID(recorder.storeID).started)