Example #1
0
 def set_cur_profile(self, profile):
   self.__cur_prof = profile
   cpool.cpool_release()
   if profile is None: return
   db_fname = None
   if profile.db_fname:
     db_fname = profile.db_fname
   else:
     db_fname = path.join(self.prof_dir, profile.id)
   cpool.cpool_init(db_fname, 5)
Example #2
0
 def setUp(self):
   db_fname = './entity_test_db'
   supp.gen_db(db_fname)
   cpool.cpool_init(db_fname, 5)
   p = model.Profile()
   p.name = 'Ayumi'
   self.pid = str(uuid.uuid1())
   p.id = self.pid
   p.attr_dict['extra_info'] = 'something important'
   p.save()
Example #3
0
  def setUp(self):
    db_fname = './da_test_db'
    supp.gen_db(db_fname)
    cpool.cpool_release()
    cpool.cpool_init(db_fname, 5)
    self.pada = da.ProfileAttrDA()

    row = ('nonsense_name', 'nonsense_value')
    self.pada.begin_transaction()
    self.pada.save_row(row)
    self.pada.end_transaction()
Example #4
0
  def setUp(self):
    db_fname = './da_test_db'
    supp.gen_db(db_fname)
    cpool.cpool_release()
    cpool.cpool_init(db_fname, 5)
    self.lfda = da.LocalFileDA()
    self.file_hash = 'file_hash'
    self.seg_hashs = ('seg_hash0', 'seg_hash1')

    row = (self.file_hash, 'full_name', 'name', 4096, '2009-01-01 09:09:09', 7168)
    seg_row0 = (self.seg_hashs[0], 0, self.file_hash, True)
    seg_row1 = (self.seg_hashs[1], 4096, self.file_hash, False)
    self.lfda.begin_transaction()
    self.lfda.save_row(row)
    self.lfda.save_seg_row(seg_row0)
    self.lfda.save_seg_row(seg_row1)
    self.lfda.end_transaction()
Example #5
0
 def testInitRelease(self):
   cpool.cpool_init('./cpool_test_db', 99)
   self.assertTrue(isinstance(cpool.get_cpool(), cpool.ConnectionPool))
   cpool.cpool_release()
   self.assertEqual(cpool.get_cpool(), None)
Example #6
0
 def setUp(self):
   db_fname = './da_test_db'
   supp.gen_db(db_fname)
   cpool.cpool_release()
   cpool.cpool_init(db_fname, 5)