Commit d69488c8 authored by Michael Davis's avatar Michael Davis
Browse files

Merge remote-tracking branch 'origin/master' into genericOStoreAlgos

Conflicts:
	objectstore/Agent.cpp
	objectstore/RetrieveQueueFailedAlgorithms.cpp
	objectstore/RetrieveQueueToReportAlgorithms.cpp
	objectstore/RetrieveRequest.cpp
	scheduler/OStoreDB/OStoreDB.cpp
	scheduler/OStoreDB/OStoreDB.hpp
	scheduler/OStoreDB/OStoreDBFactory.hpp
	scheduler/OStoreDB/QueueItor.cpp
	scheduler/RetrieveMount.cpp
	scheduler/Scheduler.cpp
	scheduler/SchedulerDatabase.hpp
	xroot_plugins/XrdCtaArchiveFileLs.hpp
	xroot_plugins/XrdCtaListPendingQueue.hpp
	xroot_plugins/XrdCtaTapePoolLs.hpp
parents e64aa279 fb2e0ea2
......@@ -157,7 +157,7 @@ archiveretrieve:
retry: 1
script:
- export NAMESPACE="archiveretrieve-${CTA_BUILD_ID}-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
- cd continuousintegration/orchestration/; ./run_systemtest.sh -n ${NAMESPACE} -p ${CI_PIPELINE_ID} -s tests/archive_retrieve.sh -O -D -t 1200
- cd continuousintegration/orchestration/; ./run_systemtest.sh -n ${NAMESPACE} -p ${CI_PIPELINE_ID} -s tests/archive_retrieve.sh -O -D -t 2400
artifacts:
when: always
expire_in: 30 days
......
......@@ -72,6 +72,14 @@ endif (NOT DEFINED SKIP_UNIT_TESTS)
#Load version information in all cases.
include(cmake/CTAVersions.cmake)
if (DEFINED NoACS)
message (STATUS "Running CMake without support for ACS")
set (use_manually_specified_variable ${NoACS})
else (DEFINED NoACS)
message (STATUS "Running CMake with support for ACS")
message (STATUS "Override with -DNoACS:Bool=true")
endif (DEFINED NoACS)
IF(DEFINED PackageOnly)
message (STATUS "Running CMake in package-only mode")
set(COMPILE_PACKAGING "1")
......@@ -113,7 +121,6 @@ ELSE(DEFINED PackageOnly)
# OCCI support is on by default
set (OCCI_SUPPORT ON)
find_package(stk REQUIRED)
# Switch OCCI support off if using gcc 5.1 or higher
#if (CMAKE_COMPILER_IS_GNUCC)
# if (GCC_VERSION VERSION_GREATER 5.0)
......
......@@ -111,7 +111,7 @@ std::unique_ptr<common::dataStructures::ArchiveFile> ArchiveFileBuilder::append(
params.push_back(cta::log::Param("archiveFileID", tapeFile.archiveFileID));
params.push_back(cta::log::Param("duplicateCopyNb", copyNbOfTapeFileToAppend));
params.push_back(cta::log::Param("workaroundCopyNb", workaroundCopyNb));
params.push_back(cta::log::Param("vid", vid));
params.push_back(cta::log::Param("tapeVid", vid));
params.push_back(cta::log::Param("fSeq", fSeq));
params.push_back(cta::log::Param("blockId", blockId));
m_log(cta::log::WARNING, "Found a duplicate tape copy number when listing archive files", params);
......
......@@ -26,12 +26,19 @@ set (CATALOGUE_LIB_SRC_FILES
ArchiveFileItorImpl.cpp
Catalogue.cpp
CatalogueFactory.cpp
CatalogueFactoryFactory.cpp
ChecksumTypeMismatch.cpp
ChecksumValueMismatch.cpp
CmdLineTool.cpp
FileSizeMismatch.cpp
InMemoryCatalogue.cpp
InMemoryCatalogueFactory.cpp
MysqlCatalogue.cpp
MysqlCatalogueFactory.cpp
MysqlCatalogueSchema.cpp
OracleCatalogue.cpp
OracleCatalogueFactory.cpp
PostgresqlCatalogueFactory.cpp
SqliteCatalogueSchema.cpp
TapeFileWritten.cpp
TapeItemImplementation.cpp
......@@ -40,15 +47,18 @@ set (CATALOGUE_LIB_SRC_FILES
RdbmsCatalogue.cpp
SchemaCreatingSqliteCatalogue.cpp
SqliteCatalogue.cpp
SqliteCatalogueFactory.cpp
TapeForWriting.cpp
UserSpecifiedANonEmptyTape.cpp
UserSpecifiedANonExistentTape.cpp
UserSpecifiedAnEmptyStringComment.cpp
UserSpecifiedAnEmptyStringDiskInstanceName.cpp
UserSpecifiedAnEmptyStringLogicalLibraryName.cpp
UserSpecifiedAnEmptyStringMediaType.cpp
UserSpecifiedAnEmptyStringStorageClassName.cpp
UserSpecifiedAnEmptyStringTapePoolName.cpp
UserSpecifiedAnEmptyStringUsername.cpp
UserSpecifiedAnEmptyStringVendor.cpp
UserSpecifiedAnEmptyStringVid.cpp
UserSpecifiedAnEmptyStringVo.cpp
UserSpecifiedAZeroCapacity.cpp
......@@ -67,12 +77,18 @@ target_link_libraries (ctacatalogue
ctacommon
ctardbms)
add_custom_command (OUTPUT sqlite_catalogue_schema.sql oracle_catalogue_schema.sql
add_custom_command (OUTPUT sqlite_catalogue_schema.sql mysql_catalogue_schema.sql oracle_catalogue_schema.sql
COMMAND cat
${CMAKE_CURRENT_SOURCE_DIR}/sqlite_catalogue_schema_header.sql
${CMAKE_CURRENT_SOURCE_DIR}/common_catalogue_schema.sql
${CMAKE_CURRENT_SOURCE_DIR}/sqlite_catalogue_schema_trailer.sql
| sed 's/NUMERIC\([^\)]*\)/INTEGER/g'
> sqlite_catalogue_schema.sql
COMMAND cat
${CMAKE_CURRENT_SOURCE_DIR}/mysql_catalogue_schema_header.sql
${CMAKE_CURRENT_SOURCE_DIR}/common_catalogue_schema.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_catalogue_schema_trailer.sql
> mysql_catalogue_schema.sql
COMMAND cat
${CMAKE_CURRENT_SOURCE_DIR}/oracle_catalogue_schema_header.sql
${CMAKE_CURRENT_SOURCE_DIR}/common_catalogue_schema.sql
......@@ -83,6 +99,8 @@ add_custom_command (OUTPUT sqlite_catalogue_schema.sql oracle_catalogue_schema.s
${CMAKE_CURRENT_SOURCE_DIR}/common_catalogue_schema.sql
${CMAKE_CURRENT_SOURCE_DIR}/sqlite_catalogue_schema_header.sql
${CMAKE_CURRENT_SOURCE_DIR}/sqlite_catalogue_schema_trailer.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_catalogue_schema_header.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_catalogue_schema_trailer.sql
${CMAKE_CURRENT_SOURCE_DIR}/oracle_catalogue_schema_header.sql
${CMAKE_CURRENT_SOURCE_DIR}/oracle_catalogue_schema_trailer.sql)
......@@ -94,9 +112,23 @@ add_custom_command(OUTPUT SqliteCatalogueSchema.cpp
COMMAND sed '/CTA_SQL_SCHEMA/r sqlite_catalogue_schema.cpp' ${CMAKE_CURRENT_SOURCE_DIR}/SqliteCatalogueSchema.before_SQL.cpp > SqliteCatalogueSchema.cpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/SqliteCatalogueSchema.before_SQL.cpp sqlite_catalogue_schema.cpp)
# For Mysql
add_custom_command(OUTPUT mysql_catalogue_schema.cpp
COMMAND sed 's/^/\ \ \"/' mysql_catalogue_schema.sql | sed 's/$$/\"/' > mysql_catalogue_schema.cpp
DEPENDS mysql_catalogue_schema.sql)
add_custom_command(OUTPUT mysql_catalogue_schema_trigger.cpp
COMMAND sed 's/^/\ \ \"/' ${CMAKE_CURRENT_SOURCE_DIR}/mysql_catalogue_schema_trigger.sql | sed 's/$$/\"/' > mysql_catalogue_schema_trigger.cpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/mysql_catalogue_schema_trigger.sql)
add_custom_command(OUTPUT MysqlCatalogueSchema.cpp
COMMAND sed -e '/CTA_SQL_SCHEMA/r mysql_catalogue_schema.cpp' -e '/CTA_SQL_TRIGGER/r mysql_catalogue_schema_trigger.cpp' ${CMAKE_CURRENT_SOURCE_DIR}/MysqlCatalogueSchema.before_SQL.cpp > MysqlCatalogueSchema.cpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/MysqlCatalogueSchema.before_SQL.cpp mysql_catalogue_schema.cpp mysql_catalogue_schema_trigger.cpp)
set(IN_MEMORY_CATALOGUE_UNIT_TESTS_LIB_SRC_FILES
CatalogueTest.cpp
CatalogueFactoryTest.cpp
InMemoryCatalogueTest.cpp
InMemoryVersionOfCatalogueTest.cpp)
......@@ -110,19 +142,19 @@ target_link_libraries (ctainmemorycatalogueunittests
install (TARGETS ctainmemorycatalogueunittests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
set (CATALOGUE_UNIT_TESTS_LIB_SRC_FILES
set (DBCONFIG_CATALOGUE_UNIT_TESTS_LIB_SRC_FILES
CatalogueTest.cpp
DbConfigVersionOfCatalogueTest.cpp)
add_library (ctacatalogueunittests SHARED
${CATALOGUE_UNIT_TESTS_LIB_SRC_FILES})
set_property(TARGET ctacatalogueunittests PROPERTY SOVERSION "${CTA_SOVERSION}")
set_property(TARGET ctacatalogueunittests PROPERTY VERSION "${CTA_LIBVERSION}")
add_library (ctadbconfigcatalogueunittests SHARED
${DBCONFIG_CATALOGUE_UNIT_TESTS_LIB_SRC_FILES})
set_property(TARGET ctadbconfigcatalogueunittests PROPERTY SOVERSION "${CTA_SOVERSION}")
set_property(TARGET ctadbconfigcatalogueunittests PROPERTY VERSION "${CTA_LIBVERSION}")
target_link_libraries (ctacatalogueunittests
target_link_libraries (ctadbconfigcatalogueunittests
ctacatalogue)
install (TARGETS ctacatalogueunittests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
install (TARGETS ctadbconfigcatalogueunittests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
install (FILES cta-catalogue.conf.example
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/cta
......@@ -141,7 +173,8 @@ add_executable(cta-catalogue-schema-create
CreateSchemaCmdLineArgs.cpp
CreateSchemaCmdMain.cpp
OracleCatalogueSchema.cpp
SqliteCatalogueSchema.cpp)
SqliteCatalogueSchema.cpp
MysqlCatalogueSchema.cpp)
target_link_libraries (cta-catalogue-schema-create
ctacatalogue)
......
......@@ -41,8 +41,6 @@
#include "common/dataStructures/MountType.hpp"
#include "common/dataStructures/MountPolicy.hpp"
#include "common/dataStructures/ReadTestResult.hpp"
#include "common/dataStructures/RepackInfo.hpp"
#include "common/dataStructures/RepackType.hpp"
#include "common/dataStructures/RequesterGroupMountRule.hpp"
#include "common/dataStructures/RequesterMountRule.hpp"
#include "common/dataStructures/RetrieveFileQueueCriteria.hpp"
......@@ -287,12 +285,15 @@ public:
virtual void createTape(
const common::dataStructures::SecurityIdentity &admin,
const std::string &vid,
const std::string &mediaType,
const std::string &vendor,
const std::string &logicalLibraryName,
const std::string &tapePoolName,
const uint64_t capacityInBytes,
const bool disabled,
const bool full,
const std::string &comment) = 0;
virtual void deleteTape(const std::string &vid) = 0;
/**
......@@ -337,6 +338,8 @@ public:
*/
virtual void reclaimTape(const common::dataStructures::SecurityIdentity &admin, const std::string &vid) = 0;
virtual void modifyTapeMediaType(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &mediaType) = 0;
virtual void modifyTapeVendor(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &vendor) = 0;
virtual void modifyTapeLogicalLibraryName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &logicalLibraryName) = 0;
virtual void modifyTapeTapePoolName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &tapePoolName) = 0;
virtual void modifyTapeCapacityInBytes(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const uint64_t capacityInBytes) = 0;
......@@ -487,6 +490,20 @@ public:
virtual ArchiveFileItor getArchiveFiles(
const TapeFileSearchCriteria &searchCriteria = TapeFileSearchCriteria()) const = 0;
/**
* Returns the specified files in tape file sequence order.
*
* @param vid The volume identifier of the tape.
* @param startFSeq The file sequence number of the first file. Please note
* that there might not be a file with this exact file sequence number.
* @param maxNbFiles The maximum number of files to be returned.
* @return The specified files in tape file sequence order.
*/
virtual std::list<common::dataStructures::ArchiveFile> getFilesForRepack(
const std::string &vid,
const uint64_t startFSeq,
const uint64_t maxNbFiles) const = 0;
/**
* Returns a summary of the tape files that meet the specified search
* criteria.
......
......@@ -17,56 +17,14 @@
*/
#include "catalogue/CatalogueFactory.hpp"
#include "catalogue/CatalogueRetryWrapper.hpp"
#include "catalogue/InMemoryCatalogue.hpp"
#include "catalogue/OracleCatalogue.hpp"
#include "catalogue/SqliteCatalogue.hpp"
#include "common/exception/Exception.hpp"
#include "common/make_unique.hpp"
namespace cta {
namespace catalogue {
//------------------------------------------------------------------------------
// create
// destructor
//------------------------------------------------------------------------------
std::unique_ptr<Catalogue> CatalogueFactory::create(
log::Logger &log,
const rdbms::Login &login,
const uint64_t nbConns,
const uint64_t nbArchiveFileListingConns,
const uint32_t maxTriesToConnect) {
try {
switch(login.dbType) {
case rdbms::Login::DBTYPE_IN_MEMORY:
{
auto c = cta::make_unique<InMemoryCatalogue>(log, nbConns, nbArchiveFileListingConns, maxTriesToConnect);
return cta::make_unique<CatalogueRetryWrapper>(log, std::move(c), maxTriesToConnect);
}
case rdbms::Login::DBTYPE_ORACLE:
{
auto c = cta::make_unique<OracleCatalogue>(log, login.username, login.password, login.database, nbConns,
nbArchiveFileListingConns, maxTriesToConnect);
return cta::make_unique<CatalogueRetryWrapper>(log, std::move(c), maxTriesToConnect);
}
case rdbms::Login::DBTYPE_SQLITE:
{
auto c = cta::make_unique<SqliteCatalogue>(log, login.database, nbConns, nbArchiveFileListingConns,
maxTriesToConnect);
return cta::make_unique<CatalogueRetryWrapper>(log, std::move(c), maxTriesToConnect);
}
case rdbms::Login::DBTYPE_NONE:
throw exception::Exception("Cannot create a catalogue without a database type");
default:
{
exception::Exception ex;
ex.getMessage() << "Unknown database type: value=" << login.dbType;
throw ex;
}
}
} catch(exception::Exception &ex) {
throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str());
}
CatalogueFactory:: ~CatalogueFactory() {
}
} // namespace catalogue
......
......@@ -19,48 +19,27 @@
#pragma once
#include "catalogue/Catalogue.hpp"
#include "rdbms/Login.hpp"
#include <memory>
#include <mutex>
namespace cta {
namespace catalogue {
/**
* Factory for creating CTA catalogue objects. This class is a singleton.
* Specifies the interface to a factory Catalogue objects.
*/
class CatalogueFactory {
public:
/**
* Prevent objects of this class from being instantiated.
* Destructor.
*/
CatalogueFactory() = delete;
virtual ~CatalogueFactory();
/**
* Creates a CTA catalogue object using the specified database login details.
*
* @param log Object representing the API to the CTA logging system.
* @param login The database connection details.
* @param nbConns The maximum number of concurrent connections to the
* underlying relational database for all operations accept listing archive
* files which can be relatively long operations.
* @param nbArchiveFileListingConns The maximum number of concurrent
* connections to the underlying relational database for the sole purpose of
* listing archive files.
* @return The newly created CTA catalogue object. Please note that it is the
* responsibility of the caller to delete the returned CTA catalogue object.
* @param maxTriesToConnext The maximum number of times a single method should
* try to connect to the database in the event of LostDatabaseConnection
* exceptions being thrown.
* Returns a newly created CTA catalogue object.
*/
static std::unique_ptr<Catalogue> create(
log::Logger &log,
const rdbms::Login &login,
const uint64_t nbConns,
const uint64_t nbArchiveFileListingConns,
const uint32_t maxTriesToConnect = 3);
virtual std::unique_ptr<Catalogue> create() = 0;
}; // class CatalogueFactory
......
/*
* 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 "catalogue/CatalogueFactoryFactory.hpp"
#include "catalogue/InMemoryCatalogueFactory.hpp"
#include "catalogue/MysqlCatalogueFactory.hpp"
#include "catalogue/OracleCatalogueFactory.hpp"
#include "catalogue/PostgresqlCatalogueFactory.hpp"
#include "catalogue/SqliteCatalogueFactory.hpp"
#include "common/make_unique.hpp"
namespace cta {
namespace catalogue {
//------------------------------------------------------------------------------
// create
//------------------------------------------------------------------------------
std::unique_ptr<CatalogueFactory> CatalogueFactoryFactory::create(
log::Logger &log,
const rdbms::Login &login,
const uint64_t nbConns,
const uint64_t nbArchiveFileListingConns,
const uint32_t maxTriesToConnect) {
try {
switch(login.dbType) {
case rdbms::Login::DBTYPE_IN_MEMORY:
return cta::make_unique<InMemoryCatalogueFactory>(log, nbConns, nbArchiveFileListingConns, maxTriesToConnect);
case rdbms::Login::DBTYPE_MYSQL:
return cta::make_unique<MysqlCatalogueFactory>(log, login, nbConns, nbArchiveFileListingConns, maxTriesToConnect);
case rdbms::Login::DBTYPE_ORACLE:
return cta::make_unique<OracleCatalogueFactory>(log, login, nbConns, nbArchiveFileListingConns,
maxTriesToConnect);
case rdbms::Login::DBTYPE_POSTGRESQL:
return cta::make_unique<PostgresqlCatalogueFactory>(log, login, nbConns, nbArchiveFileListingConns, maxTriesToConnect);
case rdbms::Login::DBTYPE_SQLITE:
return cta::make_unique<SqliteCatalogueFactory>(log, login, nbConns, nbArchiveFileListingConns, maxTriesToConnect);
case rdbms::Login::DBTYPE_NONE:
throw exception::Exception("Cannot create a catalogue without a database type");
default:
{
exception::Exception ex;
ex.getMessage() << "Unknown database type: value=" << login.dbType;
throw ex;
}
}
} catch(exception::Exception &ex) {
throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str());
}
}
} // namespace catalogue
} // 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
#include "catalogue/CatalogueFactory.hpp"
#include "rdbms/Login.hpp"
#include <memory>
namespace cta {
namespace catalogue {
/**
* Factory of catalogue factories. This class is a singleton.
*/
class CatalogueFactoryFactory {
public:
/**
* Prevent objects of this class from being instantiated.
*/
CatalogueFactoryFactory() = delete;
/**
* Creates a factory of CTA catalogue objects using the specified database
* login details.
*
* @param log Object representing the API to the CTA logging system.
* @param login The database connection details.
* @param nbConns The maximum number of concurrent connections to the
* underlying relational database for all operations accept listing archive
* files which can be relatively long operations.
* @param nbArchiveFileListingConns The maximum number of concurrent
* connections to the underlying relational database for the sole purpose of
* listing archive files.
* @return The newly created CTA catalogue object. Please note that it is the
* responsibility of the caller to delete the returned CTA catalogue object.
* @param maxTriesToConnext The maximum number of times a single method should
* try to connect to the database in the event of LostDatabaseConnection
* exceptions being thrown.
*/
static std::unique_ptr<CatalogueFactory> create(
log::Logger &log,
const rdbms::Login &login,
const uint64_t nbConns,
const uint64_t nbArchiveFileListingConns,
const uint32_t maxTriesToConnect = 3);
}; // class CatalogueFactoryFactory
} // namespace catalogue
} // 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 "catalogue/ArchiveFileRow.hpp"
#include "catalogue/CatalogueFactory.hpp"
#include "common/exception/Exception.hpp"
#include "common/log/DummyLogger.hpp"
#include <gtest/gtest.h>
#include <memory>
namespace unitTests {
class cta_catalogue_CatalogueFactoryTest : public ::testing::Test {
public:
cta_catalogue_CatalogueFactoryTest():
m_dummyLog("dummy", "dummy") {
m_localAdmin.username = "local_admin_user";
m_localAdmin.host = "local_admin_host";
m_admin.username = "admin_user";
m_admin.host = "admin_host";
}
protected:
virtual void SetUp() {
}
virtual void TearDown() {
}
cta::log::DummyLogger m_dummyLog;
cta::common::dataStructures::SecurityIdentity m_localAdmin;
cta::common::dataStructures::SecurityIdentity m_admin;
};
TEST_F(cta_catalogue_CatalogueFactoryTest, instance_in_memory) {
using namespace cta;
using namespace cta::catalogue;
rdbms::Login login(rdbms::Login::DBTYPE_IN_MEMORY, "", "", "", "", 0);
const uint64_t nbConns = 1;
const uint64_t nbArchiveFileListingConns = 1;
std::unique_ptr<Catalogue> catalogue(CatalogueFactory::create(m_dummyLog, login, nbConns, nbArchiveFileListingConns));
ASSERT_TRUE(nullptr != catalogue.get());
ASSERT_TRUE(catalogue->getAdminUsers().empty());
const std::string createAdminUserComment = "Create admin user";
catalogue->createAdminUser(m_localAdmin, m_admin.username, createAdminUserComment);
{
std::list<common::dataStructures::AdminUser> admins;
admins = catalogue->getAdminUsers();
ASSERT_EQ(1, admins.size());
const common::dataStructures::AdminUser admin = admins.front();
ASSERT_EQ(createAdminUserComment, admin.comment);
const common::dataStructures::EntryLog creationLog = admin.creationLog;
ASSERT_EQ(m_localAdmin.username, creationLog.username);
ASSERT_EQ(m_localAdmin.host, creationLog.host);
const common::dataStructures::EntryLog lastModificationLog = admin.lastModificationLog;
ASSERT_EQ(creationLog, lastModificationLog);
}
}
} // namespace unitTests
......@@ -201,8 +201,8 @@ public:
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyLogicalLibraryComment(admin, name, comment);}, m_maxTriesToConnect);
}
void createTape(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, const uint64_t capacityInBytes, const bool disabled, const bool full, const std::string &comment) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->createTape(admin, vid, logicalLibraryName, tapePoolName, capacityInBytes, disabled, full, comment);}, m_maxTriesToConnect);
void createTape(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &mediaType, const std::string &vendor, const std::string &logicalLibraryName, const std::string &tapePoolName, const uint64_t capacityInBytes, const bool disabled, const bool full, const std::string &comment) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->createTape(admin, vid, mediaType, vendor, logicalLibraryName, tapePoolName, capacityInBytes, disabled, full, comment);}, m_maxTriesToConnect);
}
void deleteTape(const std::string &vid) override {
......@@ -225,6 +225,14 @@ public:
return retryOnLostConnection(m_log, [&]{return m_catalogue->reclaimTape(admin, vid);}, m_maxTriesToConnect);
}
void modifyTapeMediaType(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &mediaType) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeMediaType(admin, vid, mediaType);}, m_maxTriesToConnect);
}
void modifyTapeVendor(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &vendor) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeVendor(admin, vid, vendor);}, m_maxTriesToConnect);
}
void modifyTapeLogicalLibraryName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &logicalLibraryName) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeLogicalLibraryName(admin, vid, logicalLibraryName);}, m_maxTriesToConnect);
}
......@@ -333,6 +341,10 @@ public:
return retryOnLostConnection(m_log, [&]{return m_catalogue->getArchiveFiles(searchCriteria);}, m_maxTriesToConnect);
}
std::list<common::dataStructures::ArchiveFile> getFilesForRepack(const std::string &vid, const uint64_t startFSeq, const uint64_t maxNbFiles) const override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->getFilesForRepack(vid, startFSeq, maxNbFiles);}, m_maxTriesToConnect);
}
common::dataStructures::ArchiveFileSummary getTapeFileSummary(const TapeFileSearchCriteria &searchCriteria = TapeFileSearchCriteria()) const override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->getTapeFileSummary(searchCriteria);}, m_maxTriesToConnect);
}
......
This diff is collapsed.
......@@ -22,8 +22,6 @@
#include "catalogue/CatalogueFactory.hpp"
#include "common/exception/Exception.hpp"
#include "common/log/DummyLogger.hpp"
#include "rdbms/wrapper/Conn.hpp"
#include "rdbms/LoginFactory.hpp"