Commit c37836b2 authored by Steven Murray's avatar Steven Murray
Browse files

Renamed Database classes as Table where appropriate

parent d6a87f3d
......@@ -17,16 +17,16 @@ set (MIDDLE_TIER_LIB_SRC_FILES
MiddleTierUser.cpp
MigrationRoute.cpp
MigrationRouteId.cpp
MockAdminHostDatabase.cpp
MockAdminUserDatabase.cpp
MockAdminHostTable.cpp
MockAdminUserTable.cpp
MockDatabase.cpp
MockLogicalLibraryDatabase.cpp
MockLogicalLibraryTable.cpp
MockMiddleTierAdmin.cpp
MockMiddleTierUser.cpp
MockMiddleTierUser.cpp
MockMigrationRouteDatabase.cpp
MockTapeDatabase.cpp
MockTapePoolDatabase.cpp
MockMigrationRouteTable.cpp
MockTapeTable.cpp
MockTapePoolTable.cpp
SecurityIdentity.cpp
StorageClass.cpp
Tape.cpp
......@@ -38,13 +38,13 @@ add_library (ctamiddletier SHARED
${MIDDLE_TIER_LIB_SRC_FILES})
set (MIDDLE_TIER_UNIT_TESTS_LIB_SRC_FILES
MockAdminHostDatabaseTest.cpp
MockAdminUserDatabaseTest.cpp
MockLogicalLibraryDatabaseTest.cpp
MockAdminHostTableTest.cpp
MockAdminUserTableTest.cpp
MockLogicalLibraryTableTest.cpp
MockMiddleTierAdminTest.cpp
MockMiddleTierUserTest.cpp
MockTapeDatabaseTest.cpp
MockTapePoolDatabaseTest.cpp
MockTapeTableTest.cpp
MockTapePoolTableTest.cpp
UtilsTest.cpp)
add_library (ctamiddletierunittests SHARED
......
#include "Exception.hpp"
#include "MockAdminHostDatabase.hpp"
#include "MockAdminHostTable.hpp"
#include <sstream>
//------------------------------------------------------------------------------
// createAdminHost
//------------------------------------------------------------------------------
void cta::MockAdminHostDatabase::createAdminHost(
void cta::MockAdminHostTable::createAdminHost(
const SecurityIdentity &requester,
const std::string &hostName,
const std::string &comment) {
......@@ -18,7 +18,7 @@ void cta::MockAdminHostDatabase::createAdminHost(
//------------------------------------------------------------------------------
// checkAdminHostDoesNotAlreadyExist
//------------------------------------------------------------------------------
void cta::MockAdminHostDatabase::checkAdminHostDoesNotAlreadyExist(
void cta::MockAdminHostTable::checkAdminHostDoesNotAlreadyExist(
const std::string &hostName) const {
std::map<std::string, AdminHost>::const_iterator itor =
m_adminHosts.find(hostName);
......@@ -32,7 +32,7 @@ void cta::MockAdminHostDatabase::checkAdminHostDoesNotAlreadyExist(
//------------------------------------------------------------------------------
// deleteAdminHost
//------------------------------------------------------------------------------
void cta::MockAdminHostDatabase::deleteAdminHost(
void cta::MockAdminHostTable::deleteAdminHost(
const SecurityIdentity &requester,
const std::string &hostName) {
for(std::map<std::string, AdminHost>::iterator itor = m_adminHosts.begin();
......@@ -53,7 +53,7 @@ void cta::MockAdminHostDatabase::deleteAdminHost(
//------------------------------------------------------------------------------
// getAdminHosts
//------------------------------------------------------------------------------
std::list<cta::AdminHost> cta::MockAdminHostDatabase::getAdminHosts(
std::list<cta::AdminHost> cta::MockAdminHostTable::getAdminHosts(
const SecurityIdentity &requester) const {
std::list<cta::AdminHost> hosts;
for(std::map<std::string, AdminHost>::const_iterator itor =
......
......@@ -10,9 +10,9 @@
namespace cta {
/**
* Mock database of administration hosts.
* Mock database-table of administration hosts.
*/
class MockAdminHostDatabase {
class MockAdminHostTable {
public:
/**
......@@ -61,6 +61,6 @@ private:
*/
std::map<std::string, AdminHost> m_adminHosts;
}; // class MockAdminHostDatabase
}; // class MockAdminHostTable
} // namespace cta
#include "MockAdminHostDatabase.hpp"
#include "MockAdminHostTable.hpp"
#include <gtest/gtest.h>
namespace unitTests {
class cta_client_MockAdminHostDatabaseTest: public ::testing::Test {
class cta_client_MockAdminHostTableTest: public ::testing::Test {
protected:
virtual void SetUp() {
......@@ -14,10 +14,10 @@ protected:
}
};
TEST_F(cta_client_MockAdminHostDatabaseTest, createAdminHost_new) {
TEST_F(cta_client_MockAdminHostTableTest, createAdminHost_new) {
using namespace cta;
MockAdminHostDatabase db;
MockAdminHostTable db;
const SecurityIdentity requester;
{
......@@ -40,10 +40,10 @@ TEST_F(cta_client_MockAdminHostDatabaseTest, createAdminHost_new) {
}
}
TEST_F(cta_client_MockAdminHostDatabaseTest, deleteAdminHost_existing) {
TEST_F(cta_client_MockAdminHostTableTest, deleteAdminHost_existing) {
using namespace cta;
MockAdminHostDatabase db;
MockAdminHostTable db;
const SecurityIdentity requester;
{
......@@ -74,10 +74,10 @@ TEST_F(cta_client_MockAdminHostDatabaseTest, deleteAdminHost_existing) {
}
}
TEST_F(cta_client_MockAdminHostDatabaseTest, deleteAdminHost_non_existing) {
TEST_F(cta_client_MockAdminHostTableTest, deleteAdminHost_non_existing) {
using namespace cta;
MockAdminHostDatabase db;
MockAdminHostTable db;
const SecurityIdentity requester;
{
......
#include "Exception.hpp"
#include "MockAdminUserDatabase.hpp"
#include "MockAdminUserTable.hpp"
#include <iostream>
#include <memory>
......@@ -8,7 +8,7 @@
//------------------------------------------------------------------------------
// createAdminUser
//------------------------------------------------------------------------------
void cta::MockAdminUserDatabase::createAdminUser(
void cta::MockAdminUserTable::createAdminUser(
const SecurityIdentity &requester,
const UserIdentity &user,
const std::string &comment) {
......@@ -20,7 +20,7 @@ void cta::MockAdminUserDatabase::createAdminUser(
//------------------------------------------------------------------------------
// checkAdminUserDoesNotAlreadyExist
//------------------------------------------------------------------------------
void cta::MockAdminUserDatabase::checkAdminUserDoesNotAlreadyExist(
void cta::MockAdminUserTable::checkAdminUserDoesNotAlreadyExist(
const UserIdentity &user) const {
std::map<uint32_t, AdminUser>::const_iterator itor =
m_adminUsers.find(user.getUid());
......@@ -35,7 +35,7 @@ void cta::MockAdminUserDatabase::checkAdminUserDoesNotAlreadyExist(
//------------------------------------------------------------------------------
// deleteAdminUser
//------------------------------------------------------------------------------
void cta::MockAdminUserDatabase::deleteAdminUser(
void cta::MockAdminUserTable::deleteAdminUser(
const SecurityIdentity &requester,
const UserIdentity &user) {
for(std::map<uint32_t, AdminUser>::iterator itor = m_adminUsers.begin();
......@@ -55,7 +55,7 @@ void cta::MockAdminUserDatabase::deleteAdminUser(
//------------------------------------------------------------------------------
// getAdminUsers
//------------------------------------------------------------------------------
std::list<cta::AdminUser> cta::MockAdminUserDatabase::getAdminUsers(
std::list<cta::AdminUser> cta::MockAdminUserTable::getAdminUsers(
const SecurityIdentity &requester) const {
std::list<cta::AdminUser> users;
for(std::map<uint32_t, AdminUser>::const_iterator itor =
......
......@@ -10,9 +10,9 @@
namespace cta {
/**
* Mock database of admin users.
* Mock database-table of admin users.
*/
class MockAdminUserDatabase {
class MockAdminUserTable {
public:
/**
......@@ -61,6 +61,6 @@ private:
*/
std::map<uint32_t, AdminUser> m_adminUsers;
}; // MockAdminUserDatabase
}; // MockAdminUserTable
} // namespace cta
#include "MockAdminUserDatabase.hpp"
#include "MockAdminUserTable.hpp"
#include "MockMiddleTierUser.hpp"
#include <gtest/gtest.h>
namespace unitTests {
class cta_client_MockAdminUserDatabaseTest: public ::testing::Test {
class cta_client_MockAdminUserTableTest: public ::testing::Test {
protected:
virtual void SetUp() {
......@@ -15,10 +15,10 @@ protected:
}
};
TEST_F(cta_client_MockAdminUserDatabaseTest, createAdminUser_new) {
TEST_F(cta_client_MockAdminUserTableTest, createAdminUser_new) {
using namespace cta;
MockAdminUserDatabase db;
MockAdminUserTable db;
const SecurityIdentity requester;
{
......@@ -44,10 +44,10 @@ TEST_F(cta_client_MockAdminUserDatabaseTest, createAdminUser_new) {
}
}
TEST_F(cta_client_MockAdminUserDatabaseTest, createAdminUser_already_existing) {
TEST_F(cta_client_MockAdminUserTableTest, createAdminUser_already_existing) {
using namespace cta;
MockAdminUserDatabase db;
MockAdminUserTable db;
const SecurityIdentity requester;
{
......@@ -82,10 +82,10 @@ TEST_F(cta_client_MockAdminUserDatabaseTest, createAdminUser_already_existing) {
}
}
TEST_F(cta_client_MockAdminUserDatabaseTest, deleteAdminUser_existing) {
TEST_F(cta_client_MockAdminUserTableTest, deleteAdminUser_existing) {
using namespace cta;
MockAdminUserDatabase db;
MockAdminUserTable db;
const SecurityIdentity requester;
{
......@@ -118,10 +118,10 @@ TEST_F(cta_client_MockAdminUserDatabaseTest, deleteAdminUser_existing) {
}
}
TEST_F(cta_client_MockAdminUserDatabaseTest, deleteAdminUser_non_existing) {
TEST_F(cta_client_MockAdminUserTableTest, deleteAdminUser_non_existing) {
using namespace cta;
MockAdminUserDatabase db;
MockAdminUserTable db;
const SecurityIdentity requester;
{
......
......@@ -2,12 +2,12 @@
#include "FileSystemNode.hpp"
#include "FileSystemStorageClasses.hpp"
#include "MockAdminHostDatabase.hpp"
#include "MockAdminUserDatabase.hpp"
#include "MockLogicalLibraryDatabase.hpp"
#include "MockMigrationRouteDatabase.hpp"
#include "MockTapeDatabase.hpp"
#include "MockTapePoolDatabase.hpp"
#include "MockAdminHostTable.hpp"
#include "MockAdminUserTable.hpp"
#include "MockLogicalLibraryTable.hpp"
#include "MockMigrationRouteTable.hpp"
#include "MockTapeTable.hpp"
#include "MockTapePoolTable.hpp"
namespace cta {
......@@ -29,14 +29,14 @@ struct MockDatabase {
~MockDatabase() throw();
/**
* Database of administrators.
* Table of administrators.
*/
MockAdminUserDatabase adminUsers;
MockAdminUserTable adminUsers;
/**
* Database of administration hosts.
* Table of administration hosts.
*/
MockAdminHostDatabase adminHosts;
MockAdminHostTable adminHosts;
/**
* Container of the storage classes used by the file system.
......@@ -44,14 +44,14 @@ struct MockDatabase {
FileSystemStorageClasses storageClasses;
/**
* Database of tape pools.
* Table of tape pools.
*/
MockTapePoolDatabase tapePools;
MockTapePoolTable tapePools;
/**
* Container of migration routes.
*/
MockMigrationRouteDatabase migrationRoutes;
MockMigrationRouteTable migrationRoutes;
/**
* The root node of the file-system.
......@@ -59,14 +59,14 @@ struct MockDatabase {
FileSystemNode fileSystemRoot;
/**
* Database of logical libraries.
* Table of logical libraries.
*/
MockLogicalLibraryDatabase libraries;
MockLogicalLibraryTable libraries;
/**
* Database of tapes.
* Table of tapes.
*/
MockTapeDatabase tapes;
MockTapeTable tapes;
}; // struct MockDatabase
......
#include "Exception.hpp"
#include "MockLogicalLibraryDatabase.hpp"
#include "MockLogicalLibraryTable.hpp"
#include <iostream>
#include <memory>
......@@ -8,7 +8,7 @@
//------------------------------------------------------------------------------
// createLogicalLibrary
//------------------------------------------------------------------------------
void cta::MockLogicalLibraryDatabase::createLogicalLibrary(
void cta::MockLogicalLibraryTable::createLogicalLibrary(
const SecurityIdentity &requester,
const std::string &name,
const std::string &comment) {
......@@ -20,7 +20,7 @@ void cta::MockLogicalLibraryDatabase::createLogicalLibrary(
//------------------------------------------------------------------------------
// checkLogicalLibraryDoesNotAlreadyExist
//------------------------------------------------------------------------------
void cta::MockLogicalLibraryDatabase::checkLogicalLibraryDoesNotAlreadyExist(
void cta::MockLogicalLibraryTable::checkLogicalLibraryDoesNotAlreadyExist(
const std::string &name) const {
std::map<std::string, LogicalLibrary>::const_iterator itor =
m_libraries.find(name);
......@@ -34,7 +34,7 @@ void cta::MockLogicalLibraryDatabase::checkLogicalLibraryDoesNotAlreadyExist(
//------------------------------------------------------------------------------
// deleteLogicalLibrary
//------------------------------------------------------------------------------
void cta::MockLogicalLibraryDatabase::deleteLogicalLibrary(
void cta::MockLogicalLibraryTable::deleteLogicalLibrary(
const SecurityIdentity &requester,
const std::string &name) {
for(std::map<std::string, LogicalLibrary>::iterator itor =
......@@ -56,7 +56,7 @@ void cta::MockLogicalLibraryDatabase::deleteLogicalLibrary(
//------------------------------------------------------------------------------
// getLogicalLibraries
//------------------------------------------------------------------------------
std::list<cta::LogicalLibrary> cta::MockLogicalLibraryDatabase::getLogicalLibraries(
std::list<cta::LogicalLibrary> cta::MockLogicalLibraryTable::getLogicalLibraries(
const SecurityIdentity &requester) const {
std::list<LogicalLibrary> libraries;
......
......@@ -10,9 +10,9 @@
namespace cta {
/**
* Mock middle-tier.
* Mock database-table logical libraries.
*/
class MockLogicalLibraryDatabase {
class MockLogicalLibraryTable {
public:
/**
......@@ -62,6 +62,6 @@ private:
*/
std::map<std::string, LogicalLibrary> m_libraries;
}; // class MockLogicalLibraryDatabase
}; // class MockLogicalLibraryTable
} // namespace cta
#include "MockLogicalLibraryDatabase.hpp"
#include "MockLogicalLibraryTable.hpp"
#include <gtest/gtest.h>
namespace unitTests {
class cta_client_MockLogicalLibraryDatabaseTest: public ::testing::Test {
class cta_client_MockLogicalLibraryTableTest: public ::testing::Test {
protected:
virtual void SetUp() {
......@@ -14,10 +14,10 @@ protected:
}
};
TEST_F(cta_client_MockLogicalLibraryDatabaseTest, createLogicalLibrary_new) {
TEST_F(cta_client_MockLogicalLibraryTableTest, createLogicalLibrary_new) {
using namespace cta;
MockLogicalLibraryDatabase db;
MockLogicalLibraryTable db;
const SecurityIdentity requester;
{
......@@ -43,11 +43,11 @@ TEST_F(cta_client_MockLogicalLibraryDatabaseTest, createLogicalLibrary_new) {
}
}
TEST_F(cta_client_MockLogicalLibraryDatabaseTest,
TEST_F(cta_client_MockLogicalLibraryTableTest,
createLogicalLibrary_already_existing) {
using namespace cta;
MockLogicalLibraryDatabase db;
MockLogicalLibraryTable db;
const SecurityIdentity requester;
{
......@@ -76,11 +76,11 @@ TEST_F(cta_client_MockLogicalLibraryDatabaseTest,
libraryComment), std::exception);
}
TEST_F(cta_client_MockLogicalLibraryDatabaseTest,
TEST_F(cta_client_MockLogicalLibraryTableTest,
createLogicalLibrary_lexicographical_order) {
using namespace cta;
MockLogicalLibraryDatabase db;
MockLogicalLibraryTable db;
const SecurityIdentity requester;
{
......@@ -109,10 +109,10 @@ TEST_F(cta_client_MockLogicalLibraryDatabaseTest,
}
}
TEST_F(cta_client_MockLogicalLibraryDatabaseTest, deleteLogicalLibrary_existing) {
TEST_F(cta_client_MockLogicalLibraryTableTest, deleteLogicalLibrary_existing) {
using namespace cta;
MockLogicalLibraryDatabase db;
MockLogicalLibraryTable db;
const SecurityIdentity requester;
{
......@@ -146,11 +146,11 @@ TEST_F(cta_client_MockLogicalLibraryDatabaseTest, deleteLogicalLibrary_existing)
}
}
TEST_F(cta_client_MockLogicalLibraryDatabaseTest,
TEST_F(cta_client_MockLogicalLibraryTableTest,
deleteLogicalLibrary_non_existing) {
using namespace cta;
MockLogicalLibraryDatabase db;
MockLogicalLibraryTable db;
const SecurityIdentity requester;
{
......
#include "Exception.hpp"
#include "MockMigrationRouteDatabase.hpp"
#include "MockMigrationRouteTable.hpp"
#include <sstream>
//------------------------------------------------------------------------------
// createMigrationRoute
//------------------------------------------------------------------------------
void cta::MockMigrationRouteDatabase::createMigrationRoute(
void cta::MockMigrationRouteTable::createMigrationRoute(
const std::string &storageClassName,
const uint8_t copyNb,
const std::string &tapePoolName,
......@@ -26,7 +26,7 @@ void cta::MockMigrationRouteDatabase::createMigrationRoute(
//------------------------------------------------------------------------------
// checkMigrationRouteDoesNotAlreadyExists
//------------------------------------------------------------------------------
void cta::MockMigrationRouteDatabase::checkMigrationRouteDoesNotAlreadyExists(
void cta::MockMigrationRouteTable::checkMigrationRouteDoesNotAlreadyExists(
const MigrationRouteId &routeId) const {
std::map<MigrationRouteId, MigrationRoute>::const_iterator itor =
m_migrationRoutes.find(routeId);
......@@ -42,7 +42,7 @@ void cta::MockMigrationRouteDatabase::checkMigrationRouteDoesNotAlreadyExists(
//------------------------------------------------------------------------------
// deleteMigrationRoute
//------------------------------------------------------------------------------
void cta::MockMigrationRouteDatabase::deleteMigrationRoute(
void cta::MockMigrationRouteTable::deleteMigrationRoute(
const std::string &storageClassName,
const uint8_t copyNb) {
const MigrationRouteId routeId(storageClassName, copyNb);
......@@ -61,7 +61,7 @@ void cta::MockMigrationRouteDatabase::deleteMigrationRoute(
//------------------------------------------------------------------------------
// getMigrationRoutes
//------------------------------------------------------------------------------
std::list<cta::MigrationRoute> cta::MockMigrationRouteDatabase::
std::list<cta::MigrationRoute> cta::MockMigrationRouteTable::
getMigrationRoutes() const {
std::list<cta::MigrationRoute> routes;
for(std::map<MigrationRouteId, MigrationRoute>::const_iterator itor =
......@@ -74,14 +74,14 @@ std::list<cta::MigrationRoute> cta::MockMigrationRouteDatabase::
//------------------------------------------------------------------------------
// checkMigrationRouteExists
//------------------------------------------------------------------------------
void cta::MockMigrationRouteDatabase::checkMigrationRouteExists(
void cta::MockMigrationRouteTable::checkMigrationRouteExists(
const std::string &storageClassName, const uint8_t copyNb) const {
}
//------------------------------------------------------------------------------
// tapePoolIsInAMigrationRoute
//------------------------------------------------------------------------------
bool cta::MockMigrationRouteDatabase::tapePoolIsInAMigrationRoute(
bool cta::MockMigrationRouteTable::tapePoolIsInAMigrationRoute(
const std::string &name) const {
for(std::map<MigrationRouteId, MigrationRoute>::const_iterator itor =
m_migrationRoutes.begin(); itor != m_migrationRoutes.end(); itor++) {
......@@ -95,7 +95,7 @@ bool cta::MockMigrationRouteDatabase::tapePoolIsInAMigrationRoute(
//------------------------------------------------------------------------------
// storageClassIsInAMigrationRoute
//------------------------------------------------------------------------------
bool cta::MockMigrationRouteDatabase::storageClassIsInAMigrationRoute(
bool cta::MockMigrationRouteTable::storageClassIsInAMigrationRoute(
const std::string &name) const {
for(std::map<MigrationRouteId, MigrationRoute>::const_iterator itor =
m_migrationRoutes.begin(); itor != m_migrationRoutes.end(); itor++) {
......
......@@ -11,9 +11,9 @@
namespace cta {
/**
* Mock database of migration routes.
* Mock database-table of migration routes.
*/
class MockMigrationRouteDatabase {
class MockMigrationRouteTable {
public:
/**
......@@ -92,6 +92,6 @@ private:
void checkMigrationRouteDoesNotAlreadyExists(const MigrationRouteId &routeId)
const;
}; // class MockMigrationRouteDatabase
}; // class MockMigrationRouteTable
} // namespace cta
#include "Exception.hpp"
#include "MockTapePoolDatabase.hpp"
#include "MockTapePoolTable.hpp"
#include <sstream>
//------------------------------------------------------------------------------
// createTapePool
//------------------------------------------------------------------------------
void cta::MockTapePoolDatabase::createTapePool(
void cta::MockTapePoolTable::createTapePool(
const SecurityIdentity &requester,
const std::string &name,
const uint16_t nbDrives,
......@@ -20,7 +20,7 @@ void cta::MockTapePoolDatabase::createTapePool(
//------------------------------------------------------------------------------
// checkTapePoolDoesNotAlreadyExist
//------------------------------------------------------------------------------
void cta::MockTapePoolDatabase::checkTapePoolDoesNotAlreadyExist(
void cta::MockTapePoolTable::checkTapePoolDoesNotAlreadyExist(
const std::string &name) const {
std::map<std::string, TapePool>::const_iterator itor =
m_tapePools.find(name);
......@@ -34,7 +34,7 @@ void cta::MockTapePoolDatabase::checkTapePoolDoesNotAlreadyExist(
//------------------------------------------------------------------------------
// deleteTapePool
//------------------------------------------------------------------------------
void cta::MockTapePoolDatabase::deleteTapePool(const SecurityIdentity &requester,
void cta::MockTapePoolTable::deleteTapePool(const SecurityIdentity &requester,
const std::string &name) {
std::map<std::string, TapePool>::iterator itor = m_tapePools.find(name);
if(itor == m_tapePools.end()) {
......@@ -48,7 +48,7 @@ void cta::MockTapePoolDatabase::deleteTapePool(const SecurityIdentity &requester
//------------------------------------------------------------------------------
// getTapePools
//------------------------------------------------------------------------------
std::list<cta::TapePool> cta::MockTapePoolDatabase::getTapePools(
std::list<cta::TapePool> cta::MockTapePoolTable::getTapePools(