Changing naming convention
Format for files: /<forwarding-hint>/<appname>/file/<hash>/<device_name>/<segment>
Format for actions: /<forwarding-hint>/<appname>/<shared-folder>/action/<device_name>/<action-seq>
All tests pass
Change-Id: Ie42c0f29813839ca7cc42fa52b5c3f246da2e130
diff --git a/test/test-action-log.cc b/test/test-action-log.cc
index 84c0cf9..1a1ff1f 100644
--- a/test/test-action-log.cc
+++ b/test/test-action-log.cc
@@ -47,7 +47,7 @@
SyncLogPtr syncLog = make_shared<SyncLog> (tmpdir, localName);
CcnxWrapperPtr ccnx = make_shared<CcnxWrapper> ();
- ActionLogPtr actionLog = make_shared<ActionLog> (ccnx, tmpdir, syncLog, "top-secret",
+ ActionLogPtr actionLog = make_shared<ActionLog> (ccnx, tmpdir, syncLog, "top-secret", "test-chronoshare",
ActionLog::OnFileAddedOrChangedCallback(), ActionLog::OnFileRemovedCallback ());
// const std::string &filename,
@@ -77,24 +77,27 @@
pco = actionLog->LookupActionPco (localName, 1);
BOOST_CHECK_EQUAL ((bool)pco, true);
- BOOST_CHECK_EQUAL (pco->name (), "/alex/action/top-secret/%00%01");
+ BOOST_CHECK_EQUAL (pco->name (), "/test-chronoshare/top-secret/action/alex/%00%01");
- ActionItemPtr action = actionLog->LookupAction (Name ("/alex/action/top-secret")(0));
+ ActionItemPtr action = actionLog->LookupAction (Name ("/test-chronoshare/top-secret/action/alex")(0));
BOOST_CHECK_EQUAL ((bool)action, false);
- action = actionLog->LookupAction (Name ("/alex/action/top-secret")(1));
+ action = actionLog->LookupAction (Name ("/test-chronoshare/top-secret/action/alex")(1));
BOOST_CHECK_EQUAL ((bool)action, true);
- BOOST_CHECK_EQUAL (action->version (), 0);
- BOOST_CHECK_EQUAL (action->action (), 0);
+ if (action)
+ {
+ BOOST_CHECK_EQUAL (action->version (), 0);
+ BOOST_CHECK_EQUAL (action->action (), 0);
- BOOST_CHECK_EQUAL (action->filename (), "file.txt");
- BOOST_CHECK_EQUAL (action->seg_num (), 10);
- BOOST_CHECK_EQUAL (action->file_hash ().size (), 32);
- BOOST_CHECK_EQUAL (action->mode (), 0755);
+ BOOST_CHECK_EQUAL (action->filename (), "file.txt");
+ BOOST_CHECK_EQUAL (action->seg_num (), 10);
+ BOOST_CHECK_EQUAL (action->file_hash ().size (), 32);
+ BOOST_CHECK_EQUAL (action->mode (), 0755);
- BOOST_CHECK_EQUAL (action->has_parent_device_name (), false);
- BOOST_CHECK_EQUAL (action->has_parent_seq_no (), false);
+ BOOST_CHECK_EQUAL (action->has_parent_device_name (), false);
+ BOOST_CHECK_EQUAL (action->has_parent_seq_no (), false);
+ }
actionLog->AddLocalActionUpdate ("file.txt", *Hash::FromString ("2ff304769cdb0125ac039e6fe7575f8576dceffc62618a431715aaf6eea2bf1c"),
time (NULL), 0755, 10);
@@ -105,11 +108,14 @@
action = actionLog->LookupAction (Name ("/alex"), 2);
BOOST_CHECK_EQUAL ((bool)action, true);
- BOOST_CHECK_EQUAL (action->has_parent_device_name (), true);
- BOOST_CHECK_EQUAL (action->has_parent_seq_no (), true);
+ if (action)
+ {
+ BOOST_CHECK_EQUAL (action->has_parent_device_name (), true);
+ BOOST_CHECK_EQUAL (action->has_parent_seq_no (), true);
- BOOST_CHECK_EQUAL (action->parent_seq_no (), 1);
- BOOST_CHECK_EQUAL (action->version (), 1);
+ BOOST_CHECK_EQUAL (action->parent_seq_no (), 1);
+ BOOST_CHECK_EQUAL (action->version (), 1);
+ }
BOOST_CHECK_NO_THROW (actionLog->AddRemoteAction (pco));
BOOST_CHECK_EQUAL (actionLog->LogSize (), 2);
@@ -122,7 +128,7 @@
item.set_timestamp (time (NULL));
BytesPtr item_msg = serializeMsg (item);
- Name actionName = Name ("/zhenkai")("action")("top-secret")(1);
+ Name actionName = Name ("/")("test-chronoshare")("top-secret")("action")("zhenkai")(1);
Bytes actionData = ccnx->createContentObject (actionName, head (*item_msg), item_msg->size ());
pco = make_shared<ParsedContentObject> (actionData);