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 ...@@ -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 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) DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/InMemoryCatalogueSchema.before_SQL.cpp in_memory_catalogue_schema.cpp)
set(CATALOGUE_UNIT_TESTS_LIB_SRC_FILES set(IN_MEMORY_CATALOGUE_UNIT_TESTS_LIB_SRC_FILES
CatalogueFactoryTest.cpp
CatalogueTest.cpp CatalogueTest.cpp
CatalogueFactoryTest.cpp
DbLoginFactory.cpp DbLoginFactory.cpp
DbLoginTest.cpp DbLoginTest.cpp
ParamNameToIdxTest.cpp ParamNameToIdxTest.cpp
InMemoryCatalogueTest.cpp InMemoryCatalogueTest.cpp
SqliteStmtTest.cpp) SqliteStmtTest.cpp)
add_library (ctacatalogueunittests SHARED add_library (ctainmemorycatalogueunittests SHARED
${CATALOGUE_UNIT_TESTS_LIB_SRC_FILES}) ${IN_MEMORY_CATALOGUE_UNIT_TESTS_LIB_SRC_FILES})
target_link_libraries (ctacatalogueunittests target_link_libraries (ctainmemorycatalogueunittests
ctacatalogue) 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 CatalogueTest.cpp
DbLoginFactory.cpp DbConfigCatalogueTest.cpp
OcciConnTest.cpp DbLoginFactory.cpp)
OcciEnvTest.cpp
OcciRsetTest.cpp
OcciStmtTest.cpp
OracleCatalogueTest.cpp)
add_library (ctacatalogueoraunittests SHARED add_library (ctacatalogueunittests SHARED
${CATALOGUE_ORA_UNIT_TESTS_LIB_SRC_FILES}) ${CATALOGUE_UNIT_TESTS_LIB_SRC_FILES})
target_link_libraries (ctacatalogueoraunittests target_link_libraries (ctacatalogueunittests
ctacatalogue) ctacatalogue)
install(TARGETS ctacatalogueoraunittests DESTINATION usr/${CMAKE_INSTALL_LIBDIR}) install(TARGETS ctacatalogueunittests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
install (FILES cta_catalogue_db.conf.example install (FILES cta_catalogue_db.conf.example
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/cta DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/cta
......
...@@ -33,6 +33,10 @@ namespace unitTests { ...@@ -33,6 +33,10 @@ namespace unitTests {
class cta_catalogue_CatalogueTest : public ::testing::TestWithParam<cta::catalogue::DbLoginFactory*> { class cta_catalogue_CatalogueTest : public ::testing::TestWithParam<cta::catalogue::DbLoginFactory*> {
public: public:
/**
* Constructor.
*/
cta_catalogue_CatalogueTest(): cta_catalogue_CatalogueTest():
m_bootstrapComment("bootstrap") { m_bootstrapComment("bootstrap") {
......
...@@ -17,20 +17,22 @@ ...@@ -17,20 +17,22 @@
*/ */
#include "catalogue/CatalogueTest.hpp" #include "catalogue/CatalogueTest.hpp"
#include "tests/OraUnitTestsCmdLineArgs.hpp" #include "tests/CatalogueUnitTestsCmdLineArgs.hpp"
namespace { 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: public:
/** /**
* Destructor. * Destructor.
*/ */
virtual ~OracleDbLoginFactory() { virtual ~DbConfigFileLoginFactory() {
} }
/** /**
...@@ -40,17 +42,17 @@ public: ...@@ -40,17 +42,17 @@ public:
*/ */
virtual cta::catalogue::DbLogin create() { virtual cta::catalogue::DbLogin create() {
using namespace cta::catalogue; using namespace cta::catalogue;
return DbLogin::parseFile(g_cmdLineArgs.oraDbConnFile); return DbLogin::parseFile(g_cmdLineArgs.dbConfigPath);
} }
}; // class OracleDbLoginFactory }; // class OracleDbLoginFactory
OracleDbLoginFactory g_oracleDbLoginFactory; DbConfigFileLoginFactory g_dbConfigLoginFactory;
} // anonymous namespace } // anonymous namespace
namespace unitTests { namespace unitTests {
INSTANTIATE_TEST_CASE_P(Oracle, cta_catalogue_CatalogueTest, INSTANTIATE_TEST_CASE_P(DbConfigFile, cta_catalogue_CatalogueTest,
::testing::Values(dynamic_cast<cta::catalogue::DbLoginFactory*>(&g_oracleDbLoginFactory))); ::testing::Values(dynamic_cast<cta::catalogue::DbLoginFactory*>(&g_dbConfigLoginFactory)));
} // namespace unitTests } // namespace unitTests
...@@ -155,15 +155,15 @@ Unit tests and system tests with virtual tape drives ...@@ -155,15 +155,15 @@ Unit tests and system tests with virtual tape drives
%attr(0755,root,root) %{_bindir}/cta-systemTests %attr(0755,root,root) %{_bindir}/cta-systemTests
%attr(0755,root,root) %{_libdir}/libsystemTestHelperTests.so %attr(0755,root,root) %{_libdir}/libsystemTestHelperTests.so
%attr(0755,root,root) %{_libdir}/libcta-tapedSystemTests.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
%attr(0755,root,root) %{_bindir}/cta-unitTests-multiProcess %attr(0755,root,root) %{_bindir}/cta-unitTests-multiProcess
%attr(0755,root,root) %{_bindir}/cta-valgrindUnitTests.sh %attr(0755,root,root) %{_bindir}/cta-valgrindUnitTests.sh
%attr(0755,root,root) %{_bindir}/cta-unitPlusSystemTests.sh %attr(0755,root,root) %{_bindir}/cta-unitPlusSystemTests.sh
%attr(0755,root,root) %{_libdir}/libctacatalogueunittests.so %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}/libctacommonunittests.so
%attr(0755,root,root) %{_libdir}/libctaexceptionunittests.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}/libctaiounittests.so
%attr(0755,root,root) %{_libdir}/libctalegacymsgunittests.so %attr(0755,root,root) %{_libdir}/libctalegacymsgunittests.so
%attr(0755,root,root) %{_libdir}/libctamessagesunittests.so %attr(0755,root,root) %{_libdir}/libctamessagesunittests.so
......
...@@ -22,7 +22,7 @@ add_executable(cta-unitTests ...@@ -22,7 +22,7 @@ add_executable(cta-unitTests
${GMOCK_SRC}) ${GMOCK_SRC})
target_link_libraries(cta-unitTests target_link_libraries(cta-unitTests
ctacatalogueunittests ctainmemorycatalogueunittests
ctaexceptionunittests ctaexceptionunittests
ctaiounittests ctaiounittests
ctalegacymsgunittests ctalegacymsgunittests
...@@ -47,13 +47,13 @@ target_link_libraries(cta-unitTests ...@@ -47,13 +47,13 @@ target_link_libraries(cta-unitTests
gtest gtest
pthread) pthread)
add_executable(cta-oraUnitTests add_executable(cta-catalogueUnitTests
OraUnitTestsCmdLineArgs.cpp CatalogueUnitTestsCmdLineArgs.cpp
oraUnitTests.cpp catalogueUnitTests.cpp
${GMOCK_SRC}) ${GMOCK_SRC})
target_link_libraries(cta-oraUnitTests target_link_libraries(cta-catalogueUnitTests
ctacatalogueoraunittests ctacatalogueunittests
${GMOCK_LIB} ${GMOCK_LIB}
gtest gtest
pthread) pthread)
...@@ -95,7 +95,7 @@ target_link_libraries(cta-systemTests ...@@ -95,7 +95,7 @@ target_link_libraries(cta-systemTests
gtest gtest
pthread) 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}) install(TARGETS systemTestHelperTests DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
......
...@@ -16,16 +16,10 @@ ...@@ -16,16 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <string> #include "tests/CatalogueUnitTestsCmdLineArgs.hpp"
struct CmdLineArgs {
/**
* The oracle database connection string.
*/
std::string oraDbConnFile;
};
/** /**
* 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 @@ ...@@ -16,9 +16,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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. * Structure to store the command-line arguments of the CTA-catalogue unit-tests
//---------------------------------------------------------------------------------------------------------------------- * program.
CmdLineArgs g_cmdLineArgs; */
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 @@ ...@@ -17,7 +17,7 @@
*/ */
#include "catalogue/CatalogueTest.hpp" #include "catalogue/CatalogueTest.hpp"
#include "tests/OraUnitTestsCmdLineArgs.hpp" #include "tests/CatalogueUnitTestsCmdLineArgs.hpp"
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
static void printUsage(std::ostream &os) { static void printUsage(std::ostream &os) {
os << os <<
"Usage:" << std::endl << "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) { ...@@ -37,15 +37,15 @@ static void printUsage(std::ostream &os) {
* Google test has consumed all of its command-line options from the * Google test has consumed all of its command-line options from the
* command-line. * command-line.
*/ */
static CmdLineArgs parseCmdLine(const int argc, char ** argv) { static CatalogueUnitTestsCmdLineArgs parseCmdLine(const int argc, char ** argv) {
if(argc != 2) { if(argc != 2) {
std::cerr << "Invalid number of command-line arguments"; std::cerr << "Invalid number of command-line arguments";
printUsage(std::cerr); printUsage(std::cerr);
exit(1); exit(1);
} }
CmdLineArgs cmdLineArgs; CatalogueUnitTestsCmdLineArgs cmdLineArgs;
cmdLineArgs.oraDbConnFile = argv[1]; cmdLineArgs.dbConfigPath = argv[1];
return cmdLineArgs; 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