diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-04-17 22:31:10 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-04-17 22:31:10 +0100 |
commit | ff6c433341ad4bf63413938dd462c6bd7071032a (patch) | |
tree | 392d77d744f2f629ade17a2a2e36c9c3d6c75d78 /mythfs | |
parent | ICE Local (diff) | |
download | mythfs-ff6c433341ad4bf63413938dd462c6bd7071032a.tar.bz2 mythfs-ff6c433341ad4bf63413938dd462c6bd7071032a.tar.xz mythfs-ff6c433341ad4bf63413938dd462c6bd7071032a.zip |
C++17 and Ice 3.7mythfs-0.3
Update everything to Ice 3.7 and C++17 in keeping with other libs/services
Diffstat (limited to 'mythfs')
-rw-r--r-- | mythfs/Jamfile.jam | 7 | ||||
-rw-r--r-- | mythfs/service/Jamfile.jam | 5 | ||||
-rw-r--r-- | mythfs/service/dbimpl.cpp | 2 | ||||
-rw-r--r-- | mythfs/service/dbimpl.h | 2 | ||||
-rw-r--r-- | mythfs/service/inodes/allDirectory.cpp | 2 | ||||
-rw-r--r-- | mythfs/service/inodes/filterByDateDirectory.cpp | 2 | ||||
-rw-r--r-- | mythfs/service/inodes/filterByTitleDirectory.cpp | 2 | ||||
-rw-r--r-- | mythfs/service/inodes/groupingByDateDirectory.cpp | 2 | ||||
-rw-r--r-- | mythfs/service/inodes/groupingByTitleDirectory.cpp | 2 | ||||
-rw-r--r-- | mythfs/service/inodes/node.h | 4 | ||||
-rw-r--r-- | mythfs/service/main.cpp | 7 | ||||
-rw-r--r-- | mythfs/service/recordingsVolume.cpp | 49 | ||||
-rw-r--r-- | mythfs/service/recordingsVolume.h | 38 | ||||
-rw-r--r-- | mythfs/service/service.cpp | 10 | ||||
-rw-r--r-- | mythfs/service/service.h | 2 | ||||
-rw-r--r-- | mythfs/unittests/Jamfile.jam | 10 | ||||
-rw-r--r-- | mythfs/unittests/mockDefs.cpp | 5 | ||||
-rw-r--r-- | mythfs/unittests/mockDefs.h | 6 | ||||
-rw-r--r-- | mythfs/unittests/testMain.cpp | 4 |
19 files changed, 79 insertions, 82 deletions
diff --git a/mythfs/Jamfile.jam b/mythfs/Jamfile.jam index 7159557..bb3cbf1 100644 --- a/mythfs/Jamfile.jam +++ b/mythfs/Jamfile.jam @@ -7,10 +7,9 @@ lib slicer-db : : : : <include>/usr/include/slicer ; lib netfs-api : : : : <include>/usr/include/netfs ; lib icetray : : : : <include>/usr/include/icetray ; lib dbppcore : : : : <include>/usr/include/dbpp ; -lib Ice ; -lib IceUtil ; +lib Ice : : <name>Ice++11 ; lib pthread ; -lib IceBox ; +lib IceBox : : <name>IceBox++11 ; lib boost_filesystem ; lib boost_system ; lib boost_thread ; @@ -20,6 +19,6 @@ build-project service ; build-project unittests ; package.install install : : : - service//mythfs + service//mythfs++11 ; diff --git a/mythfs/service/Jamfile.jam b/mythfs/service/Jamfile.jam index 6ef0337..433deb2 100644 --- a/mythfs/service/Jamfile.jam +++ b/mythfs/service/Jamfile.jam @@ -1,7 +1,7 @@ import icetray ; import package ; -lib mythfs : +lib mythfs++11 : [ glob *.cpp inodes/*.cpp *.ice sql/*.sql ] : <slicer>yes @@ -13,7 +13,6 @@ lib mythfs : <library>..//boost_date_time <library>..//Ice <library>..//IceBox - <library>..//IceUtil <library>..//pthread <library>..//icetray <library>..//slicer @@ -28,5 +27,5 @@ lib mythfs : <library>..//icetray ; -package.install install : : : mythfs ; +package.install install : : : mythfs++11 ; diff --git a/mythfs/service/dbimpl.cpp b/mythfs/service/dbimpl.cpp index c3d1b3d..498c8c8 100644 --- a/mythfs/service/dbimpl.cpp +++ b/mythfs/service/dbimpl.cpp @@ -2,7 +2,7 @@ #include <sql/getRecorded.sql.h> namespace MythFS { - DBImpl::DBImpl(IceTray::DatabasePoolPtr d) : + DBImpl::DBImpl(const ::DB::ConnectionPoolPtr & d) : IceTray::AbstractCachingDatabaseClient(d) { } diff --git a/mythfs/service/dbimpl.h b/mythfs/service/dbimpl.h index e6c4b19..d4e1f12 100644 --- a/mythfs/service/dbimpl.h +++ b/mythfs/service/dbimpl.h @@ -7,7 +7,7 @@ namespace MythFS { class DLL_PUBLIC DBImpl : public DB, ::IceTray::AbstractCachingDatabaseClient { public: - DBImpl(IceTray::DatabasePoolPtr); + DBImpl(const ::DB::ConnectionPoolPtr &); Recordeds getRecorded() override; }; diff --git a/mythfs/service/inodes/allDirectory.cpp b/mythfs/service/inodes/allDirectory.cpp index d7278a3..f9bea8c 100644 --- a/mythfs/service/inodes/allDirectory.cpp +++ b/mythfs/service/inodes/allDirectory.cpp @@ -21,7 +21,7 @@ namespace MythFS { }) == rs.end()) { throw NetFS::SystemError(ENOENT); } - return new Symlink("/var/store/mythrecordings/" + path); + return std::make_shared<Symlink>("/var/store/mythrecordings/" + path); } } diff --git a/mythfs/service/inodes/filterByDateDirectory.cpp b/mythfs/service/inodes/filterByDateDirectory.cpp index 53298e9..2fceb64 100644 --- a/mythfs/service/inodes/filterByDateDirectory.cpp +++ b/mythfs/service/inodes/filterByDateDirectory.cpp @@ -28,7 +28,7 @@ namespace MythFS { { for (auto r :db->getRecorded()) { if (matches(r) && attribute(r) == n) { - return new Symlink("/var/store/mythrecordings/" + r->basename); + return std::make_shared<Symlink>("/var/store/mythrecordings/" + r->basename); } } throw NetFS::SystemError(ENOENT); diff --git a/mythfs/service/inodes/filterByTitleDirectory.cpp b/mythfs/service/inodes/filterByTitleDirectory.cpp index 3d8f4bd..2c3a373 100644 --- a/mythfs/service/inodes/filterByTitleDirectory.cpp +++ b/mythfs/service/inodes/filterByTitleDirectory.cpp @@ -27,7 +27,7 @@ namespace MythFS { { for (auto r :db->getRecorded()) { if (matches(r) && attribute(r) == n) { - return new Symlink("/var/store/mythrecordings/" + r->basename); + return std::make_shared<Symlink>("/var/store/mythrecordings/" + r->basename); } } throw NetFS::SystemError(ENOENT); diff --git a/mythfs/service/inodes/groupingByDateDirectory.cpp b/mythfs/service/inodes/groupingByDateDirectory.cpp index 6aa842e..047488c 100644 --- a/mythfs/service/inodes/groupingByDateDirectory.cpp +++ b/mythfs/service/inodes/groupingByDateDirectory.cpp @@ -21,7 +21,7 @@ namespace MythFS { if (!AdHoc::containerContains(getContents(), t)) { throw NetFS::SystemError(ENOENT); } - return new FilterByDateDirectory(db, t); + return std::make_shared<FilterByDateDirectory>(db, t); } } diff --git a/mythfs/service/inodes/groupingByTitleDirectory.cpp b/mythfs/service/inodes/groupingByTitleDirectory.cpp index a87687c..edd5225 100644 --- a/mythfs/service/inodes/groupingByTitleDirectory.cpp +++ b/mythfs/service/inodes/groupingByTitleDirectory.cpp @@ -21,7 +21,7 @@ namespace MythFS { if (!AdHoc::containerContains(getContents(), t)) { throw NetFS::SystemError(ENOENT); } - return new FilterByTitleDirectory(db, t); + return std::make_shared<FilterByTitleDirectory>(db, t); } } diff --git a/mythfs/service/inodes/node.h b/mythfs/service/inodes/node.h index b88e403..4497857 100644 --- a/mythfs/service/inodes/node.h +++ b/mythfs/service/inodes/node.h @@ -10,11 +10,11 @@ namespace MythFS { class Node; - typedef std::map<std::string, IceUtil::Handle<Node>> Contents; + typedef std::map<std::string, std::shared_ptr<Node>> Contents; class Node : public virtual Ice::Object { public: - typedef IceUtil::Handle<Node> PointerType; + typedef std::shared_ptr<Node> PointerType; virtual NetFS::Attr getattr() const = 0; virtual std::string readlink() const; diff --git a/mythfs/service/main.cpp b/mythfs/service/main.cpp index c0e98ce..1368309 100644 --- a/mythfs/service/main.cpp +++ b/mythfs/service/main.cpp @@ -1,4 +1,4 @@ -#include <Ice/Communicator.h> +#include <Ice/Initialize.h> #include <Ice/ObjectAdapter.h> #include <icetrayService.h> #include "service.h" @@ -11,8 +11,9 @@ namespace MythFS { void addObjects(const std::string &, const Ice::CommunicatorPtr & ic, const Ice::StringSeq &, const Ice::ObjectAdapterPtr & adp) override { auto dbpool = getConnectionPool(ic, "mysql", "MythFS"); - adp->add(new MythFS::Service(), ic->stringToIdentity("Service")); - adp->add(new RecordingsVolume(new DBImpl(dbpool)), ic->stringToIdentity("recordings")); + adp->add(std::make_shared<MythFS::Service>(), Ice::stringToIdentity("Service")); + adp->add(std::make_shared<RecordingsVolume>( + std::make_shared<DBImpl>(dbpool)), Ice::stringToIdentity("recordings")); } }; diff --git a/mythfs/service/recordingsVolume.cpp b/mythfs/service/recordingsVolume.cpp index 3bdc5d2..7be25cb 100644 --- a/mythfs/service/recordingsVolume.cpp +++ b/mythfs/service/recordingsVolume.cpp @@ -12,47 +12,48 @@ namespace MythFS { RecordingsVolume::RecordingsVolume(DBPtr db) { - contents.insert({ "all", new AllDirectory(db) }); - contents.insert({ "by title", new ByTitleDirectory(db) }); - contents.insert({ "by date", new ByDateDirectory(db) }); + contents.insert({ "all", std::make_shared<AllDirectory>(db) }); + contents.insert({ "by title", std::make_shared<ByTitleDirectory>(db) }); + contents.insert({ "by date", std::make_shared<ByDateDirectory>(db) }); } - NetFS::DirectoryPrx - RecordingsVolume::opendir(const NetFS::ReqEnv &, const std::string & p, const Ice::Current & ic) + NetFS::DirectoryPrxPtr + RecordingsVolume::opendir(const NetFS::ReqEnv, const std::string p, const Ice::Current & ic) { - return ::NetFS::DirectoryPrx::uncheckedCast(ic.adapter->addFacetWithUUID(new OpenDirectory(resolvePath(p)), "v02")); + return Ice::uncheckedCast<::NetFS::DirectoryPrx>( + ic.adapter->addFacetWithUUID(std::make_shared<OpenDirectory>(resolvePath(p)), "v02")); } - void RecordingsVolume::mkdir(const NetFS::ReqEnv &, const std::string &, Ice::Int, const Ice::Current&) + void RecordingsVolume::mkdir(const NetFS::ReqEnv, const std::string, Ice::Int, const Ice::Current&) { throw ::NetFS::SystemError(ENOSYS); } - void RecordingsVolume::rmdir(const NetFS::ReqEnv &, const std::string &, const Ice::Current&) + void RecordingsVolume::rmdir(const NetFS::ReqEnv, const std::string, const Ice::Current&) { throw ::NetFS::SystemError(ENOSYS); } - void RecordingsVolume::truncate(const NetFS::ReqEnv &, const std::string &, Ice::Long, const Ice::Current&) + void RecordingsVolume::truncate(const NetFS::ReqEnv, const std::string, Ice::Long, const Ice::Current&) { throw ::NetFS::SystemError(ENOSYS); } - void RecordingsVolume::unlink(const NetFS::ReqEnv &, const std::string &, const Ice::Current&) + void RecordingsVolume::unlink(const NetFS::ReqEnv, const std::string, const Ice::Current&) { throw ::NetFS::SystemError(ENOSYS); } - NetFS::FilePrx RecordingsVolume::open(const NetFS::ReqEnv &, const std::string &, Ice::Int, const Ice::Current&) + NetFS::FilePrxPtr RecordingsVolume::open(const NetFS::ReqEnv, const std::string, Ice::Int, const Ice::Current&) { throw ::NetFS::SystemError(ENOSYS); } - NetFS::FilePrx RecordingsVolume::create(const NetFS::ReqEnv &, const std::string &, Ice::Int, Ice::Int, const Ice::Current&) + NetFS::FilePrxPtr RecordingsVolume::create(const NetFS::ReqEnv, const std::string, Ice::Int, Ice::Int, const Ice::Current&) { throw ::NetFS::SystemError(ENOSYS); } - NetFS::VFS RecordingsVolume::statfs(const NetFS::ReqEnv &, const std::string &, const Ice::Current&) + NetFS::VFS RecordingsVolume::statfs(const NetFS::ReqEnv, const std::string, const Ice::Current&) { errno = 0; struct statvfs s; @@ -63,52 +64,52 @@ namespace MythFS { return converter.convert(s); } - Ice::Int RecordingsVolume::access(const NetFS::ReqEnv &, const std::string &, Ice::Int, const Ice::Current&) + Ice::Int RecordingsVolume::access(const NetFS::ReqEnv, const std::string, Ice::Int, const Ice::Current&) { return 0; } - NetFS::Attr RecordingsVolume::getattr(const NetFS::ReqEnv &, const std::string & path, const Ice::Current&) + NetFS::Attr RecordingsVolume::getattr(const NetFS::ReqEnv, const std::string path, const Ice::Current&) { return resolvePath(path)->getattr(); } - void RecordingsVolume::mknod(const NetFS::ReqEnv &, const std::string &, Ice::Int, Ice::Int, const Ice::Current&) + void RecordingsVolume::mknod(const NetFS::ReqEnv, const std::string, Ice::Int, Ice::Int, const Ice::Current&) { throw ::NetFS::SystemError(ENOSYS); } - void RecordingsVolume::symlink(const NetFS::ReqEnv &, const std::string &, const std::string &, const Ice::Current&) + void RecordingsVolume::symlink(const NetFS::ReqEnv, const std::string, const std::string, const Ice::Current&) { throw ::NetFS::SystemError(ENOSYS); } - void RecordingsVolume::link(const NetFS::ReqEnv &, const std::string &, const std::string &, const Ice::Current&) + void RecordingsVolume::link(const NetFS::ReqEnv, const std::string, const std::string, const Ice::Current&) { throw ::NetFS::SystemError(ENOSYS); } - void RecordingsVolume::rename(const NetFS::ReqEnv &, const std::string &, const std::string &, const Ice::Current&) + void RecordingsVolume::rename(const NetFS::ReqEnv, const std::string, const std::string, const Ice::Current&) { throw ::NetFS::SystemError(ENOSYS); } - std::string RecordingsVolume::readlink(const NetFS::ReqEnv &, const std::string & path, const Ice::Current&) + std::string RecordingsVolume::readlink(const NetFS::ReqEnv, const std::string path, const Ice::Current&) { return resolvePath(path)->readlink(); } - void RecordingsVolume::chmod(const NetFS::ReqEnv &, const std::string &, Ice::Int, const Ice::Current&) + void RecordingsVolume::chmod(const NetFS::ReqEnv, const std::string, Ice::Int, const Ice::Current&) { throw ::NetFS::SystemError(ENOSYS); } - void RecordingsVolume::chown(const NetFS::ReqEnv &, const std::string &, Ice::Int, Ice::Int, const Ice::Current&) + void RecordingsVolume::chown(const NetFS::ReqEnv, const std::string, Ice::Int, Ice::Int, const Ice::Current&) { throw ::NetFS::SystemError(ENOSYS); } - void RecordingsVolume::utimens(const NetFS::ReqEnv &, const std::string &, Ice::Long, Ice::Long, Ice::Long, Ice::Long, const Ice::Current&) + void RecordingsVolume::utimens(const NetFS::ReqEnv, const std::string, Ice::Long, Ice::Long, Ice::Long, Ice::Long, const Ice::Current&) { throw ::NetFS::SystemError(ENOSYS); } @@ -120,7 +121,7 @@ namespace MythFS { Node::PointerType RecordingsVolume::resolvePath(const std::string & p) { - Node::PointerType d = this; + Node::PointerType d = shared_from_this(); boost::filesystem::path path(p.substr(1)); for (const auto & e : path) { d = d->getChild(e.string()); diff --git a/mythfs/service/recordingsVolume.h b/mythfs/service/recordingsVolume.h index c5b3fa8..8def17a 100644 --- a/mythfs/service/recordingsVolume.h +++ b/mythfs/service/recordingsVolume.h @@ -7,34 +7,34 @@ #include <typeConverter.h> namespace MythFS { - class RecordingsVolume : public ::NetFS::Volume, public StaticDirectory { + class RecordingsVolume : public ::NetFS::Volume, public StaticDirectory, public std::enable_shared_from_this<RecordingsVolume> { public: RecordingsVolume(DBPtr); - virtual NetFS::DirectoryPrx opendir(const NetFS::ReqEnv &, const std::string & path, const Ice::Current&) override; + virtual NetFS::DirectoryPrxPtr opendir(const NetFS::ReqEnv, const std::string path, const Ice::Current&) override; - virtual void mkdir(const NetFS::ReqEnv &, const std::string & path, Ice::Int id, const Ice::Current&) override; - virtual void rmdir(const NetFS::ReqEnv &, const std::string & path, const Ice::Current&) override; + virtual void mkdir(const NetFS::ReqEnv, const std::string path, Ice::Int id, const Ice::Current&) override; + virtual void rmdir(const NetFS::ReqEnv, const std::string path, const Ice::Current&) override; - virtual void truncate(const NetFS::ReqEnv &, const std::string & path, Ice::Long size, const Ice::Current&) override; + virtual void truncate(const NetFS::ReqEnv, const std::string path, Ice::Long size, const Ice::Current&) override; - virtual void unlink(const NetFS::ReqEnv &, const std::string & path, const Ice::Current&) override; + virtual void unlink(const NetFS::ReqEnv, const std::string path, const Ice::Current&) override; - virtual NetFS::FilePrx open(const NetFS::ReqEnv &, const std::string & path, Ice::Int flags, const Ice::Current&) override; - virtual NetFS::FilePrx create(const NetFS::ReqEnv &, const std::string & path, Ice::Int flags, Ice::Int mode, const Ice::Current&) override; + virtual NetFS::FilePrxPtr open(const NetFS::ReqEnv, const std::string path, Ice::Int flags, const Ice::Current&) override; + virtual NetFS::FilePrxPtr create(const NetFS::ReqEnv, const std::string path, Ice::Int flags, Ice::Int mode, const Ice::Current&) override; - virtual NetFS::VFS statfs(const NetFS::ReqEnv &, const std::string & path, const Ice::Current&) override; + virtual NetFS::VFS statfs(const NetFS::ReqEnv, const std::string path, const Ice::Current&) override; - virtual Ice::Int access(const NetFS::ReqEnv &, const std::string & path, Ice::Int mode, const Ice::Current&) override; - virtual NetFS::Attr getattr(const NetFS::ReqEnv &, const std::string & path, const Ice::Current&) override; - virtual void mknod(const NetFS::ReqEnv &, const std::string & path, Ice::Int mode, Ice::Int dev, const Ice::Current&) override; - virtual void symlink(const NetFS::ReqEnv &, const std::string & path1, const std::string & path2, const Ice::Current&) override; - virtual void link(const NetFS::ReqEnv &, const std::string & path1, const std::string & path2, const Ice::Current&) override; - virtual void rename(const NetFS::ReqEnv &, const std::string & path1, const std::string & path2, const Ice::Current&) override; - virtual std::string readlink(const NetFS::ReqEnv &, const std::string & path, const Ice::Current&) override; - virtual void chmod(const NetFS::ReqEnv &, const std::string & path, Ice::Int mode, const Ice::Current&) override; - virtual void chown(const NetFS::ReqEnv &, const std::string & path, Ice::Int uid, Ice::Int gid, const Ice::Current&) override; - virtual void utimens(const NetFS::ReqEnv &, const std::string & path, Ice::Long, Ice::Long, Ice::Long, Ice::Long, const Ice::Current&) override; + virtual Ice::Int access(const NetFS::ReqEnv, const std::string path, Ice::Int mode, const Ice::Current&) override; + virtual NetFS::Attr getattr(const NetFS::ReqEnv, const std::string path, const Ice::Current&) override; + virtual void mknod(const NetFS::ReqEnv, const std::string path, Ice::Int mode, Ice::Int dev, const Ice::Current&) override; + virtual void symlink(const NetFS::ReqEnv, const std::string path1, const std::string path2, const Ice::Current&) override; + virtual void link(const NetFS::ReqEnv, const std::string path1, const std::string path2, const Ice::Current&) override; + virtual void rename(const NetFS::ReqEnv, const std::string path1, const std::string path2, const Ice::Current&) override; + virtual std::string readlink(const NetFS::ReqEnv, const std::string path, const Ice::Current&) override; + virtual void chmod(const NetFS::ReqEnv, const std::string path, Ice::Int mode, const Ice::Current&) override; + virtual void chown(const NetFS::ReqEnv, const std::string path, Ice::Int uid, Ice::Int gid, const Ice::Current&) override; + virtual void utimens(const NetFS::ReqEnv, const std::string path, Ice::Long, Ice::Long, Ice::Long, Ice::Long, const Ice::Current&) override; virtual void disconnect(const Ice::Current&) override; diff --git a/mythfs/service/service.cpp b/mythfs/service/service.cpp index 8a2e77d..df7103d 100644 --- a/mythfs/service/service.cpp +++ b/mythfs/service/service.cpp @@ -1,13 +1,13 @@ #include "service.h" #include <Ice/ObjectAdapter.h> -#include <Ice/Communicator.h> +#include <Ice/Initialize.h> namespace MythFS { - ::NetFS::VolumePrx - Service::connect(const std::string & volume, const std::string &, const Ice::Current & ic) + ::NetFS::VolumePrxPtr + Service::connect(const std::string volume, const std::string, const Ice::Current & ic) { - return ::NetFS::VolumePrx::checkedCast( - ic.adapter->createProxy(ic.adapter->getCommunicator()->stringToIdentity(volume))); + return Ice::checkedCast<::NetFS::VolumePrx>( + ic.adapter->createProxy(Ice::stringToIdentity(volume))); } } diff --git a/mythfs/service/service.h b/mythfs/service/service.h index d021f2b..758cc9b 100644 --- a/mythfs/service/service.h +++ b/mythfs/service/service.h @@ -7,7 +7,7 @@ namespace MythFS { class Service : public ::NetFS::Service { public: - ::NetFS::VolumePrx connect(const std::string &, const ::std::string &, const Ice::Current &) override; + ::NetFS::VolumePrxPtr connect(const std::string, const ::std::string, const Ice::Current &) override; }; } diff --git a/mythfs/unittests/Jamfile.jam b/mythfs/unittests/Jamfile.jam index a76d1ec..033e2f8 100644 --- a/mythfs/unittests/Jamfile.jam +++ b/mythfs/unittests/Jamfile.jam @@ -21,23 +21,21 @@ lib testCommon : <library>..//boost_system <library>..//boost_filesystem <library>..//netfs-api - <library>..//IceUtil <library>..//Ice <library>..//IceBox <library>..//pthread <library>dryice - <library>../service//mythfs - <implicit-dependency>../service//mythfs + <library>../service//mythfs++11 + <implicit-dependency>../service//mythfs++11 : : <library>dryice <library>..//dbppcore <library>..//adhocutil - <library>..//IceUtil <library>..//Ice <library>..//IceBox <library>..//pthread - <library>../service//mythfs - <implicit-dependency>../service//mythfs + <library>../service//mythfs++11 + <implicit-dependency>../service//mythfs++11 ; run diff --git a/mythfs/unittests/mockDefs.cpp b/mythfs/unittests/mockDefs.cpp index d699f6e..9f30ca0 100644 --- a/mythfs/unittests/mockDefs.cpp +++ b/mythfs/unittests/mockDefs.cpp @@ -4,8 +4,7 @@ #include <dbimpl.h> Service::Service() : - MySQL::Mock("MythFS", { - //rootDir / "fixtures" / "schema.sql", + DB::PluginMock<MySQL::Mock>("options=p2testmysql", "MythFS", { rootDir / "fixtures" / "schema-min.sql", rootDir / "fixtures" / "data.sql" }) @@ -14,7 +13,7 @@ Service::Service() : TestClient::TestClient() : dbpool(getService()->getConnectionPool(getAdapter()->getCommunicator(), "mock", "MythFS")), - db(new MythFS::DBImpl(dbpool)), + db(std::make_shared<MythFS::DBImpl>(dbpool)), s(getProxy<NetFS::ServicePrx>("Service")) { } diff --git a/mythfs/unittests/mockDefs.h b/mythfs/unittests/mockDefs.h index f549e54..2b21522 100644 --- a/mythfs/unittests/mockDefs.h +++ b/mythfs/unittests/mockDefs.h @@ -8,7 +8,7 @@ #include <myth-db.h> #include <abstractDatabaseClient.h> -class DLL_PUBLIC Service : MySQL::Mock, public IceTray::DryIce { +class DLL_PUBLIC Service : DB::PluginMock<MySQL::Mock>, public IceTray::DryIce { public: Service(); }; @@ -17,9 +17,9 @@ class DLL_PUBLIC TestClient : public IceTray::DryIceClient { public: TestClient(); - IceTray::DatabasePoolPtr dbpool; + DB::ConnectionPoolPtr dbpool; MythFS::DBPtr db; - NetFS::ServicePrx s; + NetFS::ServicePrxPtr s; }; #endif diff --git a/mythfs/unittests/testMain.cpp b/mythfs/unittests/testMain.cpp index 61d68b5..36da42c 100644 --- a/mythfs/unittests/testMain.cpp +++ b/mythfs/unittests/testMain.cpp @@ -54,7 +54,7 @@ class RecordingsTest : public TestClient { protected: ::NetFS::ReqEnv re; - ::NetFS::VolumePrx rv; + ::NetFS::VolumePrxPtr rv; }; BOOST_FIXTURE_TEST_SUITE(rt, RecordingsTest) @@ -111,7 +111,7 @@ BOOST_AUTO_TEST_CASE( listRoot ) BOOST_REQUIRE_EQUAL("by date", ls[1]); BOOST_REQUIRE_EQUAL("by title", ls[2]); - auto d2 = NetFS::DirectoryV2Prx::uncheckedCast(d); + auto d2 = Ice::uncheckedCast<NetFS::DirectoryV2Prx>(d); auto ls2 = d2->listdir(); BOOST_REQUIRE_EQUAL(3, ls2.size()); BOOST_REQUIRE_EQUAL(defaultDirMode, ls2["all"].mode); |