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

Renamed ConfigLibrarySlot to GenericLibrarySlot

parent 68b25dcf
......@@ -21,7 +21,7 @@ cmake_minimum_required (VERSION 2.6)
set (MEDIA_CHANGER_CLIENT_LIB_SRC_FILES
AcsLibrarySlot.cpp
ConfigLibrarySlot.cpp
GenericLibrarySlot.cpp
ManualLibrarySlot.cpp
MediaChangerFacade.cpp
MmcProxy.cpp
......
......@@ -22,19 +22,19 @@
*****************************************************************************/
#include "castor/exception/Exception.hpp"
#include "castor/mediachanger/ConfigLibrarySlot.hpp"
#include "castor/mediachanger/GenericLibrarySlot.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor::mediachanger::ConfigLibrarySlot::ConfigLibrarySlot():
castor::mediachanger::GenericLibrarySlot::GenericLibrarySlot():
m_libraryType(TAPE_LIBRARY_TYPE_NONE) {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor::mediachanger::ConfigLibrarySlot::ConfigLibrarySlot(
castor::mediachanger::GenericLibrarySlot::GenericLibrarySlot(
const std::string &str):
m_str(str),
m_libraryType(getLibraryTypeOfSlot(str)) {
......@@ -43,7 +43,7 @@ castor::mediachanger::ConfigLibrarySlot::ConfigLibrarySlot(
//------------------------------------------------------------------------------
// getLibrarySlotType
//------------------------------------------------------------------------------
castor::mediachanger::TapeLibraryType castor::mediachanger::ConfigLibrarySlot::
castor::mediachanger::TapeLibraryType castor::mediachanger::GenericLibrarySlot::
getLibraryTypeOfSlot(const std::string &slot) {
if(0 == slot.find("acs")) return TAPE_LIBRARY_TYPE_ACS;
if(0 == slot.find("manual")) return TAPE_LIBRARY_TYPE_MANUAL;
......@@ -58,7 +58,7 @@ castor::mediachanger::TapeLibraryType castor::mediachanger::ConfigLibrarySlot::
//------------------------------------------------------------------------------
// str
//------------------------------------------------------------------------------
const std::string &castor::mediachanger::ConfigLibrarySlot::str() const
const std::string &castor::mediachanger::GenericLibrarySlot::str() const
throw() {
return m_str;
}
......@@ -67,6 +67,6 @@ const std::string &castor::mediachanger::ConfigLibrarySlot::str() const
// getLibraryType
//------------------------------------------------------------------------------
castor::mediachanger::TapeLibraryType
castor::mediachanger::ConfigLibrarySlot::getLibraryType() const throw() {
castor::mediachanger::GenericLibrarySlot::getLibraryType() const throw() {
return m_libraryType;
}
......@@ -31,19 +31,19 @@ namespace castor {
namespace mediachanger {
/**
* Class representing a tape-library slot in a configuration file
* (/etc/castor/TPCONFIG).
* Class representing a generic tape-library slot as found in the
* /etc/castor/TPCONFIG.
*/
class ConfigLibrarySlot {
class GenericLibrarySlot {
public:
/**
* Constructor.
*/
ConfigLibrarySlot();
GenericLibrarySlot();
/**
* Constructs a ConfigLibrarySlot object from the specified string
* Constructs a GenericLibrarySlot object from the specified string
* representation.
*
* The string representation of a tape library-slot must be in one of the
......@@ -57,7 +57,7 @@ public:
*
* @param str The string reprsentation of the library slot.
*/
ConfigLibrarySlot(const std::string &str);
GenericLibrarySlot(const std::string &str);
/**
* Returns the string representation of this tape library slot.
......@@ -93,7 +93,7 @@ private:
*/
static TapeLibraryType getLibraryTypeOfSlot(const std::string &slot);
}; // class ConfigLibrarySlot
}; // class GenericLibrarySlot
} // namespace mediachanger
} // namespace castor
......@@ -22,14 +22,14 @@
*****************************************************************************/
#include "castor/exception/Exception.hpp"
#include "castor/mediachanger/ConfigLibrarySlot.hpp"
#include "castor/mediachanger/GenericLibrarySlot.hpp"
#include <gtest/gtest.h>
#include <memory>
namespace unitTests {
class castor_mediachanger_ConfigLibrarySlotTest : public ::testing::Test {
class castor_mediachanger_GenericLibrarySlotTest : public ::testing::Test {
protected:
virtual void SetUp() {
......@@ -39,44 +39,44 @@ protected:
}
};
TEST_F(castor_mediachanger_ConfigLibrarySlotTest, getLibraryTypeNone) {
TEST_F(castor_mediachanger_GenericLibrarySlotTest, getLibraryTypeNone) {
using namespace castor::mediachanger;
ConfigLibrarySlot slot;
GenericLibrarySlot slot;
ASSERT_EQ(TAPE_LIBRARY_TYPE_NONE, slot.getLibraryType());
}
TEST_F(castor_mediachanger_ConfigLibrarySlotTest, getLibraryTypeAcs) {
TEST_F(castor_mediachanger_GenericLibrarySlotTest, getLibraryTypeAcs) {
using namespace castor::mediachanger;
ConfigLibrarySlot slot("acs1,2,3,4");
GenericLibrarySlot slot("acs1,2,3,4");
ASSERT_EQ(TAPE_LIBRARY_TYPE_ACS, slot.getLibraryType());
}
TEST_F(castor_mediachanger_ConfigLibrarySlotTest, getLibraryTypeManual) {
TEST_F(castor_mediachanger_GenericLibrarySlotTest, getLibraryTypeManual) {
using namespace castor::mediachanger;
ConfigLibrarySlot slot("manual");
GenericLibrarySlot slot("manual");
ASSERT_EQ(TAPE_LIBRARY_TYPE_MANUAL, slot.getLibraryType());
}
TEST_F(castor_mediachanger_ConfigLibrarySlotTest, getLibraryTypeScsi) {
TEST_F(castor_mediachanger_GenericLibrarySlotTest, getLibraryTypeScsi) {
using namespace castor::mediachanger;
ConfigLibrarySlot slot("smc@rmc_host,1");
GenericLibrarySlot slot("smc@rmc_host,1");
ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, slot.getLibraryType());
}
TEST_F(castor_mediachanger_ConfigLibrarySlotTest, getLibraryTypeNonsense) {
TEST_F(castor_mediachanger_GenericLibrarySlotTest, getLibraryTypeNonsense) {
using namespace castor::mediachanger;
std::auto_ptr<ConfigLibrarySlot> slot;
std::auto_ptr<GenericLibrarySlot> slot;
ASSERT_THROW(slot.reset(new ConfigLibrarySlot("nonsense")),
ASSERT_THROW(slot.reset(new GenericLibrarySlot("nonsense")),
castor::exception::Exception);
}
......
......@@ -39,7 +39,7 @@ castor::mediachanger::MediaChangerFacade::MediaChangerFacade(
// mountTapeReadOnly
//------------------------------------------------------------------------------
void castor::mediachanger::MediaChangerFacade::mountTapeReadOnly(
const std::string &vid, const ConfigLibrarySlot &librarySlot) {
const std::string &vid, const GenericLibrarySlot &librarySlot) {
try {
const TapeLibraryType libraryType = librarySlot.getLibraryType();
......@@ -73,7 +73,7 @@ void castor::mediachanger::MediaChangerFacade::mountTapeReadOnly(
// mountTapeReadWrite
//------------------------------------------------------------------------------
void castor::mediachanger::MediaChangerFacade::mountTapeReadWrite(
const std::string &vid, const ConfigLibrarySlot &librarySlot) {
const std::string &vid, const GenericLibrarySlot &librarySlot) {
try {
const TapeLibraryType libraryType = librarySlot.getLibraryType();
......@@ -106,7 +106,7 @@ void castor::mediachanger::MediaChangerFacade::mountTapeReadWrite(
// dismountTape
//------------------------------------------------------------------------------
void castor::mediachanger::MediaChangerFacade::dismountTape(
const std::string &vid, const ConfigLibrarySlot &librarySlot) {
const std::string &vid, const GenericLibrarySlot &librarySlot) {
try {
const TapeLibraryType libraryType = librarySlot.getLibraryType();
......
......@@ -22,7 +22,7 @@
#pragma once
#include "castor/legacymsg/RmcProxy.hpp"
#include "castor/mediachanger/ConfigLibrarySlot.hpp"
#include "castor/mediachanger/GenericLibrarySlot.hpp"
#include "castor/mediachanger/MmcProxy.hpp"
#include "castor/messages/AcsProxy.hpp"
......@@ -59,7 +59,7 @@ public:
* @param librarySlot The library slot containing the tape drive.
*/
void mountTapeReadOnly(const std::string &vid,
const ConfigLibrarySlot &librarySlot);
const GenericLibrarySlot &librarySlot);
/**
* Requests the media changer to mount of the specified tape for read/write
......@@ -69,7 +69,7 @@ public:
* @param librarySlot The library slot containing the tape drive.
*/
void mountTapeReadWrite(const std::string &vid,
const ConfigLibrarySlot &librarySlot);
const GenericLibrarySlot &librarySlot);
/**
* Requests the media changer to dismount of the specified tape from the
......@@ -79,7 +79,7 @@ public:
* @param librarySlot The library slot containing the tape drive.
*/
void dismountTape(const std::string &vid,
const ConfigLibrarySlot &librarySlot);
const GenericLibrarySlot &librarySlot);
private:
......
......@@ -21,8 +21,8 @@
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#include "castor/mediachanger/GenericLibrarySlot.hpp"
#include "castor/mediachanger/MediaChangerFacade.hpp"
#include "castor/mediachanger/ConfigLibrarySlot.hpp"
#include <gtest/gtest.h>
#include <iostream>
......@@ -114,9 +114,9 @@ protected:
const std::string m_vid;
const castor::mediachanger::ConfigLibrarySlot m_acsSlot;
const castor::mediachanger::ConfigLibrarySlot m_mmcSlot;
const castor::mediachanger::ConfigLibrarySlot m_rmcSlot;
const castor::mediachanger::GenericLibrarySlot m_acsSlot;
const castor::mediachanger::GenericLibrarySlot m_mmcSlot;
const castor::mediachanger::GenericLibrarySlot m_rmcSlot;
castor_mediachanger_MediaChangerFacadeTest():
m_vid("123456"),
......
......@@ -156,7 +156,7 @@ TEST(tapeServer, DataTransferSessionGooddayRecall) {
driveConfig.unitName = "T10D6116";
driveConfig.dgn = "T10KD6";
driveConfig.devFilename = "/dev/tape_T10D6116";
driveConfig.librarySlot = castor::mediachanger::ConfigLibrarySlot("manual");
driveConfig.librarySlot = castor::mediachanger::GenericLibrarySlot("manual");
DataTransferConfig castorConf;
castorConf.bufsz = 1024*1024; // 1 MB memory buffers
castorConf.nbBufs = 10;
......@@ -261,7 +261,7 @@ TEST(tapeServer, DataTransferSessionWrongRecall) {
driveConfig.unitName = "T10D6116";
driveConfig.dgn = "T10KD6";
driveConfig.devFilename = "/dev/tape_T10D6116";
driveConfig.librarySlot = castor::mediachanger::ConfigLibrarySlot("manual");
driveConfig.librarySlot = castor::mediachanger::GenericLibrarySlot("manual");
DataTransferConfig castorConf;
castorConf.bufsz = 1024*1024; // 1 MB memory buffers
castorConf.nbBufs = 10;
......@@ -319,7 +319,7 @@ TEST(tapeServer, DataTransferSessionNoSuchDrive) {
driveConfig.unitName = "T10D6116";
driveConfig.dgn = "T10KD6";
driveConfig.devFilename = "/dev/noSuchTape";
driveConfig.librarySlot = castor::mediachanger::ConfigLibrarySlot("manual");
driveConfig.librarySlot = castor::mediachanger::GenericLibrarySlot("manual");
DataTransferConfig castorConf;
castorConf.bufsz = 1024;
castorConf.nbBufs = 10;
......@@ -407,7 +407,7 @@ TEST(tapeServer, DataTransferSessionFailtoMount) {
driveConfig.unitName = "T10D6116";
driveConfig.dgn = "T10KD6";
driveConfig.devFilename = "/dev/tape_T10D6116";
driveConfig.librarySlot = castor::mediachanger::ConfigLibrarySlot("manual");
driveConfig.librarySlot = castor::mediachanger::GenericLibrarySlot("manual");
DataTransferConfig castorConf;
castorConf.bufsz = 1024*1024; // 1 MB memory buffers
castorConf.nbBufs = 10;
......@@ -471,7 +471,7 @@ TEST(tapeServer, DataTransferSessionEmptyOnVolReq) {
driveConfig.unitName = "T10D6116";
driveConfig.dgn = "T10KD6";
driveConfig.devFilename = "/dev/tape_T10D6116";
driveConfig.librarySlot = castor::mediachanger::ConfigLibrarySlot("manual");
driveConfig.librarySlot = castor::mediachanger::GenericLibrarySlot("manual");
DataTransferConfig castorConf;
castorConf.bufsz = 1024*1024; // 1 MB memory buffers
castorConf.nbBufs = 10;
......@@ -619,7 +619,7 @@ TEST(tapeServer, DataTransferSessionGooddayMigration) {
driveConfig.unitName = "T10D6116";
driveConfig.dgn = "T10KD6";
driveConfig.devFilename = "/dev/tape_T10D6116";
driveConfig.librarySlot = castor::mediachanger::ConfigLibrarySlot("manual");
driveConfig.librarySlot = castor::mediachanger::GenericLibrarySlot("manual");
DataTransferConfig castorConf;
castorConf.bufsz = 1024*1024; // 1 MB memory buffers
castorConf.nbBufs = 10;
......@@ -709,7 +709,7 @@ TEST(tapeServer, DataTransferSessionMissingFilesMigration) {
driveConfig.unitName = "T10D6116";
driveConfig.dgn = "T10KD6";
driveConfig.devFilename = "/dev/tape_T10D6116";
driveConfig.librarySlot = castor::mediachanger::ConfigLibrarySlot("manual");
driveConfig.librarySlot = castor::mediachanger::GenericLibrarySlot("manual");
DataTransferConfig castorConf;
castorConf.bufsz = 1024*1024; // 1 MB memory buffers
castorConf.nbBufs = 10;
......@@ -811,7 +811,7 @@ TEST(tapeServer, DataTransferSessionTapeFullMigration) {
driveConfig.unitName = "T10D6116";
driveConfig.dgn = "T10KD6";
driveConfig.devFilename = "/dev/tape_T10D6116";
driveConfig.librarySlot = castor::mediachanger::ConfigLibrarySlot("manual");
driveConfig.librarySlot = castor::mediachanger::GenericLibrarySlot("manual");
DataTransferConfig castorConf;
castorConf.bufsz = 1024*1024; // 1 MB memory buffers
castorConf.nbBufs = 10;
......@@ -918,7 +918,7 @@ TEST(tapeServer, DataTransferSessionTapeFullOnFlushMigration) {
driveConfig.unitName = "T10D6116";
driveConfig.dgn = "T10KD6";
driveConfig.devFilename = "/dev/tape_T10D6116";
driveConfig.librarySlot = castor::mediachanger::ConfigLibrarySlot("manual");
driveConfig.librarySlot = castor::mediachanger::GenericLibrarySlot("manual");
DataTransferConfig castorConf;
castorConf.bufsz = 1024*1024; // 1 MB memory buffers
castorConf.nbBufs = 10;
......
......@@ -25,7 +25,7 @@
#include "castor/exception/Errnum.hpp"
#include "castor/exception/Exception.hpp"
#include "castor/mediachanger/ConfigLibrarySlot.hpp"
#include "castor/mediachanger/GenericLibrarySlot.hpp"
#include "castor/tape/tapeserver/drive/mtio_add.hpp"
#include "castor/tape/tapeserver/SCSI/Device.hpp"
#include "castor/tape/tapeserver/SCSI/Exception.hpp"
......@@ -192,7 +192,7 @@ namespace drive {
* Member allowing the convenient storage of the drive location for the
* mount system (we get the information from TPCONFIG)
*/
mediachanger::ConfigLibrarySlot librarySlot;
mediachanger::GenericLibrarySlot librarySlot;
};
/**
......
......@@ -23,7 +23,7 @@
#pragma once
#include "castor/mediachanger/ConfigLibrarySlot.hpp"
#include "castor/mediachanger/GenericLibrarySlot.hpp"
#include <list>
#include <string>
......@@ -59,7 +59,7 @@ struct DriveConfig {
* The library slot n which the tape drive is located, for example:
* smc@localhost,0
*/
mediachanger::ConfigLibrarySlot librarySlot;
mediachanger::GenericLibrarySlot librarySlot;
}; // class DriveConfig
......
......@@ -23,7 +23,7 @@
*****************************************************************************/
#include "castor/exception/InvalidArgument.hpp"
#include "castor/mediachanger/ConfigLibrarySlot.hpp"
#include "castor/mediachanger/GenericLibrarySlot.hpp"
#include "castor/tape/Constants.hpp"
#include "castor/tape/utils/utils.hpp"
#include "castor/utils/SmartFILEPtr.hpp"
......
......@@ -133,7 +133,7 @@ add_executable(castorUnitTests
../castor/log/SyslogLoggerTest.cpp
../castor/mediachanger/AcsLibrarySlot.cpp
../castor/mediachanger/AcsLibrarySlotTest.cpp
../castor/mediachanger/ConfigLibrarySlotTest.cpp
../castor/mediachanger/GenericLibrarySlotTest.cpp
../castor/mediachanger/MediaChangerFacadeTest.cpp
../castor/mediachanger/ScsiLibrarySlot.cpp
../castor/mediachanger/ScsiLibrarySlotTest.cpp
......
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