Loading...
Searching...
No Matches
Go to the documentation of this file.
2#include "tkvsdatabasepool.h"
7#include <QtTest/QtTest>
9#include <TSystemGlobal>
10#include <TStdErrSystemLogger>
11#include <TWebApplication>
13#include "tsqldatabasepool.h"
14#include <TActionThread>
17#include <TMultiplexingServer>
21#define TF_TEST_MAIN(TestObject) TF_TEST_SQL_MAIN(TestObject, true);
23#define TF_TEST_SQL_MAIN(TestObject, EnableTransactions) \
24 int main(int argc, char *argv[]) \
26 class Thread : public TActionThread { \
28 Thread() : TActionThread(0), returnCode(0) { } \
29 volatile int returnCode; \
34 setTransactionEnabled(EnableTransactions); \
36 returnCode = QTest::qExec(&obj, QCoreApplication::arguments()); \
37 commitTransactions(); \
38 for (QMap<int, TSqlTransaction>::iterator it = sqlDatabases.begin(); it != sqlDatabases.end(); ++it) { \
39 it.value().database().close(); \
41 for (QMap<int, TKvsDatabase>::iterator it = kvsDatabases.begin(); it != kvsDatabases.end(); ++it) { \
44 QEventLoop eventLoop; \
45 while (eventLoop.processEvents()) { \
49 TWebApplication app(argc, argv); \
50 Tf::setupSystemLogger(new TStdErrSystemLogger); \
51 app.setDatabaseEnvironment("test"); \
52 TUrlRoute::instance(); \
53 TSqlDatabasePool::instance(); \
54 TKvsDatabasePool::instance(); \
55 INIT_MULTIPLEXING_SERVER(); \
59 _exit(thread.returnCode); \
60 return thread.returnCode; \
64#define TF_TEST_SQLLESS_MAIN(TestObject) \
65 int main(int argc, char *argv[]) \
67 TWebApplication app(argc, argv); \
68 Tf::setupSystemLogger(new TStdErrSystemLogger); \
70 return QTest::qExec(&tc, argc, argv); \
75#define INIT_MULTIPLEXING_SERVER() TMultiplexingServer::instantiate(0)
77#define INIT_MULTIPLEXING_SERVER()