Exemplo n.º 1
0
 def test_mem_mem(self):
     self.container = InMemoryEntityContainer(self.cdef)
     self.bs = blockstore.EDMBlockStore(entity_set=self.cdef['Blocks'],
                                        max_block_size=self.block_size)
     self.ls = blockstore.LockStore(entity_set=self.cdef['BlockLocks'])
     self.ss = blockstore.StreamStore(bs=self.bs,
                                      ls=self.ls,
                                      entity_set=self.cdef['Streams'])
     self.random_rw()
Exemplo n.º 2
0
 def test_sql_sql(self):
     self.container = BlockStoreContainer(container=self.cdef,
                                          file_path=str(
                                              self.d.join('blockstore.db')))
     self.container.create_all_tables()
     self.bs = blockstore.EDMBlockStore(entity_set=self.cdef['Blocks'],
                                        max_block_size=self.block_size)
     self.ls = blockstore.LockStore(entity_set=self.cdef['BlockLocks'])
     self.ss = blockstore.StreamStore(bs=self.bs,
                                      ls=self.ls,
                                      entity_set=self.cdef['Streams'])
     self.random_rw()
Exemplo n.º 3
0
 def setUp(self):  # noqa
     path = os.path.join(DATA_DIR, 'blockstore.xml')
     self.doc = edmx.Document()
     with open(path, 'rb') as f:
         self.doc.read(f)
     self.cdef = self.doc.root.DataServices['BlockSchema.BlockContainer']
     self.container = InMemoryEntityContainer(self.cdef)
     self.mt_lock = threading.Lock()
     self.mt_count = 0
     self.bs = blockstore.EDMBlockStore(entity_set=self.cdef['Blocks'],
                                        max_block_size=64)
     self.ls = blockstore.LockStore(entity_set=self.cdef['BlockLocks'])
Exemplo n.º 4
0
 def __init__(self, db, dpath=None, **kwargs):
     self.container_def = self.load_container()
     #: the :py:class:`MySQLEntityContainer` used for the blockstore
     self.container = MySQLEntityContainer(db=db,
                                           container=self.container_def,
                                           **kwargs)
     if dpath is None:
         bs = blockstore.FileBlockStore(dpath)
     else:
         bs = blockstore.EDMBlockStore(
             entity_set=self.container_def['Blocks'])
     ls = blockstore.LockStore(entity_set=self.container_def['Locks'])
     blockstore.StreamStore.__init__(self, bs, ls,
                                     self.container_def['Streams'])
Exemplo n.º 5
0
 def test_delete(self):
     bs = blockstore.EDMBlockStore(entity_set=self.cdef['Blocks'])
     self.cafeclosed(bs)
Exemplo n.º 6
0
 def test_hash(self):
     bs = blockstore.EDMBlockStore(entity_set=self.cdef['Blocks'],
                                   hash_class=hashlib.md5)
     self.checkmd5(bs)
Exemplo n.º 7
0
 def test_maxsize(self):
     bs = blockstore.EDMBlockStore(entity_set=self.cdef['Blocks'],
                                   max_block_size=256)
     self.maxsize(bs)
Exemplo n.º 8
0
 def test_store(self):
     bs = blockstore.EDMBlockStore(entity_set=self.cdef['Blocks'])
     self.fox_cafe(bs)
Exemplo n.º 9
0
 def test_init(self):
     bs = blockstore.EDMBlockStore(entity_set=self.cdef['Blocks'])
     self.assertTrue(bs.max_block_size == blockstore.MAX_BLOCK_SIZE,
                     "default block size")
     self.assertTrue(bs.hash_class is hashlib.sha256,
                     "default hash_class SHA256")