summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdbpp/mockDatabase.h5
-rw-r--r--libdbpp/unittests/testConnectionPool.cpp2
-rw-r--r--libdbpp/unittests/testPatch.cpp2
-rw-r--r--libdbpp/unittests/testUtils.cpp4
4 files changed, 7 insertions, 6 deletions
diff --git a/libdbpp/mockDatabase.h b/libdbpp/mockDatabase.h
index 2510c73..d3e5bff 100644
--- a/libdbpp/mockDatabase.h
+++ b/libdbpp/mockDatabase.h
@@ -63,10 +63,11 @@ class DLL_PUBLIC MockServerDatabase : public MockDatabase {
template<typename T>
class PluginMock {
public:
- PluginMock(const std::string & m, const std::string & name, const std::vector<boost::filesystem::path> & s) :
+ template<typename ... Args>
+ PluginMock(const std::string & name, const std::initializer_list<boost::filesystem::path> & s, const Args & ... args) :
mockName(name)
{
- AdHoc::PluginManager::getDefault()->create<MockDatabase, T>(mockName, __FILE__, __LINE__, m, name, s);
+ AdHoc::PluginManager::getDefault()->create<MockDatabase, T>(mockName, __FILE__, __LINE__, args..., name, s);
}
~PluginMock()
{
diff --git a/libdbpp/unittests/testConnectionPool.cpp b/libdbpp/unittests/testConnectionPool.cpp
index 124df5b..de3de79 100644
--- a/libdbpp/unittests/testConnectionPool.cpp
+++ b/libdbpp/unittests/testConnectionPool.cpp
@@ -8,7 +8,7 @@
class MockPool : public DB::PluginMock<PQ::Mock>, public DB::ConnectionPool {
public:
MockPool() :
- PluginMock<PQ::Mock>("user=postgres dbname=postgres", "pqmock", { }),
+ PluginMock<PQ::Mock>("pqmock", { }, "user=postgres dbname=postgres"),
DB::ConnectionPool(4, 2, "postgresql", stringbf("user=postgres dbname=%s", databaseName()))
{
}
diff --git a/libdbpp/unittests/testPatch.cpp b/libdbpp/unittests/testPatch.cpp
index b9ede04..a1c77d3 100644
--- a/libdbpp/unittests/testPatch.cpp
+++ b/libdbpp/unittests/testPatch.cpp
@@ -13,7 +13,7 @@
class Mock : public DB::PluginMock<PQ::Mock> {
public:
Mock() :
- DB::PluginMock<PQ::Mock>("user=postgres dbname=postgres", "pqmock", { rootDir / "patch.sql" })
+ DB::PluginMock<PQ::Mock>("pqmock", { rootDir / "patch.sql" }, "user=postgres dbname=postgres")
{
}
};
diff --git a/libdbpp/unittests/testUtils.cpp b/libdbpp/unittests/testUtils.cpp
index c926a47..04fad4f 100644
--- a/libdbpp/unittests/testUtils.cpp
+++ b/libdbpp/unittests/testUtils.cpp
@@ -15,8 +15,8 @@
class StandardMockDatabase : public DB::PluginMock<PQ::Mock> {
public:
- StandardMockDatabase() : DB::PluginMock<PQ::Mock>("user=postgres dbname=postgres", "pqmock", {
- rootDir / "util.sql" })
+ StandardMockDatabase() : DB::PluginMock<PQ::Mock>("pqmock", {
+ rootDir / "util.sql" }, "user=postgres dbname=postgres")
{
}
};