Skip to content

Commit

Permalink
enh(DataTest): Code enhancements (mostly to use override) to prevent …
Browse files Browse the repository at this point in the history
…wrong test calls when renaming.
  • Loading branch information
matejk committed Jul 30, 2024
1 parent 5bebdeb commit df643c1
Show file tree
Hide file tree
Showing 12 changed files with 165 additions and 168 deletions.
2 changes: 1 addition & 1 deletion Data/DataTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ file(GLOB SRCS_G ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
POCO_SOURCES_AUTO(DATA_TEST_LIB_SRCS ${SRCS_G})

# Headers
file(GLOB HDRS_G ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h)
file(GLOB HDRS_G ${CMAKE_CURRENT_SOURCE_DIR}/include/Poco/Data/Test/*.h)
POCO_HEADERS_AUTO(DATA_TEST_LIB_SRCS ${HDRS_G})

# Version Resource
Expand Down
6 changes: 2 additions & 4 deletions Data/DataTest/include/Poco/Data/Test/SQLExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@
#define DataTest_SQLExecutor_INCLUDED


#include "CppUnit/TestCase.h"
#include "Poco/Data/Test/DataTest.h"
#include "Poco/Data/Session.h"
#include "Poco/Data/BulkExtraction.h"
#include "Poco/Data/BulkBinding.h"
#include "Poco/NumberFormatter.h"
#include "Poco/String.h"
#include "Poco/Exception.h"
#include <iostream>
#include <string_view>


namespace Poco {
Expand Down Expand Up @@ -55,7 +53,7 @@ class DataTest_API SQLExecutor: public CppUnit::TestCase
};

SQLExecutor(const std::string& name, Poco::Data::Session* pSession, Poco::Data::Session* pEncSession = nullptr, bool numberedPlaceHolders = false);
~SQLExecutor();
~SQLExecutor() override;

template <typename C>
void connection(C& c, const std::string& connectString)
Expand Down
6 changes: 3 additions & 3 deletions Data/ODBC/include/Poco/Data/ODBC/Diagnostics.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ class Diagnostics
{
public:

inline static const unsigned int SQL_STATE_SIZE = SQL_SQLSTATE_SIZE + 1;
inline static const unsigned int SQL_MESSAGE_LENGTH = SQL_MAX_MESSAGE_LENGTH + 1;
inline static const unsigned int SQL_NAME_LENGTH = 128;
static constexpr unsigned int SQL_STATE_SIZE = SQL_SQLSTATE_SIZE + 1;
static constexpr unsigned int SQL_MESSAGE_LENGTH = SQL_MAX_MESSAGE_LENGTH + 1;
static constexpr unsigned int SQL_NAME_LENGTH = 128;
inline static const std::string DATA_TRUNCATED;

struct DiagnosticFields
Expand Down
6 changes: 3 additions & 3 deletions Data/ODBC/testsuite/src/ODBCAccessTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ class ODBCAccessTest: public CppUnit::TestCase
{
public:
ODBCAccessTest(const std::string& name);
~ODBCAccessTest();
~ODBCAccessTest() override;

void testSimpleAccess();

void setUp();
void tearDown();
void setUp() override;
void tearDown() override;

static CppUnit::Test* suite();

Expand Down
48 changes: 24 additions & 24 deletions Data/ODBC/testsuite/src/ODBCDB2Test.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,37 @@ class ODBCDB2Test: public ODBCTest
{
public:
ODBCDB2Test(const std::string& name);
~ODBCDB2Test();
~ODBCDB2Test() override;

void testBareboneODBC();
void testBareboneODBC() override;

void testBLOB();
void testFilter();
void testBLOB() override;
void testFilter() override;

void testStoredProcedure();
void testStoredProcedureAny();
void testStoredProcedureDynamicVar();
void testStoredFunction();
void testStoredProcedure() override;
void testStoredProcedureAny() override;
void testStoredProcedureDynamicVar() override;
void testStoredFunction() override;

static CppUnit::Test* suite();

private:
void dropObject(const std::string& type, const std::string& tableName);
void recreateNullableTable();
void recreatePersonTable();
void recreatePersonBLOBTable();
void recreatePersonDateTable();
void recreatePersonTimeTable();
void recreatePersonDateTimeTable();
void recreateStringsTable();
void recreateIntsTable();
void recreateFloatsTable();
void recreateTuplesTable();
void recreateVectorsTable();
void recreateAnysTable();
void recreateNullsTable(const std::string& notNull = "");
void recreateMiscTable();
void recreateLogTable();
void dropObject(const std::string& type, const std::string& tableName) override;
void recreateNullableTable() override;
void recreatePersonTable() override;
void recreatePersonBLOBTable() override;
void recreatePersonDateTable() override;
void recreatePersonTimeTable() override;
void recreatePersonDateTimeTable() override;
void recreateStringsTable() override;
void recreateIntsTable() override;
void recreateFloatsTable() override;
void recreateTuplesTable() override;
void recreateVectorsTable() override;
void recreateAnysTable() override;
void recreateNullsTable(const std::string& notNull = "") override;
void recreateMiscTable() override;
void recreateLogTable() override;

static ODBCTest::SessionPtr _pSession;
static ODBCTest::ExecPtr _pExecutor;
Expand Down
48 changes: 24 additions & 24 deletions Data/ODBC/testsuite/src/ODBCMySQLTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,39 +31,39 @@ class ODBCMySQLTest: public ODBCTest
{
public:
ODBCMySQLTest(const std::string& name);
~ODBCMySQLTest();
~ODBCMySQLTest() override;

void testBareboneODBC();
void testBareboneODBC() override;

void testBLOB();
void testBLOB() override;

void testStoredProcedure();
void testStoredFunction();
void testStoredProcedure() override;
void testStoredFunction() override;

void testNull();
void testNull() override;

void testMultipleResults();
void testFilter();
void testMultipleResults() override;
void testFilter() override;

static CppUnit::Test* suite();

private:
void dropObject(const std::string& type, const std::string& name);
void recreateNullableTable();
void recreatePersonTable();
void recreatePersonBLOBTable();
void recreatePersonDateTable();
void recreatePersonTimeTable();
void recreatePersonDateTimeTable();
void recreateStringsTable();
void recreateIntsTable();
void recreateFloatsTable();
void recreateTuplesTable();
void recreateVectorsTable();
void recreateAnysTable();
void recreateNullsTable(const std::string& notNull = "");
void recreateMiscTable();
void recreateLogTable();
void dropObject(const std::string& type, const std::string& name) override;
void recreateNullableTable() override;
void recreatePersonTable() override;
void recreatePersonBLOBTable() override;
void recreatePersonDateTable() override;
void recreatePersonTimeTable() override;
void recreatePersonDateTimeTable() override;
void recreateStringsTable() override;
void recreateIntsTable() override;
void recreateFloatsTable() override;
void recreateTuplesTable() override;
void recreateVectorsTable() override;
void recreateAnysTable() override;
void recreateNullsTable(const std::string& notNull = "") override;
void recreateMiscTable() override;
void recreateLogTable() override;

static ODBCTest::SessionPtr _pSession;
static ODBCTest::ExecPtr _pExecutor;
Expand Down
54 changes: 27 additions & 27 deletions Data/ODBC/testsuite/src/ODBCOracleTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,47 +30,47 @@ class ODBCOracleTest: public ODBCTest
{
public:
ODBCOracleTest(const std::string& name);
~ODBCOracleTest();
~ODBCOracleTest() override;

void testBareboneODBC();
void testBareboneODBC() override;

void testBLOB();
void testBLOB() override;

void testMultipleResults();
void testMultipleResults() override;

virtual void testTransaction();
void testTransaction() override;

void testStoredProcedure();
void testStoredProcedure() override;
void testCursorStoredProcedure();
void testStoredFunction();
void testStoredFunction() override;
void testCursorStoredFunction();
void testStoredProcedureAny();
void testStoredProcedureDynamicVar();
void testStoredProcedureAny() override;
void testStoredProcedureDynamicVar() override;
void testAutoTransaction();

void testNull();
void testNull() override;
static CppUnit::Test* suite();

private:
static void testBarebone();

void dropObject(const std::string& type, const std::string& name);
void recreateNullableTable();
void recreatePersonTable();
void recreatePersonTupleTable();
void recreatePersonBLOBTable();
void recreatePersonDateTable();
void recreatePersonDateTimeTable();
void recreateStringsTable();
void recreateIntsTable();
void recreateFloatsTable();
void recreateTuplesTable();
void recreateVectorsTable();
void recreateAnysTable();
void recreateNullsTable(const std::string& notNull = "");
void recreateMiscTable();
void recreateLogTable();
void recreateUnicodeTable();
void dropObject(const std::string& type, const std::string& name) override;
void recreateNullableTable() override;
void recreatePersonTable() override;
void recreatePersonTupleTable() override;
void recreatePersonBLOBTable() override;
void recreatePersonDateTable() override;
void recreatePersonDateTimeTable() override;
void recreateStringsTable() override;
void recreateIntsTable() override;
void recreateFloatsTable() override;
void recreateTuplesTable() override;
void recreateVectorsTable() override;
void recreateAnysTable() override;
void recreateNullsTable(const std::string& notNull = "") override;
void recreateMiscTable() override;
void recreateLogTable() override;
void recreateUnicodeTable() override;

static ODBCTest::SessionPtr _pSession;
static ODBCTest::ExecPtr _pExecutor;
Expand Down
48 changes: 24 additions & 24 deletions Data/ODBC/testsuite/src/ODBCPostgreSQLTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,37 +37,37 @@ class ODBCPostgreSQLTest: public ODBCTest
{
public:
ODBCPostgreSQLTest(const std::string& name);
~ODBCPostgreSQLTest();
~ODBCPostgreSQLTest() override;

void testBareboneODBC();
void testBareboneODBC() override;

void testBLOB();
void testBLOB() override;

void testStoredFunction();
void testStoredFunctionAny();
void testStoredFunctionDynamicAny();
void testStoredFunction() override;
void testStoredFunctionAny() override;
void testStoredFunctionDynamicAny() override;

static CppUnit::Test* suite();

private:
void dropObject(const std::string& type, const std::string& name);
void recreateNullableTable();
void recreatePersonTable();
void recreatePersonBLOBTable();
void recreatePersonDateTimeTable();
void recreatePersonDateTable();
void recreatePersonTimeTable();
void recreateStringsTable();
void recreateIntsTable();
void recreateFloatsTable();
void recreateTuplesTable();
void recreateVectorsTable();
void recreateAnysTable();
void recreateNullsTable(const std::string& notNull="");
void recreateBoolTable();
void recreateMiscTable();
void recreateLogTable();
void recreateUnicodeTable();
void dropObject(const std::string& type, const std::string& name) override;
void recreateNullableTable() override;
void recreatePersonTable() override;
void recreatePersonBLOBTable() override;
void recreatePersonDateTimeTable() override;
void recreatePersonDateTable() override;
void recreatePersonTimeTable() override;
void recreateStringsTable() override;
void recreateIntsTable() override;
void recreateFloatsTable() override;
void recreateTuplesTable() override;
void recreateVectorsTable() override;
void recreateAnysTable() override;
void recreateNullsTable(const std::string& notNull = "") override;
void recreateBoolTable() override;
void recreateMiscTable() override;
void recreateLogTable() override;
void recreateUnicodeTable() override;

void configurePLPgSQL();
/// Configures PL/pgSQL in the database. A reasonable defaults
Expand Down
Loading

0 comments on commit df643c1

Please sign in to comment.