summaryrefslogtreecommitdiff
path: root/server/src/sessionserialiser.cc
diff options
context:
space:
mode:
authordeva <deva>2011-02-18 14:16:09 +0000
committerdeva <deva>2011-02-18 14:16:09 +0000
commitbb1c42800a2f48129100222317520b690f13c40e (patch)
tree16ac5d47d22c308f98f4e508b8bb4cfc8ae8ad16 /server/src/sessionserialiser.cc
parent4a42852b13d84a283abe54ee569c6d1a8334fa09 (diff)
Made Session isreadonly property private and created new commitMacro method.
Diffstat (limited to 'server/src/sessionserialiser.cc')
-rw-r--r--server/src/sessionserialiser.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/server/src/sessionserialiser.cc b/server/src/sessionserialiser.cc
index 99f880b..b9e825a 100644
--- a/server/src/sessionserialiser.cc
+++ b/server/src/sessionserialiser.cc
@@ -252,10 +252,15 @@ Session *SessionSerialiser::findFromTupple(const std::string &patientid,
#define SID "42"
#define PID "1234567890"
#define TID "sometemplate"
-#define SPATH "/tmp"
TEST_BEGIN;
+// 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) {
+ spath += "X";
+}
+
std::string xml;
debug_parse("+all");
@@ -283,7 +288,7 @@ Environment env;
j->addEntry("some text", "macro1", 0);
j->addEntry("some more text", "macro2", 2);
j->addEntry("yet some more text", "macro3", 1);
- SessionSerialiser s(&env, SPATH);
+ SessionSerialiser s(&env, spath);
xml = s.saveStr(&session);
s.loadStr(xml);
std::string xml2 = s.saveStr(&session);
@@ -296,13 +301,13 @@ Environment env;
j->addEntry("some text", "macro1", 0);
j->addEntry("some more text", "macro2", 2);
j->addEntry("yet some more text", "macro3", 1);
- SessionSerialiser s(&env, SPATH);
+ SessionSerialiser s(&env, spath);
xml = s.saveStr(&session);
}
/*
{
Session session(SID, PID, TID);
- SessionSerialiser s(SPATH);
+ SessionSerialiser s(spath);
s.loadStr(xml);
std::string xml2 = s.saveStr(&session);
TEST_EQUAL_STR(xml, xml2, "Compare");
@@ -314,13 +319,13 @@ Environment env;
j->addEntry("some text", "macro1", 0);
j->addEntry("some more text", "macro2", 2);
j->addEntry("yet some more text", "macro3", 1);
- SessionSerialiser s(&env, SPATH);
+ SessionSerialiser s(&env, spath);
s.save(&session);
}
/*
{
Session session(SID, PID, TID);
- SessionSerialiser s(SPATH);
+ SessionSerialiser s(spath);
s.load(SID);
std::string xml2 = s.saveStr(&session);
TEST_EQUAL_STR(xml, xml2, "Compare");
@@ -329,7 +334,7 @@ Environment env;
{
Session session(&env, SID, PID, TID);
- SessionSerialiser s(&env, SPATH);
+ SessionSerialiser s(&env, spath);
s.save(&session);
Session *s1 = s.findFromTupple(PID, TID);
TEST_NOTEQUAL(s1, NULL, "Found it?");