diff --git a/CMakeLists.txt b/CMakeLists.txt index e8380d37cb3664135721258e380fc49dce1c484b..bb4af80dd79acad1ab2e9a76b2f522e8c99e3682 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,7 @@ add_subdirectory(cmdline) add_subdirectory(common) add_subdirectory(objectstore) add_subdirectory(nameserver) -add_subdirectory(remotestorage) +add_subdirectory(remotens) add_subdirectory(scheduler) add_subdirectory(tests) add_subdirectory(xroot_plugins) diff --git a/remotens/CMakeLists.txt b/remotens/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4d0ffc187026be4d91b187e08cf13da7e92c9d6 --- /dev/null +++ b/remotens/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required (VERSION 2.6) + +set (CTA_REMOTENS_SRC_FILES + EosNS.cpp + MockRemoteNS.cpp + RemoteNS.cpp) + +add_library (ctaremotens SHARED + ${CTA_REMOTENS_SRC_FILES}) + +add_library (ctaremotenstest SHARED + MockRemoteNS.cpp + MockRemoteNSFactory.cpp + RemoteNSFactory.cpp) + +target_link_libraries(ctaremotenstest + ctaremotens) diff --git a/remotestorage/EosRemoteStorage.cpp b/remotens/EosNS.cpp similarity index 84% rename from remotestorage/EosRemoteStorage.cpp rename to remotens/EosNS.cpp index 6de1a15a558d21aa53c0c139d87f4a38c82db31e..d2fc38fd11c6df5b5a7f5e6e6da49e602094435c 100644 --- a/remotestorage/EosRemoteStorage.cpp +++ b/remotens/EosNS.cpp @@ -17,18 +17,18 @@ */ #include "common/exception/Exception.hpp" -#include "remotestorage/EosRemoteStorage.hpp" +#include "remotens/EosNS.hpp" //------------------------------------------------------------------------------ // destructor //------------------------------------------------------------------------------ -cta::EosRemoteStorage::~EosRemoteStorage() throw() { +cta::EosNS::~EosNS() throw() { } //------------------------------------------------------------------------------ // regularFileExists //------------------------------------------------------------------------------ -bool cta::EosRemoteStorage::regularFileExists(const std::string &remoteFile) +bool cta::EosNS::regularFileExists(const std::string &remoteFile) const { throw exception::Exception(std::string(__FUNCTION__) + " not implemented"); } @@ -36,14 +36,14 @@ bool cta::EosRemoteStorage::regularFileExists(const std::string &remoteFile) //------------------------------------------------------------------------------ // dirExists //------------------------------------------------------------------------------ -bool cta::EosRemoteStorage::dirExists(const std::string &remoteFile) const { +bool cta::EosNS::dirExists(const std::string &remoteFile) const { throw exception::Exception(std::string(__FUNCTION__) + " not implemented"); } //------------------------------------------------------------------------------ // rename //------------------------------------------------------------------------------ -void cta::EosRemoteStorage::rename(const std::string &remoteFile, +void cta::EosNS::rename(const std::string &remoteFile, const std::string &newRemoteFile) { throw exception::Exception(std::string(__FUNCTION__) + " not implemented"); } diff --git a/remotestorage/EosRemoteStorage.hpp b/remotens/EosNS.hpp similarity index 88% rename from remotestorage/EosRemoteStorage.hpp rename to remotens/EosNS.hpp index b10ee5fc24519bb79688f4f9fd4ae036a8dcc3cc..9bd69af121aef17ecfbe57756868a41938573e10 100644 --- a/remotestorage/EosRemoteStorage.hpp +++ b/remotens/EosNS.hpp @@ -18,20 +18,20 @@ #pragma once -#include "remotestorage/RemoteStorage.hpp" +#include "remotens/RemoteNS.hpp" namespace cta { /** - * Proxy class for a remote EOS storage system. + * Proxy class for the namespace of the EOS storage system. */ -class EosRemoteStorage: public RemoteStorage { +class EosNS: public RemoteNS { public: /** * Destructor. */ - ~EosRemoteStorage() throw(); + ~EosNS() throw(); /** * Returns true if the specified regular file exists. @@ -58,6 +58,6 @@ public: void rename(const std::string &remoteFile, const std::string &newRemoteFile); -}; // class EosRemoteStorage +}; // class EosNS } // namespace cta diff --git a/remotestorage/MockRemoteStorage.cpp b/remotens/MockRemoteNS.cpp similarity index 84% rename from remotestorage/MockRemoteStorage.cpp rename to remotens/MockRemoteNS.cpp index 3c01b52e0483760ad9412fea94b06ccd6965ebf2..918838ebbac80dba2e78f0a98c6207126063c663 100644 --- a/remotestorage/MockRemoteStorage.cpp +++ b/remotens/MockRemoteNS.cpp @@ -17,18 +17,18 @@ */ #include "common/exception/Exception.hpp" -#include "remotestorage/MockRemoteStorage.hpp" +#include "remotens/MockRemoteNS.hpp" //------------------------------------------------------------------------------ // destructor //------------------------------------------------------------------------------ -cta::MockRemoteStorage::~MockRemoteStorage() throw() { +cta::MockRemoteNS::~MockRemoteNS() throw() { } //------------------------------------------------------------------------------ // regularFileExists //------------------------------------------------------------------------------ -bool cta::MockRemoteStorage::regularFileExists(const std::string &remoteFile) +bool cta::MockRemoteNS::regularFileExists(const std::string &remoteFile) const { throw exception::Exception(std::string(__FUNCTION__) + " not implemented"); } @@ -36,14 +36,14 @@ bool cta::MockRemoteStorage::regularFileExists(const std::string &remoteFile) //------------------------------------------------------------------------------ // dirExists //------------------------------------------------------------------------------ -bool cta::MockRemoteStorage::dirExists(const std::string &remoteFile) const { +bool cta::MockRemoteNS::dirExists(const std::string &remoteFile) const { throw exception::Exception(std::string(__FUNCTION__) + " not implemented"); } //------------------------------------------------------------------------------ // rename //------------------------------------------------------------------------------ -void cta::MockRemoteStorage::rename(const std::string &remoteFile, +void cta::MockRemoteNS::rename(const std::string &remoteFile, const std::string &newRemoteFile) { throw exception::Exception(std::string(__FUNCTION__) + " not implemented"); } diff --git a/remotestorage/MockRemoteStorage.hpp b/remotens/MockRemoteNS.hpp similarity index 88% rename from remotestorage/MockRemoteStorage.hpp rename to remotens/MockRemoteNS.hpp index 5894ce2209e06f4e46a198ff30cc0d6d8d02e3a9..63470a7d6e0c87b491bc49020860954d7a7a330d 100644 --- a/remotestorage/MockRemoteStorage.hpp +++ b/remotens/MockRemoteNS.hpp @@ -18,20 +18,20 @@ #pragma once -#include "remotestorage/RemoteStorage.hpp" +#include "remotens/RemoteNS.hpp" namespace cta { /** - * A mock proxy class for a remote storage system. + * A mock proxy class for the namespace of a remote storage system. */ -class MockRemoteStorage: public RemoteStorage { +class MockRemoteNS: public RemoteNS { public: /** * Destructor. */ - ~MockRemoteStorage() throw(); + ~MockRemoteNS() throw(); /** * Returns true if the specified regular file exists. @@ -58,6 +58,6 @@ public: void rename(const std::string &remoteFile, const std::string &newRemoteFile); -}; // class MockRemoteStorage +}; // class MockRemoteNS } // namespace cta diff --git a/remotestorage/MockRemoteStorageFactory.cpp b/remotens/MockRemoteNSFactory.cpp similarity index 77% rename from remotestorage/MockRemoteStorageFactory.cpp rename to remotens/MockRemoteNSFactory.cpp index 50188e9c546a8fc0bda4edd2f69879a8930d440a..916419930eca9a780c790a8caa8cfb8cf8829dfa 100644 --- a/remotestorage/MockRemoteStorageFactory.cpp +++ b/remotens/MockRemoteNSFactory.cpp @@ -16,18 +16,18 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "remotestorage/MockRemoteStorage.hpp" -#include "remotestorage/MockRemoteStorageFactory.hpp" +#include "remotens/MockRemoteNS.hpp" +#include "remotens/MockRemoteNSFactory.hpp" //------------------------------------------------------------------------------ // destructor //------------------------------------------------------------------------------ -cta::MockRemoteStorageFactory::~MockRemoteStorageFactory() throw() { +cta::MockRemoteNSFactory::~MockRemoteNSFactory() throw() { } //------------------------------------------------------------------------------ // create //------------------------------------------------------------------------------ -std::unique_ptr<cta::RemoteStorage> cta::MockRemoteStorageFactory::create() { - return std::unique_ptr<RemoteStorage>(new MockRemoteStorage()); +std::unique_ptr<cta::RemoteNS> cta::MockRemoteNSFactory::create() { + return std::unique_ptr<RemoteNS>(new MockRemoteNS()); } diff --git a/remotestorage/MockRemoteStorageFactory.hpp b/remotens/MockRemoteNSFactory.hpp similarity index 65% rename from remotestorage/MockRemoteStorageFactory.hpp rename to remotens/MockRemoteNSFactory.hpp index eb67587949c71317e29657405a2540ae95aa5caf..c27caefaff5579a561f0d8067ee5f016cf33a8ef 100644 --- a/remotestorage/MockRemoteStorageFactory.hpp +++ b/remotens/MockRemoteNSFactory.hpp @@ -18,29 +18,28 @@ #pragma once -#include "remotestorage/RemoteStorageFactory.hpp" +#include "remotens/RemoteNSFactory.hpp" namespace cta { /** - * Concrete implementation of a remote storage-system factory that creates mock - * objects. + * Factory for creating mock remote namespaces. */ -class MockRemoteStorageFactory: public RemoteStorageFactory { +class MockRemoteNSFactory: public RemoteNSFactory { public: /** * Destructor. */ - ~MockRemoteStorageFactory() throw(); + ~MockRemoteNSFactory() throw(); /** - * Returns a newly created remote storage-system object. + * Returns a newly created namespace object. * - * @return A newly created remote storage-system object. + * @return A newly created namespace object. */ - std::unique_ptr<RemoteStorage> create(); + std::unique_ptr<RemoteNS> create(); -}; // class MockRemoteStorageFactory +}; // class MockRemoteNSFactory } // namespace cta diff --git a/remotestorage/RemoteStorage.cpp b/remotens/RemoteNS.cpp similarity index 90% rename from remotestorage/RemoteStorage.cpp rename to remotens/RemoteNS.cpp index 8d1219ad0a38d38f469086f92d2d2baec672828a..f172f2d7e4621da760ea1617688f4ed8838abcd1 100644 --- a/remotestorage/RemoteStorage.cpp +++ b/remotens/RemoteNS.cpp @@ -16,10 +16,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "remotestorage/RemoteStorage.hpp" +#include "remotens/RemoteNS.hpp" //------------------------------------------------------------------------------ // destructor //------------------------------------------------------------------------------ -cta::RemoteStorage::~RemoteStorage() throw() { +cta::RemoteNS::~RemoteNS() throw() { } diff --git a/remotestorage/RemoteStorage.hpp b/remotens/RemoteNS.hpp similarity index 91% rename from remotestorage/RemoteStorage.hpp rename to remotens/RemoteNS.hpp index 26dba5d300f8fafc6331de34e8a9a6e8d161827f..f3f852eab090541efcb83cccec584a0c87272544 100644 --- a/remotestorage/RemoteStorage.hpp +++ b/remotens/RemoteNS.hpp @@ -23,15 +23,15 @@ namespace cta { /** - * Abstract class specifying the interface to a remote storage system. + * An Abstract proxy class specifying the interface to a remote storage system. */ -class RemoteStorage { +class RemoteNS { public: /** * Destructor. */ - virtual ~RemoteStorage() throw() = 0; + virtual ~RemoteNS() throw() = 0; /** * Returns true if the specified regular file exists. @@ -58,6 +58,6 @@ public: virtual void rename(const std::string &remoteFile, const std::string &newRemoteFile) = 0; -}; // class RemoteStorage +}; // class RemoteNS } // namespace cta diff --git a/remotestorage/RemoteStorageFactory.cpp b/remotens/RemoteNSFactory.cpp similarity index 89% rename from remotestorage/RemoteStorageFactory.cpp rename to remotens/RemoteNSFactory.cpp index 1e46ad096cca18970f910da309186d31c454d1b2..be1f05dd483fadeba0efe152f61215d3f3693a4b 100644 --- a/remotestorage/RemoteStorageFactory.cpp +++ b/remotens/RemoteNSFactory.cpp @@ -16,10 +16,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "remotestorage/RemoteStorageFactory.hpp" +#include "remotens/RemoteNSFactory.hpp" //------------------------------------------------------------------------------ // destructor //------------------------------------------------------------------------------ -cta::RemoteStorageFactory::~RemoteStorageFactory() throw() { +cta::RemoteNSFactory::~RemoteNSFactory() throw() { } diff --git a/remotestorage/RemoteStorageFactory.hpp b/remotens/RemoteNSFactory.hpp similarity index 74% rename from remotestorage/RemoteStorageFactory.hpp rename to remotens/RemoteNSFactory.hpp index 9c8ffa8c178848f15869ec0f8d323c507cb64292..26d89c164646224b76b8cbcf12e919a815a475ca 100644 --- a/remotestorage/RemoteStorageFactory.hpp +++ b/remotens/RemoteNSFactory.hpp @@ -23,27 +23,27 @@ namespace cta { // Forward declarations -class RemoteStorage; +class RemoteNS; /** - * Asbtract class specifying the interface to a factory of remote storage-system - * objects. + * Asbtract class specifying the interface to a factory of remote namespace + * proxies. */ -class RemoteStorageFactory { +class RemoteNSFactory { public: /** * Destructor. */ - virtual ~RemoteStorageFactory() throw() = 0; + virtual ~RemoteNSFactory() throw() = 0; /** - * Returns a newly created remote storage-system object. + * Returns a newly created namespace proxy. * - * @return A newly created remote storage-system object. + * @return A newly created namespace proxy. */ - virtual std::unique_ptr<RemoteStorage> create() = 0; + virtual std::unique_ptr<RemoteNS> create() = 0; -}; // class RemoteStorageFactory +}; // class RemoteNSFactory } // namespace cta diff --git a/remotestorage/CMakeLists.txt b/remotestorage/CMakeLists.txt deleted file mode 100644 index 2d54ae3970058245f3d26abf8fd7574a79c5a248..0000000000000000000000000000000000000000 --- a/remotestorage/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required (VERSION 2.6) - -set (CTA_REMOTE_STORAGE_SRC_FILES - MockRemoteStorage.cpp - EosRemoteStorage.cpp - RemoteStorage.cpp) - -add_library (ctaremotestorage SHARED - ${CTA_REMOTE_STORAGE_SRC_FILES}) - -add_library (ctaremotestoragetest SHARED - MockRemoteStorage.cpp - MockRemoteStorageFactory.cpp - RemoteStorageFactory.cpp) - -target_link_libraries(ctaremotestoragetest - ctaremotestorage) diff --git a/scheduler/Scheduler.cpp b/scheduler/Scheduler.cpp index f2fc489cb35317b8504dfc39f474ae74ac837b18..76511524f8b89ec7e76e7648353833af5becc78d 100644 --- a/scheduler/Scheduler.cpp +++ b/scheduler/Scheduler.cpp @@ -19,6 +19,7 @@ #include "common/exception/Exception.hpp" #include "common/Utils.hpp" #include "nameserver/NameServer.hpp" +#include "remotens/RemoteNS.hpp" #include "scheduler/AdminHost.hpp" #include "scheduler/AdminUser.hpp" #include "scheduler/ArchivalRoute.hpp" @@ -44,10 +45,10 @@ //------------------------------------------------------------------------------ cta::Scheduler::Scheduler(NameServer &ns, SchedulerDatabase &db, - RemoteStorage &remoteStorage): + RemoteNS &remoteNS): m_ns(ns), m_db(db), - m_remoteStorage(remoteStorage) { + m_remoteNS(remoteNS) { } //------------------------------------------------------------------------------ @@ -617,6 +618,12 @@ void cta::Scheduler::queueRetrieveRequest( const SecurityIdentity &requester, const std::list<std::string> &archiveFiles, const std::string &remoteFileOrDir) { + + const bool retreiveToDir = m_remoteNS.dirExists(remoteFileOrDir); + if(retreiveToDir) { + // Else retrieve to a single file + } else { + } /* const bool retreiveToDir = m_ns.dirExists(requester, archiveFileOrDir); if(archiveToDir) { diff --git a/scheduler/Scheduler.hpp b/scheduler/Scheduler.hpp index e29b2d6b8bcbe7327280a90e0c3841606f789ba8..69ee73940575f37ece82a3d632d4148378ae8b01 100644 --- a/scheduler/Scheduler.hpp +++ b/scheduler/Scheduler.hpp @@ -36,7 +36,7 @@ class DirEntry; class DirIterator; class LogicalLibrary; class NameServer; -class RemoteStorage; +class RemoteNS; class RetrieveFromTapeCopyRequest; class RetrieveToDirRequest; class RetrieveToFileRequest; @@ -58,12 +58,12 @@ public: * * @param ns The name server containing the namespace of the archive. * @param db The scheduler database. - * @param remoteStorage The remote storage system. + * @param remoteNS The name space of the remote storage system. */ Scheduler( NameServer &ns, SchedulerDatabase &db, - RemoteStorage &remoteStorage); + RemoteNS &remoteNS); /** * Destructor. @@ -591,9 +591,9 @@ private: SchedulerDatabase &m_db; /** - * The remote storage system. + * The name space of the remote storage system. */ - RemoteStorage &m_remoteStorage; + RemoteNS &m_remoteNS; /** * Queues the specified request to archive one or more remote files to an diff --git a/scheduler/SchedulerTest.cpp b/scheduler/SchedulerTest.cpp index 0269432d7b703bd5905af4cec2dfabc968eeda11..6526c1c8e54eb556680e732de9f88b5d19344d75 100644 --- a/scheduler/SchedulerTest.cpp +++ b/scheduler/SchedulerTest.cpp @@ -18,9 +18,9 @@ #include "nameserver/MockNameServerFactory.hpp" #include "nameserver/NameServer.hpp" -#include "remotestorage/MockRemoteStorageFactory.hpp" -#include "remotestorage/RemoteStorage.hpp" -#include "remotestorage/RemoteStorageFactory.hpp" +#include "remotens/MockRemoteNSFactory.hpp" +#include "remotens/RemoteNS.hpp" +#include "remotens/RemoteNSFactory.hpp" #include "scheduler/AdminUser.hpp" #include "scheduler/AdminHost.hpp" #include "scheduler/ArchivalRoute.hpp" @@ -49,12 +49,12 @@ namespace unitTests { struct SchedulerTestParam { cta::NameServerFactory &nsFactory; cta::SchedulerDatabaseFactory &dbFactory; - cta::RemoteStorageFactory &remoteStorageFactory; + cta::RemoteNSFactory &remoteStorageFactory; SchedulerTestParam( cta::NameServerFactory &nsFactory, cta::SchedulerDatabaseFactory &dbFactory, - cta::RemoteStorageFactory &remoteStorageFactory): + cta::RemoteNSFactory &remoteStorageFactory): nsFactory(nsFactory), dbFactory(dbFactory), remoteStorageFactory(remoteStorageFactory) { @@ -136,7 +136,7 @@ private: std::unique_ptr<cta::NameServer> m_ns; std::unique_ptr<cta::SchedulerDatabase> m_db; - std::unique_ptr<cta::RemoteStorage> m_remoteStorage; + std::unique_ptr<cta::RemoteNS> m_remoteStorage; std::unique_ptr<cta::Scheduler> m_scheduler; }; // class SchedulerTest @@ -2124,15 +2124,129 @@ TEST_P(SchedulerTest, ASSERT_THROW(scheduler.queueArchiveRequest(s_adminOnAdminHost, remoteFiles, archiveFile), std::exception); } +/* +TEST_P(SchedulerTest, archive_and_retrieve_new_file) { + using namespace cta; + + Scheduler &scheduler = getScheduler(); + + const std::string storageClassName = "TestStorageClass"; + const uint16_t nbCopies = 1; + const std::string storageClassComment = "Storage-class comment"; + ASSERT_NO_THROW(scheduler.createStorageClass(s_adminOnAdminHost, storageClassName, + nbCopies, storageClassComment)); + + const std::string dirPath = "/grandparent"; + const uint16_t mode = 0777; + ASSERT_NO_THROW(scheduler.createDir(s_adminOnAdminHost, dirPath, mode)); + ASSERT_NO_THROW(scheduler.setDirStorageClass(s_adminOnAdminHost, dirPath, + storageClassName)); + + const std::string tapePoolName = "TestTapePool"; + const uint16_t nbPartialTapes = 1; + const std::string tapePoolComment = "Tape-pool comment"; + ASSERT_NO_THROW(scheduler.createTapePool(s_adminOnAdminHost, tapePoolName, + nbPartialTapes, tapePoolComment)); + + const uint16_t copyNb = 1; + const std::string archivalRouteComment = "Archival-route comment"; + ASSERT_NO_THROW(scheduler.createArchivalRoute(s_adminOnAdminHost, storageClassName, + copyNb, tapePoolName, archivalRouteComment)); + + std::list<std::string> remoteFiles; + remoteFiles.push_back("remoteFile"); + const std::string archiveFile = "/grandparent/parent_file"; + ASSERT_NO_THROW(scheduler.queueArchiveRequest(s_adminOnAdminHost, remoteFiles, archiveFile)); + + { + DirIterator itor; + ASSERT_NO_THROW(itor = scheduler.getDirContents(s_adminOnAdminHost, "/")); + ASSERT_TRUE(itor.hasMore()); + DirEntry entry; + ASSERT_NO_THROW(entry = itor.next()); + ASSERT_EQ(std::string("grandparent"), entry.getName()); + ASSERT_EQ(DirEntry::ENTRYTYPE_DIRECTORY, entry.getType()); + ASSERT_EQ(storageClassName, entry.getStorageClassName()); + } + + { + DirIterator itor; + ASSERT_NO_THROW(itor = scheduler.getDirContents(s_adminOnAdminHost, + "/grandparent")); + ASSERT_TRUE(itor.hasMore()); + DirEntry entry; + ASSERT_NO_THROW(entry = itor.next()); + ASSERT_EQ(std::string("parent_file"), entry.getName()); + ASSERT_EQ(DirEntry::ENTRYTYPE_FILE, entry.getType()); + ASSERT_EQ(storageClassName, entry.getStorageClassName()); + } + + { + DirEntry entry; + ASSERT_NO_THROW(entry = scheduler.statDirEntry(s_adminOnAdminHost, + archiveFile)); + ASSERT_EQ(DirEntry::ENTRYTYPE_FILE, entry.getType()); + ASSERT_EQ(storageClassName, entry.getStorageClassName()); + } + + { + const auto rqsts = scheduler.getArchiveRequests(s_adminOnAdminHost); + ASSERT_EQ(1, rqsts.size()); + auto poolItor = rqsts.cbegin(); + ASSERT_FALSE(poolItor == rqsts.cend()); + const TapePool &pool = poolItor->first; + ASSERT_TRUE(tapePoolName == pool.getName()); + auto poolRqsts = poolItor->second; + ASSERT_EQ(1, poolRqsts.size()); + std::set<std::string> remoteFiles; + std::set<std::string> archiveFiles; + for(auto jobItor = poolRqsts.cbegin(); + jobItor != poolRqsts.cend(); jobItor++) { + remoteFiles.insert(jobItor->getRemoteFile()); + archiveFiles.insert(jobItor->getArchiveFile()); + } + ASSERT_EQ(1, remoteFiles.size()); + ASSERT_FALSE(remoteFiles.find("remoteFile") == remoteFiles.end()); + ASSERT_EQ(1, archiveFiles.size()); + ASSERT_FALSE(archiveFiles.find("/grandparent/parent_file") == + archiveFiles.end()); + } + + { + const auto poolRqsts = scheduler.getArchiveRequests(s_adminOnAdminHost, + tapePoolName); + ASSERT_EQ(1, poolRqsts.size()); + std::set<std::string> remoteFiles; + std::set<std::string> archiveFiles; + for(auto jobItor = poolRqsts.cbegin(); jobItor != poolRqsts.cend(); + jobItor++) { + remoteFiles.insert(jobItor->getRemoteFile()); + archiveFiles.insert(jobItor->getArchiveFile()); + } + ASSERT_EQ(1, remoteFiles.size()); + ASSERT_FALSE(remoteFiles.find("remoteFile") == remoteFiles.end()); + ASSERT_EQ(1, archiveFiles.size()); + ASSERT_FALSE(archiveFiles.find("/grandparent/parent_file") == archiveFiles.end()); + } + + { + std::list<std::string> archiveFiles; + archiveFiles.push_back("/grandparent/parent_file"); + ASSERT_NO_THROW(scheduler.queueRetrieveRequest(s_adminOnAdminHost, + archiveFiles, "remoteFile")); + } +} +*/ + static cta::MockNameServerFactory mockNsFactory; static cta::MockSchedulerDatabaseFactory mockDbFactory; -static cta::MockRemoteStorageFactory mockRemoteStorageFactory; +static cta::MockRemoteNSFactory mockRemoteNSFactory; INSTANTIATE_TEST_CASE_P(MockSchedulerTest, SchedulerTest, - ::testing::Values(SchedulerTestParam(mockNsFactory, mockDbFactory, mockRemoteStorageFactory))); + ::testing::Values(SchedulerTestParam(mockNsFactory, mockDbFactory, mockRemoteNSFactory))); static cta::OStoreDBFactory<cta::objectstore::BackendVFS> OStoreDBFactory; INSTANTIATE_TEST_CASE_P(OStoreDBPlusMockSchedulerTest, SchedulerTest, - ::testing::Values(SchedulerTestParam(mockNsFactory, OStoreDBFactory, mockRemoteStorageFactory))); + ::testing::Values(SchedulerTestParam(mockNsFactory, OStoreDBFactory, mockRemoteNSFactory))); } // namespace unitTests diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0cf25d89216508f96dedb0140773264d31d80ed3..fc7599ecabfff299f334d9d70d26ae15386c6309 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -13,7 +13,7 @@ target_link_libraries(unittests CTAObjectStore ctaobjectstoreunittests ctanameservertest - ctaremotestoragetest + ctaremotenstest ctaschedulertest gmock gtest diff --git a/xroot_plugins/CMakeLists.txt b/xroot_plugins/CMakeLists.txt index 73a73df1e76c0d7285fb8d08973bed7e37168d5c..a1c1623fede51e30dcbaf7a4b6922ffb885e0b0a 100644 --- a/xroot_plugins/CMakeLists.txt +++ b/xroot_plugins/CMakeLists.txt @@ -6,4 +6,4 @@ include_directories (${CMAKE_SOURCE_DIR}) include_directories (${XROOTD_INCLUDE_DIR} ${XROOTD_PRIVATE_INCLUDE_DIR}) add_library (XrdProFst MODULE XrdProFilesystem.cpp XrdProFile.cpp XrdProDir.cpp ParsedRequest.cpp) -target_link_libraries (XrdProFst ctascheduler ctacommon ctanameserver ctaremotestorage) +target_link_libraries (XrdProFst ctascheduler ctacommon ctanameserver ctaremotens) diff --git a/xroot_plugins/XrdProFilesystem.cpp b/xroot_plugins/XrdProFilesystem.cpp index 2cebcb23ac5ace91ca51d5306399baab701be780..e402ab8b73ce49827320c3fb4e3d40c2af42e22c 100644 --- a/xroot_plugins/XrdProFilesystem.cpp +++ b/xroot_plugins/XrdProFilesystem.cpp @@ -19,7 +19,7 @@ #include "common/exception/Exception.hpp" #include "nameserver/MockNameServer.hpp" #include "nameserver/NameServer.hpp" -#include "remotestorage/MockRemoteStorage.hpp" +#include "remotens/MockRemoteNS.hpp" #include "scheduler/AdminHost.hpp" #include "scheduler/AdminUser.hpp" #include "scheduler/ArchivalRoute.hpp" @@ -53,7 +53,7 @@ extern "C" return new XrdProFilesystem( new cta::MockNameServer(), new cta::MockSchedulerDatabase(), - new cta::MockRemoteStorage()); + new cta::MockRemoteNS()); } } @@ -1640,7 +1640,7 @@ void XrdProFilesystem::EnvInfo(XrdOucEnv *envP) XrdProFilesystem::XrdProFilesystem( cta::NameServer *ns, cta::SchedulerDatabase *scheddb, - cta::RemoteStorage *remoteStorage): + cta::RemoteNS *remoteStorage): m_ns(ns), m_scheddb(scheddb), m_remoteStorage(remoteStorage), diff --git a/xroot_plugins/XrdProFilesystem.hpp b/xroot_plugins/XrdProFilesystem.hpp index 944d3a85be13fe9be2f02504e55f67c87fe6f87d..4f52e9d37c6cf53d6f61a512eaa3773a9bd97459 100644 --- a/xroot_plugins/XrdProFilesystem.hpp +++ b/xroot_plugins/XrdProFilesystem.hpp @@ -19,7 +19,7 @@ #pragma once #include "nameserver/MockNameServer.hpp" -#include "remotestorage/RemoteStorage.hpp" +#include "remotens/RemoteNS.hpp" #include "scheduler/Scheduler.hpp" #include "XrdSfs/XrdSfsInterface.hh" @@ -47,7 +47,7 @@ public: virtual int stat(const char *Name, struct stat *buf, XrdOucErrInfo &eInfo, const XrdSecEntity *client = 0,const char *opaque = 0); virtual int stat(const char *path, mode_t &mode, XrdOucErrInfo &eInfo, const XrdSecEntity *client = 0, const char *opaque = 0); virtual int truncate(const char *path, XrdSfsFileOffset fsize, XrdOucErrInfo &eInfo, const XrdSecEntity *client = 0, const char *opaque = 0); - XrdProFilesystem(cta::NameServer *ns, cta::SchedulerDatabase *scheddb, cta::RemoteStorage *remoteStorage); + XrdProFilesystem(cta::NameServer *ns, cta::SchedulerDatabase *scheddb, cta::RemoteNS *remoteStorage); ~XrdProFilesystem(); protected: @@ -56,7 +56,7 @@ protected: cta::SchedulerDatabase *m_scheddb; - cta::RemoteStorage *m_remoteStorage; + cta::RemoteNS *m_remoteStorage; /** * The scheduler.