Exemplo n.º 1
0
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 "--------------------------------------------------------"
Exemplo n.º 2
0
 def setUp(self):
     self._loadApp()
     self.app.Register(configuration)
     root = self.app.root()
     self.o = o = db_app.createObj1(root)
     db_app.createObj1(o)
     db_app.createObj2(o)
     db_app.createObj3(o)
Exemplo n.º 3
0
 def setUp(self):
     self._loadApp()
     self.app.Register(configuration)
     root = self.app.root()
     self.o = o = db_app.createObj1(root)
     db_app.createObj1(o)
     db_app.createObj2(o)
     db_app.createObj3(o)
Exemplo n.º 4
0
 def setUp(self):
     self._loadApp()
     r=self.app.root()
 
     # create three levels of entries
     level1 = 5
     level2 = 5
     level3_1 = 5
     level3_2 = 5
     c=r
     ids=[]
     n=0
     user = User(u"test")
     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):
                 o4 = db_app.createObj2(o2)
                 id = o4.id
                 n+=1
     self.ids = ids
     self.lastid = id
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
def test1():
    print "1) Testing objects create / 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
    user = User(u"test")
    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()

    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 "--------------------------------------------------------"
Exemplo n.º 7
0
def test1():
    print "1) Testing objects create / 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
    user = User(u"test")
    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()

    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 "--------------------------------------------------------"
Exemplo n.º 8
0
 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)
Exemplo n.º 9
0
 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)
Exemplo n.º 10
0
 def setUp(self):
     self.request = testing.DummyRequest()
     self.config = testing.setUp(request=self.request)
     self.config.include('pyramid_chameleon')
     self.request._LOCALE_ = "en"
     self.request.subpath = ["file1.txt"]
     self.request.context = None
     self.request.content_type = None
     self._loadApp(["nive.adminview.view"])
     self.app.Startup(self.config)
     #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)
Exemplo n.º 11
0
 def setUp(self):
     self.request = testing.DummyRequest()
     self.config = testing.setUp(request=self.request)
     self.config.include('pyramid_chameleon')
     self.request._LOCALE_ = "en"
     self.request.subpath = ["file1.txt"]
     self.request.context = None
     self.request.content_type = None
     self._loadApp(["nive.adminview.view"])
     self.app.Startup(self.config)
     #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)
Exemplo n.º 12
0
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 "--------------------------------------------------------"
Exemplo n.º 13
0
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 "--------------------------------------------------------"
Exemplo n.º 14
0
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 "--------------------------------------------------------"
Exemplo n.º 15
0
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)