Commit 6b6ab5d1 authored by Vincent Pelletier's avatar Vincent Pelletier

Make buildDatabaseManager independent from database parameters.

parent dcb0e404
......@@ -48,7 +48,9 @@ class Application(object):
self.em = EventManager()
self.nm = NodeManager(config.getDynamicMasterList())
self.tm = TransactionManager(self)
self.dm = buildDatabaseManager(config.getAdapter(), config.getDatabase())
self.dm = buildDatabaseManager(config.getAdapter(),
(config.getDatabase(), )
)
# load master nodes
master_addresses, connector_name = config.getMasters()
......
......@@ -38,11 +38,11 @@ else:
if not DATABASE_MANAGER_DICT:
raise ImportError('No database back-end available.')
def buildDatabaseManager(name, config):
def buildDatabaseManager(name, args=(), kw={}):
if name is None:
name = DATABASE_MANAGER_DICT.keys()[0]
adapter_klass = DATABASE_MANAGER_DICT.get(name, None)
if adapter_klass is None:
raise DatabaseFailure('Cannot find a database adapter <%s>' % name)
return adapter_klass(config)
return adapter_klass(*args, **kw)
......@@ -118,7 +118,7 @@ class ReplicationTests(NeoUnitTestBase):
def buildStorage(self, transactions, objects, name='BTree', database=None):
def makeid(oid_or_tid):
return pack('!Q', oid_or_tid)
storage = buildDatabaseManager(name, database)
storage = buildDatabaseManager(name, (database, ))
storage.setup(reset=True)
storage.setNumPartitions(1)
storage._transactions = transactions
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment