コード例 #1
0
 def test_init_no_rdf_store(self):
     """ Should be able to init without these values """
     c = Configure()
     Configureable.default = c
     d = Data()
     try:
         d.openDatabase()
     except Exception:
         self.fail("Bad state")
コード例 #2
0
    def test_namespace_manager(self):
        c = Configure()
        c['rdf.source'] = 'default'
        c['rdf.store'] = 'default'
        Configureable.default = c
        d = Data()
        d.openDatabase()

        self.assertIsInstance(d['rdf.namespace_manager'], R.namespace.NamespaceManager)
コード例 #3
0
    def test_ZODB_persistence(self):
        """ Should be able to init without these values """
        c = Configure()
        fname = 'ZODB.fs'
        c['rdf.source'] = 'ZODB'
        c['rdf.store_conf'] = fname
        Configureable.default = c
        d = Data()
        try:
            d.openDatabase()
            g = make_graph(20)
            for x in g:
                d['rdf.graph'].add(x)
            d.closeDatabase()

            d.openDatabase()
            self.assertEqual(20, len(list(d['rdf.graph'])))
            d.closeDatabase()
        except Exception:
            traceback.print_exc()
            self.fail("Bad state")
        delete_zodb_data_store(fname)
コード例 #4
0
    def test_Sleepycat_persistence(self):
        """ Should be able to init without these values """
        c = Configure()
        fname = 'Sleepycat_store'
        c['rdf.source'] = 'Sleepycat'
        c['rdf.store_conf'] = fname
        Configureable.default = c
        d = Data()
        try:
            d.openDatabase()
            g = make_graph(20)
            for x in g:
                d['rdf.graph'].add(x)
            d.closeDatabase()

            d.openDatabase()
            self.assertEqual(20, len(list(d['rdf.graph'])))
            d.closeDatabase()
        except Exception:
            traceback.print_exc()
            self.fail("Bad state")

        subprocess.call("rm -rf "+fname, shell=True)