Esempio n. 1
0
 def test_axiomOptions(self):
     """
     L{AxiomaticStart.options} takes database location and debug setting
     parameters.
     """
     options = AxiomaticStart.options()
     options.parseOptions([])
     self.assertEqual(options['dbdir'], None)
     self.assertFalse(options['debug'])
     options.parseOptions(["--dbdir", "foo", "--debug"])
     self.assertEqual(options['dbdir'], 'foo')
     self.assertTrue(options['debug'])
Esempio n. 2
0
 def test_axiomOptions(self):
     """
     L{AxiomaticStart.options} takes database location and debug setting
     parameters.
     """
     options = AxiomaticStart.options()
     options.parseOptions([])
     self.assertEqual(options['dbdir'], None)
     self.assertFalse(options['debug'])
     options.parseOptions(["--dbdir", "foo", "--debug"])
     self.assertEqual(options['dbdir'], 'foo')
     self.assertTrue(options['debug'])
Esempio n. 3
0
 def test_axiomOptions(self):
     """
     L{AxiomaticStart.options} takes database location, debug, and
     journal mode setting parameters.
     """
     options = AxiomaticStart.options()
     options.parseOptions([])
     self.assertEqual(options['dbdir'], None)
     self.assertFalse(options['debug'])
     self.assertEqual(options['journal-mode'], None)
     options.parseOptions(
         ["--dbdir", "foo", "--debug", "--journal-mode", "WAL"])
     self.assertEqual(options['dbdir'], 'foo')
     self.assertTrue(options['debug'])
     self.assertEqual(options['journal-mode'], 'WAL')
Esempio n. 4
0
    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()
Esempio n. 5
0
    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()
Esempio n. 6
0
    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)
Esempio n. 7
0
    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)