tests[state-server]: Create test cases for StateServer
create test cases for StateServer, still broken
Change-Id: Ifd3e19aa6b7d3f43edb0541695dd45f176e9490c
diff --git a/src/action-log.cpp b/src/action-log.cpp
index 7c5bacd..328d5f4 100644
--- a/src/action-log.cpp
+++ b/src/action-log.cpp
@@ -178,8 +178,9 @@
"file_hash, file_atime, file_mtime, file_ctime, file_chmod, file_seg_num, "
"parent_device_name, parent_seq_no, "
"action_name, action_content_object) "
- "VALUES (?, ?, ?, ?, ?, datetime(?, 'unixepoch'),"
- " ?, datetime(?, 'unixepoch'), datetime(?, 'unixepoch'), datetime(?, 'unixepoch'), ?,?, "
+ "VALUES (?, ?, ?, ?, ?, datetime(?, 'unixepoch', 'localtime'),"
+ " ?, datetime(?, 'unixepoch', 'localtime'), datetime(?, 'unixepoch', 'localtime'), "
+ " datetime(?, 'unixepoch', 'localtime'), ?, ?, "
" ?, ?, "
" ?, ?);",
-1, &stmt, 0);
@@ -330,7 +331,7 @@
"(device_name, seq_no, action, filename, version, action_timestamp, "
"parent_device_name, parent_seq_no, "
"action_name, action_content_object) "
- "VALUES(?, ?, ?, ?, ?, datetime(?, 'unixepoch'),"
+ "VALUES(?, ?, ?, ?, ?, datetime(?, 'unixepoch', 'localtime'),"
" ?, ?,"
" ?, ?)",
-1, &stmt, 0);
diff --git a/src/state-server.cpp b/src/state-server.cpp
index ecec125..ca18016 100644
--- a/src/state-server.cpp
+++ b/src/state-server.cpp
@@ -321,8 +321,8 @@
json.push_back(Pair("version", file.version()));
{
Object owner;
- Name device_name(file.device_name());
- owner.push_back(Pair("userName", boost::lexical_cast<std::string>(device_name)));
+ Name device_name(Block(file.device_name().data(), file.device_name().size()));
+ owner.push_back(Pair("userName", device_name.toUri()));
owner.push_back(Pair("seqNo", file.seq_no()));
json.push_back(Pair("owner", owner));