summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/client.pro2
-rw-r--r--client/lua.cc2
-rw-r--r--client/luapraxisd.cc169
-rw-r--r--client/luapraxisd.h35
-rw-r--r--client/praxisd.cc137
-rw-r--r--client/praxisd.h39
-rw-r--r--server/src/artefact.cc6
-rw-r--r--server/src/client_connection.cc6
-rw-r--r--server/src/connectionpool.cc2
-rw-r--r--server/src/connectionpool.h2
-rw-r--r--server/src/courselist.cc9
-rw-r--r--server/src/courseparser.cc6
-rw-r--r--server/src/environment.cc6
-rw-r--r--server/src/fieldnamescanner.cc4
-rw-r--r--server/src/httpd.cc6
-rw-r--r--server/src/inotify.cc6
-rw-r--r--server/src/journal.cc6
-rw-r--r--server/src/journal_commit.cc6
-rw-r--r--server/src/journal_uploadserver.cc6
-rw-r--r--server/src/luaoncommit.cc9
-rw-r--r--server/src/luapraxisd.cc2
-rw-r--r--server/src/luaquerymapper.cc6
-rw-r--r--server/src/luaresume.cc6
-rw-r--r--server/src/luascript.cc9
-rw-r--r--server/src/macroheaderparser.cc6
-rw-r--r--server/src/macroparser.cc6
-rw-r--r--server/src/mutex.cc2
-rw-r--r--server/src/pracrodaopgsql.cc10
-rw-r--r--server/src/pracrodaotest.cc10
-rw-r--r--server/src/praxisd.cc6
-rw-r--r--server/src/queryhandlerpentominos.cc6
-rw-r--r--server/src/queryhandlerpracro.cc4
-rw-r--r--server/src/queryparser.cc6
-rw-r--r--server/src/saxparser.cc6
-rw-r--r--server/src/server.cc9
-rw-r--r--server/src/session.cc12
-rw-r--r--server/src/sessionheaderparser.cc9
-rw-r--r--server/src/sessionparser.cc6
-rw-r--r--server/src/sessionserialiser.cc11
-rw-r--r--server/src/tcpsocket.cc6
-rw-r--r--server/src/templateheaderparser.cc6
-rw-r--r--server/src/templateparser.cc6
-rw-r--r--server/src/transactionhandler.cc6
-rw-r--r--server/src/transactionparser.cc6
-rw-r--r--server/src/util.cc6
-rw-r--r--server/src/widgetgenerator.cc2
-rw-r--r--server/src/widgetvalue.cc6
-rwxr-xr-xserver/tools/test2
48 files changed, 458 insertions, 184 deletions
diff --git a/client/client.pro b/client/client.pro
index e9b2c29..893d25d 100644
--- a/client/client.pro
+++ b/client/client.pro
@@ -40,7 +40,7 @@ HEADERS += \
launcherwindow.h \
lua.h \
luadb.h \
- luapraxisd.h \
+ ../server/src/luapraxisd.h \
luawidget.h \
macro.h \
macrowindow.h \
diff --git a/client/lua.cc b/client/lua.cc
index 48840ce..f017986 100644
--- a/client/lua.cc
+++ b/client/lua.cc
@@ -32,7 +32,7 @@
#include "luawidget.h"
#include "luadb.h"
-#include "luapraxisd.h"
+#include "../server/src/luapraxisd.h"
#include "debug.h"
diff --git a/client/luapraxisd.cc b/client/luapraxisd.cc
index 00ed961..3b8e430 100644
--- a/client/luapraxisd.cc
+++ b/client/luapraxisd.cc
@@ -25,7 +25,7 @@
* along with Pracro; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#include "luapraxisd.h"
+#include "../server/src/luapraxisd.h"
#include "praxisd.h"
@@ -41,7 +41,28 @@ typedef struct px_userdata {
PraxisdSync *px;
} px_userdata;
-static int px_getcave(lua_State *L)
+int px_addcave(lua_State *L)
+{
+ lua_pushstring(L, "Add cave not implemented on client.");
+ lua_error(L);
+ return 0;
+}
+
+int px_addbehandling(lua_State *L)
+{
+ lua_pushstring(L, "Add behandling not implemented on client.");
+ lua_error(L);
+ return 0;
+}
+
+int px_adddiagnose(lua_State *L)
+{
+ lua_pushstring(L, "Add diagnose not implemented on client.");
+ lua_error(L);
+ return 0;
+}
+
+int px_getcave(lua_State *L)
{
px_userdata *pxu;
pxu = (px_userdata *)luaL_checkudata(L, 1, "Praxisd");
@@ -81,7 +102,81 @@ static int px_getcave(lua_State *L)
return 1;
}
-static int px_cavelist(lua_State *L)
+int px_getbehandling(lua_State *L)
+{
+ px_userdata *pxu;
+ pxu = (px_userdata *)luaL_checkudata(L, 1, "Praxisd");
+ luaL_argcheck(L, pxu, 1, "Praxisd expected");
+
+ const char *cpr = luaL_checkstring(L, 2);
+
+ QVector<QString> behandlinglist;
+
+ Patient patient = pxu->px->patient_get_by_cpr(cpr);
+ if(pxu->px->hasError()) {
+ lua_pushstring(L, pxu->px->errorString().toStdString().c_str());
+ lua_error(L);
+ return 1;
+ }
+ QVector<sogeord_t>::iterator i = patient.sogeord.begin();
+ while(i != patient.sogeord.end()) {
+ QString behandlingsogeord = i->sogenr;//.mid(1, i->sogenr.size() - 1);
+ QVector<behandling_t> behandling = pxu->px->diverse_get_behandling(behandlingsogeord);
+ if(behandling.size() == 1) behandlinglist.push_back(i->sogetxt);
+ i++;
+ }
+
+ lua_createtable(L, 0, behandlinglist.size());
+ int top = lua_gettop(L);
+
+ for(int i = 0; i < behandlinglist.size(); i++) {
+ QString c = behandlinglist[i];
+ DEBUG(behandlinglist, "BEHANDLING '%s'\n", c.toStdString().c_str());
+ lua_pushstring(L, c.toStdString().c_str());
+ lua_rawseti(L, top, i);
+ }
+
+ return 1;
+}
+
+int px_getdiagnose(lua_State *L)
+{
+ px_userdata *pxu;
+ pxu = (px_userdata *)luaL_checkudata(L, 1, "Praxisd");
+ luaL_argcheck(L, pxu, 1, "Praxisd expected");
+
+ const char *cpr = luaL_checkstring(L, 2);
+
+ QVector<QString> diagnoselist;
+
+ Patient patient = pxu->px->patient_get_by_cpr(cpr);
+ if(pxu->px->hasError()) {
+ lua_pushstring(L, pxu->px->errorString().toStdString().c_str());
+ lua_error(L);
+ return 1;
+ }
+ QVector<sogeord_t>::iterator i = patient.sogeord.begin();
+ while(i != patient.sogeord.end()) {
+ QString diagnosesogeord = i->sogenr;//.mid(1, i->sogenr.size() - 1);
+ QVector<diagnose_t> diagnose = pxu->px->diverse_get_diagnose(diagnosesogeord);
+ if(diagnose.size() == 1) diagnoselist.push_back(i->sogetxt);
+ i++;
+ }
+
+ lua_createtable(L, 0, diagnoselist.size());
+ int top = lua_gettop(L);
+
+ for(int i = 0; i < diagnoselist.size(); i++) {
+ QString c = diagnoselist[i];
+ DEBUG(diagnoselist, "DIAGNOSE '%s'\n", c.toStdString().c_str());
+ lua_pushstring(L, c.toStdString().c_str());
+ lua_rawseti(L, top, i);
+ }
+
+ return 1;
+}
+
+int px_cavelist(lua_State *L)
{
px_userdata *pxu;
pxu = (px_userdata *)luaL_checkudata(L, 1, "Praxisd");
@@ -107,7 +202,59 @@ static int px_cavelist(lua_State *L)
return 1;
}
-static int px_new(lua_State *L)
+int px_behandlinglist(lua_State *L)
+{
+ px_userdata *pxu;
+ pxu = (px_userdata *)luaL_checkudata(L, 1, "Praxisd");
+ luaL_argcheck(L, pxu, 1, "Praxisd expected");
+
+ QVector<behandling_t> behandlinglist = pxu->px->diverse_get_behandling("C");
+ if(pxu->px->hasError()) {
+ lua_pushstring(L, pxu->px->errorString().toStdString().c_str());
+ lua_error(L);
+ return 1;
+ }
+
+ lua_createtable(L, 0, behandlinglist.size());
+ int top = lua_gettop(L);
+
+ for(size_t i = 0; i < (size_t)behandlinglist.size(); i++) {
+ QString c = behandlinglist[i].behandling;
+ DEBUG(behandlinglist, "BEHANDLING '%s'\n", c.toStdString().c_str());
+ lua_pushstring(L, c.toStdString().c_str());
+ lua_rawseti(L, top, i);
+ }
+
+ return 1;
+}
+
+int px_diagnoselist(lua_State *L)
+{
+ px_userdata *pxu;
+ pxu = (px_userdata *)luaL_checkudata(L, 1, "Praxisd");
+ luaL_argcheck(L, pxu, 1, "Praxisd expected");
+
+ QVector<diagnose_t> diagnoselist = pxu->px->diverse_get_diagnose("C");
+ if(pxu->px->hasError()) {
+ lua_pushstring(L, pxu->px->errorString().toStdString().c_str());
+ lua_error(L);
+ return 1;
+ }
+
+ lua_createtable(L, 0, diagnoselist.size());
+ int top = lua_gettop(L);
+
+ for(size_t i = 0; i < (size_t)diagnoselist.size(); i++) {
+ QString c = diagnoselist[i].diagnose;
+ DEBUG(diagnoselist, "DIAGNOSE '%s'\n", c.toStdString().c_str());
+ lua_pushstring(L, c.toStdString().c_str());
+ lua_rawseti(L, top, i);
+ }
+
+ return 1;
+}
+
+int px_new(lua_State *L)
{
const char *host = luaL_checkstring(L, 1);
int port = luaL_checknumber(L, 2);
@@ -123,7 +270,7 @@ static int px_new(lua_State *L)
return 1;
}
-static int px_gc(lua_State *L)
+int px_gc(lua_State *L)
{
px_userdata *pxu;
@@ -135,18 +282,6 @@ static int px_gc(lua_State *L)
return 0;
}
-static const struct luaL_Reg px_meths[] = {
- {"__gc" ,px_gc},
- {"cavelist", px_cavelist},
- {"getcave", px_getcave},
- {NULL, NULL}
-};
-
-static const struct luaL_reg px_funcs[] = {
- {"new", px_new},
- {NULL, NULL}
-};
-
void register_praxisd(lua_State *L)
{
luaL_newmetatable(L, "Praxisd");
diff --git a/client/luapraxisd.h b/client/luapraxisd.h
deleted file mode 100644
index 86be31f..0000000
--- a/client/luapraxisd.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set et sw=2 ts=2: */
-/***************************************************************************
- * luapraxisd.h
- *
- * Thu May 5 11:16:20 CEST 2011
- * Copyright 2011 Bent Bisballe Nyeng
- * deva@aasimon.org
- ****************************************************************************/
-
-/*
- * This file is part of Pracro.
- *
- * Pracro is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Pracro is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Pracro; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-#ifndef __PRACRO_LUAPRAXISD_H__
-#define __PRACRO_LUAPRAXISD_H__
-
-#include <lua.hpp>
-
-void register_praxisd(lua_State *L);
-
-#endif/*__PRACRO_LUAPRAXISD_H__*/
diff --git a/client/praxisd.cc b/client/praxisd.cc
index 2fbaddc..42fdd0c 100644
--- a/client/praxisd.cc
+++ b/client/praxisd.cc
@@ -68,6 +68,75 @@ static CaveVector getCaveList(QByteArray data)
return cavelist;
}
+#define DOBEHANDLING(x) if(element.tagName() == #x) behandling.x = element.text()
+static BehandlingVector getBehandlingList(QByteArray data)
+{
+ QDomDocument doc;
+ doc.setContent(data);
+
+ BehandlingVector behandlinglist;
+
+ QDomNode praxisd = doc.documentElement();
+ QDomNodeList nodes = praxisd.childNodes();
+ for(int i = 0; i < nodes.count(); i++) {
+ QDomNode node = nodes.at(i);
+ QDomElement element = node.toElement();
+ if(element.tagName() == "div_behandling") {
+
+ behandling_t behandling;
+ behandling.sogenr = element.attribute("sogenr");
+
+ QDomNodeList nodes = element.childNodes();
+ for(int j = 0; j < nodes.count(); j++) {
+ QDomNode node = nodes.at(j);
+ QDomElement element = node.toElement();
+ DOBEHANDLING(kode);
+ DOBEHANDLING(behandling);
+ DOBEHANDLING(bemaerkning);
+ DOBEHANDLING(udregning);
+ }
+
+ behandlinglist.push_back(behandling);
+ }
+ }
+
+ return behandlinglist;
+}
+
+#define DODIAGNOSE(x) if(element.tagName() == #x) diagnose.x = element.text()
+static DiagnoseVector getDiagnoseList(QByteArray data)
+{
+ QDomDocument doc;
+ doc.setContent(data);
+
+ DiagnoseVector diagnoselist;
+
+ QDomNode praxisd = doc.documentElement();
+ QDomNodeList nodes = praxisd.childNodes();
+ for(int i = 0; i < nodes.count(); i++) {
+ QDomNode node = nodes.at(i);
+ QDomElement element = node.toElement();
+ if(element.tagName() == "div_diagnose") {
+
+ diagnose_t diagnose;
+ diagnose.sogenr = element.attribute("sogenr");
+
+ QDomNodeList nodes = element.childNodes();
+ for(int j = 0; j < nodes.count(); j++) {
+ QDomNode node = nodes.at(j);
+ QDomElement element = node.toElement();
+ DODIAGNOSE(kode);
+ DODIAGNOSE(diagnose);
+ DODIAGNOSE(bemaerkning);
+ }
+
+ diagnoselist.push_back(diagnose);
+ }
+ }
+
+ return diagnoselist;
+}
+
#define DOPATIENT(x) if(element.tagName() == #x) patient.x = element.text()
static Patient getPatient(QByteArray data)
{
@@ -208,6 +277,14 @@ void Praxisd::replyFinished(QNetworkReply *reply)
emit gotCaveList(getCaveList(reply->readAll()));
break;
+ case behandlinglist:
+ emit gotBehandlingList(getBehandlingList(reply->readAll()));
+ break;
+
+ case diagnoselist:
+ emit gotDiagnoseList(getDiagnoseList(reply->readAll()));
+ break;
+
case patient:
emit gotPatient(getPatient(reply->readAll()));
break;
@@ -264,6 +341,20 @@ void Praxisd::diverse_get_cave(QString sogenr)
makeTransfer(cavelist, "/praxisd/1.0/diverse/get_all_by_sogenr", params);
}
+void Praxisd::diverse_get_behandling(QString sogenr)
+{
+ QMap<QString, QString> params;
+ params["sogenr"] = sogenr;
+ makeTransfer(behandlinglist, "/praxisd/1.0/diverse/get_all_by_sogenr", params);
+}
+
+void Praxisd::diverse_get_diagnose(QString sogenr)
+{
+ QMap<QString, QString> params;
+ params["sogenr"] = sogenr;
+ makeTransfer(diagnoselist, "/praxisd/1.0/diverse/get_all_by_sogenr", params);
+}
+
void Praxisd::patient_get_by_cpr(QString cpr)
{
QMap<QString, QString> params;
@@ -317,6 +408,10 @@ void PraxisdSync::run()
connect(&praxisd, SIGNAL(gotCaveList(CaveVector)),
this, SLOT(gotCaveList(CaveVector)), Qt::DirectConnection);
+ connect(&praxisd, SIGNAL(gotBehandlingList(BehandlingVector)),
+ this, SLOT(gotBehandlingList(BehandlingVector)), Qt::DirectConnection);
+ connect(&praxisd, SIGNAL(gotDiagnoseList(DiagnoseVector)),
+ this, SLOT(gotDiagnoseList(DiagnoseVector)), Qt::DirectConnection);
connect(&praxisd, SIGNAL(gotPatient(Patient)),
this, SLOT(gotPatient(Patient)), Qt::DirectConnection);
@@ -339,6 +434,12 @@ void PraxisdSync::run()
case Praxisd::cavelist:
praxisd.diverse_get_cave(request_sogenr);
break;
+ case Praxisd::behandlinglist:
+ praxisd.diverse_get_behandling(request_sogenr);
+ break;
+ case Praxisd::diagnoselist:
+ praxisd.diverse_get_diagnose(request_sogenr);
+ break;
case Praxisd::patient:
praxisd.patient_get_by_cpr(request_cpr);
break;
@@ -380,6 +481,20 @@ void PraxisdSync::gotCaveList(CaveVector cl)
quit();
}
+void PraxisdSync::gotBehandlingList(BehandlingVector bl)
+{
+ behandlinglist = bl;
+ rsem.release();
+ quit();
+}
+
+void PraxisdSync::gotDiagnoseList(DiagnoseVector dl)
+{
+ diagnoselist = dl;
+ rsem.release();
+ quit();
+}
+
void PraxisdSync::gotPatient(Patient p)
{
patient = p;
@@ -410,6 +525,28 @@ CaveVector PraxisdSync::diverse_get_cave(QString sogenr)
return cavelist;
}
+BehandlingVector PraxisdSync::diverse_get_behandling(QString sogenr)
+{
+ request_type = Praxisd::behandlinglist;
+ request_sogenr = sogenr;
+
+ wsem.release();
+ rsem.acquire();
+
+ return behandlinglist;
+}
+
+DiagnoseVector PraxisdSync::diverse_get_diagnose(QString sogenr)
+{
+ request_type = Praxisd::diagnoselist;
+ request_sogenr = sogenr;
+
+ wsem.release();
+ rsem.acquire();
+
+ return diagnoselist;
+}
+
Patient PraxisdSync::patient_get_by_cpr(QString cpr)
{
request_type = Praxisd::patient;
diff --git a/client/praxisd.h b/client/praxisd.h
index 507e63e..38404da 100644
--- a/client/praxisd.h
+++ b/client/praxisd.h
@@ -49,6 +49,23 @@ typedef struct {
typedef struct {
QString sogenr;
+ QString kode;
+ QString behandling;
+ QString bemaerkning;
+ QString udregning;
+} behandling_t;
+//std::vector<behandling_t> diverse_get_behandling(std::string sogenr)
+
+typedef struct {
+ QString sogenr;
+ QString kode;
+ QString diagnose;
+ QString bemaerkning;
+} diagnose_t;
+// std::vector<diagnose_t> diverse_get_diagnose(std::string sogenr)
+
+typedef struct {
+ QString sogenr;
QString sogedato;
QString sogetxt;
} sogeord_t;
@@ -101,6 +118,9 @@ typedef struct {
} dokmenu_t;
typedef QVector<cave_t> CaveVector;
+typedef QVector<behandling_t> BehandlingVector;
+typedef QVector<diagnose_t> DiagnoseVector;
+
typedef patient_t Patient;
typedef QVector<dokmenu_t> DokMenuVector;
@@ -110,6 +130,8 @@ public:
typedef enum {
journal,
cavelist,
+ behandlinglist,
+ diagnoselist,
patient,
dokmenu,
dokmenufile
@@ -120,6 +142,8 @@ public:
void journal_get_by_cpr(QString patientid);
void diverse_get_cave(QString sogenr);
+ void diverse_get_behandling(QString sogenr);
+ void diverse_get_diagnose(QString sogenr);
void patient_get_by_cpr(QString cpr);
@@ -132,7 +156,11 @@ signals:
void networkError(QString text);
void gotJournal(QString data);
+
void gotCaveList(CaveVector cave);
+ void gotBehandlingList(BehandlingVector cave);
+ void gotDiagnoseList(DiagnoseVector cave);
+
void gotPatient(Patient patient);
void gotDokMenu(DokMenuVector dokmenu);
void gotDokMenuFile(QByteArray data, QString mimetype);
@@ -159,7 +187,11 @@ public:
~PraxisdSync();
QString journal_get_by_cpr(QString patientid);
+
CaveVector diverse_get_cave(QString sogenr);
+ BehandlingVector diverse_get_behandling(QString sogenr);
+ DiagnoseVector diverse_get_diagnose(QString sogenr);
+
Patient patient_get_by_cpr(QString cpr);
DokMenuVector dokmenu_get_all_by_cpr(QString cpr);
QString dokmenu_get_by_cpr_and_name(QString cpr, QString name);
@@ -171,7 +203,11 @@ public:
private slots:
void networkError(QString);
+
void gotCaveList(CaveVector);
+ void gotBehandlingList(BehandlingVector);
+ void gotDiagnoseList(DiagnoseVector);
+
void gotPatient(Patient);
void gotDokMenu(DokMenuVector);
@@ -187,6 +223,9 @@ private:
QString request_cpr;
CaveVector cavelist;
+ BehandlingVector behandlinglist;
+ DiagnoseVector diagnoselist;
+
Patient patient;
DokMenuVector dokmenu;
diff --git a/server/src/artefact.cc b/server/src/artefact.cc
index 8c6b81a..48b8174 100644
--- a/server/src/artefact.cc
+++ b/server/src/artefact.cc
@@ -152,9 +152,9 @@ QueryResult Artefact::exec(Query &query,
#ifdef TEST_ARTEFACT
-//deps: configuration.cc debug.cc log.cc
-//cflags: $(ATF_CFLAGS) -I..
-//libs: $(ATF_LIBS)
+//deps: configuration.cc debug.cc log.cc mutex.cc
+//cflags: -I.. $(ATF_CFLAGS) $(PTHREAD_CFLAGS)
+//libs: $(ATF_LIBS) $(PTHREAD_LIBS)
#include "test.h"
TEST_BEGIN;
diff --git a/server/src/client_connection.cc b/server/src/client_connection.cc
index c3de7b0..c952ca7 100644
--- a/server/src/client_connection.cc
+++ b/server/src/client_connection.cc
@@ -256,7 +256,7 @@ void ClientConnection::getReply(Httpd::Reply &reply)
}
#ifdef TEST_CLIENT_CONNECTION
-//deps: debug.cc transactionparser.cc session.cc xml_encode_decode.cc saxparser.cc transactionhandler.cc journal.cc mutex.cc templateparser.cc exception.cc configuration.cc macroparser.cc semaphore.cc entitylist.cc luaquerymapper.cc inotify.cc log.cc queryhandlerpentominos.cc widgetgenerator.cc queryhandlerpracro.cc resumeparser.cc journal_commit.cc versionstr.cc luaresume.cc luautil.cc artefact.cc environment.cc database.cc macrolist.cc templatelist.cc pracrodao.cc templateheaderparser.cc macroheaderparser.cc pracrodaotest.cc pracrodaopgsql.cc journal_uploadserver.cc sessionserialiser.cc sessionparser.cc widgetvalue.cc courseparser.cc praxisd.cc luapraxisd.cc courselist.cc
+//deps: debug.cc transactionparser.cc session.cc xml_encode_decode.cc saxparser.cc transactionhandler.cc journal.cc mutex.cc templateparser.cc exception.cc configuration.cc macroparser.cc semaphore.cc entitylist.cc luaquerymapper.cc inotify.cc log.cc queryhandlerpentominos.cc widgetgenerator.cc queryhandlerpracro.cc journal_commit.cc versionstr.cc luaresume.cc luautil.cc artefact.cc environment.cc database.cc macrolist.cc templatelist.cc pracrodao.cc templateheaderparser.cc macroheaderparser.cc pracrodaotest.cc pracrodaopgsql.cc journal_uploadserver.cc sessionserialiser.cc sessionparser.cc widgetvalue.cc courseparser.cc praxisd.cc luapraxisd.cc courselist.cc luascript.cc sessionheaderparser.cc luaoncommit.cc
//cflags: -DWITHOUT_DATABASE -DWITHOUT_ARTEFACT -I.. $(LUA_CFLAGS) $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) $(PQXX_CXXFLAGS) $(CURL_CFLAGS)
//libs: $(LUA_LIBS) $(EXPAT_LIBS) $(PTHREAD_LIBS) $(PQXX_LIBS) $(CURL_LIBS)
#include "test.h"
@@ -315,7 +315,7 @@ std::string sid;
{
headers_t hdrs;
ClientConnection con(env, hdrs, hdrs, "/test");
- TEST_TRUE(con.handle("", 0), "Test handler return value.");
+ TEST_TRUE(con.handle(), "Test handler return value.");
con.getReply(reply);
TEST_NOTEQUAL_STR(reply.data, empty_reply, "Did we get nonemtpy reply?");
TEST_NOTEQUAL_STR(reply.headers["SessionID"], "",
@@ -327,7 +327,7 @@ std::string sid;
{
headers_t hdrs;
ClientConnection con(env, hdrs, hdrs, "/test/test");
- TEST_TRUE(con.handle("", 0), "Test handler return value.");
+ TEST_TRUE(con.handle(), "Test handler return value.");
con.getReply(reply);
TEST_EQUAL_STR(reply.data, empty_reply, "Did we get an empty reponse?");
TEST_NOTEQUAL_STR(reply.headers["SessionID"], "", "Non empty session id?");
diff --git a/server/src/connectionpool.cc b/server/src/connectionpool.cc
index e2b6bfc..16cfd68 100644
--- a/server/src/connectionpool.cc
+++ b/server/src/connectionpool.cc
@@ -33,7 +33,7 @@
#ifdef TEST_CONNECTIONPOOL
//deps: mutex.cc semaphore.cc
-//cflags: $(PTHREAD_CFLAGS)
+//cflags: -I.. $(PTHREAD_CFLAGS)
//libs: $(PTHREAD_LIBS)
#include <test.h>
#include <unistd.h>
diff --git a/server/src/connectionpool.h b/server/src/connectionpool.h
index 33473e5..0f1c844 100644
--- a/server/src/connectionpool.h
+++ b/server/src/connectionpool.h
@@ -133,7 +133,7 @@ int ConnectionPool<T>::numFree()
template <class T>
T ConnectionPool<T>::borrow()
{
- T t = NULL;
+ T t;
semaphore.wait();
diff --git a/server/src/courselist.cc b/server/src/courselist.cc
index b6d2b29..b2a33c5 100644
--- a/server/src/courselist.cc
+++ b/server/src/courselist.cc
@@ -58,12 +58,9 @@ void CourseList::addFile(std::string file)
}
#ifdef TEST_COURSELIST
-//Additional dependency files
-//deps:
-//Required cflags (autoconf vars may be used)
-//cflags:
-//Required link options (autoconf vars may be used)
-//libs:
+//deps: entitylist.cc mutex.cc inotify.cc debug.cc courseparser.cc saxparser.cc exception.cc versionstr.cc log.cc
+//cflags: -I .. $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS)
+//libs: $(PTHREAD_LIBS) $(EXPAT_LIBS)
#include "test.h"
TEST_BEGIN;
diff --git a/server/src/courseparser.cc b/server/src/courseparser.cc
index af78ca1..0a9bbd9 100644
--- a/server/src/courseparser.cc
+++ b/server/src/courseparser.cc
@@ -160,9 +160,9 @@ Course *CourseParser::getCourse()
}
#ifdef TEST_COURSEPARSER
-//deps: saxparser.cc debug.cc log.cc exception.cc
-//cflags: -I.. $(EXPAT_CFLAGS)
-//libs: $(EXPAT_LIBS)
+//deps: saxparser.cc debug.cc log.cc exception.cc mutex.cc
+//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS)
+//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS)
#include "test.h"
TEST_BEGIN;
diff --git a/server/src/environment.cc b/server/src/environment.cc
index d232174..fc9c75c 100644
--- a/server/src/environment.cc
+++ b/server/src/environment.cc
@@ -68,9 +68,9 @@ Environment::~Environment()
}
#ifdef TEST_ENVIRONMENT
-//deps: configuration.cc database.cc artefact.cc pracrodao.cc session.cc mutex.cc semaphore.cc debug.cc pracrodaotest.cc pracrodaopgsql.cc journal.cc journal_commit.cc entitylist.cc inotify.cc exception.cc versionstr.cc tcpsocket.cc macrolist.cc templatelist.cc saxparser.cc log.cc macroheaderparser.cc templateheaderparser.cc sessionserialiser.cc journal_uploadserver.cc xml_encode_decode.cc sessionparser.cc
-//cflags: -DWITHOUT_ARTEFACT -I.. $(PQXX_CXXFLAGS) $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS)
-//libs: $(PQXX_LIBS) -lpthread $(EXPAT_LIBS) $(PTHREAD_LIBS)
+//deps: configuration.cc database.cc artefact.cc pracrodao.cc session.cc mutex.cc semaphore.cc debug.cc pracrodaotest.cc pracrodaopgsql.cc journal.cc journal_commit.cc entitylist.cc inotify.cc exception.cc versionstr.cc tcpsocket.cc macrolist.cc templatelist.cc saxparser.cc log.cc macroheaderparser.cc templateheaderparser.cc sessionserialiser.cc journal_uploadserver.cc xml_encode_decode.cc sessionparser.cc sessionheaderparser.cc luascript.cc courselist.cc luapraxisd.cc praxisd.cc luautil.cc courseparser.cc
+//cflags: -DWITHOUT_ARTEFACT -I.. $(PQXX_CXXFLAGS) $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS)
+//libs: $(PQXX_LIBS) -lpthread $(EXPAT_LIBS) $(PTHREAD_LIBS) $(LUA_LIBS) $(CURL_LIBS)
#include "test.h"
TEST_BEGIN;
diff --git a/server/src/fieldnamescanner.cc b/server/src/fieldnamescanner.cc
index ba3b61f..d8b10f1 100644
--- a/server/src/fieldnamescanner.cc
+++ b/server/src/fieldnamescanner.cc
@@ -131,8 +131,8 @@ templates_t scanfieldnames(Environment &env, std::set<std::string> &filter)
#ifdef TEST_FIELDNAMESCANNER
//deps: util.cc configuration.cc debug.cc log.cc templateparser.cc exception.cc saxparser.cc macrolist.cc entitylist.cc inotify.cc mutex.cc macroheaderparser.cc versionstr.cc macroparser.cc
-//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS)
-//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS)
+//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) $(ATF_CFLAGS) $(OPENSSL_CFLAGS)
+//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) $(ATF_LIBS) $(OPENSSL_LIBS)
#include "test.h"
TEST_BEGIN;
diff --git a/server/src/httpd.cc b/server/src/httpd.cc
index 9349697..6682629 100644
--- a/server/src/httpd.cc
+++ b/server/src/httpd.cc
@@ -264,9 +264,9 @@ bool Httpd::is_running_ssl()
}
#ifdef TEST_HTTPD
-//deps: debug.cc log.cc
-//cflags: -I.. $(HTTPD_CFLAGS)
-//libs: $(HTTPD_LIBS) -lcurl
+//deps: debug.cc log.cc mutex.cc
+//cflags: -I.. $(HTTPD_CFLAGS) $(PTHREAD_CFLAGS)
+//libs: $(HTTPD_LIBS) $(CURL_LIBS) $(PTHREAD_LIBS)
#include "test.h"
#include <curl/curl.h>
diff --git a/server/src/inotify.cc b/server/src/inotify.cc
index cba781a..14a47bc 100644
--- a/server/src/inotify.cc
+++ b/server/src/inotify.cc
@@ -386,9 +386,9 @@ void INotify::clear()
}
#ifdef TEST_INOTIFY
-//deps: debug.cc log.cc
-//cflags: -I..
-//libs:
+//deps: debug.cc log.cc mutex.cc
+//cflags: -I.. $(PTHREAD_CFLAGS)
+//libs: $(PTHREAD_LIBS)
#include "test.h"
#include <stdio.h>
diff --git a/server/src/journal.cc b/server/src/journal.cc
index 04b1459..f5eeed7 100644
--- a/server/src/journal.cc
+++ b/server/src/journal.cc
@@ -167,9 +167,9 @@ void Journal::runOnCommitScripts() throw(LUAScript::Exception)
#ifdef TEST_JOURNAL
-//deps: debug.cc log.cc journal_uploadserver.cc journal_commit.cc
-//cflags: -I..
-//libs:
+//deps: debug.cc log.cc journal_uploadserver.cc journal_commit.cc mutex.cc luascript.cc luapraxisd.cc praxisd.cc saxparser.cc luautil.cc configuration.cc
+//cflags: -I.. $(PTHREAD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS) $(EXPAT_CFLAGS)
+//libs: $(PTHREAD_LIBS) $(LUA_LIBS) $(CURL_LIBS) $(EXPAT_LIBS)
#include <test.h>
TEST_BEGIN;
diff --git a/server/src/journal_commit.cc b/server/src/journal_commit.cc
index d765ebb..1bfd9e8 100644
--- a/server/src/journal_commit.cc
+++ b/server/src/journal_commit.cc
@@ -145,9 +145,9 @@ int journal_commit(const char *cpr, const char *user,
}
#ifdef TEST_JOURNAL_COMMIT
-//deps: debug.cc log.cc
-//cflags: -I..
-//libs:
+//deps: debug.cc log.cc mutex.cc
+//cflags: -I.. $(PTHREAD_CFLAGS)
+//libs: $(PTHREAD_LIBS)
#include <test.h>
TEST_BEGIN;
diff --git a/server/src/journal_uploadserver.cc b/server/src/journal_uploadserver.cc
index eac6cd5..3d433a2 100644
--- a/server/src/journal_uploadserver.cc
+++ b/server/src/journal_uploadserver.cc
@@ -238,9 +238,9 @@ void JournalUploadServer::commit()
#ifdef TEST_JOURNAL_UPLOADSERVER
-//deps: debug.cc log.cc journal.cc journal_commit.cc
-//cflags: -I..
-//libs:
+//deps: debug.cc log.cc journal.cc journal_commit.cc mutex.cc luascript.cc luapraxisd.cc praxisd.cc luautil.cc saxparser.cc configuration.cc
+//cflags: -I.. $(PTHREAD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS) $(EXPAT_CFLAGS)
+//libs: $(PTHREAD_LIBS) $(LUA_LIBS) $(CURL_LIBS) $(EXPAT_LIBS)
#include "test.h"
#define LONG "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do\neiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. \n\n \t";
diff --git a/server/src/luaoncommit.cc b/server/src/luaoncommit.cc
index 8e96066..aa15cdb 100644
--- a/server/src/luaoncommit.cc
+++ b/server/src/luaoncommit.cc
@@ -52,12 +52,9 @@ LUAOnCommit::LUAOnCommit(Transaction &t, Commit &c) : LUAScript()
}
#ifdef TEST_LUAONCOMMIT
-//Additional dependency files
-//deps:
-//Required cflags (autoconf vars may be used)
-//cflags:
-//Required link options (autoconf vars may be used)
-//libs:
+//deps: debug.cc log.cc mutex.cc luascript.cc luapraxisd.cc praxisd.cc luautil.cc saxparser.cc configuration.cc
+//cflags: -I.. $(PTHREAD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS) $(EXPAT_CFLAGS)
+//libs: $(PTHREAD_LIBS) $(LUA_LIBS) $(CURL_LIBS) $(EXPAT_LIBS)
#include "test.h"
TEST_BEGIN;
diff --git a/server/src/luapraxisd.cc b/server/src/luapraxisd.cc
index da34d32..b12eace 100644
--- a/server/src/luapraxisd.cc
+++ b/server/src/luapraxisd.cc
@@ -38,7 +38,7 @@
(lua_isboolean(L,i) ? lua_toboolean(L,i) : luaL_checkint(L,i))
#define error(L, m) \
- ERR(luapraxisd, "%s\n", m); lua_pushstring(L, m); lua_error(L);
+ { ERR(luapraxisd, "%s\n", m); lua_pushstring(L, m); lua_error(L); }
typedef struct px_userdata {
Praxisd *px;
diff --git a/server/src/luaquerymapper.cc b/server/src/luaquerymapper.cc
index 56ea1e9..defe1ae 100644
--- a/server/src/luaquerymapper.cc
+++ b/server/src/luaquerymapper.cc
@@ -262,9 +262,9 @@ std::string LUAQueryMapper::automap(const std::string &name)
}
#ifdef TEST_LUAQUERYMAPPER
-//deps: exception.cc log.cc debug.cc luautil.cc
-//cflags: -I.. ${LUA_CFLAGS}
-//libs:${LUA_LIBS}
+//deps: exception.cc debug.cc log.cc mutex.cc luascript.cc luapraxisd.cc praxisd.cc luautil.cc saxparser.cc configuration.cc
+//cflags: -I.. $(PTHREAD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS) $(EXPAT_CFLAGS)
+//libs: $(PTHREAD_LIBS) $(LUA_LIBS) $(CURL_LIBS) $(EXPAT_LIBS)
#include <test.h>
TEST_BEGIN;
diff --git a/server/src/luaresume.cc b/server/src/luaresume.cc
index 1db4fb3..a0a3ade 100644
--- a/server/src/luaresume.cc
+++ b/server/src/luaresume.cc
@@ -50,9 +50,9 @@ LUAResume::LUAResume(Transaction &t, Commit &c) : LUAScript()
}
#ifdef TEST_LUARESUME
-//deps: debug.cc log.cc luautil.cc
-//cflags: -I.. $(LUA_CFLAGS)
-//libs: $(LUA_LIBS)
+//deps: exception.cc debug.cc log.cc mutex.cc luascript.cc luapraxisd.cc praxisd.cc luautil.cc saxparser.cc configuration.cc
+//cflags: -I.. $(PTHREAD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS) $(EXPAT_CFLAGS)
+//libs: $(PTHREAD_LIBS) $(LUA_LIBS) $(CURL_LIBS) $(EXPAT_LIBS)
#include <test.h>
TEST_BEGIN;
diff --git a/server/src/luascript.cc b/server/src/luascript.cc
index 6ba52a9..e46aa8d 100644
--- a/server/src/luascript.cc
+++ b/server/src/luascript.cc
@@ -299,12 +299,9 @@ void LUAScript::setEnv(LUAScript::env_t id, std::string value)
}
#ifdef TEST_LUASCRIPT
-//Additional dependency files
-//deps:
-//Required cflags (autoconf vars may be used)
-//cflags:
-//Required link options (autoconf vars may be used)
-//libs:
+//deps: exception.cc debug.cc log.cc mutex.cc luapraxisd.cc praxisd.cc luautil.cc saxparser.cc configuration.cc
+//cflags: -I.. $(PTHREAD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS) $(EXPAT_CFLAGS)
+//libs: $(PTHREAD_LIBS) $(LUA_LIBS) $(CURL_LIBS) $(EXPAT_LIBS)
#include "test.h"
TEST_BEGIN;
diff --git a/server/src/macroheaderparser.cc b/server/src/macroheaderparser.cc
index 3262888..8db14dc 100644
--- a/server/src/macroheaderparser.cc
+++ b/server/src/macroheaderparser.cc
@@ -146,9 +146,9 @@ Macro *MacroHeaderParser::getMacro()
}
#ifdef TEST_MACROHEADERPARSER
-//deps: debug.cc log.cc saxparser.cc exception.cc
-//cflags: -I.. $(EXPAT_CFLAGS)
-//libs: $(EXPAT_LIBS)
+//deps: debug.cc log.cc saxparser.cc exception.cc mutex.cc
+//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS)
+//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS)
#include <test.h>
#define XMLFILE "/tmp/test_macroheaderparser.xml"
diff --git a/server/src/macroparser.cc b/server/src/macroparser.cc
index be781aa..8506a7b 100644
--- a/server/src/macroparser.cc
+++ b/server/src/macroparser.cc
@@ -392,9 +392,9 @@ Macro *MacroParser::getMacro()
}
#ifdef TEST_MACROPARSER
-//deps: debug.cc log.cc saxparser.cc exception.cc
-//cflags: -I.. $(EXPAT_CFLAGS)
-//libs: $(EXPAT_LIBS)
+//deps: debug.cc log.cc saxparser.cc exception.cc mutex.cc
+//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS)
+//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS)
#include <test.h>
#define XMLFILE "/tmp/test_macroheaderparser.xml"
diff --git a/server/src/mutex.cc b/server/src/mutex.cc
index 9805591..d5e9a6f 100644
--- a/server/src/mutex.cc
+++ b/server/src/mutex.cc
@@ -27,8 +27,6 @@
*/
#include "mutex.h"
-#include "debug.h"
-
#define MUTEX_DBG(x)
//#define MUTEX_DBG(x) x
diff --git a/server/src/pracrodaopgsql.cc b/server/src/pracrodaopgsql.cc
index db0a9aa..3c7040a 100644
--- a/server/src/pracrodaopgsql.cc
+++ b/server/src/pracrodaopgsql.cc
@@ -627,9 +627,9 @@ void PracroDAOPgsql::setIdle(std::string sessionid, bool idle)
#endif/*WITHOUT_DB*/
#ifdef TEST_PRACRODAOPGSQL
-//deps: debug.cc log.cc configuration.cc exception.cc pracrodao.cc
-//cflags: -I.. $(PQXX_CXXFLAGS)
-//libs: $(PQXX_LIBS)
+//deps: debug.cc log.cc configuration.cc exception.cc pracrodao.cc mutex.cc
+//cflags: -I.. $(PQXX_CXXFLAGS) $(PTHREAD_CFLAGS)
+//libs: $(PQXX_LIBS) $(PTHREAD_LIBS)
#include <test.h>
#include <time.h>
@@ -681,8 +681,8 @@ commit.fields["field2"] = "world";
commit.templ = "tester";
Macro macro;
-macro.attributes["version"] = "1.0";
-macro.attributes["name"] = MACRO;
+macro.version = "1.0";
+macro.name = MACRO;
time_t now = time(NULL);
diff --git a/server/src/pracrodaotest.cc b/server/src/pracrodaotest.cc
index 705d4b8..d8b151d 100644
--- a/server/src/pracrodaotest.cc
+++ b/server/src/pracrodaotest.cc
@@ -332,9 +332,9 @@ void PracroDAOTest::discard(std::string sessionid)
}
#ifdef TEST_PRACRODAOTEST
-//deps: debug.cc log.cc configuration.cc exception.cc pracrodao.cc
-//cflags: -I..
-//libs:
+//deps: debug.cc log.cc configuration.cc exception.cc pracrodao.cc mutex.cc
+//cflags: -I.. $(PTHREAD_CFLAGS)
+//libs: $(PTHREAD_LIBS)
#include <test.h>
#include <time.h>
@@ -387,8 +387,8 @@ commit.fields["field2"] = "world";
commit.templ = "tester";
Macro macro;
-macro.attributes["version"] = "1.0";
-macro.attributes["name"] = MACRO;
+macro.version = "1.0";
+macro.name = MACRO;
time_t now = time(NULL);
diff --git a/server/src/praxisd.cc b/server/src/praxisd.cc
index c198051..c8dfa6f 100644
--- a/server/src/praxisd.cc
+++ b/server/src/praxisd.cc
@@ -1012,9 +1012,9 @@ std::string Praxisd::dokmenu_get_by_cpr_and_name(std::string cpr,
}
#ifdef TEST_PRAXISD
-//deps: saxparser.cc debug.cc log.cc
-//cflags: $(CURL_CFLAGS) $(EXPAT_CFLAGS) -I..
-//libs: $(CURL_LIBS) $(EXPAT_LIBS)
+//deps: saxparser.cc debug.cc log.cc mutex.cc
+//cflags: -I.. $(CURL_CFLAGS) $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS)
+//libs: $(CURL_LIBS) $(EXPAT_LIBS) $(PTHREAD_LIBS)
#include "test.h"
#define NL "\r\n"
diff --git a/server/src/queryhandlerpentominos.cc b/server/src/queryhandlerpentominos.cc
index 0b4aeb5..698fc2e 100644
--- a/server/src/queryhandlerpentominos.cc
+++ b/server/src/queryhandlerpentominos.cc
@@ -45,9 +45,9 @@ QueryResult QueryHandlerPentominos::exec(Query &query)
}
#ifdef TEST_QUERYHANDLERPENTOMINOS
-//deps: artefact.cc configuration.cc debug.cc log.cc
-//cflags: -I.. $(ATF_CFLAGS)
-//libs: $(ATF_LIBS)
+//deps: artefact.cc configuration.cc debug.cc log.cc mutex.cc
+//cflags: -I.. $(ATF_CFLAGS) $(PTHREAD_CFLAGS)
+//libs: $(ATF_LIBS) $(PTHREAD_LIBS)
#include <test.h>
#include "tcpsocket.h"
diff --git a/server/src/queryhandlerpracro.cc b/server/src/queryhandlerpracro.cc
index e95d4ff..1187c06 100644
--- a/server/src/queryhandlerpracro.cc
+++ b/server/src/queryhandlerpracro.cc
@@ -77,8 +77,8 @@ QueryResult QueryHandlerPracro::exec(Query &query)
#ifdef TEST_QUERYHANDLERPRACRO
//deps: database.cc mutex.cc debug.cc log.cc pracrodao.cc pracrodaotest.cc pracrodaopgsql.cc configuration.cc
-//cflags: -I.. $(PQXX_CXXFLAGS)
-//libs: $(PQXX_LIBS)
+//cflags: -I.. $(PQXX_CXXFLAGS) $(PTHREAD_CFLAGS)
+//libs: $(PQXX_LIBS) $(PTHREAD_LIBS)
#include <test.h>
#include <time.h>
diff --git a/server/src/queryparser.cc b/server/src/queryparser.cc
index 138b7ab..84f7437 100644
--- a/server/src/queryparser.cc
+++ b/server/src/queryparser.cc
@@ -88,9 +88,9 @@ void QueryParser::parseError(const char *buf, size_t len, std::string error, int
}
#ifdef TEST_QUERYPARSER
-//deps: saxparser.cc debug.cc log.cc utf8.cc exception.cc
-//cflags: -I.. $(EXPAT_CFLAGS)
-//libs: $(EXPAT_LIBS)
+//deps: saxparser.cc debug.cc log.cc utf8.cc exception.cc mutex.cc
+//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS)
+//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS)
#include <test.h>
#include <string.h>
diff --git a/server/src/saxparser.cc b/server/src/saxparser.cc
index 14f204c..e01af83 100644
--- a/server/src/saxparser.cc
+++ b/server/src/saxparser.cc
@@ -198,9 +198,9 @@ void SAXParser::characterData(std::string &)
}
#ifdef TEST_SAXPARSER
-//deps: log.cc debug.cc exception.cc
-//cflags: -I..
-//libs: -lexpat
+//deps: log.cc debug.cc exception.cc mutex.cc
+//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS)
+//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS)
#include <test.h>
#define XMLFILE "/tmp/saxparsertest.xml"
diff --git a/server/src/server.cc b/server/src/server.cc
index 838da32..8592ad9 100644
--- a/server/src/server.cc
+++ b/server/src/server.cc
@@ -138,14 +138,17 @@ void server()
}
#ifdef TEST_SERVER
-//deps: httpd.cc session.cc configuration.cc journal.cc journal_uploadserver.cc journal_commit.cc mutex.cc debug.cc sessionserialiser.cc sessionparser.cc saxparser.cc environment.cc semaphore.cc artefact.cc xml_encode_decode.cc database.cc pracrodaopgsql.cc pracrodaotest.cc pracrodao.cc entitylist.cc macrolist.cc templatelist.cc macroheaderparser.cc templateheaderparser.cc versionstr.cc exception.cc log.cc inotify.cc client_connection.cc admin_connection.cc admin_rc.cc admin_export.cc transactionparser.cc transactionhandler.cc templateparser.cc macroparser.cc queryhandlerpracro.cc luaquerymapper.cc queryhandlerpentominos.cc resumeparser.cc luaresume.cc luautil.cc widgetgenerator.cc widgetvalue.cc
-//cflags: -I.. -DWITHOUT_ARTEFACT -DWITHOUT_DB $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) $(HTTPD_CFLAGS) $(LUA_CFLAGS)
-//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) $(HTTPD_LIBS) $(LUA_LIBS)
+//deps: httpd.cc session.cc configuration.cc journal.cc journal_uploadserver.cc journal_commit.cc mutex.cc debug.cc sessionserialiser.cc sessionparser.cc saxparser.cc environment.cc semaphore.cc artefact.cc xml_encode_decode.cc database.cc pracrodaopgsql.cc pracrodaotest.cc pracrodao.cc entitylist.cc macrolist.cc templatelist.cc macroheaderparser.cc templateheaderparser.cc versionstr.cc exception.cc log.cc inotify.cc client_connection.cc admin_connection.cc admin_rc.cc admin_export.cc transactionparser.cc transactionhandler.cc templateparser.cc macroparser.cc queryhandlerpracro.cc luaquerymapper.cc queryhandlerpentominos.cc luaresume.cc widgetgenerator.cc widgetvalue.cc luascript.cc luautil.cc luapraxisd.cc praxisd.cc sessionheaderparser.cc courseparser.cc courselist.cc luaoncommit.cc
+//cflags: -I.. -DWITHOUT_ARTEFACT -DWITHOUT_DB $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) $(HTTPD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS)
+//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) $(HTTPD_LIBS) $(LUA_LIBS) $(CURL_LIBS)
#include <test.h>
#include <sys/types.h>
#include <signal.h>
+// Thsese are globals normally defined in pracrod.cc:
+std::string logfile;
+volatile bool logfile_reload;
bool pracro_is_running = true;
char request[] =
diff --git a/server/src/session.cc b/server/src/session.cc
index ea4d11c..4ee1041 100644
--- a/server/src/session.cc
+++ b/server/src/session.cc
@@ -400,9 +400,9 @@ SessionAutounlock::~SessionAutounlock()
}
#ifdef TEST_SESSION
-//deps: configuration.cc journal.cc journal_uploadserver.cc journal_commit.cc mutex.cc debug.cc sessionserialiser.cc sessionparser.cc saxparser.cc environment.cc semaphore.cc artefact.cc xml_encode_decode.cc database.cc pracrodaopgsql.cc pracrodaotest.cc pracrodao.cc entitylist.cc macrolist.cc templatelist.cc macroheaderparser.cc templateheaderparser.cc versionstr.cc exception.cc log.cc inotify.cc
-//cflags: -I.. $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS) -DWITHOUT_ARTEFACT -DWITHOUT_DB
-//libs: $(PTHREAD_LIBS) $(EXPAT_LIBS)
+//deps: configuration.cc journal.cc journal_uploadserver.cc journal_commit.cc mutex.cc debug.cc sessionserialiser.cc sessionparser.cc saxparser.cc environment.cc semaphore.cc artefact.cc xml_encode_decode.cc database.cc pracrodaopgsql.cc pracrodaotest.cc pracrodao.cc entitylist.cc macrolist.cc templatelist.cc macroheaderparser.cc templateheaderparser.cc versionstr.cc exception.cc log.cc inotify.cc sessionheaderparser.cc luascript.cc luautil.cc luapraxisd.cc praxisd.cc courselist.cc courseparser.cc
+//cflags: -I.. $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS) -DWITHOUT_ARTEFACT -DWITHOUT_DB $(LUA_CFLAGS) $(CURL_CFLAGS)
+//libs: $(PTHREAD_LIBS) $(EXPAT_LIBS) $(LUA_LIBS) $(CURL_LIBS)
#include <test.h>
#define PID "1505050505"
@@ -410,6 +410,10 @@ SessionAutounlock::~SessionAutounlock()
TEST_BEGIN;
+// TODO: Put some testcode here (see test.h for usable macros).
+TEST_TRUE(false, "No tests yet!");
+
+/*
debug_parse("+all");
Conf::database_backend = "testdb";
@@ -531,7 +535,7 @@ TEST_TRUE(s9->isReadonly(), "Read only session.");
TEST_FALSE(s9->idle(), "Readonly session is not idle.");
s9->setIdle(true); // Force idle (no effect)
TEST_FALSE(s9->idle(), "Readonly session still not idle.");
-
+*/
TEST_END;
#endif/*TEST_SESSION*/
diff --git a/server/src/sessionheaderparser.cc b/server/src/sessionheaderparser.cc
index c9a8e67..8602196 100644
--- a/server/src/sessionheaderparser.cc
+++ b/server/src/sessionheaderparser.cc
@@ -164,12 +164,9 @@ SessionHeaderParser::Header SessionHeaderParser::getHeader()
}
#ifdef TEST_SESSIONHEADERPARSER
-//Additional dependency files
-//deps:
-//Required cflags (autoconf vars may be used)
-//cflags:
-//Required link options (autoconf vars may be used)
-//libs:
+//deps: saxparser.cc debug.cc log.cc exception.cc mutex.cc
+//cflags: -I.. $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS)
+//libs: $(PTHREAD_LIBS) $(EXPAT_LIBS)
#include "test.h"
TEST_BEGIN;
diff --git a/server/src/sessionparser.cc b/server/src/sessionparser.cc
index 8913e3c..d9e2c9a 100644
--- a/server/src/sessionparser.cc
+++ b/server/src/sessionparser.cc
@@ -187,9 +187,9 @@ void SessionParser::parseError(const char *buf, size_t len,
}
#ifdef TEST_SESSIONPARSER
-//deps: saxparser.cc debug.cc log.cc
-//cflags: -I.. $(EXPAT_CFLAGS)
-//libs: $(EXPAT_LIBS)
+//deps: saxparser.cc debug.cc log.cc mutex.cc luascript.cc luautil.cc luapraxisd.cc praxisd.cc configuration.cc
+//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS)
+//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) $(LUA_LIBS) $(CURL_LIBS)
#include "test.h"
TEST_BEGIN;
diff --git a/server/src/sessionserialiser.cc b/server/src/sessionserialiser.cc
index 6288ddd..4e52d79 100644
--- a/server/src/sessionserialiser.cc
+++ b/server/src/sessionserialiser.cc
@@ -342,9 +342,9 @@ SessionSerialiser::sessionFiles()
#ifdef TEST_SESSIONSERIALISER
-//deps: session.cc journal.cc debug.cc configuration.cc mutex.cc journal_commit.cc sessionparser.cc saxparser.cc xml_encode_decode.cc database.cc pracrodaopgsql.cc pracrodaotest.cc pracrodao.cc journal_uploadserver.cc log.cc environment.cc semaphore.cc artefact.cc macrolist.cc templatelist.cc entitylist.cc inotify.cc versionstr.cc exception.cc macroheaderparser.cc templateheaderparser.cc
-//cflags: -I.. $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS) $(PQXX_CFLAGS) -DWITHOUT_ARTEFACT
-//libs: $(PTHREAD_LIBS) $(EXPAT_LIBS) $(PQXX_LIBS)
+//deps: session.cc journal.cc debug.cc configuration.cc mutex.cc journal_commit.cc sessionparser.cc saxparser.cc xml_encode_decode.cc database.cc pracrodaopgsql.cc pracrodaotest.cc pracrodao.cc journal_uploadserver.cc log.cc environment.cc semaphore.cc artefact.cc macrolist.cc templatelist.cc entitylist.cc inotify.cc versionstr.cc exception.cc macroheaderparser.cc templateheaderparser.cc sessionheaderparser.cc luascript.cc luautil.cc luapraxisd.cc praxisd.cc courselist.cc courseparser.cc
+//cflags: -I.. $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS) $(PQXX_CFLAGS) -DWITHOUT_ARTEFACT $(LUA_CFLAGS) $(CURL_CFLAGS)
+//libs: $(PTHREAD_LIBS) $(EXPAT_LIBS) $(PQXX_LIBS) $(LUA_LIBS) $(CURL_LIBS)
#include "test.h"
#include <stdio.h>
@@ -355,6 +355,10 @@ SessionSerialiser::sessionFiles()
TEST_BEGIN;
+// TODO: Put some testcode here (see test.h for usable macros).
+TEST_TRUE(false, "No tests yet!");
+
+#if 0
// Make sure we start out on an empty session directory.
std::string spath = "/tmp/test_sessionserialiser";
while(mkdir(spath.c_str(), 0777) == -1 && errno == EEXIST) {
@@ -443,6 +447,7 @@ Environment env;
TEST_EQUAL(s1->templ, TID, "Compare found tuple.");
delete s1;
}
+#endif/*0*/
TEST_END;
diff --git a/server/src/tcpsocket.cc b/server/src/tcpsocket.cc
index b54b581..fc4dab2 100644
--- a/server/src/tcpsocket.cc
+++ b/server/src/tcpsocket.cc
@@ -367,9 +367,9 @@ std::string TCPSocket::dstaddr()
}
#ifdef TEST_TCPSOCKET
-//deps: exception.cc debug.cc log.cc
-//cflags: -I..
-//libs:
+//deps: exception.cc debug.cc log.cc mutex.cc
+//cflags: -I.. $(PTHREAD_CFLAGS)
+//libs: $(PTHREAD_LIBS)
#include <test.h>
#define PORT 12346
diff --git a/server/src/templateheaderparser.cc b/server/src/templateheaderparser.cc
index 57b0a4e..b2c68e3 100644
--- a/server/src/templateheaderparser.cc
+++ b/server/src/templateheaderparser.cc
@@ -147,9 +147,9 @@ Template *TemplateHeaderParser::getTemplate()
}
#ifdef TEST_TEMPLATEHEADERPARSER
-//deps: saxparser.cc exception.cc debug.cc log.cc
-//cflags: -I.. $(EXPAT_CFLAGS)
-//libs: $(EXPAT_LIBS)
+//deps: saxparser.cc exception.cc debug.cc log.cc mutex.cc
+//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS)
+//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS)
#include <test.h>
#define XMLFILE "/tmp/test_templateheaderparser.xml"
diff --git a/server/src/templateparser.cc b/server/src/templateparser.cc
index 8fc3eff..a71ccfb 100644
--- a/server/src/templateparser.cc
+++ b/server/src/templateparser.cc
@@ -225,9 +225,9 @@ Template *TemplateParser::getTemplate()
}
#ifdef TEST_TEMPLATEPARSER
-//deps: saxparser.cc debug.cc log.cc exception.cc
-//cflags: -I.. $(EXPAT_CFLAGS)
-//libs: $(EXPAT_LIBS)
+//deps: saxparser.cc debug.cc log.cc exception.cc mutex.cc
+//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS)
+//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS)
#include <test.h>
#define XMLFILE "/tmp/test_templateparser.xml"
diff --git a/server/src/transactionhandler.cc b/server/src/transactionhandler.cc
index 6ab3d89..1623d56 100644
--- a/server/src/transactionhandler.cc
+++ b/server/src/transactionhandler.cc
@@ -358,9 +358,9 @@ std::string handleTransaction(Request &request,
}
#ifdef TEST_TRANSACTIONHANDLER
-//deps: session.cc configuration.cc journal.cc journal_uploadserver.cc journal_commit.cc mutex.cc debug.cc sessionserialiser.cc sessionparser.cc saxparser.cc environment.cc semaphore.cc artefact.cc xml_encode_decode.cc database.cc pracrodaopgsql.cc pracrodaotest.cc pracrodao.cc entitylist.cc macrolist.cc templatelist.cc macroheaderparser.cc templateheaderparser.cc versionstr.cc exception.cc log.cc inotify.cc client_connection.cc admin_connection.cc admin_rc.cc admin_export.cc transactionparser.cc templateparser.cc macroparser.cc queryhandlerpracro.cc luaquerymapper.cc queryhandlerpentominos.cc resumeparser.cc luaresume.cc luautil.cc widgetgenerator.cc widgetvalue.cc
-//cflags: -I.. -DWITHOUT_ARTEFACT -DWITHOUT_DB $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) $(HTTPD_CFLAGS) $(LUA_CFLAGS)
-//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) $(HTTPD_LIBS) $(LUA_LIBS)
+//deps: session.cc configuration.cc journal.cc journal_uploadserver.cc journal_commit.cc mutex.cc debug.cc sessionserialiser.cc sessionparser.cc saxparser.cc environment.cc semaphore.cc artefact.cc xml_encode_decode.cc database.cc pracrodaopgsql.cc pracrodaotest.cc pracrodao.cc entitylist.cc macrolist.cc templatelist.cc macroheaderparser.cc templateheaderparser.cc versionstr.cc exception.cc log.cc inotify.cc client_connection.cc admin_connection.cc admin_rc.cc admin_export.cc transactionparser.cc templateparser.cc macroparser.cc queryhandlerpracro.cc luaquerymapper.cc queryhandlerpentominos.cc luaresume.cc luautil.cc widgetgenerator.cc widgetvalue.cc luascript.cc luapraxisd.cc praxisd.cc sessionheaderparser.cc courselist.cc luaoncommit.cc courseparser.cc
+//cflags: -I.. -DWITHOUT_ARTEFACT -DWITHOUT_DB $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) $(HTTPD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS)
+//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) $(HTTPD_LIBS) $(LUA_LIBS) $(CURL_LIBS)
#include "test.h"
TEST_BEGIN;
diff --git a/server/src/transactionparser.cc b/server/src/transactionparser.cc
index a52d797..fbead8d 100644
--- a/server/src/transactionparser.cc
+++ b/server/src/transactionparser.cc
@@ -97,9 +97,9 @@ void TransactionParser::parseError(const char *buf, size_t len,
}
#ifdef TEST_TRANSACTIONPARSER
-//deps: saxparser.cc debug.cc exception.cc log.cc
-//cflags: -I.. $(EXPAT_CFLAGS)
-//libs: $(EXPAT_LIBS)
+//deps: saxparser.cc debug.cc exception.cc log.cc mutex.cc
+//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS)
+//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS)
#include "test.h"
static char xml_minimal[] =
diff --git a/server/src/util.cc b/server/src/util.cc
index 4c049bd..d1085a4 100644
--- a/server/src/util.cc
+++ b/server/src/util.cc
@@ -77,9 +77,9 @@ void printcolumn(std::string text, size_t width)
}
#ifdef TEST_UTIL
-//deps: configuration.cc debug.cc log.cc
-//cflags: -I..
-//libs:
+//deps: configuration.cc debug.cc log.cc mutex.cc
+//cflags: -I.. $(PTHREAD_CFLAGS)
+//libs: $(PTHREAD_LIBS)
#include <test.h>
TEST_BEGIN;
diff --git a/server/src/widgetgenerator.cc b/server/src/widgetgenerator.cc
index 7f8e8c4..d3cfe9e 100644
--- a/server/src/widgetgenerator.cc
+++ b/server/src/widgetgenerator.cc
@@ -103,7 +103,7 @@ std::string widgetgenerator(std::string cpr, std::string sessionid,
}
#ifdef TEST_WIDGETGENERATOR
-//deps: log.cc mutex.cc debug.cc xml_encode_decode.cc widgetvalue.cc luaquerymapper.cc configuration.cc exception.cc
+//deps: log.cc mutex.cc debug.cc xml_encode_decode.cc widgetvalue.cc luaquerymapper.cc configuration.cc exception.cc luautil.cc
//cflags: -I.. $(PTHREAD_CFLAGS) $(LUA_CFLAGS)
//libs: $(PTHREAD_LIBS) $(LUA_LIBS)
#include <test.h>
diff --git a/server/src/widgetvalue.cc b/server/src/widgetvalue.cc
index 71f27f4..7e176bb 100644
--- a/server/src/widgetvalue.cc
+++ b/server/src/widgetvalue.cc
@@ -137,9 +137,9 @@ bool getValue(Value &value,
#ifdef TEST_WIDGETVALUE
-//deps: debug.cc exception.cc log.cc configuration.cc luaquerymapper.cc
-//cflags: -I.. $(LUA_CXXFLAGS)
-//libs: $(LUA_LIBS)
+//deps: debug.cc exception.cc log.cc configuration.cc luaquerymapper.cc mutex.cc luautil.cc
+//cflags: -I.. $(LUA_CXXFLAGS) $(PTHREAD_CFLAGS)
+//libs: $(LUA_LIBS) $(PTHREAD_LIBS)
#include "test.h"
TEST_BEGIN;
diff --git a/server/tools/test b/server/tools/test
index ec54e70..922040d 100755
--- a/server/tools/test
+++ b/server/tools/test
@@ -12,7 +12,7 @@ shift
OBJFILES=""
for f in $TEST_DEPS
do
- of=`echo -n $f | cut -d'.' -f1`.o;
+ of=`basename $f | cut -d'.' -f1`.o;
OBJFILES="$OBJFILES $of"
done