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

Reorganized the files in themes.

middletier, itself separated in interface, SQLite, objectstore and
shared tests.
Moved all utilities (exceptions, threading...) to a shared utility
directory.
Created a single, shared unit test from all the scattered ones.
parent b3765ce7
......@@ -29,10 +29,12 @@ set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
add_subdirectory(exception)
include_directories(${PROJECT_SOURCE_DIR})
add_subdirectory(utils)
add_subdirectory(middletier)
add_subdirectory(objectstore)
add_subdirectory(objectstore_middletier)
add_subdirectory(namespace)
add_subdirectory(tests)
add_subdirectory(xroot_clients)
add_subdirectory(xroot_plugins)
......@@ -4,78 +4,84 @@ find_package (sqlite REQUIRED)
include_directories (${SQLITE3_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${PROJECT_SOURCE_DIR})
set (MIDDLE_TIER_LIB_SRC_FILES
cta/AdminHost.cpp
cta/AdminUser.cpp
cta/ArchivalFileTransfer.cpp
cta/ArchivalJob.cpp
cta/ArchivalJobQueues.cpp
cta/ArchivalJobState.cpp
cta/ArchivalMount.cpp
cta/ArchivalRequest.cpp
cta/ArchivalRoute.cpp
cta/ArchivalRouteId.cpp
cta/ArchiveToDirRequest.cpp
cta/ArchiveToFileRequest.cpp
cta/ConfigurationItem.cpp
cta/DirEntry.cpp
cta/DirIterator.cpp
cta/DiskException.cpp
cta/DriveQuota.cpp
cta/EosRemoteStorage.cpp
cta/Exception.cpp
cta/FileAttribute.cpp
cta/FileSystemDirEntry.cpp
cta/FileSystemNode.cpp
cta/FileSystemStorageClass.cpp
cta/FileSystemStorageClasses.cpp
cta/FileTransfer.cpp
cta/LogicalLibrary.cpp
cta/MiddleTierAdmin.cpp
cta/MiddleTierUser.cpp
cta/MockNameServer.cpp
cta/Mount.cpp
cta/MountCriteria.cpp
cta/NameServer.cpp
cta/RemoteStorage.cpp
cta/RetrievalFileTransfer.cpp
cta/RetrievalJob.cpp
cta/RetrievalJobQueues.cpp
cta/RetrievalJobState.cpp
cta/RetrievalMount.cpp
cta/RetrievalRequest.cpp
cta/RetrieveToDirRequest.cpp
cta/RetrieveToFileRequest.cpp
cta/SecurityIdentity.cpp
cta/SqliteColumnNameToIndex.cpp
cta/SqliteDatabase.cpp
cta/SqliteMiddleTierAdmin.cpp
cta/SqliteMiddleTierUser.cpp
cta/StorageClass.cpp
cta/Tape.cpp
cta/TapeException.cpp
cta/TapeFileLocation.cpp
cta/TapePool.cpp
cta/UserIdentity.cpp
cta/UserGroup.cpp
cta/UserRequest.cpp
cta/Utils.cpp
cta/Vfs.cpp
cta/VO.cpp)
set (MIDDLE_TIER_INTERFACE_SRC_FILES
interface/AdminHost.cpp
interface/AdminUser.cpp
interface/ArchivalFileTransfer.cpp
interface/ArchivalJob.cpp
interface/ArchivalJobQueues.cpp
interface/ArchivalJobState.cpp
interface/ArchivalMount.cpp
interface/ArchivalRequest.cpp
interface/ArchivalRoute.cpp
interface/ArchivalRouteId.cpp
interface/ArchiveToDirRequest.cpp
interface/ArchiveToFileRequest.cpp
interface/ConfigurationItem.cpp
interface/DirEntry.cpp
interface/DirIterator.cpp
interface/DiskException.cpp
interface/DriveQuota.cpp
interface/EosRemoteStorage.cpp
interface/FileAttribute.cpp
interface/FileSystemDirEntry.cpp
interface/FileSystemNode.cpp
interface/FileSystemStorageClass.cpp
interface/FileSystemStorageClasses.cpp
interface/FileTransfer.cpp
interface/LogicalLibrary.cpp
interface/MiddleTierAdmin.cpp
interface/MiddleTierUser.cpp
interface/MockNameServer.cpp
interface/Mount.cpp
interface/MountCriteria.cpp
interface/NameServer.cpp
interface/RemoteStorage.cpp
interface/RetrievalFileTransfer.cpp
interface/RetrievalJob.cpp
interface/RetrievalJobQueues.cpp
interface/RetrievalJobState.cpp
interface/RetrievalMount.cpp
interface/RetrievalRequest.cpp
interface/RetrieveToDirRequest.cpp
interface/RetrieveToFileRequest.cpp
interface/SecurityIdentity.cpp
interface/StorageClass.cpp
interface/Tape.cpp
interface/TapeException.cpp
interface/TapeFileLocation.cpp
interface/TapePool.cpp
interface/UserIdentity.cpp
interface/UserGroup.cpp
interface/UserRequest.cpp
interface/VO.cpp)
add_library (ctamiddletier SHARED
${MIDDLE_TIER_LIB_SRC_FILES})
${MIDDLE_TIER_INTERFACE_SRC_FILES})
target_link_libraries (ctamiddletier ${SQLITE3_LIBRARY_RELEASE}
CTAException)
#target_link_libraries (ctamiddletier ${SQLITE3_LIBRARY_RELEASE}
# CTAException)
set (MIDDLE_TIER_UNIT_TESTS_LIB_SRC_FILES
cta/SqliteMiddleTierAdminTest.cpp
cta/SqliteMiddleTierUserTest.cpp
cta/UtilsTest.cpp
cta/MockNameServerTest.cpp)
set (MIDDLE_TIER_INTERFACE_UNIT_TESTS_LIB_SRC_FILES
# cta/SqliteMiddleTierAdminTest.cpp
# cta/SqliteMiddleTierUserTest.cpp
# cta/UtilsTest.cpp
interface/MockNameServerTest.cpp
sharedtest/MiddleTierAdminAbstractTest.cpp
sharedtest/MiddleTierUserAbstractTest.cpp)
add_library (ctamiddletierunittests SHARED
${MIDDLE_TIER_UNIT_TESTS_LIB_SRC_FILES})
${MIDDLE_TIER_INTERFACE_UNIT_TESTS_LIB_SRC_FILES})
target_link_libraries (ctamiddletierunittests ${SQLITE3_LIBRARY_RELEASE})
#target_link_libraries (ctamiddletierunittests ${SQLITE3_LIBRARY_RELEASE})
add_library (ctamiddletiersqlite SHARED
SQLite/SqliteColumnNameToIndex.cpp
SQLite/SqliteDatabase.cpp
SQLite/SqliteMiddleTierAdmin.cpp
SQLite/SqliteMiddleTierUser.cpp)
target_link_libraries (ctamiddletiersqlite ${SQLITE3_LIBRARY_RELEASE})
add_library (ctamiddletiersqliteunittests SHARED
SQLite/SqliteMiddleTierTest.cpp)
......@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "cta/Exception.hpp"
#include "cta/SqliteColumnNameToIndex.hpp"
#include "utils/exception/Exception.hpp"
#include "middletier/SQLite/SqliteColumnNameToIndex.hpp"
#include <sstream>
......@@ -31,7 +31,7 @@ cta::SqliteColumnNameToIndex::SqliteColumnNameToIndex(
std::ostringstream message;
message << "SqliteColumnNameToIndex() - "
"SQLite error: sqlite3_column_count() returned 0";
throw(cta::Exception(message.str()));
throw(cta::exception::Exception(message.str()));
}
for(int i=0; i<colCount; i++) {
const char *const columnName = sqlite3_column_origin_name(statement,i);
......@@ -39,7 +39,7 @@ cta::SqliteColumnNameToIndex::SqliteColumnNameToIndex(
std::ostringstream message;
message << "SqliteColumnNameToIndex() -"
" SQLite error: sqlite3_column_origin_name() returned NULL";
throw(cta::Exception(message.str()));
throw(cta::exception::Exception(message.str()));
}
m_columnNameToIndex[std::string(columnName)] = i;
}
......@@ -58,6 +58,6 @@ int cta::SqliteColumnNameToIndex::operator()(const std::string &columnName)
std::ostringstream message;
message << "SqliteColumnNameToIndex() - column " << columnName <<
" does not exist";
throw cta::Exception(message.str());
throw cta::exception::Exception(message.str());
}
}
......@@ -16,14 +16,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "cta/Exception.hpp"
#include "cta/SqliteColumnNameToIndex.hpp"
#include "cta/SqliteDatabase.hpp"
#include "cta/Utils.hpp"
#include "utils/exception/Exception.hpp"
#include "middletier/SQLite/SqliteColumnNameToIndex.hpp"
#include "middletier/SQLite/SqliteDatabase.hpp"
#include "utils/Utils.hpp"
#include <iostream>
#include <memory>
#include <sstream>
using cta::exception::Exception;
//------------------------------------------------------------------------------
// constructor
......
......@@ -18,16 +18,16 @@
#pragma once
#include "cta/AdminHost.hpp"
#include "cta/AdminUser.hpp"
#include "cta/ArchivalJob.hpp"
#include "cta/ArchivalRoute.hpp"
#include "cta/LogicalLibrary.hpp"
#include "cta/RetrievalJob.hpp"
#include "cta/SecurityIdentity.hpp"
#include "cta/StorageClass.hpp"
#include "cta/Tape.hpp"
#include "cta/TapePool.hpp"
#include "middletier/interface/AdminHost.hpp"
#include "middletier/interface/AdminUser.hpp"
#include "middletier/interface/ArchivalJob.hpp"
#include "middletier/interface/ArchivalRoute.hpp"
#include "middletier/interface/LogicalLibrary.hpp"
#include "middletier/interface/RetrievalJob.hpp"
#include "middletier/interface/SecurityIdentity.hpp"
#include "middletier/interface/StorageClass.hpp"
#include "middletier/interface/Tape.hpp"
#include "middletier/interface/TapePool.hpp"
#include <list>
#include <map>
......
......@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "cta/Exception.hpp"
#include "cta/SqliteMiddleTierAdmin.hpp"
#include "utils/exception/Exception.hpp"
#include "middletier/SQLite/SqliteMiddleTierAdmin.hpp"
#include <iostream>
#include <memory>
......
......@@ -18,9 +18,9 @@
#pragma once
#include "cta/MiddleTierAdmin.hpp"
#include "cta/SqliteDatabase.hpp"
#include "cta/Vfs.hpp"
#include "middletier/interface/MiddleTierAdmin.hpp"
#include "middletier/SQLite/SqliteDatabase.hpp"
#include "namespace/Vfs.hpp"
namespace cta {
......
......@@ -16,38 +16,41 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "middletier/sharedtest/MiddleTierAbstractTest.hpp"
#include "middletier/interface/MiddleTierAdmin.hpp"
#include "middletier/interface/MiddleTierUser.hpp"
#include "middletier/SQLite/SqliteDatabase.hpp"
#include "middletier/SQLite/SqliteMiddleTierAdmin.hpp"
#include "middletier/SQLite/SqliteMiddleTierUser.hpp"
#include "namespace/Vfs.hpp"
#include <exception>
#include <string>
namespace cta {
namespace unitTests {
/**
* Class representing an exception.
*/
class Exception: public std::exception {
class SQLiteLocalMiddleTier: public localMiddleTier {
public:
/**
* Constructor.
*/
Exception(const std::string &message);
/**
* Destructor.
*/
~Exception() throw();
/**
* Returns a description of what went wrong.
*/
const char *what() const throw();
SQLiteLocalMiddleTier(): m_vfs(), m_sqLite(), m_admin(m_vfs, m_sqLite),
m_user(m_vfs, m_sqLite) {}
virtual cta::MiddleTierAdmin & admin () { return m_admin; }
virtual cta::MiddleTierUser & user () { return m_user; }
private:
cta::Vfs m_vfs;
cta::SqliteDatabase m_sqLite;
cta::SqliteMiddleTierAdmin m_admin;
cta::SqliteMiddleTierUser m_user;
};
std::string m_message;
}; // class Exception
} // namespace cta
class SQLiteMiddleTierFactory: public MiddleTierFactory {
public:
SQLiteMiddleTierFactory() {
m_localMiddleTier = allocateLocalMiddleTier();
}
virtual localMiddleTier * allocateLocalMiddleTier() {
return new SQLiteLocalMiddleTier; }
} g_SQLiteMiddleTierFactory;
// Macro chokes on implicit casting of pointer so we have to do it ourselves
INSTANTIATE_TEST_CASE_P(MiddleTierSQL, MiddleTierAbstractTest, ::testing::Values(
(MiddleTierFactory*)&g_SQLiteMiddleTierFactory));
}
\ No newline at end of file
......@@ -16,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "cta/Exception.hpp"
#include "cta/SqliteMiddleTierUser.hpp"
#include "cta/Utils.hpp"
#include "utils/exception/Exception.hpp"
#include "middletier/SQLite/SqliteMiddleTierUser.hpp"
#include "utils/Utils.hpp"
#include <iostream>
#include <memory>
......
......@@ -18,12 +18,12 @@
#pragma once
#include "cta/FileSystemNode.hpp"
#include "cta/FileSystemStorageClasses.hpp"
#include "cta/MiddleTierUser.hpp"
#include "cta/SqliteDatabase.hpp"
#include "cta/StorageClass.hpp"
#include "cta/Vfs.hpp"
#include "middletier/interface/FileSystemNode.hpp"
#include "middletier/interface/FileSystemStorageClasses.hpp"
#include "middletier/interface/MiddleTierUser.hpp"
#include "middletier/SQLite/SqliteDatabase.hpp"
#include "middletier/interface/StorageClass.hpp"
#include "namespace/Vfs.hpp"
namespace cta {
......
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#pragma once
namespace cta {
/**
* Class representing the API for archiving files.
*/
class ArchivalRequestHandler {
public:
/**
* Creates and queues a request to archive one or files.
*/
void createArchivalRequest();
}; // class ArchivalRequestHandler
} // namespace cta
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "cta/Exception.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::Exception::Exception(const std::string &message):
m_message(message) {
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
cta::Exception::~Exception() throw() {
}
//------------------------------------------------------------------------------
// what
//------------------------------------------------------------------------------
const char *cta::Exception::what() const throw() {
return m_message.c_str();
}
This diff is collapsed.
This diff is collapsed.
......@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "cta/AdminHost.hpp"
#include "middletier/interface/AdminHost.hpp"
//------------------------------------------------------------------------------
// constructor
......
......@@ -18,8 +18,8 @@
#pragma once
#include "cta/ConfigurationItem.hpp"
#include "cta/UserIdentity.hpp"
#include "middletier/interface/ConfigurationItem.hpp"
#include "middletier/interface/UserIdentity.hpp"
#include <string>
......
......@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "cta/AdminUser.hpp"
#include "middletier/interface/AdminUser.hpp"
//------------------------------------------------------------------------------
// constructor
......
......@@ -18,8 +18,8 @@
#pragma once
#include "cta/ConfigurationItem.hpp"
#include "cta/UserIdentity.hpp"
#include "middletier/interface/ConfigurationItem.hpp"
#include "middletier/interface/UserIdentity.hpp"
#include <string>
......
......@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "cta/ArchivalFileTransfer.hpp"
#include "middletier/interface/ArchivalFileTransfer.hpp"
//------------------------------------------------------------------------------
// constructor
......
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