def test3(): print "3) Testing objects create / load / load batch / delete, 3 level, no files" t = time.time() a=db_app.app_db() print time.time() - t, "Creating db (contains", db_app.statdb(a), "Entries)" t2 = time.time() r=a.root() print time.time() - t2, "Creating root" t2 = time.time() c=r ids=[] n=0 for i in range(0,level1): o=db_app.createObj1(c) n+=1 ids.append(o.id) for i2 in range(0,level2): o2=db_app.createObj1(o) n+=1 for i3 in range(0,level3_1): db_app.createObj1(o2) n+=1 for i3 in range(0,level3_2): db_app.createObj2(o2) n+=1 print time.time() - t2, "Creating", n, "objects" t2 = time.time() del r del a a=db_app.app_db() print time.time() - t2, "Creating db (contains", db_app.statdb(a), "Entries)" t2 = time.time() r=a.root() print time.time() - t2, "Creating root" t2 = time.time() o1 = r.GetObjs(batch=True) cc = len(o1) for o in o1: o2 = o.GetObjs(batch=True) cc+=len(o2) for a in o2: o3 = a.GetObjs(batch=True) cc+=len(o3) print time.time() - t2, "Loading batch", cc, "objects" t2 = time.time() user = User(u"test") for id in ids: r.Delete(id, user=user) print time.time() - t2, "Deleting objects recursively" print "------------" print time.time() - t, "Total. Finished (contains", db_app.statdb(a), "Entries)" a.Close() print "--------------------------------------------------------"
def test4(): print "4) Testing objects create / load cache / delete, 3 level, no files" t = time.time() a=db_app.app_db() print time.time() - t, "Creating db (contains", db_app.statdb(a), "Entries)" t2 = time.time() r=a.root() print time.time() - t2, "Creating root" t2 = time.time() c=r ids=[] n=0 c.useCache = True for i in range(0,level1): o=db_app.createObj1(r) o.useCache = True ids.append(o.id) #print o.id n+=1 for i2 in range(0,level2): o2=db_app.createObj1(o) o2.useCache = True #print o2.id, n+=1 for i3 in range(0,level3_1): o3 = db_app.createObj1(o2) o3.useCache = True #print o3.id, n+=1 for i3 in range(0,level3_2): o3 = db_app.createObj2(o2) o3.useCache = True #print o3.id, n+=1 print time.time() - t2, "Creating", n, "objects" t2 = time.time() o1 = r.GetObjs() cc = len(o1) for o in o1: o2 = o.GetObjs() cc+=len(o2) for a in o2: o3 = a.GetObjs() cc+=len(o3) print time.time() - t2, "Loading", cc, "objects" t2 = time.time() r.Close() print time.time() - t2, "Closing", cc, "objects" t2 = time.time() user = User(u"test") for id in ids: try: r.Delete(id, user=user) except Exception, e: raise Exception, str(ids)+ " " + str(id)
def test_database(self): user = User(u"test") app = db_app.app_db() r = app.root() type = u"type1" data = db_app.data1_1 o = r.Create(type, data = data, user = user) self.assert_(o) id = o.id #print "get_referents:" #for x in gc.get_referents(o): # print x #print #print "get_referrers:" #for x in gc.get_referrers(o): # print x del o o=app.obj(id, rootname = "") self.assert_(o) r.Delete(id, user=user) del o #app.portal.Close() print a=1
def test_database(self): user = User(u"test") app = db_app.app_db() r = app.root() type = u"type1" data = db_app.data1_1 o = r.Create(type, data=data, user=user) self.assert_(o) id = o.id #print "get_referents:" #for x in gc.get_referents(o): # print x #print #print "get_referrers:" #for x in gc.get_referrers(o): # print x del o o = app.obj(id, rootname="") self.assert_(o) r.Delete(id, user=user) del o #app.portal.Close() print a = 1
def setUp(self): testing.setUp() self.request = testing.DummyRequest() self.request._LOCALE_ = "en" self.request.subpath = ["file1.txt"] self.request.context = None self.app = db_app.app_db() # self.request = getRequest() user = User(u"test") r = self.app.root() self.context = db_app.createObj1(r) self.context2 = db_app.createObj2(r) self.context2.StoreFile("file1", db_app.file2_1, user=user) self.context2.StoreFile("file2", db_app.file2_2, user=user)
def setUp(self): testing.setUp() self.request = testing.DummyRequest() self.request._LOCALE_ = "en" self.request.subpath = ["file1.txt"] self.request.context = None self.app = db_app.app_db() #self.request = getRequest() user = User(u"test") r = self.app.root() self.context = db_app.createObj1(r) self.context2 = db_app.createObj2(r) self.context2.StoreFile("file1", db_app.file2_1, user=user) self.context2.StoreFile("file2", db_app.file2_2, user=user)
def test2(): print "2) Testing objects create / delete, 3 level, with files" t = time.time() a = db_app.app_db() print time.time() - t, "Creating db (contains", db_app.statdb( a), "Entries)" t2 = time.time() r = a.root() print time.time() - t2, "Creating root" t2 = time.time() c = r ids = [] n = 0 for i in range(0, level1): o = db_app.createObj1file(c) n += 1 ids.append(o.id) for i2 in range(0, level2): o2 = db_app.createObj1file(o) n += 1 for i3 in range(0, level3_1): db_app.createObj1file(o2) n += 1 for i3 in range(0, level3_2): db_app.createObj2file(o2) n += 1 print time.time() - t2, "Creating", n, "objects" t2 = time.time() user = User(u"test") for id in ids: r.Delete(id, user=user) print time.time() - t2, "Deleting objects recursively" print "------------" print time.time() - t, "Total Finished (contains", db_app.statdb( a), "Entries)" a.Close() print "--------------------------------------------------------"
def test2(): print "2) Testing objects create / delete, 3 level, with files" t = time.time() a=db_app.app_db() print time.time() - t, "Creating db (contains", db_app.statdb(a), "Entries)" t2 = time.time() r=a.root() print time.time() - t2, "Creating root" t2 = time.time() c=r ids=[] n=0 for i in range(0,level1): o=db_app.createObj1file(c) n+=1 ids.append(o.id) for i2 in range(0,level2): o2=db_app.createObj1file(o) n+=1 for i3 in range(0,level3_1): db_app.createObj1file(o2) n+=1 for i3 in range(0,level3_2): db_app.createObj2file(o2) n+=1 print time.time() - t2, "Creating", n, "objects" t2 = time.time() user = User(u"test") for id in ids: r.Delete(id, user=user) print time.time() - t2, "Deleting objects recursively" print "------------" print time.time() - t, "Total Finished (contains", db_app.statdb(a), "Entries)" a.Close() print "--------------------------------------------------------"
def _loadApp(self, mods=None): if not mods: mods = [] mods.append(DatabaseConf(POSTGRES_CONF)) self.app = db_app.app_db(mods)
def checkdb(self): app_db()
def setUp(self): self.app = db_app.app_db() self.app.Register(configuration)
def setUp(self): self.app = db_app.app_db()
def setUp(self): self.app = db_app.app_db() self.app.Include(configuration) logging.basicConfig()
def test5(): print "5) Testing objects create / close load cache / delete, 3 level, no files" t = time.time() a=db_app.app_db([DB_CONF]) print time.time() - t, "Creating db (contains", db_app.statdb(a), "Entries)" t2 = time.time() r=a.root() print time.time() - t2, "Creating root" t2 = time.time() c=r ids=[] n=0 c.useCache = True for i in range(0,level1): o=db_app.createObj1(r) o.useCache = True ids.append(o.id) #print o.id n+=1 for i2 in range(0,level2): o2=db_app.createObj1(o) o2.useCache = True #print o2.id, n+=1 for i3 in range(0,level3_1): o3 = db_app.createObj1(o2) o3.useCache = True #print o3.id, n+=1 for i3 in range(0,level3_2): o3 = db_app.createObj2(o2) o3.useCache = True #print o3.id, n+=1 print time.time() - t2, "Creating", n, "objects" t2 = time.time() r.Close() print time.time() - t2, "Closing", n, "objects" t2 = time.time() r=a.root() r.useCache = True o1 = r.GetObjs() cc = len(o1) for o in o1: o.useCache = True o2 = o.GetObjs() cc+=len(o2) for a in o2: a.useCache = True o3 = a.GetObjs() cc+=len(o3) print time.time() - t2, "Loading after Close", cc, "objects" t2 = time.time() user = User(u"test") for id in ids: r.Delete(id, user=user) #try: # r.Delete(id) #except Exception, e: # raise Exception, str(ids)+ " " + str(id) print time.time() - t2, "Deleting objects recursively" print "------------" print time.time() - t, "Total. Finished (contains", db_app.statdb(a), "Entries)" a.Close() print "--------------------------------------------------------"
def test_include_app(self): a = app_db() a.Register(wf1) a.Register(wf2) self.assert_(a.GetWorkflowConf(wf1.id, self.obj)[0].id==wf1.id) self.assert_(a.GetWorkflowConf(wf2.id)[0].id==wf2.id)
a.useCache = True o3 = a.GetObjs() cc += len(o3) print time.time() - t2, "Loading after Close", cc, "objects" t2 = time.time() user = User(u"test") for id in ids: r.Delete(id, user=user) #try: # r.Delete(id) #except Exception, e: # raise Exception, str(ids)+ " " + str(id) print time.time() - t2, "Deleting objects recursively" print "------------" print time.time() - t, "Total. Finished (contains", db_app.statdb( a), "Entries)" a.Close() print "--------------------------------------------------------" if __name__ == '__main__': db_app.emptypool(db_app.app_db()) test1() test2() test3() test4() test5() db_app.emptypool(db_app.app_db())
def setUp(self): self.app = db_app.app_db([ "nive.components.extensions.persistence.dbPersistenceConfiguration" ]) pass
def setUp(self): self.app = db_app.app_db(["nive.components.extensions.persistence.dbPersistenceConfiguration"]) pass
a.useCache = True o3 = a.GetObjs() cc+=len(o3) print time.time() - t2, "Loading after Close", cc, "objects" t2 = time.time() user = User(u"test") for id in ids: r.Delete(id, user=user) #try: # r.Delete(id) #except Exception, e: # raise Exception, str(ids)+ " " + str(id) print time.time() - t2, "Deleting objects recursively" print "------------" print time.time() - t, "Total. Finished (contains", db_app.statdb(a), "Entries)" a.Close() print "--------------------------------------------------------" if __name__ == '__main__': db_app.emptypool(db_app.app_db()) test1() test2() test3() test4() test5() db_app.emptypool(db_app.app_db())
def setUp(self): self.app = db_app.app_db() self.app.Register(configuration) logging.basicConfig()
def test4(): print "4) Testing objects create / load cache / delete, 3 level, no files" t = time.time() a = db_app.app_db([DB_CONF]) print time.time() - t, "Creating db (contains", db_app.statdb( a), "Entries)" t2 = time.time() r = a.root() print time.time() - t2, "Creating root" t2 = time.time() c = r ids = [] n = 0 c.useCache = True for i in range(0, level1): o = db_app.createObj1(r) o.useCache = True ids.append(o.id) #print o.id n += 1 for i2 in range(0, level2): o2 = db_app.createObj1(o) o2.useCache = True #print o2.id, n += 1 for i3 in range(0, level3_1): o3 = db_app.createObj1(o2) o3.useCache = True #print o3.id, n += 1 for i3 in range(0, level3_2): o3 = db_app.createObj2(o2) o3.useCache = True #print o3.id, n += 1 print time.time() - t2, "Creating", n, "objects" t2 = time.time() o1 = r.GetObjs() cc = len(o1) for o in o1: o2 = o.GetObjs() cc += len(o2) for a in o2: o3 = a.GetObjs() cc += len(o3) print time.time() - t2, "Loading", cc, "objects" t2 = time.time() r.Close() print time.time() - t2, "Closing", cc, "objects" t2 = time.time() user = User(u"test") for id in ids: try: r.Delete(id, user=user) except Exception, e: raise Exception, str(ids) + " " + str(id)
def test_include_app(self): a = app_db() a.Register(wf1) a.Register(wf2) self.assert_(a.GetWorkflowConf(wf1.id, self.obj)[0].id == wf1.id) self.assert_(a.GetWorkflowConf(wf2.id)[0].id == wf2.id)
a.useCache = True o3 = a.GetObjs() cc += len(o3) print time.time() - t2, "Loading after Close", cc, "objects" t2 = time.time() user = User(u"test") for id in ids: r.Delete(id, user=user) #try: # r.Delete(id) #except Exception, e: # raise Exception, str(ids)+ " " + str(id) print time.time() - t2, "Deleting objects recursively" print "------------" print time.time() - t, "Total. Finished (contains", db_app.statdb( a), "Entries)" a.Close() print "--------------------------------------------------------" if __name__ == '__main__': db_app.emptypool(db_app.app_db([DB_CONF])) test1() test2() test3() test4() test5() db_app.emptypool(db_app.app_db([DB_CONF]))
a.useCache = True o3 = a.GetObjs() cc+=len(o3) print time.time() - t2, "Loading after Close", cc, "objects" t2 = time.time() user = User(u"test") for id in ids: r.Delete(id, user=user) #try: # r.Delete(id) #except Exception, e: # raise Exception, str(ids)+ " " + str(id) print time.time() - t2, "Deleting objects recursively" print "------------" print time.time() - t, "Total. Finished (contains", db_app.statdb(a), "Entries)" a.Close() print "--------------------------------------------------------" if __name__ == '__main__': db_app.emptypool(db_app.app_db([DB_CONF])) test1() test2() test3() test4() test5() db_app.emptypool(db_app.app_db([DB_CONF]))
def test5(): print "5) Testing objects create / close load cache / delete, 3 level, no files" t = time.time() a = db_app.app_db() print time.time() - t, "Creating db (contains", db_app.statdb( a), "Entries)" t2 = time.time() r = a.root() print time.time() - t2, "Creating root" t2 = time.time() c = r ids = [] n = 0 c.useCache = True for i in range(0, level1): o = db_app.createObj1(r) o.useCache = True ids.append(o.id) #print o.id n += 1 for i2 in range(0, level2): o2 = db_app.createObj1(o) o2.useCache = True #print o2.id, n += 1 for i3 in range(0, level3_1): o3 = db_app.createObj1(o2) o3.useCache = True #print o3.id, n += 1 for i3 in range(0, level3_2): o3 = db_app.createObj2(o2) o3.useCache = True #print o3.id, n += 1 print time.time() - t2, "Creating", n, "objects" t2 = time.time() r.Close() print time.time() - t2, "Closing", n, "objects" t2 = time.time() r = a.root() r.useCache = True o1 = r.GetObjs() cc = len(o1) for o in o1: o.useCache = True o2 = o.GetObjs() cc += len(o2) for a in o2: a.useCache = True o3 = a.GetObjs() cc += len(o3) print time.time() - t2, "Loading after Close", cc, "objects" t2 = time.time() user = User(u"test") for id in ids: r.Delete(id, user=user) #try: # r.Delete(id) #except Exception, e: # raise Exception, str(ids)+ " " + str(id) print time.time() - t2, "Deleting objects recursively" print "------------" print time.time() - t, "Total. Finished (contains", db_app.statdb( a), "Entries)" a.Close() print "--------------------------------------------------------"
def test3(): print "3) Testing objects create / load / load batch / delete, 3 level, no files" t = time.time() a = db_app.app_db() print time.time() - t, "Creating db (contains", db_app.statdb( a), "Entries)" t2 = time.time() r = a.root() print time.time() - t2, "Creating root" t2 = time.time() c = r ids = [] n = 0 for i in range(0, level1): o = db_app.createObj1(c) n += 1 ids.append(o.id) for i2 in range(0, level2): o2 = db_app.createObj1(o) n += 1 for i3 in range(0, level3_1): db_app.createObj1(o2) n += 1 for i3 in range(0, level3_2): db_app.createObj2(o2) n += 1 print time.time() - t2, "Creating", n, "objects" t2 = time.time() del r del a a = db_app.app_db() print time.time() - t2, "Creating db (contains", db_app.statdb( a), "Entries)" t2 = time.time() r = a.root() print time.time() - t2, "Creating root" t2 = time.time() o1 = r.GetObjs(batch=True) cc = len(o1) for o in o1: o2 = o.GetObjs(batch=True) cc += len(o2) for a in o2: o3 = a.GetObjs(batch=True) cc += len(o3) print time.time() - t2, "Loading batch", cc, "objects" t2 = time.time() user = User(u"test") for id in ids: r.Delete(id, user=user) print time.time() - t2, "Deleting objects recursively" print "------------" print time.time() - t, "Total. Finished (contains", db_app.statdb( a), "Entries)" a.Close() print "--------------------------------------------------------"
def test_init1(self): app = db_app.app_db() GetUsers(app)