diff --git a/middletier/CMakeLists.txt b/middletier/CMakeLists.txt index 89966f32517b420be406e9838af2bef260a48d15..9803e6337f85cfb68d7ae073d51942499bfc2eb1 100644 --- a/middletier/CMakeLists.txt +++ b/middletier/CMakeLists.txt @@ -32,10 +32,8 @@ set (MIDDLE_TIER_INTERFACE_SRC_FILES 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 @@ -60,7 +58,6 @@ add_library (ctamiddletier SHARED ${MIDDLE_TIER_INTERFACE_SRC_FILES}) set (MIDDLE_TIER_INTERFACE_UNIT_TESTS_LIB_SRC_FILES - interface/MockNameServerTest.cpp sharedtest/MiddleTierAdminAbstractTest.cpp sharedtest/MiddleTierUserAbstractTest.cpp) diff --git a/middletier/sharedtest/MiddleTierTest.cpp b/middletier/sharedtest/MiddleTierTest.cpp deleted file mode 100644 index f07191c5d059e40c0b42272ca6042f4d7c689d25..0000000000000000000000000000000000000000 --- a/middletier/sharedtest/MiddleTierTest.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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 "MiddleTierAbstractTest.hpp" -#include "ObjectStoreMiddleTierAdmin.hpp" -#include "objectstore/BackendRados.hpp" -#include "objectstore/BackendVFS.hpp" -#include "middletier/cta/SqliteDatabase.hpp" -#include "middletier/cta/Vfs.hpp" -#include "middletier/cta/SqliteMiddleTierAdmin.hpp" -#include "middletier/cta/SqliteMiddleTierUser.hpp" - -#define TEST_RADOS 0 -#define TEST_VFS 0 -#define TEST_SQL 1 - -namespace unitTests { - -#if TEST_RADOS -cta::objectstore::BackendRados osRados("tapetest", "tapetest"); -cta::OStoreMiddleTierAdmin mtaRados(osRados); -unitTests::MiddleTierFull middleTierRados; -middleTierRados.admin = &mtaRados; -middleTierRados.user = NULL; - -INSTANTIATE_TEST_CASE_P(MiddleTierRados, MiddleTierAbstractTest , ::testing::Values(middleTierRados)); -#endif - -#if TEST_VFS -cta::objectstore::BackendVFS osVFS; - -#endif - -#if TEST_SQL -class SQLiteLocalMiddleTier: public localMiddleTier { -public: - 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; -}; - -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)); -#endif - -} \ No newline at end of file diff --git a/namespace/CMakeLists.txt b/namespace/CMakeLists.txt index ab7dc505116b767e6eb2a569afc4e2487a720d6d..f016bd24c7639e5373aea6db6e9138cb72dbc48a 100644 --- a/namespace/CMakeLists.txt +++ b/namespace/CMakeLists.txt @@ -1,5 +1,14 @@ cmake_minimum_required (VERSION 2.6) +add_library (ctanameserver SHARED + NameServer.cpp) + +add_library (ctamocknameserver SHARED + MockNameServer.cpp) + +add_library (ctamocknameservertest SHARED + MockNameServerTest.cpp) + add_library (ctanamespacevfs SHARED Vfs.cpp) diff --git a/middletier/interface/MockNameServer.cpp b/namespace/MockNameServer.cpp similarity index 99% rename from middletier/interface/MockNameServer.cpp rename to namespace/MockNameServer.cpp index b5db28c34fa5d792d6c15fb438b717befb132188..cfd1ff320918bc2ed3e99401c11248a6654337a7 100644 --- a/middletier/interface/MockNameServer.cpp +++ b/namespace/MockNameServer.cpp @@ -31,7 +31,7 @@ #include "utils/exception/Exception.hpp" #include "utils/exception/Errnum.hpp" #include "utils/Utils.hpp" -#include "middletier/interface/MockNameServer.hpp" +#include "namespace/MockNameServer.hpp" using cta::exception::Exception; //------------------------------------------------------------------------------ diff --git a/middletier/interface/MockNameServer.hpp b/namespace/MockNameServer.hpp similarity index 98% rename from middletier/interface/MockNameServer.hpp rename to namespace/MockNameServer.hpp index fd3062786f5bbbc63ecee31214264e9ed6c18590..4cd07f18758b5601d12f81e90c6cbc87df0af0fd 100644 --- a/middletier/interface/MockNameServer.hpp +++ b/namespace/MockNameServer.hpp @@ -19,7 +19,7 @@ #pragma once #include "middletier/interface/DirIterator.hpp" -#include "middletier/interface/NameServer.hpp" +#include "namespace/NameServer.hpp" #include "middletier/interface/SecurityIdentity.hpp" #include <list> diff --git a/middletier/interface/MockNameServerTest.cpp b/namespace/MockNameServerTest.cpp similarity index 99% rename from middletier/interface/MockNameServerTest.cpp rename to namespace/MockNameServerTest.cpp index 017e8c8f88a12cf768fc200d675ef9262603d1f5..1f7b792d2472a08481fc64314f94945b1a6ae4d8 100644 --- a/middletier/interface/MockNameServerTest.cpp +++ b/namespace/MockNameServerTest.cpp @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "middletier/interface/MockNameServer.hpp" +#include "namespace/MockNameServer.hpp" #include <gtest/gtest.h> #include <memory> diff --git a/middletier/interface/NameServer.cpp b/namespace/NameServer.cpp similarity index 95% rename from middletier/interface/NameServer.cpp rename to namespace/NameServer.cpp index 0bce33c9fc8e0aead8f96630b95b88b10bc641c3..9a3614f7237fb775c00dea7e07adce03019d1e7c 100644 --- a/middletier/interface/NameServer.cpp +++ b/namespace/NameServer.cpp @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "middletier/interface/NameServer.hpp" +#include "namespace/NameServer.hpp" //------------------------------------------------------------------------------ // destructor diff --git a/middletier/interface/NameServer.hpp b/namespace/NameServer.hpp similarity index 100% rename from middletier/interface/NameServer.hpp rename to namespace/NameServer.hpp diff --git a/namespace/Vfs.hpp b/namespace/Vfs.hpp index 73e5e6aabb0ae13b41d54c43b0822a1ebdb17839..35c3283418f58c0da9ca077d15de27b888777282 100644 --- a/namespace/Vfs.hpp +++ b/namespace/Vfs.hpp @@ -66,8 +66,6 @@ public: private: - std::string m_baseDir; - std::string m_fsDir; void checkDirectoryExists(const std::string &dirPath); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0ca08c9a62e1c6a9533564d25c5319c6657888c7..c009fcda33abd870c6d3a65eceba8124648bc851 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -20,6 +20,9 @@ target_link_libraries(unittests ctamiddletierobjectstore ctanamespacevfs ctanamespacevfsunittests + ctamocknameservertest + ctamocknameserver + ctanameserver gmock gtest pthread)