Commit 34ef3e7e authored by Steven Murray's avatar Steven Murray
Browse files

Renamed mediachanger::TapeLibrarySlot to ConfigLibrarySlot

parent 6bf01485
......@@ -48,7 +48,7 @@ public:
* @param librarySlot The library slot containing the tape drive.
*/
virtual void mountTapeReadOnly(const std::string &vid,
const mediachanger::TapeLibrarySlot &librarySlot) = 0;
const mediachanger::ConfigLibrarySlot &librarySlot) = 0;
/**
* Requests the media changer to mount of the specified tape for read/write
......@@ -58,7 +58,7 @@ public:
* @param librarySlot The library slot containing the tape drive.
*/
virtual void mountTapeReadWrite(const std::string &vid,
const mediachanger::TapeLibrarySlot &librarySlot) = 0;
const mediachanger::ConfigLibrarySlot &librarySlot) = 0;
/**
* Requests the media changer to dismount of the specified tape from the
......@@ -68,7 +68,7 @@ public:
* @param librarySlot The library slot containing the tape drive.
*/
virtual void dismountTape(const std::string &vid,
const mediachanger::TapeLibrarySlot &librarySlot) = 0;
const mediachanger::ConfigLibrarySlot &librarySlot) = 0;
}; // class RmcProxy
......
......@@ -49,10 +49,7 @@ castor::legacymsg::RmcProxyTcpIp::~RmcProxyTcpIp() throw() {
// mountTapeReadOnly
//------------------------------------------------------------------------------
void castor::legacymsg::RmcProxyTcpIp::mountTapeReadOnly(
const std::string &vid, const mediachanger::TapeLibrarySlot &librarySlot) {
verifyVidAndLibrarySlot(vid, mediachanger::TAPE_LIBRARY_TYPE_SCSI,
librarySlot);
const std::string &vid, const mediachanger::ConfigLibrarySlot &librarySlot) {
// SCSI does not support read-only mounts
mountTapeReadWrite(vid, librarySlot);
}
......@@ -61,11 +58,8 @@ void castor::legacymsg::RmcProxyTcpIp::mountTapeReadOnly(
// mountTapeReadWrite
//------------------------------------------------------------------------------
void castor::legacymsg::RmcProxyTcpIp::mountTapeReadWrite(
const std::string &vid, const mediachanger::TapeLibrarySlot &librarySlot) {
const std::string &vid, const mediachanger::ConfigLibrarySlot &librarySlot) {
try {
verifyVidAndLibrarySlot(vid, mediachanger::TAPE_LIBRARY_TYPE_SCSI,
librarySlot);
// Dispatch the appropriate helper method depending on library slot type
switch(librarySlot.getLibraryType()) {
case mediachanger::TAPE_LIBRARY_TYPE_ACS:
......@@ -172,10 +166,7 @@ void castor::legacymsg::RmcProxyTcpIp::mountTapeScsi(const std::string &vid,
// dismountTape
//------------------------------------------------------------------------------
void castor::legacymsg::RmcProxyTcpIp::dismountTape(const std::string &vid,
const mediachanger::TapeLibrarySlot &librarySlot) {
verifyVidAndLibrarySlot(vid, mediachanger::TAPE_LIBRARY_TYPE_SCSI,
librarySlot);
const mediachanger::ConfigLibrarySlot &librarySlot) {
// Dispatch the appropriate helper method depending on library slot type
switch(librarySlot.getLibraryType()) {
case mediachanger::TAPE_LIBRARY_TYPE_ACS:
......
......@@ -63,7 +63,7 @@ public:
* @param librarySlot The library slot containing the tape drive.
*/
void mountTapeReadOnly(const std::string &vid,
const mediachanger::TapeLibrarySlot &librarySlot);
const mediachanger::ConfigLibrarySlot &librarySlot);
/**
* Requests the media changer to mount of the specified tape for read/write
......@@ -73,7 +73,7 @@ public:
* @param librarySlot The library slot containing the tape drive.
*/
void mountTapeReadWrite(const std::string &vid,
const mediachanger::TapeLibrarySlot &librarySlot);
const mediachanger::ConfigLibrarySlot &librarySlot);
/**
* Requests the media changer to dismount of the specified tape from the
......@@ -83,7 +83,7 @@ public:
* @param librarySlot The library slot containing the tape drive.
*/
void dismountTape(const std::string &vid,
const mediachanger::TapeLibrarySlot &librarySlot);
const mediachanger::ConfigLibrarySlot &librarySlot);
protected:
......
......@@ -21,11 +21,11 @@ cmake_minimum_required (VERSION 2.6)
set (MEDIA_CHANGER_CLIENT_LIB_SRC_FILES
AcsLibrarySlot.cpp
ConfigLibrarySlot.cpp
MediaChangerFacade.cpp
MediaChangerProxy.cpp
MediaChangerProxyDummy.cpp
ScsiLibrarySlot.cpp
TapeLibrarySlot.cpp
TapeLibraryType.cpp)
add_library(castormediachangerclient
${MEDIA_CHANGER_CLIENT_LIB_SRC_FILES})
......@@ -22,19 +22,20 @@
*****************************************************************************/
#include "castor/exception/Exception.hpp"
#include "castor/mediachanger/TapeLibrarySlot.hpp"
#include "castor/mediachanger/ConfigLibrarySlot.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor::mediachanger::TapeLibrarySlot::TapeLibrarySlot():
castor::mediachanger::ConfigLibrarySlot::ConfigLibrarySlot():
m_libraryType(TAPE_LIBRARY_TYPE_NONE) {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor::mediachanger::TapeLibrarySlot::TapeLibrarySlot(const std::string &str):
castor::mediachanger::ConfigLibrarySlot::ConfigLibrarySlot(
const std::string &str):
m_str(str),
m_libraryType(getLibraryTypeOfSlot(str)) {
}
......@@ -42,7 +43,7 @@ castor::mediachanger::TapeLibrarySlot::TapeLibrarySlot(const std::string &str):
//------------------------------------------------------------------------------
// getLibrarySlotType
//------------------------------------------------------------------------------
castor::mediachanger::TapeLibraryType castor::mediachanger::TapeLibrarySlot::
castor::mediachanger::TapeLibraryType castor::mediachanger::ConfigLibrarySlot::
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;
......@@ -57,7 +58,8 @@ castor::mediachanger::TapeLibraryType castor::mediachanger::TapeLibrarySlot::
//------------------------------------------------------------------------------
// str
//------------------------------------------------------------------------------
const std::string &castor::mediachanger::TapeLibrarySlot::str() const throw() {
const std::string &castor::mediachanger::ConfigLibrarySlot::str() const
throw() {
return m_str;
}
......@@ -65,6 +67,6 @@ const std::string &castor::mediachanger::TapeLibrarySlot::str() const throw() {
// getLibraryType
//------------------------------------------------------------------------------
castor::mediachanger::TapeLibraryType
castor::mediachanger::TapeLibrarySlot::getLibraryType() const throw() {
castor::mediachanger::ConfigLibrarySlot::getLibraryType() const throw() {
return m_libraryType;
}
......@@ -31,18 +31,19 @@ namespace castor {
namespace mediachanger {
/**
* Class representing a slot in a tape library.
* Class representing a tape-library slot in a configuration file
* (/etc/castor/TPCONFIG).
*/
class TapeLibrarySlot {
class ConfigLibrarySlot {
public:
/**
* Constructor.
*/
TapeLibrarySlot();
ConfigLibrarySlot();
/**
* Constructs a TapeLibrarySlot object from the specified string
* Constructs a ConfigLibrarySlot object from the specified string
* representation.
*
* The string representation of a tape library-slot must be in one of the
......@@ -56,7 +57,7 @@ public:
*
* @param str The string reprsentation of the library slot.
*/
TapeLibrarySlot(const std::string &str);
ConfigLibrarySlot(const std::string &str);
/**
* Returns the string representation of this tape library slot.
......@@ -92,7 +93,7 @@ private:
*/
static TapeLibraryType getLibraryTypeOfSlot(const std::string &slot);
}; // class TapeLibrarySlot
}; // class ConfigLibrarySlot
} // namespace mediachanger
} // namespace castor
......@@ -22,14 +22,14 @@
*****************************************************************************/
#include "castor/exception/Exception.hpp"
#include "castor/mediachanger/TapeLibrarySlot.hpp"
#include "castor/mediachanger/ConfigLibrarySlot.hpp"
#include <gtest/gtest.h>
#include <memory>
namespace unitTests {
class castor_mediachanger_TapeLibrarySlotTest : public ::testing::Test {
class castor_mediachanger_ConfigLibrarySlotTest : public ::testing::Test {
protected:
virtual void SetUp() {
......@@ -39,44 +39,44 @@ protected:
}
};
TEST_F(castor_mediachanger_TapeLibrarySlotTest, getLibraryTypeNone) {
TEST_F(castor_mediachanger_ConfigLibrarySlotTest, getLibraryTypeNone) {
using namespace castor::mediachanger;
TapeLibrarySlot slot;
ConfigLibrarySlot slot;
ASSERT_EQ(TAPE_LIBRARY_TYPE_NONE, slot.getLibraryType());
}
TEST_F(castor_mediachanger_TapeLibrarySlotTest, getLibraryTypeAcs) {
TEST_F(castor_mediachanger_ConfigLibrarySlotTest, getLibraryTypeAcs) {
using namespace castor::mediachanger;
TapeLibrarySlot slot("acs1,2,3,4");
ConfigLibrarySlot slot("acs1,2,3,4");
ASSERT_EQ(TAPE_LIBRARY_TYPE_ACS, slot.getLibraryType());
}
TEST_F(castor_mediachanger_TapeLibrarySlotTest, getLibraryTypeManual) {
TEST_F(castor_mediachanger_ConfigLibrarySlotTest, getLibraryTypeManual) {
using namespace castor::mediachanger;
TapeLibrarySlot slot("manual");
ConfigLibrarySlot slot("manual");
ASSERT_EQ(TAPE_LIBRARY_TYPE_MANUAL, slot.getLibraryType());
}
TEST_F(castor_mediachanger_TapeLibrarySlotTest, getLibraryTypeScsi) {
TEST_F(castor_mediachanger_ConfigLibrarySlotTest, getLibraryTypeScsi) {
using namespace castor::mediachanger;
TapeLibrarySlot slot("smc@rmc_host,1");
ConfigLibrarySlot slot("smc@rmc_host,1");
ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, slot.getLibraryType());
}
TEST_F(castor_mediachanger_TapeLibrarySlotTest, getLibraryTypeNonsense) {
TEST_F(castor_mediachanger_ConfigLibrarySlotTest, getLibraryTypeNonsense) {
using namespace castor::mediachanger;
std::auto_ptr<TapeLibrarySlot> slot;
std::auto_ptr<ConfigLibrarySlot> slot;
ASSERT_THROW(slot.reset(new TapeLibrarySlot("nonsense")),
ASSERT_THROW(slot.reset(new ConfigLibrarySlot("nonsense")),
castor::exception::Exception);
}
......
......@@ -39,7 +39,7 @@ castor::mediachanger::MediaChangerFacade::MediaChangerFacade(
// mountTapeReadOnly
//------------------------------------------------------------------------------
void castor::mediachanger::MediaChangerFacade::mountTapeReadOnly(
const std::string &vid, const TapeLibrarySlot &librarySlot) {
const std::string &vid, const ConfigLibrarySlot &librarySlot) {
try {
const TapeLibraryType libraryType = librarySlot.getLibraryType();
......@@ -71,7 +71,7 @@ void castor::mediachanger::MediaChangerFacade::mountTapeReadOnly(
// mountTapeReadWrite
//------------------------------------------------------------------------------
void castor::mediachanger::MediaChangerFacade::mountTapeReadWrite(
const std::string &vid, const TapeLibrarySlot &librarySlot) {
const std::string &vid, const ConfigLibrarySlot &librarySlot) {
try {
const TapeLibraryType libraryType = librarySlot.getLibraryType();
......@@ -103,7 +103,7 @@ void castor::mediachanger::MediaChangerFacade::mountTapeReadWrite(
// dismountTape
//------------------------------------------------------------------------------
void castor::mediachanger::MediaChangerFacade::dismountTape(
const std::string &vid, const TapeLibrarySlot &librarySlot) {
const std::string &vid, const ConfigLibrarySlot &librarySlot) {
try {
const TapeLibraryType libraryType = librarySlot.getLibraryType();
......
......@@ -59,7 +59,7 @@ public:
* @param librarySlot The library slot containing the tape drive.
*/
void mountTapeReadOnly(const std::string &vid,
const TapeLibrarySlot &librarySlot);
const ConfigLibrarySlot &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 TapeLibrarySlot &librarySlot);
const ConfigLibrarySlot &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 TapeLibrarySlot &librarySlot);
const ConfigLibrarySlot &librarySlot);
private:
......
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 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 2
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#include "castor/mediachanger/MediaChangerFacade.hpp"
#include "castor/mediachanger/MediaChangerProxy.hpp"
#include "castor/mediachanger/TapeLibrarySlot.hpp"
#include <gtest/gtest.h>
#include <iostream>
#include <memory>
#include <sstream>
namespace unitTests {
/*
class castor_mediachanger_MediaChangerFacadeTest : public ::testing::Test {
protected:
struct MockMediaChangerProxy: public castor::mediachanger::MediaChangerProxy {
unsigned int nbTimesMountTapeReadOnlyCalled;
unsigned int nbTimesMountTapeReadWriteCalled;
unsigned int nbTimesDismountTapeCalled;
MockMediaChangerProxy():
nbTimesMountTapeReadOnlyCalled(0),
nbTimesMountTapeReadWriteCalled(0),
nbTimesDismountTapeCalled(0) {
}
void mountTapeReadOnly(const std::string &vid,
const castor::mediachanger::TapeLibrarySlot &librarySlot) {
nbTimesMountTapeReadOnlyCalled++;
}
void mountTapeReadWrite(const std::string &vid,
const castor::mediachanger::TapeLibrarySlot &librarySlot) {
nbTimesMountTapeReadWriteCalled++;
}
void dismountTape(const std::string &vid,
const castor::mediachanger::TapeLibrarySlot &librarySlot) {
nbTimesDismountTapeCalled++;
}
}; // struct MockMediaChangerProxy
MockMediaChangerProxy m_acs; // ACS
MockMediaChangerProxy m_mmc; // Manual
MockMediaChangerProxy m_rmc; // SCSI
const std::string m_vid;
const castor::mediachanger::TapeLibrarySlot m_acsSlot;
const castor::mediachanger::TapeLibrarySlot m_mmcSlot;
const castor::mediachanger::TapeLibrarySlot m_rmcSlot;
castor_mediachanger_MediaChangerFacadeTest():
m_vid("123456"),
m_acsSlot("acs1,2,3,4"),
m_mmcSlot("manual"),
m_rmcSlot("smc@rmc_host,1") {
}
virtual void SetUp() {
m_acs.nbTimesMountTapeReadOnlyCalled = 0;
m_acs.nbTimesMountTapeReadWriteCalled = 0;
m_acs.nbTimesDismountTapeCalled = 0;
m_mmc.nbTimesMountTapeReadOnlyCalled = 0;
m_mmc.nbTimesMountTapeReadWriteCalled = 0;
m_mmc.nbTimesDismountTapeCalled = 0;
m_rmc.nbTimesMountTapeReadOnlyCalled = 0;
m_rmc.nbTimesMountTapeReadWriteCalled = 0;
m_rmc.nbTimesDismountTapeCalled = 0;
}
virtual void TearDown() {
SetUp();
}
}; // class castor_mediachanger_MediaChangerFacadeTest
TEST_F(castor_mediachanger_MediaChangerFacadeTest, mountTapeReadOnlyAcs) {
using namespace castor::mediachanger;
MediaChangerFacade facade(m_acs, m_mmc, m_rmc);
facade.mountTapeReadOnly(m_vid, m_acsSlot);
ASSERT_EQ(1, m_acs.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_acs.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_acs.nbTimesDismountTapeCalled);
ASSERT_EQ(0, m_mmc.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_mmc.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_mmc.nbTimesDismountTapeCalled);
ASSERT_EQ(0, m_rmc.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_rmc.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_rmc.nbTimesDismountTapeCalled);
}
TEST_F(castor_mediachanger_MediaChangerFacadeTest, mountTapeReadOnlyMmc) {
using namespace castor::mediachanger;
MediaChangerFacade facade(m_acs, m_mmc, m_rmc);
facade.mountTapeReadOnly(m_vid, m_mmcSlot);
ASSERT_EQ(0, m_acs.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_acs.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_acs.nbTimesDismountTapeCalled);
ASSERT_EQ(1, m_mmc.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_mmc.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_mmc.nbTimesDismountTapeCalled);
ASSERT_EQ(0, m_rmc.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_rmc.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_rmc.nbTimesDismountTapeCalled);
}
TEST_F(castor_mediachanger_MediaChangerFacadeTest, mountTapeReadOnlyRmc) {
using namespace castor::mediachanger;
MediaChangerFacade facade(m_acs, m_mmc, m_rmc);
facade.mountTapeReadOnly(m_vid, m_rmcSlot);
ASSERT_EQ(0, m_acs.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_acs.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_acs.nbTimesDismountTapeCalled);
ASSERT_EQ(0, m_mmc.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_mmc.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_mmc.nbTimesDismountTapeCalled);
ASSERT_EQ(1, m_rmc.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_rmc.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_rmc.nbTimesDismountTapeCalled);
}
TEST_F(castor_mediachanger_MediaChangerFacadeTest, mountTapeReadWriteAcs) {
using namespace castor::mediachanger;
MediaChangerFacade facade(m_acs, m_mmc, m_rmc);
facade.mountTapeReadWrite(m_vid, m_acsSlot);
ASSERT_EQ(0, m_acs.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(1, m_acs.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_acs.nbTimesDismountTapeCalled);
ASSERT_EQ(0, m_mmc.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_mmc.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_mmc.nbTimesDismountTapeCalled);
ASSERT_EQ(0, m_rmc.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_rmc.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_rmc.nbTimesDismountTapeCalled);
}
TEST_F(castor_mediachanger_MediaChangerFacadeTest, mountTapeReadWriteMmc) {
using namespace castor::mediachanger;
MediaChangerFacade facade(m_acs, m_mmc, m_rmc);
facade.mountTapeReadWrite(m_vid, m_mmcSlot);
ASSERT_EQ(0, m_acs.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_acs.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_acs.nbTimesDismountTapeCalled);
ASSERT_EQ(0, m_mmc.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(1, m_mmc.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_mmc.nbTimesDismountTapeCalled);
ASSERT_EQ(0, m_rmc.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_rmc.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_rmc.nbTimesDismountTapeCalled);
}
TEST_F(castor_mediachanger_MediaChangerFacadeTest, mountTapeReadWriteRmc) {
using namespace castor::mediachanger;
MediaChangerFacade facade(m_acs, m_mmc, m_rmc);
facade.mountTapeReadWrite(m_vid, m_rmcSlot);
ASSERT_EQ(0, m_acs.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_acs.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_acs.nbTimesDismountTapeCalled);
ASSERT_EQ(0, m_mmc.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_mmc.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_mmc.nbTimesDismountTapeCalled);
ASSERT_EQ(0, m_rmc.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(1, m_rmc.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_rmc.nbTimesDismountTapeCalled);
}
TEST_F(castor_mediachanger_MediaChangerFacadeTest, dismountTapeAcs) {
using namespace castor::mediachanger;
MediaChangerFacade facade(m_acs, m_mmc, m_rmc);
facade.dismountTape(m_vid, m_acsSlot);
ASSERT_EQ(0, m_acs.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_acs.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(1, m_acs.nbTimesDismountTapeCalled);
ASSERT_EQ(0, m_mmc.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_mmc.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_mmc.nbTimesDismountTapeCalled);
ASSERT_EQ(0, m_rmc.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_rmc.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_rmc.nbTimesDismountTapeCalled);
}
TEST_F(castor_mediachanger_MediaChangerFacadeTest, dismountTapeMmc) {
using namespace castor::mediachanger;
MediaChangerFacade facade(m_acs, m_mmc, m_rmc);
facade.dismountTape(m_vid, m_mmcSlot);
ASSERT_EQ(0, m_acs.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_acs.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_acs.nbTimesDismountTapeCalled);
ASSERT_EQ(0, m_mmc.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_mmc.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(1, m_mmc.nbTimesDismountTapeCalled);
ASSERT_EQ(0, m_rmc.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_rmc.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_rmc.nbTimesDismountTapeCalled);
}
TEST_F(castor_mediachanger_MediaChangerFacadeTest, dismountTapeRmc) {
using namespace castor::mediachanger;
MediaChangerFacade facade(m_acs, m_mmc, m_rmc);
facade.dismountTape(m_vid, m_rmcSlot);
ASSERT_EQ(0, m_acs.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_acs.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_acs.nbTimesDismountTapeCalled);
ASSERT_EQ(0, m_mmc.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_mmc.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(0, m_mmc.nbTimesDismountTapeCalled);
ASSERT_EQ(0, m_rmc.nbTimesMountTapeReadOnlyCalled);
ASSERT_EQ(0, m_rmc.nbTimesMountTapeReadWriteCalled);
ASSERT_EQ(1, m_rmc.nbTimesDismountTapeCalled);
}
*/
} // namespace unitTests
......@@ -28,35 +28,3 @@
//------------------------------------------------------------------------------
castor::mediachanger::MediaChangerProxy::~MediaChangerProxy() {
}
//------------------------------------------------------------------------------
// verifyVidAndLibrarySlot
//------------------------------------------------------------------------------
void castor::mediachanger::MediaChangerProxy::verifyVidAndLibrarySlot(
const std::string &vid,
const mediachanger::TapeLibraryType expectedLibraryType,
const mediachanger::TapeLibrarySlot librarySlot) {
// Verify VID
if(vid.empty()) {
castor::exception::Exception ex;
ex.getMessage() << "VID is an empty string";
throw ex;
}
if(CA_MAXVIDLEN < vid.length()) {