Commit b265af99 authored by Eric Cano's avatar Eric Cano
Browse files

Moved the tape server's classes into castor::tape.

parent 53260ec4
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
int main(int argc, char ** argv) { int main(int argc, char ** argv) {
try { try {
Tape::Server::Daemon daemon(argc, argv); castor::tape::Server::Daemon daemon(argc, argv);
} catch (std::exception & e) { } catch (std::exception & e) {
std::cerr << "Uncaught standard exception in tapeserverd:" << std::endl std::cerr << "Uncaught standard exception in tapeserverd:" << std::endl
<< e.what() << std::endl; << e.what() << std::endl;
...@@ -46,13 +46,13 @@ int main(int argc, char ** argv) { ...@@ -46,13 +46,13 @@ int main(int argc, char ** argv) {
} }
} }
Tape::Server::Daemon::Daemon(int argc, char** argv) throw (Tape::Exception) { castor::tape::Server::Daemon::Daemon(int argc, char** argv) throw (castor::tape::Exception) {
m_options = getCommandLineOptions(argc, argv); m_options = getCommandLineOptions(argc, argv);
if (m_options.daemonize) daemonize(); if (m_options.daemonize) daemonize();
} }
Tape::Server::Daemon::options Tape::Server::Daemon::getCommandLineOptions(int argc, char** argv) castor::tape::Server::Daemon::options castor::tape::Server::Daemon::getCommandLineOptions(int argc, char** argv)
throw (Tape::Exception) throw (castor::tape::Exception)
{ {
options ret; options ret;
/* Expect -f or --foreground */ /* Expect -f or --foreground */
...@@ -68,14 +68,14 @@ throw (Tape::Exception) ...@@ -68,14 +68,14 @@ throw (Tape::Exception)
break; break;
case ':': case ':':
{ {
Tape::Exceptions::InvalidArgument ex(std::string("The -") + (char) optopt + " option requires a parameter"); castor::tape::Exceptions::InvalidArgument ex(std::string("The -") + (char) optopt + " option requires a parameter");
throw ex; throw ex;
} }
case '?': case '?':
{ {
std::stringstream err("Unknown command-line option"); std::stringstream err("Unknown command-line option");
if (optopt) err << std::string(": -") << optopt; if (optopt) err << std::string(": -") << optopt;
Tape::Exceptions::InvalidArgument ex(err.str().c_str()); castor::tape::Exceptions::InvalidArgument ex(err.str().c_str());
throw ex; throw ex;
} }
default: default:
...@@ -83,7 +83,7 @@ throw (Tape::Exception) ...@@ -83,7 +83,7 @@ throw (Tape::Exception)
std::stringstream err; std::stringstream err;
err << "getopt_long returned the following unknown value: 0x" << err << "getopt_long returned the following unknown value: 0x" <<
std::hex << (int) c; std::hex << (int) c;
Tape::Exceptions::InvalidArgument ex(err.str().c_str()); castor::tape::Exceptions::InvalidArgument ex(err.str().c_str());
throw ex; throw ex;
} }
} }
...@@ -91,7 +91,7 @@ throw (Tape::Exception) ...@@ -91,7 +91,7 @@ throw (Tape::Exception)
return ret; return ret;
} }
void Tape::Server::Daemon::daemonize() void castor::tape::Server::Daemon::daemonize()
{ {
pid_t pid, sid; pid_t pid, sid;
...@@ -101,7 +101,7 @@ void Tape::Server::Daemon::daemonize() ...@@ -101,7 +101,7 @@ void Tape::Server::Daemon::daemonize()
/* Fork off the parent process */ /* Fork off the parent process */
pid = fork(); pid = fork();
if (pid < 0) { if (pid < 0) {
Tape::Exceptions::Errnum e("Failed to fork in Tape::Server::Daemon::daemonize"); castor::tape::Exceptions::Errnum e("Failed to fork in castor::tape::Server::Daemon::daemonize");
throw e; throw e;
} }
/* If we got a good PID, then we can exit the parent process. */ /* If we got a good PID, then we can exit the parent process. */
...@@ -115,22 +115,22 @@ void Tape::Server::Daemon::daemonize() ...@@ -115,22 +115,22 @@ void Tape::Server::Daemon::daemonize()
/* Create a new session for the child process */ /* Create a new session for the child process */
sid = setsid(); sid = setsid();
if (sid < 0) { if (sid < 0) {
Tape::Exceptions::Errnum e("Failed to create new session in Tape::Server::Daemon::daemonize"); castor::tape::Exceptions::Errnum e("Failed to create new session in castor::tape::Server::Daemon::daemonize");
throw e; throw e;
} }
/* At this point we are executing as the child process, and parent process should be init */ /* At this point we are executing as the child process, and parent process should be init */
if (getppid() != 1) { if (getppid() != 1) {
Tape::Exception e("Failed to detach from parent process in Tape::Server::Daemon::daemonize"); castor::tape::Exception e("Failed to detach from parent process in castor::tape::Server::Daemon::daemonize");
throw e; throw e;
} }
/* Change the current working directory. This prevents the current /* Change the current working directory. This prevents the current
directory from being locked; hence not being able to remove it. */ directory from being locked; hence not being able to remove it. */
if ((chdir(m_options.runDirectory.c_str())) < 0) { if ((chdir(m_options.runDirectory.c_str())) < 0) {
std::stringstream err("Failed to chdir in Tape::Server::Daemon::daemonize"); std::stringstream err("Failed to chdir in castor::tape::Server::Daemon::daemonize");
err << " ( destination directory: " << m_options.runDirectory << ")"; err << " ( destination directory: " << m_options.runDirectory << ")";
Tape::Exceptions::Errnum e(err.str()); castor::tape::Exceptions::Errnum e(err.str());
throw e; throw e;
} }
......
...@@ -25,11 +25,12 @@ ...@@ -25,11 +25,12 @@
#pragma once #pragma once
#include "../Exception/Exception.hpp" #include "../Exception/Exception.hpp"
namespace Tape { namespace castor {
namespace tape {
namespace Server { namespace Server {
class Daemon { class Daemon {
public: public:
Daemon (int argc, char ** argv) throw (Tape::Exception); Daemon (int argc, char ** argv) throw (castor::tape::Exception);
class options { class options {
public: public:
options(): daemonize(true), runDirectory("/var/log/castor") {} options(): daemonize(true), runDirectory("/var/log/castor") {}
...@@ -37,9 +38,10 @@ namespace Tape { ...@@ -37,9 +38,10 @@ namespace Tape {
std::string runDirectory; std::string runDirectory;
}; };
private: private:
options getCommandLineOptions(int argc, char ** argv) throw (Tape::Exception); options getCommandLineOptions(int argc, char ** argv) throw (castor::tape::Exception);
void daemonize(); void daemonize();
options m_options; options m_options;
}; };
} }
} }
}
*.aux
*.idx
*.out
*.toc
*converted-to.pdf
*.synctex.gz
*.log
...@@ -229,7 +229,9 @@ The SCSI commands can be found in the SCSI section of Hackipedia.org ...@@ -229,7 +229,9 @@ The SCSI commands can be found in the SCSI section of Hackipedia.org
{http://hackipedia.org/Hardware/SCSI/Stream\%20Commands/SCSI\%20Stream\%20Commands\%20-\%203.pdf} }) {http://hackipedia.org/Hardware/SCSI/Stream\%20Commands/SCSI\%20Stream\%20Commands\%20-\%203.pdf} })
and the SCSI primary commands (SPC-4 and the SCSI primary commands (SPC-4
\footnote{ \href{http://hackipedia.org/Hardware/SCSI/Primary\%20Commands/SCSI\%20Primary\%20Commands\%20-\%204.pdf} \footnote{ \href{http://hackipedia.org/Hardware/SCSI/Primary\%20Commands/SCSI\%20Primary\%20Commands\%20-\%204.pdf}
{http://hackipedia.org/Hardware/SCSI/Primary\%20Commands/SCSI\%20Primary\%20Commands\%20-\%204.pdf} }). {http://hackipedia.org/Hardware/SCSI/Primary\%20Commands/SCSI\%20Primary\%20Commands\%20-\%204.pdf} }
\footnote{ Latest drafts can be downloaded from \href{http://www.t10.org/members/w_spc4.htm}
{http://www.t10.org/members/w_spc4.htm} } ).
\subsubsection{Manufacturer's specificities} \subsubsection{Manufacturer's specificities}
\label{Manufacturer's specificities} \label{Manufacturer's specificities}
......
This diff is collapsed.
...@@ -36,7 +36,9 @@ ...@@ -36,7 +36,9 @@
* Class wrapping the tape server. Has to be templated (and hence fully in .hh) * Class wrapping the tape server. Has to be templated (and hence fully in .hh)
* to allow unit testing against system wrapper. * to allow unit testing against system wrapper.
*/ */
namespace Tape { namespace castor {
namespace tape {
namespace drives {
/** /**
* Compressions statistics container, returned by Drive::getCompression() * Compressions statistics container, returned by Drive::getCompression()
...@@ -320,7 +322,7 @@ namespace Tape { ...@@ -320,7 +322,7 @@ namespace Tape {
protected: protected:
SCSI::DeviceInfo m_SCSIInfo; SCSI::DeviceInfo m_SCSIInfo;
int m_tapeFD; int m_tapeFD;
Tape::System::virtualWrapper & m_sysWrapper; castor::tape::System::virtualWrapper & m_sysWrapper;
struct mtget m_mtInfo; struct mtget m_mtInfo;
private: private:
/** /**
...@@ -370,7 +372,7 @@ namespace Tape { ...@@ -370,7 +372,7 @@ namespace Tape {
} else if (di.product.find("03592")) { } else if (di.product.find("03592")) {
m_drive = new DriveIBM3592(di, sw); m_drive = new DriveIBM3592(di, sw);
} else { } else {
throw Tape::Exception(std::string("Unsupported drive type: ")+di.product); throw Exception(std::string("Unsupported drive type: ")+di.product);
} }
} }
~Drive() { ~Drive() {
...@@ -383,4 +385,6 @@ namespace Tape { ...@@ -383,4 +385,6 @@ namespace Tape {
DriveGeneric * m_drive; DriveGeneric * m_drive;
}; };
} } // namespace drives
} // namespace tape
} // namespace castor
...@@ -37,7 +37,7 @@ namespace UnitTests { ...@@ -37,7 +37,7 @@ namespace UnitTests {
TEST(TapeDrive, OpensCorrectly) { TEST(TapeDrive, OpensCorrectly) {
/* Prepare the test harness */ /* Prepare the test harness */
Tape::System::mockWrapper sysWrapper; castor::tape::System::mockWrapper sysWrapper;
sysWrapper.fake.setupSLC5(); sysWrapper.fake.setupSLC5();
sysWrapper.delegateToFake(); sysWrapper.delegateToFake();
...@@ -55,18 +55,18 @@ TEST(TapeDrive, OpensCorrectly) { ...@@ -55,18 +55,18 @@ TEST(TapeDrive, OpensCorrectly) {
EXPECT_CALL(sysWrapper, stat(_,_)).Times(7); EXPECT_CALL(sysWrapper, stat(_,_)).Times(7);
/* Test: detect devices, then open the device files */ /* Test: detect devices, then open the device files */
SCSI::DeviceVector dl(sysWrapper); castor::tape::SCSI::DeviceVector dl(sysWrapper);
for (std::vector<SCSI::DeviceInfo>::iterator i = dl.begin(); for (std::vector<castor::tape::SCSI::DeviceInfo>::iterator i = dl.begin();
i != dl.end(); i++) { i != dl.end(); i++) {
if (SCSI::Types::tape == i->type) { if (castor::tape::SCSI::Types::tape == i->type) {
Tape::Drive drive(*i, sysWrapper); castor::tape::drives::Drive drive(*i, sysWrapper);
} }
} }
} }
TEST(TapeDrive, getPositionInfoAndPositionToLogicalObject) { TEST(TapeDrive, getPositionInfoAndPositionToLogicalObject) {
/* Prepare the test harness */ /* Prepare the test harness */
Tape::System::mockWrapper sysWrapper; castor::tape::System::mockWrapper sysWrapper;
sysWrapper.fake.setupSLC5(); sysWrapper.fake.setupSLC5();
sysWrapper.delegateToFake(); sysWrapper.delegateToFake();
...@@ -84,15 +84,15 @@ TEST(TapeDrive, getPositionInfoAndPositionToLogicalObject) { ...@@ -84,15 +84,15 @@ TEST(TapeDrive, getPositionInfoAndPositionToLogicalObject) {
EXPECT_CALL(sysWrapper, stat(_,_)).Times(7); EXPECT_CALL(sysWrapper, stat(_,_)).Times(7);
/* Test: detect devices, then open the device files */ /* Test: detect devices, then open the device files */
SCSI::DeviceVector dl(sysWrapper); castor::tape::SCSI::DeviceVector dl(sysWrapper);
for (std::vector<SCSI::DeviceInfo>::iterator i = dl.begin(); for (std::vector<castor::tape::SCSI::DeviceInfo>::iterator i = dl.begin();
i != dl.end(); i++) { i != dl.end(); i++) {
if (SCSI::Types::tape == i->type) { if (castor::tape::SCSI::Types::tape == i->type) {
Tape::Drive dContainer(*i, sysWrapper); castor::tape::drives::Drive dContainer(*i, sysWrapper);
/* Compiler cannot implicitly use the conversion operator. Create an /* Compiler cannot implicitly use the conversion operator. Create an
* intermediate reference*/ * intermediate reference*/
Tape::DriveGeneric & drive = dContainer; castor::tape::drives::DriveGeneric & drive = dContainer;
Tape::positionInfo posInfo; castor::tape::drives::positionInfo posInfo;
EXPECT_CALL(sysWrapper, ioctl(_,_,An<sg_io_hdr_t*>())).Times(1); EXPECT_CALL(sysWrapper, ioctl(_,_,An<sg_io_hdr_t*>())).Times(1);
posInfo = drive.getPositionInfo(); posInfo = drive.getPositionInfo();
...@@ -117,7 +117,7 @@ TEST(TapeDrive, getPositionInfoAndPositionToLogicalObject) { ...@@ -117,7 +117,7 @@ TEST(TapeDrive, getPositionInfoAndPositionToLogicalObject) {
} }
TEST(TapeDrive, setDensityAndCompression) { TEST(TapeDrive, setDensityAndCompression) {
/* Prepare the test harness */ /* Prepare the test harness */
Tape::System::mockWrapper sysWrapper; castor::tape::System::mockWrapper sysWrapper;
sysWrapper.fake.setupSLC5(); sysWrapper.fake.setupSLC5();
sysWrapper.delegateToFake(); sysWrapper.delegateToFake();
...@@ -135,14 +135,14 @@ TEST(TapeDrive, setDensityAndCompression) { ...@@ -135,14 +135,14 @@ TEST(TapeDrive, setDensityAndCompression) {
EXPECT_CALL(sysWrapper, stat(_,_)).Times(7); EXPECT_CALL(sysWrapper, stat(_,_)).Times(7);
/* Test: detect devices, then open the device files */ /* Test: detect devices, then open the device files */
SCSI::DeviceVector dl(sysWrapper); castor::tape::SCSI::DeviceVector dl(sysWrapper);
for (std::vector<SCSI::DeviceInfo>::iterator i = dl.begin(); for (std::vector<castor::tape::SCSI::DeviceInfo>::iterator i = dl.begin();
i != dl.end(); i++) { i != dl.end(); i++) {
if (SCSI::Types::tape == i->type) { if (castor::tape::SCSI::Types::tape == i->type) {
Tape::Drive dContainer(*i, sysWrapper); castor::tape::drives::Drive dContainer(*i, sysWrapper);
/* Compiler cannot implicitly use the conversion operator. Create an /* Compiler cannot implicitly use the conversion operator. Create an
* intermediate reference*/ * intermediate reference*/
Tape::DriveGeneric & drive = dContainer; castor::tape::drives::DriveGeneric & drive = dContainer;
EXPECT_CALL(sysWrapper, ioctl(_,_,An<sg_io_hdr_t*>())).Times(2); EXPECT_CALL(sysWrapper, ioctl(_,_,An<sg_io_hdr_t*>())).Times(2);
drive.setDensityAndCompression(); drive.setDensityAndCompression();
...@@ -164,7 +164,7 @@ TEST(TapeDrive, setDensityAndCompression) { ...@@ -164,7 +164,7 @@ TEST(TapeDrive, setDensityAndCompression) {
TEST(TapeDrive, setStDriverOptions) { TEST(TapeDrive, setStDriverOptions) {
/* Prepare the test harness */ /* Prepare the test harness */
Tape::System::mockWrapper sysWrapper; castor::tape::System::mockWrapper sysWrapper;
sysWrapper.fake.setupSLC5(); sysWrapper.fake.setupSLC5();
sysWrapper.delegateToFake(); sysWrapper.delegateToFake();
...@@ -182,13 +182,13 @@ TEST(TapeDrive, setStDriverOptions) { ...@@ -182,13 +182,13 @@ TEST(TapeDrive, setStDriverOptions) {
EXPECT_CALL(sysWrapper, stat(_,_)).Times(7); EXPECT_CALL(sysWrapper, stat(_,_)).Times(7);
/* Test: detect devices, then open the device files */ /* Test: detect devices, then open the device files */
SCSI::DeviceVector dl(sysWrapper); castor::tape::SCSI::DeviceVector dl(sysWrapper);
for (std::vector<SCSI::DeviceInfo>::iterator i = dl.begin(); i != dl.end(); i++) { for (std::vector<castor::tape::SCSI::DeviceInfo>::iterator i = dl.begin(); i != dl.end(); i++) {
if (SCSI::Types::tape == i->type) { if (castor::tape::SCSI::Types::tape == i->type) {
Tape::Drive dContainer(*i, sysWrapper); castor::tape::drives::Drive dContainer(*i, sysWrapper);
/* Compiler cannot implicitly use the conversion operator. Create an /* Compiler cannot implicitly use the conversion operator. Create an
* intermediate reference*/ * intermediate reference*/
Tape::DriveGeneric & drive = dContainer; castor::tape::drives::DriveGeneric & drive = dContainer;
EXPECT_CALL(sysWrapper, ioctl(_,_,An<struct mtop *>())).Times(1); EXPECT_CALL(sysWrapper, ioctl(_,_,An<struct mtop *>())).Times(1);
drive.setSTBufferWrite(true); drive.setSTBufferWrite(true);
...@@ -201,7 +201,7 @@ TEST(TapeDrive, setStDriverOptions) { ...@@ -201,7 +201,7 @@ TEST(TapeDrive, setStDriverOptions) {
TEST(TapeDrive, getDeviceInfo) { TEST(TapeDrive, getDeviceInfo) {
/* Prepare the test harness */ /* Prepare the test harness */
Tape::System::mockWrapper sysWrapper; castor::tape::System::mockWrapper sysWrapper;
sysWrapper.fake.setupSLC5(); sysWrapper.fake.setupSLC5();
sysWrapper.delegateToFake(); sysWrapper.delegateToFake();
...@@ -219,15 +219,15 @@ TEST(TapeDrive, getDeviceInfo) { ...@@ -219,15 +219,15 @@ TEST(TapeDrive, getDeviceInfo) {
EXPECT_CALL(sysWrapper, stat(_,_)).Times(7); EXPECT_CALL(sysWrapper, stat(_,_)).Times(7);
/* Test: detect devices, then open the device files */ /* Test: detect devices, then open the device files */
SCSI::DeviceVector dl(sysWrapper); castor::tape::SCSI::DeviceVector dl(sysWrapper);
for (std::vector<SCSI::DeviceInfo>::iterator i = dl.begin(); for (std::vector<castor::tape::SCSI::DeviceInfo>::iterator i = dl.begin();
i != dl.end(); i++) { i != dl.end(); i++) {
if (SCSI::Types::tape == i->type) { if (castor::tape::SCSI::Types::tape == i->type) {
Tape::Drive dContainer(*i, sysWrapper); castor::tape::drives::Drive dContainer(*i, sysWrapper);
/* Compiler cannot implicitly use the conversion operator. Create an /* Compiler cannot implicitly use the conversion operator. Create an
* intermediate reference*/ * intermediate reference*/
Tape::DriveGeneric & drive = dContainer; castor::tape::drives::DriveGeneric & drive = dContainer;
Tape::deviceInfo devInfo; castor::tape::drives::deviceInfo devInfo;
EXPECT_CALL(sysWrapper, ioctl(_,_,An<sg_io_hdr_t*>())).Times(2); EXPECT_CALL(sysWrapper, ioctl(_,_,An<sg_io_hdr_t*>())).Times(2);
devInfo = drive.getDeviceInfo(); devInfo = drive.getDeviceInfo();
...@@ -242,7 +242,7 @@ TEST(TapeDrive, getDeviceInfo) { ...@@ -242,7 +242,7 @@ TEST(TapeDrive, getDeviceInfo) {
TEST(TapeDrive, getCompressionAndClearCompressionStats) { TEST(TapeDrive, getCompressionAndClearCompressionStats) {
/* Prepare the test harness */ /* Prepare the test harness */
Tape::System::mockWrapper sysWrapper; castor::tape::System::mockWrapper sysWrapper;
sysWrapper.fake.setupSLC5(); sysWrapper.fake.setupSLC5();
sysWrapper.delegateToFake(); sysWrapper.delegateToFake();
...@@ -260,15 +260,15 @@ TEST(TapeDrive, getCompressionAndClearCompressionStats) { ...@@ -260,15 +260,15 @@ TEST(TapeDrive, getCompressionAndClearCompressionStats) {
EXPECT_CALL(sysWrapper, stat(_,_)).Times(7); EXPECT_CALL(sysWrapper, stat(_,_)).Times(7);
/* Test: detect devices, then open the device files */ /* Test: detect devices, then open the device files */
SCSI::DeviceVector dl(sysWrapper); castor::tape::SCSI::DeviceVector dl(sysWrapper);
for (std::vector<SCSI::DeviceInfo>::iterator i = dl.begin(); for (std::vector<castor::tape::SCSI::DeviceInfo>::iterator i = dl.begin();
i != dl.end(); i++) { i != dl.end(); i++) {
if (SCSI::Types::tape == i->type) { if (castor::tape::SCSI::Types::tape == i->type) {
Tape::DriveGeneric *drive; castor::tape::drives::DriveGeneric *drive;
Tape::compressionStats comp; castor::tape::drives::compressionStats comp;
{ {
drive = new Tape::DriveT10000(*i, sysWrapper); drive = new castor::tape::drives::DriveT10000(*i, sysWrapper);
EXPECT_CALL(sysWrapper, ioctl(_, _, An<sg_io_hdr_t*>())).Times(1); EXPECT_CALL(sysWrapper, ioctl(_, _, An<sg_io_hdr_t*>())).Times(1);
comp = drive->getCompression(); comp = drive->getCompression();
...@@ -290,7 +290,7 @@ TEST(TapeDrive, getCompressionAndClearCompressionStats) { ...@@ -290,7 +290,7 @@ TEST(TapeDrive, getCompressionAndClearCompressionStats) {
delete drive; delete drive;
} }
{ {
drive = new Tape::DriveIBM3592(*i, sysWrapper); drive = new castor::tape::drives::DriveIBM3592(*i, sysWrapper);
EXPECT_CALL(sysWrapper, ioctl(_, _, An<sg_io_hdr_t*>())).Times(1); EXPECT_CALL(sysWrapper, ioctl(_, _, An<sg_io_hdr_t*>())).Times(1);
comp = drive->getCompression(); comp = drive->getCompression();
...@@ -312,7 +312,7 @@ TEST(TapeDrive, getCompressionAndClearCompressionStats) { ...@@ -312,7 +312,7 @@ TEST(TapeDrive, getCompressionAndClearCompressionStats) {
delete drive; delete drive;
} }
{ {
drive = new Tape::DriveLTO(*i, sysWrapper); drive = new castor::tape::drives::DriveLTO(*i, sysWrapper);
EXPECT_CALL(sysWrapper, ioctl(_, _, An<sg_io_hdr_t*>())).Times(1); EXPECT_CALL(sysWrapper, ioctl(_, _, An<sg_io_hdr_t*>())).Times(1);
comp = drive->getCompression(); comp = drive->getCompression();
...@@ -344,7 +344,7 @@ TEST(TapeDrive, getTapeAlerts) { ...@@ -344,7 +344,7 @@ TEST(TapeDrive, getTapeAlerts) {
* SLC6). * SLC6).
*/ */
struct { struct {
void operator() (Tape::System::mockWrapper & sysWrapper) { void operator() (castor::tape::System::mockWrapper & sysWrapper) {
/* We expect the following calls: */ /* We expect the following calls: */
EXPECT_CALL(sysWrapper, opendir(_)).Times(AtLeast(3)); EXPECT_CALL(sysWrapper, opendir(_)).Times(AtLeast(3));
EXPECT_CALL(sysWrapper, readdir(_)).Times(AtLeast(30)); EXPECT_CALL(sysWrapper, readdir(_)).Times(AtLeast(30));
...@@ -359,14 +359,14 @@ TEST(TapeDrive, getTapeAlerts) { ...@@ -359,14 +359,14 @@ TEST(TapeDrive, getTapeAlerts) {
EXPECT_CALL(sysWrapper, stat(_, _)).Times(AtLeast(7)); EXPECT_CALL(sysWrapper, stat(_, _)).Times(AtLeast(7));
/* Test: detect devices, then open the device files */ /* Test: detect devices, then open the device files */
SCSI::DeviceVector dl(sysWrapper); castor::tape::SCSI::DeviceVector dl(sysWrapper);
for (std::vector<SCSI::DeviceInfo>::iterator i = dl.begin(); for (std::vector<castor::tape::SCSI::DeviceInfo>::iterator i = dl.begin();
i != dl.end(); i++) { i != dl.end(); i++) {
if (SCSI::Types::tape == i->type) { if (castor::tape::SCSI::Types::tape == i->type) {
Tape::Drive dContainer(*i, sysWrapper); castor::tape::drives::Drive dContainer(*i, sysWrapper);
/* Compiler cannot implicitly use the conversion operator. Create an /* Compiler cannot implicitly use the conversion operator. Create an
* intermediate reference*/ * intermediate reference*/
Tape::DriveGeneric & drive = dContainer; castor::tape::drives::DriveGeneric & drive = dContainer;
EXPECT_CALL(sysWrapper, ioctl(_, _, An<sg_io_hdr_t*>())).Times(1); EXPECT_CALL(sysWrapper, ioctl(_, _, An<sg_io_hdr_t*>())).Times(1);
std::vector<std::string> alerts = drive.getTapeAlerts(); std::vector<std::string> alerts = drive.getTapeAlerts();
ASSERT_EQ(3U, alerts.size()); ASSERT_EQ(3U, alerts.size());
...@@ -384,8 +384,8 @@ TEST(TapeDrive, getTapeAlerts) { ...@@ -384,8 +384,8 @@ TEST(TapeDrive, getTapeAlerts) {
/* Prepare the test harness */ /* Prepare the test harness */
Tape::System::mockWrapper sysWrapperSLC5; castor::tape::System::mockWrapper sysWrapperSLC5;
Tape::System::mockWrapper sysWrapperSLC6; castor::tape::System::mockWrapper sysWrapperSLC6;
sysWrapperSLC5.fake.setupSLC5(); sysWrapperSLC5.fake.setupSLC5();
sysWrapperSLC6.fake.setupSLC6(); sysWrapperSLC6.fake.setupSLC6();
sysWrapperSLC5.delegateToFake(); sysWrapperSLC5.delegateToFake();
......