Commit 47298db7 authored by Steven Murray's avatar Steven Murray
Browse files

Added empty mock database-tables for archival and retrieval jobs

parent 3d2a4478
......@@ -18,6 +18,7 @@ set (MIDDLE_TIER_LIB_SRC_FILES
MiddleTierUser.cpp
MigrationRoute.cpp
MigrationRouteId.cpp
MockArchivalJobTable.cpp
MockAdminHostTable.cpp
MockAdminUserTable.cpp
MockDatabase.cpp
......@@ -26,6 +27,7 @@ set (MIDDLE_TIER_LIB_SRC_FILES
MockMiddleTierUser.cpp
MockMiddleTierUser.cpp
MockMigrationRouteTable.cpp
MockRetrievalJobTable.cpp
MockTapeTable.cpp
MockTapePoolTable.cpp
RetrievalJob.cpp
......
#include "MockArchivalJobTable.hpp"
#include "Exception.hpp"
//------------------------------------------------------------------------------
// createArchivalJob
//------------------------------------------------------------------------------
void cta::MockArchivalJobTable::createArchivalJob(
const SecurityIdentity &requester,
const std::string &srcUrl,
const std::string &dstPath) {
}
//------------------------------------------------------------------------------
// checkArchivalJobDoesNotAlreadyExist
//------------------------------------------------------------------------------
void cta::MockArchivalJobTable::checkArchivalJobDoesNotAlreadyExist(
const std::string &dstPath) const {
}
//------------------------------------------------------------------------------
// deleteArchivalJob
//------------------------------------------------------------------------------
void cta::MockArchivalJobTable::deleteArchivalJob(
const SecurityIdentity &requester,
const std::string &dstPath) {
}
//------------------------------------------------------------------------------
// getArchivalJobs
//------------------------------------------------------------------------------
const std::map<cta::TapePool, std::list<cta::ArchivalJob> >
cta::MockArchivalJobTable::getArchivalJobs(
const SecurityIdentity &requester) const {
std::map<cta::TapePool, std::list<cta::ArchivalJob> > jobs;
return jobs;
}
//------------------------------------------------------------------------------
// getArchivalJobs
//------------------------------------------------------------------------------
std::list<cta::ArchivalJob> cta::MockArchivalJobTable::getArchivalJobs(
const SecurityIdentity &requester,
const std::string &tapePoolName) const {
std::list<cta::ArchivalJob> jobs;
return jobs;
}
#pragma once
#include "ArchivalJob.hpp"
#include "TapePool.hpp"
#include "SecurityIdentity.hpp"
#include <list>
#include <map>
#include <string>
namespace cta {
/**
* Mock database-table of archival jobs.
*/
class MockArchivalJobTable {
public:
/**
* Creates an archival job.
*
* @param requester The identity of the user requesting the creation of the
* job.
* @param srcUrl The URL of the source file.
* @param dstPath The full path of the destination file within the archive.
*/
void createArchivalJob(
const SecurityIdentity &requester,
const std::string &srcUrl,
const std::string &dstPath);
/**
* Throws an exception if the specified archival job already exists.
*
* @param dstPath The full path of the destination file within the archive.
*/
void checkArchivalJobDoesNotAlreadyExist(const std::string &dstPath) const;
/**
* Deletes the specified archival job.
*
* @param requester The identity of the user requesting the deletion of the
* job.
* @param dstPath The full path of the destination file within the archive.
*/
void deleteArchivalJob(
const SecurityIdentity &requester,
const std::string &dstPath);
/**
* Returns all of the existing archival jobs grouped by tape pool and then
* sorted by creation time in ascending order (oldest first).
*
* @param requester The identity of the user requesting the list.
* @return All of the existing archival jobs grouped by tape pool and then
* sorted by creation time in ascending order (oldest first).
*/
const std::map<TapePool, std::list<ArchivalJob> > getArchivalJobs(
const SecurityIdentity &requester) const;
/**
* Returns the list of archival jobs associated with the specified tape pool
* sorted by creation time in ascending order (oldest first).
*
* @param requester The identity of the user requesting the list.
* @param tapePoolName The name of the tape pool.
* @return The list of archival jobs associated with the specified tape pool
* sorted by creation time in ascending order (oldest first).
*/
std::list<ArchivalJob> getArchivalJobs(
const SecurityIdentity &requester,
const std::string &tapePoolName) const;
private:
/**
* All of the existing archival jobs grouped by tape pool and then
* sorted by creation time in ascending order (oldest first).
*/
std::map<TapePool, std::map<time_t, ArchivalJob> > m_jobs;
}; // class MockArchivalJobTable
} // namespace cta
......@@ -4,8 +4,10 @@
#include "FileSystemStorageClasses.hpp"
#include "MockAdminHostTable.hpp"
#include "MockAdminUserTable.hpp"
#include "MockArchivalJobTable.hpp"
#include "MockLogicalLibraryTable.hpp"
#include "MockMigrationRouteTable.hpp"
#include "MockRetrievalJobTable.hpp"
#include "MockTapeTable.hpp"
#include "MockTapePoolTable.hpp"
......@@ -68,6 +70,16 @@ struct MockDatabase {
*/
MockTapeTable tapes;
/**
* Table of archival jobs.
*/
MockArchivalJobTable archivalJobs;
/**
* Table of retrieval jobs.
*/
MockRetrievalJobTable retrievalJobs;
}; // struct MockDatabase
} // namespace cta
......@@ -277,8 +277,7 @@ void cta::MockMiddleTierUser::checkUserIsAuthorisedToArchive(
std::map<cta::TapePool, std::list<cta::ArchivalJob> >
cta::MockMiddleTierUser::getArchivalJobs(
const SecurityIdentity &requester) const {
std::map<TapePool, std::list<cta::ArchivalJob> > jobs;
return jobs;
return m_db.archivalJobs.getArchivalJobs(requester);
}
//------------------------------------------------------------------------------
......@@ -287,8 +286,7 @@ std::map<cta::TapePool, std::list<cta::ArchivalJob> >
std::list<cta::ArchivalJob> cta::MockMiddleTierUser::getArchivalJobs(
const SecurityIdentity &requester,
const std::string &tapePoolName) const {
std::list<cta::ArchivalJob> jobs;
return jobs;
return m_db.archivalJobs.getArchivalJobs(requester, tapePoolName);
}
//------------------------------------------------------------------------------
......@@ -297,6 +295,7 @@ std::list<cta::ArchivalJob> cta::MockMiddleTierUser::getArchivalJobs(
void cta::MockMiddleTierUser::deleteArchivalJob(
const SecurityIdentity &requester,
const std::string &dstPath) {
m_db.archivalJobs.deleteArchivalJob(requester, dstPath);
}
//------------------------------------------------------------------------------
......@@ -314,8 +313,7 @@ void cta::MockMiddleTierUser::retrieve(
std::map<cta::Tape, std::list<cta::RetrievalJob> >
cta::MockMiddleTierUser::getRetrievalJobs(
const SecurityIdentity &requester) const {
std::map<Tape, std::list<RetrievalJob> > jobs;
return jobs;
return m_db.retrievalJobs.getRetrievalJobs(requester);
}
//------------------------------------------------------------------------------
......@@ -324,8 +322,7 @@ std::map<cta::Tape, std::list<cta::RetrievalJob> >
std::list<cta::RetrievalJob> cta::MockMiddleTierUser::getRetrievalJobs(
const SecurityIdentity &requester,
const std::string &vid) const {
std::list<cta::RetrievalJob> jobs;
return jobs;
return m_db.retrievalJobs.getRetrievalJobs(requester, vid);
}
//------------------------------------------------------------------------------
......@@ -334,4 +331,5 @@ std::list<cta::RetrievalJob> cta::MockMiddleTierUser::getRetrievalJobs(
void cta::MockMiddleTierUser::deleteRetrievalJob(
const SecurityIdentity &requester,
const std::string &dstUrl) {
m_db.retrievalJobs.deleteRetrievalJob(requester, dstUrl);
}
......@@ -148,7 +148,7 @@ public:
* Deletes the specified archival job.
*
* @param requester The identity of the user requesting the deletion of the
* tape.
* job.
* @param dstPath The full path of the destination file within the archive.
*/
void deleteArchivalJob(
......@@ -202,7 +202,7 @@ public:
* Deletes the specified retrieval job.
*
* @param requester The identity of the user requesting the deletion of the
* tape.
* job.
* @param dstUrl The URL of the destination file or directory.
*/
void deleteRetrievalJob(
......
#include "Exception.hpp"
#include "MockRetrievalJobTable.hpp"
//------------------------------------------------------------------------------
// createRetrievalJob
//------------------------------------------------------------------------------
void cta::MockRetrievalJobTable::createRetrievalJob(
const SecurityIdentity &requester,
const std::string &srcPath,
const std::string &dstUrl) {
}
//------------------------------------------------------------------------------
// checkRetrievalJobDoesNotAlreadyExist
//------------------------------------------------------------------------------
void cta::MockRetrievalJobTable::checkRetrievalJobDoesNotAlreadyExist(
const std::string &dstUrl) const {
}
//------------------------------------------------------------------------------
// deleteRetrievalJob
//------------------------------------------------------------------------------
void cta::MockRetrievalJobTable::deleteRetrievalJob(
const SecurityIdentity &requester,
const std::string &dstPath) {
}
//------------------------------------------------------------------------------
// getRetrievalJobs
//------------------------------------------------------------------------------
const std::map<cta::Tape, std::list<cta::RetrievalJob> >
cta::MockRetrievalJobTable::getRetrievalJobs(
const SecurityIdentity &requester) const {
std::map<cta::Tape, std::list<cta::RetrievalJob> > jobs;
return jobs;
}
//------------------------------------------------------------------------------
// getRetrievalJobs
//------------------------------------------------------------------------------
std::list<cta::RetrievalJob> cta::MockRetrievalJobTable::getRetrievalJobs(
const SecurityIdentity &requester,
const std::string &vid) const {
std::list<cta::RetrievalJob> jobs;
return jobs;
}
#pragma once
#include "RetrievalJob.hpp"
#include "Tape.hpp"
#include "SecurityIdentity.hpp"
#include <list>
#include <map>
#include <string>
namespace cta {
/**
* Mock database-table of retrieval jobs.
*/
class MockRetrievalJobTable {
public:
/**
* Creates a retrival job.
*
* @param requester The identity of the user requesting the creation of the
* job.
* @param srcPath The full path of the source file within the archive.
* @param dstUrl The URL of the destination file.
*/
void createRetrievalJob(
const SecurityIdentity &requester,
const std::string &srcPath,
const std::string &dstUrl);
/**
* Throws an exception if the specified retrieval job already exists.
*
* @param dstUrl The URL of the destination file.
*/
void checkRetrievalJobDoesNotAlreadyExist(const std::string &dstUrl) const;
/**
* Deletes the specified retrieval job.
*
* @param requester The identity of the user requesting the deletion of the
* job.
* @param dstPath The full path of the destination file within the archive.
*/
void deleteRetrievalJob(
const SecurityIdentity &requester,
const std::string &dstPath);
/**
* Returns all of the existing retrieval jobs grouped by tape and then
* sorted by creation time in ascending order (oldest first).
*
* @param requester The identity of the user requesting the list.
* @return All of the existing retrieval jobs grouped by tape and then
* sorted by creation time in ascending order (oldest first).
*/
const std::map<Tape, std::list<RetrievalJob> > getRetrievalJobs(
const SecurityIdentity &requester) const;
/**
* Returns the list of retrieval jobs associated with the specified tape
* sorted by creation time in ascending order (oldest first).
*
* @param requester The identity of the user requesting the list.
* @param vid The volume identifier of the tape.
* @return The list of retrieval jobs associated with the specified tape
* sorted by creation time in ascending order (oldest first).
*/
std::list<RetrievalJob> getRetrievalJobs(
const SecurityIdentity &requester,
const std::string &vid) const;
private:
/**
* All of the existing retrieval jobs grouped by tape and then
* sorted by creation time in ascending order (oldest first).
*/
std::map<Tape, std::map<time_t, RetrievalJob> > m_jobs;
}; // class MockRetrievalJobTable
} // namespace cta
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment