Commit c8289901 authored by David COME's avatar David COME
Browse files

Removed the castor::tape::Exception class

parent 9744b1ea
/******************************************************************************
*
* 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 "Exception.hpp"
#include <gtest/gtest.h>
#include <gmock/gmock-cardinalities.h>
namespace unitTests {
}
......@@ -46,52 +46,52 @@ namespace castor {
Trailer
};
class TapeFormatError: public castor::tape::Exception {
class TapeFormatError: public castor::exception::Exception {
public:
TapeFormatError(const std::string & what): Exception(what) {}
};
class TapeMediaError: public castor::tape::Exception {
class TapeMediaError: public castor::exception::Exception {
public:
TapeMediaError(const std::string & what): Exception(what) {}
};
class EndOfFile: public castor::tape::Exception {
class EndOfFile: public castor::exception::Exception {
public:
EndOfFile(): Exception("End Of File reached") {}
};
class SessionAlreadyInUse: public castor::tape::Exception {
class SessionAlreadyInUse: public castor::exception::Exception {
public:
SessionAlreadyInUse(): Exception("Session already in use") {}
};
class SessionCorrupted: public castor::tape::Exception {
class SessionCorrupted: public castor::exception::Exception {
public:
SessionCorrupted(): Exception("Session corrupted") {}
};
class FileClosedTwice: public castor::tape::Exception {
class FileClosedTwice: public castor::exception::Exception {
public:
FileClosedTwice(): Exception("Trying to close a file twice") {}
};
class ZeroFileWritten: public castor::tape::Exception {
class ZeroFileWritten: public castor::exception::Exception {
public:
ZeroFileWritten(): Exception("Trying to write a file with size 0") {}
};
class TapeNotEmpty: public castor::tape::Exception {
class TapeNotEmpty: public castor::exception::Exception {
public:
TapeNotEmpty(): Exception("Trying to label a non-empty tape without the \"force\" setting") {}
};
class UnsupportedPositioningMode: public castor::tape::Exception {
class UnsupportedPositioningMode: public castor::exception::Exception {
public:
UnsupportedPositioningMode(): Exception("Trying to use an unsupported positioning mode") {}
};
class WrongBlockSize: public castor::tape::Exception {
class WrongBlockSize: public castor::exception::Exception {
public:
WrongBlockSize(): Exception("Trying to use a wrong block size") {}
};
......
......@@ -27,7 +27,7 @@
#include "castor/tape/tapeserver/drive/FakeDrive.hpp"
#include "castor/tape/tapeserver/file/File.hpp"
#include "castor/tape/tapeserver/file/DiskFile.hpp"
#include "castor/tape/tapeserver/exception/Exception.hpp"
#include "castor/exception/Exception.hpp"
#include "castor/exception/Errnum.hpp"
#include "castor/tape/tapeserver/client/ClientInterface.hpp"
#include <gtest/gtest.h>
......
......@@ -38,29 +38,29 @@ void tapeFile::VOL1::fill(std::string vsn) {
void tapeFile::VOL1::verify() {
if (cmpString(label, "VOL1"))
throw Exception(std::string("Failed verify for the VOL1: ") +
throw castor::exception::Exception(std::string("Failed verify for the VOL1: ") +
tapeFile::toString(label));
if (!cmpString(VSN, ""))
throw Exception(std::string("Failed verify for the VSN: ") +
throw castor::exception::Exception(std::string("Failed verify for the VSN: ") +
tapeFile::toString(VSN));
if (cmpString(lblStandard, "3"))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the label standard: ") +
tapeFile::toString(lblStandard));
if (cmpString(ownerID, "CASTOR") && cmpString(ownerID, "stage"))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the ownerID: ") +
tapeFile::toString(ownerID));
/* now we verify all other fields which must be spaces */
if (cmpString(accessibility, ""))
throw Exception("accessibility is not empty");
throw castor::exception::Exception("accessibility is not empty");
if (cmpString(reserved1, ""))
throw Exception("reserved1 is not empty");
throw castor::exception::Exception("reserved1 is not empty");
if (cmpString(implID, ""))
throw Exception("implID is not empty");
throw castor::exception::Exception("implID is not empty");
if (cmpString(reserved2, ""))
throw Exception("reserved2 is not empty");
throw castor::exception::Exception("reserved2 is not empty");
}
void tapeFile::HDR1EOF1::fillCommon(
......@@ -89,44 +89,44 @@ void tapeFile::HDR1EOF1::verifyCommon()
const {
if (!cmpString(fileId, ""))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the fileId: ") +
tapeFile::toString(fileId));
if (!cmpString(VSN, ""))
throw Exception(std::string("Failed verify for the VSN: ") +
throw castor::exception::Exception(std::string("Failed verify for the VSN: ") +
tapeFile::toString(VSN));
if (cmpString(fSec, "0001"))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the fSec: ") +
tapeFile::toString(fSec));
if (!cmpString(fSeq, ""))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the fSeq: ") +
tapeFile::toString(fSeq));
if (cmpString(genNum, "0001"))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the genNum: ") +
tapeFile::toString(genNum));
if (cmpString(verNumOfGen, "00"))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the verNumOfGen: ") +
tapeFile::toString(verNumOfGen));
if (!cmpString(creationDate, ""))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the creationDate: ") +
tapeFile::toString(creationDate));
if (!cmpString(expirationDate, ""))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the expirationDate: ") +
tapeFile::toString(expirationDate));
if (cmpString(accessibility, ""))
throw Exception("accessibility is not empty");
throw castor::exception::Exception("accessibility is not empty");
if (!cmpString(sysCode, ""))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the sysCode: ") +
tapeFile::toString(sysCode));
if (cmpString(reserved, ""))
throw Exception("reserved is not empty");
throw castor::exception::Exception("reserved is not empty");
}
void tapeFile::HDR1::fill(
......@@ -142,10 +142,10 @@ void tapeFile::HDR1::fill(
void tapeFile::HDR1::verify() const {
if (cmpString(label, "HDR1"))
throw Exception(std::string("Failed verify for the HDR1: ") +
throw castor::exception::Exception(std::string("Failed verify for the HDR1: ") +
tapeFile::toString(label));
if (cmpString(blockCount, "000000"))
throw Exception(std::string("Failed verify for the blockCount: ") +
throw castor::exception::Exception(std::string("Failed verify for the blockCount: ") +
tapeFile::toString(blockCount));
verifyCommon();
......@@ -162,14 +162,14 @@ void tapeFile::HDR1PRELABEL::verify()
const {
if (cmpString(label, "HDR1"))
throw Exception(std::string("Failed verify for the HDR1: ") +
throw castor::exception::Exception(std::string("Failed verify for the HDR1: ") +
tapeFile::toString(label));
if (cmpString(blockCount, "000000"))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the blockCount: ") +
tapeFile::toString(blockCount));
if (cmpString(fileId, "PRELABEL"))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the PRELABEL: ") +
tapeFile::toString(fileId));
......@@ -187,10 +187,10 @@ void tapeFile::EOF1::fill(
void tapeFile::EOF1::verify() const {
if (cmpString(label, "EOF1"))
throw Exception(std::string("Failed verify for the EOF1: ") +
throw castor::exception::Exception(std::string("Failed verify for the EOF1: ") +
tapeFile::toString(label));
if (!cmpString(blockCount, ""))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the blockCount: ") +
tapeFile::toString(blockCount));
......@@ -214,27 +214,27 @@ void tapeFile::HDR2EOF2::verifyCommon()
const {
if (cmpString(recordFormat, "F"))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the recordFormat: ") +
tapeFile::toString(recordFormat));
if (!cmpString(blockLength, ""))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the blockLength: ") +
tapeFile::toString(blockLength));
if (!cmpString(recordLength, ""))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the recordLength: ") +
tapeFile::toString(recordLength));
if (cmpString(aulId, "00"))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the aulId: ") +
tapeFile::toString(aulId));
if (cmpString(reserved1, ""))
throw Exception("reserved1 is not empty");
throw castor::exception::Exception("reserved1 is not empty");
if (cmpString(reserved2, ""))
throw castor::tape::Exception("reserved2 is not empty");
throw castor::exception::Exception("reserved2 is not empty");
if (cmpString(reserved3, ""))
throw castor::tape::Exception("reserved2 is not empty");
throw castor::exception::Exception("reserved2 is not empty");
}
void tapeFile::HDR2::fill(int _blockLength, bool driveHasCompression) {
......@@ -244,7 +244,7 @@ void tapeFile::HDR2::fill(int _blockLength, bool driveHasCompression) {
}
void tapeFile::HDR2::verify() const {
if (cmpString(label, "HDR2"))
throw Exception(std::string("Failed verify for the HDR2: ") +
throw castor::exception::Exception(std::string("Failed verify for the HDR2: ") +
tapeFile::toString(label));
verifyCommon();
......@@ -258,7 +258,7 @@ void tapeFile::EOF2::fill(int _blockLength, bool driveHasCompression) {
void tapeFile::EOF2::verify() const {
if (cmpString(label, "EOF2"))
throw Exception(std::string("Failed verify for the EOF2: ") +
throw castor::exception::Exception(std::string("Failed verify for the EOF2: ") +
tapeFile::toString(label));
verifyCommon();
......@@ -284,35 +284,35 @@ void tapeFile::UHL1UTL1::verifyCommon()
const {
if (!cmpString(actualfSeq, ""))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the actualfSeq: ") +
tapeFile::toString(actualfSeq));
if (!cmpString(actualBlockSize, ""))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the actualBlockSize: ") +
tapeFile::toString(actualBlockSize));
if (!cmpString(actualRecordLength, ""))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for the actualRecordLength: ") +
tapeFile::toString(actualRecordLength));
if (!cmpString(site, ""))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for site: ") +
tapeFile::toString(site));
if (!cmpString(moverHost, ""))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for moverHost: ") +
tapeFile::toString(moverHost));
if (!cmpString(driveVendor, ""))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for driveVendor: ") +
tapeFile::toString(driveVendor));
if (!cmpString(driveModel, ""))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for driveModel: ") +
tapeFile::toString(driveModel));
if (!cmpString(serialNumber, ""))
throw Exception(
throw castor::exception::Exception(
std::string("Failed verify for serialNumber: ") +
tapeFile::toString(serialNumber));
}
......@@ -330,7 +330,7 @@ void tapeFile::UHL1::fill(int fSeq,
void tapeFile::UHL1::verify() const {
if (cmpString(label, "UHL1"))
throw Exception(std::string("Failed verify for the UHL1: ") +
throw castor::exception::Exception(std::string("Failed verify for the UHL1: ") +
tapeFile::toString(label));
verifyCommon();
......@@ -349,7 +349,7 @@ void tapeFile::UTL1::fill(int fSeq,
void tapeFile::UTL1::verify() const {
if (cmpString(label, "UTL1"))
throw Exception(std::string("Failed verify for the UTL1: ") +
throw castor::exception::Exception(std::string("Failed verify for the UTL1: ") +
tapeFile::toString(label));
verifyCommon();
......
......@@ -22,7 +22,7 @@
*****************************************************************************/
#include "Regex.hpp"
#include "castor/tape/tapeserver/exception/Exception.hpp"
#include "castor/exception/Exception.hpp"
#include <regex.h>
using namespace castor::tape;
......@@ -37,7 +37,7 @@ utils::Regex::Regex(const char * re_str) : m_set(false) {
error += ": ";
error += re_err;
}
throw Exception(error);
throw castor::exception::Exception(error);
}
m_set = true;
}
......
......@@ -22,7 +22,7 @@
cmake_minimum_required (VERSION 2.6)
find_package( ZLIB REQUIRED )
# Try to find the four STK client libaries: libapi.so, libutl.so, libipc.so
# Try to find the four STK client libaries: libaExcpi.so, libutl.so, libipc.so
# and libcl.so
find_library (STK_API_LIB api PATHS /usr/lib64/CDK /usr/lib/CDK NO_DEFAULT_PATH)
if (STK_API_LIB)
......@@ -152,7 +152,6 @@ add_executable(castorUnitTests
../castor/tape/tapeserver/daemon/DiskWriteThreadPoolTest.cpp
../castor/tape/tapeserver/daemon/DiskWriteTaskTest.cpp
../castor/tape/tapeserver/drive/DriveTest.cpp
../castor/tape/tapeserver/exception/ExceptionTest.cpp
../castor/tape/tapeserver/file/StructuresTest.cpp
../castor/tape/tapeserver/file/FileTest.cpp
../castor/tape/tapeserver/SCSI/DeviceTest.cpp
......@@ -175,7 +174,6 @@ target_link_libraries(castorUnitTests
castorclient
castorlegacymsg
castortapeutils
Exception
SCSI
System
Utils
......@@ -217,7 +215,6 @@ add_executable(castorThreadedUnitTests
)
target_link_libraries(castorThreadedUnitTests
Exception
castorclient
castorcommon
castorlegacymsg
......@@ -252,7 +249,6 @@ add_executable(castorMultiprocessUnitTests
)
target_link_libraries(castorMultiprocessUnitTests
TapeDrive
Exception
SCSI
System
Utils File
......
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