mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-31 14:39:53 +01:00
Cppunit and data test enhancements (#4616)
* enh(CppUnit): Source code enhancements. * enh(DataTest): Code enhancements (mostly to use override) to prevent wrong test calls when renaming.
This commit is contained in:
parent
669be63134
commit
1eebd46c04
@ -33,11 +33,11 @@ public:
|
|||||||
long data2lineNumber,
|
long data2lineNumber,
|
||||||
const std::string& fileName);
|
const std::string& fileName);
|
||||||
CppUnitException(const CppUnitException& other);
|
CppUnitException(const CppUnitException& other);
|
||||||
virtual ~CppUnitException() noexcept;
|
~CppUnitException() noexcept override;
|
||||||
|
|
||||||
CppUnitException& operator = (const CppUnitException& other);
|
CppUnitException& operator = (const CppUnitException& other);
|
||||||
|
|
||||||
const char* what() const noexcept;
|
const char* what() const noexcept override;
|
||||||
|
|
||||||
long lineNumber() const;
|
long lineNumber() const;
|
||||||
long data1LineNumber() const;
|
long data1LineNumber() const;
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
ClassUnderTest call(ClassUnderTest object);
|
ClassUnderTest call(ClassUnderTest object);
|
||||||
void runTest ();
|
void runTest () override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public:
|
|||||||
|
|
||||||
int countTestCases();
|
int countTestCases();
|
||||||
std::string toString();
|
std::string toString();
|
||||||
void run(TestResult* result, const Test::Callback& callback = nullptr);
|
void run(TestResult* result, const Test::Callback& callback = nullptr) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int _timesRepeat;
|
const int _timesRepeat;
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#include "CppUnit/TestResult.h"
|
#include "CppUnit/TestResult.h"
|
||||||
#include "CppUnit/CppUnitException.h"
|
#include "CppUnit/CppUnitException.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <math.h>
|
#include <cmath>
|
||||||
#include "CppUnit/TestCase.h"
|
#include "CppUnit/TestCase.h"
|
||||||
#include "CppUnit/TestResult.h"
|
#include "CppUnit/TestResult.h"
|
||||||
#include "CppUnit/estring.h"
|
#include "CppUnit/estring.h"
|
||||||
@ -117,7 +117,7 @@ void TestCase::run(TestResult *result, const Test::Callback& callback)
|
|||||||
}
|
}
|
||||||
catch (CppUnitException& e)
|
catch (CppUnitException& e)
|
||||||
{
|
{
|
||||||
CppUnitException* copy = new CppUnitException(e);
|
auto* copy = new CppUnitException(e);
|
||||||
result->addFailure(this, copy);
|
result->addFailure(this, copy);
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
@ -128,7 +128,7 @@ void TestCase::run(TestResult *result, const Test::Callback& callback)
|
|||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
CppUnitException *e = new CppUnitException ("unknown exception");
|
auto* e = new CppUnitException ("unknown exception");
|
||||||
result->addError (this, e);
|
result->addError (this, e);
|
||||||
}
|
}
|
||||||
tearDown ();
|
tearDown ();
|
||||||
|
@ -15,9 +15,7 @@ TestDecorator::TestDecorator(Test* test)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TestDecorator::~TestDecorator()
|
TestDecorator::~TestDecorator() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int TestDecorator::countTestCases() const
|
int TestDecorator::countTestCases() const
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include "CppUnit/TestSuite.h"
|
#include "CppUnit/TestSuite.h"
|
||||||
#include "CppUnit/TextTestResult.h"
|
#include "CppUnit/TextTestResult.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
|
|
||||||
namespace CppUnit {
|
namespace CppUnit {
|
||||||
@ -28,8 +27,8 @@ TestRunner::TestRunner(std::ostream& ostr):
|
|||||||
|
|
||||||
TestRunner::~TestRunner()
|
TestRunner::~TestRunner()
|
||||||
{
|
{
|
||||||
for (Mappings::iterator it = _mappings.begin(); it != _mappings.end(); ++it)
|
for (auto & _mapping : _mappings)
|
||||||
delete it->second;
|
delete _mapping.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -80,9 +79,9 @@ bool TestRunner::run(const std::vector<std::string>& args, const Test::Callback&
|
|||||||
}
|
}
|
||||||
else if (arg == "-print")
|
else if (arg == "-print")
|
||||||
{
|
{
|
||||||
for (Mappings::iterator it = _mappings.begin(); it != _mappings.end(); ++it)
|
for (auto& _mapping : _mappings)
|
||||||
{
|
{
|
||||||
print(it->first, it->second, 0);
|
print(_mapping.first, _mapping.second, 0);
|
||||||
}
|
}
|
||||||
printed = true;
|
printed = true;
|
||||||
continue;
|
continue;
|
||||||
@ -104,8 +103,8 @@ bool TestRunner::run(const std::vector<std::string>& args, const Test::Callback&
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Test* testToRun = 0;
|
Test* testToRun = nullptr;
|
||||||
for (Mappings::iterator it = _mappings.begin(); !testToRun && it != _mappings.end(); ++it)
|
for (auto it = _mappings.begin(); !testToRun && it != _mappings.end(); ++it)
|
||||||
{
|
{
|
||||||
testToRun = find(testCase, it->second, it->first);
|
testToRun = find(testCase, it->second, it->first);
|
||||||
}
|
}
|
||||||
@ -124,18 +123,18 @@ bool TestRunner::run(const std::vector<std::string>& args, const Test::Callback&
|
|||||||
if (all)
|
if (all)
|
||||||
{
|
{
|
||||||
tests.clear();
|
tests.clear();
|
||||||
for (Mappings::iterator it = _mappings.begin(); it != _mappings.end(); ++it)
|
for (auto& _mapping : _mappings)
|
||||||
{
|
{
|
||||||
collectAllTestCases(it->second, tests);
|
collectAllTestCases(_mapping.second, tests);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextTestResult result(_ostr, ignore);
|
TextTestResult result(_ostr, ignore);
|
||||||
for (std::vector<Test*>::const_iterator it = tests.begin(); it != tests.end(); ++it)
|
for (auto testToRun : tests)
|
||||||
{
|
{
|
||||||
Test* testToRun = *it;
|
|
||||||
if(testToRun->getType() == Test::Long && !longRunning)
|
if(testToRun->getType() == Test::Long && !longRunning)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (setup.size() > 0)
|
if (setup.size() > 0)
|
||||||
testToRun->addSetup(setup);
|
testToRun->addSetup(setup);
|
||||||
|
|
||||||
@ -163,7 +162,7 @@ bool TestRunner::run(const std::vector<std::string>& args, const Test::Callback&
|
|||||||
|
|
||||||
void TestRunner::addTest(const std::string& name, Test* test)
|
void TestRunner::addTest(const std::string& name, Test* test)
|
||||||
{
|
{
|
||||||
_mappings.push_back(Mapping(name, test));
|
_mappings.emplace_back(name, test);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -176,9 +175,9 @@ void TestRunner::print(const std::string& name, Test* pTest, int indent)
|
|||||||
if (pSuite)
|
if (pSuite)
|
||||||
{
|
{
|
||||||
const std::vector<Test*>& tests = pSuite->tests();
|
const std::vector<Test*>& tests = pSuite->tests();
|
||||||
for (std::vector<Test*>::const_iterator it = tests.begin(); it != tests.end(); ++it)
|
for (auto* test : tests)
|
||||||
{
|
{
|
||||||
print((*it)->toString(), *it, indent + 1);
|
print(test->toString(), test, indent + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -192,17 +191,17 @@ Test* TestRunner::find(const std::string& name, Test* pTest, const std::string&
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TestSuite* pSuite = dynamic_cast<TestSuite*>(pTest);
|
auto* pSuite = dynamic_cast<TestSuite*>(pTest);
|
||||||
if (pSuite)
|
if (pSuite)
|
||||||
{
|
{
|
||||||
const std::vector<Test*>& tests = pSuite->tests();
|
const std::vector<Test*>& tests = pSuite->tests();
|
||||||
for (std::vector<Test*>::const_iterator it = tests.begin(); it != tests.end(); ++it)
|
for (auto* test : tests)
|
||||||
{
|
{
|
||||||
Test* result = find(name, *it, (*it)->toString());
|
Test* result = find(name, test, test->toString());
|
||||||
if (result) return result;
|
if (result) return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,14 +211,14 @@ int TestRunner::collectAllTestCases(Test* pTest, std::vector<Test*>& testcases)
|
|||||||
int added = 0;
|
int added = 0;
|
||||||
if (pTest->getType() == Test::Suite)
|
if (pTest->getType() == Test::Suite)
|
||||||
{
|
{
|
||||||
TestSuite* pSuite = dynamic_cast<TestSuite*>(pTest);
|
auto* pSuite = dynamic_cast<TestSuite*>(pTest);
|
||||||
|
|
||||||
if (pSuite)
|
if (pSuite)
|
||||||
{
|
{
|
||||||
const std::vector<Test*>& tests = pSuite->tests();
|
const std::vector<Test*>& tests = pSuite->tests();
|
||||||
for (std::vector<Test*>::const_iterator it = tests.begin(); it != tests.end(); ++it)
|
for (auto* test : tests)
|
||||||
{
|
{
|
||||||
added += collectAllTestCases(*it, testcases);
|
added += collectAllTestCases(test, testcases);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,22 +13,22 @@ namespace CppUnit {
|
|||||||
// Deletes all tests in the suite.
|
// Deletes all tests in the suite.
|
||||||
void TestSuite::deleteContents()
|
void TestSuite::deleteContents()
|
||||||
{
|
{
|
||||||
for (std::vector<Test*>::iterator it = _tests.begin(); it != _tests.end(); ++it)
|
for (auto* _test : _tests)
|
||||||
delete *it;
|
delete _test;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Runs the tests and collects their result in a TestResult.
|
// Runs the tests and collects their result in a TestResult.
|
||||||
void TestSuite::run(TestResult *result, const Test::Callback& callback)
|
void TestSuite::run(TestResult *result, const Test::Callback& callback)
|
||||||
{
|
{
|
||||||
for (std::vector<Test*>::iterator it = _tests.begin(); it != _tests.end(); ++it)
|
for (auto* test : _tests)
|
||||||
{
|
{
|
||||||
if (result->shouldStop())
|
if (result->shouldStop())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
Test *test = *it;
|
|
||||||
if (!setup().empty())
|
if (!setup().empty())
|
||||||
test->addSetup(setup());
|
test->addSetup(setup());
|
||||||
|
|
||||||
test->run(result, callback);
|
test->run(result, callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,8 +39,8 @@ int TestSuite::countTestCases() const
|
|||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for (std::vector<Test*>::const_iterator it = _tests.begin(); it != _tests.end(); ++it)
|
for (auto* _test : _tests)
|
||||||
count += (*it)->countTestCases();
|
count += _test->countTestCases();
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ file(GLOB SRCS_G ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
|
|||||||
POCO_SOURCES_AUTO(DATA_TEST_LIB_SRCS ${SRCS_G})
|
POCO_SOURCES_AUTO(DATA_TEST_LIB_SRCS ${SRCS_G})
|
||||||
|
|
||||||
# Headers
|
# 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})
|
POCO_HEADERS_AUTO(DATA_TEST_LIB_SRCS ${HDRS_G})
|
||||||
|
|
||||||
# Version Resource
|
# Version Resource
|
||||||
|
@ -14,15 +14,13 @@
|
|||||||
#define DataTest_SQLExecutor_INCLUDED
|
#define DataTest_SQLExecutor_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
|
#include "CppUnit/TestCase.h"
|
||||||
#include "Poco/Data/Test/DataTest.h"
|
#include "Poco/Data/Test/DataTest.h"
|
||||||
#include "Poco/Data/Session.h"
|
#include "Poco/Data/Session.h"
|
||||||
#include "Poco/Data/BulkExtraction.h"
|
#include "Poco/Data/BulkExtraction.h"
|
||||||
#include "Poco/Data/BulkBinding.h"
|
#include "Poco/Data/BulkBinding.h"
|
||||||
#include "Poco/NumberFormatter.h"
|
|
||||||
#include "Poco/String.h"
|
|
||||||
#include "Poco/Exception.h"
|
#include "Poco/Exception.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string_view>
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
@ -55,7 +53,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
SQLExecutor(const std::string& name, Poco::Data::Session* pSession, Poco::Data::Session* pEncSession = nullptr, bool numberedPlaceHolders = false);
|
SQLExecutor(const std::string& name, Poco::Data::Session* pSession, Poco::Data::Session* pEncSession = nullptr, bool numberedPlaceHolders = false);
|
||||||
~SQLExecutor();
|
~SQLExecutor() override;
|
||||||
|
|
||||||
template <typename C>
|
template <typename C>
|
||||||
void connection(C& c, const std::string& connectString)
|
void connection(C& c, const std::string& connectString)
|
||||||
|
@ -45,9 +45,9 @@ class Diagnostics
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
inline static const unsigned int SQL_STATE_SIZE = SQL_SQLSTATE_SIZE + 1;
|
static constexpr unsigned int SQL_STATE_SIZE = SQL_SQLSTATE_SIZE + 1;
|
||||||
inline static const unsigned int SQL_MESSAGE_LENGTH = SQL_MAX_MESSAGE_LENGTH + 1;
|
static constexpr unsigned int SQL_MESSAGE_LENGTH = SQL_MAX_MESSAGE_LENGTH + 1;
|
||||||
inline static const unsigned int SQL_NAME_LENGTH = 128;
|
static constexpr unsigned int SQL_NAME_LENGTH = 128;
|
||||||
inline static const std::string DATA_TRUNCATED;
|
inline static const std::string DATA_TRUNCATED;
|
||||||
|
|
||||||
struct DiagnosticFields
|
struct DiagnosticFields
|
||||||
|
@ -32,12 +32,12 @@ class ODBCAccessTest: public CppUnit::TestCase
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ODBCAccessTest(const std::string& name);
|
ODBCAccessTest(const std::string& name);
|
||||||
~ODBCAccessTest();
|
~ODBCAccessTest() override;
|
||||||
|
|
||||||
void testSimpleAccess();
|
void testSimpleAccess();
|
||||||
|
|
||||||
void setUp();
|
void setUp() override;
|
||||||
void tearDown();
|
void tearDown() override;
|
||||||
|
|
||||||
static CppUnit::Test* suite();
|
static CppUnit::Test* suite();
|
||||||
|
|
||||||
|
@ -28,37 +28,37 @@ class ODBCDB2Test: public ODBCTest
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ODBCDB2Test(const std::string& name);
|
ODBCDB2Test(const std::string& name);
|
||||||
~ODBCDB2Test();
|
~ODBCDB2Test() override;
|
||||||
|
|
||||||
void testBareboneODBC();
|
void testBareboneODBC() override;
|
||||||
|
|
||||||
void testBLOB();
|
void testBLOB() override;
|
||||||
void testFilter();
|
void testFilter() override;
|
||||||
|
|
||||||
void testStoredProcedure();
|
void testStoredProcedure() override;
|
||||||
void testStoredProcedureAny();
|
void testStoredProcedureAny() override;
|
||||||
void testStoredProcedureDynamicVar();
|
void testStoredProcedureDynamicVar() override;
|
||||||
void testStoredFunction();
|
void testStoredFunction() override;
|
||||||
|
|
||||||
static CppUnit::Test* suite();
|
static CppUnit::Test* suite();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void dropObject(const std::string& type, const std::string& tableName);
|
void dropObject(const std::string& type, const std::string& tableName) override;
|
||||||
void recreateNullableTable();
|
void recreateNullableTable() override;
|
||||||
void recreatePersonTable();
|
void recreatePersonTable() override;
|
||||||
void recreatePersonBLOBTable();
|
void recreatePersonBLOBTable() override;
|
||||||
void recreatePersonDateTable();
|
void recreatePersonDateTable() override;
|
||||||
void recreatePersonTimeTable();
|
void recreatePersonTimeTable() override;
|
||||||
void recreatePersonDateTimeTable();
|
void recreatePersonDateTimeTable() override;
|
||||||
void recreateStringsTable();
|
void recreateStringsTable() override;
|
||||||
void recreateIntsTable();
|
void recreateIntsTable() override;
|
||||||
void recreateFloatsTable();
|
void recreateFloatsTable() override;
|
||||||
void recreateTuplesTable();
|
void recreateTuplesTable() override;
|
||||||
void recreateVectorsTable();
|
void recreateVectorsTable() override;
|
||||||
void recreateAnysTable();
|
void recreateAnysTable() override;
|
||||||
void recreateNullsTable(const std::string& notNull = "");
|
void recreateNullsTable(const std::string& notNull = "") override;
|
||||||
void recreateMiscTable();
|
void recreateMiscTable() override;
|
||||||
void recreateLogTable();
|
void recreateLogTable() override;
|
||||||
|
|
||||||
static ODBCTest::SessionPtr _pSession;
|
static ODBCTest::SessionPtr _pSession;
|
||||||
static ODBCTest::ExecPtr _pExecutor;
|
static ODBCTest::ExecPtr _pExecutor;
|
||||||
|
@ -31,39 +31,39 @@ class ODBCMySQLTest: public ODBCTest
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ODBCMySQLTest(const std::string& name);
|
ODBCMySQLTest(const std::string& name);
|
||||||
~ODBCMySQLTest();
|
~ODBCMySQLTest() override;
|
||||||
|
|
||||||
void testBareboneODBC();
|
void testBareboneODBC() override;
|
||||||
|
|
||||||
void testBLOB();
|
void testBLOB() override;
|
||||||
|
|
||||||
void testStoredProcedure();
|
void testStoredProcedure() override;
|
||||||
void testStoredFunction();
|
void testStoredFunction() override;
|
||||||
|
|
||||||
void testNull();
|
void testNull() override;
|
||||||
|
|
||||||
void testMultipleResults();
|
void testMultipleResults() override;
|
||||||
void testFilter();
|
void testFilter() override;
|
||||||
|
|
||||||
static CppUnit::Test* suite();
|
static CppUnit::Test* suite();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void dropObject(const std::string& type, const std::string& name);
|
void dropObject(const std::string& type, const std::string& name) override;
|
||||||
void recreateNullableTable();
|
void recreateNullableTable() override;
|
||||||
void recreatePersonTable();
|
void recreatePersonTable() override;
|
||||||
void recreatePersonBLOBTable();
|
void recreatePersonBLOBTable() override;
|
||||||
void recreatePersonDateTable();
|
void recreatePersonDateTable() override;
|
||||||
void recreatePersonTimeTable();
|
void recreatePersonTimeTable() override;
|
||||||
void recreatePersonDateTimeTable();
|
void recreatePersonDateTimeTable() override;
|
||||||
void recreateStringsTable();
|
void recreateStringsTable() override;
|
||||||
void recreateIntsTable();
|
void recreateIntsTable() override;
|
||||||
void recreateFloatsTable();
|
void recreateFloatsTable() override;
|
||||||
void recreateTuplesTable();
|
void recreateTuplesTable() override;
|
||||||
void recreateVectorsTable();
|
void recreateVectorsTable() override;
|
||||||
void recreateAnysTable();
|
void recreateAnysTable() override;
|
||||||
void recreateNullsTable(const std::string& notNull = "");
|
void recreateNullsTable(const std::string& notNull = "") override;
|
||||||
void recreateMiscTable();
|
void recreateMiscTable() override;
|
||||||
void recreateLogTable();
|
void recreateLogTable() override;
|
||||||
|
|
||||||
static ODBCTest::SessionPtr _pSession;
|
static ODBCTest::SessionPtr _pSession;
|
||||||
static ODBCTest::ExecPtr _pExecutor;
|
static ODBCTest::ExecPtr _pExecutor;
|
||||||
|
@ -30,47 +30,47 @@ class ODBCOracleTest: public ODBCTest
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ODBCOracleTest(const std::string& name);
|
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 testCursorStoredProcedure();
|
||||||
void testStoredFunction();
|
void testStoredFunction() override;
|
||||||
void testCursorStoredFunction();
|
void testCursorStoredFunction();
|
||||||
void testStoredProcedureAny();
|
void testStoredProcedureAny() override;
|
||||||
void testStoredProcedureDynamicVar();
|
void testStoredProcedureDynamicVar() override;
|
||||||
void testAutoTransaction();
|
void testAutoTransaction();
|
||||||
|
|
||||||
void testNull();
|
void testNull() override;
|
||||||
static CppUnit::Test* suite();
|
static CppUnit::Test* suite();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void testBarebone();
|
static void testBarebone();
|
||||||
|
|
||||||
void dropObject(const std::string& type, const std::string& name);
|
void dropObject(const std::string& type, const std::string& name) override;
|
||||||
void recreateNullableTable();
|
void recreateNullableTable() override;
|
||||||
void recreatePersonTable();
|
void recreatePersonTable() override;
|
||||||
void recreatePersonTupleTable();
|
void recreatePersonTupleTable() override;
|
||||||
void recreatePersonBLOBTable();
|
void recreatePersonBLOBTable() override;
|
||||||
void recreatePersonDateTable();
|
void recreatePersonDateTable() override;
|
||||||
void recreatePersonDateTimeTable();
|
void recreatePersonDateTimeTable() override;
|
||||||
void recreateStringsTable();
|
void recreateStringsTable() override;
|
||||||
void recreateIntsTable();
|
void recreateIntsTable() override;
|
||||||
void recreateFloatsTable();
|
void recreateFloatsTable() override;
|
||||||
void recreateTuplesTable();
|
void recreateTuplesTable() override;
|
||||||
void recreateVectorsTable();
|
void recreateVectorsTable() override;
|
||||||
void recreateAnysTable();
|
void recreateAnysTable() override;
|
||||||
void recreateNullsTable(const std::string& notNull = "");
|
void recreateNullsTable(const std::string& notNull = "") override;
|
||||||
void recreateMiscTable();
|
void recreateMiscTable() override;
|
||||||
void recreateLogTable();
|
void recreateLogTable() override;
|
||||||
void recreateUnicodeTable();
|
void recreateUnicodeTable() override;
|
||||||
|
|
||||||
static ODBCTest::SessionPtr _pSession;
|
static ODBCTest::SessionPtr _pSession;
|
||||||
static ODBCTest::ExecPtr _pExecutor;
|
static ODBCTest::ExecPtr _pExecutor;
|
||||||
|
@ -37,37 +37,37 @@ class ODBCPostgreSQLTest: public ODBCTest
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ODBCPostgreSQLTest(const std::string& name);
|
ODBCPostgreSQLTest(const std::string& name);
|
||||||
~ODBCPostgreSQLTest();
|
~ODBCPostgreSQLTest() override;
|
||||||
|
|
||||||
void testBareboneODBC();
|
void testBareboneODBC() override;
|
||||||
|
|
||||||
void testBLOB();
|
void testBLOB() override;
|
||||||
|
|
||||||
void testStoredFunction();
|
void testStoredFunction() override;
|
||||||
void testStoredFunctionAny();
|
void testStoredFunctionAny() override;
|
||||||
void testStoredFunctionDynamicAny();
|
void testStoredFunctionDynamicAny() override;
|
||||||
|
|
||||||
static CppUnit::Test* suite();
|
static CppUnit::Test* suite();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void dropObject(const std::string& type, const std::string& name);
|
void dropObject(const std::string& type, const std::string& name) override;
|
||||||
void recreateNullableTable();
|
void recreateNullableTable() override;
|
||||||
void recreatePersonTable();
|
void recreatePersonTable() override;
|
||||||
void recreatePersonBLOBTable();
|
void recreatePersonBLOBTable() override;
|
||||||
void recreatePersonDateTimeTable();
|
void recreatePersonDateTimeTable() override;
|
||||||
void recreatePersonDateTable();
|
void recreatePersonDateTable() override;
|
||||||
void recreatePersonTimeTable();
|
void recreatePersonTimeTable() override;
|
||||||
void recreateStringsTable();
|
void recreateStringsTable() override;
|
||||||
void recreateIntsTable();
|
void recreateIntsTable() override;
|
||||||
void recreateFloatsTable();
|
void recreateFloatsTable() override;
|
||||||
void recreateTuplesTable();
|
void recreateTuplesTable() override;
|
||||||
void recreateVectorsTable();
|
void recreateVectorsTable() override;
|
||||||
void recreateAnysTable();
|
void recreateAnysTable() override;
|
||||||
void recreateNullsTable(const std::string& notNull="");
|
void recreateNullsTable(const std::string& notNull = "") override;
|
||||||
void recreateBoolTable();
|
void recreateBoolTable() override;
|
||||||
void recreateMiscTable();
|
void recreateMiscTable() override;
|
||||||
void recreateLogTable();
|
void recreateLogTable() override;
|
||||||
void recreateUnicodeTable();
|
void recreateUnicodeTable() override;
|
||||||
|
|
||||||
void configurePLPgSQL();
|
void configurePLPgSQL();
|
||||||
/// Configures PL/pgSQL in the database. A reasonable defaults
|
/// Configures PL/pgSQL in the database. A reasonable defaults
|
||||||
|
@ -40,51 +40,51 @@ class ODBCSQLServerTest: public ODBCTest
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ODBCSQLServerTest(const std::string& name);
|
ODBCSQLServerTest(const std::string& name);
|
||||||
~ODBCSQLServerTest();
|
~ODBCSQLServerTest() override;
|
||||||
|
|
||||||
void testBareboneODBC();
|
void testBareboneODBC() override;
|
||||||
|
|
||||||
void testTempTable();
|
void testTempTable() override;
|
||||||
|
|
||||||
void testBLOB();
|
void testBLOB() override;
|
||||||
void testBigString();
|
void testBigString();
|
||||||
void testBigBatch();
|
void testBigBatch();
|
||||||
void testNull();
|
void testNull() override;
|
||||||
void testBulk();
|
void testBulk() override;
|
||||||
|
|
||||||
void testStoredProcedure();
|
void testStoredProcedure() override;
|
||||||
void testCursorStoredProcedure();
|
void testCursorStoredProcedure();
|
||||||
void testStoredProcedureAny();
|
void testStoredProcedureAny() override;
|
||||||
void testStoredProcedureDynamicVar();
|
void testStoredProcedureDynamicVar() override;
|
||||||
|
|
||||||
void testStoredProcedureReturn();
|
void testStoredProcedureReturn();
|
||||||
void testStoredFunction();
|
void testStoredFunction() override;
|
||||||
|
|
||||||
static CppUnit::Test* suite();
|
static CppUnit::Test* suite();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void dropObject(const std::string& type, const std::string& name);
|
void dropObject(const std::string& type, const std::string& name) override;
|
||||||
void recreateNullableTable();
|
void recreateNullableTable() override;
|
||||||
void recreatePersonTable();
|
void recreatePersonTable() override;
|
||||||
void recreatePersonBLOBTable();
|
void recreatePersonBLOBTable() override;
|
||||||
void recreatePersonBigStringTable();
|
void recreatePersonBigStringTable();
|
||||||
void recreatePersonDateTimeTable();
|
void recreatePersonDateTimeTable() override;
|
||||||
void recreatePersonDateTable() { /* no-op */ };
|
void recreatePersonDateTable() override { /* no-op */ };
|
||||||
void recreatePersonTimeTable() { /* no-op */ };
|
void recreatePersonTimeTable() override { /* no-op */ };
|
||||||
void recreateStringsTable();
|
void recreateStringsTable() override;
|
||||||
void recreateIntsTable();
|
void recreateIntsTable() override;
|
||||||
void recreateFloatsTable();
|
void recreateFloatsTable() override;
|
||||||
void recreateUUIDsTable();
|
void recreateUUIDsTable() override;
|
||||||
void recreateTuplesTable();
|
void recreateTuplesTable() override;
|
||||||
void recreateVectorTable();
|
void recreateVectorTable();
|
||||||
void recreateVectorsTable();
|
void recreateVectorsTable() override;
|
||||||
void recreateAnysTable();
|
void recreateAnysTable() override;
|
||||||
void recreateNullsTable(const std::string& notNull = "");
|
void recreateNullsTable(const std::string& notNull = "") override;
|
||||||
void recreateBoolTable();
|
void recreateBoolTable() override;
|
||||||
void recreateMiscTable();
|
void recreateMiscTable() override;
|
||||||
void recreateLogTable();
|
void recreateLogTable() override;
|
||||||
void recreateUnicodeTable();
|
void recreateUnicodeTable() override;
|
||||||
void recreateEncodingTables();
|
void recreateEncodingTables() override;
|
||||||
|
|
||||||
static SessionPtr _pSession;
|
static SessionPtr _pSession;
|
||||||
static SessionPtr _pEncSession;
|
static SessionPtr _pEncSession;
|
||||||
|
@ -28,29 +28,29 @@ class ODBCSQLiteTest: public ODBCTest
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ODBCSQLiteTest(const std::string& name);
|
ODBCSQLiteTest(const std::string& name);
|
||||||
~ODBCSQLiteTest();
|
~ODBCSQLiteTest() override;
|
||||||
|
|
||||||
void testBareboneODBC();
|
void testBareboneODBC() override;
|
||||||
void testAffectedRows();
|
void testAffectedRows() override;
|
||||||
void testNull();
|
void testNull() override;
|
||||||
|
|
||||||
static CppUnit::Test* suite();
|
static CppUnit::Test* suite();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void dropObject(const std::string& type, const std::string& name);
|
void dropObject(const std::string& type, const std::string& name) override;
|
||||||
void recreateNullableTable();
|
void recreateNullableTable() override;
|
||||||
void recreatePersonTable();
|
void recreatePersonTable() override;
|
||||||
void recreatePersonBLOBTable();
|
void recreatePersonBLOBTable() override;
|
||||||
void recreatePersonDateTimeTable();
|
void recreatePersonDateTimeTable() override;
|
||||||
void recreateStringsTable();
|
void recreateStringsTable() override;
|
||||||
void recreateIntsTable();
|
void recreateIntsTable() override;
|
||||||
void recreateFloatsTable();
|
void recreateFloatsTable() override;
|
||||||
void recreateTuplesTable();
|
void recreateTuplesTable() override;
|
||||||
void recreateVectorsTable();
|
void recreateVectorsTable() override;
|
||||||
void recreateAnysTable();
|
void recreateAnysTable() override;
|
||||||
void recreateNullsTable(const std::string& notNull = "");
|
void recreateNullsTable(const std::string& notNull = "") override;
|
||||||
void recreateMiscTable();
|
void recreateMiscTable() override;
|
||||||
void recreateLogTable();
|
void recreateLogTable() override;
|
||||||
|
|
||||||
static ODBCTest::SessionPtr _pSession;
|
static ODBCTest::SessionPtr _pSession;
|
||||||
static ODBCTest::ExecPtr _pExecutor;
|
static ODBCTest::ExecPtr _pExecutor;
|
||||||
|
@ -40,10 +40,10 @@ public:
|
|||||||
std::string& rPwd,
|
std::string& rPwd,
|
||||||
std::string& rConnectString);
|
std::string& rConnectString);
|
||||||
|
|
||||||
~ODBCTest();
|
~ODBCTest() override;
|
||||||
|
|
||||||
virtual void setUp();
|
void setUp() override;
|
||||||
virtual void tearDown();
|
void tearDown() override;
|
||||||
|
|
||||||
virtual void testBareboneODBC() = 0;
|
virtual void testBareboneODBC() = 0;
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ public:
|
|||||||
virtual void testReconnect();
|
virtual void testReconnect();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef Poco::Data::ODBC::Utility::DriverMap Drivers;
|
using Drivers = Poco::Data::ODBC::Utility::DriverMap;
|
||||||
|
|
||||||
virtual void dropObject(const std::string& type, const std::string& name);
|
virtual void dropObject(const std::string& type, const std::string& name);
|
||||||
virtual void recreateNullableTable();
|
virtual void recreateNullableTable();
|
||||||
|
@ -13,16 +13,13 @@
|
|||||||
#ifndef SQLExecutor_INCLUDED
|
#ifndef SQLExecutor_INCLUDED
|
||||||
#define SQLExecutor_INCLUDED
|
#define SQLExecutor_INCLUDED
|
||||||
|
|
||||||
|
#include "CppUnit/TestCase.h"
|
||||||
#include "Poco/Data/ODBC/ODBC.h"
|
|
||||||
#include "Poco/Data/ODBC/Utility.h"
|
|
||||||
#include "Poco/Data/ODBC/ODBCException.h"
|
#include "Poco/Data/ODBC/ODBCException.h"
|
||||||
#include "Poco/Data/Session.h"
|
#include "Poco/Data/Session.h"
|
||||||
#include "Poco/Data/BulkExtraction.h"
|
#include "Poco/Data/BulkExtraction.h"
|
||||||
#include "Poco/Data/BulkBinding.h"
|
#include "Poco/Data/BulkBinding.h"
|
||||||
#include "Poco/Data/Test/SQLExecutor.h"
|
#include "Poco/Data/Test/SQLExecutor.h"
|
||||||
#include "Poco/NumberFormatter.h"
|
#include "Poco/NumberFormatter.h"
|
||||||
#include "Poco/String.h"
|
|
||||||
#include "Poco/Exception.h"
|
#include "Poco/Exception.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@ -88,8 +85,10 @@ public:
|
|||||||
DE_BOUND
|
DE_BOUND
|
||||||
};
|
};
|
||||||
|
|
||||||
SQLExecutor(const std::string& name, Poco::Data::Session* pSession, Poco::Data::Session* pEncSession = 0);
|
SQLExecutor(const std::string& name,
|
||||||
~SQLExecutor();
|
Poco::Data::Session* pSession,
|
||||||
|
Poco::Data::Session* pEncSession = nullptr);
|
||||||
|
~SQLExecutor() override;
|
||||||
|
|
||||||
void execute(const std::string& sql);
|
void execute(const std::string& sql);
|
||||||
/// Execute a query.
|
/// Execute a query.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user