def InitializeDataStore(): """Initialize the data store. Depends on the stats module being initialized. """ global REL_DB # pylint: disable=global-statement global BLOBS # pylint: disable=global-statement if flags.FLAGS.list_storage: _ListStorageOptions() sys.exit(0) # Initialize the blobstore. blobstore_name = config.CONFIG.Get("Blobstore.implementation") try: cls = blob_store.REGISTRY[blobstore_name] except KeyError: raise ValueError("No blob store %s found." % blobstore_name) BLOBS = blob_store.BlobStoreValidationWrapper(cls()) # Initialize the relational DB. rel_db_name = config.CONFIG["Database.implementation"] if not rel_db_name: return try: cls = registry_init.REGISTRY[rel_db_name] except KeyError: raise ValueError("Database %s not found." % rel_db_name) logging.info("Using database implementation %s", rel_db_name) REL_DB = db.DatabaseValidationWrapper(cls())
def setUp(self): super(BlobStoreTestMixin, self).setUp() bs, cleanup = self.CreateBlobStore() if cleanup is not None: self.addCleanup(cleanup) self.blob_store = blob_store.BlobStoreValidationWrapper(bs)
def _MakeBlobStore(blobstore_name): try: cls = blob_store.REGISTRY[blobstore_name] except KeyError: raise ValueError("No blob store %s found." % blobstore_name) return blob_store.BlobStoreValidationWrapper(cls())
def setUp(self): super(BlobStoreTestMixin, self).setUp() bs, self.cleanup = self.CreateBlobStore() self.blob_store = blob_store.BlobStoreValidationWrapper(bs)