From 6dc65494b6eeffee43cc4b2b2738f5a1c78c9625 Mon Sep 17 00:00:00 2001
From: Steven Murray <Steven.Murray@cern.ch>
Date: Fri, 12 Jun 2015 16:12:48 +0200
Subject: [PATCH] Renamed RemoteStorage to RemoteNS

---
 CMakeLists.txt                                |   2 +-
 remotens/CMakeLists.txt                       |  17 +++
 .../EosNS.cpp                                 |  10 +-
 .../EosNS.hpp                                 |  10 +-
 .../MockRemoteNS.cpp                          |  10 +-
 .../MockRemoteNS.hpp                          |  10 +-
 .../MockRemoteNSFactory.cpp                   |  10 +-
 .../MockRemoteNSFactory.hpp                   |  17 ++-
 .../RemoteNS.cpp                              |   4 +-
 .../RemoteNS.hpp                              |   8 +-
 .../RemoteNSFactory.cpp                       |   4 +-
 .../RemoteNSFactory.hpp                       |  18 +--
 remotestorage/CMakeLists.txt                  |  17 ---
 scheduler/Scheduler.cpp                       |  11 +-
 scheduler/Scheduler.hpp                       |  10 +-
 scheduler/SchedulerTest.cpp                   | 132 ++++++++++++++++--
 tests/CMakeLists.txt                          |   2 +-
 xroot_plugins/CMakeLists.txt                  |   2 +-
 xroot_plugins/XrdProFilesystem.cpp            |   6 +-
 xroot_plugins/XrdProFilesystem.hpp            |   6 +-
 20 files changed, 213 insertions(+), 93 deletions(-)
 create mode 100644 remotens/CMakeLists.txt
 rename remotestorage/EosRemoteStorage.cpp => remotens/EosNS.cpp (84%)
 rename remotestorage/EosRemoteStorage.hpp => remotens/EosNS.hpp (88%)
 rename remotestorage/MockRemoteStorage.cpp => remotens/MockRemoteNS.cpp (84%)
 rename remotestorage/MockRemoteStorage.hpp => remotens/MockRemoteNS.hpp (88%)
 rename remotestorage/MockRemoteStorageFactory.cpp => remotens/MockRemoteNSFactory.cpp (77%)
 rename remotestorage/MockRemoteStorageFactory.hpp => remotens/MockRemoteNSFactory.hpp (65%)
 rename remotestorage/RemoteStorage.cpp => remotens/RemoteNS.cpp (90%)
 rename remotestorage/RemoteStorage.hpp => remotens/RemoteNS.hpp (91%)
 rename remotestorage/RemoteStorageFactory.cpp => remotens/RemoteNSFactory.cpp (89%)
 rename remotestorage/RemoteStorageFactory.hpp => remotens/RemoteNSFactory.hpp (74%)
 delete mode 100644 remotestorage/CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e8380d37cb..bb4af80dd7 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 0000000000..c4d0ffc187
--- /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 6de1a15a55..d2fc38fd11 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 b10ee5fc24..9bd69af121 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 3c01b52e04..918838ebba 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 5894ce2209..63470a7d6e 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 50188e9c54..916419930e 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 eb67587949..c27caefaff 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 8d1219ad0a..f172f2d7e4 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 26dba5d300..f3f852eab0 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 1e46ad096c..be1f05dd48 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 9c8ffa8c17..26d89c1646 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 2d54ae3970..0000000000
--- 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 f2fc489cb3..76511524f8 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 e29b2d6b8b..69ee739405 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 0269432d7b..6526c1c8e5 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 0cf25d8921..fc7599ecab 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 73a73df1e7..a1c1623fed 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 2cebcb23ac..e402ab8b73 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 944d3a85be..4f52e9d37c 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.
-- 
GitLab