Commit 55e81e42 authored by Steven Murray's avatar Steven Murray
Browse files

Renamed cta-oraUnitTests to cta-catalogueUnitTests because there is more than...

Renamed cta-oraUnitTests to cta-catalogueUnitTests because there is more than one supported database type
parent 10495d2f
......@@ -83,39 +83,35 @@ add_custom_command(OUTPUT InMemoryCatalogueSchema.cpp
COMMAND sed '/CTA_SQL_SCHEMA/r in_memory_catalogue_schema.cpp' ${CMAKE_CURRENT_SOURCE_DIR}/InMemoryCatalogueSchema.before_SQL.cpp > InMemoryCatalogueSchema.cpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/InMemoryCatalogueSchema.before_SQL.cpp in_memory_catalogue_schema.cpp)
set(CATALOGUE_UNIT_TESTS_LIB_SRC_FILES
CatalogueFactoryTest.cpp
set(IN_MEMORY_CATALOGUE_UNIT_TESTS_LIB_SRC_FILES
CatalogueTest.cpp
CatalogueFactoryTest.cpp
DbLoginFactory.cpp
DbLoginTest.cpp
ParamNameToIdxTest.cpp
InMemoryCatalogueTest.cpp
SqliteStmtTest.cpp)
add_library (ctacatalogueunittests SHARED
${CATALOGUE_UNIT_TESTS_LIB_SRC_FILES})
add_library (ctainmemorycatalogueunittests SHARED
${IN_MEMORY_CATALOGUE_UNIT_TESTS_LIB_SRC_FILES})
target_link_libraries (ctacatalogueunittests
target_link_libraries (ctainmemorycatalogueunittests
ctacatalogue)
install(TARGETS ctacatalogueunittests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
install(TARGETS ctainmemorycatalogueunittests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
set (CATALOGUE_ORA_UNIT_TESTS_LIB_SRC_FILES
set (CATALOGUE_UNIT_TESTS_LIB_SRC_FILES
CatalogueTest.cpp
DbLoginFactory.cpp
OcciConnTest.cpp
OcciEnvTest.cpp
OcciRsetTest.cpp
OcciStmtTest.cpp
OracleCatalogueTest.cpp)
DbConfigCatalogueTest.cpp
DbLoginFactory.cpp)
add_library (ctacatalogueoraunittests SHARED
${CATALOGUE_ORA_UNIT_TESTS_LIB_SRC_FILES})
add_library (ctacatalogueunittests SHARED
${CATALOGUE_UNIT_TESTS_LIB_SRC_FILES})
target_link_libraries (ctacatalogueoraunittests
target_link_libraries (ctacatalogueunittests
ctacatalogue)
install(TARGETS ctacatalogueoraunittests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
install(TARGETS ctacatalogueunittests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
install (FILES cta_catalogue_db.conf.example
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/cta
......
......@@ -33,6 +33,10 @@ namespace unitTests {
class cta_catalogue_CatalogueTest : public ::testing::TestWithParam<cta::catalogue::DbLoginFactory*> {
public:
/**
* Constructor.
*/
cta_catalogue_CatalogueTest():
m_bootstrapComment("bootstrap") {
......
......@@ -17,20 +17,22 @@
*/
#include "catalogue/CatalogueTest.hpp"
#include "tests/OraUnitTestsCmdLineArgs.hpp"
#include "tests/CatalogueUnitTestsCmdLineArgs.hpp"
namespace {
/**
* Creates DbLogin objects for in-memory catalogue databases.
* Creates DbLogin objects for the test catalogue database whose database login
* details are specified in a database configuration file passed on the
* command-line to the catalogue unit-tests program.
*/
class OracleDbLoginFactory: public cta::catalogue::DbLoginFactory {
class DbConfigFileLoginFactory: public cta::catalogue::DbLoginFactory {
public:
/**
* Destructor.
*/
virtual ~OracleDbLoginFactory() {
virtual ~DbConfigFileLoginFactory() {
}
/**
......@@ -40,17 +42,17 @@ public:
*/
virtual cta::catalogue::DbLogin create() {
using namespace cta::catalogue;
return DbLogin::parseFile(g_cmdLineArgs.oraDbConnFile);
return DbLogin::parseFile(g_cmdLineArgs.dbConfigPath);
}
}; // class OracleDbLoginFactory
OracleDbLoginFactory g_oracleDbLoginFactory;
DbConfigFileLoginFactory g_dbConfigLoginFactory;
} // anonymous namespace
namespace unitTests {
INSTANTIATE_TEST_CASE_P(Oracle, cta_catalogue_CatalogueTest,
::testing::Values(dynamic_cast<cta::catalogue::DbLoginFactory*>(&g_oracleDbLoginFactory)));
INSTANTIATE_TEST_CASE_P(DbConfigFile, cta_catalogue_CatalogueTest,
::testing::Values(dynamic_cast<cta::catalogue::DbLoginFactory*>(&g_dbConfigLoginFactory)));
} // namespace unitTests
......@@ -155,15 +155,15 @@ Unit tests and system tests with virtual tape drives
%attr(0755,root,root) %{_bindir}/cta-systemTests
%attr(0755,root,root) %{_libdir}/libsystemTestHelperTests.so
%attr(0755,root,root) %{_libdir}/libcta-tapedSystemTests.so
%attr(0755,root,root) %{_bindir}/cta-oraUnitTests
%attr(0755,root,root) %{_bindir}/cta-catalogueUnitTests
%attr(0755,root,root) %{_bindir}/cta-unitTests
%attr(0755,root,root) %{_bindir}/cta-unitTests-multiProcess
%attr(0755,root,root) %{_bindir}/cta-valgrindUnitTests.sh
%attr(0755,root,root) %{_bindir}/cta-unitPlusSystemTests.sh
%attr(0755,root,root) %{_libdir}/libctacatalogueunittests.so
%attr(0755,root,root) %{_libdir}/libctacatalogueoraunittests.so
%attr(0755,root,root) %{_libdir}/libctacommonunittests.so
%attr(0755,root,root) %{_libdir}/libctaexceptionunittests.so
%attr(0755,root,root) %{_libdir}/libctainmemorycatalogueunittests.so
%attr(0755,root,root) %{_libdir}/libctaiounittests.so
%attr(0755,root,root) %{_libdir}/libctalegacymsgunittests.so
%attr(0755,root,root) %{_libdir}/libctamessagesunittests.so
......
......@@ -22,7 +22,7 @@ add_executable(cta-unitTests
${GMOCK_SRC})
target_link_libraries(cta-unitTests
ctacatalogueunittests
ctainmemorycatalogueunittests
ctaexceptionunittests
ctaiounittests
ctalegacymsgunittests
......@@ -47,13 +47,13 @@ target_link_libraries(cta-unitTests
gtest
pthread)
add_executable(cta-oraUnitTests
OraUnitTestsCmdLineArgs.cpp
oraUnitTests.cpp
add_executable(cta-catalogueUnitTests
CatalogueUnitTestsCmdLineArgs.cpp
catalogueUnitTests.cpp
${GMOCK_SRC})
target_link_libraries(cta-oraUnitTests
ctacatalogueoraunittests
target_link_libraries(cta-catalogueUnitTests
ctacatalogueunittests
${GMOCK_LIB}
gtest
pthread)
......@@ -95,7 +95,7 @@ target_link_libraries(cta-systemTests
gtest
pthread)
install(TARGETS cta-oraUnitTests cta-unitTests cta-unitTests-multiProcess cta-systemTests DESTINATION usr/bin)
install(TARGETS cta-catalogueUnitTests cta-unitTests cta-unitTests-multiProcess cta-systemTests DESTINATION usr/bin)
install(TARGETS systemTestHelperTests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
......
......@@ -16,16 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string>
struct CmdLineArgs {
/**
* The oracle database connection string.
*/
std::string oraDbConnFile;
};
#include "tests/CatalogueUnitTestsCmdLineArgs.hpp"
/**
* Declaration of the global variable used to store the command-line arguments so that they are visible to the tests.
* Global variable used to store the command-line arguments so that they are
* visible to the tests.
*/
extern CmdLineArgs g_cmdLineArgs;
CatalogueUnitTestsCmdLineArgs g_cmdLineArgs;
......@@ -16,9 +16,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tests/OraUnitTestsCmdLineArgs.hpp"
#include <string>
//----------------------------------------------------------------------------------------------------------------------
// Definition of the global variable used to store the command-line arguments so that they are visible to the tests.
//----------------------------------------------------------------------------------------------------------------------
CmdLineArgs g_cmdLineArgs;
/**
* Structure to store the command-line arguments of the CTA-catalogue unit-tests
* program.
*/
struct CatalogueUnitTestsCmdLineArgs {
/**
* Absolute path to the file containing the connection details of a test CTA
* catalogue database.
*/
std::string dbConfigPath;
};
/**
* Declaration of the global variable used to store the command-line arguments
* so that they are visible to the tests.
*/
extern CatalogueUnitTestsCmdLineArgs g_cmdLineArgs;
......@@ -17,7 +17,7 @@
*/
#include "catalogue/CatalogueTest.hpp"
#include "tests/OraUnitTestsCmdLineArgs.hpp"
#include "tests/CatalogueUnitTestsCmdLineArgs.hpp"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
......@@ -29,7 +29,7 @@
static void printUsage(std::ostream &os) {
os <<
"Usage:" << std::endl <<
'\t' << "cta-oraUnitTest [Google test options] databaseConnectionFile" << std::endl;
'\t' << "cta-catalogueUnitTests [Google test options] databaseConnectionFile" << std::endl;
}
/**
......@@ -37,15 +37,15 @@ static void printUsage(std::ostream &os) {
* Google test has consumed all of its command-line options from the
* command-line.
*/
static CmdLineArgs parseCmdLine(const int argc, char ** argv) {
static CatalogueUnitTestsCmdLineArgs parseCmdLine(const int argc, char ** argv) {
if(argc != 2) {
std::cerr << "Invalid number of command-line arguments";
printUsage(std::cerr);
exit(1);
}
CmdLineArgs cmdLineArgs;
cmdLineArgs.oraDbConnFile = argv[1];
CatalogueUnitTestsCmdLineArgs cmdLineArgs;
cmdLineArgs.dbConfigPath = argv[1];
return cmdLineArgs;
}
......
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