diff --git a/objectstore/ArchiveQueue.cpp b/objectstore/ArchiveQueue.cpp
index d8ee5d9ff6ebd78e6860a03fc1fb4bf4cd609db7..69af9851051c3a26eae20e1baea4a69ce50e1017 100644
--- a/objectstore/ArchiveQueue.cpp
+++ b/objectstore/ArchiveQueue.cpp
@@ -21,6 +21,7 @@
 #include "ProtocolBuffersAlgorithms.hpp"
 #include "EntryLog.hpp"
 #include "RootEntry.hpp"
+#include "ValueCountMap.hpp"
 #include <json-c/json.h>
 
 namespace cta { namespace objectstore { 
@@ -153,9 +154,15 @@ std::string ArchiveQueue::getName() {
 
 void ArchiveQueue::addJob(const ArchiveRequest::JobDump& job,
   const std::string & archiveToFileAddress, uint64_t fileid,
-  uint64_t size, uint64_t priority, time_t startTime) {
+  uint64_t size, const cta::common::dataStructures::MountPolicy & policy, time_t startTime) {
   checkPayloadWritable();
-  // The tape pool gets the highest priority of its jobs
+  // Keep track of the mounting criteria
+  ValueCountMap maxDriveAllowedMap(m_payload.mutable_maxdrivesallowedmap());
+  maxDriveAllowedMap.incCount(policy.maxDrivesAllowed);
+  ValueCountMap priorityMap(m_payload.mutable_prioritymap());
+  priorityMap.incCount(policy.archivePriority);
+  ValueCountMap minArchiveRequestAgeMap(m_payload.mutable_minarchiverequestagemap());
+  minArchiveRequestAgeMap.incCount(policy.archiveMinRequestAge);
   if (m_payload.pendingarchivejobs_size()) {
     if ((uint64_t)startTime < m_payload.oldestjobcreationtime())
       m_payload.set_oldestjobcreationtime(startTime);
@@ -177,6 +184,18 @@ auto ArchiveQueue::getJobsSummary() -> JobsSummary {
   ret.files = m_payload.pendingarchivejobs_size();
   ret.bytes = m_payload.archivejobstotalsize();
   ret.oldestJobStartTime = m_payload.oldestjobcreationtime();
+  if (ret.files) {
+    ValueCountMap maxDriveAllowedMap(m_payload.mutable_maxdrivesallowedmap());
+    ret.maxDrivesAllowed = maxDriveAllowedMap.maxValue();
+    ValueCountMap priorityMap(m_payload.mutable_prioritymap());
+    ret.priority = priorityMap.maxValue();
+    ValueCountMap minArchiveRequestAgeMap(m_payload.mutable_minarchiverequestagemap());
+    ret.minArchiveRequestAge = minArchiveRequestAgeMap.minValue();
+  } else {
+    ret.maxDrivesAllowed = 0;
+    ret.priority = 0;
+    ret.minArchiveRequestAge = 0;
+  }
   return ret;
 }
 
@@ -221,7 +240,7 @@ void ArchiveQueue::removeJob(const std::string& archiveToFileAddress) {
   } while (found);
 }
 
-auto ArchiveQueue::dumpJobs() -> std::list<JobDump> {
+auto ArchiveQueue::dumpJobs() -> std::list<ArchiveQueue::JobDump> {
   checkPayloadReadable();
   std::list<JobDump> ret;
   auto & jl=m_payload.pendingarchivejobs();
@@ -270,8 +289,4 @@ bool ArchiveQueue::addOrphanedJobPendingNsDeletion(
   return true;
 }
 
-cta::common::dataStructures::MountPolicy ArchiveQueue::getMountPolicy() {
-  throw cta::exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__);
-}
-
 }} // namespace cta::objectstore
diff --git a/objectstore/ArchiveQueue.hpp b/objectstore/ArchiveQueue.hpp
index e5d42a40d1e208eb0606a623fbc3c4cac4c29d21..d8656d059c7a9b0dee2fac7289d7b2c2c8eadc40 100644
--- a/objectstore/ArchiveQueue.hpp
+++ b/objectstore/ArchiveQueue.hpp
@@ -52,7 +52,7 @@ public:
   // Archive jobs management ===================================================  
   void addJob(const ArchiveRequest::JobDump & job,
     const std::string & archiveToFileAddress, uint64_t fileid,
-    uint64_t size, uint64_t priority, time_t startTime);
+    uint64_t size, const cta::common::dataStructures::MountPolicy & priority, time_t startTime);
   /// This version will check for existence of the job in the queue before
   // returns true if a new job was actually inserted.
   bool addJobIfNecessary(const ArchiveRequest::JobDump & job,
@@ -74,6 +74,8 @@ public:
     uint64_t bytes;
     time_t oldestJobStartTime;
     uint64_t priority;
+    uint64_t minArchiveRequestAge;
+    uint64_t maxDrivesAllowed;
   };
   JobsSummary getJobsSummary();
   
@@ -86,10 +88,6 @@ public:
   };
   std::list<JobDump> dumpJobs();
   
-  // Mount criteria jobs management ============================================
-  void setMountPolicy(const common::dataStructures::MountPolicy& mountPolicy);
-  common::dataStructures::MountPolicy getMountPolicy();
-  
   // Check that the tape pool is empty (of both tapes and jobs)
   bool isEmpty();
  
diff --git a/objectstore/ArchiveRequest.cpp b/objectstore/ArchiveRequest.cpp
index c5c0a5b14ca932c309f26ced4532a96dac5a460c..68322f11d608d6b274b7b5b7a578106e0ce778f8 100644
--- a/objectstore/ArchiveRequest.cpp
+++ b/objectstore/ArchiveRequest.cpp
@@ -233,6 +233,7 @@ uint64_t cta::objectstore::ArchiveRequest::getDiskpoolThroughput() {
 void cta::objectstore::ArchiveRequest::setMountPolicy(const cta::common::dataStructures::MountPolicy &mountPolicy) {
   checkPayloadWritable();
   auto payloadMountPolicy = m_payload.mutable_mountpolicy();
+  payloadMountPolicy->set_name(mountPolicy.name);
   payloadMountPolicy->set_maxdrives(mountPolicy.maxDrivesAllowed);
   payloadMountPolicy->set_minrequestage(mountPolicy.archiveMinRequestAge);
   payloadMountPolicy->set_priority(mountPolicy.archivePriority);
@@ -404,7 +405,7 @@ cta::common::dataStructures::EntryLog ArchiveRequest::getCreationLog() {
   return creationLog;  
 }
 
-auto ArchiveRequest::dumpJobs() -> std::list<JobDump> {
+auto ArchiveRequest::dumpJobs() -> std::list<ArchiveRequest::JobDump> {
   checkPayloadReadable();
   std::list<JobDump> ret;
   auto & jl = m_payload.jobs();
diff --git a/objectstore/CMakeLists.txt b/objectstore/CMakeLists.txt
index b80b95f566fcb873ae363a7b6d70e963f185675e..8bbe2c2d77abe074b69ec8f8c4810e9a488a6054 100644
--- a/objectstore/CMakeLists.txt
+++ b/objectstore/CMakeLists.txt
@@ -42,7 +42,8 @@ set (CTAProtoDependants objectstore/Agent.hpp
   objectstore/SchedulerGlobalLock.hpp
   objectstore/TapeQueue.hpp
   objectstore/ArchiveQueue.hpp
-  objectstore/UserIdentity.hpp)
+  objectstore/UserIdentity.hpp
+  objectstore/ValueCountMap.hpp)
 
 SET_SOURCE_FILES_PROPERTIES(${CTAProtoHeaders} PROPERTIES HEADER_FILE_ONLY TRUE)
 SET_SOURCE_FILES_PROPERTIES(${CTAProtoDependants} 
@@ -69,7 +70,8 @@ add_library (ctaobjectstore SHARED
   ProtocolBuffersAlgorithms.cpp
   GenericObject.cpp
   GarbageCollector.cpp
-  SchedulerGlobalLock.cpp)
+  SchedulerGlobalLock.cpp
+  ValueCountMap.cpp)
 target_link_libraries(ctaobjectstore Utils rados json-c ctautils)
 set_source_files_properties(BackendRados.cpp PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations)
 install (TARGETS ctaobjectstore DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
diff --git a/objectstore/GarbageCollectorTest.cpp b/objectstore/GarbageCollectorTest.cpp
index 2e65d33a38ae1568a03ed31cb807fb7f817bd908..f01b921d7f3173a795a3a1e1c00e13daef2deaa8 100644
--- a/objectstore/GarbageCollectorTest.cpp
+++ b/objectstore/GarbageCollectorTest.cpp
@@ -347,7 +347,11 @@ TEST(ObjectStore, GarbageCollectorArchiveRequest) {
       jd.copyNb = 1;
       jd.tapePool = "TapePool0";
       jd.ArchiveQueueAddress = tpAddr[0];
-      aq.addJob(jd, ar.getAddressIfSet(), ar.getArchiveFileID(), 1000+pass, 0, time(NULL));
+      cta::common::dataStructures::MountPolicy policy;
+      policy.archiveMinRequestAge = 0;
+      policy.archivePriority = 1;
+      policy.maxDrivesAllowed = 1;
+      aq.addJob(jd, ar.getAddressIfSet(), ar.getArchiveFileID(), 1000+pass, policy, time(NULL));
       aq.commit();
     }
     if (pass < 4) { pass++; continue; }
@@ -361,7 +365,11 @@ TEST(ObjectStore, GarbageCollectorArchiveRequest) {
       jd.copyNb = 2;
       jd.tapePool = "TapePool1";
       jd.ArchiveQueueAddress = tpAddr[1];
-      aq.addJob(jd, ar.getAddressIfSet(), ar.getArchiveFileID(), 1000+pass, 0, time(NULL));
+      cta::common::dataStructures::MountPolicy policy;
+      policy.archiveMinRequestAge = 0;
+      policy.archivePriority = 1;
+      policy.maxDrivesAllowed = 1;
+      aq.addJob(jd, ar.getAddressIfSet(), ar.getArchiveFileID(), 1000+pass, policy, time(NULL));
       aq.commit();
     }
     if (pass < 5) { pass++; continue; }
diff --git a/objectstore/ValueCountMap.cpp b/objectstore/ValueCountMap.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..0d8974aead6cc0c1260bb591344a85caa58c96a4
--- /dev/null
+++ b/objectstore/ValueCountMap.cpp
@@ -0,0 +1,124 @@
+/*
+ * The CERN Tape Archive (CTA) project
+ * Copyright (C) 2015  CERN
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ValueCountMap.hpp"
+#include "common/exception/Exception.hpp"
+
+namespace cta { namespace objectstore {
+
+ValueCountMap::ValueCountMap(google::protobuf::RepeatedPtrField<serializers::ValueCountPair>* valueCountMap): 
+  m_valueCountMap(*valueCountMap) { }
+
+void ValueCountMap::decCount(uint64_t value) {
+  // Find the entry for this value. Failing is an error.
+  auto counter = std::find_if(m_valueCountMap.begin(), m_valueCountMap.end(),
+      [&](decltype(*m_valueCountMap.begin()) pair) {
+        return pair.value() == value;
+      });
+  if (counter == m_valueCountMap.end()) {
+    std::stringstream err;
+    err << "In ValueCountMap::decCount: no entry found for value=" << value;
+    throw  cta::exception::Exception(err.str());
+  }
+  // Decrement the value and remove the entry if needed.
+  if (counter->count() < 1) {
+    std::stringstream err;
+    err << "In ValueCountMap::decCount: entry with wrong count value=" << value << " count=" << counter->count();
+    throw  cta::exception::Exception(err.str());
+  }
+  counter->set_count(counter->count()-1);
+  if (!counter->count()) {
+    auto size=m_valueCountMap.size();
+    counter->Swap(&(*(m_valueCountMap.end()-1)));
+    m_valueCountMap.RemoveLast();
+    // Cross check that the size has decreased.
+    if (size -1 != m_valueCountMap.size()) {
+      std::stringstream err;
+      err << "In ValueCountMap::decCount: unexpected size after trimming empty entry. expectedSize=" << size -1 << " newSize=" << m_valueCountMap.size();
+      throw  cta::exception::Exception(err.str());
+    }
+    // Cross check we cannot find the value.
+    auto counter2 = std::find_if(m_valueCountMap.begin(), m_valueCountMap.end(), 
+          [&](decltype(*m_valueCountMap.begin()) pair) { return pair.value() == value; });
+    if (m_valueCountMap.end() != counter2) {
+      std::stringstream err;
+      err << "In ValueCountMap::decCount: still found the value after trimming empty entry. value=" << counter2->value() << " count=" << counter2->count();
+      throw  cta::exception::Exception(err.str());
+    }
+  }
+}
+
+void ValueCountMap::incCount(uint64_t value) {
+  // Find the entry for this value (might fail)
+  auto counter = std::find_if(m_valueCountMap.begin(), m_valueCountMap.end(),
+      [&](decltype(*m_valueCountMap.begin()) pair) {
+        return pair.value() == value; 
+      });
+  if (counter != m_valueCountMap.end()) {
+    if (counter->count() < 1) {
+      std::stringstream err;
+      err << "In ValueCountMap::incCount: unexpected count value=" << counter->value() << " count=" << counter->count();
+      throw  cta::exception::Exception(err.str());
+    } else {
+      counter->set_value(counter->value()+1);
+    }
+  } else {
+    // Create the new entry if necessary.
+    auto newCounter = m_valueCountMap.Add();
+    newCounter->set_value(value);
+    newCounter->set_count(1);
+  }
+}
+
+uint64_t ValueCountMap::maxValue() {
+  if (!m_valueCountMap.size()) throw  cta::exception::Exception("In ValueCountMap::maxValue: empty map");
+  uint64_t ret = std::numeric_limits<uint64_t>::min();
+  std::for_each(m_valueCountMap.begin(), m_valueCountMap.end(),
+      [&](decltype(*m_valueCountMap.begin()) pair) {
+        if (ret<pair.value()) ret=pair.value();
+      });
+  return ret;
+}
+
+uint64_t ValueCountMap::minValue() {
+  if (!m_valueCountMap.size()) throw  cta::exception::Exception("In ValueCountMap::minValue: empty map");
+  uint64_t ret = std::numeric_limits<uint64_t>::max();
+  std::for_each(m_valueCountMap.begin(), m_valueCountMap.end(),
+      [&](decltype(*m_valueCountMap.begin()) pair) {
+        if (ret>pair.value()) ret=pair.value();
+      });
+  return ret;
+}
+
+uint64_t ValueCountMap::total() {
+  uint64_t ret = 0;
+  std::for_each(m_valueCountMap.begin(), m_valueCountMap.end(), 
+      [&](decltype(*m_valueCountMap.begin()) pair) {
+        if (pair.count()<1) {
+          std::stringstream err;
+          err << "In ValueCountMap::total: unexpected count value=" << pair.value() << " count=" << pair.count();
+          throw  cta::exception::Exception(err.str());
+        }
+        ret += pair.count();
+      });
+  return ret;
+}
+
+
+
+}} // namespace cta::objectstore
\ No newline at end of file
diff --git a/scheduler/mockDB/MockSchedulerDatabaseFactory.hpp b/objectstore/ValueCountMap.hpp
similarity index 54%
rename from scheduler/mockDB/MockSchedulerDatabaseFactory.hpp
rename to objectstore/ValueCountMap.hpp
index 8b0a33fd287249f8a633484a2b9c433f2d9c39df..c2137490e0136961256efb66225a627625a53422 100644
--- a/scheduler/mockDB/MockSchedulerDatabaseFactory.hpp
+++ b/objectstore/ValueCountMap.hpp
@@ -18,29 +18,22 @@
 
 #pragma once
 
-#include "SchedulerDatabaseFactory.hpp"
+#include "objectstore/cta.pb.h"
 
-namespace cta {
+namespace cta { namespace objectstore {
 
-/**
- * A conncret implementation of a scheduler database factory that creates mock
- * objects.
- */
-class MockSchedulerDatabaseFactory: public SchedulerDatabaseFactory {
+/** A helper class allowing manipulation of arrays of ValueCountPairs, used as containers for running
+ * counters for properties with multiple possible values. */
+class ValueCountMap {
 public:
-
-  /**
-   * Destructor.
-   */
-  ~MockSchedulerDatabaseFactory() throw();
-
-  /**
-   * Returns a newly created scheduler database object.
-   *
-   * @return A newly created scheduler database object.
-   */
-  std::unique_ptr<SchedulerDatabase> create() const;
-
-}; // class MockSchedulerDatabaseFactory
-
-} // namespace cta
+  ValueCountMap (google::protobuf::RepeatedPtrField<serializers::ValueCountPair>* valueCountMap);
+  void incCount(uint64_t value);
+  void decCount(uint64_t value);
+  uint64_t total();
+  uint64_t minValue();
+  uint64_t maxValue();
+private:
+  google::protobuf::RepeatedPtrField<serializers::ValueCountPair>& m_valueCountMap;
+};
+
+}} // namespace cta::objectstore
\ No newline at end of file
diff --git a/objectstore/cta.proto b/objectstore/cta.proto
index 0a63a776b9c70f82519fb1e6b6f9af77b0dc6dea..b4626008e0f7cf4ce24b07b2bec189b1f1b86fd7 100644
--- a/objectstore/cta.proto
+++ b/objectstore/cta.proto
@@ -23,13 +23,13 @@ enum ObjectType {
   AgentRegister_t = 1;
   Agent_t = 2;
   DriveRegister_t = 3;
-  ArchiveToFileRequest_t = 6;
-  RetrieveToFileRequest_t = 7;
-  SchedulerGlobalLock_t = 8;
-  ArchiveRequest_t = 9;
-  RetrieveRequest_t = 10;
-  ArchiveQueue_t = 11;
-  RetrieveQueue_t = 12;
+  ArchiveToFileRequest_t = 4;
+  RetrieveToFileRequest_t = 5;
+  SchedulerGlobalLock_t = 6;
+  ArchiveRequest_t = 7;
+  RetrieveRequest_t = 8;
+  ArchiveQueue_t = 9;
+  RetrieveQueue_t = 10;
   GenericObject_t = 1000;
 }
 
@@ -348,9 +348,10 @@ message EntryLog {
 }
 
 message MountPolicy {
-  required uint64 minRequestAge = 8985;
-  required uint64 priority = 8987;
-  required uint64 maxDrives = 8989;
+  required string name = 8980;
+  required uint64 minRequestAge = 8981;
+  required uint64 priority = 8982;
+  required uint64 maxDrives = 8983;
 }
 
 message ArchiveRequest {
@@ -383,13 +384,21 @@ message RetrieveRequest {
   repeated RetrieveJobEntry jobs = 9152;
 }
 
+message ValueCountPair {
+  required uint64 value = 9201;
+  required uint64 count = 9202;
+}
+
 message ArchiveQueue {
   required string tapepoolname = 10000;
   repeated ArchiveJobPointer pendingarchivejobs = 10010;
   repeated ArchiveJobPointer orphanedarchivejobsnscreation = 10020;
   repeated ArchiveJobPointer orphanedarchivejobsnsdeletion = 10030;
-  required uint64 ArchiveJobsTotalSize = 10040;
-  required uint64 oldestJobCreationTime = 10050;
+  repeated ValueCountPair prioritymap = 10031;
+  repeated ValueCountPair minarchiverequestagemap = 10032;
+  repeated ValueCountPair maxdrivesallowedmap = 10033;
+  required uint64 archivejobstotalsize = 10040;
+  required uint64 oldestjobcreationtime = 10050;
 }
 
 message RetrieveQueue {
diff --git a/scheduler/ArchiveToTapeCopyRequest.cpp b/scheduler/ArchiveToTapeCopyRequest.cpp
deleted file mode 100644
index 4dda132fc73d163c71dc950bcef62af5031ec934..0000000000000000000000000000000000000000
--- a/scheduler/ArchiveToTapeCopyRequest.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * The CERN Tape Archive (CTA) project
- * Copyright (C) 2015  CERN
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "scheduler/ArchiveToTapeCopyRequest.hpp"
-
-//------------------------------------------------------------------------------
-// constructor
-//------------------------------------------------------------------------------
-cta::ArchiveToTapeCopyRequest::ArchiveToTapeCopyRequest() {
-}
-
-//------------------------------------------------------------------------------
-// destructor
-//------------------------------------------------------------------------------
-cta::ArchiveToTapeCopyRequest::~ArchiveToTapeCopyRequest() throw() {
-}
-
-//------------------------------------------------------------------------------
-// constructor
-//------------------------------------------------------------------------------
-cta::ArchiveToTapeCopyRequest::ArchiveToTapeCopyRequest(
-  const std::string & diskFileID,
-  const uint64_t archiveFileID,
-  const uint16_t copyNb,
-  const std::string tapePoolName,
-  const uint64_t priority,
-  const common::dataStructures::EntryLog &entryLog):
-  UserArchiveRequest(priority, entryLog),
-  diskFileID(diskFileID),
-  archiveFileID(archiveFileID),
-  copyNb(copyNb),
-  tapePoolName(tapePoolName) {
-}
diff --git a/scheduler/ArchiveToTapeCopyRequest.hpp b/scheduler/ArchiveToTapeCopyRequest.hpp
deleted file mode 100644
index 4554bcb45c96a4eb46b6f39d21595ee270617cc5..0000000000000000000000000000000000000000
--- a/scheduler/ArchiveToTapeCopyRequest.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * The CERN Tape Archive (CTA) project
- * Copyright (C) 2015  CERN
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include "common/remoteFS/RemotePathAndStatus.hpp"
-#include "scheduler/UserArchiveRequest.hpp"
-
-#include <stdint.h>
-#include <string>
-
-namespace cta {
-
-/**
- * A user request to archive a remote file to a copy on tape.
- */
-struct ArchiveToTapeCopyRequest: public UserArchiveRequest {
-
-  /**
-   * Constructor.
-   */
-  ArchiveToTapeCopyRequest();
-
-  /**
-   * Destructor.
-   */
-  ~ArchiveToTapeCopyRequest() throw();
-
-  /**
-   * Constructor.
-   *
-   * @param diskFileID The ID of the remote file to be archived.
-   * @param archiveFileID The ID of the archive file
-   * @param copyNb The tape copy number.
-   * @param tapePoolName The name of the destination tape pool.
-   * @param priority The priority of the request.
-   * @param requester The identity of the user who made the request.
-   * @param entryLog log for the creation of the request.
-   */
-  ArchiveToTapeCopyRequest(
-    const std::string & diskFileID,
-    const uint64_t archiveFileID,
-    const uint16_t copyNb,
-    const std::string tapePoolName,
-    const uint64_t priority, 
-    const common::dataStructures::EntryLog & entryLog);
-
-  /**
-   * The ID of the remote file to be archived.
-   */
-  std::string diskFileID;
-
-  /**
-   * The full path of the source archive file.
-   */
-  uint64_t archiveFileID;
-
-  /**
-   * The tape copy number.
-   */
-  uint16_t copyNb;
-
-  /**
-   * The name of the destination tape pool.
-   */
-  std::string tapePoolName;
-
-}; // class ArchiveToTapeCopyRequest
-
-} // namespace cta
diff --git a/scheduler/CMakeLists.txt b/scheduler/CMakeLists.txt
index 51c6a73381364cf7088404cbcfc26f5daa0646ff..d0d353d0d058a9341eb87575a65ca7dbaa988cfa 100644
--- a/scheduler/CMakeLists.txt
+++ b/scheduler/CMakeLists.txt
@@ -7,11 +7,8 @@ set (CTA_SCHEDULER_SRC_FILES
   ArchiveJob.cpp
   ArchiveMount.cpp
   UserArchiveRequest.cpp
-  ArchiveToTapeCopyRequest.cpp
   TapeMount.cpp
   LogicalLibrary.cpp
-#  mockDB/MockSchedulerDatabase.cpp
-#  mockDB/MockSchedulerDatabaseFactory.cpp
   MountType.cpp
   PositioningMethod.cpp
   RetrieveJob.cpp
@@ -36,8 +33,6 @@ target_link_libraries (ctascheduler ctacommon ctaobjectstore protobuf Utils ctau
 #  _old_prototype_DummyScheduler.cpp)
 
 add_library (ctaschedulerunittests SHARED
-#  mockDB/MockSchedulerDatabase.cpp
-#  mockDB/MockSchedulerDatabaseFactory.cpp
   SchedulerDatabaseFactory.cpp
   SchedulerDatabaseTest.cpp
   SchedulerTest.cpp)
diff --git a/scheduler/OStoreDB/OStoreDB.cpp b/scheduler/OStoreDB/OStoreDB.cpp
index 8ac08b0ae4ede9e2654fe107c994690367158db8..9a39ba33e18cb8adfffa128c2bfe8836ddf50312 100644
--- a/scheduler/OStoreDB/OStoreDB.cpp
+++ b/scheduler/OStoreDB/OStoreDB.cpp
@@ -37,7 +37,6 @@
 #include "common/archiveNS/Tape.hpp"
 #include "RetrieveToFileRequest.hpp"
 #include "common/archiveNS/TapeFileLocation.hpp"
-#include "ArchiveToTapeCopyRequest.hpp"
 #include "common/archiveNS/ArchiveFile.hpp"
 #include "objectstore/ArchiveRequest.hpp"
 #include "common/dataStructures/MountPolicy.hpp"
@@ -103,8 +102,8 @@ std::unique_ptr<SchedulerDatabase::TapeMountDecisionInfo>
       m.filesQueued = aqueue.getJobsSummary().files;      
       m.oldestJobStartTime = aqueue.getJobsSummary().oldestJobStartTime;
       m.priority = aqueue.getJobsSummary().priority;
-      
-      m.mountPolicy = aqueue.getMountPolicy();
+      m.maxDrivesAllowed = aqueue.getJobsSummary().maxDrivesAllowed;
+      m.minArchiveRequestAge = aqueue.getJobsSummary().minArchiveRequestAge;
       m.logicalLibrary = "";
 
     }
@@ -271,116 +270,11 @@ std::unique_ptr<SchedulerDatabase::TapeMountDecisionInfo>
 }
 */
 
-void OStoreDB::ArchiveRequestCreation::complete() {
-  // We inherited all the objects from the creation.
-  // Lock is still here at that point.
-  // First, record that we are fine for next step.
-  m_request.setAllJobsLinkingToArchiveQueue();
-  m_request.commit();
-  objectstore::RootEntry re(m_objectStore);
-  // We can now plug the request onto its tape pools.
-  // We can discover at that point that a tape pool is actually not
-  // really owned by the root entry, and hence a dangling pointer
-  // We should then unlink the jobs from that already connected
-  // tape pools and abort the job creation.
-  // The list of done tape pools is held here for this purpose
-  // Reconstruct the job list
-  auto jl = m_request.dumpJobs();
-  std::list<std::string> linkedTapePools;
-  try {
-    for (auto j=jl.begin(); j!=jl.end(); j++) {
-      objectstore::ArchiveQueue aq(j->ArchiveQueueAddress, m_objectStore);
-      ScopedExclusiveLock aql(aq);
-      aq.fetch();
-      if (aq.getOwner() != re.getAddressIfSet())
-        throw NoSuchArchiveQueue("In OStoreDB::queue: non-existing archive queue found "
-            "(dangling pointer): canceling request creation.");
-      aq.addJob(*j, m_request.getAddressIfSet(), m_request.getArchiveFileID(), 
-        m_request.getFileSize(), m_request.getMountPolicy().archivePriority,
-        m_request.getCreationLog().time);
-      // Now that we have the tape pool handy, get the retry limits from it and 
-      // assign them to the job
-      m_request.setJobFailureLimits(j->copyNb, aq.getMountPolicy().maxRetriesWithinMount, 
-        aq.getMountPolicy().maxTotalRetries);
-      aq.commit();
-      linkedTapePools.push_back(j->ArchiveQueueAddress);
-    }
-  } catch (NoSuchArchiveQueue &) {
-    // Unlink the request from already connected tape pools
-    for (auto tpa=linkedTapePools.begin(); tpa!=linkedTapePools.end(); tpa++) {
-      objectstore::ArchiveQueue aq(*tpa, m_objectStore);
-      ScopedExclusiveLock aql(aq);
-      aq.fetch();
-      aq.removeJob(m_request.getAddressIfSet());
-      aq.commit();
-      m_request.remove();
-    }
-    throw;
-  }
-  // The request is now fully set. As it's multi-owned, we do not set the owner,
-  // just to disown it from the agent.
-  m_request.setOwner("");
-  m_request.commit();
-  m_lock.release();
-  // And remove reference from the agent
-  {
-    objectstore::ScopedExclusiveLock al(*m_agent);
-    m_agent->fetch();
-    m_agent->removeFromOwnership(m_request.getAddressIfSet());
-    m_agent->commit();
-  }
-  m_closed=true;
-  return;
-}
-
-void OStoreDB::ArchiveRequestCreation::cancel() {
-  // We inherited everything from the creation, and all we have to
-  // do here is to delete the request from storage and dereference it from
-  // the agent's entry
-  if (m_closed) {
-    throw ArchiveRequestAlreadyCompleteOrCanceled(
-      "In OStoreDB::ArchiveRequestCreation::cancel: trying the close "
-      "the request creation twice");
-  }
-  m_request.remove();
-  {
-    objectstore::ScopedExclusiveLock al(*m_agent);
-    m_agent->fetch();
-    m_agent->removeFromOwnership(m_request.getAddressIfSet());
-    m_agent->commit();
-  }
-  m_closed=true;
-  return;
-}
-
-OStoreDB::ArchiveRequestCreation::~ArchiveRequestCreation() {
-  // We have to determine whether complete() or cancel() were called, in which
-  // case there is nothing to do, or not, in which case we have to garbage
-  // collect the archive to file request. This will queue it to the appropriate
-  // tape pool(s) orphanesArchiveToFileCreations. The schedule will then 
-  // determine its fate depending on the status of the NS entry creation
-  // (no entry, just cancel, already created in NS, carry on).
-  if (m_closed)
-    return;
-  try {
-    m_request.garbageCollect(m_agent->getAddressIfSet());
-    {
-      objectstore::ScopedExclusiveLock al(*m_agent);
-      m_agent->fetch();
-      m_agent->removeFromOwnership(m_request.getAddressIfSet());
-      m_agent->commit();
-    }
-    m_closed=true;
-  } catch (...) {}
-}
-
-std::unique_ptr<cta::SchedulerDatabase::ArchiveRequestCreation> OStoreDB::queue(const cta::common::dataStructures::ArchiveRequest &request, 
+void OStoreDB::queue(const cta::common::dataStructures::ArchiveRequest &request, 
         const cta::common::dataStructures::ArchiveFileQueueCriteria &criteria) {
   assertAgentSet();
   // Construct the return value immediately
-  std::unique_ptr<cta::OStoreDB::ArchiveRequestCreation> internalRet(new cta::OStoreDB::ArchiveRequestCreation(m_agent, m_objectStore));
-  cta::objectstore::ArchiveRequest & ar = internalRet->m_request;
-  ar.setAddress(m_agent->nextId("ArchiveRequest"));
+  cta::objectstore::ArchiveRequest ar(m_agent->nextId("ArchiveRequest"), m_objectStore);
   ar.initialize();
   ar.setArchiveFileID(criteria.fileId);
   ar.setChecksumType(request.checksumType);
@@ -391,6 +285,7 @@ std::unique_ptr<cta::SchedulerDatabase::ArchiveRequestCreation> OStoreDB::queue(
   ar.setDrData(request.drData);
   ar.setDiskFileID(request.diskFileID);
   ar.setFileSize(request.fileSize);
+  ar.setInstance(request.instance);
   ar.setMountPolicy(criteria.mountPolicy);
   ar.setRequester(request.requester);
   ar.setSrcURL(request.srcURL);
@@ -420,20 +315,52 @@ std::unique_ptr<cta::SchedulerDatabase::ArchiveRequestCreation> OStoreDB::queue(
     m_agent->commit();
   }
   ar.setOwner(m_agent->getAddressIfSet());
-  ar.setInstance(request.instance);
   ar.insert();
-  internalRet->m_lock.lock(ar);  
-  // We successfully prepared the object. It will remain attached to the agent 
-  // entry for the time being and get plugged to the tape pools on a second
-  // pass. 
-  // TODO: this can be improved by passing an opaque set of data to the called
-  // (including the lock) in order to optimise the acesses to the object store.
-  // In the mean time, the step 2 of this insertion will be done by finding the
-  // archiveRequest from the agent's owned object. Crude, but should not be too
-  // bad as the agent is not supposed to own many objects in this place.
-  std::unique_ptr<cta::SchedulerDatabase::ArchiveRequestCreation> ret;
-  ret.reset(internalRet.release());
-  return ret;
+  ScopedExclusiveLock arl(ar);
+  // We can now enqueue the requests
+  std::list<std::string> linkedTapePools;
+  try {
+    for (auto &j: ar.dumpJobs()) {
+      objectstore::ArchiveQueue aq(j.ArchiveQueueAddress, m_objectStore);
+      ScopedExclusiveLock aql(aq);
+      aq.fetch();
+      if (aq.getOwner() != re.getAddressIfSet())
+          throw NoSuchArchiveQueue("In OStoreDB::queue: non-existing archive queue found "
+              "(dangling pointer): canceling request creation.");
+      aq.addJob(j, ar.getAddressIfSet(), ar.getArchiveFileID(), 
+        ar.getFileSize(), ar.getMountPolicy(),
+        ar.getCreationLog().time);
+      // Now that we have the tape pool handy, get the retry limits from it and 
+      // assign them to the job
+      ar.setJobFailureLimits(j.copyNb, criteria.mountPolicy.maxRetriesWithinMount, 
+        criteria.mountPolicy.maxTotalRetries);
+      aq.commit();
+      linkedTapePools.push_back(j.ArchiveQueueAddress);
+    }
+  } catch (NoSuchArchiveQueue &) {
+    // Unlink the request from already connected tape pools
+    for (auto tpa=linkedTapePools.begin(); tpa!=linkedTapePools.end(); tpa++) {
+      objectstore::ArchiveQueue aq(*tpa, m_objectStore);
+      ScopedExclusiveLock aql(aq);
+      aq.fetch();
+      aq.removeJob(ar.getAddressIfSet());
+      aq.commit();
+      ar.remove();
+    }
+    throw;
+  }
+  // The request is now fully set. As it's multi-owned, we do not set the owner,
+  // just to disown it from the agent.
+  ar.setOwner("");
+  ar.commit();
+  arl.release();
+  // And remove reference from the agent
+  {
+    objectstore::ScopedExclusiveLock al(*m_agent);
+    m_agent->fetch();
+    m_agent->removeFromOwnership(ar.getAddressIfSet());
+    m_agent->commit();
+  }
 }
 
 void OStoreDB::deleteArchiveRequest(const SecurityIdentity& requester, 
@@ -570,60 +497,112 @@ OStoreDB::ArchiveToFileRequestCancelation::~ArchiveToFileRequestCancelation() {
 
 
 
-std::map<std::string, std::list<ArchiveToTapeCopyRequest> >
-  OStoreDB::getArchiveRequests() const {
+//std::map<std::string, std::list<ArchiveToTapeCopyRequest> >
+//  OStoreDB::getArchiveRequests() const {
+//  objectstore::RootEntry re(m_objectStore);
+//  objectstore::ScopedSharedLock rel(re);
+//  re.fetch();
+//  std::map<std::string, std::list<ArchiveToTapeCopyRequest> > ret;
+//  auto aql = re.dumpArchiveQueues();
+//  rel.release();
+//  for (auto & aqp:aql) {
+//    objectstore::ArchiveQueue osaq(aqp.address, m_objectStore);
+//    ScopedSharedLock osaql(osaq);
+//    osaq.fetch();  
+//    auto arl = osaq.dumpJobs();
+//    osaql.release();
+//    for (auto & ar: arl) {
+//      objectstore::ArchiveRequest osar(ar.address, m_objectStore);
+//      ScopedSharedLock osarl(osar);
+//      osar.fetch();
+//      // Find which copy number is for this tape pool.
+//      // skip the request if not found
+//      auto jl = osar.dumpJobs();
+//      uint16_t copynb;
+//      bool copyndFound=false;
+//      for (auto & j:jl) {
+//        if (j.tapePool == aqp.tapePool) {
+//          copynb = j.copyNb;
+//          copyndFound = true;
+//          break;
+//        }
+//      }
+//      if (!copyndFound) continue;
+//      ret[aqp.tapePool].push_back(cta::ArchiveToTapeCopyRequest(
+//        osar.getDiskFileID(),
+//        osar.getArchiveFileID(),
+//        copynb,
+//        aqp.tapePool,
+//        osar.getMountPolicy().archivePriority,
+//        osar.getCreationLog()));
+//    }
+//  }
+//  return ret;
+//}
+
+std::list<cta::common::dataStructures::ArchiveJob>
+  OStoreDB::getArchiveJobs(const std::string& tapePoolName) const {
   objectstore::RootEntry re(m_objectStore);
   objectstore::ScopedSharedLock rel(re);
   re.fetch();
-  std::map<std::string, std::list<ArchiveToTapeCopyRequest> > ret;
-  auto aql = re.dumpArchiveQueues();
+  auto tpl = re.dumpArchiveQueues();
   rel.release();
-  for (auto & aqp:aql) {
-    objectstore::ArchiveQueue osaq(aqp.address, m_objectStore);
-    ScopedSharedLock osaql(osaq);
-    osaq.fetch();  
+  for (auto & tpp:tpl) {
+    if (tpp.tapePool != tapePoolName) continue;
+    std::list<cta::common::dataStructures::ArchiveJob> ret;
+    objectstore::ArchiveQueue osaq(tpp.address, m_objectStore);
+    ScopedSharedLock ostpl(osaq);
+    osaq.fetch();
     auto arl = osaq.dumpJobs();
-    osaql.release();
-    for (auto & ar: arl) {
-      objectstore::ArchiveRequest osar(ar.address, m_objectStore);
+    ostpl.release();
+    for (auto ar=arl.begin(); ar!=arl.end(); ar++) {
+      objectstore::ArchiveRequest osar(ar->address, m_objectStore);
       ScopedSharedLock osarl(osar);
       osar.fetch();
       // Find which copy number is for this tape pool.
       // skip the request if not found
-      auto jl = osar.dumpJobs();
       uint16_t copynb;
       bool copyndFound=false;
-      for (auto & j:jl) {
-        if (j.tapePool == aqp.tapePool) {
+      for (auto & j:osar.dumpJobs()) {
+        if (j.tapePool == tpp.tapePool) {
           copynb = j.copyNb;
           copyndFound = true;
           break;
         }
       }
       if (!copyndFound) continue;
-      ret[aqp.tapePool].push_back(cta::ArchiveToTapeCopyRequest(
-        osar.getDiskFileID(),
-        osar.getArchiveFileID(),
-        copynb,
-        aqp.tapePool,
-        osar.getMountPolicy().archivePriority,
-        osar.getCreationLog()));
+      ret.push_back(cta::common::dataStructures::ArchiveJob());
+      ret.back().archiveFileID = osar.getArchiveFileID();
+      ret.back().copyNumber = copynb;
+      ret.back().tapePool = tpp.tapePool;
+      ret.back().request.checksumType = osar.getChecksumType();
+      ret.back().request.checksumValue = osar.getChecksumValue();
+      ret.back().request.creationLog = osar.getCreationLog();
+      ret.back().request.diskFileID = osar.getDiskFileID();
+      ret.back().request.diskpoolName = osar.getDiskpoolName();
+      ret.back().request.diskpoolThroughput = osar.getDiskpoolThroughput();
+      ret.back().request.drData = osar.getDrData();
+      ret.back().request.fileSize = osar.getFileSize();
+      ret.back().request.instance = osar.getInstance();
+      ret.back().request.requester = osar.getRequester();
+      ret.back().request.srcURL = osar.getSrcURL();
+      ret.back().request.storageClass = osar.getStorageClass();
     }
+    return ret;
   }
-  return ret;
+  throw NoSuchArchiveQueue("In OStoreDB::getArchiveRequests: tape pool not found");
 }
 
-std::list<ArchiveToTapeCopyRequest>
-  OStoreDB::getArchiveRequests(const std::string& tapePoolName) const {
+std::map<std::string, std::list<common::dataStructures::ArchiveJob> >
+  OStoreDB::getArchiveJobs() const {
   objectstore::RootEntry re(m_objectStore);
   objectstore::ScopedSharedLock rel(re);
   re.fetch();
   auto tpl = re.dumpArchiveQueues();
   rel.release();
-  for (auto tpp=tpl.begin(); tpp!=tpl.end(); tpp++) {
-    if (tpp->tapePool != tapePoolName) continue;
-    std::list<ArchiveToTapeCopyRequest> ret;
-    objectstore::ArchiveQueue osaq(tpp->address, m_objectStore);
+  std::map<std::string, std::list<common::dataStructures::ArchiveJob> > ret;
+  for (auto & tpp:tpl) {
+    objectstore::ArchiveQueue osaq(tpp.address, m_objectStore);
     ScopedSharedLock ostpl(osaq);
     osaq.fetch();
     auto arl = osaq.dumpJobs();
@@ -634,30 +613,38 @@ std::list<ArchiveToTapeCopyRequest>
       osar.fetch();
       // Find which copy number is for this tape pool.
       // skip the request if not found
-      auto jl = osar.dumpJobs();
       uint16_t copynb;
       bool copyndFound=false;
-      for (auto j=jl.begin(); j!=jl.end(); j++) {
-        if (j->tapePool == tpp->tapePool) {
-          copynb = j->copyNb;
+      for (auto & j:osar.dumpJobs()) {
+        if (j.tapePool == tpp.tapePool) {
+          copynb = j.copyNb;
           copyndFound = true;
           break;
         }
       }
       if (!copyndFound) continue;
-      ret.push_back(cta::ArchiveToTapeCopyRequest(
-        osar.getDiskFileID(),
-        osar.getArchiveFileID(),
-        copynb,
-        tpp->tapePool,
-        osar.getMountPolicy().archivePriority,
-        osar.getCreationLog()));
+      ret[tpp.tapePool].push_back(cta::common::dataStructures::ArchiveJob());
+      ret[tpp.tapePool].back().archiveFileID = osar.getArchiveFileID();
+      ret[tpp.tapePool].back().copyNumber = copynb;
+      ret[tpp.tapePool].back().tapePool = tpp.tapePool;
+      ret[tpp.tapePool].back().request.checksumType = osar.getChecksumType();
+      ret[tpp.tapePool].back().request.checksumValue = osar.getChecksumValue();
+      ret[tpp.tapePool].back().request.creationLog = osar.getCreationLog();
+      ret[tpp.tapePool].back().request.diskFileID = osar.getDiskFileID();
+      ret[tpp.tapePool].back().request.diskpoolName = osar.getDiskpoolName();
+      ret[tpp.tapePool].back().request.diskpoolThroughput = osar.getDiskpoolThroughput();
+      ret[tpp.tapePool].back().request.drData = osar.getDrData();
+      ret[tpp.tapePool].back().request.fileSize = osar.getFileSize();
+      ret[tpp.tapePool].back().request.instance = osar.getInstance();
+      ret[tpp.tapePool].back().request.requester = osar.getRequester();
+      ret[tpp.tapePool].back().request.srcURL = osar.getSrcURL();
+      ret[tpp.tapePool].back().request.storageClass = osar.getStorageClass();
     }
-    return ret;
   }
-  throw NoSuchArchiveQueue("In OStoreDB::getArchiveRequests: tape pool not found");
+  return ret;
 }
 
+
 void OStoreDB::queue(const cta::common::dataStructures::RetrieveRequest& rqst,
   const cta::common::dataStructures::RetrieveFileQueueCriteria& criteria) {
   throw cta::exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__);
@@ -764,10 +751,17 @@ void OStoreDB::queue(const cta::common::dataStructures::RetrieveRequest& rqst,
 //  }
 }
 
-std::list<RetrieveRequestDump> OStoreDB::getRetrieveRequests(const std::string& vid) const {
-  throw exception::Exception("Not Implemented");
+std::list<RetrieveRequestDump> OStoreDB::getRetrieveRequestsByVid(const std::string& vid) const {
+  throw exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__);
 }
 
+std::list<RetrieveRequestDump> OStoreDB::getRetrieveRequestsByRequester(const std::string& vid) const {
+  throw cta::exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__);
+}
+
+
+
+
 std::map<cta::Tape, std::list<RetrieveRequestDump> > OStoreDB::getRetrieveRequests() const {
   throw cta::exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__);
 //  std::map<cta::Tape, std::list<RetrieveRequestDump> > ret;
diff --git a/scheduler/OStoreDB/OStoreDB.hpp b/scheduler/OStoreDB/OStoreDB.hpp
index 6925e7b0b5405dbf50910e1e2defcb89d27cfab9..d338111d2d6371434f7876535910bb8950500c6c 100644
--- a/scheduler/OStoreDB/OStoreDB.hpp
+++ b/scheduler/OStoreDB/OStoreDB.hpp
@@ -150,26 +150,8 @@ public:
   CTA_GENERATE_EXCEPTION_CLASS(ArchiveRequestHasNoCopies);
   CTA_GENERATE_EXCEPTION_CLASS(ArchiveRequestAlreadyCompleteOrCanceled);
   CTA_GENERATE_EXCEPTION_CLASS(NoSuchArchiveQueue);
-  class ArchiveRequestCreation: 
-   public cta::SchedulerDatabase::ArchiveRequestCreation {
-  public:
-    ArchiveRequestCreation(objectstore::Agent * agent, 
-      objectstore::Backend & be): m_request(be), m_lock(), m_objectStore(be), 
-      m_agent(agent), m_closed(false) {}
-    virtual void complete() override;
-    virtual void cancel() override;
-    virtual ~ArchiveRequestCreation() override;
-  private:
-    objectstore::ArchiveRequest m_request;
-    objectstore::ScopedExclusiveLock m_lock;
-    objectstore::Backend & m_objectStore;
-    objectstore::Agent * m_agent;
-    bool m_closed;
-    friend class cta::OStoreDB;
-  };
-
   
-  std::unique_ptr<cta::SchedulerDatabase::ArchiveRequestCreation> queue(const cta::common::dataStructures::ArchiveRequest &request, 
+  void queue(const cta::common::dataStructures::ArchiveRequest &request, 
     const cta::common::dataStructures::ArchiveFileQueueCriteria &criteria) override;
 
   CTA_GENERATE_EXCEPTION_CLASS(NoSuchArchiveRequest);
@@ -193,9 +175,9 @@ public:
   };
   std::unique_ptr<SchedulerDatabase::ArchiveToFileRequestCancelation> markArchiveRequestForDeletion(const SecurityIdentity &cliIdentity, uint64_t fileId) override;
 
-  std::map<std::string, std::list<ArchiveToTapeCopyRequest> > getArchiveRequests() const override;
-
-  std::list<ArchiveToTapeCopyRequest> getArchiveRequests(const std::string& tapePoolName) const override;
+  std::map<std::string, std::list<common::dataStructures::ArchiveJob> > getArchiveJobs() const override;
+  
+  std::list<cta::common::dataStructures::ArchiveJob> getArchiveJobs(const std::string& tapePoolName) const override;
 
   /* === Retrieve requests handling  ======================================== */
   CTA_GENERATE_EXCEPTION_CLASS(RetrieveRequestHasNoCopies);
@@ -203,7 +185,9 @@ public:
   void queue(const cta::common::dataStructures::RetrieveRequest& rqst,
     const cta::common::dataStructures::RetrieveFileQueueCriteria &criteria) override;
 
-  std::list<RetrieveRequestDump> getRetrieveRequests(const std::string& vid) const override;
+  std::list<RetrieveRequestDump> getRetrieveRequestsByVid(const std::string& vid) const override;
+  
+  std::list<RetrieveRequestDump> getRetrieveRequestsByRequester(const std::string& vid) const override;
 
   std::map<Tape, std::list<RetrieveRequestDump> > getRetrieveRequests() const override;
 
diff --git a/scheduler/OStoreDB/OStoreDBFactory.hpp b/scheduler/OStoreDB/OStoreDBFactory.hpp
index 844fb1b0ef95a5337d4818f4f93d6d3c3f49dfc5..eab359d45275331deae6541ff3ba32cd8c270482 100644
--- a/scheduler/OStoreDB/OStoreDBFactory.hpp
+++ b/scheduler/OStoreDB/OStoreDBFactory.hpp
@@ -24,7 +24,6 @@
 #include "common/TapePool.hpp"
 #include "common/archiveNS/Tape.hpp"
 #include "scheduler/LogicalLibrary.hpp"
-#include "scheduler/ArchiveToTapeCopyRequest.hpp"
 #include "scheduler/RetrieveRequestDump.hpp"
 #include "objectstore/RootEntry.hpp"
 #include "objectstore/Agent.hpp"
@@ -53,7 +52,7 @@ public:
   
   ~OStoreDBWrapper() throw () {}
 
-  std::unique_ptr<ArchiveRequestCreation> queue(const cta::common::dataStructures::ArchiveRequest& request, const cta::common::dataStructures::ArchiveFileQueueCriteria& criteria) override {
+  void queue(const cta::common::dataStructures::ArchiveRequest& request, const cta::common::dataStructures::ArchiveFileQueueCriteria& criteria) override {
     return m_OStoreDB.queue(request, criteria);
   }
 
@@ -70,22 +69,27 @@ public:
     m_OStoreDB.deleteRetrieveRequest(cliIdentity, remoteFile);
   }
 
-  virtual std::list<ArchiveToTapeCopyRequest> getArchiveRequests(const std::string& tapePoolName) const override {
-    return m_OStoreDB.getArchiveRequests(tapePoolName);
+  std::map<std::string, std::list<common::dataStructures::ArchiveJob> > getArchiveJobs() const override {
+    return m_OStoreDB.getArchiveJobs();
   }
-
-  virtual std::map<std::string, std::list<ArchiveToTapeCopyRequest> > getArchiveRequests() const override {
-    return m_OStoreDB.getArchiveRequests();
+  
+  std::list<cta::common::dataStructures::ArchiveJob> getArchiveJobs(const std::string& tapePoolName) const override {
+    return m_OStoreDB.getArchiveJobs(tapePoolName);
   }
 
   virtual std::map<Tape, std::list<RetrieveRequestDump> > getRetrieveRequests() const override {
     return m_OStoreDB.getRetrieveRequests();
   }
 
-  virtual std::list<RetrieveRequestDump> getRetrieveRequests(const std::string& vid) const override {
-    return m_OStoreDB.getRetrieveRequests(vid);
+  virtual std::list<RetrieveRequestDump> getRetrieveRequestsByVid(const std::string& vid) const override {
+    return m_OStoreDB.getRetrieveRequestsByVid(vid);
   }
   
+  std::list<RetrieveRequestDump> getRetrieveRequestsByRequester(const std::string& requester) const override {
+    return m_OStoreDB.getRetrieveRequestsByRequester(requester);
+  }
+
+  
   virtual std::unique_ptr<TapeMountDecisionInfo> getMountInfo() override {
     return m_OStoreDB.getMountInfo();
   }
diff --git a/scheduler/Scheduler.cpp b/scheduler/Scheduler.cpp
index d87bbfb4e1962b8c18f8dfc3ba27ee40ef239d87..c7ad87f32e8da488b718b77cdde9accf7343886f 100644
--- a/scheduler/Scheduler.cpp
+++ b/scheduler/Scheduler.cpp
@@ -33,8 +33,9 @@
 //------------------------------------------------------------------------------
 cta::Scheduler::Scheduler(
   catalogue::Catalogue &catalogue,
-  SchedulerDatabase &db, const uint64_t minFilesToWarrantAMount, const uint64_t minBytesToWarrantAMount): m_catalogue(catalogue), m_db(db), m_minFilesToWarrantAMount(minFilesToWarrantAMount), m_minBytesToWarrantAMount(minBytesToWarrantAMount) {
-}
+  SchedulerDatabase &db, const uint64_t minFilesToWarrantAMount, const uint64_t minBytesToWarrantAMount): 
+    m_catalogue(catalogue), m_db(db), m_minFilesToWarrantAMount(minFilesToWarrantAMount), 
+    m_minBytesToWarrantAMount(minBytesToWarrantAMount) {}
 
 //------------------------------------------------------------------------------
 // destructor
@@ -52,10 +53,10 @@ void cta::Scheduler::authorizeCliIdentity(const cta::common::dataStructures::Sec
 //------------------------------------------------------------------------------
 // queueArchive
 //------------------------------------------------------------------------------
-uint64_t cta::Scheduler::queueArchive(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::ArchiveRequest &request) {  
-  std::unique_ptr<SchedulerDatabase::ArchiveRequestCreation> requestCreation(m_db.queue(request, m_catalogue.prepareForNewFile(request.storageClass, request.requester)));
-  requestCreation->complete();
-  return 0;
+uint64_t cta::Scheduler::queueArchive(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::ArchiveRequest &request) {
+  auto catalogueInfo = m_catalogue.prepareForNewFile(request.storageClass, request.requester);
+  m_db.queue(request, catalogueInfo);
+  return catalogueInfo.fileId;
 }
 
 //------------------------------------------------------------------------------
@@ -243,37 +244,29 @@ std::list<cta::common::dataStructures::ArchiveFile> cta::Scheduler::reconcile(co
 //------------------------------------------------------------------------------
 // getPendingArchiveJobs
 //------------------------------------------------------------------------------
-std::map<std::string, std::list<cta::common::dataStructures::ArchiveJob> > cta::Scheduler::getPendingArchiveJobs(const cta::common::dataStructures::SecurityIdentity &cliIdentity) const {
-  auto archiveRequests=m_db.getArchiveRequests();
-  std::map<std::string, std::list<cta::common::dataStructures::ArchiveJob> > ret;
-//  for (auto & dbtp: archiveRequests) {
-//    for (auto & dbaj: dbtp.second) {
-//      cta::common::dataStructures::ArchiveJob aj;
-//      aj.archiveFileID = dbaj.;
-//      ret[dbtp.first.name].push_back()
-//    }
-//  }
-  throw cta::exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__);
+std::map<std::string, std::list<cta::common::dataStructures::ArchiveJob> > cta::Scheduler::getPendingArchiveJobs() const {
+  return m_db.getArchiveJobs();
 }
 
 //------------------------------------------------------------------------------
 // getPendingArchiveJobs
 //------------------------------------------------------------------------------
-std::list<cta::common::dataStructures::ArchiveJob> cta::Scheduler::getPendingArchiveJobs(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &tapePoolName) const {
-  throw cta::exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__);
+std::list<cta::common::dataStructures::ArchiveJob> cta::Scheduler::getPendingArchiveJobs(const std::string &tapePoolName) const {
+  return m_db.getArchiveJobs(tapePoolName);
 }
 
 //------------------------------------------------------------------------------
 // getPendingRetrieveJobs
 //------------------------------------------------------------------------------
-std::map<std::string, std::list<cta::common::dataStructures::RetrieveJob> > cta::Scheduler::getPendingRetrieveJobs(const cta::common::dataStructures::SecurityIdentity &cliIdentity) const {
+std::map<std::string, std::list<cta::common::dataStructures::RetrieveJob> > cta::Scheduler::getPendingRetrieveJobs() const {
   throw cta::exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__);
 }
 
 //------------------------------------------------------------------------------
 // getPendingRetrieveJobs
 //------------------------------------------------------------------------------
-std::list<cta::common::dataStructures::RetrieveJob> cta::Scheduler::getPendingRetrieveJobs(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid) const {
+
+std::list<cta::common::dataStructures::RetrieveJob> cta::Scheduler::getPendingRetrieveJobs(const std::string& vid) const {
   throw cta::exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__);
 }
 
diff --git a/scheduler/Scheduler.hpp b/scheduler/Scheduler.hpp
index bb7676003c443bf269dbd13381f17a1424bbb671..ff700dd002012f92ec37f71c25fb06d667ad3a2f 100644
--- a/scheduler/Scheduler.hpp
+++ b/scheduler/Scheduler.hpp
@@ -71,6 +71,7 @@ public:
    */
   virtual ~Scheduler() throw();
 
+  /** Queue an archive request and return the CTA file ID */
   virtual uint64_t queueArchive(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::ArchiveRequest &request);
   virtual void queueRetrieve(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::RetrieveRequest &request);
   virtual void deleteArchive(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::DeleteArchiveRequest &request);
@@ -107,10 +108,10 @@ public:
 
   virtual std::list<cta::common::dataStructures::ArchiveFile> reconcile(const cta::common::dataStructures::SecurityIdentity &cliIdentity); // returns the list of files unknown to EOS, to be deleted manually by the admin after proper checks
 
-  virtual std::map<std::string, std::list<cta::common::dataStructures::ArchiveJob> > getPendingArchiveJobs(const cta::common::dataStructures::SecurityIdentity &cliIdentity) const;
-  virtual std::list<cta::common::dataStructures::ArchiveJob> getPendingArchiveJobs(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &tapePoolName) const;
-  virtual std::map<std::string, std::list<cta::common::dataStructures::RetrieveJob> > getPendingRetrieveJobs(const cta::common::dataStructures::SecurityIdentity &cliIdentity) const;
-  virtual std::list<cta::common::dataStructures::RetrieveJob> getPendingRetrieveJobs(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid) const;
+  virtual std::map<std::string, std::list<cta::common::dataStructures::ArchiveJob> > getPendingArchiveJobs() const;
+  virtual std::list<cta::common::dataStructures::ArchiveJob> getPendingArchiveJobs(const std::string &tapePoolName) const;
+  virtual std::map<std::string, std::list<cta::common::dataStructures::RetrieveJob> > getPendingRetrieveJobs() const;
+  virtual std::list<cta::common::dataStructures::RetrieveJob> getPendingRetrieveJobs(const std::string &vid) const;
 
   virtual std::list<cta::common::dataStructures::DriveState> getDriveStates(const cta::common::dataStructures::SecurityIdentity &cliIdentity) const;
 
diff --git a/scheduler/SchedulerDatabase.hpp b/scheduler/SchedulerDatabase.hpp
index b9ec4e9a70d7644fad51a20ad20b00cc9f1c536e..7e0a8235b30523d0041c96f81cea175b8fe6997d 100644
--- a/scheduler/SchedulerDatabase.hpp
+++ b/scheduler/SchedulerDatabase.hpp
@@ -26,13 +26,14 @@
 #include "common/dataStructures/RetrieveFileQueueCriteria.hpp"
 #include "common/DriveState.hpp"
 #include "common/MountControl.hpp"
+#include "common/dataStructures/ArchiveJob.hpp"
 #include "common/dataStructures/ArchiveRequest.hpp"
 #include "common/dataStructures/ArchiveFileQueueCriteria.hpp"
 #include "common/dataStructures/MountPolicy.hpp"
 #include "common/dataStructures/RetrieveRequest.hpp"
+#include "common/dataStructures/SecurityIdentity.hpp"
 #include "common/remoteFS/RemotePathAndStatus.hpp"
 #include "nameserver/NameServerTapeFile.hpp"
-#include "scheduler/ArchiveToTapeCopyRequest.hpp"
 #include "scheduler/MountType.hpp"
 
 #include <list>
@@ -89,20 +90,6 @@ public:
   virtual ~SchedulerDatabase() throw() = 0;
   
   /*============ Archive management: user side ==============================*/
-  /*
-   * Subclass allowing the tracking and automated cleanup of a 
-   * ArchiveToFile requests on the SchdulerDB. Those 2 operations (creation+close
-   * or cancel) surround an NS operation. This class can keep references, locks,
-   * etc... handy to simplify the implementation of the completion and cancelling
-   * (plus the destructor in case the caller fails half way through).
-   */ 
-  class ArchiveRequestCreation {
-  public:
-    virtual void complete() = 0;
-    virtual void cancel() = 0;
-    virtual ~ArchiveRequestCreation() {};
-  };
-  
   /**
    * Queues the specified request.
    *
@@ -110,28 +97,28 @@ public:
    * @param criteria The criteria retrieved from the CTA catalogue to be used to
    * decide how to quue the request.
    */
-  virtual std::unique_ptr<ArchiveRequestCreation> queue(const cta::common::dataStructures::ArchiveRequest &request, 
+  virtual void queue(const cta::common::dataStructures::ArchiveRequest &request, 
     const cta::common::dataStructures::ArchiveFileQueueCriteria &criteria) = 0;
 
   /**
-   * Returns all of the queued archive requests.  The returned requests are
+   * Returns all of the queued archive jobs.  The returned jobs are
    * grouped by tape pool and then sorted by creation time, oldest first.
    *
-   * @return The queued requests.
+   * @return The queued jobs.
    */
-  virtual std::map<std::string, std::list<ArchiveToTapeCopyRequest> >
-    getArchiveRequests() const = 0;
+  virtual std::map<std::string, std::list<common::dataStructures::ArchiveJob> >
+    getArchiveJobs() const = 0;
 
   /**
-   * Returns the list of queued archive requests for the specified tape pool.
+   * Returns the list of queued jobs queued on the specified tape pool.
    * The returned requests are sorted by creation time, oldest first.
    *
    * @param tapePoolName The name of the tape pool.
    * @return The queued requests.
    */
-  virtual std::list<ArchiveToTapeCopyRequest> getArchiveRequests(
+  virtual std::list<cta::common::dataStructures::ArchiveJob> getArchiveJobs(
     const std::string &tapePoolName) const = 0;
-
+  
   /**
    * Deletes the specified archive request.
    *
@@ -235,9 +222,20 @@ public:
    * @return The list of retrieve jobs associated with the specified tape
    * sorted by creation time in ascending order (oldest first).
    */
-  virtual std::list<RetrieveRequestDump> getRetrieveRequests(
+  virtual std::list<RetrieveRequestDump> getRetrieveRequestsByVid(
     const std::string &vid) const = 0;
   
+  /**
+   * Returns the list of retrieve jobs associated with the specified requester
+   * sorted by creation time in ascending order (oldest first).
+   *
+   * @param requester The requester who created the retrieve request.
+   * @return The list of retrieve jobs associated with the specified tape
+   * sorted by creation time in ascending order (oldest first).
+   */
+  virtual std::list<RetrieveRequestDump> getRetrieveRequestsByRequester(
+    const std::string &requester) const = 0;
+  
   /**
    * Deletes the specified retrieve job.
    *
@@ -288,11 +286,12 @@ public:
     cta::MountType::Enum type; /**< Is this an archive or retireve? */
     std::string vid; /**< The tape VID (for a retieve) */
     std::string tapePool; /**< The name of the tape pool for both archive and retrieve */
-    uint64_t priority; /**< The priority for the mount */
+    uint64_t priority;    /**< The priority for the mount, defined as the highest priority of all queued jobs */
+    uint64_t maxDrivesAllowed; /**< The maximum number of drives allowed for this tape pool, defined as the highest value amongst jobs */
+    uint64_t minArchiveRequestAge; /**< The maximum amount of time to wait before forcing a mount in the absence of enough data. Defined as the smallest value amongst jobs.*/
     uint64_t filesQueued; /**< The number of files queued for this queue */
     uint64_t bytesQueued; /**< The amount of data currently queued */
     time_t oldestJobStartTime; /**< Creation time of oldest request */
-    common::dataStructures::MountPolicy mountPolicy; /**< The mount policy */ 
     std::string logicalLibrary; /**< The logical library (for a retrieve) */
     double ratioOfMountQuotaUsed; /**< The [ 0.0, 1.0 [ ratio of existing mounts/quota (for faire share of mounts)*/
     
diff --git a/scheduler/SchedulerTest.cpp b/scheduler/SchedulerTest.cpp
index d86b7b59c90ec7bdc2f76e9c0be9b7b292c6455c..1fb025516699668361ddfe17e7f52db71c7f0cea 100644
--- a/scheduler/SchedulerTest.cpp
+++ b/scheduler/SchedulerTest.cpp
@@ -23,7 +23,6 @@
 #include "common/admin/AdminHost.hpp"
 #include "common/archiveRoutes/ArchiveRoute.hpp"
 #include "scheduler/ArchiveRequest.hpp"
-#include "scheduler/ArchiveToTapeCopyRequest.hpp"
 #include "scheduler/LogicalLibrary.hpp"
 #include "scheduler/MountRequest.hpp"
 #include "scheduler/OStoreDB/OStoreDBFactory.hpp"
@@ -124,7 +123,7 @@ private:
 
 }; // class SchedulerTest
 
-TEST_P(SchedulerTest, DISABLED_archive_to_new_file) {
+TEST_P(SchedulerTest, archive_to_new_file) {
   using namespace cta;
 
   catalogue::Catalogue &catalogue = getCatalogue();
@@ -234,7 +233,7 @@ TEST_P(SchedulerTest, DISABLED_archive_to_new_file) {
   scheduler.queueArchive(s_adminOnAdminHost, request);
 
   {
-    auto rqsts = scheduler.getPendingArchiveJobs(s_adminOnAdminHost);
+    auto rqsts = scheduler.getPendingArchiveJobs();
     ASSERT_EQ(1, rqsts.size());
     auto poolItor = rqsts.cbegin();
     ASSERT_FALSE(poolItor == rqsts.cend());
diff --git a/scheduler/_old_prototype_DummyScheduler.cpp b/scheduler/_old_prototype_DummyScheduler.cpp
deleted file mode 100644
index df5f1c962c4d9126e70ba6bf0a1622fae4455610..0000000000000000000000000000000000000000
--- a/scheduler/_old_prototype_DummyScheduler.cpp
+++ /dev/null
@@ -1,441 +0,0 @@
-/*
- * The CERN Tape Archive (CTA) project
- * Copyright (C) 2015  CERN
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "common/admin/AdminHost.hpp"
-#include "common/admin/AdminUser.hpp"
-#include "common/archiveNS/StorageClass.hpp"
-#include "common/archiveNS/Tape.hpp"
-#include "common/archiveRoutes/ArchiveRoute.hpp"
-#include "common/exception/Exception.hpp"
-#include "common/remoteFS/RemotePathAndStatus.hpp"
-#include "common/UserIdentity.hpp"
-#include "common/utils/Utils.hpp"
-#include "common/SecurityIdentity.hpp"
-#include "common/TapePool.hpp"
-#include "nameserver/NameServer.hpp"
-#include "remotens/RemoteNS.hpp"
-#include "scheduler/ArchiveMount.hpp"
-#include "scheduler/ArchiveRequest.hpp"
-#include "scheduler/ArchiveToTapeCopyRequest.hpp"
-#include "scheduler/DummyScheduler.hpp"
-#include "scheduler/LogicalLibrary.hpp"
-#include "scheduler/RetrieveRequestDump.hpp"
-#include "scheduler/RetrieveMount.hpp"
-#include "scheduler/RetrieveToFileRequest.hpp"
-#include "scheduler/Scheduler.hpp"
-#include "scheduler/SchedulerDatabase.hpp"
-#include "scheduler/TapeMount.hpp"
-
-//------------------------------------------------------------------------------
-// constructor
-//------------------------------------------------------------------------------
-cta::DummyScheduler::DummyScheduler(NameServer &ns,
-  SchedulerDatabase &db,
-  RemoteNS &remoteNS): Scheduler(ns, db, remoteNS) {
-}
-
-//------------------------------------------------------------------------------
-// destructor
-//------------------------------------------------------------------------------
-cta::DummyScheduler::~DummyScheduler() throw() {
-}
-
-//------------------------------------------------------------------------------
-// getArchiveRequests
-//------------------------------------------------------------------------------
-std::map<cta::TapePool, std::list<cta::ArchiveToTapeCopyRequest> >
-  cta::DummyScheduler::getArchiveRequests(const SecurityIdentity &cliIdentity) const {
-  return std::map<cta::TapePool, std::list<cta::ArchiveToTapeCopyRequest> >();
-}
-
-//------------------------------------------------------------------------------
-// getArchiveRequests
-//------------------------------------------------------------------------------
-std::list<cta::ArchiveToTapeCopyRequest> cta::DummyScheduler::getArchiveRequests(
-  const SecurityIdentity &cliIdentity,
-  const std::string &tapePoolName) const {
-  return std::list<cta::ArchiveToTapeCopyRequest>();
-}
-
-//------------------------------------------------------------------------------
-// deleteArchiveRequest
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::deleteArchiveRequest(
-  const SecurityIdentity &cliIdentity,
-  const std::string &archiveFile) {
-}
-
-//------------------------------------------------------------------------------
-// getRetrieveRequests
-//------------------------------------------------------------------------------
-std::map<cta::Tape, std::list<cta::RetrieveRequestDump> > cta::
-  DummyScheduler::getRetrieveRequests(const SecurityIdentity &cliIdentity) const {
-  return std::map<cta::Tape, std::list<cta::RetrieveRequestDump> >();
-}
-
-//------------------------------------------------------------------------------
-// getRetrieveRequests
-//------------------------------------------------------------------------------
-std::list<cta::RetrieveRequestDump> cta::DummyScheduler::getRetrieveRequests(
-  const SecurityIdentity &cliIdentity,
-  const std::string &vid) const {
-  return std::list<cta::RetrieveRequestDump>();
-}
-  
-//------------------------------------------------------------------------------
-// deleteRetrieveRequest
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::deleteRetrieveRequest(
-  const SecurityIdentity &cliIdentity,
-  const std::string &remoteFile) {
-}
-
-//------------------------------------------------------------------------------
-// createAdminUser
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::createAdminUser(
-  const SecurityIdentity &cliIdentity,
-  const UserIdentity &user,
-  const std::string &comment) {
-}
-
-//------------------------------------------------------------------------------
-// createAdminUserWithoutAuthorizingRequester
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::createAdminUserWithoutAuthorizingRequester(
-  const SecurityIdentity &cliIdentity,
-  const UserIdentity &user,
-  const std::string &comment) {
-}
-
-//------------------------------------------------------------------------------
-// deleteAdminUser
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::deleteAdminUser(
-  const SecurityIdentity &cliIdentity,
-  const UserIdentity &user) {
-}
-
-//------------------------------------------------------------------------------
-// getAdminUsers
-//------------------------------------------------------------------------------
-std::list<cta::common::admin::AdminUser> cta::DummyScheduler::getAdminUsers(const SecurityIdentity
-  &requester) const {
-  return std::list<common::admin::AdminUser>();
-}
-
-//------------------------------------------------------------------------------
-// createAdminHost
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::createAdminHost(
-  const SecurityIdentity &cliIdentity,
-  const std::string &hostName,
-  const std::string &comment) {
-}
-
-//------------------------------------------------------------------------------
-// createAdminHostWithoutAuthorizingRequester
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::createAdminHostWithoutAuthorizingRequester(
-  const SecurityIdentity &cliIdentity,
-  const std::string &hostName,
-  const std::string &comment) {
-}
-
-//------------------------------------------------------------------------------
-// deleteAdminHost
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::deleteAdminHost(
-  const SecurityIdentity &cliIdentity,
-  const std::string &hostName) {
-}
-
-//------------------------------------------------------------------------------
-// getAdminHosts
-//------------------------------------------------------------------------------
-std::list<cta::common::admin::AdminHost> cta::DummyScheduler::getAdminHosts(const SecurityIdentity
-  &requester) const {
-  return std::list<cta::common::admin::AdminHost>();
-}
-
-//------------------------------------------------------------------------------
-// createStorageClass
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::createStorageClass(
-  const SecurityIdentity &cliIdentity,
-  const std::string &name,
-  const uint16_t nbCopies,
-  const std::string &comment) {
-}
-
-//------------------------------------------------------------------------------
-// createStorageClass
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::createStorageClass(
-  const SecurityIdentity &cliIdentity,
-  const std::string &name,
-  const uint16_t nbCopies,
-  const uint32_t id,
-  const std::string &comment) {
-}
-
-//------------------------------------------------------------------------------
-// deleteStorageClass
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::deleteStorageClass(
-  const SecurityIdentity &cliIdentity,
-  const std::string &name) {
-}
-
-//------------------------------------------------------------------------------
-// getStorageClasses
-//------------------------------------------------------------------------------
-std::list<cta::StorageClass> cta::DummyScheduler::getStorageClasses(
-  const SecurityIdentity &cliIdentity) const {
-  return std::list<cta::StorageClass>();
-}
-
-//------------------------------------------------------------------------------
-// createTapePool
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::createTapePool(
-  const SecurityIdentity &cliIdentity,
-  const std::string &name,
-  const uint32_t nbPartialTapes,
-  const std::string &comment) {
-}
-
-//------------------------------------------------------------------------------
-// deleteTapePool
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::deleteTapePool(
-  const SecurityIdentity &cliIdentity,
-  const std::string &name) {
-}
-
-//------------------------------------------------------------------------------
-// getTapePools
-//------------------------------------------------------------------------------
-std::list<cta::TapePool> cta::DummyScheduler::getTapePools(
-  const SecurityIdentity &cliIdentity) const {
-  return std::list<cta::TapePool>();
-}
-
-//------------------------------------------------------------------------------
-// createArchiveRoute
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::createArchiveRoute(
-  const SecurityIdentity &cliIdentity,
-  const std::string &storageClassName,
-  const uint16_t copyNb,
-  const std::string &tapePoolName,
-  const std::string &comment) {
-}
-
-//------------------------------------------------------------------------------
-// deleteArchiveRoute
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::deleteArchiveRoute(
-  const SecurityIdentity &cliIdentity,
-  const std::string &storageClassName,
-  const uint16_t copyNb) {
-}
-
-//------------------------------------------------------------------------------
-// getArchiveRoutes
-//------------------------------------------------------------------------------
-std::list<cta::common::archiveRoute::ArchiveRoute> cta::DummyScheduler::getArchiveRoutes(
-  const SecurityIdentity &cliIdentity) const {
-  return std::list<cta::common::archiveRoute::ArchiveRoute>();
-}
-
-//------------------------------------------------------------------------------
-// createLogicalLibrary
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::createLogicalLibrary(
-  const SecurityIdentity &cliIdentity,
-  const std::string &name,
-  const std::string &comment) {
-}
-
-//------------------------------------------------------------------------------
-// deleteLogicalLibrary
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::deleteLogicalLibrary(
-  const SecurityIdentity &cliIdentity,
-  const std::string &name) {
-}
-
-//------------------------------------------------------------------------------
-// getLogicalLibraries
-//------------------------------------------------------------------------------
-std::list<cta::LogicalLibrary> cta::DummyScheduler::getLogicalLibraries(
-  const SecurityIdentity &cliIdentity) const {
-  return std::list<cta::LogicalLibrary>();
-}
-
-//------------------------------------------------------------------------------
-// createTape
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::createTape(
-  const SecurityIdentity &cliIdentity,
-  const std::string &vid,
-  const std::string &logicalLibraryName,
-  const std::string &tapePoolName,
-  const uint64_t capacityInBytes,
-  const CreationLog &creationLog) {
-}
-
-//------------------------------------------------------------------------------
-// deleteTape
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::deleteTape(
-  const SecurityIdentity &cliIdentity,
-  const std::string &vid) {
-}
-
-//------------------------------------------------------------------------------
-// getTape
-//------------------------------------------------------------------------------
-cta::Tape cta::DummyScheduler::getTape(const SecurityIdentity &cliIdentity,
-  const std::string &vid) const {
-  return Tape();
-}
-
-//------------------------------------------------------------------------------
-// getTapes
-//------------------------------------------------------------------------------
-std::list<cta::Tape> cta::DummyScheduler::getTapes(
-  const SecurityIdentity &cliIdentity) const {
-  return std::list<cta::Tape>();
-}
-
-//------------------------------------------------------------------------------
-// createDir
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::createDir(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path,
-  const mode_t mode) {
-}
-
-//------------------------------------------------------------------------------
-// setOwner
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::setOwner(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path,
-  const UserIdentity &owner) {
-}
-
-//------------------------------------------------------------------------------
-// getOwner
-//------------------------------------------------------------------------------
-cta::UserIdentity cta::DummyScheduler::getOwner(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path) const {
-  return cta::UserIdentity();
-}
-
-//------------------------------------------------------------------------------
-// deleteDir
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::deleteDir(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path) {
-}
-
-//------------------------------------------------------------------------------
-// getVidOfFile
-//------------------------------------------------------------------------------
-std::string cta::DummyScheduler::getVidOfFile(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path,
-  const uint16_t copyNb) const {
-  return std::string();
-}
-
-//------------------------------------------------------------------------------
-// getDirContents
-//------------------------------------------------------------------------------
-cta::common::archiveNS::ArchiveDirIterator cta::DummyScheduler::getDirContents(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path) const {
-  return cta::common::archiveNS::ArchiveDirIterator();
-}
-
-//------------------------------------------------------------------------------
-// statArchiveFile
-//------------------------------------------------------------------------------
-std::unique_ptr<cta::common::archiveNS::ArchiveFileStatus> cta::DummyScheduler::statArchiveFile(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path) const {
-  return std::unique_ptr<cta::common::archiveNS::ArchiveFileStatus>();
-}
-
-//------------------------------------------------------------------------------
-// setDirStorageClass
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::setDirStorageClass(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path,
-  const std::string &storageClassName) {
-}
-
-//------------------------------------------------------------------------------
-// clearDirStorageClass
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::clearDirStorageClass(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path) {
-}
-  
-//------------------------------------------------------------------------------
-// getDirStorageClass
-//------------------------------------------------------------------------------
-std::string cta::DummyScheduler::getDirStorageClass(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path) const {
-  return std::string();
-}
-
-//------------------------------------------------------------------------------
-// queueArchiveRequest
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::queueArchiveRequest(
-  const SecurityIdentity &cliIdentity,
-  const std::list<std::string> &remoteFiles,
-  const std::string &archiveFileOrDir) {
-}
-
-//------------------------------------------------------------------------------
-// queueRetrieveRequest
-//------------------------------------------------------------------------------
-void cta::DummyScheduler::queueRetrieveRequest(
-  const SecurityIdentity &cliIdentity,
-  const std::list<std::string> &archiveFiles,
-  const std::string &remoteFileOrDir) {
-}
-
-//------------------------------------------------------------------------------
-// getNextMount
-//------------------------------------------------------------------------------
-std::unique_ptr<cta::TapeMount> cta::DummyScheduler::getNextMount(
-  const std::string &logicalLibraryName, const std::string & driveName) {
-  return std::unique_ptr<cta::TapeMount>();
-}
diff --git a/scheduler/_old_prototype_DummyScheduler.hpp b/scheduler/_old_prototype_DummyScheduler.hpp
deleted file mode 100644
index 5dbb06e2fe1e4112d6f40f2837d7a9bb4e31e738..0000000000000000000000000000000000000000
--- a/scheduler/_old_prototype_DummyScheduler.hpp
+++ /dev/null
@@ -1,599 +0,0 @@
-/*
- * The CERN Tape Archive (CTA) project
- * Copyright (C) 2015  CERN
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include "scheduler/Scheduler.hpp"
-
-#include <memory>
-
-namespace cta {
-
-/**
- * Class implementimg a dummy tape resource scheduler.
- */
-class DummyScheduler: public Scheduler {
-public:
-
-  /**
-   * Constructor.
-   *
-   * @param ns The name server containing the namespace of the archive.
-   * @param db The scheduler database.
-   * @param remoteNS The name space of the remote storage system.
-   */
-  DummyScheduler(
-    NameServer &ns,
-    SchedulerDatabase &db,
-    RemoteNS &remoteNS);
-
-  /**
-   * Destructor.
-   */
-  ~DummyScheduler() throw();
-
-  /**
-   * Returns all of the queued archive requests.  The returned requests are
-   * grouped by tape pool and then sorted by creation time, oldest first.
-   *
-   * @param requester The identity of the user requesting the list.
-   * @return The queued requests.
-   */
-  std::map<TapePool, std::list<ArchiveToTapeCopyRequest> > getArchiveRequests(
-    const SecurityIdentity &cliIdentity) const;
-
-  /**
-   * Returns the list of queued archive requests for the specified tape pool.
-   * The returned requests are sorted by creation time, oldest first.
-   *
-   * @param requester The identity of the user requesting the list.
-   * @param tapePoolName The name of the tape pool.
-   * @return The queued requests.
-   */
-  std::list<ArchiveToTapeCopyRequest> getArchiveRequests(
-    const SecurityIdentity &cliIdentity,
-    const std::string &tapePoolName) const;
-
-  /**
-   * Deletes the specified archive request.
-   *
-   * @param requester The identity of the requester.
-   * @param archiveFile The absolute path of the destination file within the
-   * archive namespace.
-   */
-  void deleteArchiveRequest(
-    const SecurityIdentity &cliIdentity,
-    const std::string &remoteFile);
-
-  /**
-   * Returns all of the queued retrieve requests.  The returned requests are
-   * grouped by tape and then sorted by creation time, oldest first.
-   *
-   * @param requester The identity of requester.
-   * @return all of the queued retrieve requests.  The returned requsts are
-   * grouped by tape and then sorted by creation time, oldest first.
-   */
-  std::map<Tape, std::list<RetrieveRequestDump> > getRetrieveRequests(
-    const SecurityIdentity &cliIdentity) const;
-
-  /**
-   * Returns the queued retrieve requests for the specified tape.  The
-   * returned requests are sorted by creation time, oldest first.
-   *
-   * @param requester The identity of the requester.
-   * @param vid The volume identifier of the tape.
-   * @return The queued retrieve requests for the specified tape.  The
-   * returned requests are sorted by creation time, oldest first.
-   */
-  std::list<RetrieveRequestDump> getRetrieveRequests(
-    const SecurityIdentity &cliIdentity,
-    const std::string &vid) const;
-  
-  /**
-   * Deletes the specified retrieve request.
-   *
-   * @param requester The identity of the requester.
-   * @param remoteFile The URL of the remote file.
-   */
-  void deleteRetrieveRequest(
-    const SecurityIdentity &cliIdentity,
-    const std::string &remoteFile);
-
-  /**
-   * Creates the specified administrator.
-   *
-   * @param requester The identity of the requester.
-   * @param user The identity of the administrator.
-   * @param comment The comment describing the sministrator.
-   */
-  void createAdminUser(
-    const SecurityIdentity &cliIdentity,
-    const UserIdentity &user,
-    const std::string &comment);
-
-  /**
-   * Creates the specified administrator without performing any authorisation
-   * checks.
-   *
-   * This method provides a way to bootstrap the list of administrators.
-   * This method does not perform any authorizations checks therefore please
-   * take any necessary precautions before calling this method.
-   *
-   * @param requester The identity of the user requesting the creation of the
-   * administrator.
-   * @param user The identity of the administrator.
-   * @param comment The comment describing the sministrator.
-   */
-  void createAdminUserWithoutAuthorizingRequester(
-    const SecurityIdentity &cliIdentity,
-    const UserIdentity &user,
-    const std::string &comment);
-
-  /**
-   * Deletes the specified administrator.
-   *
-   * @param requester The identity of the user requesting the deletion of the
-   * administrator.
-   * @param user The identity of the administrator.
-   */
-  void deleteAdminUser(
-    const SecurityIdentity &cliIdentity,
-    const UserIdentity &user);
-
-  /**
-   * Returns the current list of administrators in lexicographical order.
-   *
-   * @param requester The identity of the user requesting the list.
-   * @return The current list of administrators in lexicographical order.
-   */
-  std::list<common::admin::AdminUser> getAdminUsers(const SecurityIdentity &cliIdentity) const;
-
-  /**
-   * Creates the specified administration host.
-   *
-   * @param requester The identity of the requester.
-   * @param hostName The network name of the administration host.
-   * @param comment The comment describing the administration host.
-   */
-  void createAdminHost(
-    const SecurityIdentity &cliIdentity,
-    const std::string &hostName,
-    const std::string &comment);
-
-  /**
-   * Creates the specified administration host with performing any authorisation
-   * checks.
-   *
-   * This method provides a way to bootstrap the list of administration hosts.
-   * This method does not perform any authorizations checks therefore please
-   * take any necessary precautions before calling this method.
-   *
-   * @param requester The identity of the requester.
-   * @param hostName The network name of the administration host.
-   * @param comment The comment describing the administration host.
-   */
-  void createAdminHostWithoutAuthorizingRequester(
-    const SecurityIdentity &cliIdentity,
-    const std::string &hostName,
-    const std::string &comment);
-
-  /**
-   * Deletes the specified administration host.
-   *
-   * @param requester The identity of the user requesting the deletion of the
-   * administration host.
-   * @param hostName The network name of the administration host.
-   */
-  void deleteAdminHost(
-    const SecurityIdentity &cliIdentity,
-    const std::string &hostName);
-
-  /**
-   * Returns the current list of administration hosts in lexicographical order.
-   *
-   * @param requester The identity of the user requesting the list.
-   * @return The current list of administration hosts in lexicographical order.
-   */
-  std::list<common::admin::AdminHost> getAdminHosts(const SecurityIdentity &cliIdentity) const;
-
-  /**
-   * Creates the specified storage class.
-   *
-   * @param requester The identity of the user requesting the creation of the
-   * storage class.
-   * @param name The name of the storage class.
-   * @param nbCopies The number of copies a file associated with this storage
-   * class should have on tape.
-   * @param comment The comment describing the storage class.
-   */
-  void createStorageClass(
-    const SecurityIdentity &cliIdentity,
-    const std::string &name,
-    const uint16_t nbCopies,
-    const std::string &comment);
-
-  /**
-   * Creates the specified storage class.
-   *
-   * @param requester The identity of the user requesting the creation of the
-   * storage class.
-   * @param name The name of the storage class.
-   * @param nbCopies The number of copies a file associated with this storage
-   * class should have on tape.
-   * @param id The numeric identifer of the storage class.
-   * @param comment The comment describing the storage class.
-   */
-  void createStorageClass(
-    const SecurityIdentity &cliIdentity,
-    const std::string &name,
-    const uint16_t nbCopies,
-    const uint32_t id,
-    const std::string &comment);
-
-  /**
-   * Deletes the specified storage class.
-   *
-   * @param requester The identity of the user requesting the deletion of the
-   * storage class.
-   * @param name The name of the storage class.
-   */
-  void deleteStorageClass(
-    const SecurityIdentity &cliIdentity,
-    const std::string &name);
-
-  /**
-   * Gets the current list of storage classes in lexicographical order.
-   *
-   * @param requester The identity of the user requesting the list.
-   * @return The current list of storage classes in lexicographical order.
-   */
-  std::list<StorageClass> getStorageClasses(
-    const SecurityIdentity &cliIdentity) const;
-
-  /**
-   * Creates a tape pool with the specifed name.
-   *
-   * @param requester The identity of the user requesting the creation of the
-   * tape pool.
-   * @param name The name of the tape pool.
-   * @param nbPartialTapes The maximum number of tapes that can be partially
-   * full at any moment in time.
-   * @param comment The comment describing the tape pool.
-   */
-  void createTapePool(
-    const SecurityIdentity &cliIdentity,
-    const std::string &name,
-    const uint32_t nbPartialTapes,
-    const std::string &comment);
-
-  /**
-   * Delete the tape pool with the specifed name.
-   *
-   * @param requester The identity of the user requesting the deletion of the
-   * tape pool.
-   * @param name The name of the tape pool.
-   */
-  void deleteTapePool(
-    const SecurityIdentity &cliIdentity,
-    const std::string &name);
-
-  /**
-   * Gets the current list of tape pools in lexicographical order.
-   *
-   * @param requester The identity of the user requesting the list.
-   * @return The current list of tape pools in lexicographical order.
-   */
-  std::list<TapePool> getTapePools(
-    const SecurityIdentity &cliIdentity) const;
-
-  /**
-   * Creates the specified archive route.
-   *
-   * @param requester The identity of the user requesting the creation of the
-   * archive route.
-   * @param storageClassName The name of the storage class that identifies the
-   * source disk files.
-   * @param copyNb The tape copy number.
-   * @param tapePoolName The name of the destination tape pool.
-   * @param comment The comment describing the archive route.
-   */
-  void createArchiveRoute(
-    const SecurityIdentity &cliIdentity,
-    const std::string &storageClassName,
-    const uint16_t copyNb,
-    const std::string &tapePoolName,
-    const std::string &comment);
-
-  /**
-   * Deletes the specified archive route.
-   *
-   * @param requester The identity of the user requesting the deletion of the
-   * archive route.
-   * @param storageClassName The name of the storage class that identifies the
-   * source disk files.
-   * @param copyNb The tape copy number.
-   */
-  void deleteArchiveRoute(
-    const SecurityIdentity &cliIdentity,
-    const std::string &storageClassName,
-    const uint16_t copyNb);
-
-  /**
-   * Gets the current list of archive routes.
-   *
-   * @param requester The identity of the user requesting the list.
-   */
-  std::list<common::archiveRoute::ArchiveRoute> getArchiveRoutes(
-    const SecurityIdentity &cliIdentity) const;
-
-  /**
-   * Creates a logical library with the specified name.
-   *
-   * @param requester The identity of the user requesting the creation of the
-   * logical library.
-   * @param name The name of the logical library.
-   * @param comment The comment describing the logical library.
-   */
-  void createLogicalLibrary(
-    const SecurityIdentity &cliIdentity,
-    const std::string &name,
-    const std::string &comment);
-
-  /**
-   * Deletes the logical library with the specified name.
-   *
-   * @param requester The identity of the user requesting the deletion of the
-   * logical library.
-   * @param name The name of the logical library.
-   */
-  void deleteLogicalLibrary(
-    const SecurityIdentity &cliIdentity,
-    const std::string &name);
-
-  /**
-   * Returns the current list of libraries in lexicographical order.
-   *
-   * @param requester The identity of the user requesting the list.
-   * @return The current list of libraries in lexicographical order.
-   */
-  std::list<LogicalLibrary> getLogicalLibraries(
-    const SecurityIdentity &cliIdentity) const;
-
-  /**
-   * Creates a tape.
-   *
-   * @param requester The identity of the requester.
-   * @param vid The volume identifier of the tape.
-   * @param logicalLibraryName The name of the logical library to which the tape
-   * belongs.
-   * @param tapePoolName The name of the tape pool to which the tape belongs.
-   * @param capacityInBytes The capacity of the tape.
-   * @param creationLog The who, where, when an why of this modification.
-   */
-  void createTape(
-    const SecurityIdentity &cliIdentity,
-    const std::string &vid,
-    const std::string &logicalLibraryName,
-    const std::string &tapePoolName,
-    const uint64_t capacityInBytes,
-    const CreationLog &creationLog);
-
-  /**
-   * Deletes the tape with the specified volume identifier.
-   *
-   * @param requester The identity of the requester.
-   * @param vid The volume identifier of the tape.
-   */
-  void deleteTape(
-    const SecurityIdentity &cliIdentity,
-    const std::string &vid);
-
-  /**
-   * Returns the tape with the specified volume identifier.
-   *
-   * @param requester The identity of the requester.
-   * @param vid The volume identifier of the tape.
-   * @return The tape with the specified volume identifier.
-   */
-  Tape getTape(
-    const SecurityIdentity &cliIdentity,
-    const std::string &vid) const;
-
-  /**
-   * Returns the current list of tapes in the lexicographical order of their
-   * volume identifiers.
-   *
-   * @param requester The identity of the requester
-   * @return The current list of tapes in the lexicographical order of their
-   * volume identifiers.
-   */
-  std::list<Tape> getTapes(
-    const SecurityIdentity &cliIdentity) const;
-
-  /**
-   * Creates the specified directory.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the directory.
-   * @param mode The mode bits of the directory entry.
-   */
-  void createDir(
-    const SecurityIdentity &cliIdentity,
-    const std::string &path,
-    const mode_t mode);
-  
-  /**
-   * Sets the owner of the specified file or directory entry.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the file or directory.
-   * @param owner The owner.
-   */
-  void setOwner(
-    const SecurityIdentity &cliIdentity,
-    const std::string &path,
-    const UserIdentity &owner);
-    
-  /**
-   * Returns the owner of the specified file or directory entry.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the file or directory.
-   * @return The owner of the specified file or directory entry.
-   */
-  virtual UserIdentity getOwner(
-    const SecurityIdentity &cliIdentity,
-    const std::string &path) const;
-
-  /**
-   * Deletes the specified directory.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the directory.
-   */
-  void deleteDir(
-   const SecurityIdentity &cliIdentity,
-   const std::string &path);
-
-  /**
-   * Returns the volume identifier of the tape on which the specified tape copy
-   * has been archived.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the file.
-   * @param copyNb The copy number of the file.
-   */
-  std::string getVidOfFile(
-    const SecurityIdentity &cliIdentity,
-    const std::string &path,
-    const uint16_t copyNb) const;
-
-  /**
-   * Gets the contents of the specified directory.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the directory.
-   * @return An iterator over the contents of the directory.
-   */
-  common::archiveNS::ArchiveDirIterator getDirContents(
-    const SecurityIdentity &cliIdentity,
-    const std::string &path) const;
-
-  /**
-   * Returns the status of the specified file or directory within the archive
-   * namespace or NULL if the file or directory does not exist.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the file or directory within the archive
-   * namespace.
-   * @return The status of the file or directory or NULL the the file or
-   * directory does not exist.
-   */
-  std::unique_ptr<common::archiveNS::ArchiveFileStatus> statArchiveFile(
-    const SecurityIdentity &cliIdentity,
-    const std::string &path) const;
-
-  /**
-   * Sets the storage class of the specified directory to the specified value.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the directory.
-   * @param storageClassName The name of the storage class.
-   */
-  void setDirStorageClass(
-    const SecurityIdentity &cliIdentity,
-    const std::string &path,
-    const std::string &storageClassName);
-
-  /**
-   * Clears the storage class of the specified directory.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the directory.
-   */ 
-  void clearDirStorageClass(
-    const SecurityIdentity &cliIdentity,
-    const std::string &path);
-
-  /**
-   * Returns the name of the storage class of the specified directory.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the directory.
-   * @return The name of the storage class of the specified directory.
-   */
-  std::string getDirStorageClass(
-    const SecurityIdentity &cliIdentity,
-    const std::string &path) const;
-
-  /**
-   * Queues the specified request to archive one or more remote files.
-   *
-   * If there is more than one source file then the destination must be a
-   * directory.
-   *
-   * If there is only one source file then the destination can be either a file
-   * or a directory.
-   *
-   * The storage class of the archived file(s) will be inherited from the
-   * destination directory.
-   *
-   * @param requester The identity of the user requesting the archive.
-   * @param remoteFiles The URLs of one or more remote files.
-   * @param archiveFileOrDir The absolute path of the destination file or
-   * directory within the archive namespace.
-   */
-  void queueArchiveRequest(
-    const SecurityIdentity &cliIdentity,
-    const std::list<std::string> &remoteFiles,
-    const std::string &archiveFileOrDir);
-
-  /**
-   * Queues the specified request to retrieve one or more archived files.
-   *
-   * If there is more than one archived file then the destination must be a
-   * directory.
-   *
-   * If there is only one archived file then the destination can be either a
-   * file or a directory.
-   *
-   * @param requester The identity of the user requesting the retrieve.
-   * @param archiveFiles The full path of each source file in the archive
-   * namespace.
-   * @param remoteFileOrDir The URL of the destination remote file or directory.
-   */
-  void queueRetrieveRequest(
-    const SecurityIdentity &cliIdentity,
-    const std::list<std::string> &archiveFiles,
-    const std::string &remoteFileOrDir);
-  
-  /**
-   * Returns the next tape mount for the specified logical library.
-   * All the functions of the mount will handled via the mount object
-   * itself. This is the entry point to the tape server's interface
-   *
-   * @param logicalLibraryName The name of the logical library.
-   * @param driveName The drive's name.
-   * @return The next tape mount or NULL if there is currently no work to do.
-   */
-  std::unique_ptr<TapeMount> getNextMount(const std::string &logicalLibraryName,
-    const std::string & driveName);
-
-}; // class DummyScheduler
-
-} // namespace cta
diff --git a/scheduler/_old_prototype_Scheduler.cpp b/scheduler/_old_prototype_Scheduler.cpp
deleted file mode 100644
index 7bda58ab96e45fa84c079b4ae0945433e1ae0801..0000000000000000000000000000000000000000
--- a/scheduler/_old_prototype_Scheduler.cpp
+++ /dev/null
@@ -1,904 +0,0 @@
-/*
- * The CERN Tape Archive (CTA) project
- * Copyright (C) 2015  CERN
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "common/admin/AdminHost.hpp"
-#include "common/admin/AdminUser.hpp"
-#include "common/archiveNS/StorageClass.hpp"
-#include "common/archiveNS/Tape.hpp"
-#include "common/archiveRoutes/ArchiveRoute.hpp"
-#include "common/exception/Exception.hpp"
-#include "common/remoteFS/RemotePathAndStatus.hpp"
-#include "common/UserIdentity.hpp"
-#include "common/Utils.hpp"
-#include "common/SecurityIdentity.hpp"
-#include "common/TapePool.hpp"
-#include "common/CreationLog.hpp"
-#include "nameserver/NameServer.hpp"
-#include "remotens/RemoteNS.hpp"
-#include "scheduler/ArchiveMount.hpp"
-#include "scheduler/ArchiveRequest.hpp"
-#include "scheduler/ArchiveToTapeCopyRequest.hpp"
-#include "scheduler/LogicalLibrary.hpp"
-#include "scheduler/RetrieveRequestDump.hpp"
-#include "scheduler/RetrieveMount.hpp"
-#include "scheduler/RetrieveToFileRequest.hpp"
-#include "scheduler/Scheduler.hpp"
-#include "scheduler/SchedulerDatabase.hpp"
-#include "scheduler/TapeMount.hpp"
-
-#include <iostream>
-#include <sstream>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <algorithm>
-
-//------------------------------------------------------------------------------
-// TransferFailureToStr
-//------------------------------------------------------------------------------
-const char *cta::Scheduler_old::TransferFailureToStr(
-  const TapeJobFailure enumValue) throw() {
-  switch(enumValue) {
-  case JOBFAILURE_NONE         : return "NONE";
-  case JOBFAILURE_TAPEDRIVE    : return "TAPE DRIVE";
-  case JOBFAILURE_TAPELIBRARY  : return "TAPE LIBRARY";
-  case JOBFAILURE_REMOTESTORAGE: return "REMOTE STORAGE";
-  default                           : return "UNKNOWN";
-  }
-}
-
-//------------------------------------------------------------------------------
-// constructor
-//------------------------------------------------------------------------------
-cta::Scheduler_old::Scheduler(NameServer &ns,
-  SchedulerDatabase &db,
-  RemoteNS &remoteNS):
-  m_ns(ns),
-  m_db(db),
-  m_remoteNS(remoteNS) {
-}
-
-//------------------------------------------------------------------------------
-// destructor
-//------------------------------------------------------------------------------
-cta::Scheduler_old::~Scheduler() throw() {
-}
-
-//------------------------------------------------------------------------------
-// getArchiveRequests
-//------------------------------------------------------------------------------
-std::map<cta::TapePool, std::list<cta::ArchiveToTapeCopyRequest> >
-  cta::Scheduler_old::getArchiveRequests(const SecurityIdentity &cliIdentity) const {
-  return m_db.getArchiveRequests();
-}
-
-//------------------------------------------------------------------------------
-// getArchiveRequests
-//------------------------------------------------------------------------------
-std::list<cta::ArchiveToTapeCopyRequest> cta::Scheduler_old::getArchiveRequests(
-  const SecurityIdentity &cliIdentity,
-  const std::string &tapePoolName) const {
-  return m_db.getArchiveRequests(tapePoolName);
-}
-
-//------------------------------------------------------------------------------
-// deleteArchiveRequest
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::deleteArchiveRequest(
-  const SecurityIdentity &cliIdentity,
-  const std::string &archiveFile) {
-  std::unique_ptr<cta::Scheduler_oldDatabase::ArchiveToFileRequestCancelation>
-    reqCancelation(
-      m_db.markArchiveRequestForDeletion(requester, archiveFile));
-  m_ns.deleteFile(requester, archiveFile);
-  reqCancelation->complete();
-}
-
-//------------------------------------------------------------------------------
-// getRetrieveRequests
-//------------------------------------------------------------------------------
-std::map<cta::Tape, std::list<cta::RetrieveRequestDump> > cta::
-  Scheduler::getRetrieveRequests(const SecurityIdentity &cliIdentity) const {
-  return m_db.getRetrieveRequests();
-}
-
-//------------------------------------------------------------------------------
-// getRetrieveRequests
-//------------------------------------------------------------------------------
-std::list<cta::RetrieveRequestDump> cta::Scheduler_old::getRetrieveRequests(
-  const SecurityIdentity &cliIdentity,
-  const std::string &vid) const {
-  return m_db.getRetrieveRequests(vid);
-}
-  
-//------------------------------------------------------------------------------
-// deleteRetrieveRequest
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::deleteRetrieveRequest(
-  const SecurityIdentity &cliIdentity,
-  const std::string &remoteFile) {
-  m_db.assertIsAdminOnAdminHost(requester);
-  m_db.deleteRetrieveRequest(requester, remoteFile);
-}
-
-//------------------------------------------------------------------------------
-// createAdminUser
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::createAdminUser(
-  const SecurityIdentity &cliIdentity,
-  const UserIdentity &user,
-  const std::string &comment) {
-  m_db.assertIsAdminOnAdminHost(requester);
-  m_db.createAdminUser(requester, user, comment);
-}
-
-//------------------------------------------------------------------------------
-// createAdminUserWithoutAuthorizingRequester
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::createAdminUserWithoutAuthorizingRequester(
-  const SecurityIdentity &cliIdentity,
-  const UserIdentity &user,
-  const std::string &comment) {
-  m_db.createAdminUser(requester, user, comment);
-}
-
-//------------------------------------------------------------------------------
-// deleteAdminUser
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::deleteAdminUser(
-  const SecurityIdentity &cliIdentity,
-  const UserIdentity &user) {
-  m_db.assertIsAdminOnAdminHost(requester);
-  m_db.deleteAdminUser(requester, user);
-}
-
-//------------------------------------------------------------------------------
-// getAdminUsers
-//------------------------------------------------------------------------------
-std::list<cta::common::admin::AdminUser> cta::Scheduler_old::getAdminUsers(const SecurityIdentity
-  &requester) const {
-  m_db.assertIsAdminOnAdminHost(requester);
-  return m_db.getAdminUsers();
-}
-
-//------------------------------------------------------------------------------
-// createAdminHost
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::createAdminHost(
-  const SecurityIdentity &cliIdentity,
-  const std::string &hostName,
-  const std::string &comment) {
-  m_db.assertIsAdminOnAdminHost(requester);
-  CreationLog log(requester.getUser(), requester.getHost(), time(NULL),
-     comment);
-  m_db.createAdminHost(hostName, log);
-}
-
-//------------------------------------------------------------------------------
-// createAdminHostWithoutAuthorizingRequester
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::createAdminHostWithoutAuthorizingRequester(
-  const SecurityIdentity &cliIdentity,
-  const std::string &hostName,
-  const std::string &comment) {
-  CreationLog log (requester.getUser(), requester.getHost(), time(NULL), comment);
-  m_db.createAdminHost(hostName, log);
-}
-
-//------------------------------------------------------------------------------
-// deleteAdminHost
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::deleteAdminHost(
-  const SecurityIdentity &cliIdentity,
-  const std::string &hostName) {
-  m_db.assertIsAdminOnAdminHost(requester);
-  m_db.deleteAdminHost(requester, hostName);
-}
-
-//------------------------------------------------------------------------------
-// getAdminHosts
-//------------------------------------------------------------------------------
-std::list<cta::common::admin::AdminHost> cta::Scheduler_old::getAdminHosts(const SecurityIdentity
-  &requester) const {
-  return m_db.getAdminHosts();
-}
-
-//------------------------------------------------------------------------------
-// createStorageClass
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::createStorageClass(
-  const SecurityIdentity &cliIdentity,
-  const std::string &name,
-  const uint16_t nbCopies,
-  const std::string &comment) {
-  m_db.assertIsAdminOnAdminHost(requester);
-  if(0 == nbCopies) {
-    std::ostringstream msg;
-    msg << "Failed to create storage class " << name << " nbCopies must be"
-      " greater than 0";
-    throw exception::Exception(msg.str());
-  }
-
-  m_db.createStorageClass(name, nbCopies, CreationLog(requester.getUser(), 
-       requester.getHost(), time(NULL), comment));
-  m_ns.createStorageClass(requester, name, nbCopies);
-}
-
-//------------------------------------------------------------------------------
-// createStorageClass
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::createStorageClass(
-  const SecurityIdentity &cliIdentity,
-  const std::string &name,
-  const uint16_t nbCopies,
-  const uint32_t id,
-  const std::string &comment) {
-  m_db.assertIsAdminOnAdminHost(requester);
-  if(0 == nbCopies) {
-    std::ostringstream msg;
-    msg << "Failed to create storage class " << name << " nbCopies must be"
-      " greater than 0";
-    throw exception::Exception(msg.str());
-  }
-  if(9999 < id) {
-    std::ostringstream msg;
-    msg << "Failed to create storage class " << name << " with numeric"
-    " identifier " << id << " because the identifier is greater than the"
-    " maximum permitted value of 9999";
-    throw exception::Exception(msg.str());
-  }
-  m_db.createStorageClass(name, nbCopies, CreationLog(requester.getUser(), 
-       requester.getHost(), time(NULL), comment));
-  m_ns.createStorageClass(requester, name, nbCopies, id);
-}
-
-//------------------------------------------------------------------------------
-// deleteStorageClass
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::deleteStorageClass(
-  const SecurityIdentity &cliIdentity,
-  const std::string &name) {
-  m_db.assertIsAdminOnAdminHost(requester);
-  m_ns.assertStorageClassIsNotInUse(requester, name, "/");
-  m_db.deleteStorageClass(requester, name);
-  m_ns.deleteStorageClass(requester, name);
-}
-
-//------------------------------------------------------------------------------
-// getStorageClasses
-//------------------------------------------------------------------------------
-std::list<cta::StorageClass> cta::Scheduler_old::getStorageClasses(
-  const SecurityIdentity &cliIdentity) const {
-  return m_db.getStorageClasses();
-}
-
-//------------------------------------------------------------------------------
-// createTapePool
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::createTapePool(
-  const SecurityIdentity &cliIdentity,
-  const std::string &name,
-  const uint32_t nbPartialTapes,
-  const std::string &comment) {
-  m_db.assertIsAdminOnAdminHost(requester);
-  m_db.createTapePool(name, nbPartialTapes, CreationLog(requester.getUser(), 
-    requester.getHost(), time(NULL), comment));
-}
-
-//------------------------------------------------------------------------------
-// deleteTapePool
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::deleteTapePool(
-  const SecurityIdentity &cliIdentity,
-  const std::string &name) {
-  m_db.assertIsAdminOnAdminHost(requester);
-  m_db.deleteTapePool(requester, name);
-}
-
-//------------------------------------------------------------------------------
-// getTapePools
-//------------------------------------------------------------------------------
-std::list<cta::TapePool> cta::Scheduler_old::getTapePools(
-  const SecurityIdentity &cliIdentity) const {
-  return m_db.getTapePools();
-}
-
-//------------------------------------------------------------------------------
-// getTapePools
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::setTapePoolMountCriteria(
-  const std::string & tapePool, const MountCriteriaByDirection & mountCriteriaByDirection) {
-  return m_db.setTapePoolMountCriteria(tapePool, mountCriteriaByDirection);
-}
-
-//------------------------------------------------------------------------------
-// createArchiveRoute
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::createArchiveRoute(
-  const SecurityIdentity &cliIdentity,
-  const std::string &storageClassName,
-  const uint16_t copyNb,
-  const std::string &tapePoolName,
-  const std::string &comment) {
-  m_db.assertIsAdminOnAdminHost(requester);
-  m_db.createArchiveRoute(storageClassName, copyNb, tapePoolName,
-    CreationLog(UserIdentity(requester.getUser()), requester.getHost(),
-    time(NULL), comment));
-}
-
-//------------------------------------------------------------------------------
-// deleteArchiveRoute
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::deleteArchiveRoute(
-  const SecurityIdentity &cliIdentity,
-  const std::string &storageClassName,
-  const uint16_t copyNb) {
-  m_db.assertIsAdminOnAdminHost(requester);
-  m_db.deleteArchiveRoute(requester, storageClassName, copyNb);
-}
-
-//------------------------------------------------------------------------------
-// getArchiveRoutes
-//------------------------------------------------------------------------------
-std::list<cta::common::archiveRoute::ArchiveRoute> cta::Scheduler_old::getArchiveRoutes(
-  const SecurityIdentity &cliIdentity) const {
-  return m_db.getArchiveRoutes();
-}
-
-//------------------------------------------------------------------------------
-// createLogicalLibrary
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::createLogicalLibrary(
-  const SecurityIdentity &cliIdentity,
-  const std::string &name,
-  const std::string &comment) {
-  m_db.assertIsAdminOnAdminHost(requester);
-  m_db.createLogicalLibrary(name, CreationLog(requester.getUser(),
-      requester.getHost(), time(NULL), comment));
-}
-
-//------------------------------------------------------------------------------
-// deleteLogicalLibrary
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::deleteLogicalLibrary(
-  const SecurityIdentity &cliIdentity,
-  const std::string &name) {
-  m_db.assertIsAdminOnAdminHost(requester);
-  m_db.deleteLogicalLibrary(requester, name);
-}
-
-//------------------------------------------------------------------------------
-// getLogicalLibraries
-//------------------------------------------------------------------------------
-std::list<cta::LogicalLibrary> cta::Scheduler_old::getLogicalLibraries(
-  const SecurityIdentity &cliIdentity) const {
-  return m_db.getLogicalLibraries();
-}
-
-//------------------------------------------------------------------------------
-// createTape
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::createTape(
-  const SecurityIdentity &cliIdentity,
-  const std::string &vid,
-  const std::string &logicalLibraryName,
-  const std::string &tapePoolName,
-  const uint64_t capacityInBytes,
-  const std::string & comment) {
-  m_db.assertIsAdminOnAdminHost(requester);
-  cta::CreationLog cl (requester.getUser(), requester.getHost(), time(NULL), comment);
-  m_db.createTape(vid, logicalLibraryName, tapePoolName,
-    capacityInBytes, cl);
-}
-
-//------------------------------------------------------------------------------
-// deleteTape
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::deleteTape(
-  const SecurityIdentity &cliIdentity,
-  const std::string &vid) {
-  m_db.assertIsAdminOnAdminHost(requester);
-  m_db.deleteTape(requester, vid);
-}
-
-//------------------------------------------------------------------------------
-// getTape
-//------------------------------------------------------------------------------
-cta::Tape cta::Scheduler_old::getTape(const SecurityIdentity &cliIdentity,
-  const std::string &vid) const {
-  return m_db.getTape(vid);
-}
-
-//------------------------------------------------------------------------------
-// getTapes
-//------------------------------------------------------------------------------
-std::list<cta::Tape> cta::Scheduler_old::getTapes(
-  const SecurityIdentity &cliIdentity) const {
-  return m_db.getTapes();
-}
-
-//------------------------------------------------------------------------------
-// createDir
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::createDir(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path,
-  const mode_t mode) {
-  m_ns.createDir(requester, path, mode);
-}
-
-//------------------------------------------------------------------------------
-// setOwner
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::setOwner(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path,
-  const UserIdentity &owner) {
-  m_ns.setOwner(requester, path, owner);
-}
-
-//------------------------------------------------------------------------------
-// getOwner
-//------------------------------------------------------------------------------
-cta::UserIdentity cta::Scheduler_old::getOwner(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path) const {
-  return m_ns.getOwner(requester, path);
-}
-
-//------------------------------------------------------------------------------
-// deleteDir
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::deleteDir(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path) {
-  m_ns.deleteDir(requester, path);
-}
-
-//------------------------------------------------------------------------------
-// getVidOfFile
-//------------------------------------------------------------------------------
-std::string cta::Scheduler_old::getVidOfFile(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path,
-  const uint16_t copyNb) const {
-  return m_ns.getVidOfFile(requester, path, copyNb);
-}
-
-//------------------------------------------------------------------------------
-// getDirContents
-//------------------------------------------------------------------------------
-cta::common::archiveNS::ArchiveDirIterator cta::Scheduler_old::getDirContents(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path) const {
-  return m_ns.getDirContents(requester, path);
-}
-
-//------------------------------------------------------------------------------
-// statArchiveFile
-//------------------------------------------------------------------------------
-std::unique_ptr<cta::common::archiveNS::ArchiveFileStatus> cta::Scheduler_old::statArchiveFile(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path) const {
-  return m_ns.statFile(requester, path);
-}
-
-//------------------------------------------------------------------------------
-// setDirStorageClass
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::setDirStorageClass(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path,
-  const std::string &storageClassName) {
-  m_ns.setDirStorageClass(requester, path, storageClassName);
-}
-
-//------------------------------------------------------------------------------
-// clearDirStorageClass
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::clearDirStorageClass(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path) {
-  m_ns.clearDirStorageClass(requester, path);
-}
-  
-//------------------------------------------------------------------------------
-// getDirStorageClass
-//------------------------------------------------------------------------------
-std::string cta::Scheduler_old::getDirStorageClass(
-  const SecurityIdentity &cliIdentity,
-  const std::string &path) const {
-  return m_ns.getDirStorageClass(requester, path);
-}
-
-//------------------------------------------------------------------------------
-// queueArchiveRequest
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::queueArchiveRequest(
-  const SecurityIdentity &cliIdentity,
-  const std::list<std::string> &remoteFiles,
-  const std::string &archiveFileOrDir) {
-
-  const std::unique_ptr<common::archiveNS::ArchiveFileStatus> archiveStat =
-    m_ns.statFile(requester, archiveFileOrDir);
-  const bool archiveToDir = archiveStat.get() && S_ISDIR(archiveStat->mode);
-  if(archiveToDir) {
-    const std::string &archiveDir = archiveFileOrDir;
-    if(remoteFiles.empty()) {
-      std::ostringstream message;
-      message << "Invalid archive to directory request:"
-        " The must be at least one remote file:"
-        " archiveDir=" << archiveDir;
-      throw exception::Exception(message.str());
-    }
-
-    // Fetch the status of each remote file
-    std::list<RemotePathAndStatus> rfil;
-    for (auto rf = remoteFiles.begin(); rf != remoteFiles.end(); rf++) {
-      const auto rfStat = m_remoteNS.statFile(*rf);
-      if(NULL == rfStat.get()) {
-        std::ostringstream msg;
-        msg << "Failed to fetch status of remote file " << *rf <<
-          " because the file does not exist";
-        throw exception::Exception(msg.str());
-      }
-      rfil.push_back(RemotePathAndStatus(*rf, *rfStat));
-    }
-//    queueArchiveToDirRequest(requester, rfil, archiveDir);
-    throw exception::Exception("Archive to Dir not supported in current prototype");
-
-  // Else archive to a single file
-  } else {
-    const std::string &archiveFile = archiveFileOrDir;
-    if(archiveStat.get()) {
-      std::ostringstream msg;
-      msg << "Failed to archive to a single file because the destination file "
-        << archiveFile << " already exists in the archive namespace";
-    }
-
-    if(1 != remoteFiles.size()) {
-      std::ostringstream message;
-      message << "Invalid archive to file request:"
-        " The must be one and only one remote file:"
-        " actual=" << remoteFiles.size() << " archiveFile=" << archiveFile;
-      throw exception::Exception(message.str());
-    }
-    const auto rfStat = m_remoteNS.statFile(remoteFiles.front());
-    if(NULL == rfStat.get()) {
-      std::ostringstream msg;
-      msg << "Failed to fetch status of remote file " << remoteFiles.front() <<
-        " because the file does not exist";
-      throw exception::Exception(msg.str());
-    }
-    queueArchiveToFileRequest(requester, 
-      RemotePathAndStatus(remoteFiles.front(), *rfStat), archiveFile);
-  }
-}
-
-//------------------------------------------------------------------------------
-// assertStorageClassHasAtLeastOneCopy
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::assertStorageClassHasAtLeastOneCopy(
-  const StorageClass &storageClass) const {
-  if(0 == storageClass.nbCopies) {
-    std::ostringstream message;
-    message << "Storage class " << storageClass.name <<
-      " has a tape copy count of 0";
-    throw(exception::Exception(message.str()));
-  }
-}
-
-//------------------------------------------------------------------------------
-// createArchiveToFileRequests
-//------------------------------------------------------------------------------
-std::list<cta::ArchiveRequest> cta::Scheduler_old::
-  createArchiveToFileRequests(
-  const SecurityIdentity &cliIdentity,
-  const std::list<RemotePathAndStatus> &remoteFiles,
-  const std::string &archiveDir,
-  const uint64_t priority) {
-  const bool archiveDirEndsWithASlash = Utils::endsWith(archiveDir, '/');
-  std::list<ArchiveToFileRequest> archiveToFileRequests;
-
-  for(auto itor = remoteFiles.cbegin(); itor != remoteFiles.cend(); itor++) {
-    const auto remoteFile = *itor;
-    const auto remoteFileName = m_remoteNS.getFilename(remoteFile.path);
-    const std::string archiveFile = archiveDirEndsWithASlash ?
-      archiveDir + remoteFileName : archiveDir + '/' + remoteFileName;
-    archiveToFileRequests.push_back(createArchiveToFileRequest(requester,
-      remoteFile, archiveFile, priority));
-  }  
-
-  return archiveToFileRequests;
-}
-
-//------------------------------------------------------------------------------
-// queueArchiveToFileRequest
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::queueArchiveToFileRequest(
-  const SecurityIdentity &cliIdentity,
-  const RemotePathAndStatus &remoteFile,
-  const std::string &archiveFile) {
-
-  const uint64_t priority = 0; // TO BE DONE
-  m_ns.createFile(requester, archiveFile, remoteFile.status.mode, Checksum(), remoteFile.status.size);
-  const ArchiveToFileRequest rqst = createArchiveToFileRequest(requester, remoteFile, archiveFile, priority);
-  std::unique_ptr<SchedulerDatabase::ArchiveToFileRequestCreation> requestCreation(m_db.queue(rqst));
-  requestCreation->complete();
-}
-
-//------------------------------------------------------------------------------
-// createArchiveToFileRequest
-//------------------------------------------------------------------------------
-cta::ArchiveRequest cta::Scheduler_old::createArchiveToFileRequest(
-  const SecurityIdentity &cliIdentity,
-  const RemotePathAndStatus &remoteFile,
-  const std::string &archiveFilePath,
-  const uint64_t priority) const {
-
-  const std::string enclosingPath = Utils::getEnclosingPath(archiveFilePath);
-  const std::string storageClassName = m_ns.getDirStorageClass(requester,
-     enclosingPath);
-  const StorageClass storageClass = m_db.getStorageClass(storageClassName);
-  assertStorageClassHasAtLeastOneCopy(storageClass);
-  const auto routes = m_db.getArchiveRoutes(storageClassName);
-  const auto copyNbToPoolMap = createCopyNbToPoolMap(routes);
-  std::unique_ptr<cta::common::archiveNS::ArchiveFileStatus> status = m_ns.statFile(requester, archiveFilePath);
-  cta::common::archiveNS::ArchiveFile archiveFile(archiveFilePath, "", status->fileId, remoteFile.status.size, 0, 0);
-
-  const CreationLog log(requester.getUser(), requester.getHost(), time(NULL));
-  return ArchiveToFileRequest(
-    remoteFile,
-    archiveFile,
-    copyNbToPoolMap,
-    priority,
-    log);
-}
-
-//------------------------------------------------------------------------------
-// createCopyNbToPoolMap
-//------------------------------------------------------------------------------
-std::map<uint16_t, std::string> cta::Scheduler_old::createCopyNbToPoolMap(
-  const std::list<common::archiveRoute::ArchiveRoute> &routes) const {
-  std::map<uint16_t, std::string> copyNbToPoolMap;
-    for(auto itor = routes.begin(); itor != routes.end(); itor++) {
-    const common::archiveRoute::ArchiveRoute &route = *itor;
-    copyNbToPoolMap[route.copyNb] = route.tapePoolName;
-  }
-  return copyNbToPoolMap;
-}
-
-//------------------------------------------------------------------------------
-// queueRetrieveRequest
-//------------------------------------------------------------------------------
-void cta::Scheduler_old::queueRetrieveRequest(
-  const SecurityIdentity &cliIdentity,
-  const std::list<std::string> &archiveFiles,
-  const std::string &remoteFileOrDir) {
-
-  const auto remoteStat = m_remoteNS.statFile(remoteFileOrDir);
-  // If the target does not exist or is a directory, we are retrieving to 
-  // directory
-  const bool retrieveToDir = remoteStat.get() && S_ISDIR(remoteStat->mode);
-  if(retrieveToDir) {
-    const std::string &remoteDir = remoteFileOrDir;
-    std::ostringstream msg;
-    msg << "Failed to queue request to retrieve to the " << remoteDir <<
-      " directory because this functionality is not impelemented";
-    throw exception::Exception(msg.str());
-  // Else retrieve to a single file
-  } else {
-    const std::string &remoteFile = remoteFileOrDir;
-
-    // The remote file should not exist
-    if(remoteStat.get()) {
-      std::ostringstream msg;
-      msg << "Failed to queue request to retrieve to the single file " <<
-        remoteFile << " because the remote file already exists";
-      throw exception::Exception(msg.str());
-    }
-    // We should only try to retrieve one file
-    if (archiveFiles.size() != 1)
-      throw exception::Exception("Failed to queue request to retrieve to single file: trying to retrieve several files");
-    // Check the validity of the source
-    auto sourceStat = m_ns.statFile(requester, archiveFiles.front());
-    if (!sourceStat.get())
-      throw exception::Exception("Failed to queue request to retrieve to single file: source file does not exist");
-    auto tapeCopies = m_ns.getTapeFiles(requester, archiveFiles.front());
-    if (!tapeCopies.size())
-      throw exception::Exception("Failed to queue request to retrieve to single file: source file has no copy on tape");
-    // Generate the requests and enqueue them in the database
-    CreationLog cl (requester.getUser(), requester.getHost(), time(NULL), 
-        "Retrieve request queueing");
-    std::list<TapeFileLocation> tcl;
-    for (auto nstf = tapeCopies.begin(); nstf != tapeCopies.end(); nstf++) {
-      tcl.push_back(nstf->tapeFileLocation);
-    }
-    if (sourceStat->checksum.getByteArray().size() != sizeof(uint32_t)) {
-        std::stringstream err;
-        err << "Unexpected checksum size in cta::Scheduler_old::queueRetrieveRequest: size="
-            << sourceStat->checksum.getByteArray().size()
-            << " expected=" << sizeof(uint32_t);
-      throw cta::exception::Exception(err.str());
-    }
-    uint32_t cs = sourceStat->checksum.getNumeric<uint32_t>();
-    cta::common::archiveNS::ArchiveFile archiveFile(archiveFiles.front(), 
-        "", 
-        sourceStat->fileId,
-        sourceStat->size,
-        cs,
-        0);
-    //nshostname is set to "" and lastmodificationtime is 0 because we don't need this info for retrieving the file
-    RetrieveToFileRequest rtfr (archiveFile,
-        tcl, remoteFile, 0, cl);
-    m_db.queue(rtfr);
-  }
-}
-
-//------------------------------------------------------------------------------
-// getNextMount
-//------------------------------------------------------------------------------
-std::unique_ptr<cta::TapeMount> cta::Scheduler_old::getNextMount(
-  const std::string &logicalLibraryName, const std::string & driveName) {
-  // In order to decide the next mount to do, we have to take a global lock on 
-  // the scheduling, retrieve a list of all running mounts, queues sizes for 
-  // tapes and tape pools, filter the tapes which are actually accessible to
-  // this drive (by library and dedication), order the candidates by priority
-  // below threshold, and pick one at a time. In addition, for archives, we
-  // might not find a suitable tape (by library and dedication). In such a case,
-  // we should find out if no tape at all is available, and log an error if 
-  // so.
-  // We then skip to the next candidate, until we find a suitable one and
-  // return the mount, or exhaust all of them an 
-  // Many steps for this logic are not specific for the database and are hence
-  // implemented in the scheduler itself.
-  // First, get the mount-related info from the DB
-  std::unique_ptr<SchedulerDatabase::TapeMountDecisionInfo> mountInfo;
-  mountInfo = m_db.getMountInfo();
-  auto potentialMounts = mountInfo->potentialMounts;
-  
-  // We should now filter the potential mounts to keep only the ones we are
-  // compatible with (match the logical library for retrieves).
-  // We also only want the potential mounts for which we still have 
-  // We cannot filter the archives yet
-  for (auto m = mountInfo->potentialMounts.begin(); m!= mountInfo->potentialMounts.end();) {
-    if (m->type == MountType::RETRIEVE && m->logicalLibrary != logicalLibraryName) {
-      m = mountInfo->potentialMounts.erase(m);
-    } else {
-      m++;
-    }
-  }
-  
-  // With the existing mount list, we can now populate the potential mount list
-  // with the per tape pool existing mount statistics.
-  typedef std::pair<std::string, cta::MountType::Enum> tpType;
-  std::map<tpType, uint32_t> existingMountsSummary;
-  for (auto em=mountInfo->existingMounts.begin(); em!=mountInfo->existingMounts.end(); em++) {
-    try {
-      existingMountsSummary.at(tpType(em->tapePool, em->type))++;
-    } catch (std::out_of_range &) {
-      existingMountsSummary[tpType(em->tapePool, em->type)] = 1;
-    }
-  }
-  
-  // We can now filter out the potential mounts for which their mount criteria
-  // is already met, filter out the potential mounts for which the maximum mount
-  // quota is already reached, and weight the remaining by how much of their quota 
-  // is reached
-  for (auto m = mountInfo->potentialMounts.begin(); m!= mountInfo->potentialMounts.end();) {
-    // Get summary data
-    uint32_t existingMounts;
-    try {
-      existingMounts = existingMountsSummary.at(tpType(m->tapePool, m->type));
-    } catch (std::out_of_range &) {
-      existingMounts = 0;
-    } 
-    bool mountPassesACriteria = false;
-    if (m->bytesQueued / (1 + existingMounts) >= m->mountCriteria.maxBytesQueued)
-      mountPassesACriteria = true;
-    if (m->filesQueued / (1 + existingMounts) >= m->mountCriteria.maxFilesQueued)
-      mountPassesACriteria = true;
-    if (!existingMounts && ((time(NULL) - m->oldestJobStartTime) > (int64_t)m->mountCriteria.maxAge))
-      mountPassesACriteria = true;
-    if (!mountPassesACriteria || existingMounts >= m->mountCriteria.quota) {
-      m = mountInfo->potentialMounts.erase(m);
-    } else {
-      // populate the mount with a weight 
-      m->ratioOfMountQuotaUsed = 1.0L * existingMounts / m->mountCriteria.quota;
-      m++;
-   }
-  }
-  
-  // We can now sort the potential mounts in decreasing priority order. 
-  // The ordering is defined in operator <.
-  // We want the result in descending order or priority so we reverse the vector
-  std::sort(mountInfo->potentialMounts.begin(), mountInfo->potentialMounts.end());
-  std::reverse(mountInfo->potentialMounts.begin(), mountInfo->potentialMounts.end());
-  
-  // We can now simply iterate on the candidates until we manage to create a
-  // mount for one of them
-  for (auto m = mountInfo->potentialMounts.begin(); m!=mountInfo->potentialMounts.end(); m++) {
-    // If the mount is an archive, we still have to find a tape.
-    if (m->type==cta::MountType::ARCHIVE) {
-      // We need to find a tape for archiving. It should be both in the right 
-      // tape pool and in the drive's logical library
-      auto tapesList = m_db.getTapes();
-      // The first tape matching will go for a prototype.
-      // TODO: improve to reuse already partially written tapes
-      for (auto t=tapesList.begin(); t!=tapesList.end(); t++) {
-        if (t->logicalLibraryName == logicalLibraryName &&
-            t->tapePoolName == m->tapePool &&
-            t->status.availableToWrite()) {
-          // We have our tape. Try to create the session. Prepare a return value
-          // for it.
-          std::unique_ptr<ArchiveMount> internalRet(new ArchiveMount(m_ns));
-          // Get the db side of the session
-          try {
-            internalRet->m_dbMount.reset(mountInfo->createArchiveMount(t->vid,
-                t->tapePoolName, 
-                driveName, 
-                logicalLibraryName, 
-                Utils::getShortHostname(), 
-                time(NULL)).release());
-            internalRet->m_sessionRunning = true;
-            internalRet->setDriveStatus(cta::common::DriveStatus::Starting);
-            return std::unique_ptr<TapeMount> (internalRet.release());
-          } catch (cta::exception::Exception & ex) {
-            continue;
-          }
-        }
-      }
-    } else if (m->type==cta::MountType::RETRIEVE) {
-      // We know the tape we intend to mount. We have to validate the tape is 
-      // actually available to read, and pass on it if no.
-      auto tapesList = m_db.getTapes();
-      for (auto t=tapesList.begin(); t!=tapesList.end(); t++) {
-        if (t->vid == m->vid && t->status.availableToRead()) {
-          try {
-            // create the mount, and populate its DB side.
-            std::unique_ptr<RetrieveMount> internalRet (
-              new RetrieveMount(mountInfo->createRetrieveMount(t->vid, 
-                t->tapePoolName,
-                driveName,
-                logicalLibraryName, 
-                Utils::getShortHostname(), 
-                time(NULL))));
-            internalRet->m_sessionRunning = true;
-            internalRet->m_diskRunning = true;
-            internalRet->m_tapeRunning = true;
-            internalRet->setDriveStatus(cta::common::DriveStatus::Starting);
-            return std::unique_ptr<TapeMount> (internalRet.release()); 
-         } catch (cta::exception::Exception & ex) {
-           std::string debug=ex.getMessageValue();
-           continue;
-         }
-        }
-      }
-    } else {
-      throw std::runtime_error("In Scheduler::getNextMount unexpected mount type");
-    }
-  }
-  return std::unique_ptr<TapeMount>();
-}
-
-//------------------------------------------------------------------------------
-// getDriveStates
-//------------------------------------------------------------------------------
-std::list<cta::common::DriveState> cta::Scheduler_old::getDriveStates(const SecurityIdentity &cliIdentity) const {
-  return m_db.getDriveStates();
-}
diff --git a/scheduler/_old_prototype_Scheduler.hpp b/scheduler/_old_prototype_Scheduler.hpp
deleted file mode 100644
index 3dd0bd4f95446ecd1384af86be356415a1b0f039..0000000000000000000000000000000000000000
--- a/scheduler/_old_prototype_Scheduler.hpp
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * The CERN Tape Archive (CTA) project
- * Copyright (C) 2015  CERN
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include "common/dataStructures/AdminHost.hpp"
-#include "common/dataStructures/AdminUser.hpp"
-#include "common/dataStructures/ArchiveFile.hpp"
-#include "common/dataStructures/ArchiveJob.hpp"
-#include "common/dataStructures/ArchiveMount.hpp"
-#include "common/dataStructures/ArchiveRequest.hpp"
-#include "common/dataStructures/ArchiveRoute.hpp"
-#include "common/dataStructures/CancelRetrieveRequest.hpp"
-#include "common/dataStructures/Dedication.hpp"
-#include "common/dataStructures/DeleteArchiveRequest.hpp"
-#include "common/dataStructures/DRData.hpp"
-#include "common/dataStructures/DriveState.hpp"
-#include "common/dataStructures/EntryLog.hpp"
-#include "common/dataStructures/ListStorageClassRequest.hpp"
-#include "common/dataStructures/LogicalLibrary.hpp"
-#include "common/dataStructures/MountType.hpp"
-#include "common/dataStructures/ReadTestResult.hpp"
-#include "common/dataStructures/RepackInfo.hpp"
-#include "common/dataStructures/RepackType.hpp"
-#include "common/dataStructures/Requester.hpp"
-#include "common/dataStructures/RetrieveJob.hpp"
-#include "common/dataStructures/RetrieveMount.hpp"
-#include "common/dataStructures/RetrieveRequest.hpp"
-#include "common/dataStructures/SecurityIdentity.hpp"
-#include "common/dataStructures/StorageClass.hpp"
-#include "common/dataStructures/TapeFileLocation.hpp"
-#include "common/dataStructures/Tape.hpp"
-#include "common/dataStructures/TapeMount.hpp"
-#include "common/dataStructures/TapePool.hpp"
-#include "common/dataStructures/UpdateFileInfoRequest.hpp"
-#include "common/dataStructures/UserGroup.hpp"
-#include "common/dataStructures/User.hpp"
-#include "common/dataStructures/UserIdentity.hpp"
-#include "common/dataStructures/VerifyInfo.hpp"
-#include "common/dataStructures/VerifyType.hpp"
-#include "common/dataStructures/WriteTestResult.hpp"
-
-#include "common/exception/Exception.hpp"
-#include "scheduler/SchedulerDatabase.hpp"
-
-#include <list>
-#include <map>
-#include <memory>
-#include <stdint.h>
-#include <string>
-
-#include "common/forwardDeclarations.hpp"
-
-namespace cta {
-
-/**
- * Class implementimg a tape resource scheduler.
- */
-class Scheduler_old {
-public:
-
-  /**
-   * An enumeration of the different types of tape job failures.
-   */
-  enum TapeJobFailure {
-    JOBFAILURE_NONE,
-    JOBFAILURE_TAPEDRIVE,
-    JOBFAILURE_TAPELIBRARY,
-    JOBFAILURE_REMOTESTORAGE
-  };
-
-  /**
-   * Thread safe method that returns the string representation of the specified
-   * enumeration value.
-   *
-   * @param enumValue The integer value of the type.
-   * @return The string representation.
-   */
-  static const char *TransferFailureToStr(const TapeJobFailure enumValue)
-    throw();
-
-  /**
-   * Constructor.
-   *
-   * @param ns The name server containing the namespace of the archive.
-   * @param db The scheduler database.
-   * @param remoteNS The name space of the remote storage system.
-   */
-  Scheduler(
-    NameServer &ns,
-    SchedulerDatabase &db,
-    RemoteNS &remoteNS);
-
-  /**
-   * Destructor.
-   */
-  virtual ~Scheduler() throw();
-
-  /**
-   * Returns all of the queued archive requests.  The returned requests are
-   * grouped by tape pool and then sorted by creation time, oldest first.
-   *
-   * @param requester The identity of the user requesting the list.
-   * @return The queued requests.
-   */
-  virtual std::map<TapePool, std::list<ArchiveToTapeCopyRequest> >
-    getArchiveRequests(const SecurityIdentity &cliIdentity) const;
-
-  /**
-   * Returns the list of queued archive requests for the specified tape pool.
-   * The returned requests are sorted by creation time, oldest first.
-   *
-   * @param requester The identity of the user requesting the list.
-   * @param tapePoolName The name of the tape pool.
-   * @return The queued requests.
-   */
-  virtual std::list<ArchiveToTapeCopyRequest> getArchiveRequests(
-    const SecurityIdentity &cliIdentity,
-    const std::string &tapePoolName) const;
-
-  /**
-   * Deletes the specified archive request.
-   *
-   * @param requester The identity of the requester.
-   * @param archiveFile The absolute path of the destination file within the
-   * archive namespace.
-   */
-  virtual void deleteArchiveRequest(
-    const SecurityIdentity &cliIdentity,
-    const std::string &remoteFile);
-
-  /**
-   * Returns all of the queued retrieve requests.  The returned requests are
-   * grouped by tape and then sorted by creation time, oldest first.
-   *
-   * @param requester The identity of requester.
-   * @return all of the queued retrieve requests.  The returned requsts are
-   * grouped by tape and then sorted by creation time, oldest first.
-   */
-  virtual std::map<Tape, std::list<RetrieveRequestDump> >
-    getRetrieveRequests(const SecurityIdentity &cliIdentity) const;
-
-  /**
-   * Returns the queued retrieve requests for the specified tape.  The
-   * returned requests are sorted by creation time, oldest first.
-   *
-   * @param requester The identity of the requester.
-   * @param vid The volume identifier of the tape.
-   * @return The queued retrieve requests for the specified tape.  The
-   * returned requests are sorted by creation time, oldest first.
-   */
-  virtual std::list<RetrieveRequestDump> getRetrieveRequests(
-    const SecurityIdentity &cliIdentity,
-    const std::string &vid) const;
-  
-  /**
-   * Deletes the specified retrieve request.
-   *
-   * @param requester The identity of the requester.
-   * @param remoteFile The URL of the remote file.
-   */
-  virtual void deleteRetrieveRequest(
-    const SecurityIdentity &cliIdentity,
-    const std::string &remoteFile);
-
-  /**
-   * Creates the specified administrator.
-   *
-   * @param requester The identity of the requester.
-   * @param user The identity of the administrator.
-   * @param comment The comment describing the sministrator.
-   */
-  virtual void createAdminUser(
-    const SecurityIdentity &cliIdentity,
-    const UserIdentity &user,
-    const std::string &comment);
-
-  /**
-   * Creates the specified administrator without performing any authorisation
-   * checks.
-   *
-   * This method provides a way to bootstrap the list of administrators.
-   * This method does not perform any authorizations checks therefore please
-   * take any necessary precautions before calling this method.
-   *
-   * @param requester The identity of the user requesting the creation of the
-   * administrator.
-   * @param user The identity of the administrator.
-   * @param comment The comment describing the sministrator.
-   */
-  virtual void createAdminUserWithoutAuthorizingRequester(
-    const SecurityIdentity &cliIdentity,
-    const UserIdentity &user,
-    const std::string &comment);
-
-  /**
-   * Deletes the specified administrator.
-   *
-   * @param requester The identity of the user requesting the deletion of the
-   * administrator.
-   * @param user The identity of the administrator.
-   */
-  virtual void deleteAdminUser(
-    const SecurityIdentity &cliIdentity,
-    const UserIdentity &user);
-
-  /**
-   * Returns the current list of administrators in lexicographical order.
-   *
-   * @param requester The identity of the user requesting the list.
-   * @return The current list of administrators in lexicographical order.
-   */
-  virtual std::list<common::admin::AdminUser> getAdminUsers(
-    const SecurityIdentity &cliIdentity) const;
-
-  /**
-   * Creates the specified administration host.
-   *
-   * @param requester The identity of the requester.
-   * @param hostName The network name of the administration host.
-   * @param comment The comment describing the administration host.
-   */
-  virtual void createAdminHost(
-    const SecurityIdentity &cliIdentity,
-    const std::string &hostName,
-    const std::string &comment);
-
-  /**
-   * Creates the specified administration host with performing any authorisation
-   * checks.
-   *
-   * This method provides a way to bootstrap the list of administration hosts.
-   * This method does not perform any authorizations checks therefore please
-   * take any necessary precautions before calling this method.
-   *
-   * @param requester The identity of the requester.
-   * @param hostName The network name of the administration host.
-   * @param comment The comment describing the administration host.
-   */
-  virtual void createAdminHostWithoutAuthorizingRequester(
-    const SecurityIdentity &cliIdentity,
-    const std::string &hostName,
-    const std::string &comment);
-
-  /**
-   * Deletes the specified administration host.
-   *
-   * @param requester The identity of the user requesting the deletion of the
-   * administration host.
-   * @param hostName The network name of the administration host.
-   */
-  virtual void deleteAdminHost(
-    const SecurityIdentity &cliIdentity,
-    const std::string &hostName);
-
-  /**
-   * Returns the current list of administration hosts in lexicographical order.
-   *
-   * @param requester The identity of the user requesting the list.
-   * @return The current list of administration hosts in lexicographical order.
-   */
-  virtual std::list<common::admin::AdminHost> getAdminHosts(const SecurityIdentity &cliIdentity)
-    const;
-
-  /**
-   * Creates the specified storage class.
-   *
-   * @param requester The identity of the user requesting the creation of the
-   * storage class.
-   * @param name The name of the storage class.
-   * @param nbCopies The number of copies a file associated with this storage
-   * class should have on tape.
-   * @param comment The comment describing the storage class.
-   */
-  virtual void createStorageClass(
-    const SecurityIdentity &cliIdentity,
-    const std::string &name,
-    const uint16_t nbCopies,
-    const std::string &comment);
-
-  /**
-   * Creates the specified storage class.
-   *
-   * @param requester The identity of the user requesting the creation of the
-   * storage class.
-   * @param name The name of the storage class.
-   * @param nbCopies The number of copies a file associated with this storage
-   * class should have on tape.
-   * @param id The numeric identifer of the storage class.
-   * @param comment The comment describing the storage class.
-   */
-  virtual void createStorageClass(
-    const SecurityIdentity &cliIdentity,
-    const std::string &name,
-    const uint16_t nbCopies,
-    const uint32_t id,
-    const std::string &comment);
-
-  /**
-   * Deletes the specified storage class.
-   *
-   * @param requester The identity of the user requesting the deletion of the
-   * storage class.
-   * @param name The name of the storage class.
-   */
-  virtual void deleteStorageClass(
-    const SecurityIdentity &cliIdentity,
-    const std::string &name);
-
-  /**
-   * Gets the current list of storage classes in lexicographical order.
-   *
-   * @param requester The identity of the user requesting the list.
-   * @return The current list of storage classes in lexicographical order.
-   */
-  virtual std::list<StorageClass> getStorageClasses(
-    const SecurityIdentity &cliIdentity) const;
-
-  /**
-   * Creates a tape pool with the specifed name.
-   *
-   * @param requester The identity of the user requesting the creation of the
-   * tape pool.
-   * @param name The name of the tape pool.
-   * @param nbPartialTapes The maximum number of tapes that can be partially
-   * full at any moment in time.
-   * @param comment The comment describing the tape pool.
-   */
-  virtual void createTapePool(
-    const SecurityIdentity &cliIdentity,
-    const std::string &name,
-    const uint32_t nbPartialTapes,
-    const std::string &comment);
-  
-  /**
-   * Delete the tape pool with the specifed name.
-   *
-   * @param requester The identity of the user requesting the deletion of the
-   * tape pool.
-   * @param name The name of the tape pool.
-   */
-  virtual void deleteTapePool(
-    const SecurityIdentity &cliIdentity,
-    const std::string &name);
-
-  /**
-   * Gets the current list of tape pools in lexicographical order.
-   *
-   * @param requester The identity of the user requesting the list.
-   * @return The current list of tape pools in lexicographical order.
-   */
-  virtual std::list<TapePool> getTapePools(
-    const SecurityIdentity &cliIdentity) const;
-  
-  /***/
-  virtual void setTapePoolMountCriteria(const std::string & tapePoolName, 
-    const MountCriteriaByDirection & mountCriteriaByDirection);
-
-  /**
-   * Creates the specified archive route.
-   *
-   * @param requester The identity of the user requesting the creation of the
-   * archive route.
-   * @param storageClassName The name of the storage class that identifies the
-   * source disk files.
-   * @param copyNb The tape copy number.
-   * @param tapePoolName The name of the destination tape pool.
-   * @param comment The comment describing the archive route.
-   */
-  virtual void createArchiveRoute(
-    const SecurityIdentity &cliIdentity,
-    const std::string &storageClassName,
-    const uint16_t copyNb,
-    const std::string &tapePoolName,
-    const std::string &comment);
-
-  /**
-   * Deletes the specified archive route.
-   *
-   * @param requester The identity of the user requesting the deletion of the
-   * archive route.
-   * @param storageClassName The name of the storage class that identifies the
-   * source disk files.
-   * @param copyNb The tape copy number.
-   */
-  virtual void deleteArchiveRoute(
-    const SecurityIdentity &cliIdentity,
-    const std::string &storageClassName,
-    const uint16_t copyNb);
-
-  /**
-   * Gets the current list of archive routes.
-   *
-   * @param requester The identity of the user requesting the list.
-   */
-  virtual std::list<common::archiveRoute::ArchiveRoute> getArchiveRoutes(
-    const SecurityIdentity &cliIdentity) const;
-
-  /**
-   * Creates a logical library with the specified name.
-   *
-   * @param requester The identity of the user requesting the creation of the
-   * logical library.
-   * @param name The name of the logical library.
-   * @param comment The comment describing the logical library.
-   */
-  virtual void createLogicalLibrary(
-    const SecurityIdentity &cliIdentity,
-    const std::string &name,
-    const std::string &comment);
-
-  /**
-   * Deletes the logical library with the specified name.
-   *
-   * @param requester The identity of the user requesting the deletion of the
-   * logical library.
-   * @param name The name of the logical library.
-   */
-  virtual void deleteLogicalLibrary(
-    const SecurityIdentity &cliIdentity,
-    const std::string &name);
-
-  /**
-   * Returns the current list of libraries in lexicographical order.
-   *
-   * @param requester The identity of the user requesting the list.
-   * @return The current list of libraries in lexicographical order.
-   */
-  virtual std::list<LogicalLibrary> getLogicalLibraries(
-    const SecurityIdentity &cliIdentity) const;
-
-  /**
-   * Creates a tape.
-   *
-   * @param requester The identity of the requester.
-   * @param vid The volume identifier of the tape.
-   * @param logicalLibraryName The name of the logical library to which the tape
-   * belongs.
-   * @param tapePoolName The name of the tape pool to which the tape belongs.
-   * @param capacityInBytes The capacity of the tape.
-   * @param comment reason for the creation of the tape
-   */
-  virtual void createTape(
-    const SecurityIdentity &cliIdentity,
-    const std::string &vid,
-    const std::string &logicalLibraryName,
-    const std::string &tapePoolName,
-    const uint64_t capacityInBytes,
-    const std::string & comment);
-
-  /**
-   * Deletes the tape with the specified volume identifier.
-   *
-   * @param requester The identity of the requester.
-   * @param vid The volume identifier of the tape.
-   */
-  virtual void deleteTape(
-    const SecurityIdentity &cliIdentity,
-    const std::string &vid);
-
-  /**
-   * Returns the tape with the specified volume identifier.
-   *
-   * @param requester The identity of the requester.
-   * @param vid The volume identifier of the tape.
-   * @return The tape with the specified volume identifier.
-   */
-  virtual Tape getTape(
-    const SecurityIdentity &cliIdentity,
-    const std::string &vid) const;
-
-  /**
-   * Returns the current list of tapes in the lexicographical order of their
-   * volume identifiers.
-   *
-   * @param requester The identity of the requester
-   * @return The current list of tapes in the lexicographical order of their
-   * volume identifiers.
-   */
-  virtual std::list<Tape> getTapes(
-    const SecurityIdentity &cliIdentity) const;
-
-  /**
-   * Creates the specified directory.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the directory.
-   * @param mode The mode bits of the directory entry.
-   */
-  virtual void createDir(
-    const SecurityIdentity &cliIdentity,
-    const std::string &path,
-    const mode_t mode);
-  
-  /**
-   * Sets the owner of the specified file or directory entry.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the file or directory.
-   * @param owner The owner.
-   */
-  virtual void setOwner(
-    const SecurityIdentity &cliIdentity,
-    const std::string &path,
-    const UserIdentity &owner);
-    
-  /**
-   * Returns the owner of the specified file or directory entry.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the file or directory.
-   * @return The owner of the specified file or directory entry.
-   */
-  virtual UserIdentity getOwner(
-    const SecurityIdentity &cliIdentity,
-    const std::string &path) const;
-
-  /**
-   * Deletes the specified directory.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the directory.
-   */
-  virtual void deleteDir(
-   const SecurityIdentity &cliIdentity,
-   const std::string &path);
-
-  /**
-   * Returns the volume identifier of the tape on which the specified tape copy
-   * has been archived.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the file.
-   * @param copyNb The copy number of the file.
-   */
-  virtual std::string getVidOfFile(
-    const SecurityIdentity &cliIdentity,
-    const std::string &path,
-    const uint16_t copyNb) const;
-
-  /**
-   * Gets the contents of the specified directory.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the directory.
-   * @return An iterator over the contents of the directory.
-   */
-  virtual common::archiveNS::ArchiveDirIterator getDirContents(
-    const SecurityIdentity &cliIdentity,
-    const std::string &path) const;
-
-  /**
-   * Returns the status of the specified file or directory within the archive
-   * namespace or NULL if the file or directory does not exist.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the file or directory within the archive
-   * namespace.
-   * @return The status of the file or directory or NULL the the file or
-   * directory does not exist.
-   */
-  virtual std::unique_ptr<common::archiveNS::ArchiveFileStatus> statArchiveFile(
-    const SecurityIdentity &cliIdentity,
-    const std::string &path) const;
-
-  /**
-   * Sets the storage class of the specified directory to the specified value.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the directory.
-   * @param storageClassName The name of the storage class.
-   */
-  virtual void setDirStorageClass(
-    const SecurityIdentity &cliIdentity,
-    const std::string &path,
-    const std::string &storageClassName);
-
-  /**
-   * Clears the storage class of the specified directory.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the directory.
-   */ 
-  virtual void clearDirStorageClass(
-    const SecurityIdentity &cliIdentity,
-    const std::string &path);
-
-  /**
-   * Returns the name of the storage class of the specified directory.
-   *
-   * @param requester The identity of the requester.
-   * @param path The absolute path of the directory.
-   * @return The name of the storage class of the specified directory.
-   */
-  virtual std::string getDirStorageClass(
-    const SecurityIdentity &cliIdentity,
-    const std::string &path) const;
-
-  /**
-   * Queues the specified request to archive one or more remote files.
-   *
-   * If there is more than one source file then the destination must be a
-   * directory.
-   *
-   * If there is only one source file then the destination can be either a file
-   * or a directory.
-   *
-   * The storage class of the archived file(s) will be inherited from the
-   * destination directory.
-   *
-   * @param requester The identity of the user requesting the archive.
-   * @param remoteFiles The URLs of one or more remote files.
-   * @param archiveFileOrDir The absolute path of the destination file or
-   * directory within the archive namespace.
-   */
-  virtual void queueArchiveRequest(
-    const SecurityIdentity &cliIdentity,
-    const std::list<std::string> &remoteFiles,
-    const std::string &archiveFileOrDir);
-
-  /**
-   * Queues the specified request to retrieve one or more archived files.
-   *
-   * If there is more than one archived file then the destination must be a
-   * directory.
-   *
-   * If there is only one archived file then the destination can be either a
-   * file or a directory.
-   *
-   * @param requester The identity of the user requesting the retrieve.
-   * @param archiveFiles The full path of each source file in the archive
-   * namespace.
-   * @param remoteFileOrDir The URL of the destination remote file or directory.
-   */
-  virtual void queueRetrieveRequest(
-    const SecurityIdentity &cliIdentity,
-    const std::list<std::string> &archiveFiles,
-    const std::string &remoteFileOrDir);
-  
-  CTA_GENERATE_EXCEPTION_CLASS(NotImplemented);
-
-  /**
-   * Returns the next tape mount for the specified logical library.
-   * All the functions of the mount will handled via the mount object
-   * itself. This is the entry point to the tape server's interface
-   *
-   * @param logicalLibraryName The name of the logical library.
-   * @param driveName The drive's name.
-   * @return The next tape mount or NULL if there is currently no work to do.
-   */
-  virtual std::unique_ptr<TapeMount> getNextMount(const std::string &logicalLibraryName,
-    const std::string & driveName);
-  
-  /**
-   * Returns the current list of registered drives.
-   *
-   * @return The current list of registered drives.
-   */
-  virtual std::list<cta::common::DriveState> getDriveStates(const SecurityIdentity &cliIdentity) const;
-
-private:
-
-  /**
-   * The name server containing the namespace of the archive.
-   */
-  NameServer &m_ns;
-
-  /**
-   * The scheduler database.
-   */
-  SchedulerDatabase &m_db;
-
-  /**
-   * The name space of the remote storage system.
-   */
-  RemoteNS &m_remoteNS;
-  
-  /**
-   * A class containing the necessary information to queue an Archive request
-   */
-  class RemoteFileInfo {
-  public:
-    RemoteFileInfo(const std::string & p, const uint64_t s):path(p), size(s) {}
-    std::string path;
-    uint64_t size;
-  };
-  
-  /**
-   * Queues the specified request to archive one or more remote files to an
-   * archive directory.
-   *
-   * The list of source files should contain at least one file.
-   *
-   * The storage class of the archived file will be inherited from its
-   * destination directory.
-   *
-   * @param requester The identity of the user requesting the archive.
-   * @param remoteFiles The paths and statuses of the files in the  remote
-   * storage systems.
-   * @param archiveDir The full path of the destination directory within the
-   * archive namespace.
-   */
-//  void queueArchiveToDirRequest(
-//    const SecurityIdentity &cliIdentity,
-//    const std::list<RemotePathAndStatus> &remoteFiles,
-//    const std::string &archiveDir);
-
-  /**
-   * Throws an exception if the specified storage class has a tape copy count
-   * of 0.
-   *
-   * @param storageClass The storage class.
-   */
-  void assertStorageClassHasAtLeastOneCopy(
-    const StorageClass &storageClass) const;
-  
-  /**
-   * Returns the list of ArchiveToFileRequest objects representing the specified
-   * request to archive multiple files to an archive directory.
-   *
-   * @param requester The identity of the requester.
-   * @param remoteFiles The paths and statuses of the files in the remote
-   * storage systems.
-   * @param archiveFile The full path of the destination directory within the
-   * archive namespace.
-   * @param priority The priority of the request.
-   */
-  std::list<ArchiveToFileRequest> createArchiveToFileRequests(
-    const SecurityIdentity &cliIdentity,
-    const std::list<RemotePathAndStatus> &remoteFiles,
-    const std::string &archiveDir,
-    const uint64_t priority);
-
-  /**
-   * Queues the specifed request to archive one remote file to on archive file.
-   *
-   * The storage class of the archived file will be inherited from its
-   * destination directory.
-   *
-   * @param requester The identity of the requester.
-   * @param remoteFile The path and status of the remote file.
-   * @param archiveFile The full path of the destination file within the
-   * archive namespace.
-   */
-  void queueArchiveToFileRequest(
-    const SecurityIdentity &cliIdentity,
-    const RemotePathAndStatus &remoteFile,
-    const std::string &archiveFile);
-
-  /**
-   * Returns the ArchiveToFileRequest object representing the specified request.
-   *
-   * @param requester The identity of the requester.
-   * @param remoteFile The path and status of the remote file.
-   * @param archiveFile The full path of the destination file within the
-   * archive namespace.
-   * @param priority The priority of the request.
-   */
-  ArchiveToFileRequest createArchiveToFileRequest(
-    const SecurityIdentity &cliIdentity,
-    const RemotePathAndStatus &remoteFile,
-    const std::string &archiveFilePath,
-    const uint64_t priority) const;
-
-  /**
-   * Returns the map from tape copy number to tape pool name for the specified
-   * set of archive routes.
-   *
-   * @param routes The archive routes.
-   * @return The map from tape copy number to tape pool name for the specified
-   * set of archive routes.
-   */
-  std::map<uint16_t, std::string> createCopyNbToPoolMap(
-    const std::list<common::archiveRoute::ArchiveRoute> &routes) const;
-
-}; // class Scheduler
-
-} // namespace cta
diff --git a/scheduler/_old_prototype_SchedulerTest.cpp b/scheduler/_old_prototype_SchedulerTest.cpp
deleted file mode 100644
index a6ff5be53db5888606fd37f16b5c41f4cb676a63..0000000000000000000000000000000000000000
--- a/scheduler/_old_prototype_SchedulerTest.cpp
+++ /dev/null
@@ -1,2715 +0,0 @@
-/*
- * The CERN Tape Archive (CTA) project
- * Copyright (C) 2015  CERN
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "nameserver/mockNS/MockNameServerFactory.hpp"
-#include "nameserver/NameServer.hpp"
-#include "remotens/MockRemoteNS.hpp"
-#include "common/admin/AdminUser.hpp"
-#include "common/admin/AdminHost.hpp"
-#include "common/archiveRoutes/ArchiveRoute.hpp"
-#include "scheduler/ArchiveRequest.hpp"
-#include "scheduler/ArchiveToTapeCopyRequest.hpp"
-#include "scheduler/LogicalLibrary.hpp"
-#include "scheduler/MountRequest.hpp"
-#include "scheduler/Scheduler.hpp"
-#include "scheduler/SchedulerDatabase.hpp"
-#include "scheduler/TapeMount.hpp"
-#include "scheduler/ArchiveMount.hpp"
-#include "scheduler/RetrieveMount.hpp"
-#include "common/SecurityIdentity.hpp"
-#include "common/archiveNS/StorageClass.hpp"
-#include "common/archiveNS/Tape.hpp"
-#include "common/TapePool.hpp"
-#include "OStoreDB/OStoreDBFactory.hpp"
-
-#include <exception>
-#include <gtest/gtest.h>
-#include <memory>
-#include <utility>
-
-namespace unitTests {
-
-/**
- * This structure is used to parameterize scheduler tests.
- */
-struct SchedulerTestParam {
-  cta::NameServerFactory &nsFactory;
-  cta::SchedulerDatabaseFactory &dbFactory;
-
-  SchedulerTestParam(
-    cta::NameServerFactory &nsFactory,
-    cta::SchedulerDatabaseFactory &dbFactory):
-    nsFactory(nsFactory),
-    dbFactory(dbFactory) {
- }
-}; // struct SchedulerTestParam
-
-/**
- * The scheduler test is a parameterized test.  It takes a pair of name server
- * and scheduler database factories as a parameter.
- */
-class SchedulerTest: public ::testing::TestWithParam<SchedulerTestParam> {
-public:
-
-  SchedulerTest() throw() {
-  }
-
-  class FailedToGetMockRemoteNS: public std::exception {
-  public:
-    const char *what() const throw() {
-      return "Failed to get mock remote NS";
-    }
-  };
-
-  class FailedToGetScheduler: public std::exception {
-  public:
-    const char *what() const throw() {
-      return "Failed to get scheduler";
-    }
-  };
-
-  virtual void SetUp() {
-    using namespace cta;
-
-    const SchedulerTestParam &param = GetParam();
-    m_ns = param.nsFactory.create();
-    m_db = param.dbFactory.create();
-    m_mockRemoteNS.reset(new MockRemoteNS());
-    m_scheduler.reset(new cta::Scheduler(*(m_ns.get()), *(m_db.get()),
-      *(m_mockRemoteNS.get())));
-
-    MockRemoteNS &remoteNS = *m_mockRemoteNS.get();
-    remoteNS.createEntry(s_remoteFileRawPath1, RemoteFileStatus(s_user, 0777, 1111));
-    remoteNS.createEntry(s_remoteFileRawPath2, RemoteFileStatus(s_user, 0777, 2222));
-    remoteNS.createEntry(s_remoteFileRawPath3, RemoteFileStatus(s_user, 0777, 3333));
-    remoteNS.createEntry(s_remoteFileRawPath4, RemoteFileStatus(s_user, 0777, 4444));
-
-    SchedulerDatabase &db = *m_db.get();
-    db.createAdminUser(s_systemOnSystemHost, s_admin,
-      "The initial administrator created by the system");
-    cta::CreationLog log(s_systemOnSystemHost.getUser(), s_systemOnSystemHost.getHost(),
-      time(NULL), "The initial administration host created by the system");
-    db.createAdminHost(s_adminHost, log);
-  }
-
-  virtual void TearDown() {
-    m_scheduler.reset();
-    m_mockRemoteNS.reset();
-    m_db.reset();
-    m_ns.reset();
-  }
-
-  cta::MockRemoteNS &getMockRemoteNs() {
-    cta::MockRemoteNS *const ptr = m_mockRemoteNS.get();
-    if(NULL == ptr) {
-      throw FailedToGetMockRemoteNS();
-    }
-    return *ptr;
-  }
-
-  cta::Scheduler &getScheduler() {
-    cta::Scheduler *const ptr = m_scheduler.get();
-    if(NULL == ptr) {
-      throw FailedToGetScheduler();
-    }
-    return *ptr;
-  }
-
-  static const std::string s_systemHost;
-  static const std::string s_adminHost;
-  static const std::string s_userHost;
-
-  static const cta::UserIdentity s_system;
-  static const cta::UserIdentity s_admin;
-  static const cta::UserIdentity s_user;
-
-  static const cta::SecurityIdentity s_systemOnSystemHost;
-
-  static const cta::SecurityIdentity s_adminOnAdminHost;
-  static const cta::SecurityIdentity s_adminOnUserHost;
-
-  static const cta::SecurityIdentity s_userOnAdminHost;
-  static const cta::SecurityIdentity s_userOnUserHost;
-
-  static const std::string s_remoteFilename1;
-  static const std::string s_remoteFilename2;
-  static const std::string s_remoteFilename3;
-  static const std::string s_remoteFilename4;
-
-  static const std::string s_remoteFileRawPath1;
-  static const std::string s_remoteFileRawPath2;
-  static const std::string s_remoteFileRawPath3;
-  static const std::string s_remoteFileRawPath4;
-
-  static const std::string s_remoteTargetFilename1;
-  static const std::string s_remoteTargetFilename2;
-  static const std::string s_remoteTargetFilename3;
-  static const std::string s_remoteTargetFilename4;
-
-  static const std::string s_remoteTargetRawPath1;
-  static const std::string s_remoteTargetRawPath2;
-  static const std::string s_remoteTargetRawPath3;
-  static const std::string s_remoteTargetRawPath4;
-
-private:
-
-  // Prevent copying
-  SchedulerTest(const SchedulerTest &);
-
-  // Prevent assignment
-  SchedulerTest & operator= (const SchedulerTest &);
-
-  std::unique_ptr<cta::NameServer> m_ns;
-  std::unique_ptr<cta::SchedulerDatabase> m_db;
-  std::unique_ptr<cta::MockRemoteNS> m_mockRemoteNS;
-  std::unique_ptr<cta::Scheduler> m_scheduler;
-
-}; // class SchedulerTest
-
-const std::string SchedulerTest::s_systemHost = "systemhost";
-const std::string SchedulerTest::s_adminHost = "adminhost";
-const std::string SchedulerTest::s_userHost = "userhost";
-
-const cta::UserIdentity SchedulerTest::s_system(1111, 1111);
-const cta::UserIdentity SchedulerTest::s_admin(2222, 2222);
-const cta::UserIdentity SchedulerTest::s_user(getuid(), getgid());
-
-const cta::SecurityIdentity SchedulerTest::s_systemOnSystemHost(SchedulerTest::s_system, SchedulerTest::s_systemHost);
-
-const cta::SecurityIdentity SchedulerTest::s_adminOnAdminHost(SchedulerTest::s_admin, SchedulerTest::s_adminHost);
-const cta::SecurityIdentity SchedulerTest::s_adminOnUserHost(SchedulerTest::s_admin, SchedulerTest::s_userHost);
-
-const cta::SecurityIdentity SchedulerTest::s_userOnAdminHost(SchedulerTest::s_user, SchedulerTest::s_adminHost);
-const cta::SecurityIdentity SchedulerTest::s_userOnUserHost(SchedulerTest::s_user, SchedulerTest::s_userHost);
-
-
-const std::string SchedulerTest::s_remoteFilename1("remoteFile1");
-const std::string SchedulerTest::s_remoteFilename2("remoteFile2");
-const std::string SchedulerTest::s_remoteFilename3("remoteFile3");
-const std::string SchedulerTest::s_remoteFilename4("remoteFile4");
-
-const std::string SchedulerTest::s_remoteFileRawPath1(std::string("mock:") + s_remoteFilename1);
-const std::string SchedulerTest::s_remoteFileRawPath2(std::string("mock:") + s_remoteFilename2);
-const std::string SchedulerTest::s_remoteFileRawPath3(std::string("mock:") + s_remoteFilename3);
-const std::string SchedulerTest::s_remoteFileRawPath4(std::string("mock:") + s_remoteFilename4);
-
-const std::string SchedulerTest::s_remoteTargetFilename1("remoteFileForWrite1");
-const std::string SchedulerTest::s_remoteTargetFilename2("remoteFileForWrite2");
-const std::string SchedulerTest::s_remoteTargetFilename3("remoteFileForWrite3");
-const std::string SchedulerTest::s_remoteTargetFilename4("remoteFileForWrite4");
-
-const std::string SchedulerTest::s_remoteTargetRawPath1(std::string("mock:") + s_remoteTargetFilename1);
-const std::string SchedulerTest::s_remoteTargetRawPath2(std::string("mock:") + s_remoteTargetFilename2);
-const std::string SchedulerTest::s_remoteTargetRawPath3(std::string("mock:") + s_remoteTargetFilename3);
-const std::string SchedulerTest::s_remoteTargetRawPath4(std::string("mock:") + s_remoteTargetFilename4);
-
-TEST_P(SchedulerTest, createStorageClass_new_as_adminOnAdminHost) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnAdminHost));
-    ASSERT_TRUE(storageClasses.empty());
-  }
-
-  const std::string name = "TestStorageClass";
-  const uint16_t nbCopies = 2;
-  const std::string comment = "Comment";
-  ASSERT_NO_THROW(scheduler.createStorageClass(s_adminOnAdminHost, name,
-    nbCopies, comment));
-
-  {
-    std::list<StorageClass> storageClasses;
-    scheduler.getStorageClasses(
-      s_adminOnAdminHost);
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnAdminHost));
-    ASSERT_EQ(1, storageClasses.size());
-
-    StorageClass storageClass;
-    ASSERT_NO_THROW(storageClass = storageClasses.front());
-    ASSERT_EQ(name, storageClass.name);
-    ASSERT_EQ(nbCopies, storageClass.nbCopies);
-  }
-}
-
-TEST_P(SchedulerTest, createStorageClass_new_as_adminOnUserHost) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnUserHost));
-    ASSERT_TRUE(storageClasses.empty());
-  }
-
-  const std::string name = "TestStorageClass";
-  const uint16_t nbCopies = 2;
-  const std::string comment = "Comment";
-  ASSERT_THROW(scheduler.createStorageClass(s_adminOnUserHost, name, nbCopies,
-    comment), std::exception);
-}
-
-TEST_P(SchedulerTest, createStorageClass_new_as_userOnAdminHost) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_userOnAdminHost));
-    ASSERT_TRUE(storageClasses.empty());
-  }
-
-  const std::string name = "TestStorageClass";
-  const uint16_t nbCopies = 2;
-  const std::string comment = "Comment";
-  ASSERT_THROW(scheduler.createStorageClass(s_userOnAdminHost, name, nbCopies,
-    comment), std::exception);
-}
-
-TEST_P(SchedulerTest, createStorageClass_new_as_userOnUserHost) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses =
-      scheduler.getStorageClasses(s_userOnUserHost));
-    ASSERT_TRUE(storageClasses.empty());
-  }
-
-  const std::string name = "TestStorageClass";
-  const uint16_t nbCopies = 2;
-  const std::string comment = "Comment";
-  ASSERT_THROW(scheduler.createStorageClass(s_userOnUserHost, name, nbCopies,
-    comment), std::exception);
-}
-
-TEST_P(SchedulerTest,
-  admin_createStorageClass_already_existing) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnAdminHost));
-    ASSERT_TRUE(storageClasses.empty());
-  }
-
-  const std::string name = "TestStorageClass";
-  const uint16_t nbCopies = 2;
-  const std::string comment = "Comment";
-  ASSERT_NO_THROW(scheduler.createStorageClass(s_adminOnAdminHost, name,
-    nbCopies, comment));
-
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnAdminHost));
-    ASSERT_EQ(1, storageClasses.size());
-
-    StorageClass storageClass;
-    ASSERT_NO_THROW(storageClass = storageClasses.front());
-    ASSERT_EQ(name, storageClass.name);
-    ASSERT_EQ(nbCopies, storageClass.nbCopies);
-  }
-  
-  ASSERT_THROW(scheduler.createStorageClass(s_adminOnAdminHost, name, nbCopies,
-    comment), std::exception);
-}
-
-TEST_P(SchedulerTest,
-  admin_createStorageClass_lexicographical_order) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnAdminHost));
-    ASSERT_TRUE(storageClasses.empty());
-  }
-
-  ASSERT_NO_THROW(scheduler.createStorageClass(s_adminOnAdminHost, "d", 1, "Comment d"));
-  ASSERT_NO_THROW(scheduler.createStorageClass(s_adminOnAdminHost, "b", 1, "Comment b"));
-  ASSERT_NO_THROW(scheduler.createStorageClass(s_adminOnAdminHost, "a", 1, "Comment a"));
-  ASSERT_NO_THROW(scheduler.createStorageClass(s_adminOnAdminHost, "c", 1, "Comment c"));
-  
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnAdminHost));
-    ASSERT_EQ(4, storageClasses.size());
-
-    ASSERT_EQ(std::string("a"), storageClasses.front().name);
-    storageClasses.pop_front();
-    ASSERT_EQ(std::string("b"), storageClasses.front().name);
-    storageClasses.pop_front();
-    ASSERT_EQ(std::string("c"), storageClasses.front().name);
-    storageClasses.pop_front();
-    ASSERT_EQ(std::string("d"), storageClasses.front().name);
-  }
-}
-
-TEST_P(SchedulerTest, admin_deleteStorageClass_existing) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-  
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnAdminHost));
-    ASSERT_TRUE(storageClasses.empty());
-  }
-
-  const std::string name = "TestStorageClass";
-  const uint16_t nbCopies = 2;
-  const std::string comment = "Comment";
-  ASSERT_NO_THROW(scheduler.createStorageClass(s_adminOnAdminHost, name, nbCopies, comment));
-
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnAdminHost));
-    ASSERT_EQ(1, storageClasses.size());
-  
-    StorageClass storageClass;
-    ASSERT_NO_THROW(storageClass = storageClasses.front());
-    ASSERT_EQ(name, storageClass.name);
-    ASSERT_EQ(nbCopies, storageClass.nbCopies);
-
-    ASSERT_NO_THROW(scheduler.deleteStorageClass(s_adminOnAdminHost, name));
-  }
-
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnAdminHost));
-    ASSERT_TRUE(storageClasses.empty());
-  }
-}
-
-TEST_P(SchedulerTest,
-  admin_deleteStorageClass_in_use_by_directory) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-  
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnAdminHost));
-    ASSERT_TRUE(storageClasses.empty());
-  }
-
-  const std::string storageClassName = "TestStorageClass";
-  const uint16_t nbCopies = 2;
-  const std::string comment = "Comment";
-  ASSERT_NO_THROW(scheduler.createStorageClass(s_adminOnAdminHost, storageClassName, nbCopies,
-    comment));
-
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnAdminHost));
-    ASSERT_EQ(1, storageClasses.size());
-
-    StorageClass storageClass;
-    ASSERT_NO_THROW(storageClass = storageClasses.front());
-    ASSERT_EQ(storageClassName, storageClass.name);
-    ASSERT_EQ(nbCopies, storageClass.nbCopies);
-  }
-
-  ASSERT_NO_THROW(scheduler.setDirStorageClass(s_adminOnAdminHost, "/",
-    storageClassName));
-
-  ASSERT_THROW(scheduler.deleteStorageClass(s_adminOnAdminHost, storageClassName),
-    std::exception);
-
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnAdminHost));
-    ASSERT_EQ(1, storageClasses.size());
-
-    StorageClass storageClass;
-    ASSERT_NO_THROW(storageClass = storageClasses.front());
-    ASSERT_EQ(storageClassName, storageClass.name);
-    ASSERT_EQ(nbCopies, storageClass.nbCopies);
-  }
-
-  ASSERT_NO_THROW(scheduler.clearDirStorageClass(s_adminOnAdminHost, "/"));
-
-  ASSERT_NO_THROW(scheduler.deleteStorageClass(s_adminOnAdminHost, storageClassName));
-
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnAdminHost));
-    ASSERT_TRUE(storageClasses.empty());
-  }
-}
-
-TEST_P(SchedulerTest, admin_deleteStorageClass_in_use_by_route) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-  
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnAdminHost));
-    ASSERT_TRUE(storageClasses.empty());
-  }
-
-  const std::string storageClassName = "TestStorageClass";
-  const uint16_t nbCopies = 2;
-  const std::string comment = "Comment";
-  ASSERT_NO_THROW(scheduler.createStorageClass(s_adminOnAdminHost, storageClassName, nbCopies,
-    comment));
-
-  {
-    std::list<StorageClass> storageClasses;
-
-
-
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnAdminHost));
-    ASSERT_EQ(1, storageClasses.size());
-
-    StorageClass storageClass;
-    ASSERT_NO_THROW(storageClass = storageClasses.front());
-    ASSERT_EQ(storageClassName, storageClass.name);
-    ASSERT_EQ(nbCopies, storageClass.nbCopies);
-  }
-
-  const std::string tapePoolName = "TestTapePool";
-  const uint16_t nbPartialTapes = 1;
-  ASSERT_NO_THROW(scheduler.createTapePool(s_adminOnAdminHost, tapePoolName,
-    nbPartialTapes, comment));
-
-  {
-    std::list<TapePool> tapePools;
-    ASSERT_NO_THROW(tapePools = scheduler.getTapePools(s_adminOnAdminHost));
-    ASSERT_EQ(1, tapePools.size());
-
-    TapePool tapePool;
-    ASSERT_NO_THROW(tapePool = tapePools.front());
-    ASSERT_EQ(tapePoolName, tapePool.name);
-  }
-
-  const uint16_t copyNb = 1;
-  ASSERT_NO_THROW(scheduler.createArchiveRoute(s_adminOnAdminHost, storageClassName,
-    copyNb, tapePoolName, comment));
-
-  {
-    std::list<common::archiveRoute::ArchiveRoute> archiveRoutes;
-    ASSERT_NO_THROW(archiveRoutes = scheduler.getArchiveRoutes(
-      s_adminOnAdminHost));
-    ASSERT_EQ(1, archiveRoutes.size());
-
-    common::archiveRoute::ArchiveRoute archiveRoute;
-    ASSERT_NO_THROW(archiveRoute = archiveRoutes.front());
-    ASSERT_EQ(storageClassName, archiveRoute.storageClassName);
-    ASSERT_EQ(copyNb, archiveRoute.copyNb);
-    ASSERT_EQ(tapePoolName, archiveRoute.tapePoolName);
-  }
-
-  ASSERT_THROW(scheduler.deleteStorageClass(s_adminOnAdminHost, storageClassName),
-    std::exception);
-
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnAdminHost));
-    ASSERT_EQ(1, storageClasses.size());
-
-    StorageClass storageClass;
-    ASSERT_NO_THROW(storageClass = storageClasses.front());
-    ASSERT_EQ(storageClassName, storageClass.name);
-    ASSERT_EQ(nbCopies, storageClass.nbCopies);
-  }
-
-  ASSERT_NO_THROW(scheduler.deleteArchiveRoute(s_adminOnAdminHost, storageClassName,
-    copyNb));
-
-  {
-    std::list<common::archiveRoute::ArchiveRoute> archiveRoutes;
-    ASSERT_NO_THROW(archiveRoutes = scheduler.getArchiveRoutes(
-      s_adminOnAdminHost));
-    ASSERT_TRUE(archiveRoutes.empty());
-  }
-
-  ASSERT_NO_THROW(scheduler.deleteStorageClass(s_adminOnAdminHost, storageClassName));
-
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnAdminHost));
-    ASSERT_TRUE(storageClasses.empty());
-  }
-}
-
-TEST_P(SchedulerTest, admin_deleteStorageClass_non_existing) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-  
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(s_adminOnAdminHost));
-    ASSERT_TRUE(storageClasses.empty());
-  }
-
-  const std::string name = "TestStorageClass";
-  ASSERT_THROW(scheduler.deleteStorageClass(s_adminOnAdminHost, name), std::exception);
-
-  {
-    std::list<StorageClass> storageClasses;
-    ASSERT_NO_THROW(storageClasses = scheduler.getStorageClasses(
-      s_adminOnAdminHost));
-    ASSERT_TRUE(storageClasses.empty());
-  }
-}
-
-TEST_P(SchedulerTest, admin_deleteTapePool_in_use) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  {
-    std::list<common::archiveRoute::ArchiveRoute> archiveRoutes;
-    ASSERT_NO_THROW(archiveRoutes = scheduler.getArchiveRoutes(
-      s_adminOnAdminHost));
-    ASSERT_TRUE(archiveRoutes.empty());
-  }
-
-  const std::string storageClassName = "TestStorageClass";
-  const std::string comment = "Comment";
-  {
-    const uint16_t nbCopies = 2;
-    ASSERT_NO_THROW(scheduler.createStorageClass(s_adminOnAdminHost, storageClassName,
-      nbCopies, comment));
-  }
-
-  const std::string tapePoolName = "TestTapePool";
-  const uint16_t nbPartialTapes = 1;
-  ASSERT_NO_THROW(scheduler.createTapePool(s_adminOnAdminHost, tapePoolName,
-    nbPartialTapes, comment));
-
-  const uint16_t copyNb = 1;
-  ASSERT_NO_THROW(scheduler.createArchiveRoute(s_adminOnAdminHost, storageClassName,
-    copyNb, tapePoolName, comment));
-
-  {
-    std::list<common::archiveRoute::ArchiveRoute> archiveRoutes;
-    ASSERT_NO_THROW(archiveRoutes = scheduler.getArchiveRoutes(
-      s_adminOnAdminHost));
-    ASSERT_EQ(1, archiveRoutes.size());
-
-    common::archiveRoute::ArchiveRoute archiveRoute;
-    ASSERT_NO_THROW(archiveRoute = archiveRoutes.front());
-    ASSERT_EQ(storageClassName, archiveRoute.storageClassName);
-    ASSERT_EQ(copyNb, archiveRoute.copyNb);
-    ASSERT_EQ(tapePoolName, archiveRoute.tapePoolName);
-  }
-
-  ASSERT_THROW(scheduler.deleteTapePool(s_adminOnAdminHost, tapePoolName), std::exception);
-
-  {
-    std::list<common::archiveRoute::ArchiveRoute> archiveRoutes;
-    ASSERT_NO_THROW(archiveRoutes = scheduler.getArchiveRoutes(
-      s_adminOnAdminHost));
-    ASSERT_EQ(1, archiveRoutes.size());
-
-    common::archiveRoute::ArchiveRoute archiveRoute;
-    ASSERT_NO_THROW(archiveRoute = archiveRoutes.front());
-    ASSERT_EQ(storageClassName, archiveRoute.storageClassName);
-    ASSERT_EQ(copyNb, archiveRoute.copyNb);
-    ASSERT_EQ(tapePoolName, archiveRoute.tapePoolName);
-  }
-}
-
-TEST_P(SchedulerTest, admin_createArchiveRoute_new) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  {
-    std::list<common::archiveRoute::ArchiveRoute> archiveRoutes;
-    ASSERT_NO_THROW(archiveRoutes = scheduler.getArchiveRoutes(
-      s_adminOnAdminHost));
-    ASSERT_TRUE(archiveRoutes.empty());
-  }
-
-  const std::string storageClassName = "TestStorageClass";
-  const std::string comment = "Comment";
-  {
-    const uint16_t nbCopies = 2;
-    ASSERT_NO_THROW(scheduler.createStorageClass(s_adminOnAdminHost, storageClassName,
-      nbCopies, comment));
-  }
-
-  const std::string tapePoolName = "TestTapePool";
-  const uint16_t nbPartialTapes = 1;
-  ASSERT_NO_THROW(scheduler.createTapePool(s_adminOnAdminHost, tapePoolName,
-    nbPartialTapes, comment));
-
-  const uint16_t copyNb = 1;
-  ASSERT_NO_THROW(scheduler.createArchiveRoute(s_adminOnAdminHost, storageClassName,
-    copyNb, tapePoolName, comment));
-
-  {
-    std::list<common::archiveRoute::ArchiveRoute> archiveRoutes;
-    ASSERT_NO_THROW(archiveRoutes = scheduler.getArchiveRoutes(
-      s_adminOnAdminHost));
-    ASSERT_EQ(1, archiveRoutes.size());
-
-    common::archiveRoute::ArchiveRoute archiveRoute;
-    ASSERT_NO_THROW(archiveRoute = archiveRoutes.front());
-    ASSERT_EQ(storageClassName, archiveRoute.storageClassName);
-    ASSERT_EQ(copyNb, archiveRoute.copyNb);
-    ASSERT_EQ(tapePoolName, archiveRoute.tapePoolName);
-  }
-}
-
-TEST_P(SchedulerTest,
-  admin_createArchiveRoute_already_existing) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  {
-    std::list<common::archiveRoute::ArchiveRoute> archiveRoutes;
-    ASSERT_NO_THROW(archiveRoutes = scheduler.getArchiveRoutes(s_adminOnAdminHost));
-    ASSERT_TRUE(archiveRoutes.empty());
-  }
-
-  const std::string storageClassName = "TestStorageClass";
-  const std::string comment = "Comment";
-  {
-    const uint16_t nbCopies = 2;
-    ASSERT_NO_THROW(scheduler.createStorageClass(s_adminOnAdminHost, storageClassName,
-      nbCopies, comment));
-  }
-
-  const std::string tapePoolName = "TestTapePool";
-  const uint16_t nbPartialTapes = 1;
-  ASSERT_NO_THROW(scheduler.createTapePool(s_adminOnAdminHost, tapePoolName,
-    nbPartialTapes, comment));
-
-  const uint16_t copyNb = 1;
-  ASSERT_NO_THROW(scheduler.createArchiveRoute(s_adminOnAdminHost, storageClassName,
-    copyNb, tapePoolName, comment));
-
-  {
-    std::list<common::archiveRoute::ArchiveRoute> archiveRoutes;
-    ASSERT_NO_THROW(archiveRoutes = scheduler.getArchiveRoutes(
-      s_adminOnAdminHost));
-    ASSERT_EQ(1, archiveRoutes.size());
-
-    common::archiveRoute::ArchiveRoute archiveRoute;
-    ASSERT_NO_THROW(archiveRoute = archiveRoutes.front());
-    ASSERT_EQ(storageClassName, archiveRoute.storageClassName);
-    ASSERT_EQ(copyNb, archiveRoute.copyNb);
-    ASSERT_EQ(tapePoolName, archiveRoute.tapePoolName);
-  }
-
-  ASSERT_THROW(scheduler.createArchiveRoute(s_adminOnAdminHost, storageClassName,
-    copyNb, tapePoolName, comment), std::exception);
-}
-
-TEST_P(SchedulerTest, admin_deleteArchiveRoute_existing) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  {
-    std::list<common::archiveRoute::ArchiveRoute> archiveRoutes;
-    ASSERT_NO_THROW(archiveRoutes = scheduler.getArchiveRoutes(
-      s_adminOnAdminHost));
-    ASSERT_TRUE(archiveRoutes.empty());
-  }
-
-  const std::string storageClassName = "TestStorageClass";
-  const std::string comment = "Comment";
-  {
-    const uint16_t nbCopies = 2;
-    ASSERT_NO_THROW(scheduler.createStorageClass(s_adminOnAdminHost, storageClassName,
-      nbCopies, comment));
-  }
-
-  const std::string tapePoolName = "TestTapePool";
-  const uint16_t nbPartialTapes = 1;
-  ASSERT_NO_THROW(scheduler.createTapePool(s_adminOnAdminHost, tapePoolName,
-    nbPartialTapes, comment));
-
-  const uint16_t copyNb = 1;
-  ASSERT_NO_THROW(scheduler.createArchiveRoute(s_adminOnAdminHost, storageClassName,
-    copyNb, tapePoolName, comment));
-
-  {
-    std::list<common::archiveRoute::ArchiveRoute> archiveRoutes;
-    ASSERT_NO_THROW(archiveRoutes = scheduler.getArchiveRoutes(
-      s_adminOnAdminHost));
-    ASSERT_EQ(1, archiveRoutes.size());
-
-    common::archiveRoute::ArchiveRoute archiveRoute;
-    ASSERT_NO_THROW(archiveRoute = archiveRoutes.front());
-    ASSERT_EQ(storageClassName, archiveRoute.storageClassName);
-    ASSERT_EQ(copyNb, archiveRoute.copyNb);
-    ASSERT_EQ(tapePoolName, archiveRoute.tapePoolName);
-  }
-
-  ASSERT_NO_THROW(scheduler.deleteArchiveRoute(s_adminOnAdminHost, storageClassName,
-    copyNb));
-
-  {
-    std::list<common::archiveRoute::ArchiveRoute> archiveRoutes;
-    ASSERT_NO_THROW(archiveRoutes = scheduler.getArchiveRoutes(s_adminOnAdminHost));
-    ASSERT_TRUE(archiveRoutes.empty());
-  }
-}
-
-TEST_P(SchedulerTest, admin_deleteArchiveRoute_non_existing) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  {
-    std::list<common::archiveRoute::ArchiveRoute> archiveRoutes;
-    ASSERT_NO_THROW(archiveRoutes = scheduler.getArchiveRoutes(
-      s_adminOnAdminHost));
-    ASSERT_TRUE(archiveRoutes.empty());
-  }
-
-  const std::string storageClassName = "TestStorageClass";
-  const std::string comment = "Comment";
-  {
-    const uint16_t nbCopies = 2;
-    ASSERT_NO_THROW(scheduler.createStorageClass(s_adminOnAdminHost, storageClassName,
-      nbCopies, comment));
-  }
-
-  const std::string tapePoolName = "TestTapePool";
-  const uint16_t nbPartialTapes = 1;
-  ASSERT_NO_THROW(scheduler.createTapePool(s_adminOnAdminHost, tapePoolName,
-    nbPartialTapes, comment));
-
-  const uint16_t copyNb = 1;
-  ASSERT_THROW(scheduler.deleteArchiveRoute(s_adminOnAdminHost, tapePoolName, copyNb),
-    std::exception);
-}
-
-TEST_P(SchedulerTest, admin_createTape_new) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  {
-    std::list<LogicalLibrary> libraries;
-    ASSERT_NO_THROW(libraries = scheduler.getLogicalLibraries(
-      s_adminOnAdminHost));
-    ASSERT_TRUE(libraries.empty());
-  }
-
-  {
-    std::list<TapePool> pools;
-    ASSERT_NO_THROW(pools = scheduler.getTapePools(s_adminOnAdminHost));
-    ASSERT_TRUE(pools.empty());
-  }
-
-  {
-    std::list<Tape> tapes;
-    ASSERT_NO_THROW(tapes = scheduler.getTapes(s_adminOnAdminHost));
-    ASSERT_TRUE(tapes.empty());
-  }
-
-  const std::string libraryName = "TestLogicalLibrary";
-  const std::string libraryComment = "Library comment";
-  ASSERT_NO_THROW(scheduler.createLogicalLibrary(s_adminOnAdminHost, libraryName,
-    libraryComment));
-  {
-    std::list<LogicalLibrary> libraries;
-    ASSERT_NO_THROW(libraries = scheduler.getLogicalLibraries(
-      s_adminOnAdminHost));
-    ASSERT_EQ(1, libraries.size());
-  
-    LogicalLibrary logicalLibrary;
-    ASSERT_NO_THROW(logicalLibrary = libraries.front());
-    ASSERT_EQ(libraryName, logicalLibrary.name);
-    ASSERT_EQ(libraryComment, logicalLibrary.creationLog.comment);
-  }
-
-  const std::string tapePoolName = "TestTapePool";
-  const uint16_t nbPartialTapes = 1;
-  const std::string comment = "Tape pool comment";
-  ASSERT_NO_THROW(scheduler.createTapePool(s_adminOnAdminHost, tapePoolName,
-    nbPartialTapes, comment));
-  {
-    std::list<TapePool> tapePools;
-    ASSERT_NO_THROW(tapePools = scheduler.getTapePools(s_adminOnAdminHost));
-    ASSERT_EQ(1, tapePools.size());
-    
-    TapePool tapePool;
-    ASSERT_NO_THROW(tapePool = tapePools.front());
-    ASSERT_EQ(tapePoolName, tapePool.name);
-    ASSERT_EQ(comment, tapePool.creationLog.comment);
-  } 
-
-  const std::string vid = "TestVid";
-  const uint64_t capacityInBytes = 12345678;
-  const std::string tapeComment = "Tape comment";
-  ASSERT_NO_THROW(scheduler.createTape(s_adminOnAdminHost, vid, libraryName, tapePoolName,
-    capacityInBytes, tapeComment));
-  {
-    std::list<Tape> tapes;
-    ASSERT_NO_THROW(tapes = scheduler.getTapes(s_adminOnAdminHost));
-    ASSERT_EQ(1, tapes.size()); 
-  
-    Tape tape;
-    ASSERT_NO_THROW(tape = tapes.front());
-    ASSERT_EQ(vid, tape.vid);
-    ASSERT_EQ(libraryName, tape.logicalLibraryName);
-    ASSERT_EQ(tapePoolName, tape.tapePoolName);
-    ASSERT_EQ(capacityInBytes, tape.capacityInBytes);
-    ASSERT_EQ(0, tape.dataOnTapeInBytes);
-    ASSERT_EQ(tapeComment, tape.creationLog.comment);
-  } 
-
-  {
-    Tape tape;
-    ASSERT_NO_THROW(tape = scheduler.getTape(s_adminOnAdminHost, vid));
-    ASSERT_EQ(vid, tape.vid);
-    ASSERT_EQ(libraryName, tape.logicalLibraryName);
-    ASSERT_EQ(tapePoolName, tape.tapePoolName);
-    ASSERT_EQ(capacityInBytes, tape.capacityInBytes);
-    ASSERT_EQ(0, tape.dataOnTapeInBytes);
-    ASSERT_EQ(tapeComment, tape.creationLog.comment);
-  }
-}
-
-TEST_P(SchedulerTest,
-  admin_createTape_new_non_existing_library) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  {
-    std::list<LogicalLibrary> libraries;
-    ASSERT_NO_THROW(libraries = scheduler.getLogicalLibraries(
-      s_adminOnAdminHost));
-    ASSERT_TRUE(libraries.empty());
-  }
-
-  {
-    std::list<TapePool> pools;
-    ASSERT_NO_THROW(pools = scheduler.getTapePools(s_adminOnAdminHost));
-    ASSERT_TRUE(pools.empty());
-  }
-
-  {
-    std::list<Tape> tapes;
-    ASSERT_NO_THROW(tapes = scheduler.getTapes(s_adminOnAdminHost));
-    ASSERT_TRUE(tapes.empty());
-  }
-
-  const std::string libraryName = "TestLogicalLibrary";
-
-  const std::string tapePoolName = "TestTapePool";
-  const uint16_t nbPartialTapes = 1;
-  const std::string comment = "Tape pool comment";
-  ASSERT_NO_THROW(scheduler.createTapePool(s_adminOnAdminHost, tapePoolName,
-    nbPartialTapes, comment));
-  {
-    std::list<TapePool> tapePools;
-    ASSERT_NO_THROW(tapePools = scheduler.getTapePools(
-      s_adminOnAdminHost));
-    ASSERT_EQ(1, tapePools.size());
-    
-    TapePool tapePool;
-    ASSERT_NO_THROW(tapePool = tapePools.front());
-    ASSERT_EQ(tapePoolName, tapePool.name);
-    ASSERT_EQ(comment, tapePool.creationLog.comment);
-  } 
-
-  const std::string vid = "TestVid";
-  const uint64_t capacityInBytes = 12345678;
-  const std::string tapeComment = "Tape comment";
-  ASSERT_THROW(scheduler.createTape(s_adminOnAdminHost, vid, libraryName, tapePoolName,
-    capacityInBytes, tapeComment), std::exception);
-}
-
-TEST_P(SchedulerTest, admin_createTape_new_non_existing_pool) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  {
-    std::list<LogicalLibrary> libraries;
-    ASSERT_NO_THROW(libraries = scheduler.getLogicalLibraries(
-      s_adminOnAdminHost));
-    ASSERT_TRUE(libraries.empty());
-  }
-
-  {
-    std::list<TapePool> pools;
-    ASSERT_NO_THROW(pools = scheduler.getTapePools(s_adminOnAdminHost));
-    ASSERT_TRUE(pools.empty());
-  }
-
-  {
-    std::list<Tape> tapes;
-    ASSERT_NO_THROW(tapes = scheduler.getTapes(s_adminOnAdminHost));
-    ASSERT_TRUE(tapes.empty());
-  }
-
-  const std::string libraryName = "TestLogicalLibrary";
-  const std::string libraryComment = "Library comment";
-  ASSERT_NO_THROW(scheduler.createLogicalLibrary(s_adminOnAdminHost, libraryName,
-    libraryComment));
-  {
-    std::list<LogicalLibrary> libraries;
-    ASSERT_NO_THROW(libraries = scheduler.getLogicalLibraries(s_adminOnAdminHost));
-    ASSERT_EQ(1, libraries.size());
-  
-    LogicalLibrary logicalLibrary;
-    ASSERT_NO_THROW(logicalLibrary = libraries.front());
-    ASSERT_EQ(libraryName, logicalLibrary.name);
-    ASSERT_EQ(libraryComment, logicalLibrary.creationLog.comment);
-  }
-
-  const std::string tapePoolName = "TestTapePool";
-
-  const std::string vid = "TestVid";
-  const uint64_t capacityInBytes = 12345678;
-  const std::string tapeComment = "Tape comment";
-  ASSERT_THROW(scheduler.createTape(s_adminOnAdminHost, vid, libraryName, tapePoolName,
-    capacityInBytes, tapeComment), std::exception);
-}
-
-TEST_P(SchedulerTest, getDirContents_root_dir_is_empty) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  common::archiveNS::ArchiveDirIterator itor;
-  ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-  ASSERT_FALSE(itor.hasMore());
-}
-
-TEST_P(SchedulerTest, createDir_empty_string) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  const std::string dirPath = "";
-
-  const uint16_t mode = 0777;
-  ASSERT_THROW(scheduler.createDir(s_userOnUserHost, dirPath, mode),
-    std::exception);
-}
-
-TEST_P(SchedulerTest, createDir_consecutive_slashes) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  const std::string dirPath = "//";
-  const uint16_t mode = 0777;
-  ASSERT_THROW(scheduler.createDir(s_userOnUserHost, dirPath, mode),
-    std::exception);
-}
-
-TEST_P(SchedulerTest, createDir_invalid_chars) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  const std::string dirPath = "/?grandparent";
-  
-  const uint16_t mode = 0777;
-  ASSERT_THROW(scheduler.createDir(s_userOnUserHost, dirPath, mode),
-    std::exception);
-}
-
-TEST_P(SchedulerTest, createDir_top_level) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  const std::string dirPath = "/grandparent";
-  
-  const uint16_t mode = 0777;
-  ASSERT_NO_THROW(scheduler.createDir(s_userOnUserHost, dirPath, mode));
-
-  common::archiveNS::ArchiveDirIterator itor;
-
-  ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-
-  ASSERT_TRUE(itor.hasMore());
-
-  common::archiveNS::ArchiveDirEntry entry;
-
-  ASSERT_NO_THROW(entry = itor.next());
-
-  ASSERT_EQ(std::string("grandparent"), entry.name);
-}
-
-TEST_P(SchedulerTest, createDir_second_level) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  ASSERT_TRUE(scheduler.getDirStorageClass(s_userOnUserHost, "/").empty());
-
-  {
-    const std::string topLevelDirPath = "/grandparent";
-    const uint16_t mode = 0777;
-
-    ASSERT_NO_THROW(scheduler.createDir(s_userOnUserHost, topLevelDirPath,
-      mode));
-  }
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-
-    ASSERT_TRUE(itor.hasMore());
-
-    common::archiveNS::ArchiveDirEntry entry;
-
-    ASSERT_NO_THROW(entry = itor.next());
-
-    ASSERT_EQ(std::string("grandparent"), entry.name);
-  }
-
-  ASSERT_TRUE(scheduler.getDirStorageClass(s_userOnUserHost, "/grandparent").empty());
-
-  {
-    const std::string secondLevelDirPath = "/grandparent/parent";
-    const uint16_t mode = 0777;
-
-    ASSERT_NO_THROW(scheduler.createDir(s_userOnUserHost, secondLevelDirPath,
-      mode));
-  }
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-
-    ASSERT_TRUE(itor.hasMore());
-
-    common::archiveNS::ArchiveDirEntry entry;
-
-    ASSERT_NO_THROW(entry = itor.next());
-
-    ASSERT_EQ(std::string("grandparent"), entry.name);
-  }
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost,
-      "/grandparent"));
-
-    ASSERT_TRUE(itor.hasMore());
-
-    common::archiveNS::ArchiveDirEntry entry;
-
-    ASSERT_NO_THROW(entry = itor.next());
-
-    ASSERT_EQ(std::string("parent"), entry.name);
-  }
-
-  ASSERT_TRUE(scheduler.getDirStorageClass(s_userOnUserHost,
-    "/grandparent/parent").empty());
-}
-
-TEST_P(SchedulerTest,
-  createDir_inherit_storage_class) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  ASSERT_TRUE(scheduler.getDirStorageClass(s_userOnUserHost, "/").empty());
-
-  {
-    const std::string name = "TestStorageClass";
-    const uint16_t nbCopies = 2;
-    const std::string comment = "Comment";
-    ASSERT_NO_THROW(scheduler.createStorageClass(s_adminOnAdminHost, name,
-      nbCopies, comment));
-  }
-
-  {
-    const std::string topLevelDirPath = "/grandparent";
-    const uint16_t mode = 0777;
-
-    ASSERT_NO_THROW(scheduler.createDir(s_userOnUserHost, topLevelDirPath,
-      mode));
-  }
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-
-    ASSERT_TRUE(itor.hasMore());
-
-    common::archiveNS::ArchiveDirEntry entry;
-
-    ASSERT_NO_THROW(entry = itor.next());
-
-    ASSERT_EQ(std::string("grandparent"), entry.name);
-
-    ASSERT_TRUE(scheduler.getDirStorageClass(s_userOnUserHost, "/grandparent").empty());
-
-    ASSERT_NO_THROW(scheduler.setDirStorageClass(s_userOnUserHost, "/grandparent",
-      "TestStorageClass"));
-  }
-
-  ASSERT_EQ(std::string("TestStorageClass"),
-    scheduler.getDirStorageClass(s_userOnUserHost, "/grandparent"));
-
-  {
-    const std::string secondLevelDirPath = "/grandparent/parent";
-    const uint16_t mode = 0777;
-
-    ASSERT_NO_THROW(scheduler.createDir(s_userOnUserHost, secondLevelDirPath,
-      mode));
-  }
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-
-    ASSERT_TRUE(itor.hasMore());
-
-    common::archiveNS::ArchiveDirEntry entry;
-
-    ASSERT_NO_THROW(entry = itor.next());
-
-    ASSERT_EQ(std::string("grandparent"), entry.name);
-  }
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/grandparent"));
-
-    ASSERT_TRUE(itor.hasMore());
-
-    common::archiveNS::ArchiveDirEntry entry;
-
-    ASSERT_NO_THROW(entry = itor.next());
-
-    ASSERT_EQ(std::string("parent"), entry.name);
-  }
-
-  ASSERT_EQ(std::string("TestStorageClass"),
-    scheduler.getDirStorageClass(s_userOnUserHost, "/grandparent/parent"));
-}
-
-TEST_P(SchedulerTest, deleteDir_root) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  const std::string dirPath = "/";
-
-  ASSERT_THROW(scheduler.deleteDir(s_userOnUserHost, "/"), std::exception);
-}
-
-TEST_P(SchedulerTest, deleteDir_existing_top_level) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  const std::string dirPath = "/grandparent";
-  const uint16_t mode = 0777;
-  
-  ASSERT_NO_THROW(scheduler.createDir(s_userOnUserHost, dirPath, mode));
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-
-    ASSERT_TRUE(itor.hasMore());
-
-    common::archiveNS::ArchiveDirEntry entry;
-
-    ASSERT_NO_THROW(entry = itor.next());
-
-    ASSERT_EQ(std::string("grandparent"), entry.name);
-  }
-
-  ASSERT_NO_THROW(scheduler.deleteDir(s_userOnUserHost, "/grandparent"));
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-  
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-  
-    ASSERT_FALSE(itor.hasMore());
-  }
-}
-
-TEST_P(SchedulerTest,
-  deleteDir_non_empty_top_level) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  {
-    const std::string topLevelDirPath = "/grandparent";
-    const uint16_t mode = 0777;
-
-    ASSERT_NO_THROW(scheduler.createDir(s_userOnUserHost, topLevelDirPath,
-      mode));
-
-    common::archiveNS::ArchiveDirIterator itor;
-
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-
-    ASSERT_TRUE(itor.hasMore());
-
-    common::archiveNS::ArchiveDirEntry entry;
-
-    ASSERT_NO_THROW(entry = itor.next());
-
-    ASSERT_EQ(std::string("grandparent"), entry.name);
-  }
-
-  {
-    const std::string secondLevelDirPath = "/grandparent/parent";
-    const uint16_t mode = 0777;
-
-    ASSERT_NO_THROW(scheduler.createDir(s_userOnUserHost, secondLevelDirPath,
-      mode));
-
-    common::archiveNS::ArchiveDirIterator itor;
-
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-
-    ASSERT_TRUE(itor.hasMore());
-
-    common::archiveNS::ArchiveDirEntry entry;
-
-    ASSERT_NO_THROW(entry = itor.next());
-
-    ASSERT_EQ(std::string("grandparent"), entry.name);
-  }
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/grandparent"));
-
-    ASSERT_TRUE(itor.hasMore());
-
-    common::archiveNS::ArchiveDirEntry entry;
-
-    ASSERT_NO_THROW(entry = itor.next());
-
-    ASSERT_EQ(std::string("parent"), entry.name);
-  }
-
-  ASSERT_THROW(scheduler.deleteDir(s_userOnUserHost, "/grandparent"), std::exception);
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/grandparent"));
-
-    ASSERT_TRUE(itor.hasMore());
-
-    common::archiveNS::ArchiveDirEntry entry;
-
-    ASSERT_NO_THROW(entry = itor.next());
-
-    ASSERT_EQ(std::string("parent"), entry.name);
-  }
-}
-
-TEST_P(SchedulerTest, deleteDir_non_existing_top_level) {
-  using namespace cta;
-  
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  ASSERT_THROW(scheduler.deleteDir(s_userOnUserHost, "/grandparent"), std::exception);
-}
-
-TEST_P(SchedulerTest, setDirStorageClass_top_level) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  const std::string dirPath = "/grandparent";
-  const uint16_t mode = 0777;
-
-  ASSERT_NO_THROW(scheduler.createDir(s_userOnUserHost, dirPath, mode));
-
-  common::archiveNS::ArchiveDirIterator itor;
-
-  ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-
-  ASSERT_TRUE(itor.hasMore());
-
-  common::archiveNS::ArchiveDirEntry entry;
-
-  ASSERT_NO_THROW(entry = itor.next());
-
-  ASSERT_EQ(std::string("grandparent"), entry.name);
-
-  {
-    std::string name;
-    ASSERT_NO_THROW(name = scheduler.getDirStorageClass(s_userOnUserHost, dirPath));
-    ASSERT_TRUE(name.empty());
-  }
-
-  const std::string storageClassName = "TestStorageClass";
-  const uint16_t nbCopies = 2;
-    const std::string comment = "Comment";
-  {
-    ASSERT_NO_THROW(scheduler.createStorageClass(s_adminOnAdminHost, storageClassName,
-      nbCopies, comment));
-  }
-
-  ASSERT_NO_THROW(scheduler.setDirStorageClass(s_userOnUserHost, dirPath,
-    storageClassName));
-
-  {
-    std::string name;
-    ASSERT_NO_THROW(name = scheduler.getDirStorageClass(s_userOnUserHost, dirPath));
-    ASSERT_EQ(storageClassName, name);
-  }
-}
-
-TEST_P(SchedulerTest, clearDirStorageClass_top_level) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  const std::string dirPath = "/grandparent";
-  const uint16_t mode = 0777;
-
-  ASSERT_NO_THROW(scheduler.createDir(s_userOnUserHost, dirPath, mode));
-
-  common::archiveNS::ArchiveDirIterator itor;
-
-  ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-
-  ASSERT_TRUE(itor.hasMore());
-
-  common::archiveNS::ArchiveDirEntry entry;
-
-  ASSERT_NO_THROW(entry = itor.next());
-
-  ASSERT_EQ(std::string("grandparent"), entry.name);
-
-  {
-    std::string name;
-    ASSERT_NO_THROW(name = scheduler.getDirStorageClass(s_userOnUserHost, dirPath));
-    ASSERT_TRUE(name.empty());
-  }
-
-  const std::string storageClassName = "TestStorageClass";
-  const uint16_t nbCopies = 2;
-  const std::string comment = "Comment";
-  ASSERT_NO_THROW(scheduler.createStorageClass(s_adminOnAdminHost, storageClassName,
-    nbCopies, comment));
-
-  ASSERT_NO_THROW(scheduler.setDirStorageClass(s_userOnUserHost, dirPath,
-    storageClassName));
-
-  {
-    std::string name;
-    ASSERT_NO_THROW(name = scheduler.getDirStorageClass(s_userOnUserHost, dirPath));
-    ASSERT_EQ(storageClassName, name);
-  }
-
-  ASSERT_THROW(scheduler.deleteStorageClass(s_adminOnAdminHost, storageClassName),
-    std::exception);
-
-  ASSERT_NO_THROW(scheduler.clearDirStorageClass(s_userOnUserHost, dirPath));
-
-  {
-    std::string name;
-    ASSERT_NO_THROW(name = scheduler.getDirStorageClass(s_userOnUserHost, dirPath));
-    ASSERT_TRUE(name.empty());
-  }
-
-  ASSERT_NO_THROW(scheduler.deleteStorageClass(s_adminOnAdminHost, storageClassName));
-}
-
-TEST_P(SchedulerTest, archive_to_new_file) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  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_userOnUserHost, dirPath, mode));
-  ASSERT_NO_THROW(scheduler.setDirStorageClass(s_userOnUserHost, 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 archiveRouteComment = "Archive-route comment";
-  ASSERT_NO_THROW(scheduler.createArchiveRoute(s_adminOnAdminHost, storageClassName,
-    copyNb, tapePoolName, archiveRouteComment));
-
-  std::list<std::string> remoteFiles;
-  remoteFiles.push_back(s_remoteFileRawPath1);
-  const std::string archiveFile  = "/grandparent/parent_file";
-  ASSERT_NO_THROW(scheduler.queueArchiveRequest(s_userOnUserHost, remoteFiles, archiveFile));
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-    ASSERT_TRUE(itor.hasMore());
-    common::archiveNS::ArchiveDirEntry entry;
-    ASSERT_NO_THROW(entry = itor.next());
-    ASSERT_EQ(std::string("grandparent"), entry.name);
-    ASSERT_EQ(common::archiveNS::ArchiveDirEntry::ENTRYTYPE_DIRECTORY, entry.type);
-    ASSERT_EQ(storageClassName, entry.status.storageClassName);
-  }
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost,
-      "/grandparent"));
-    ASSERT_TRUE(itor.hasMore());
-    common::archiveNS::ArchiveDirEntry entry;
-    ASSERT_NO_THROW(entry = itor.next());
-    ASSERT_EQ(std::string("parent_file"), entry.name);
-    ASSERT_EQ(common::archiveNS::ArchiveDirEntry::ENTRYTYPE_FILE, entry.type);
-    ASSERT_EQ(storageClassName, entry.status.storageClassName);
-  }
-
-  {
-    std::unique_ptr<common::archiveNS::ArchiveFileStatus> status;
-    ASSERT_NO_THROW(status = scheduler.statArchiveFile(s_userOnUserHost,
-      archiveFile));
-    ASSERT_TRUE(status.get());
-    ASSERT_EQ(storageClassName, status->storageClassName);
-  }
-
-  {
-    decltype(scheduler.getArchiveRequests(s_userOnUserHost)) rqsts;
-    ASSERT_NO_THROW(rqsts = scheduler.getArchiveRequests(s_userOnUserHost));
-    ASSERT_EQ(1, rqsts.size());
-    auto poolItor = rqsts.cbegin();
-    ASSERT_FALSE(poolItor == rqsts.cend());
-    const TapePool &pool = poolItor->first;
-    ASSERT_TRUE(tapePoolName == pool.name);
-    auto poolRqsts = poolItor->second;
-    ASSERT_EQ(1, poolRqsts.size());
-    std::set<std::string> remoteFiles;
-    std::set<std::string> archiveFiles;
-    for(auto rqstItor = poolRqsts.cbegin();
-      rqstItor != poolRqsts.cend(); rqstItor++) {
-      remoteFiles.insert(rqstItor->remoteFile.path.getRaw());
-      archiveFiles.insert(rqstItor->archiveFile);
-    }
-    ASSERT_EQ(1, remoteFiles.size());
-    ASSERT_FALSE(remoteFiles.find(s_remoteFileRawPath1) == remoteFiles.end());
-    ASSERT_EQ(1, archiveFiles.size());
-    ASSERT_FALSE(archiveFiles.find("/grandparent/parent_file") ==
-      archiveFiles.end());
-  }
-
-  {
-    const auto poolRqsts = scheduler.getArchiveRequests(s_userOnUserHost,
-      tapePoolName);
-    ASSERT_EQ(1, poolRqsts.size());
-    std::set<std::string> remoteFiles;
-    std::set<std::string> archiveFiles;
-    for(auto rqstItor = poolRqsts.cbegin(); rqstItor != poolRqsts.cend();
-      rqstItor++) {
-      remoteFiles.insert(rqstItor->remoteFile.path.getRaw());
-      archiveFiles.insert(rqstItor->archiveFile);
-    }
-    ASSERT_EQ(1, remoteFiles.size());
-    ASSERT_FALSE(remoteFiles.find(s_remoteFileRawPath1) == remoteFiles.end());
-    ASSERT_EQ(1, archiveFiles.size());
-    ASSERT_FALSE(archiveFiles.find("/grandparent/parent_file") == archiveFiles.end());
-  }
-}
-
-TEST_P(SchedulerTest, archive_to_new_user_file_as_admin) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  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_userOnUserHost, dirPath, mode));
-  ASSERT_NO_THROW(scheduler.setDirStorageClass(s_userOnUserHost, 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 archiveRouteComment = "Archive-route comment";
-  ASSERT_NO_THROW(scheduler.createArchiveRoute(s_adminOnAdminHost, storageClassName,
-    copyNb, tapePoolName, archiveRouteComment));
-
-  std::list<std::string> remoteFiles;
-  remoteFiles.push_back(s_remoteFileRawPath1);
-  const std::string archiveFile  = "/grandparent/parent_file";
-  ASSERT_THROW(scheduler.queueArchiveRequest(s_adminOnAdminHost, remoteFiles, archiveFile), std::exception);
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-    ASSERT_TRUE(itor.hasMore());
-    common::archiveNS::ArchiveDirEntry entry;
-    ASSERT_NO_THROW(entry = itor.next());
-    ASSERT_EQ(std::string("grandparent"), entry.name);
-    ASSERT_EQ(common::archiveNS::ArchiveDirEntry::ENTRYTYPE_DIRECTORY, entry.type);
-    ASSERT_EQ(storageClassName, entry.status.storageClassName);
-  }
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost,
-      "/grandparent"));
-    ASSERT_FALSE(itor.hasMore());
-  }
-
-  {
-    ASSERT_NO_THROW(ASSERT_TRUE(scheduler.getArchiveRequests(s_adminOnAdminHost).empty()));
-  }
-
-  {
-    const auto poolRqsts = scheduler.getArchiveRequests(s_userOnUserHost,
-      tapePoolName);
-    ASSERT_TRUE(poolRqsts.empty());
-  }
-}
-
-TEST_P(SchedulerTest, archive_twice_to_same_file) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  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_userOnUserHost, dirPath, mode));
-  ASSERT_NO_THROW(scheduler.setDirStorageClass(s_userOnUserHost, 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 archiveRouteComment = "Archive-route comment";
-  ASSERT_NO_THROW(scheduler.createArchiveRoute(s_adminOnAdminHost, storageClassName,
-    copyNb, tapePoolName, archiveRouteComment));
-
-  std::list<std::string> remoteFiles;
-  remoteFiles.push_back(s_remoteFileRawPath1);
-  const std::string archiveFile  = "/grandparent/parent_file";
-  ASSERT_NO_THROW(scheduler.queueArchiveRequest(s_userOnUserHost, remoteFiles, archiveFile));
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-    ASSERT_TRUE(itor.hasMore());
-    common::archiveNS::ArchiveDirEntry entry;
-    ASSERT_NO_THROW(entry = itor.next());
-    ASSERT_EQ(std::string("grandparent"), entry.name);
-    ASSERT_EQ(common::archiveNS::ArchiveDirEntry::ENTRYTYPE_DIRECTORY, entry.type);
-    ASSERT_EQ(storageClassName, entry.status.storageClassName);
-  }
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost,
-      "/grandparent"));
-    ASSERT_TRUE(itor.hasMore());
-    common::archiveNS::ArchiveDirEntry entry;
-    ASSERT_NO_THROW(entry = itor.next());
-    ASSERT_EQ(std::string("parent_file"), entry.name);
-    ASSERT_EQ(common::archiveNS::ArchiveDirEntry::ENTRYTYPE_FILE, entry.type);
-    ASSERT_EQ(storageClassName, entry.status.storageClassName);
-  }
-
-  {
-    std::unique_ptr<common::archiveNS::ArchiveFileStatus> status;
-    ASSERT_NO_THROW(status = scheduler.statArchiveFile(s_userOnUserHost,
-      archiveFile));
-    ASSERT_TRUE(status.get());
-    ASSERT_EQ(storageClassName, status->storageClassName);
-  }
-
-  {
-    decltype(scheduler.getArchiveRequests(s_userOnUserHost)) rqsts;
-    ASSERT_NO_THROW(rqsts = scheduler.getArchiveRequests(s_userOnUserHost));
-    ASSERT_EQ(1, rqsts.size());
-    auto poolItor = rqsts.cbegin();
-    ASSERT_FALSE(poolItor == rqsts.cend());
-    const TapePool &pool = poolItor->first;
-    ASSERT_TRUE(tapePoolName == pool.name);
-    auto poolRqsts = poolItor->second;
-    ASSERT_EQ(1, poolRqsts.size());
-    std::set<std::string> remoteFiles;
-    std::set<std::string> archiveFiles;
-    for(auto rqstItor = poolRqsts.cbegin();
-      rqstItor != poolRqsts.cend(); rqstItor++) {
-      remoteFiles.insert(rqstItor->remoteFile.path.getRaw());
-      archiveFiles.insert(rqstItor->archiveFile);
-    }
-    ASSERT_EQ(1, remoteFiles.size());
-    ASSERT_FALSE(remoteFiles.find(s_remoteFileRawPath1) == remoteFiles.end());
-    ASSERT_EQ(1, archiveFiles.size());
-    ASSERT_FALSE(archiveFiles.find("/grandparent/parent_file") ==
-      archiveFiles.end());
-  }
-
-  {
-    const auto poolRqsts = scheduler.getArchiveRequests(s_userOnUserHost,
-      tapePoolName);
-    ASSERT_EQ(1, poolRqsts.size());
-    std::set<std::string> remoteFiles;
-    std::set<std::string> archiveFiles;
-    for(auto rqstItor = poolRqsts.cbegin(); rqstItor != poolRqsts.cend();
-      rqstItor++) {
-      remoteFiles.insert(rqstItor->remoteFile.path.getRaw());
-      archiveFiles.insert(rqstItor->archiveFile);
-    }
-    ASSERT_EQ(1, remoteFiles.size());
-    ASSERT_FALSE(remoteFiles.find(s_remoteFileRawPath1) == remoteFiles.end());
-    ASSERT_EQ(1, archiveFiles.size());
-    ASSERT_FALSE(archiveFiles.find("/grandparent/parent_file") == archiveFiles.end());
-  }
-
-  ASSERT_THROW(scheduler.queueArchiveRequest(s_userOnUserHost, remoteFiles, archiveFile), std::exception);
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-    ASSERT_TRUE(itor.hasMore());
-    common::archiveNS::ArchiveDirEntry entry;
-    ASSERT_NO_THROW(entry = itor.next());
-    ASSERT_EQ(std::string("grandparent"), entry.name);
-    ASSERT_EQ(common::archiveNS::ArchiveDirEntry::ENTRYTYPE_DIRECTORY, entry.type);
-    ASSERT_EQ(storageClassName, entry.status.storageClassName);
-  }
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost,
-      "/grandparent"));
-    ASSERT_TRUE(itor.hasMore());
-    common::archiveNS::ArchiveDirEntry entry;
-    ASSERT_NO_THROW(entry = itor.next());
-    ASSERT_EQ(std::string("parent_file"), entry.name);
-    ASSERT_EQ(common::archiveNS::ArchiveDirEntry::ENTRYTYPE_FILE, entry.type);
-    ASSERT_EQ(storageClassName, entry.status.storageClassName);
-  }
-
-  {
-    std::unique_ptr<common::archiveNS::ArchiveFileStatus> status;
-    ASSERT_NO_THROW(status = scheduler.statArchiveFile(s_userOnUserHost,
-      archiveFile));
-    ASSERT_TRUE(status.get());
-    ASSERT_EQ(storageClassName, status->storageClassName);
-  }
-
-  {
-    const auto rqsts = scheduler.getArchiveRequests(s_userOnUserHost);
-    ASSERT_EQ(1, rqsts.size());
-    auto poolItor = rqsts.cbegin();
-    ASSERT_FALSE(poolItor == rqsts.cend());
-    const TapePool &pool = poolItor->first;
-    ASSERT_TRUE(tapePoolName == pool.name);
-    auto poolRqsts = poolItor->second;
-    ASSERT_EQ(1, poolRqsts.size());
-    std::set<std::string> remoteFiles;
-    std::set<std::string> archiveFiles;
-    for(auto rqstItor = poolRqsts.cbegin();
-      rqstItor != poolRqsts.cend(); rqstItor++) {
-      remoteFiles.insert(rqstItor->remoteFile.path.getRaw());
-      archiveFiles.insert(rqstItor->archiveFile);
-    }
-    ASSERT_EQ(1, remoteFiles.size());
-    ASSERT_FALSE(remoteFiles.find(s_remoteFileRawPath1) == remoteFiles.end());
-    ASSERT_EQ(1, archiveFiles.size());
-    ASSERT_FALSE(archiveFiles.find("/grandparent/parent_file") ==
-      archiveFiles.end());
-  }
-}
-
-TEST_P(SchedulerTest, delete_archive_request) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  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_userOnUserHost, dirPath, mode));
-  ASSERT_NO_THROW(scheduler.setDirStorageClass(s_userOnUserHost, 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 archiveRouteComment = "Archive-route comment";
-  ASSERT_NO_THROW(scheduler.createArchiveRoute(s_adminOnAdminHost, storageClassName,
-    copyNb, tapePoolName, archiveRouteComment));
-
-  std::list<std::string> remoteFiles;
-  remoteFiles.push_back(s_remoteFileRawPath1);
-  const std::string archiveFile  = "/grandparent/parent_file";
-  ASSERT_NO_THROW(scheduler.queueArchiveRequest(s_userOnUserHost, remoteFiles, archiveFile));
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-    ASSERT_TRUE(itor.hasMore());
-    common::archiveNS::ArchiveDirEntry entry;
-    ASSERT_NO_THROW(entry = itor.next());
-    ASSERT_EQ(std::string("grandparent"), entry.name);
-    ASSERT_EQ(common::archiveNS::ArchiveDirEntry::ENTRYTYPE_DIRECTORY, entry.type);
-    ASSERT_EQ(storageClassName, entry.status.storageClassName);
-  }
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost,
-      "/grandparent"));
-    ASSERT_TRUE(itor.hasMore());
-    common::archiveNS::ArchiveDirEntry entry;
-    ASSERT_NO_THROW(entry = itor.next());
-    ASSERT_EQ(std::string("parent_file"), entry.name);
-    ASSERT_EQ(common::archiveNS::ArchiveDirEntry::ENTRYTYPE_FILE, entry.type);
-    ASSERT_EQ(storageClassName, entry.status.storageClassName);
-  }
-
-  {
-    std::unique_ptr<common::archiveNS::ArchiveFileStatus> status;
-    ASSERT_NO_THROW(status = scheduler.statArchiveFile(s_userOnUserHost,
-      archiveFile));
-    ASSERT_TRUE(status.get());
-    ASSERT_EQ(storageClassName, status->storageClassName);
-  }
-
-  {
-    decltype(scheduler.getArchiveRequests(s_userOnUserHost)) rqsts;
-    ASSERT_NO_THROW(rqsts = scheduler.getArchiveRequests(s_userOnUserHost));
-    ASSERT_EQ(1, rqsts.size());
-    auto poolItor = rqsts.cbegin();
-    ASSERT_FALSE(poolItor == rqsts.cend());
-    const TapePool &pool = poolItor->first;
-    ASSERT_TRUE(tapePoolName == pool.name);
-    auto poolRqsts = poolItor->second;
-    ASSERT_EQ(1, poolRqsts.size());
-    std::set<std::string> remoteFiles;
-    std::set<std::string> archiveFiles;
-    for(auto rqstItor = poolRqsts.cbegin();
-      rqstItor != poolRqsts.cend(); rqstItor++) {
-      remoteFiles.insert(rqstItor->remoteFile.path.getRaw());
-      archiveFiles.insert(rqstItor->archiveFile);
-    }
-    ASSERT_EQ(1, remoteFiles.size());
-    ASSERT_FALSE(remoteFiles.find(s_remoteFileRawPath1) == remoteFiles.end());
-    ASSERT_EQ(1, archiveFiles.size());
-    ASSERT_FALSE(archiveFiles.find("/grandparent/parent_file") ==
-      archiveFiles.end());
-  }
-
-  {
-    const auto poolRqsts = scheduler.getArchiveRequests(s_userOnUserHost,
-      tapePoolName);
-    ASSERT_EQ(1, poolRqsts.size());
-    std::set<std::string> remoteFiles;
-    std::set<std::string> archiveFiles;
-    for(auto rqstItor = poolRqsts.cbegin(); rqstItor != poolRqsts.cend();
-      rqstItor++) {
-      remoteFiles.insert(rqstItor->remoteFile.path.getRaw());
-      archiveFiles.insert(rqstItor->archiveFile);
-    }
-    ASSERT_EQ(1, remoteFiles.size());
-    ASSERT_FALSE(remoteFiles.find(s_remoteFileRawPath1) == remoteFiles.end());
-    ASSERT_EQ(1, archiveFiles.size());
-    ASSERT_FALSE(archiveFiles.find("/grandparent/parent_file") == archiveFiles.end());
-  }
-
-  ASSERT_NO_THROW(scheduler.deleteArchiveRequest(s_userOnUserHost,
-    "/grandparent/parent_file"));
-
-  {
-    const auto rqsts = scheduler.getArchiveRequests(s_userOnUserHost);
-    ASSERT_TRUE(rqsts.empty());
-  }
-
-  {
-    const auto poolRqsts = scheduler.getArchiveRequests(s_userOnUserHost,
-      tapePoolName);
-    ASSERT_TRUE(poolRqsts.empty());
-  }
-
-  {
-    std::unique_ptr<common::archiveNS::ArchiveFileStatus> status;
-    ASSERT_NO_THROW(status = scheduler.statArchiveFile(s_userOnUserHost,
-      "/grandparent/parent_file"));
-    ASSERT_FALSE(status.get());
-  }
-}
-
-TEST_P(SchedulerTest, archive_to_new_file_with_no_storage_class) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  const std::string dirPath = "/grandparent";
-  const uint16_t mode = 0777;
-  ASSERT_NO_THROW(scheduler.createDir(s_userOnUserHost, dirPath, mode));
-
-  std::list<std::string> remoteFiles;
-  remoteFiles.push_back(s_remoteFileRawPath1);
-  const std::string archiveFile  = "/grandparent/parent_file";
-  ASSERT_THROW(scheduler.queueArchiveRequest(s_userOnUserHost, remoteFiles, archiveFile), std::exception);
-}
-
-TEST_P(SchedulerTest, create_zero_copy_storage_class) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  const std::string storageClassName = "TestStorageClass";
-  const uint16_t nbCopies = 0;
-  const std::string storageClassComment = "Storage-class comment";
-  ASSERT_THROW(scheduler.createStorageClass(s_adminOnAdminHost, storageClassName,
-    nbCopies, storageClassComment), std::exception);
-}
-
-TEST_P(SchedulerTest, archive_to_new_file_with_no_route) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  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_userOnUserHost, dirPath, mode));
-  ASSERT_NO_THROW(scheduler.setDirStorageClass(s_userOnUserHost, 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));
-
-  std::list<std::string> remoteFiles;
-  remoteFiles.push_back(s_remoteFileRawPath1);
-  const std::string archiveFile  = "/grandparent/parent_file";
-  ASSERT_THROW(scheduler.queueArchiveRequest(s_userOnUserHost, remoteFiles, archiveFile), std::exception);
-}
-
-TEST_P(SchedulerTest,
-  archive_to_new_file_with_incomplete_routing) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  const std::string storageClassName = "TestStorageClass";
-  const uint16_t nbCopies = 2;
-  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_userOnUserHost, dirPath, mode));
-  ASSERT_NO_THROW(scheduler.setDirStorageClass(s_userOnUserHost, 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 archiveRouteComment = "Archive-route comment";
-  ASSERT_NO_THROW(scheduler.createArchiveRoute(s_adminOnAdminHost, storageClassName,
-    copyNb, tapePoolName, archiveRouteComment));
-
-  std::list<std::string> remoteFiles;
-  remoteFiles.push_back(s_remoteFileRawPath1);
-  const std::string archiveFile  = "/grandparent/parent_file";
-  ASSERT_THROW(scheduler.queueArchiveRequest(s_userOnUserHost, remoteFiles, archiveFile), std::exception);
-}
-
-/*
-TEST_P(SchedulerTest, archive_to_directory) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  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_userOnUserHost, dirPath, mode));
-  ASSERT_NO_THROW(scheduler.setDirStorageClass(s_userOnUserHost, 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 archiveRouteComment = "Archive-route comment";
-  ASSERT_NO_THROW(scheduler.createArchiveRoute(s_adminOnAdminHost, storageClassName,
-    copyNb, tapePoolName, archiveRouteComment));
-
-  std::list<std::string> remoteFiles;
-  remoteFiles.push_back(s_remoteFileRawPath1);
-  remoteFiles.push_back(s_remoteFileRawPath2);
-  remoteFiles.push_back(s_remoteFileRawPath3);
-  remoteFiles.push_back(s_remoteFileRawPath4);
-  const std::string archiveFile  = "/grandparent";
-  ASSERT_NO_THROW(scheduler.queueArchiveRequest(s_userOnUserHost, remoteFiles, archiveFile));
-
-  {
-    ArchiveDirIterator itor;
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-    ASSERT_TRUE(itor.hasMore());
-    common::archiveNS::ArchiveDirEntry entry;
-    ASSERT_NO_THROW(entry = itor.next());
-    ASSERT_EQ(std::string("grandparent"), entry.name);
-    ASSERT_EQ(ArchiveDirEntry::ENTRYTYPE_DIRECTORY, entry.type);
-    ASSERT_EQ(storageClassName, entry.status.storageClassName);
-  }
-
-  {
-    std::set<std::string> archiveFileNames;
-    ArchiveDirIterator itor;
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost,
-      "/grandparent"));
-    while(itor.hasMore()) {
-      const common::archiveNS::ArchiveDirEntry entry = itor.next();
-      archiveFileNames.insert(entry.name);
-    }
-    ASSERT_EQ(4, archiveFileNames.size());
-    ASSERT_TRUE(archiveFileNames.find(s_remoteFilename1) != archiveFileNames.end());
-    ASSERT_TRUE(archiveFileNames.find(s_remoteFilename2) != archiveFileNames.end());
-    ASSERT_TRUE(archiveFileNames.find(s_remoteFilename3) != archiveFileNames.end());
-    ASSERT_TRUE(archiveFileNames.find(s_remoteFilename4) != archiveFileNames.end());
-  }
-
-  {
-    const auto rqsts = scheduler.getArchiveRequests(s_userOnUserHost);
-    ASSERT_EQ(1, rqsts.size());
-    auto poolItor = rqsts.cbegin();
-    ASSERT_FALSE(poolItor == rqsts.cend());
-    const TapePool &pool = poolItor->first;
-    ASSERT_TRUE(tapePoolName == pool.name);
-    const auto poolRqsts = poolItor->second;
-    ASSERT_EQ(4, poolRqsts.size());
-    std::set<std::string> remoteFiles;
-    std::set<std::string> archiveFiles;
-    for(auto rqstItor = poolRqsts.cbegin();
-      rqstItor != poolRqsts.cend(); rqstItor++) {
-      remoteFiles.insert(rqstItor->remoteFile.path.getRaw());
-      archiveFiles.insert(rqstItor->archiveFile);
-    }
-    ASSERT_EQ(4, remoteFiles.size());
-    ASSERT_FALSE(remoteFiles.find(s_remoteFileRawPath1) == remoteFiles.end());
-    ASSERT_FALSE(remoteFiles.find(s_remoteFileRawPath2) == remoteFiles.end());
-    ASSERT_FALSE(remoteFiles.find(s_remoteFileRawPath3) == remoteFiles.end());
-    ASSERT_FALSE(remoteFiles.find(s_remoteFileRawPath4) == remoteFiles.end());
-    ASSERT_EQ(4, archiveFiles.size());
-    ASSERT_FALSE(archiveFiles.find("/grandparent/remoteFile1") == remoteFiles.end());
-    ASSERT_FALSE(archiveFiles.find("/grandparent/remoteFile2") == remoteFiles.end());
-    ASSERT_FALSE(archiveFiles.find("/grandparent/remoteFile3") == remoteFiles.end());
-    ASSERT_FALSE(archiveFiles.find("/grandparent/remoteFile4") == remoteFiles.end());
-  }
-
-  {
-    const auto poolRqsts = scheduler.getArchiveRequests(s_userOnUserHost,
-      tapePoolName);
-    ASSERT_EQ(4, poolRqsts.size());
-    std::set<std::string> remoteFiles;
-    std::set<std::string> archiveFiles;
-    for(auto rqstItor = poolRqsts.cbegin(); rqstItor != poolRqsts.cend();
-      rqstItor++) {
-      remoteFiles.insert(rqstItor->remoteFile.path.getRaw());
-      archiveFiles.insert(rqstItor->archiveFile);
-    }
-    ASSERT_EQ(4, remoteFiles.size());
-    ASSERT_FALSE(remoteFiles.find(s_remoteFileRawPath1) == remoteFiles.end());
-    ASSERT_FALSE(remoteFiles.find(s_remoteFileRawPath2) == remoteFiles.end());
-    ASSERT_FALSE(remoteFiles.find(s_remoteFileRawPath3) == remoteFiles.end());
-    ASSERT_FALSE(remoteFiles.find(s_remoteFileRawPath4) == remoteFiles.end());
-    ASSERT_EQ(4, archiveFiles.size());
-    ASSERT_FALSE(archiveFiles.find("/grandparent/remoteFile1") == remoteFiles.end());
-    ASSERT_FALSE(archiveFiles.find("/grandparent/remoteFile2") == remoteFiles.end());
-    ASSERT_FALSE(archiveFiles.find("/grandparent/remoteFile3") == remoteFiles.end());
-    ASSERT_FALSE(archiveFiles.find("/grandparent/remoteFile4") == remoteFiles.end());
-  }
-}
-*/
-
-TEST_P(SchedulerTest,
-  archive_to_directory_without_storage_class) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  const std::string dirPath = "/grandparent";
-  const uint16_t mode = 0777;
-  ASSERT_NO_THROW(scheduler.createDir(s_userOnUserHost, dirPath, mode));
-
-  std::list<std::string> remoteFiles;
-  remoteFiles.push_back(s_remoteFileRawPath1);
-  remoteFiles.push_back(s_remoteFileRawPath2);
-  remoteFiles.push_back(s_remoteFileRawPath3);
-  remoteFiles.push_back(s_remoteFileRawPath4);
-  const std::string archiveFile  = "/grandparent";
-  ASSERT_THROW(scheduler.queueArchiveRequest(s_userOnUserHost, remoteFiles,
-    archiveFile), std::exception);
-}
-
-TEST_P(SchedulerTest, archive_to_directory_with_no_route) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  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_userOnUserHost, dirPath, mode));
-  ASSERT_NO_THROW(scheduler.setDirStorageClass(s_userOnUserHost, 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));
-
-  std::list<std::string> remoteFiles;
-  remoteFiles.push_back(s_remoteFileRawPath1);
-  remoteFiles.push_back(s_remoteFileRawPath2);
-  remoteFiles.push_back(s_remoteFileRawPath3);
-  remoteFiles.push_back(s_remoteFileRawPath4);
-  const std::string archiveFile  = "/grandparent";
-  ASSERT_THROW(scheduler.queueArchiveRequest(s_userOnUserHost, remoteFiles,
-    archiveFile), std::exception);
-}
-
-TEST_P(SchedulerTest, archive_to_directory_with_incomplete_routing) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  const std::string storageClassName = "TestStorageClass";
-  const uint16_t nbCopies = 2;
-  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_userOnUserHost, dirPath, mode));
-  ASSERT_NO_THROW(scheduler.setDirStorageClass(s_userOnUserHost, 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 archiveRouteComment = "Archive-route comment";
-  ASSERT_NO_THROW(scheduler.createArchiveRoute(s_adminOnAdminHost, storageClassName,
-    copyNb, tapePoolName, archiveRouteComment));
-
-  std::list<std::string> remoteFiles;
-  remoteFiles.push_back(s_remoteFileRawPath1);
-  remoteFiles.push_back(s_remoteFileRawPath2);
-  remoteFiles.push_back(s_remoteFileRawPath3);
-  remoteFiles.push_back(s_remoteFileRawPath4);
-  const std::string archiveFile  = "/grandparent";
-  ASSERT_THROW(scheduler.queueArchiveRequest(s_userOnUserHost, remoteFiles, archiveFile), std::exception);
-}
-
-TEST_P(SchedulerTest, archive_and_retrieve_new_file) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  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_userOnUserHost, dirPath, mode));
-  ASSERT_NO_THROW(scheduler.setDirStorageClass(s_userOnUserHost, 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));
-  MountCriteriaByDirection mcbd(MountCriteria(1,1,0,1), MountCriteria(1,1,0,1));
-  ASSERT_NO_THROW(scheduler.setTapePoolMountCriteria("TestTapePool", mcbd));
-
-  const std::string libraryName = "TestLogicalLibrary";
-  const std::string libraryComment = "Library comment";
-  ASSERT_NO_THROW(scheduler.createLogicalLibrary(s_adminOnAdminHost, libraryName,
-    libraryComment));
-  {
-    std::list<LogicalLibrary> libraries;
-    ASSERT_NO_THROW(libraries = scheduler.getLogicalLibraries(
-      s_adminOnAdminHost));
-    ASSERT_EQ(1, libraries.size());
-  
-    LogicalLibrary logicalLibrary;
-    ASSERT_NO_THROW(logicalLibrary = libraries.front());
-    ASSERT_EQ(libraryName, logicalLibrary.name);
-    ASSERT_EQ(libraryComment, logicalLibrary.creationLog.comment);
-  }
-
-  const std::string vid = "TestVid";
-  const uint64_t capacityInBytes = 12345678;
-  const std::string tapeComment = "Tape comment";  
-  ASSERT_NO_THROW(scheduler.createTape(s_adminOnAdminHost, vid, libraryName,
-    tapePoolName, capacityInBytes, tapeComment));
-
-  const uint16_t copyNb = 1;
-  const std::string archiveRouteComment = "Archive-route comment";
-  ASSERT_NO_THROW(scheduler.createArchiveRoute(s_adminOnAdminHost, storageClassName,
-    copyNb, tapePoolName, archiveRouteComment));
-
-  std::list<std::string> remoteFiles;
-  remoteFiles.push_back(s_remoteFileRawPath1);
-  const std::string archiveFile  = "/grandparent/parent_file";
-  ASSERT_NO_THROW(scheduler.queueArchiveRequest(s_userOnUserHost, remoteFiles, archiveFile));
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-    ASSERT_TRUE(itor.hasMore());
-    common::archiveNS::ArchiveDirEntry entry;
-    ASSERT_NO_THROW(entry = itor.next());
-    ASSERT_EQ(std::string("grandparent"), entry.name);
-    ASSERT_EQ(common::archiveNS::ArchiveDirEntry::ENTRYTYPE_DIRECTORY, entry.type);
-    ASSERT_EQ(storageClassName, entry.status.storageClassName);
-  }
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost,
-      "/grandparent"));
-    ASSERT_TRUE(itor.hasMore());
-    common::archiveNS::ArchiveDirEntry entry;
-    ASSERT_NO_THROW(entry = itor.next());
-    ASSERT_EQ(std::string("parent_file"), entry.name);
-    ASSERT_EQ(common::archiveNS::ArchiveDirEntry::ENTRYTYPE_FILE, entry.type);
-    ASSERT_EQ(storageClassName, entry.status.storageClassName);
-  }
-
-  {
-    std::unique_ptr<common::archiveNS::ArchiveFileStatus> status;
-    ASSERT_NO_THROW(status = scheduler.statArchiveFile(s_adminOnAdminHost,
-      archiveFile));
-    ASSERT_TRUE(status.get());
-    ASSERT_EQ(storageClassName, status->storageClassName);
-  }
-
-  {
-    decltype(scheduler.getArchiveRequests(s_userOnUserHost)) rqsts;
-    ASSERT_NO_THROW(rqsts = scheduler.getArchiveRequests(s_userOnUserHost));
-    ASSERT_EQ(1, rqsts.size());
-    auto poolItor = rqsts.cbegin();
-    ASSERT_FALSE(poolItor == rqsts.cend());
-    const TapePool &pool = poolItor->first;
-    ASSERT_TRUE(tapePoolName == pool.name);
-    auto poolRqsts = poolItor->second;
-    ASSERT_EQ(1, poolRqsts.size());
-    std::set<std::string> remoteFiles;
-    std::set<std::string> archiveFiles;
-    for(auto rqstItor = poolRqsts.cbegin();
-      rqstItor != poolRqsts.cend(); rqstItor++) {
-      remoteFiles.insert(rqstItor->remoteFile.path.getRaw());
-      archiveFiles.insert(rqstItor->archiveFile);
-    }
-    ASSERT_EQ(1, remoteFiles.size());
-    ASSERT_FALSE(remoteFiles.find(s_remoteFileRawPath1) == remoteFiles.end());
-    ASSERT_EQ(1, archiveFiles.size());
-    ASSERT_FALSE(archiveFiles.find("/grandparent/parent_file") ==
-      archiveFiles.end());
-  }
-
-  {
-    const auto poolRqsts = scheduler.getArchiveRequests(s_userOnUserHost,
-      tapePoolName);
-    ASSERT_EQ(1, poolRqsts.size());
-    std::set<std::string> remoteFiles;
-    std::set<std::string> archiveFiles;
-    for(auto rqstItor = poolRqsts.cbegin(); rqstItor != poolRqsts.cend();
-      rqstItor++) {
-      remoteFiles.insert(rqstItor->remoteFile.path.getRaw());
-      archiveFiles.insert(rqstItor->archiveFile);
-    }
-    ASSERT_EQ(1, remoteFiles.size());
-    ASSERT_FALSE(remoteFiles.find(s_remoteFileRawPath1) == remoteFiles.end());
-    ASSERT_EQ(1, archiveFiles.size());
-    ASSERT_FALSE(archiveFiles.find("/grandparent/parent_file") == archiveFiles.end());
-  }
-
-  // The file has not yet been archived, there is no 'm' bit in the archive
-  // namespace and therefore an attempted retrive request should fail at this point
-  {
-    std::list<std::string> archiveFiles;
-    archiveFiles.push_back("/grandparent/parent_file");
-    ASSERT_THROW(scheduler.queueRetrieveRequest(s_userOnUserHost, archiveFiles,
-      s_remoteTargetRawPath1), std::exception);
-  }
-
-  {
-    // Emulate a tape server by asking for a mount and then a file (and succeed
-    // the transfer)
-    std::unique_ptr<cta::TapeMount> mount;
-    ASSERT_NO_THROW(mount.reset(scheduler.getNextMount(libraryName, "drive0").release()));
-    ASSERT_NE((cta::TapeMount*)NULL, mount.get());
-    ASSERT_EQ(cta::MountType::ARCHIVE, mount.get()->getMountType());
-    std::unique_ptr<cta::ArchiveMount> archiveMount;
-    ASSERT_NO_THROW(archiveMount.reset(dynamic_cast<cta::ArchiveMount*>(mount.release())));
-    ASSERT_NE((cta::ArchiveMount*)NULL, archiveMount.get());
-    std::unique_ptr<cta::ArchiveJob> archiveJob;
-    ASSERT_NO_THROW(archiveJob.reset(archiveMount->getNextJob().release()));
-    ASSERT_NE((cta::ArchiveJob*)NULL, archiveJob.get());
-    archiveJob->nameServerTapeFile.tapeFileLocation.blockId = 1;
-    archiveJob->nameServerTapeFile.copyNb = archiveJob->nameServerTapeFile.tapeFileLocation.copyNb;
-    cta::Checksum checksum(cta::Checksum::CHECKSUMTYPE_ADLER32, ntohl(0x12345687));
-    archiveJob->nameServerTapeFile.checksum = checksum;
-    ASSERT_NO_THROW(archiveJob->complete());
-    ASSERT_NO_THROW(archiveJob.reset(archiveMount->getNextJob().release()));
-    ASSERT_EQ((cta::ArchiveJob*)NULL, archiveJob.get());
-    ASSERT_NO_THROW(archiveMount->complete());
-  }
-
-  {
-    
-    std::list<std::string> archiveFiles;
-    archiveFiles.push_back("/grandparent/parent_file");
-    ASSERT_NO_THROW(scheduler.queueRetrieveRequest(s_userOnUserHost,
-      archiveFiles, s_remoteTargetRawPath1));
-  }
-
-  {
-    decltype(scheduler.getRetrieveRequests(s_userOnUserHost)) rqsts;
-    ASSERT_NO_THROW(rqsts = scheduler.getRetrieveRequests(s_userOnUserHost));
-    ASSERT_EQ(1, rqsts.size());
-    auto tapeItor = rqsts.cbegin();
-    ASSERT_FALSE(tapeItor == rqsts.cend());
-    const Tape &tape = tapeItor->first;
-    ASSERT_TRUE(vid == tape.vid);
-    auto tapeRqsts = tapeItor->second;
-    ASSERT_EQ(1, tapeRqsts.size());
-    std::set<std::string> remoteFiles;
-    std::set<std::string> archiveFiles;
-    for(auto rqstItor = tapeRqsts.cbegin(); rqstItor != tapeRqsts.cend();
-      rqstItor++) {
-      remoteFiles.insert(rqstItor->remoteFile);
-      archiveFiles.insert(rqstItor->archiveFile.path);
-    }
-    ASSERT_EQ(1, remoteFiles.size());
-    ASSERT_FALSE(remoteFiles.find(s_remoteTargetRawPath1) == remoteFiles.end());
-    ASSERT_EQ(1, archiveFiles.size());
-    ASSERT_FALSE(archiveFiles.find("/grandparent/parent_file") ==
-      archiveFiles.end());
-  }
-  
-  {
-    // Emulate a tape server by asking for a mount and then a file (and succeed
-    // the transfer)
-    std::unique_ptr<cta::TapeMount> mount;
-    ASSERT_NO_THROW(mount.reset(scheduler.getNextMount(libraryName, "drive0").release()));
-    ASSERT_NE((cta::TapeMount*)NULL, mount.get());
-    ASSERT_EQ(cta::MountType::RETRIEVE, mount.get()->getMountType());
-    std::unique_ptr<cta::RetrieveMount> retrieveMount;
-    ASSERT_NO_THROW(retrieveMount.reset(dynamic_cast<cta::RetrieveMount*>(mount.release())));
-    ASSERT_NE((cta::RetrieveMount*)NULL, retrieveMount.get());
-    std::unique_ptr<cta::RetrieveJob> retrieveJob;
-    ASSERT_NO_THROW(retrieveJob.reset(retrieveMount->getNextJob().release()));
-    ASSERT_NE((cta::RetrieveJob*)NULL, retrieveJob.get());
-    ASSERT_NO_THROW(retrieveJob->complete());
-    ASSERT_NO_THROW(retrieveJob.reset(retrieveMount->getNextJob().release()));
-    ASSERT_EQ((cta::RetrieveJob*)NULL, retrieveJob.get());
-  }
-}
-
-TEST_P(SchedulerTest, retry_archive_until_max_reached) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  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_userOnUserHost, dirPath, mode));
-  ASSERT_NO_THROW(scheduler.setDirStorageClass(s_userOnUserHost, 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));
-  MountCriteriaByDirection mcbd(MountCriteria(1,1,0,1), MountCriteria(1,1,0,1));
-  ASSERT_NO_THROW(scheduler.setTapePoolMountCriteria("TestTapePool", mcbd));
-
-  const std::string libraryName = "TestLogicalLibrary";
-  const std::string libraryComment = "Library comment";
-  ASSERT_NO_THROW(scheduler.createLogicalLibrary(s_adminOnAdminHost, libraryName,
-    libraryComment));
-  {
-    std::list<LogicalLibrary> libraries;
-    ASSERT_NO_THROW(libraries = scheduler.getLogicalLibraries(
-      s_adminOnAdminHost));
-    ASSERT_EQ(1, libraries.size());
-  
-    LogicalLibrary logicalLibrary;
-    ASSERT_NO_THROW(logicalLibrary = libraries.front());
-    ASSERT_EQ(libraryName, logicalLibrary.name);
-    ASSERT_EQ(libraryComment, logicalLibrary.creationLog.comment);
-  }
-
-  const std::string vid = "TestVid";
-  const uint64_t capacityInBytes = 12345678;
-  const std::string tapeComment = "Tape comment";  
-  ASSERT_NO_THROW(scheduler.createTape(s_adminOnAdminHost, vid, libraryName,
-    tapePoolName, capacityInBytes, tapeComment));
-
-  const uint16_t copyNb = 1;
-  const std::string archiveRouteComment = "Archive-route comment";
-  ASSERT_NO_THROW(scheduler.createArchiveRoute(s_adminOnAdminHost, storageClassName,
-    copyNb, tapePoolName, archiveRouteComment));
-
-  std::list<std::string> remoteFiles;
-  remoteFiles.push_back(s_remoteFileRawPath1);
-  const std::string archiveFile  = "/grandparent/parent_file";
-  ASSERT_NO_THROW(scheduler.queueArchiveRequest(s_userOnUserHost, remoteFiles, archiveFile));
-  
-  {
-    // Emulate a tape server by asking for a mount and then a file
-    std::unique_ptr<cta::TapeMount> mount;
-    ASSERT_NO_THROW(mount.reset(scheduler.getNextMount(libraryName, "drive0").release()));
-    ASSERT_NE((cta::TapeMount*)NULL, mount.get());
-    ASSERT_EQ(cta::MountType::ARCHIVE, mount.get()->getMountType());
-    std::unique_ptr<cta::ArchiveMount> archiveMount;
-    ASSERT_NO_THROW(archiveMount.reset(dynamic_cast<cta::ArchiveMount*>(mount.release())));
-    ASSERT_NE((cta::ArchiveMount*)NULL, archiveMount.get());
-    // The file should be retried 10 times
-    for (int i=0; i<5; i++) {
-      std::unique_ptr<cta::ArchiveJob> archiveJob;
-      ASSERT_NO_THROW(archiveJob.reset(archiveMount->getNextJob().release()));
-      ASSERT_NE((cta::ArchiveJob*)NULL, archiveJob.get());
-      ASSERT_NO_THROW(archiveJob->failed(cta::exception::Exception("Archive failed")));
-    }
-    // Then the request should be gone
-    std::unique_ptr<cta::ArchiveJob> archiveJob;
-    ASSERT_NO_THROW(archiveJob.reset(archiveMount->getNextJob().release()));
-    ASSERT_EQ((cta::ArchiveJob*)NULL, archiveJob.get());
-  }
-}
-
-TEST_P(SchedulerTest, retrieve_non_existing_file) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, "/", s_user));
-
-  {
-    common::archiveNS::ArchiveDirIterator itor;
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-    ASSERT_FALSE(itor.hasMore());
-  }
-
-  {
-    std::list<std::string> archiveFiles;
-    archiveFiles.push_back("/non_existing_file");
-    ASSERT_THROW(scheduler.queueRetrieveRequest(s_userOnUserHost,
-      archiveFiles, "mock:non_existing_file"), std::exception);
-  }
-}
-
-TEST_P(SchedulerTest, setOwner_getOwner_root) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-  const std::string dirPath = "/";
-
-  ASSERT_NO_THROW(scheduler.getOwner(s_adminOnAdminHost, dirPath) );
-  ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, dirPath, s_user));
-
-  {
-    UserIdentity owner;
-
-    ASSERT_NO_THROW(owner = scheduler.getOwner(s_adminOnAdminHost, dirPath));
-    ASSERT_EQ(s_user, owner);
-  }
-}
-
-TEST_P(SchedulerTest, setOwner_getDirContents_top_level) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  {
-    const std::string dirPath = "/";
-
-    ASSERT_NO_THROW(scheduler.getOwner(s_adminOnAdminHost, dirPath));
-    ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, dirPath, s_user));
-
-    {
-      UserIdentity owner;
-
-      ASSERT_NO_THROW(owner = scheduler.getOwner(s_adminOnAdminHost, dirPath));
-      ASSERT_EQ(s_user, owner);
-    }
-  }
-
-  {
-    const std::string dirPath = "/grandparent";
-
-    const uint16_t mode = 0777;
-    ASSERT_NO_THROW(scheduler.createDir(s_userOnUserHost, dirPath, mode));
-
-    common::archiveNS::ArchiveDirIterator itor;
-
-    ASSERT_NO_THROW(itor = scheduler.getDirContents(s_userOnUserHost, "/"));
-
-    ASSERT_TRUE(itor.hasMore());
-
-    common::archiveNS::ArchiveDirEntry entry;
-
-    ASSERT_NO_THROW(entry = itor.next());
-
-    ASSERT_EQ(std::string("grandparent"), entry.name);
-
-    ASSERT_EQ(s_user.uid, entry.status.owner.uid);
-    ASSERT_EQ(s_user.gid, entry.status.owner.gid);
-  }
-}
-
-TEST_P(SchedulerTest, setOwner_statFile_top_level) {
-  using namespace cta;
-
-  Scheduler &scheduler = getScheduler();
-
-  {
-    const std::string dirPath = "/";
-
-    ASSERT_NO_THROW(scheduler.getOwner(s_adminOnAdminHost, dirPath));
-    ASSERT_NO_THROW(scheduler.setOwner(s_adminOnAdminHost, dirPath, s_user));
-
-    {
-      UserIdentity owner;
-
-      ASSERT_NO_THROW(owner = scheduler.getOwner(s_adminOnAdminHost, dirPath));
-      ASSERT_EQ(s_user, owner);
-    }
-  }
-
-  {
-    const std::string dirPath = "/grandparent";
-
-    const uint16_t mode = 0777;
-    ASSERT_NO_THROW(scheduler.createDir(s_userOnUserHost, dirPath, mode));
-
-    std::unique_ptr<common::archiveNS::ArchiveFileStatus> status;
-
-    ASSERT_NO_THROW(status = scheduler.statArchiveFile(s_userOnUserHost,
-      dirPath));
-    ASSERT_TRUE(status.get());
-    ASSERT_EQ(s_user.uid, status->owner.uid);
-    ASSERT_EQ(s_user.gid, status->owner.gid);
-  }
-}
-static cta::MockNameServerFactory mockNsFactory;
-
-#undef TEST_MOCK_DB
-#ifdef TEST_MOCK_DB
-static cta::MockSchedulerDatabaseFactory mockDbFactory;
-INSTANTIATE_TEST_CASE_P(MockSchedulerTest, SchedulerTest,
-  ::testing::Values(SchedulerTestParam(mockNsFactory, mockDbFactory)));
-#endif
-
-#define TEST_VFS
-#ifdef TEST_VFS
-static cta::OStoreDBFactory<cta::objectstore::BackendVFS> OStoreDBFactoryVFS;
-
-INSTANTIATE_TEST_CASE_P(OStoreDBPlusMockSchedulerTestVFS, SchedulerTest,
-  ::testing::Values(SchedulerTestParam(mockNsFactory, OStoreDBFactoryVFS)));
-#endif
-
-#undef TEST_RADOS
-#ifdef TEST_RADOS
-static cta::OStoreDBFactory<cta::objectstore::BackendRados> OStoreDBFactoryRados("rados://tapetest@tapetest");
-
-INSTANTIATE_TEST_CASE_P(OStoreDBPlusMockSchedulerTestRados, SchedulerTest,
-  ::testing::Values(SchedulerTestParam(mockNsFactory, OStoreDBFactoryRados)));
-#endif
-} // namespace unitTests
diff --git a/scheduler/mockDB/MockSchedulerDatabase.cpp b/scheduler/mockDB/MockSchedulerDatabase.cpp
deleted file mode 100644
index a9d52c3e55cfd88dcd0e359366cda1734b9fc91a..0000000000000000000000000000000000000000
--- a/scheduler/mockDB/MockSchedulerDatabase.cpp
+++ /dev/null
@@ -1,1553 +0,0 @@
-/*
- * The CERN Tape Archive (CTA) project
- * Copyright (C) 2015  CERN
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "common/archiveNS/ArchiveDirIterator.hpp"
-#include "common/exception/Exception.hpp"
-#include "common/UserIdentity.hpp"
-#include "nameserver/NameServer.hpp"
-#include "common/admin/AdminHost.hpp"
-#include "common/admin/AdminUser.hpp"
-#include "scheduler/ArchiveRequest.hpp"
-#include "scheduler/ArchiveToTapeCopyRequest.hpp"
-#include "common/archiveRoutes/ArchiveRoute.hpp"
-#include "scheduler/LogicalLibrary.hpp"
-#include "scheduler/mockDB/MockSchedulerDatabase.hpp"
-#include "scheduler/RetrieveRequestDump.hpp"
-#include "scheduler/RetrieveToFileRequest.hpp"
-#include "common/SecurityIdentity.hpp"
-#include "scheduler/mockDB/SqliteColumnNameToIndex.hpp"
-#include "scheduler/mockDB/SQLiteStatementDeleter.hpp"
-#include "common/archiveNS/StorageClass.hpp"
-#include "common/archiveNS/Tape.hpp"
-#include "common/TapePool.hpp"
-
-#include <iostream>
-#include <memory>
-#include <sstream>
-
-//------------------------------------------------------------------------------
-// constructor
-//------------------------------------------------------------------------------
-cta::MockSchedulerDatabase::MockSchedulerDatabase() {
-  try {
-    if(sqlite3_open(":memory:", &m_dbHandle)) {
-      std::ostringstream msg;
-      msg << "SQLite error: Can't open database: " <<
-        sqlite3_errmsg(m_dbHandle);
-      throw(exception::Exception(msg.str()));
-    }
-    char *zErrMsg = 0;
-    if(SQLITE_OK != sqlite3_exec(m_dbHandle, "PRAGMA foreign_keys = ON;", 0, 0,
-      &zErrMsg)) {
-      std::ostringstream msg;
-      msg << "SqliteDatabase() - SQLite error: " << zErrMsg;
-      sqlite3_free(zErrMsg);
-      throw(exception::Exception(msg.str()));
-    }
-    createSchema();
-  } catch (...) {
-    sqlite3_close(m_dbHandle);
-    throw;
-  }
-}
-
-//------------------------------------------------------------------------------
-// createSchema
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::createSchema() {  
-  char *zErrMsg = 0;
-  const int rc = sqlite3_exec(m_dbHandle,
-    "CREATE TABLE ARCHIVEROUTE("
-      "STORAGECLASS_NAME TEXT,"
-      "COPYNB            INTEGER,"
-      "TAPEPOOL     TEXT,"
-      "UID               INTEGER,"
-      "GID               INTEGER,"
-      "HOST              TEXT,"
-      "CREATIONTIME      INTEGER,"
-      "COMMENT           TEXT,"
-      "PRIMARY KEY (STORAGECLASS_NAME, COPYNB),"
-      "FOREIGN KEY(STORAGECLASS_NAME) REFERENCES STORAGECLASS(NAME),"
-      "FOREIGN KEY(TAPEPOOL)     REFERENCES TAPEPOOL(NAME)"
-      ");"
-    "CREATE TABLE STORAGECLASS("
-      "NAME           TEXT     PRIMARY KEY,"
-      "NBCOPIES       INTEGER,"
-      "UID            INTEGER,"
-      "GID            INTEGER,"
-      "HOST           TEXT,"
-      "CREATIONTIME   INTEGER,"
-      "COMMENT        TEXT"
-      ");"
-    "CREATE TABLE TAPEPOOL("
-      "NAME           TEXT     PRIMARY KEY,"
-      "NBPARTIALTAPES INTEGER,"
-      "UID            INTEGER,"
-      "GID            INTEGER,"
-      "HOST           TEXT,"
-      "CREATIONTIME   INTEGER,"
-      "COMMENT        TEXT"
-      ");"
-    "CREATE TABLE TAPE("
-      "VID              TEXT,"
-      "NBFILES          INTEGER,"
-      "LOGICALLIBRARY   TEXT,"
-      "TAPEPOOL         TEXT,"
-      "CAPACITY_BYTES   INTEGER,"
-      "DATAONTAPE_BYTES INTEGER,"
-      "UID              INTEGER,"
-      "GID              INTEGER,"
-      "HOST             TEXT,"
-      "CREATIONTIME     INTEGER,"
-      "COMMENT          TEXT,"
-      "PRIMARY KEY (VID),"
-      "FOREIGN KEY (LOGICALLIBRARY) REFERENCES LOGICALLIBRARY(NAME),"
-      "FOREIGN KEY (TAPEPOOL) REFERENCES TAPEPOOL(NAME)"
-      ");"
-    "CREATE TABLE LOGICALLIBRARY("
-      "NAME           TEXT,"
-      "UID            INTEGER,"
-      "GID            INTEGER,"
-      "HOST              TEXT,"
-      "CREATIONTIME   INTEGER,"
-      "COMMENT        TEXT,"
-      "PRIMARY KEY (NAME)"
-      ");"
-    "CREATE TABLE ADMINUSER("
-      "ADMIN_UID      INTEGER,"
-      "ADMIN_GID      INTEGER,"
-      "UID            INTEGER,"
-      "GID            INTEGER,"
-      "HOST              TEXT,"
-      "CREATIONTIME   INTEGER,"
-      "COMMENT        TEXT,"
-      "PRIMARY KEY (ADMIN_UID,ADMIN_GID)"
-      ");"
-    "CREATE TABLE ADMINHOST("
-      "NAME           TEXT,"
-      "UID            INTEGER,"
-      "GID            INTEGER,"
-      "HOST            TEXT,"
-      "CREATIONTIME   INTEGER,"
-      "COMMENT        TEXT,"
-      "PRIMARY KEY (NAME)"
-      ");"
-    "CREATE TABLE ARCHIVETOTAPECOPYREQUEST("
-      "STATE          TEXT,"
-      "REMOTEFILEPATH TEXT,"
-      "REMOTEFILEUID  INTEGER,"
-      "REMOTEFILEGID  INTEGER,"
-      "REMOTEFILESIZE INTEGER,"
-      "REMOTEFILEMODE INTEGER,"
-      "ARCHIVEFILE    TEXT,"
-      "TAPEPOOL       TEXT,"
-      "COPYNB         INTEGER,"
-      "PRIORITY       INTEGER,"
-      "UID            INTEGER,"
-      "GID            INTEGER,"
-      "HOST           TEXT,"
-      "CREATIONTIME   INTEGER,"
-      "PRIMARY KEY (ARCHIVEFILE, COPYNB),"
-      "FOREIGN KEY (TAPEPOOL) REFERENCES TAPEPOOL(NAME)"
-      ");"
-    "CREATE TABLE RETRIEVEFROMTAPECOPYREQUEST("
-      "ARCHIVEFILE    TEXT,"
-      "REMOTEFILE     TEXT,"
-      "COPYNB         INTEGER,"
-      "VID            TEXT,"
-      "FSEQ           INTEGER,"
-      "BLOCKID        INTEGER,"
-      "PRIORITY       INTEGER,"
-      "UID            INTEGER,"
-      "GID            INTEGER,"
-      "HOST           TEXT,"
-      "CREATIONTIME   INTEGER,"
-      "PRIMARY KEY (REMOTEFILE, VID, FSEQ),"
-      "FOREIGN KEY (VID) REFERENCES TAPE(VID)"
-      ");",
-    0, 0, &zErrMsg);
-  if(SQLITE_OK != rc) {    
-      std::ostringstream msg;
-      msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-      sqlite3_free(zErrMsg);
-      throw(exception::Exception(msg.str()));
-  }
-}  
-
-//------------------------------------------------------------------------------
-// destructor
-//------------------------------------------------------------------------------
-cta::MockSchedulerDatabase::~MockSchedulerDatabase() throw() {
-  sqlite3_close(m_dbHandle);
-}
-
-std::unique_ptr<cta::SchedulerDatabase::TapeMountDecisionInfo>
-  cta::MockSchedulerDatabase::getMountInfo() {
-  throw NotImplemented("");
-}
-
-
-//------------------------------------------------------------------------------
-// queue
-//------------------------------------------------------------------------------
-
-void cta::MockSchedulerDatabase::queue(const ArchiveToDirRequest &rqst) {
-  for(auto itor = rqst.getArchiveToFileRequests().cbegin();
-    itor != rqst.getArchiveToFileRequests().cend(); itor++) {
-    queue(*itor);
-  }
-}
-
-//------------------------------------------------------------------------------
-// ArchiveToFileRequestCreation's constructor
-//------------------------------------------------------------------------------
-
-cta::MockSchedulerDatabase::
-  ArchiveToFileRequestCreation::ArchiveToFileRequestCreation(
-   sqlite3 * dbHandle, const std::string& archiveFile,
-   const SecurityIdentity & requester, MockSchedulerDatabase & parent): 
-     m_dbHandle(dbHandle), m_archiveFile(archiveFile), m_requester(requester),
-     m_parent(parent){}
-
-//------------------------------------------------------------------------------
-// ArchiveToFileRequestCreation::complete
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::
-  ArchiveToFileRequestCreation::complete() {
-  char *zErrMsg = 0;
-  std::ostringstream query;
-  query << "UPDATE ARCHIVETOTAPECOPYREQUEST SET STATE='PENDING_MOUNT' WHERE"
-    " STATE='PENDING_NS_CREATION' AND ARCHIVEFILE='" << m_archiveFile << "';";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-    sqlite3_free(zErrMsg);
-    throw(exception::Exception(msg.str()));
-  }
-  const int nbRowsModified = sqlite3_changes(m_dbHandle);
-  if(0 >= nbRowsModified) {
-    std::ostringstream msg;
-    msg << "There are no archive requests in status PENDING_MOUNT for archive"
-      " file " << m_archiveFile;
-    throw(exception::Exception(msg.str()));
-  }
-}
-
-//------------------------------------------------------------------------------
-// ArchiveToFileRequestCreation::~ArchiveToFileRequestCreation
-//------------------------------------------------------------------------------
-
-cta::MockSchedulerDatabase::ArchiveToFileRequestCreation::~ArchiveToFileRequestCreation() {
-  // TODO: add management of abandoned transaction is necessary.
-  // Currently do nothing.
-}
-
-//------------------------------------------------------------------------------
-// ArchiveToFileRequestCreation::cancel
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::ArchiveToFileRequestCreation::cancel() {
-  m_parent.deleteArchiveRequest(m_requester, m_archiveFile);
-}
-
-//------------------------------------------------------------------------------
-// queue
-//------------------------------------------------------------------------------
-std::unique_ptr<cta::SchedulerDatabase::ArchiveRequestCreation>
-  cta::MockSchedulerDatabase::queue(const cta::common::dataStructures::ArchiveRequest &request, const uint64_t archiveFileId) {
-  return std::unique_ptr<cta::SchedulerDatabase::ArchiveRequestCreation> ();
-}
-
-//------------------------------------------------------------------------------
-// queue
-//------------------------------------------------------------------------------
-std::unique_ptr<cta::SchedulerDatabase::ArchiveRequestCreation>
-  cta::MockSchedulerDatabase::queue(const ArchiveRequest &rqst) {
-  const std::map<uint16_t, std::string> &copyNbToPoolMap =
-    rqst.copyNbToPoolMap;
-  for(auto itor = copyNbToPoolMap.begin(); itor != copyNbToPoolMap.end();
-    itor++) {
-    const uint16_t copyNb = itor->first;
-    const std::string &tapePoolName = itor->second;
-    queue(ArchiveToTapeCopyRequest(
-      rqst.remoteFile,
-      rqst.archiveFile,
-      copyNb,
-      tapePoolName,
-      rqst.priority,
-      rqst.creationLog));
-  }
-  return
-    std::unique_ptr<cta::SchedulerDatabase::ArchiveRequestCreation> (
-      new ArchiveToFileRequestCreation(m_dbHandle, rqst.archiveFile,
-      SecurityIdentity(rqst.creationLog.user, rqst.creationLog.host),
-        *this));
-}
-
-//------------------------------------------------------------------------------
-// queue
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::queue(const ArchiveToTapeCopyRequest &rqst) {
-  char *zErrMsg = 0;
-  const CreationLog &log = rqst.creationLog;
-  std::ostringstream query;
-  query << "INSERT INTO ARCHIVETOTAPECOPYREQUEST(STATE, REMOTEFILEPATH,"
-    " REMOTEFILEUID, REMOTEFILEGID, REMOTEFILESIZE, REMOTEFILEMODE, ARCHIVEFILE,"
-    " TAPEPOOL, COPYNB, PRIORITY, UID, GID, HOST, CREATIONTIME)"
-    " VALUES("
-    "'PENDING_NS_CREATION','" <<
-    rqst.remoteFile.path.getRaw() << "'," <<
-    rqst.remoteFile.status.owner.uid << "," <<
-    rqst.remoteFile.status.owner.gid << "," <<
-    rqst.remoteFile.status.size << "," <<
-    rqst.remoteFile.status.mode << ",'" <<
-    rqst.archiveFile << "','" <<
-    rqst.tapePoolName << "'," <<
-    rqst.copyNb << "," <<
-    rqst.priority << "," <<
-    log.user.uid << "," <<
-    log.user.gid << ",'" <<
-    log.host << "', " <<
-    (int)log.time << ");";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-    sqlite3_free(zErrMsg);
-    throw(exception::Exception(msg.str()));
-  }
-  const int nbRowsModified = sqlite3_changes(m_dbHandle);
-  if(0 >= nbRowsModified) {
-    std::ostringstream msg;
-    msg << "Archive request for copy " << rqst.copyNb <<
-      " of archive file " << rqst.archiveFile << " already exists";
-    throw(exception::Exception(msg.str()));
-  }
-}
-
-//------------------------------------------------------------------------------
-// getArchiveRequests
-//------------------------------------------------------------------------------
-std::map<cta::TapePool, std::list<cta::ArchiveToTapeCopyRequest> >
-  cta::MockSchedulerDatabase::getArchiveRequests() const {
-  std::ostringstream query;
-  std::map<TapePool, std::list<ArchiveToTapeCopyRequest> > rqsts;
-  query << "SELECT STATE, REMOTEFILEPATH, REMOTEFILEUID, REMOTEFILEGID,"
-    " REMOTEFILESIZE, REMOTEFILEMODE, ARCHIVEFILE, TAPEPOOL, COPYNB,"
-    " PRIORITY, UID, GID, HOST, CREATIONTIME FROM ARCHIVETOTAPECOPYREQUEST"
-    " ORDER BY ARCHIVEFILE;";
-  sqlite3_stmt *s = NULL;
-  const int rc = sqlite3_prepare(m_dbHandle, query.str().c_str(), -1, &s, 0 );
-  std::unique_ptr<sqlite3_stmt, SQLiteStatementDeleter> statement(s);
-  if(SQLITE_OK != rc){    
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << sqlite3_errmsg(m_dbHandle);
-    throw(exception::Exception(msg.str()));
-  }
-  while(SQLITE_ROW == sqlite3_step(statement.get())) {
-    const SqliteColumnNameToIndex idx(statement.get());
-    const std::string tapePoolName =
-      (char *)sqlite3_column_text(statement.get(), idx("TAPEPOOL"));
-    const TapePool tapePool = getTapePool(tapePoolName);
-    const std::string remoteFilePath =
-      (char *)sqlite3_column_text(statement.get(), idx("REMOTEFILEPATH"));
-    const uint32_t remoteFileUid =
-      sqlite3_column_int(statement.get(), idx("REMOTEFILEUID"));
-    const uint32_t remoteFileGid =
-      sqlite3_column_int(statement.get(), idx("REMOTEFILEGID"));
-    const uint64_t remoteFileSize =
-      sqlite3_column_int(statement.get(), idx("REMOTEFILESIZE"));
-    const mode_t remoteFileMode =
-      sqlite3_column_int(statement.get(), idx("REMOTEFILEMODE"));
-    const std::string archiveFile =
-      (char *)sqlite3_column_text(statement.get(), idx("ARCHIVEFILE"));
-    const uint16_t copyNb =
-      sqlite3_column_int(statement.get(), idx("COPYNB"));
-    const std::string tapePolMName =
-      (char *)sqlite3_column_text(statement.get(), idx("TAPEPOOL"));
-    const uint16_t requesterUid =
-      sqlite3_column_int(statement.get(), idx("UID"));
-    const uint16_t requesterGid =
-      sqlite3_column_int(statement.get(), idx("GID"));
-    const std::map<uint16_t, std::string> copyNbToPoolMap;
-    const uint64_t priority =
-      sqlite3_column_int(statement.get(), idx("PRIORITY"));
-    const UserIdentity requester(requesterUid, requesterGid);
-    const std::string requesterHost = 
-      (char *)sqlite3_column_text(statement.get(),idx("HOST"));
-    const time_t creationTime =
-      sqlite3_column_int(statement.get(), idx("CREATIONTIME"));
-    const UserIdentity remoteFileOwner(remoteFileUid, remoteFileGid);
-    const RemoteFileStatus remoteFileStatus(remoteFileOwner, remoteFileMode,
-      remoteFileSize);
-    const CreationLog log(requester, requesterHost, creationTime);
-    rqsts[tapePool].push_back(ArchiveToTapeCopyRequest(
-      RemotePathAndStatus(remoteFilePath, remoteFileStatus),
-      archiveFile,
-      copyNb,
-      tapePoolName,
-      priority,
-      log
-    ));
-  }
-  return rqsts;
-}
-
-//------------------------------------------------------------------------------
-// getTapePool
-//------------------------------------------------------------------------------
-cta::TapePool cta::MockSchedulerDatabase::getTapePool(const std::string &name)
-  const {
-  std::ostringstream query;
-  cta::TapePool pool;
-  query << "SELECT NAME, NBPARTIALTAPES, UID, GID, HOST, CREATIONTIME, COMMENT"
-    " FROM TAPEPOOL WHERE NAME='" << name << "';";
-  sqlite3_stmt *s = NULL;
-  const int rc = sqlite3_prepare(m_dbHandle, query.str().c_str(), -1, &s, 0 );
-  std::unique_ptr<sqlite3_stmt, SQLiteStatementDeleter> statement(s);
-  if(SQLITE_OK != rc){    
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << sqlite3_errmsg(m_dbHandle);
-    throw(exception::Exception(msg.str()));
-  }
-  switch(sqlite3_step(statement.get())) {
-  case SQLITE_ROW:
-    {
-      SqliteColumnNameToIndex idx(statement.get());
-      pool = TapePool(
-        (char *)sqlite3_column_text(statement.get(),idx("NAME")),
-        sqlite3_column_int(statement.get(),idx("NBPARTIALTAPES")),
-        MountCriteriaByDirection(MountCriteria(0,0,0,0),MountCriteria(0,0,0,0)),
-        CreationLog(
-          UserIdentity(sqlite3_column_int(statement.get(),idx("UID")),
-            sqlite3_column_int(statement.get(),idx("GID"))),
-          (char *)sqlite3_column_text(statement.get(),idx("HOST")),
-          time_t(sqlite3_column_int(statement.get(),idx("CREATIONTIME"))),
-          (char *)sqlite3_column_text(statement.get(),idx("COMMENT"))
-        )
-      );
-    }
-    break;
-  case SQLITE_DONE:
-    {
-      std::ostringstream msg;
-      msg << __FUNCTION__ << " - No tape pool found with name: " << name;
-      throw(exception::Exception(msg.str()));
-    }
-    break;
-  default:
-    {
-      std::ostringstream msg;
-      msg << __FUNCTION__ << " - SQLite error";
-      throw(exception::Exception(msg.str()));
-    }
-  }
-  return pool;
-}
-
-//------------------------------------------------------------------------------
-// getArchiveRequests
-//------------------------------------------------------------------------------
-std::list<cta::ArchiveToTapeCopyRequest> cta::MockSchedulerDatabase::
-  getArchiveRequests(const std::string &tapePoolName) const {
-  std::ostringstream query;
-  std::list<ArchiveToTapeCopyRequest> rqsts;
-  query << "SELECT STATE, REMOTEFILEPATH, REMOTEFILEUID, REMOTEFILEGID,"
-    " REMOTEFILESIZE, REMOTEFILEMODE, ARCHIVEFILE, TAPEPOOL, COPYNB,"
-    " PRIORITY, UID, GID, HOST, CREATIONTIME FROM ARCHIVETOTAPECOPYREQUEST"
-    " WHERE TAPEPOOL='" << tapePoolName << "' ORDER BY ARCHIVEFILE;";
-  sqlite3_stmt *s = NULL;
-  const int rc = sqlite3_prepare(m_dbHandle, query.str().c_str(), -1, &s, 0 );
-  std::unique_ptr<sqlite3_stmt, SQLiteStatementDeleter> statement(s);
-  if(SQLITE_OK != rc){    
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << sqlite3_errmsg(m_dbHandle);
-    throw(exception::Exception(msg.str()));
-  }
-  while(SQLITE_ROW == sqlite3_step(statement.get())) {
-    const SqliteColumnNameToIndex idx(statement.get());
-    const std::string tapePoolName =
-      (char *)sqlite3_column_text(statement.get(), idx("TAPEPOOL"));
-    const TapePool tapePool = getTapePool(tapePoolName);
-    const std::string remoteFilePath =
-      (char *)sqlite3_column_text(statement.get(), idx("REMOTEFILEPATH"));
-    const uint32_t remoteFileUid =
-      sqlite3_column_int(statement.get(), idx("REMOTEFILEUID"));
-    const uint32_t remoteFileGid =
-      sqlite3_column_int(statement.get(), idx("REMOTEFILEGID"));
-    const uint64_t remoteFileSize =
-      sqlite3_column_int(statement.get(), idx("REMOTEFILESIZE"));
-    const mode_t remoteFileMode =
-      sqlite3_column_int(statement.get(), idx("REMOTEFILEMODE"));
-    const std::string archiveFile = (char *)sqlite3_column_text(statement.get(),
-      idx("ARCHIVEFILE"));
-    const uint16_t copyNb = sqlite3_column_int(statement.get(), idx("COPYNB"));
-    const std::string tapePolMName = (char *)sqlite3_column_text(
-      statement.get(), idx("TAPEPOOL"));
-    const uint16_t requesterUid = sqlite3_column_int(statement.get(),
-      idx("UID"));
-    const uint16_t requesterGid = sqlite3_column_int(statement.get(),
-      idx("GID"));
-    const std::map<uint16_t, std::string> copyNbToPoolMap;
-    const uint64_t priority = sqlite3_column_int(statement.get(),
-      idx("PRIORITY"));
-    const UserIdentity requester(requesterUid, requesterGid);
-    const std::string requesterHost = 
-      (char *)sqlite3_column_text(statement.get(),idx("HOST"));
-    const time_t creationTime = sqlite3_column_int(statement.get(),
-      idx("CREATIONTIME"));
-    const UserIdentity remoteFileOwner(remoteFileUid, remoteFileGid);
-    const RemoteFileStatus remoteFileStatus(remoteFileOwner, remoteFileMode,
-      remoteFileSize);
-    const CreationLog log(requester, requesterHost, creationTime, "");
-    rqsts.push_back(ArchiveToTapeCopyRequest(
-      RemotePathAndStatus(remoteFilePath, remoteFileStatus),
-      archiveFile,
-      copyNb,
-      tapePoolName,
-      priority,
-      log
-    ));
-  }
-  return rqsts;
-}
-
-//------------------------------------------------------------------------------
-// deleteArchiveRequest
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::deleteArchiveRequest(
-  const SecurityIdentity &cliIdentity,
-  const std::string &archiveFile) {
-  char *zErrMsg = 0;
-  std::ostringstream query;
-  query << "DELETE FROM ARCHIVETOTAPECOPYREQUEST WHERE ARCHIVEFILE='" <<
-    archiveFile << "';";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-    sqlite3_free(zErrMsg);
-    throw(exception::Exception(msg.str()));
-  }
-  const int nbRowsModified = sqlite3_changes(m_dbHandle);
-  if(0 >= nbRowsModified) {
-    std::ostringstream msg;
-    msg << "Archive request for archive file " << archiveFile <<
-      " does not exist";
-    throw(exception::Exception(msg.str()));
-  }
-}
-
-//------------------------------------------------------------------------------
-// markArchiveRequestForDeletion
-//------------------------------------------------------------------------------
-std::unique_ptr<cta::SchedulerDatabase::ArchiveToFileRequestCancelation> 
-  cta::MockSchedulerDatabase::markArchiveRequestForDeletion(
-  const SecurityIdentity &cliIdentity,
-  const std::string &archiveFile) {
-  char *zErrMsg = 0;
-  std::ostringstream query;
-  query << "UPDATE ARCHIVETOTAPECOPYREQUEST SET STATE='PENDING_NS_DELETION'"
-    " WHERE ARCHIVEFILE='" << archiveFile << "';";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-    sqlite3_free(zErrMsg);
-    throw(exception::Exception(msg.str()));
-  }
-  const int nbRowsModified = sqlite3_changes(m_dbHandle);
-  if(0 >= nbRowsModified) {
-    std::ostringstream msg;
-    msg << "An archive requests for archive file " << archiveFile <<
-      " does not exist";
-    throw(exception::Exception(msg.str()));
-  }
-  return std::unique_ptr<cta::SchedulerDatabase::ArchiveToFileRequestCancelation>(
-      new ArchiveToFileRequestCancelation(requester, archiveFile, *this));
-}
-
-void cta::MockSchedulerDatabase::ArchiveToFileRequestCancelation::complete() {
-  m_parent.deleteArchiveRequest(m_requester, m_archiveFile);
-}
-
-//------------------------------------------------------------------------------
-// queue
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::queue(const RetrieveToDirRequest &rqst) {
-  throw exception::Exception(std::string(__FUNCTION__) + " not implemented");
-}
-
-//------------------------------------------------------------------------------
-// queue
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::queue(const RetrieveToFileRequest &rqst) {
-/*
-  char *zErrMsg = 0;
-  const SecurityIdentity &cliIdentity = rqst.getRequester();
-  std::ostringstream query;
-  query << "INSERT INTO RETRIEVEFROMTAPECOPYREQUEST(ARCHIVEFILE, REMOTEFILE, COPYNB, VID, FSEQ, BLOCKID, PRIORITY, UID,"
-    " GID, HOST, CREATIONTIME) VALUES(" << (int)cta::RetrieveFromTapeCopyRequestState::PENDING <<
-    ",'" << rqst.archiveFile << "','" << rqst.remoteFile << "'," <<
-    requester.getUser().uid << "," << requester.getUser().gid <<
-    "," << (int)time(NULL) << ");";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-    sqlite3_free(zErrMsg);
-    throw(exception::Exception(msg.str()));
-  }
-*/
-}
-
-//------------------------------------------------------------------------------
-// getRetrieveRequests
-//------------------------------------------------------------------------------
-std::map<cta::Tape, std::list<cta::RetrieveFromTapeCopyRequest> >
-  cta::MockSchedulerDatabase::getRetrieveRequests() const {
-  return std::map<cta::Tape, std::list<cta::RetrieveFromTapeCopyRequest> >();
-/*
-  std::ostringstream query;
-  std::map<cta::Tape, std::list<cta::RetrieveFromTapeCopyRequest> > map;
-  query << "SELECT ARCHIVEFILE, REMOTEFILE, COPYNB, VID, FSEQ, BLOCKID,"
-    " PRIORITY, UID, GID, CREATIONTIME FROM RETRIEVEFROMTAPECOPYREQUEST ORDER"
-    " BY REMOTEFILE;";
-  sqlite3_stmt *s = NULL;
-  const int rc = sqlite3_prepare(m_dbHandle, query.str().c_str(), -1, &s, 0 );
-  std::unique_ptr<sqlite3_stmt, SQLiteStatementDeleter> statement(s);
-  if(SQLITE_OK != rc){    
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << sqlite3_errmsg(m_dbHandle);
-    throw(exception::Exception(msg.str()));
-  }
-  while(SQLITE_ROW == sqlite3_step(statement.get())) {
-    SqliteColumnNameToIndex idx(statement.get());
-    const std::string vid = (char *)sqlite3_column_text(statement.get(),idx("VID"));
-    const Tape tape = getTape(vid);
-    const uint16_t requesterUid = sqlite3_column_int(statement.get(),
-      idx("UID"));
-    const uint16_t requesterGid = sqlite3_column_int(statement.get(),
-      idx("GID"));
-    UserIdentity requester(requesterUid, requesterGid);
-    SecurityIdentity requesterAndHost(
-    map[tape].push_back(RetrieveFromTapeCopyRequest(
-      (char *)sqlite3_column_text(statement.get(),idx("ARCHIVEFILE")),
-      (char *)sqlite3_column_text(statement.get(),idx("REMOTEFILE")),
-      UserIdentity(sqlite3_column_int(statement.get(),idx("UID")),
-      sqlite3_column_int(statement.get(),idx("GID"))),
-      time_t(sqlite3_column_int(statement.get(),idx("CREATIONTIME")))
-    ));
-  }
-  return map;
-*/
-}
-
-//------------------------------------------------------------------------------
-// getTape
-//------------------------------------------------------------------------------
-cta::Tape cta::MockSchedulerDatabase::getTape(const std::string &vid) const {
-  std::ostringstream query;
-  cta::Tape tape;
-  query << "SELECT VID, NBFILES, LOGICALLIBRARY, TAPEPOOL, CAPACITY_BYTES,"
-    " DATAONTAPE_BYTES, UID, GID, HOST, CREATIONTIME, COMMENT FROM TAPE"
-    " WHERE VID='" << vid << "';";
-  sqlite3_stmt *s = NULL;
-  const int rc = sqlite3_prepare(m_dbHandle, query.str().c_str(), -1, &s, 0 );
-  std::unique_ptr<sqlite3_stmt, SQLiteStatementDeleter> statement(s);
-  if(SQLITE_OK != rc){    
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << sqlite3_errmsg(m_dbHandle);
-    throw(exception::Exception(msg.str()));
-  }
-  switch(sqlite3_step(statement.get())) {
-  case SQLITE_ROW:
-    {
-      SqliteColumnNameToIndex idx(statement.get());
-      tape = Tape(
-        (char *)sqlite3_column_text(statement.get(),idx("VID")),
-        (uint64_t)sqlite3_column_int64(statement.get(),idx("NBFILES")),
-        (char *)sqlite3_column_text(statement.get(),idx("LOGICALLIBRARY")),
-        (char *)sqlite3_column_text(statement.get(),idx("TAPEPOOL")),
-        (uint64_t)sqlite3_column_int64(statement.get(),idx("CAPACITY_BYTES")),
-        (uint64_t)sqlite3_column_int64(statement.get(),idx("DATAONTAPE_BYTES")),
-        CreationLog(UserIdentity(sqlite3_column_int(statement.get(),idx("UID")),
-            sqlite3_column_int(statement.get(),idx("GID"))),
-          (char *)sqlite3_column_text(statement.get(),idx("COMMENT")),
-          time_t(sqlite3_column_int(statement.get(),idx("CREATIONTIME"))),
-          (char *)sqlite3_column_text(statement.get(),idx("COMMENT"))),
-          Tape::Status()
-      );
-    }
-    break;
-  case SQLITE_DONE:
-    {
-      std::ostringstream msg;
-      msg << __FUNCTION__ << " - No tape found with vid: " << vid;
-      throw(exception::Exception(msg.str()));
-    }
-    break;
-  default:
-    {
-      std::ostringstream msg;
-      msg << __FUNCTION__ << " - SQLite error";
-      throw(exception::Exception(msg.str()));
-    }
-  }
-  return tape;
-}
-
-//------------------------------------------------------------------------------
-// getRetrieveRequests
-//------------------------------------------------------------------------------
-std::list<cta::RetrieveFromTapeCopyRequest> cta::MockSchedulerDatabase::getRetrieveRequests(
-  const std::string &vid) const {
-  throw exception::Exception(std::string(__FUNCTION__) + " not implemented");
-}
-  
-//------------------------------------------------------------------------------
-// deleteRetrieveRequest
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::deleteRetrieveRequest(
-  const SecurityIdentity &cliIdentity,
-  const std::string &remoteFile) {
-  char *zErrMsg = 0;
-  std::ostringstream query;
-  query << "DELETE FROM RETRIEVEFROMTAPECOPYREQUEST WHERE REMOTEFILE='" << remoteFile << "';";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-    sqlite3_free(zErrMsg);
-    throw(exception::Exception(msg.str()));
-  }
-
-  const int nbRowsModified = sqlite3_changes(m_dbHandle);
-  if(0 >= nbRowsModified) {
-    std::ostringstream msg;
-    msg << "Retrival job for remote file file " << remoteFile <<
-      " does not exist";
-    throw(exception::Exception(msg.str()));
-  }
-}
-
-//------------------------------------------------------------------------------
-// createAdminUser
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::createAdminUser(
-  const SecurityIdentity &cliIdentity,
-  const UserIdentity &user,
-  const std::string &comment) {
-  const uint32_t adminUid = user.uid;
-  const uint32_t adminGid = user.gid;
-  char *zErrMsg = 0;
-  std::ostringstream query;
-  query << "INSERT INTO ADMINUSER(ADMIN_UID, ADMIN_GID, UID, GID,"
-    " CREATIONTIME, COMMENT) VALUES(" << adminUid << "," << adminGid << "," <<
-    requester.getUser().uid << "," << requester.getUser().gid << ","
-    << (int)time(NULL) << ",'" << comment << "');";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-    sqlite3_free(zErrMsg);
-    throw(exception::Exception(msg.str()));
-  }
-  const int nbRowsModified = sqlite3_changes(m_dbHandle);
-  if(0 >= nbRowsModified) {
-    std::ostringstream msg;
-    msg << "Admin user uid=" << adminUid << " gid=" << adminGid <<
-      " already exists";
-    throw(exception::Exception(msg.str()));
-  }
-}
-
-//------------------------------------------------------------------------------
-// deleteAdminUser
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::deleteAdminUser(
-  const SecurityIdentity &cliIdentity,
-  const UserIdentity &user) {
-  char *zErrMsg = 0;
-  std::ostringstream query;
-  query << "DELETE FROM ADMINUSER WHERE ADMIN_UID=" << user.uid <<
-    " AND ADMIN_GID=" << user.gid <<";";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-      std::ostringstream msg;
-      msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-      sqlite3_free(zErrMsg);
-      throw(exception::Exception(msg.str()));
-  }
-  const int nbRowsModified = sqlite3_changes(m_dbHandle);
-  if(0 >= nbRowsModified) {
-    std::ostringstream msg;
-    msg << "Admin user " << user.uid << ":" << user.gid <<
-      " does not exist";
-    throw(exception::Exception(msg.str()));
-  }
-}
-  
-//------------------------------------------------------------------------------
-// getAdminUsers
-//------------------------------------------------------------------------------
-std::list<cta::common::admin::AdminUser> cta::MockSchedulerDatabase::getAdminUsers() const {
-  std::ostringstream query;
-  std::list<cta::common::admin::AdminUser> list;
-  query << "SELECT ADMIN_UID, ADMIN_GID, UID, GID, HOST, CREATIONTIME, COMMENT"
-    " FROM ADMINUSER ORDER BY ADMIN_UID, ADMIN_GID;";
-  sqlite3_stmt *s = NULL;
-  const int rc = sqlite3_prepare(m_dbHandle, query.str().c_str(), -1, &s, 0 );
-  std::unique_ptr<sqlite3_stmt, SQLiteStatementDeleter> statement(s);
-  if(SQLITE_OK != rc){    
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << sqlite3_errmsg(m_dbHandle);
-    throw(exception::Exception(msg.str()));
-  }
-  while(SQLITE_ROW == sqlite3_step(statement.get())) {
-    SqliteColumnNameToIndex idx(statement.get());
-    const UserIdentity user(sqlite3_column_int(statement.get(),idx("ADMIN_UID")),
-      sqlite3_column_int(statement.get(),idx("ADMIN_GID")));
-    const UserIdentity requester(sqlite3_column_int(statement.get(),idx("UID")),
-      sqlite3_column_int(statement.get(),idx("GID")));
-    CreationLog log(requester,
-      (char *)sqlite3_column_text(statement.get(),idx("COMMENT")),
-      time_t(sqlite3_column_int(statement.get(),idx("CREATIONTIME"))),
-      (char *)sqlite3_column_text(statement.get(),idx("COMMENT")));
-    list.push_back(AdminUser(
-      user,
-      log
-    ));
-  }
-  return list;
-}
-
-//------------------------------------------------------------------------------
-// assertIsAdminOnAdminHost
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::assertIsAdminOnAdminHost(
-  const SecurityIdentity &id) const {
-  assertIsAdmin(id.getUser());
-  assertIsAdminHost(id.getHost());
-}
-
-//------------------------------------------------------------------------------
-// assertIsAdmin
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::assertIsAdmin(const UserIdentity &user)
-  const {
-  const uint32_t adminUid = user.uid;
-  const uint32_t adminGid = user.gid;
-  std::ostringstream query;
-  query << "SELECT COUNT(*) FROM ADMINUSER WHERE ADMIN_UID=" << adminUid <<
-    " AND ADMIN_GID=" << adminGid << ";";
-  sqlite3_stmt *s = NULL;
-  const int rc = sqlite3_prepare(m_dbHandle, query.str().c_str(), -1, &s, 0 );
-  std::unique_ptr<sqlite3_stmt, SQLiteStatementDeleter> statement(s);
-  if(SQLITE_OK != rc){    
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << sqlite3_errmsg(m_dbHandle);
-    throw(exception::Exception(msg.str()));
-  }
-  int count = 0;
-  while(SQLITE_ROW == sqlite3_step(statement.get())) {
-    count = sqlite3_column_int(statement.get(), 0);
-  }
-
-  if(0 >= count) {
-    std::ostringstream msg;
-    msg << "User uid=" << adminUid << " gid=" << adminGid <<
-      " is not an administrator";
-    throw exception::Exception(msg.str());
-  }
-}
-
-//------------------------------------------------------------------------------
-// assertIsAdminHost
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::assertIsAdminHost(const std::string &host)
-  const {
-  std::ostringstream query;
-  query << "SELECT COUNT(*) FROM ADMINHOST WHERE NAME='" << host << "';";
-  sqlite3_stmt *s = NULL;
-  const int rc = sqlite3_prepare(m_dbHandle, query.str().c_str(), -1, &s, 0 );
-  std::unique_ptr<sqlite3_stmt, SQLiteStatementDeleter> statement(s);
-  if(SQLITE_OK != rc){    
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << sqlite3_errmsg(m_dbHandle);
-    throw(exception::Exception(msg.str()));
-  }
-  int count = 0;
-  while(SQLITE_ROW == sqlite3_step(statement.get())) {
-    count = sqlite3_column_int(statement.get(), 0);
-  }
-
-  if(0 >= count) {
-    std::ostringstream msg;
-    msg << "Host " << host << " is not an administration host";
-    throw exception::Exception(msg.str());
-  }
-}
-
-//------------------------------------------------------------------------------
-// createAdminHost
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::createAdminHost(
-  const std::string &hostName,
-  const CreationLog & log) {
-  char *zErrMsg = 0;
-  std::ostringstream query;
-  query << "INSERT INTO ADMINHOST(NAME, UID, GID, HOST, CREATIONTIME, COMMENT)"
-    " VALUES('" << hostName << "',"<< log.user.uid << "," <<
-    log.user.gid << ", '" << log.host << "', " << log.time << ",'" << log.comment <<
-    "');";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-    sqlite3_free(zErrMsg);
-    throw(exception::Exception(msg.str()));
-  }
-
-  const int nbRowsModified = sqlite3_changes(m_dbHandle);
-  if(0 >= nbRowsModified) {
-    std::ostringstream msg;
-    msg << "Admin host " << hostName << " already exists";
-    throw(exception::Exception(msg.str()));
-  }
-}
-
-//------------------------------------------------------------------------------
-// deleteAdminHost
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::deleteAdminHost(
-  const SecurityIdentity &cliIdentity,
-  const std::string &hostName) {
-  char *zErrMsg = 0;
-  std::ostringstream query;
-  query << "DELETE FROM ADMINHOST WHERE NAME='" << hostName << "';";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-      std::ostringstream msg;
-      msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-      sqlite3_free(zErrMsg);
-      throw(exception::Exception(msg.str()));
-  }
-
-  const int nbRowsModified = sqlite3_changes(m_dbHandle);
-  if(0 >= nbRowsModified) {
-    std::ostringstream msg;
-    msg << "Admin host " << hostName << " does not exist";
-    throw(exception::Exception(msg.str()));
-  }
-}
-  
-//------------------------------------------------------------------------------
-// getAdminHosts
-//------------------------------------------------------------------------------
-std::list<cta::AdminHost> cta::MockSchedulerDatabase::getAdminHosts() const {
-  std::ostringstream query;
-  std::list<cta::AdminHost> list;
-  query << "SELECT NAME, UID, GID, HOST, CREATIONTIME, COMMENT"
-    " FROM ADMINHOST ORDER BY NAME;";
-  sqlite3_stmt *s = NULL;
-  const int rc = sqlite3_prepare(m_dbHandle, query.str().c_str(), -1, &s, 0 );
-  std::unique_ptr<sqlite3_stmt, SQLiteStatementDeleter> statement(s);
-  if(SQLITE_OK != rc){    
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << sqlite3_errmsg(m_dbHandle);
-    throw(exception::Exception(msg.str()));
-  }
-  while(SQLITE_ROW == sqlite3_step(statement.get())) {
-    SqliteColumnNameToIndex idx(statement.get());
-    const UserIdentity requester(sqlite3_column_int(statement.get(),idx("UID")),
-      sqlite3_column_int(statement.get(),idx("GID")));
-    const CreationLog log(requester, 
-      (char *)sqlite3_column_text(statement.get(),idx("HOST")),
-      time_t(sqlite3_column_int(statement.get(),idx("CREATIONTIME"))),
-      (char *)sqlite3_column_text(statement.get(),idx("COMMENT")));
-    list.push_back(AdminHost(
-      (char *)sqlite3_column_text(statement.get(),idx("NAME")),
-      log));
-  }
-  return list;
-}
-
-//------------------------------------------------------------------------------
-// createStorageClass
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::createStorageClass(
-  const std::string &name,
-  const uint16_t nbCopies, const CreationLog &creationLog) {
-  char *zErrMsg = 0;
-  std::ostringstream query;
-  query << "INSERT INTO STORAGECLASS(NAME, NBCOPIES, UID, GID, HOST, CREATIONTIME,"
-    " COMMENT) VALUES('" << name << "'," << (int)nbCopies << "," <<
-    creationLog.user.uid << "," << creationLog.user.gid << ", '" <<
-    creationLog.host << "', " <<
-    creationLog.time << ",'" << creationLog.comment << "');";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-    sqlite3_free(zErrMsg);
-    throw(exception::Exception(msg.str()));
-  }
-}
-
-//------------------------------------------------------------------------------
-// deleteStorageClass
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::deleteStorageClass(
-  const SecurityIdentity &cliIdentity,
-  const std::string &name) {
-  char *zErrMsg = 0;
-  std::ostringstream query;
-  query << "DELETE FROM STORAGECLASS WHERE NAME='" << name << "';";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-    sqlite3_free(zErrMsg);
-    throw(exception::Exception(msg.str()));
-  }
-
-  const int nbRowsModified = sqlite3_changes(m_dbHandle);
-  if(0 >= nbRowsModified) {
-    std::ostringstream msg;
-    msg << "Storage class " << name << " does not exist";
-    throw(exception::Exception(msg.str()));
-  }
-}
-
-//------------------------------------------------------------------------------
-// getStorageClasses
-//------------------------------------------------------------------------------
-std::list<cta::StorageClass> cta::MockSchedulerDatabase::getStorageClasses()
-  const {
-  std::ostringstream query;
-  std::list<cta::StorageClass> classes;
-  query << "SELECT NAME, NBCOPIES, UID, GID, HOST, CREATIONTIME, COMMENT FROM"
-    " STORAGECLASS ORDER BY NAME;";
-  sqlite3_stmt *s = NULL;
-  const int rc = sqlite3_prepare(m_dbHandle, query.str().c_str(), -1, &s, 0 );
-  std::unique_ptr<sqlite3_stmt, SQLiteStatementDeleter> statement(s);
-  if(SQLITE_OK != rc){    
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << sqlite3_errmsg(m_dbHandle);
-    throw(exception::Exception(msg.str()));
-  }
-  while(SQLITE_ROW == sqlite3_step(statement.get())) {
-    SqliteColumnNameToIndex idx(statement.get());
-    classes.push_back(StorageClass(
-      (char *)sqlite3_column_text(statement.get(),idx("NAME")),
-      sqlite3_column_int(statement.get(),idx("NBCOPIES")),
-      CreationLog(
-        UserIdentity(sqlite3_column_int(statement.get(),idx("UID")),
-          sqlite3_column_int(statement.get(),idx("GID"))),
-        (char *)sqlite3_column_text(statement.get(),idx("HOST")),
-        time_t(sqlite3_column_int(statement.get(),idx("CREATIONTIME"))),
-        (char *)sqlite3_column_text(statement.get(),idx("COMMENT"))
-      )
-    ));
-  }
-  return classes;
-}
-
-//------------------------------------------------------------------------------
-// getStorageClass
-//------------------------------------------------------------------------------
-cta::StorageClass cta::MockSchedulerDatabase::getStorageClass(
-  const std::string &name) const {
-  std::ostringstream query;
-  query << "SELECT NAME, NBCOPIES, UID, GID, HOST, CREATIONTIME, COMMENT"
-    " FROM STORAGECLASS WHERE NAME='" << name << "';";
-  sqlite3_stmt *s = NULL;
-  const int rc = sqlite3_prepare(m_dbHandle, query.str().c_str(), -1, &s, 0 );
-  std::unique_ptr<sqlite3_stmt, SQLiteStatementDeleter> statement(s);
-  if(SQLITE_OK != rc){    
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << sqlite3_errmsg(m_dbHandle);
-    throw(exception::Exception(msg.str()));
-  }
-  StorageClass storageClass;
-  switch(sqlite3_step(statement.get())) {
-  case SQLITE_ROW:
-    {
-      SqliteColumnNameToIndex idx(statement.get());
-      storageClass = cta::StorageClass(
-        (char *)sqlite3_column_text(statement.get(),idx("NAME")),
-        sqlite3_column_int(statement.get(),idx("NBCOPIES")),
-        CreationLog(
-          UserIdentity(sqlite3_column_int(statement.get(),idx("UID")),
-            sqlite3_column_int(statement.get(),idx("GID"))),
-          (char *)sqlite3_column_text(statement.get(),idx("HOST")),
-          time_t(sqlite3_column_int(statement.get(),idx("CREATIONTIME"))),
-          (char *)sqlite3_column_text(statement.get(),idx("COMMENT"))
-        )
-      );
-    }
-    break;
-  case SQLITE_DONE:
-    {
-      std::ostringstream msg;
-      msg << __FUNCTION__ << " - No storage class found with name " << name;
-      throw(exception::Exception(msg.str()));
-    }
-    break;
-  default:
-    {
-      std::ostringstream msg;
-      msg << __FUNCTION__ << " - SQLite error";
-      throw(exception::Exception(msg.str()));
-    }
-  }
-  return storageClass;
-}
-
-//------------------------------------------------------------------------------
-// createTapePool
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::createTapePool(
-  const std::string &name,
-  const uint32_t nbPartialTapes,
-  const CreationLog& creationLog) {
-  char *zErrMsg = 0;
-  std::ostringstream query;
-  query << "INSERT INTO TAPEPOOL(NAME, NBPARTIALTAPES, UID, GID, HOST, CREATIONTIME,"
-    " COMMENT) VALUES('" << name << "'," << (int)nbPartialTapes << "," <<
-    creationLog.user.uid << "," << creationLog.user.uid << "," <<
-    "'" << creationLog.host << "', " << 
-    (int)time(NULL) << ",'" << creationLog.comment << "');";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-    sqlite3_free(zErrMsg);
-    throw(exception::Exception(msg.str()));
-  }
-}
-
-//------------------------------------------------------------------------------
-// deleteTapePool
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::deleteTapePool(
-  const SecurityIdentity &cliIdentity,
-  const std::string &name) {
-  char *zErrMsg = 0;
-  std::ostringstream query;
-  query << "DELETE FROM TAPEPOOL WHERE NAME='" << name << "';";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-    sqlite3_free(zErrMsg);
-    throw(exception::Exception(msg.str()));
-  }
-
-  const int nbRowsModified = sqlite3_changes(m_dbHandle);
-  if(0 >= nbRowsModified) {
-    std::ostringstream msg;
-    msg << "Tape pool " << name << " does not exist";
-    throw(exception::Exception(msg.str()));
-  }
-}
-
-//------------------------------------------------------------------------------
-// getTapePools
-//------------------------------------------------------------------------------
-std::list<cta::TapePool> cta::MockSchedulerDatabase::getTapePools() const {
-  std::ostringstream query;
-  std::list<cta::TapePool> pools;
-  query << "SELECT NAME, NBPARTIALTAPES, UID, GID, HOST, CREATIONTIME, COMMENT FROM"
-    " TAPEPOOL ORDER BY NAME;";
-  sqlite3_stmt *s = NULL;
-  const int rc = sqlite3_prepare(m_dbHandle, query.str().c_str(), -1, &s, 0 );
-  std::unique_ptr<sqlite3_stmt, SQLiteStatementDeleter> statement(s);
-  if(SQLITE_OK != rc){    
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << sqlite3_errmsg(m_dbHandle);
-    throw(exception::Exception(msg.str()));
-  }
-  while(SQLITE_ROW == sqlite3_step(statement.get())) {
-    SqliteColumnNameToIndex idx(statement.get());
-    pools.push_back(TapePool(
-      (char *)sqlite3_column_text(statement.get(),idx("NAME")),
-      sqlite3_column_int(statement.get(),idx("NBPARTIALTAPES")),
-      MountCriteriaByDirection(), 
-      CreationLog(
-          UserIdentity(sqlite3_column_int(statement.get(),idx("UID")),
-            sqlite3_column_int(statement.get(),idx("GID"))),
-          (char *)sqlite3_column_text(statement.get(),idx("HOST")),
-          time_t(sqlite3_column_int(statement.get(),idx("CREATIONTIME"))),
-          (char *)sqlite3_column_text(statement.get(),idx("COMMENT"))
-        )
-    ));
-  }
-  return pools;
-}
-
-//------------------------------------------------------------------------------
-// createArchiveRoute
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::createArchiveRoute(
-  const std::string &storageClassName,
-  const uint16_t copyNb,
-  const std::string &tapePoolName,
-  const CreationLog &creationLog) {
-  const std::list<common::archiveRoute::ArchiveRoute> routes = getArchiveRoutesWithoutChecks(
-    storageClassName);
-  const StorageClass storageClass = getStorageClass(storageClassName);
-  if(routes.size() >= storageClass.nbCopies) {
-    std::ostringstream msg;
-    msg << "Too many archive routes for storage class "
-      << storageClassName;
-    throw(exception::Exception(msg.str()));
-  }
-
-  assertTapePoolIsNotAlreadyADestination(routes, tapePoolName);
-
-  char *zErrMsg = 0;
-  std::ostringstream query;
-  query << "INSERT INTO ARCHIVEROUTE(STORAGECLASS_NAME, COPYNB, TAPEPOOL,"
-    " UID, GID, HOST, CREATIONTIME, COMMENT) VALUES('" << storageClassName << "'," <<
-    (int)copyNb << ",'" << tapePoolName << "'," << creationLog.user.uid <<
-    "," << creationLog.user.gid << ",'" << creationLog.host << 
-    "'," << (int)time(NULL) << ",'" << creationLog.comment << "');";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-    sqlite3_free(zErrMsg);
-    throw(exception::Exception(msg.str()));
-  }
-
-  const int nbRowsModified = sqlite3_changes(m_dbHandle);
-  if(0 >= nbRowsModified) {
-    std::ostringstream msg;
-    msg << "Archive route for storage class " << storageClassName <<
-      " copy number " << copyNb << " already exists";
-    throw(exception::Exception(msg.str()));
-  }
-}
-
-//------------------------------------------------------------------------------
-// assertTapePoolIsNotAlreadyADestination
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::assertTapePoolIsNotAlreadyADestination(
-  const std::list<common::archiveRoute::ArchiveRoute> &routes,
-  const std::string &tapePoolName) const {
-  for(auto itor = routes.begin(); itor != routes.end(); itor++) {
-    if(tapePoolName == itor->tapePoolName) {
-      std::ostringstream msg;
-      msg << "Tape pool " << tapePoolName << " is already an archive"
-        " destination for storage class " << itor->storageClassName;
-      throw exception::Exception(msg.str());
-    }
-  }
-}
-
-//------------------------------------------------------------------------------
-// deleteArchiveRoute
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::deleteArchiveRoute(
-  const SecurityIdentity &cliIdentity,
-  const std::string &storageClassName,
-  const uint16_t copyNb) {
-  char *zErrMsg = 0;
-  std::ostringstream query;
-  query << "DELETE FROM ARCHIVEROUTE WHERE STORAGECLASS_NAME='" <<
-    storageClassName << "' AND COPYNB=" << (int)copyNb << ";";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-    sqlite3_free(zErrMsg);
-    throw(exception::Exception(msg.str()));
-  }
-
-  const int nbRowsModified = sqlite3_changes(m_dbHandle);
-  if(0 >= nbRowsModified) {
-    std::ostringstream msg;
-    msg << "Archive route for storage class " << storageClassName << 
-      " and copy number " << copyNb << " does not exist";
-    throw(exception::Exception(msg.str()));
-  }
-}
-
-//------------------------------------------------------------------------------
-// getArchiveRoutes
-//------------------------------------------------------------------------------
-std::list<cta::common::archiveRoute::ArchiveRoute> cta::MockSchedulerDatabase::getArchiveRoutes()
-  const {
-  std::ostringstream query;
-  std::list<cta::common::archiveRoute::ArchiveRoute> routes;
-  query << "SELECT STORAGECLASS_NAME, COPYNB, TAPEPOOL, UID, GID, HOST,"
-    " CREATIONTIME, COMMENT FROM ARCHIVEROUTE ORDER BY STORAGECLASS_NAME,"
-    " COPYNB;";
-  sqlite3_stmt *s = NULL;
-  const int rc = sqlite3_prepare(m_dbHandle, query.str().c_str(), -1, &s, 0 );
-  std::unique_ptr<sqlite3_stmt, SQLiteStatementDeleter> statement(s);
-  if(SQLITE_OK != rc){    
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << sqlite3_errmsg(m_dbHandle);
-    throw(exception::Exception(msg.str()));
-  }
-  while(SQLITE_ROW == sqlite3_step(statement.get())) {
-    SqliteColumnNameToIndex idx(statement.get());
-    routes.push_back(common::archiveRoute::ArchiveRoute(
-      (char *)sqlite3_column_text(statement.get(),idx("STORAGECLASS_NAME")),
-      sqlite3_column_int(statement.get(),idx("COPYNB")),
-      (char *)sqlite3_column_text(statement.get(),idx("TAPEPOOL")),
-      CreationLog(
-        UserIdentity(sqlite3_column_int(statement.get(),idx("UID")),
-          sqlite3_column_int(statement.get(),idx("GID"))),
-        (char *)sqlite3_column_text(statement.get(),idx("HOST")),
-        time_t(sqlite3_column_int(statement.get(),idx("CREATIONTIME"))),
-        (char *)sqlite3_column_text(statement.get(),idx("COMMENT"))
-      )
-    ));
-  }
-  return routes;
-}
-
-//------------------------------------------------------------------------------
-// getArchiveRoutes
-//------------------------------------------------------------------------------
-std::list<cta::common::archiveRoute::ArchiveRoute> cta::MockSchedulerDatabase::getArchiveRoutes(
-  const std::string &storageClassName) const {
-  std::ostringstream query;
-  const std::list<cta::common::archiveRoute::ArchiveRoute> routes = getArchiveRoutesWithoutChecks(
-    storageClassName);
-
-  const StorageClass storageClass = getStorageClass(storageClassName);
-  if(routes.size() < storageClass.nbCopies) {
-    std::ostringstream msg;
-    msg << "Incomplete archive routes for storage class "
-      << storageClassName;
-    throw(exception::Exception(msg.str()));
-  }
-
-  return routes;
-}
-
-//------------------------------------------------------------------------------
-// getArchiveRoutesWithoutChecks
-//------------------------------------------------------------------------------
-std::list<cta::common::archiveRoute::ArchiveRoute> cta::MockSchedulerDatabase::
-  getArchiveRoutesWithoutChecks(const std::string &storageClassName) const {
-  std::ostringstream query;
-  std::list<cta::common::archiveRoute::ArchiveRoute> routes;
-  query << "SELECT STORAGECLASS_NAME, COPYNB, TAPEPOOL, UID, GID, HOST,"
-    " CREATIONTIME, COMMENT FROM ARCHIVEROUTE WHERE STORAGECLASS_NAME='" <<
-    storageClassName << "' ORDER BY STORAGECLASS_NAME, COPYNB;";
-  sqlite3_stmt *s = NULL;
-  const int rc = sqlite3_prepare(m_dbHandle, query.str().c_str(), -1, &s, 0 );
-  std::unique_ptr<sqlite3_stmt, SQLiteStatementDeleter> statement(s);
-  if(SQLITE_OK != rc){    
-      std::ostringstream msg;
-      msg << __FUNCTION__ << " - SQLite error: " << sqlite3_errmsg(m_dbHandle);
-    throw(exception::Exception(msg.str()));
-  }
-  while(SQLITE_ROW == sqlite3_step(statement.get())) {
-    SqliteColumnNameToIndex idx(statement.get());
-    routes.push_back(common::archiveRoute::ArchiveRoute(
-      (char *)sqlite3_column_text(statement.get(),idx("STORAGECLASS_NAME")),
-      sqlite3_column_int(statement.get(),idx("COPYNB")),
-      (char *)sqlite3_column_text(statement.get(),idx("TAPEPOOL")),
-      CreationLog(
-        UserIdentity(sqlite3_column_int(statement.get(),idx("UID")),
-          sqlite3_column_int(statement.get(),idx("GID"))),
-        (char *)sqlite3_column_text(statement.get(),idx("HOST")),
-        time_t(sqlite3_column_int(statement.get(),idx("CREATIONTIME"))),
-        (char *)sqlite3_column_text(statement.get(),idx("COMMENT"))
-      )
-    ));
-  }
-  return routes;
-}
-
-//------------------------------------------------------------------------------
-// createLogicalLibrary
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::createLogicalLibrary(
-  const std::string &name,
-  const cta::CreationLog& creationLog) {
-  char *zErrMsg = 0;
-  std::ostringstream query;
-  query << "INSERT INTO LOGICALLIBRARY(NAME, UID, GID, HOST, CREATIONTIME, COMMENT)"
-    << " VALUES('" << name << "',"<< creationLog.user.uid << ","
-    << creationLog.user.gid << "," 
-    << " '" << creationLog.host << "', "
-    << creationLog.time << ",'" << creationLog.comment <<
-    "');";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-    sqlite3_free(zErrMsg);
-    throw(exception::Exception(msg.str()));
-  }
-}
-
-//------------------------------------------------------------------------------
-// deleteLogicalLibrary
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::deleteLogicalLibrary(
-  const SecurityIdentity &cliIdentity,
-  const std::string &name) {
-  char *zErrMsg = 0;
-  std::ostringstream query;
-  query << "DELETE FROM LOGICALLIBRARY WHERE NAME='" << name << "';";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-    sqlite3_free(zErrMsg);
-    throw(exception::Exception(msg.str()));
-  }
-
-  const int nbRowsModified = sqlite3_changes(m_dbHandle);
-  if(0 >= nbRowsModified) {
-    std::ostringstream msg;
-    msg << "Logical library " << name << " does not exist";
-    throw(exception::Exception(msg.str()));
-  }
-}
-
-//------------------------------------------------------------------------------
-// getLogicalLibraries
-//------------------------------------------------------------------------------
-std::list<cta::LogicalLibrary> cta::MockSchedulerDatabase::getLogicalLibraries()
-  const {
-  std::ostringstream query;
-  std::list<cta::LogicalLibrary> list;
-  query << "SELECT NAME, UID, GID, HOST, CREATIONTIME, COMMENT"
-    " FROM LOGICALLIBRARY ORDER BY NAME;";
-  sqlite3_stmt *s = NULL;
-  const int rc = sqlite3_prepare(m_dbHandle, query.str().c_str(), -1, &s, 0 );
-  std::unique_ptr<sqlite3_stmt, SQLiteStatementDeleter> statement(s);
-  if(SQLITE_OK != rc){    
-      std::ostringstream msg;
-      msg << __FUNCTION__ << " - SQLite error: " << sqlite3_errmsg(m_dbHandle);
-    throw(exception::Exception(msg.str()));
-  }
-  while(SQLITE_ROW == sqlite3_step(statement.get())) {
-    SqliteColumnNameToIndex idx(statement.get());
-    list.push_back(LogicalLibrary(
-      (char *)sqlite3_column_text(statement.get(),idx("NAME")),
-      CreationLog(
-        UserIdentity(sqlite3_column_int(statement.get(),idx("UID")),
-          sqlite3_column_int(statement.get(),idx("GID"))),
-        (char *)sqlite3_column_text(statement.get(),idx("HOST")),
-        time_t(sqlite3_column_int(statement.get(),idx("CREATIONTIME"))),
-        (char *)sqlite3_column_text(statement.get(),idx("COMMENT"))
-      )
-    ));
-  }
-  return list;
-}
-
-//------------------------------------------------------------------------------
-// createTape
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::createTape(
-  const std::string &vid,
-  const std::string &logicalLibraryName,
-  const std::string &tapePoolName,
-  const uint64_t capacityInBytes,
-  const CreationLog &creationLog) {
-  char *zErrMsg = 0;
-  std::ostringstream query;
-  query << "INSERT INTO TAPE(VID, LOGICALLIBRARY, TAPEPOOL,"
-    " CAPACITY_BYTES, DATAONTAPE_BYTES, UID, GID, HOST, CREATIONTIME, COMMENT)"
-    " VALUES('" << vid << "','" << logicalLibraryName << "','" << tapePoolName
-    << "',"<< (long unsigned int)capacityInBytes << ",0," <<
-    creationLog.user.uid << "," << creationLog.user.gid << ","
-    << "'" << creationLog.host << "', " << creationLog.time << ",'" 
-    << creationLog.comment << "');";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-    sqlite3_free(zErrMsg);
-    throw(exception::Exception(msg.str()));
-  }
-}
-
-//------------------------------------------------------------------------------
-// deleteTape
-//------------------------------------------------------------------------------
-void cta::MockSchedulerDatabase::deleteTape(
-  const SecurityIdentity &cliIdentity,
-  const std::string &vid) {
-  char *zErrMsg = 0;
-  std::ostringstream query;
-  query << "DELETE FROM TAPE WHERE NAME='" << vid << "';";
-  if(SQLITE_OK != sqlite3_exec(m_dbHandle, query.str().c_str(), 0, 0,
-    &zErrMsg)) {
-    std::ostringstream msg;
-    msg << __FUNCTION__ << " - SQLite error: " << zErrMsg;
-    sqlite3_free(zErrMsg);
-    throw(exception::Exception(msg.str()));
-  }
-
-  const int nbRowsModified = sqlite3_changes(m_dbHandle);
-  if(0 >= nbRowsModified) {
-    std::ostringstream msg;
-    msg << "Tape " << vid << " does not exist";
-    throw(exception::Exception(msg.str()));
-  }
-}
-
-//------------------------------------------------------------------------------
-// getTapes
-//------------------------------------------------------------------------------
-std::list<cta::Tape> cta::MockSchedulerDatabase::getTapes() const {
-  std::ostringstream query;
-  std::list<cta::Tape> tapes;
-  query << "SELECT VID, NBFILES, LOGICALLIBRARY, TAPEPOOL, CAPACITY_BYTES,"
-    " DATAONTAPE_BYTES, UID, GID, HOST, CREATIONTIME, COMMENT"
-    " FROM TAPE ORDER BY VID;";
-  sqlite3_stmt *s = NULL;
-  const int rc = sqlite3_prepare(m_dbHandle, query.str().c_str(), -1, &s, 0 );
-  std::unique_ptr<sqlite3_stmt, SQLiteStatementDeleter> statement(s);
-  if(SQLITE_OK != rc){    
-      std::ostringstream msg;
-      msg << __FUNCTION__ << " - SQLite error: " << sqlite3_errmsg(m_dbHandle);
-    throw(exception::Exception(msg.str()));
-  }
-  while(SQLITE_ROW == sqlite3_step(statement.get())) {
-    SqliteColumnNameToIndex idx(statement.get());
-    tapes.push_back(Tape(
-      (char *)sqlite3_column_text(statement.get(),idx("VID")),
-      (uint64_t)sqlite3_column_int64(statement.get(),idx("NBFILES")),
-      (char *)sqlite3_column_text(statement.get(),idx("LOGICALLIBRARY")),
-      (char *)sqlite3_column_text(statement.get(),idx("TAPEPOOL")),
-      (uint64_t)sqlite3_column_int64(statement.get(),idx("CAPACITY_BYTES")),
-      (uint64_t)sqlite3_column_int64(statement.get(),idx("DATAONTAPE_BYTES")),
-      CreationLog(UserIdentity(sqlite3_column_int(statement.get(),idx("UID")),
-          sqlite3_column_int(statement.get(),idx("GID"))),
-        (char *)sqlite3_column_text(statement.get(),idx("COMMENT")),
-        time_t(sqlite3_column_int(statement.get(),idx("CREATIONTIME"))),
-        (char *)sqlite3_column_text(statement.get(),idx("COMMENT"))),
-     Tape::Status()
-    ));
-  }
-  return tapes;
-}
diff --git a/scheduler/mockDB/MockSchedulerDatabase.hpp b/scheduler/mockDB/MockSchedulerDatabase.hpp
deleted file mode 100644
index d70fd771ddf7da0eaded57026228c2409279843d..0000000000000000000000000000000000000000
--- a/scheduler/mockDB/MockSchedulerDatabase.hpp
+++ /dev/null
@@ -1,536 +0,0 @@
-/*
- * The CERN Tape Archive (CTA) project
- * Copyright (C) 2015  CERN
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include "scheduler/SchedulerDatabase.hpp"
-#include "common/SecurityIdentity.hpp"
-#include "common/exception/Exception.hpp"
-
-#include <sqlite3.h>
-
-namespace cta {
-  
-/**
- * A mock implementation of the database of a tape resource scheduler.
- */
-class MockSchedulerDatabase: public SchedulerDatabase {
-public:
-
-  /**
-   * Constructor.
-   */
-  MockSchedulerDatabase();
-
-  /**
-   * Destructor.
-   */
-  ~MockSchedulerDatabase() throw();
-
-  CTA_GENERATE_EXCEPTION_CLASS(NotImplemented);
-  
-  /**
-   * A function dumping the relevant mount information for deciding which
-   * tape to mount next.
-   */
-  virtual std::unique_ptr<TapeMountDecisionInfo> getMountInfo();
-  
-  /*
-   * Subclass allowing the tracking and automated cleanup of a 
-   * ArchiveToFile requests on the SchdulerDB. Those 2 operations (creation+close
-   * or cancel) surround an NS operation. This class can keep references, locks,
-   * etc... handy to simplify the implementation of the completion and cancelling
-   * (plus the destructor in case the caller fails half way through).
-   */ 
-  class ArchiveToFileRequestCreation:
-    public SchedulerDatabase::ArchiveRequestCreation {
-  public:
-    ArchiveToFileRequestCreation(sqlite3 * dbHandle, 
-      const std::string & archiveFile,
-      const SecurityIdentity & requester,
-      MockSchedulerDatabase & parent);
-    virtual void complete();
-    virtual void cancel();
-    virtual ~ArchiveToFileRequestCreation();
-  private:
-    sqlite3 *m_dbHandle;
-    std::string m_archiveFile;
-    SecurityIdentity m_requester;
-    MockSchedulerDatabase & m_parent;
-  };
-  /**
-   * Queues the specified request.
-   *
-   * @param rqst The request.
-   */
-  
-   void queue(const ArchiveToDirRequest &rqst);
-
-  /**
-   * Queues the specified request.
-   *
-   * @param rqst The request.
-   */
-  std::unique_ptr<SchedulerDatabase::ArchiveRequestCreation> queue(const ArchiveRequest &rqst);
-  
-  /**
-   * Queues the specified request.
-   *
-   * @param rqst The request.
-   */
-  std::unique_ptr<ArchiveToFileRequestCreation> queue(const cta::common::dataStructures::ArchiveRequest &request, const uint64_t archiveFileId);
-
-  /**
-   * Returns all of the queued archive requests.  The returned requests are
-   * grouped by tape pool and then sorted by creation time, oldest first.
-   *
-   * @return The queued requests.
-   */
-  std::map<TapePool, std::list<ArchiveToTapeCopyRequest> >
-    getArchiveRequests() const;
-
-  /**
-   * Returns the list of queued archive requests for the specified tape pool.
-   * The returned requests are sorted by creation time, oldest first.
-   *
-   * @param tapePoolName The name of the tape pool.
-   * @return The queued requests.
-   */
-  std::list<ArchiveToTapeCopyRequest> getArchiveRequests(
-    const std::string &tapePoolName) const;
-
-  /**
-   * Deletes the specified archive request.
-   *
-   * @param requester The identity of the requester.
-   * @param archiveFile The absolute path of the destination file within the
-   * archive namespace.
-   */
-  void deleteArchiveRequest(
-    const SecurityIdentity &cliIdentity,
-    const std::string &archiveFile);
-
-  /*
-   * Subclass allowing the tracking and automated cleanup of a 
-   * ArchiveToFile requests on the SchdulerDB for deletion.
-   * This will mark the request as to be deleted, and then add it to the agent's
-   * list. In a second step, the request will be completely deleted when calling
-   * the complete() method.
-   * In case of failure, the request will be queued to the orphaned requests queue,
-   * so that the scheduler picks it up later.
-   */ 
-  class ArchiveToFileRequestCancelation: public SchedulerDatabase::ArchiveToFileRequestCancelation {
-  public:
-    ArchiveToFileRequestCancelation(const SecurityIdentity &cliIdentity,
-      const std::string &archiveFile, MockSchedulerDatabase & parent): m_requester(requester), 
-      m_archiveFile(archiveFile), m_parent(parent) {}
-    virtual void complete();
-    virtual ~ArchiveToFileRequestCancelation() {};
-  private:
-    SecurityIdentity m_requester;
-    std::string m_archiveFile;
-    MockSchedulerDatabase & m_parent;
-  };
-  
-  /**
-   * Marks the specified archive request for deletion.  The request can only be
-   * fully deleted once the corresponding entry has been deleted from the
-   * archive namespace.
-   *
-   * @param requester The identity of the requester.
-   * @param archiveFile The absolute path of the destination file within the
-   * archive namespace.
-   */
-  std::unique_ptr<SchedulerDatabase::ArchiveToFileRequestCancelation> markArchiveRequestForDeletion(
-    const SecurityIdentity &cliIdentity,
-    const std::string &archiveFile);
-
-  /**
-   * Queues the specified request.
-   *
-   * @param rqst The request.
-   */
-  void queue(const RetrieveToDirRequest &rqst);
-
-  /**
-   * Queues the specified request.
-   *
-   * @param rqst The request.
-   */
-  void queue(const RetrieveToFileRequest &rqst);
-
-  /**
-   * Returns all of the existing retrieve jobs grouped by tape and then
-   * sorted by creation time in ascending order (oldest first).
-   *
-   * @return All of the existing retrieve jobs grouped by tape and then
-   * sorted by creation time in ascending order (oldest first).
-   */
-  std::map<Tape, std::list<RetrieveFromTapeCopyRequest> > getRetrieveRequests()
-    const;
-
-  /**
-   * Returns the list of retrieve jobs associated with the specified tape
-   * sorted by creation time in ascending order (oldest first).
-   *
-   * @param vid The volume identifier of the tape.
-   * @return The list of retrieve jobs associated with the specified tape
-   * sorted by creation time in ascending order (oldest first).
-   */
-  std::list<RetrieveFromTapeCopyRequest> getRetrieveRequests(
-    const std::string &vid) const;
-
-  /**
-   * Deletes the specified retrieve job.
-   *
-   * @param requester The identity of the requester.
-   * @param remoteFile The URL of the destination file.
-   */
-  void deleteRetrieveRequest(
-    const SecurityIdentity &cliIdentity,
-    const std::string &remoteFile);
-
-  /**
-   * Creates the specified administrator.
-   *
-   * @param requester The identity of the requester.
-   * @param user The identity of the administrator.
-   * @param comment The comment describing the sministrator.
-   */
-  void createAdminUser(
-    const SecurityIdentity &cliIdentity,
-    const UserIdentity &user,
-    const std::string &comment);
-
-  /**
-   * Deletes the specified administrator.
-   *
-   * @param requester The identity of the requester.
-   * @param user The identity of the administrator.
-   */
-  void deleteAdminUser(
-    const SecurityIdentity &cliIdentity,
-    const UserIdentity &user);
-
-  /**
-   * Returns the current list of administrators in lexicographical order.
-   *
-   * @return The current list of administrators in lexicographical order.
-   */
-  std::list<AdminUser> getAdminUsers() const;
-
-  /**
-   * Throws an exception if the specified user is not an administrator or if the
-   * user is not sending a request from an adminsitration host.
-   *
-   * @param id The identity of the user together with the host they are on.
-   */
-  void assertIsAdminOnAdminHost(const SecurityIdentity &id) const;
-
-  /**
-   * Creates the specified administration host.
-   *
-   * @param requester The identity of the requester.
-   * @param hostName The network name of the administration host.
-   * @param comment The comment describing the administration host.
-   */
-  void createAdminHost(
-    const std::string &hostName,
-    const CreationLog &creationLog);
-
-  /**
-   * Deletes the specified administration host.
-   *
-   * @param requester The identity of the requester.
-   * @param hostName The network name of the administration host.
-   */
-  void deleteAdminHost(
-    const SecurityIdentity &cliIdentity,
-    const std::string &hostName);
-
-  /**
-   * Returns the current list of administration hosts in lexicographical order.
-   *
-   * @return The current list of administration hosts in lexicographical order.
-   */
-  std::list<AdminHost> getAdminHosts() const;
-
-  /**
-   * Creates the specified storage class.
-   *
-   * @param requester The identity of the requester.
-   * @param name The name of the storage class.
-   * @param nbCopies The number of copies a file associated with this storage
-   * class should have on tape.
-   * @param comment The comment describing the storage class.
-   */
-  void createStorageClass(
-    const std::string &name,
-    const uint16_t nbCopies,
-    const CreationLog &creationLog);
-
-  /**
-   * Deletes the specified storage class.
-   *
-   * @param requester The identity of the requester.
-   * @param name The name of the storage class.
-   */
-  void deleteStorageClass(
-    const SecurityIdentity &cliIdentity,
-    const std::string &name);
-
-  /**
-   * Returns the current list of storage classes in lexicographical order.
-   *
-   * @return The current list of storage classes in lexicographical order.
-   */
-  std::list<StorageClass> getStorageClasses() const;
-
-  /**
-   * Returns the storage class with the specified name.
-   *
-   * @param name The name of the storage class.
-   * @return The storage class with the specified name.
-   */
-  StorageClass getStorageClass(const std::string &name) const;
-
-
-  /**
-   * Creates a tape pool with the specified name.
-   *
-   * @param name The name of the tape pool.
-   * @param nbPartialTapes The maximum number of tapes that can be partially
-   * full at any moment in time.
-   * @param creationLog The who, where, when an why of this modification.
-   */
-  virtual void createTapePool(
-    const std::string &name,
-    const uint32_t nbPartialTapes,
-    const CreationLog& creationLog);
-
-  /**
-   * Delete the tape pool with the specified name.
-   *
-   * @param requester The identity of the requester.
-   * @param name The name of the tape pool.
-   */
-  void deleteTapePool(
-    const SecurityIdentity &cliIdentity,
-    const std::string &name);
-
-
-  virtual void setTapePoolMountCriteria(const std::string& tapePool, const MountCriteriaByDirection& mountCriteriaByDirection);
-
-  
-  /**
-   * Gets the current list of tape pools in lexicographical order.
-   *
-   * @return The current list of tape pools in lexicographical order.
-   */
-  std::list<TapePool> getTapePools() const;
-
-  /**
-   * Creates the specified archive route.
-   *
-   * @param requester The identity of the requester.
-   * @param storageClassName The name of the storage class that identifies the
-   * source disk files.
-   * @param copyNb The tape copy number.
-   * @param tapePoolName The name of the destination tape pool.
-   * @param comment The comment describing the archive route.
-   */
-  void createArchiveRoute(
-    const std::string &storageClassName,
-    const uint16_t copyNb,
-    const std::string &tapePoolName,
-    const CreationLog &creationLog);
-
-  /**
-   * Deletes the specified archive route.
-   *
-   * @param requester The identity of the requester.
-   * @param storageClassName The name of the storage class that identifies the
-   * source disk files.
-   * @param copyNb The tape copy number.
-   */
-  void deleteArchiveRoute(
-    const SecurityIdentity &cliIdentity,
-    const std::string &storageClassName,
-    const uint16_t copyNb);
-
-  /**
-   * Returns the current list of archive routes.
-   *
-   * @return The current list of archive routes.
-   */
-  std::list<ArchiveRoute> getArchiveRoutes() const;
-
-  /**
-   * Returns the list of archive routes for the specified storage class.
-   *
-   * This method throws an exception if the list of archive routes is
-   * incomplete.  For example this method will throw an exception if the number
-   * of tape copies in the specified storage class is 2 but only one archive
-   * route has been created in the scheduler database for the storage class.
-   *
-   * @param storageClassName The name of the storage class.
-   * @return The list of archive routes for the specified storage class.
-   */
-  std::list<common::archiveRoute::ArchiveRoute> getArchiveRoutes(
-    const std::string &storageClassName) const;
-
-  /**
-   * Creates a logical library with the specified name.
-   *
-   * @param requester The identity of the requester.
-   * @param name The name of the logical library.
-   * @param comment The comment describing the logical library.
-   */
-  void createLogicalLibrary(
-    const std::string &name,
-    const cta::CreationLog& creationLog);
-
-  /**
-   * Deletes the logical library with the specified name.
-   *
-   * @param requester The identity of the requester.
-   * @param name The name of the logical library.
-   */
-  void deleteLogicalLibrary(
-    const SecurityIdentity &cliIdentity,
-    const std::string &name);
-
-  /**
-   * Returns the current list of libraries in lexicographical order.
-   *
-   * @return The current list of libraries in lexicographical order.
-   */
-  std::list<LogicalLibrary> getLogicalLibraries() const;
-
-  /**
-   * Creates a tape.
-   *
-   * @param vid The volume identifier of the tape.
-   * @param logicalLibraryName The name of the logical library to which the tape
-   * belongs.
-   * @param tapePoolName The name of the tape pool to which the tape belongs.
-   * @param capacityInBytes The capacity of the tape.
-   * @param creationLog The who, where, when an why of this modification.
-   */
-  virtual void createTape(
-    const std::string &vid,
-    const std::string &logicalLibraryName,
-    const std::string &tapePoolName,
-    const uint64_t capacityInBytes,
-    const CreationLog &creationLog);
-
-  /**
-   * Deletes the tape with the specified volume identifier.
-   *
-   * @param requester The identity of the requester.
-   * @param vid The volume identifier of the tape.
-   */
-  void deleteTape(
-    const SecurityIdentity &cliIdentity,
-    const std::string &vid);
-
-  /**
-   * Returns the tape with the specified volume identifier.
-   *
-   * @param vid The volume identifier of the tape.
-   * @return The tape with the specified volume identifier.
-   */
-  Tape getTape(const std::string &vid) const;
-
-  /**
-   * Returns the current list of tapes in the lexicographical order of their
-   * volume identifiers.
-   *
-   * @return The current list of tapes in the lexicographical order of their.
-   * volume identifiers.
-   */
-  std::list<Tape> getTapes() const;
-
-private:
-
-  /**
-   * SQLite database handle.
-   */
-  sqlite3 *m_dbHandle;
-
-  /**
-   * Creates the database schema.
-   */
-  void createSchema();
-
-  /**
-   * Throws an exception if the specified user is not an administrator.
-   *
-   * @param id The identity of the user.
-   */
-  void assertIsAdmin(const UserIdentity &user) const;
-
-  /**
-   * Throws an exception if the specified host is not an administration host.
-   *
-   * @param host The network name of the host.
-   */
-  void assertIsAdminHost(const std::string &host) const;
-
-  /**
-   * Returns the tape pool with specified name.
-   *
-   * @param name The name of teh tape pool.
-   * @return The tape pool with specified name.
-   */
-  TapePool getTapePool(const std::string &name) const;
-
-  /**
-   * Returns the list of archive routes for the specified storage class.
-   *
-   * This method does not perfrom any consistency checks.  For example this
-   * method will not throw an exception if the list of archive routes is
-   * incomplete.
-   *
-   * @param storageClassName The name of the storage class.
-   * @return The list of archive routes for the specified storage class.
-   */
-  std::list<common::archiveRoute::ArchiveRoute> getArchiveRoutesWithoutChecks(
-    const std::string &storageClassName) const;
-
-  /**
-   * Throws an exception if the specified tape pool is already a destination in
-   * the specified archive routes.
-   *
-   * @param routes The archive routes.
-   * @param tapePoolName The name of the tape pool.
-   */
-  void assertTapePoolIsNotAlreadyADestination(
-    const std::list<common::archiveRoute::ArchiveRoute> &routes, 
-    const std::string &tapePoolName) const;
-
-  /**
-   * Queues the specified request.
-   *
-   * @param rqst The request.
-   */
-  void queue(const ArchiveToTapeCopyRequest &rqst);
-
-}; // class MockSchedulerDatabase
-
-} // namespace cta
diff --git a/scheduler/mockDB/MockSchedulerDatabaseFactory.cpp b/scheduler/mockDB/MockSchedulerDatabaseFactory.cpp
deleted file mode 100644
index 38c3efb72adabcb8cdb19ca868bf9948f27c18d0..0000000000000000000000000000000000000000
--- a/scheduler/mockDB/MockSchedulerDatabaseFactory.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * The CERN Tape Archive (CTA) project
- * Copyright (C) 2015  CERN
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "MockSchedulerDatabase.hpp"
-#include "MockSchedulerDatabaseFactory.hpp"
-
-//------------------------------------------------------------------------------
-// destructor
-//------------------------------------------------------------------------------
-cta::MockSchedulerDatabaseFactory::~MockSchedulerDatabaseFactory() throw() {
-}
-
-//------------------------------------------------------------------------------
-// create
-//------------------------------------------------------------------------------
-std::unique_ptr<cta::SchedulerDatabase> cta::MockSchedulerDatabaseFactory::
-  create() const {
-  return std::unique_ptr<SchedulerDatabase>(new MockSchedulerDatabase());
-}
diff --git a/scheduler/mockDB/SQLiteStatementDeleter.cpp b/scheduler/mockDB/SQLiteStatementDeleter.cpp
deleted file mode 100644
index 817a22fd673401dc018072329cf5e1e469893d25..0000000000000000000000000000000000000000
--- a/scheduler/mockDB/SQLiteStatementDeleter.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * The CERN Tape Archive (CTA) project
- * Copyright (C) 2015  CERN
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "scheduler/mockDB/SQLiteStatementDeleter.hpp"
-
-//------------------------------------------------------------------------------
-// operator()
-//------------------------------------------------------------------------------
-void cta::SQLiteStatementDeleter::operator() (sqlite3_stmt * ptr) {
-  sqlite3_finalize(ptr);
-}
\ No newline at end of file
diff --git a/scheduler/mockDB/SQLiteStatementDeleter.hpp b/scheduler/mockDB/SQLiteStatementDeleter.hpp
deleted file mode 100644
index 81877b804bb5da8858bed931cd0b40d6e7b98496..0000000000000000000000000000000000000000
--- a/scheduler/mockDB/SQLiteStatementDeleter.hpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * The CERN Tape Archive (CTA) project
- * Copyright (C) 2015  CERN
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include <sqlite3.h>
-
-namespace cta {
-
-/**
- * Deleter class used by unique_ptrs of sqlite3_stmts.
- */
-struct SQLiteStatementDeleter{
-  /**
-   * Overloading the () operator
-   * 
-   * @param ptr: the statement pointer to delete
-   */
-  void operator() (sqlite3_stmt * ptr);
-};
-
-} // namespace cta
\ No newline at end of file
diff --git a/scheduler/mockDB/SqliteColumnNameToIndex.cpp b/scheduler/mockDB/SqliteColumnNameToIndex.cpp
deleted file mode 100644
index 70874ae331924d408ef2cceb89620ba876ffcaa5..0000000000000000000000000000000000000000
--- a/scheduler/mockDB/SqliteColumnNameToIndex.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * The CERN Tape Archive (CTA) project
- * Copyright (C) 2015  CERN
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "common/exception/Exception.hpp"
-#include "scheduler/mockDB/SqliteColumnNameToIndex.hpp"
-
-#include <sstream>
-
-//------------------------------------------------------------------------------
-// constructor
-//------------------------------------------------------------------------------
-cta::SqliteColumnNameToIndex::SqliteColumnNameToIndex(
-  sqlite3_stmt *const statement) {
-  const int colCount = sqlite3_column_count(statement);
-  if(colCount==0) {
-    std::ostringstream message;
-    message << "SqliteColumnNameToIndex() - "
-      "SQLite error: sqlite3_column_count() returned 0";
-    throw(cta::exception::Exception(message.str()));
-  }
-  for(int i=0; i<colCount; i++) {
-    const char *const columnName = sqlite3_column_origin_name(statement,i);
-    if(columnName == NULL) {
-      std::ostringstream message;
-      message << "SqliteColumnNameToIndex() -"
-        " SQLite error: sqlite3_column_origin_name() returned NULL";
-      throw(cta::exception::Exception(message.str()));
-    }
-    m_columnNameToIndex[std::string(columnName)] = i;
-  }
-}
-
-//------------------------------------------------------------------------------
-// operator()
-//------------------------------------------------------------------------------
-int cta::SqliteColumnNameToIndex::operator()(const std::string &columnName)
-  const {
-  std::map<std::string, int>::const_iterator it =
-    m_columnNameToIndex.find(columnName);
-  if(it != m_columnNameToIndex.end()) {
-    return it->second;
-  } else {
-    std::ostringstream message;
-    message << "SqliteColumnNameToIndex() - column " << columnName <<
-      " does not exist";
-    throw cta::exception::Exception(message.str());
-  }
-}
diff --git a/scheduler/mockDB/SqliteColumnNameToIndex.hpp b/scheduler/mockDB/SqliteColumnNameToIndex.hpp
deleted file mode 100644
index df2c971f369524c5d57e8a538695b4857e8af66c..0000000000000000000000000000000000000000
--- a/scheduler/mockDB/SqliteColumnNameToIndex.hpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * The CERN Tape Archive (CTA) project
- * Copyright (C) 2015  CERN
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include <map>
-#include <sqlite3.h>
-#include <string>
-
-namespace cta {
-
-/**
- * Functor that takes the name of a column of an Sqlite statement and returns
- * the corresponding index.
- */
-class SqliteColumnNameToIndex {
-public:
-
-  /**
-   * Constructor.
-   *
-   * @param statement The Sqlite statment.
-   */
-  SqliteColumnNameToIndex(sqlite3_stmt *const statement);
-
-  /**
-   * Returns the index of the specified column.
-   *
-   * @param columnName The name of the column.
-   */
-  int operator()(const std::string &columnName) const;
-
-private:
-
-  /**
-   * The mapping from column name to column index.
-   */
-  std::map<std::string, int> m_columnNameToIndex;
-
-}; // class SqliteColumnNameToIndex
-
-} // namespace cta
diff --git a/xroot_plugins/XrdCtaFile.cpp b/xroot_plugins/XrdCtaFile.cpp
index 2cbb9587eac5787fa6399cfee210ec0b3d3c9bea..e89ba47de23d8b20bc6530878a9d14acf97e0936 100644
--- a/xroot_plugins/XrdCtaFile.cpp
+++ b/xroot_plugins/XrdCtaFile.cpp
@@ -1848,10 +1848,10 @@ int XrdCtaFile::xCom_listpendingarchives(const std::vector<std::string> &tokens,
   bool extended = hasOption(tokens, "-x", "--extended");
   std::map<std::string, std::list<cta::common::dataStructures::ArchiveJob> > result;
   if(tapepool.empty()) {
-    result = m_scheduler->getPendingArchiveJobs(cliIdentity);
+    result = m_scheduler->getPendingArchiveJobs();
   }
   else {
-    std::list<cta::common::dataStructures::ArchiveJob> list = m_scheduler->getPendingArchiveJobs(cliIdentity, tapepool);
+    std::list<cta::common::dataStructures::ArchiveJob> list = m_scheduler->getPendingArchiveJobs(tapepool);
     if(list.size()>0) {
       result[tapepool] = list;
     }
@@ -1914,10 +1914,10 @@ int XrdCtaFile::xCom_listpendingretrieves(const std::vector<std::string> &tokens
   bool extended = hasOption(tokens, "-x", "--extended");
   std::map<std::string, std::list<cta::common::dataStructures::RetrieveJob> > result;
   if(vid.empty()) {
-    result = m_scheduler->getPendingRetrieveJobs(cliIdentity);
+    result = m_scheduler->getPendingRetrieveJobs();
   }
   else {
-    std::list<cta::common::dataStructures::RetrieveJob> list = m_scheduler->getPendingRetrieveJobs(cliIdentity, vid);
+    std::list<cta::common::dataStructures::RetrieveJob> list = m_scheduler->getPendingRetrieveJobs(vid);
     if(list.size()>0) {
       result[vid] = list;
     }
diff --git a/xroot_plugins/XrdCtaFilesystem.cpp b/xroot_plugins/XrdCtaFilesystem.cpp
index f39fcff4a0b8de1c9d391817f563cf912d14b23b..b9f98995545a577d60fc5e97adae4252198c6cb2 100644
--- a/xroot_plugins/XrdCtaFilesystem.cpp
+++ b/xroot_plugins/XrdCtaFilesystem.cpp
@@ -30,7 +30,6 @@
 #include "objectstore/RootEntry.hpp"
 #include "objectstore/BackendFactory.hpp"
 #include "remotens/MockRemoteNS.hpp"
-#include "scheduler/ArchiveToTapeCopyRequest.hpp"
 #include "scheduler/LogicalLibrary.hpp"
 #include "scheduler/OStoreDB/OStoreDB.hpp"
 #include "scheduler/RetrieveRequestDump.hpp"