diff options
Diffstat (limited to 'libdbpp/mockDatabase.cpp')
-rw-r--r-- | libdbpp/mockDatabase.cpp | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/libdbpp/mockDatabase.cpp b/libdbpp/mockDatabase.cpp index 5e78ca1..80d4732 100644 --- a/libdbpp/mockDatabase.cpp +++ b/libdbpp/mockDatabase.cpp @@ -7,15 +7,6 @@ #include <plugins.impl.h> #include <factory.impl.h> -namespace AdHoc { - template <> - PluginOf<DB::MockDatabase>::~PluginOf() - { - // This implementation doesn't delete .implementation as - // mock databases simply unregister themselves (via destructor) - // when the mock framework tears them down. - } -} INSTANTIATEPLUGINOF(DB::MockDatabase); INSTANTIATEFACTORY(DB::MockDatabase, const std::string &, const std::string &, const std::vector<boost::filesystem::path> &); PLUGINRESOLVER(DB::MockDatabaseFactory, DB::Connection::resolvePlugin); @@ -24,18 +15,8 @@ namespace DB { unsigned int MockDatabase::mocked = 0; -MockDatabase::MockDatabase(const std::string & name) : - mockName(name) -{ - AdHoc::PluginManager::getDefault()->add(AdHoc::PluginPtr(new AdHoc::PluginOf<MockDatabase>(this, mockName, __FILE__, __LINE__))); -} - -MockDatabase::~MockDatabase() -{ - AdHoc::PluginManager::getDefault()->remove<MockDatabase>(mockName); -} -Connection * +ConnectionPtr MockDatabase::openConnectionTo(const std::string & mockName) { return AdHoc::PluginManager::getDefault()->get<DB::MockDatabase>(mockName)->implementation()->openConnection(); @@ -75,7 +56,6 @@ MockDatabase::PlaySchemaScript(DB::Connection * conn, const boost::filesystem::p AdHocFormatter(MockServerDatabaseName, "libdbpp_mock_%?_%?_%?"); MockServerDatabase::MockServerDatabase(const std::string & masterdb, const std::string & name, const std::string & type) : - MockDatabase(name), master(DB::ConnectionFactory::createNew(type, masterdb)), testDbName(MockServerDatabaseName::get(name, getpid(), ++mocked)) { @@ -83,7 +63,6 @@ MockServerDatabase::MockServerDatabase(const std::string & masterdb, const std:: MockServerDatabase::~MockServerDatabase() { - delete master; } const std::string & |