Commit 194912de authored by Steven Murray's avatar Steven Murray
Browse files

Catalogue now creates, deletes and gets mount rules

parent f94c32d3
......@@ -45,7 +45,8 @@
#include "common/dataStructures/ReadTestResult.hpp"
#include "common/dataStructures/RepackInfo.hpp"
#include "common/dataStructures/RepackType.hpp"
#include "common/dataStructures/Requester.hpp"
#include "common/dataStructures/RequesterGroupMountRule.hpp"
#include "common/dataStructures/RequesterMountRule.hpp"
#include "common/dataStructures/RetrieveFileQueueCriteria.hpp"
#include "common/dataStructures/RetrieveJob.hpp"
#include "common/dataStructures/RetrieveRequest.hpp"
......@@ -136,14 +137,6 @@ public:
virtual void setTapeLbp(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool lbpValue) = 0; // internal function (noCLI)
virtual void modifyTapeComment(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &comment) = 0;
virtual void createRequester(
const common::dataStructures::SecurityIdentity &cliIdentity,
const std::string &requesterName,
const std::string &mountPolicy,
const std::string &comment) = 0;
virtual void deleteRequester(const std::string &requesterName) = 0;
virtual std::list<common::dataStructures::Requester> getRequesters() const = 0;
virtual void modifyRequesterMountPolicy(const common::dataStructures::SecurityIdentity &cliIdentity, const common::dataStructures::UserIdentity &user, const std::string &mountPolicy) = 0;
virtual void modifyRequesterComment(const common::dataStructures::SecurityIdentity &cliIdentity, const common::dataStructures::UserIdentity &user, const std::string &comment) = 0;
......@@ -158,36 +151,87 @@ public:
const std::string &comment) = 0;
/**
* Assigns the specified mount policy to the specified requester.
* Returns the list of all existing mount policies.
*
* Please note that requester mount-policies overrule requester-group
* mount-policies.
* @return the list of all existing mount policies.
*/
virtual std::list<common::dataStructures::MountPolicy> getMountPolicies() const = 0;
/**
* Deletes the specified mount policy.
*
* @param name The name of the mount policy.
*/
virtual void deleteMountPolicy(const std::string &name) = 0;
/**
* Creates the rule that the specified mount policy will be used for the
* specified requester.
*
* Please note that requester mount-rules overrule requester-group
* mount-rules.
*
* @param cliIdentity The user of the command-line tool.
* @param mountPolicyName The name of the mount policy.
* @param requesterName The name of the requester.
* @param comment Comment.
*/
virtual void assignMountPolicyToRequester(
virtual void createRequesterMountRule(
const common::dataStructures::SecurityIdentity &cliIdentity,
const std::string &mountPolicyName,
const std::string &requesterName,
const std::string &comment) = 0;
/**
* Assigns the specified mount policy to the specified requester group.
* Returns the rules that specify which mount policy is be used for which
* requester.
*
* @return the rules that specify which mount policy is be used for which
* requester.
*/
virtual std::list<common::dataStructures::RequesterMountRule> getRequesterMountRules() const = 0;
/**
* Deletes the specified mount rule.
*
* @param requesterName The name of the requester.
*/
virtual void deleteRequesterMountRule(const std::string &requesterName) = 0;
/**
* Creates the rule that the specified mount policy will be used for the
* specified requester group.
*
* Please note that requester mount-policies overrule requester-group
* mount-policies.
* Please note that requester mount-rules overrule requester-group
* mount-rules.
*
* @param cliIdentity The user of the command-line tool.
* @param mountPolicyName The name of the mount policy.
* @param requesterGrouprName The name of the requester group.
* @param requesterGroupName The name of the requester group.
* @param comment Comment.
*/
virtual void assignMountPolicyToRequesterGroup(const std::string &mountPolicyName,
const std::string &requesterGroupName) = 0;
virtual void createRequesterGroupMountRule(
const common::dataStructures::SecurityIdentity &cliIdentity,
const std::string &mountPolicyName,
const std::string &requesterGroupName,
const std::string &comment) = 0;
/**
* Returns the rules that specify which mount policy is be used for which
* requester group.
*
* @return the rules that specify which mount policy is be used for which
* requester group.
*/
virtual std::list<common::dataStructures::RequesterGroupMountRule> getRequesterGroupMountRules() const = 0;
/**
* Deletes the specified mount rule.
*
* @param requesterGroupName The name of the requester group.
*/
virtual void deleteRequesterGroupMountRule(const std::string &requesterGroupName) = 0;
virtual void deleteMountPolicy(const std::string &name) = 0;
virtual std::list<common::dataStructures::MountPolicy> getMountPolicies() const = 0;
virtual void modifyMountPolicyArchivePriority(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t archivePriority) = 0;
virtual void modifyMountPolicyArchiveMinFilesQueued(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t minArchiveFilesQueued) = 0;
virtual void modifyMountPolicyArchiveMinBytesQueued(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t archiveMinBytesQueued) = 0;
......@@ -279,14 +323,6 @@ public:
virtual common::dataStructures::TapeCopyToPoolMap getTapeCopyToPoolMap(const std::string &storageClass) const = 0;
/**
* Returns the mount policy for the specified end user.
*
* @param username The name of the end user.
* @return The mount policy.
*/
virtual common::dataStructures::MountPolicy getMountPolicyForAUser(const std::string &username) const = 0;
virtual bool isAdmin(const common::dataStructures::SecurityIdentity &cliIdentity) const = 0;
/**
......
......@@ -17,7 +17,6 @@
*/
#include "catalogue/ArchiveFileRow.hpp"
#include "catalogue/RdbmsCatalogue.hpp"
#include "catalogue/CatalogueFactory.hpp"
#include "catalogue/UserError.hpp"
#include "common/exception/Exception.hpp"
......@@ -51,7 +50,7 @@ protected:
using namespace cta::catalogue;
const DbLogin catalogueLogin(DbLogin::DBTYPE_IN_MEMORY, "", "", "");
m_catalogue.reset(dynamic_cast<RdbmsCatalogue*>(CatalogueFactory::create(catalogueLogin)));
m_catalogue.reset(CatalogueFactory::create(catalogueLogin));
{
const std::list<common::dataStructures::AdminUser> adminUsers = m_catalogue->getAdminUsers();
......@@ -72,9 +71,16 @@ protected:
}
}
{
const std::list<common::dataStructures::Requester> requesters = m_catalogue->getRequesters();
for(auto &requester: requesters) {
m_catalogue->deleteRequester(requester.name);
const std::list<common::dataStructures::RequesterMountRule> rules = m_catalogue->getRequesterMountRules();
for(auto &rule: rules) {
m_catalogue->deleteRequesterMountRule(rule.name);
}
}
{
const std::list<common::dataStructures::RequesterGroupMountRule> rules =
m_catalogue->getRequesterGroupMountRules();
for(auto &rule: rules) {
m_catalogue->deleteRequesterGroupMountRule(rule.name);
}
}
{
......@@ -120,7 +126,7 @@ protected:
m_catalogue.reset();
}
std::unique_ptr<cta::catalogue::RdbmsCatalogue> m_catalogue;
std::unique_ptr<cta::catalogue::Catalogue> m_catalogue;
const std::string m_bootstrapComment;
cta::common::dataStructures::SecurityIdentity m_cliSI;
cta::common::dataStructures::SecurityIdentity m_bootstrapAdminSI;
......@@ -1215,10 +1221,10 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, deleteMountPolicy_non_existant) {
ASSERT_THROW(m_catalogue->deleteMountPolicy("non_existant_mount_policy"), catalogue::UserError);
}
TEST_F(cta_catalogue_InMemoryCatalogueTest, createRequester) {
TEST_F(cta_catalogue_InMemoryCatalogueTest, createRequesterMountRule) {
using namespace cta;
ASSERT_TRUE(m_catalogue->getRequesters().empty());
ASSERT_TRUE(m_catalogue->getRequesterMountRules().empty());
const std::string mountPolicyName = "mount_policy";
const uint64_t archivePriority = 1;
......@@ -1235,16 +1241,16 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createRequester) {
retrievePriority,
minRetrieveRequestAge,
maxDrivesAllowed,
"create mount group");
"create mount policy");
const std::string comment = "create requester";
const std::string comment = "create mount rule for requester";
const std::string requesterName = "requester_name";
m_catalogue->createRequester(m_cliSI, requesterName, mountPolicyName, comment);
m_catalogue->createRequesterMountRule(m_cliSI, mountPolicyName, requesterName, comment);
const std::list<common::dataStructures::Requester> requesters = m_catalogue->getRequesters();
const std::list<common::dataStructures::RequesterMountRule> requesters = m_catalogue->getRequesterMountRules();
ASSERT_EQ(1, requesters.size());
const common::dataStructures::Requester requester = requesters.front();
const common::dataStructures::RequesterMountRule requester = requesters.front();
ASSERT_EQ(requesterName, requester.name);
ASSERT_EQ(mountPolicyName, requester.mountPolicy);
......@@ -1252,20 +1258,12 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createRequester) {
ASSERT_EQ(m_cliSI.username, requester.creationLog.username);
ASSERT_EQ(m_cliSI.host, requester.creationLog.host);
ASSERT_EQ(requester.creationLog, requester.lastModificationLog);
const common::dataStructures::MountPolicy policy = m_catalogue->getMountPolicyForAUser(requesterName);
ASSERT_EQ(archivePriority, policy.archivePriority);
ASSERT_EQ(minArchiveRequestAge, policy.archiveMinRequestAge);
ASSERT_EQ(maxDrivesAllowed, policy.maxDrivesAllowed);
ASSERT_EQ(retrievePriority, policy.retrievePriority);
ASSERT_EQ(minRetrieveRequestAge, policy.retrieveMinRequestAge);
}
TEST_F(cta_catalogue_InMemoryCatalogueTest, createRequester_same_twice) {
TEST_F(cta_catalogue_InMemoryCatalogueTest, createRequesterMountRule_same_twice) {
using namespace cta;
ASSERT_TRUE(m_catalogue->getRequesters().empty());
ASSERT_TRUE(m_catalogue->getRequesterMountRules().empty());
const std::string mountPolicyName = "mount_policy";
const uint64_t archivePriority = 1;
......@@ -1282,19 +1280,31 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createRequester_same_twice) {
retrievePriority,
minRetrieveRequestAge,
maxDrivesAllowed,
"create mount group");
const std::string comment = "create requester";
"create mount policy");
const std::string comment = "create mount rule for requester";
const std::string requesterName = "requester_name";
m_catalogue->createRequesterMountRule(m_cliSI, mountPolicyName, requesterName, comment);
ASSERT_THROW(m_catalogue->createRequesterMountRule(m_cliSI, mountPolicyName, requesterName, comment),
catalogue::UserError);
}
TEST_F(cta_catalogue_InMemoryCatalogueTest, createRequesterMountRule_non_existant_mount_policy) {
using namespace cta;
ASSERT_TRUE(m_catalogue->getRequesterMountRules().empty());
const std::string comment = "create mount rule for requester";
const std::string mountPolicyName = "non_existant_mount_policy";
const std::string requesterName = "requester_name";
const std::string mountPolicy = "mount_policy";
m_catalogue->createRequester(m_cliSI, requesterName, mountPolicyName, comment);
ASSERT_THROW(m_catalogue->createRequester(m_cliSI, requesterName, mountPolicy, comment), catalogue::UserError);
ASSERT_THROW(m_catalogue->createRequesterMountRule(m_cliSI, mountPolicyName, requesterName, comment),
catalogue::UserError);
}
TEST_F(cta_catalogue_InMemoryCatalogueTest, deleteRequester) {
TEST_F(cta_catalogue_InMemoryCatalogueTest, deleteRequesterMountRule) {
using namespace cta;
ASSERT_TRUE(m_catalogue->getRequesters().empty());
ASSERT_TRUE(m_catalogue->getRequesterMountRules().empty());
const std::string mountPolicyName = "mount_policy";
const uint64_t archivePriority = 1;
......@@ -1311,47 +1321,39 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, deleteRequester) {
retrievePriority,
minRetrieveRequestAge,
maxDrivesAllowed,
"create mount group");
"create mount policy");
const std::string comment = "create requester";
const std::string comment = "create mount rule for requester";
const std::string requesterName = "requester_name";
m_catalogue->createRequester(m_cliSI, requesterName, mountPolicyName, comment);
const std::list<common::dataStructures::Requester> requesters = m_catalogue->getRequesters();
ASSERT_EQ(1, requesters.size());
const common::dataStructures::Requester requester = requesters.front();
m_catalogue->createRequesterMountRule(m_cliSI, mountPolicyName, requesterName, comment);
ASSERT_EQ(requesterName, requester.name);
ASSERT_EQ(mountPolicyName, requester.mountPolicy);
ASSERT_EQ(comment, requester.comment);
ASSERT_EQ(m_cliSI.username, requester.creationLog.username);
ASSERT_EQ(m_cliSI.host, requester.creationLog.host);
ASSERT_EQ(requester.creationLog, requester.lastModificationLog);
const std::list<common::dataStructures::RequesterMountRule> rules = m_catalogue->getRequesterMountRules();
ASSERT_EQ(1, rules.size());
const common::dataStructures::MountPolicy policy = m_catalogue->getMountPolicyForAUser(requesterName);
const common::dataStructures::RequesterMountRule rule = rules.front();
ASSERT_EQ(archivePriority, policy.archivePriority);
ASSERT_EQ(minArchiveRequestAge, policy.archiveMinRequestAge);
ASSERT_EQ(maxDrivesAllowed, policy.maxDrivesAllowed);
ASSERT_EQ(retrievePriority, policy.retrievePriority);
ASSERT_EQ(minRetrieveRequestAge, policy.retrieveMinRequestAge);
ASSERT_EQ(requesterName, rule.name);
ASSERT_EQ(mountPolicyName, rule.mountPolicy);
ASSERT_EQ(comment, rule.comment);
ASSERT_EQ(m_cliSI.username, rule.creationLog.username);
ASSERT_EQ(m_cliSI.host, rule.creationLog.host);
ASSERT_EQ(rule.creationLog, rule.lastModificationLog);
m_catalogue->deleteRequester(requesterName);
ASSERT_TRUE(m_catalogue->getRequesters().empty());
m_catalogue->deleteRequesterMountRule(requesterName);
ASSERT_TRUE(m_catalogue->getRequesterMountRules().empty());
}
TEST_F(cta_catalogue_InMemoryCatalogueTest, deleteRequester_non_existant) {
TEST_F(cta_catalogue_InMemoryCatalogueTest, deleteRequesterMountRule_non_existant) {
using namespace cta;
ASSERT_TRUE(m_catalogue->getRequesters().empty());
ASSERT_THROW(m_catalogue->deleteRequester("non_existant_requester"), catalogue::UserError);
ASSERT_TRUE(m_catalogue->getRequesterMountRules().empty());
ASSERT_THROW(m_catalogue->deleteRequesterMountRule("non_existant_requester"), catalogue::UserError);
}
TEST_F(cta_catalogue_InMemoryCatalogueTest, assignMountPolicyToRequester) {
TEST_F(cta_catalogue_InMemoryCatalogueTest, createRequesterGroupMountRule) {
using namespace cta;
ASSERT_TRUE(m_catalogue->getRequesters().empty());
ASSERT_TRUE(m_catalogue->getRequesterGroupMountRules().empty());
const std::string mountPolicyName = "mount_policy";
const uint64_t archivePriority = 1;
......@@ -1368,37 +1370,30 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, assignMountPolicyToRequester) {
retrievePriority,
minRetrieveRequestAge,
maxDrivesAllowed,
"create mount group");
const std::string comment = "create requester";
const std::string requesterName = "requester_name";
m_catalogue->assignMountPolicyToRequester(m_cliSI, mountPolicyName, requesterName, comment);
const std::list<common::dataStructures::Requester> requesters = m_catalogue->getRequesters();
ASSERT_EQ(1, requesters.size());
"create mount policy");
const common::dataStructures::Requester requester = requesters.front();
const std::string comment = "create mount rule for requester group";
const std::string requesterGroupName = "requester_group_name";
m_catalogue->createRequesterGroupMountRule(m_cliSI, mountPolicyName, requesterGroupName, comment);
ASSERT_EQ(requesterName, requester.name);
ASSERT_EQ(mountPolicyName, requester.mountPolicy);
ASSERT_EQ(comment, requester.comment);
ASSERT_EQ(m_cliSI.username, requester.creationLog.username);
ASSERT_EQ(m_cliSI.host, requester.creationLog.host);
ASSERT_EQ(requester.creationLog, requester.lastModificationLog);
const std::list<common::dataStructures::RequesterGroupMountRule> rules =
m_catalogue->getRequesterGroupMountRules();
ASSERT_EQ(1, rules.size());
const common::dataStructures::MountPolicy policy = m_catalogue->getMountPolicyForAUser(requesterName);
const common::dataStructures::RequesterGroupMountRule rule = rules.front();
ASSERT_EQ(archivePriority, policy.archivePriority);
ASSERT_EQ(minArchiveRequestAge, policy.archiveMinRequestAge);
ASSERT_EQ(maxDrivesAllowed, policy.maxDrivesAllowed);
ASSERT_EQ(retrievePriority, policy.retrievePriority);
ASSERT_EQ(minRetrieveRequestAge, policy.retrieveMinRequestAge);
ASSERT_EQ(requesterGroupName, rule.name);
ASSERT_EQ(mountPolicyName, rule.mountPolicy);
ASSERT_EQ(comment, rule.comment);
ASSERT_EQ(m_cliSI.username, rule.creationLog.username);
ASSERT_EQ(m_cliSI.host, rule.creationLog.host);
ASSERT_EQ(rule.creationLog, rule.lastModificationLog);
}
TEST_F(cta_catalogue_InMemoryCatalogueTest, assignMountPolicyToRequester_same_twice) {
TEST_F(cta_catalogue_InMemoryCatalogueTest, createRequesterGroupMountRule_same_twice) {
using namespace cta;
ASSERT_TRUE(m_catalogue->getRequesters().empty());
ASSERT_TRUE(m_catalogue->getRequesterGroupMountRules().empty());
const std::string mountPolicyName = "mount_policy";
const uint64_t archivePriority = 1;
......@@ -1415,31 +1410,80 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, assignMountPolicyToRequester_same_tw
retrievePriority,
minRetrieveRequestAge,
maxDrivesAllowed,
"create mount group");
"create mount policy");
const std::string comment = "create requester";
const std::string requesterName = "requester_name";
m_catalogue->assignMountPolicyToRequester(m_cliSI, mountPolicyName, requesterName, comment);
ASSERT_THROW(m_catalogue->assignMountPolicyToRequester(m_cliSI, mountPolicyName, requesterName, comment),
const std::string comment = "create mount rule for requester group";
const std::string requesterGroupName = "requester_group_name";
m_catalogue->createRequesterGroupMountRule(m_cliSI, mountPolicyName, requesterGroupName, comment);
ASSERT_THROW(m_catalogue->createRequesterGroupMountRule(m_cliSI, mountPolicyName, requesterGroupName, comment),
catalogue::UserError);
}
TEST_F(cta_catalogue_InMemoryCatalogueTest, assignMountPolicyToRequester_non_existant_mount_policy) {
TEST_F(cta_catalogue_InMemoryCatalogueTest, createRequesterGroupMountRule_non_existant_mount_policy) {
using namespace cta;
ASSERT_TRUE(m_catalogue->getRequesters().empty());
ASSERT_TRUE(m_catalogue->getRequesterGroupMountRules().empty());
const std::string comment = "create requester";
const std::string comment = "create mount rule for requester group";
const std::string mountPolicyName = "non_existant_mount_policy";
const std::string requesterName = "requsterName";
ASSERT_THROW(m_catalogue->assignMountPolicyToRequester(m_cliSI, mountPolicyName, requesterName, comment),
const std::string requesterGroupName = "requester_group_name";
ASSERT_THROW(m_catalogue->createRequesterGroupMountRule(m_cliSI, mountPolicyName, requesterGroupName, comment),
catalogue::UserError);
}
TEST_F(cta_catalogue_InMemoryCatalogueTest, deleteRequesterGroupMountRule) {
using namespace cta;
ASSERT_TRUE(m_catalogue->getRequesterGroupMountRules().empty());
const std::string mountPolicyName = "mount_policy";
const uint64_t archivePriority = 1;
const uint64_t minArchiveRequestAge = 4;
const uint64_t retrievePriority = 5;
const uint64_t minRetrieveRequestAge = 8;
const uint64_t maxDrivesAllowed = 9;
m_catalogue->createMountPolicy(
m_cliSI,
mountPolicyName,
archivePriority,
minArchiveRequestAge,
retrievePriority,
minRetrieveRequestAge,
maxDrivesAllowed,
"create mount policy");
const std::string comment = "create mount rule for requester group";
const std::string requesterGroupName = "requester_group_name";
m_catalogue->createRequesterGroupMountRule(m_cliSI, mountPolicyName, requesterGroupName, comment);
const std::list<common::dataStructures::RequesterGroupMountRule> rules = m_catalogue->getRequesterGroupMountRules();
ASSERT_EQ(1, rules.size());
const common::dataStructures::RequesterGroupMountRule rule = rules.front();
ASSERT_EQ(requesterGroupName, rule.name);
ASSERT_EQ(mountPolicyName, rule.mountPolicy);
ASSERT_EQ(comment, rule.comment);
ASSERT_EQ(m_cliSI.username, rule.creationLog.username);
ASSERT_EQ(m_cliSI.host, rule.creationLog.host);
ASSERT_EQ(rule.creationLog, rule.lastModificationLog);
m_catalogue->deleteRequesterGroupMountRule(requesterGroupName);
ASSERT_TRUE(m_catalogue->getRequesterGroupMountRules().empty());
}
TEST_F(cta_catalogue_InMemoryCatalogueTest, deleteRequesterGroupMountRule_non_existant) {
using namespace cta;
ASSERT_TRUE(m_catalogue->getRequesterGroupMountRules().empty());
ASSERT_THROW(m_catalogue->deleteRequesterGroupMountRule("non_existant_requester_group"), catalogue::UserError);
}
TEST_F(cta_catalogue_InMemoryCatalogueTest, prepareForNewFile) {
using namespace cta;
ASSERT_TRUE(m_catalogue->getRequesters().empty());
ASSERT_TRUE(m_catalogue->getRequesterMountRules().empty());
const std::string mountPolicyName = "mount_policy";
const uint64_t archivePriority = 1;
......@@ -1458,30 +1502,22 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, prepareForNewFile) {
maxDrivesAllowed,
"create mount group");
const std::string userComment = "create requester";
const std::string comment = "create mount rule for requester";
const std::string requesterName = "requester_name";
m_catalogue->createRequester(m_cliSI, requesterName, mountPolicyName, userComment);
m_catalogue->createRequesterMountRule(m_cliSI, mountPolicyName, requesterName, comment);
const std::list<common::dataStructures::Requester> requesters = m_catalogue->getRequesters();
const std::list<common::dataStructures::RequesterMountRule> requesters = m_catalogue->getRequesterMountRules();
ASSERT_EQ(1, requesters.size());
const common::dataStructures::Requester requester = requesters.front();
const common::dataStructures::RequesterMountRule requester = requesters.front();
ASSERT_EQ(requesterName, requester.name);
ASSERT_EQ(mountPolicyName, requester.mountPolicy);
ASSERT_EQ(userComment, requester.comment);
ASSERT_EQ(comment, requester.comment);
ASSERT_EQ(m_cliSI.username, requester.creationLog.username);
ASSERT_EQ(m_cliSI.host, requester.creationLog.host);
ASSERT_EQ(requester.creationLog, requester.lastModificationLog);
const common::dataStructures::MountPolicy policy = m_catalogue->getMountPolicyForAUser(requesterName);
ASSERT_EQ(archivePriority, policy.archivePriority);
ASSERT_EQ(minArchiveRequestAge, policy.archiveMinRequestAge);
ASSERT_EQ(maxDrivesAllowed, policy.maxDrivesAllowed);
ASSERT_EQ(retrievePriority, policy.retrievePriority);
ASSERT_EQ(minRetrieveRequestAge, policy.retrieveMinRequestAge);
ASSERT_TRUE(m_catalogue->getArchiveRoutes().empty());
const std::string storageClassName = "storage_class";
......@@ -1563,15 +1599,15 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, prepareToRetrieveFile) {
const uint64_t capacityInBytes = (uint64_t)10 * 1000 * 1000 * 1000 * 1000;
const bool disabledValue = true;
const bool fullValue = false;
const std::string comment = "create tape";
const std::string createTapeComment = "create tape";
m_catalogue->createLogicalLibrary(m_cliSI, logicalLibraryName,
"create logical library");
m_catalogue->createTapePool(m_cliSI, tapePoolName, 2, true, "create tape pool");
m_catalogue->createTape(m_cliSI, vid1, logicalLibraryName, tapePoolName, encryptionKey, capacityInBytes,
disabledValue, fullValue, comment);
disabledValue, fullValue, createTapeComment);
m_catalogue->createTape(m_cliSI, vid2, logicalLibraryName, tapePoolName, encryptionKey, capacityInBytes,
disabledValue, fullValue, comment);
disabledValue, fullValue, createTapeComment);
const std::list<common::dataStructures::Tape> tapes = m_catalogue->getTapes("", "", "", "", "", "", "", "");
const std::map<std::string, common::dataStructures::Tape> vidToTape = tapeListToMap(tapes);
......@@ -1585,7 +1621,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, prepareToRetrieveFile) {
ASSERT_EQ(capacityInBytes, tape.capacityInBytes);
ASSERT_TRUE(disabledValue == tape.disabled);
ASSERT_TRUE(fullValue == tape.full);
ASSERT_EQ(comment, tape.comment);
ASSERT_EQ(createTapeComment, tape.comment);
const common::dataStructures::EntryLog creationLog = tape.creationLog;
ASSERT_EQ(m_cliSI.username, creationLog.username);
......@@ -1605,7 +1641,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, prepareToRetrieveFile) {
ASSERT_EQ(capacityInBytes, tape.capacityInBytes);
ASSERT_TRUE(disabledValue == tape.disabled);
ASSERT_TRUE(fullValue == tape.full);
ASSERT_EQ(comment, tape.comment);
ASSERT_EQ(createTapeComment, tape.comment);
const common::dataStructures::EntryLog creationLog = tape.creationLog;
ASSERT_EQ(m_cliSI.username, creationLog.username);
......@@ -1736,30 +1772,22 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, prepareToRetrieveFile) {
maxDrivesAllowed,
"create mount group");
const std::string userComment = "create requester";
const std::string comment = "create mount rule for requester";
const std::string requesterName = "requester_name";
m_catalogue->createRequester(m_cliSI, requesterName, mountPolicyName, userComment);
m_catalogue->createRequesterMountRule(m_cliSI, mountPolicyName, requesterName, comment);
const std::list<common::dataStructures::Requester> requesters = m_catalogue->getRequesters();
const std::list<common::dataStructures::RequesterMountRule> requesters = m_catalogue->getRequesterMountRules();
ASSERT_EQ(1, requesters.size());
const common::dataStructures::Requester requester = requesters.front();
const common::dataStructures::RequesterMountRule requester = requesters.front();
ASSERT_EQ(requesterName, requester.name);
ASSERT_EQ(mountPolicyName, requester.mountPolicy);
ASSERT_EQ(userComment, requester.comment);
ASSERT_EQ(comment, requester.comment);
ASSERT_EQ(m_cliSI.username, requester.creationLog.username);
ASSERT_EQ(m_cliSI.host, requester.creationLog.host);
ASSERT_EQ(requester.creationLog, requester.lastModificationLog);
const common::dataStructures::MountPolicy policy = m_catalogue->getMountPolicyForAUser(requesterName);