name assignment fix and use NDN-name like format /a/b/c

Change-Id: I4c1b81d01fa3e3fa549bc87e5135bab0abdd9864
diff --git a/src/name-assignments/assignment-hash.cpp b/src/name-assignments/assignment-hash.cpp
index 22b6e69..4849324 100644
--- a/src/name-assignments/assignment-hash.cpp
+++ b/src/name-assignments/assignment-hash.cpp
@@ -21,8 +21,11 @@
 AssignmentHash::getFunction(const std::string &factoryParam) {
     std::list<std::string> paramList;
     size_t index = 0, startIndex = 0;
-    while ((index = factoryParam.find(":", startIndex)) != factoryParam.npos) {
-        paramList.push_back(factoryParam.substr(startIndex, index));
+    while ((index = factoryParam.find("/", startIndex)) != std::string::npos) {
+        auto component = factoryParam.substr(startIndex, index - startIndex);
+        if (!component.empty()) {
+            paramList.push_back(component);
+        }
         startIndex = index + 1;
     }
     if (startIndex != factoryParam.size()) {
diff --git a/src/name-assignments/assignment-param.cpp b/src/name-assignments/assignment-param.cpp
index c7d0cfb..c5cbf09 100644
--- a/src/name-assignments/assignment-param.cpp
+++ b/src/name-assignments/assignment-param.cpp
@@ -20,8 +20,11 @@
 AssignmentParam::getFunction(const std::string &factoryParam) {
     std::list<std::string> paramList;
     size_t index = 0, startIndex = 0;
-    while ((index = factoryParam.find(":", startIndex)) != factoryParam.npos) {
-        paramList.push_back(factoryParam.substr(startIndex, index));
+    while ((index = factoryParam.find("/", startIndex)) != std::string::npos) {
+        auto component = factoryParam.substr(startIndex, index - startIndex);
+        if (!component.empty()) {
+            paramList.push_back(component);
+        }
         startIndex = index + 1;
     }
     if (startIndex != factoryParam.size()) {
diff --git a/tests/unit-tests/config-files/config-ca-5 b/tests/unit-tests/config-files/config-ca-5
index 5e05b29..0d1e6b3 100644
--- a/tests/unit-tests/config-files/config-ca-5
+++ b/tests/unit-tests/config-files/config-ca-5
@@ -24,6 +24,6 @@
   ],
   "name-assignment":
   {
-     "param": "email"
+     "param": "/group/email"
   }
 }
\ No newline at end of file
diff --git a/tests/unit-tests/configuration.t.cpp b/tests/unit-tests/configuration.t.cpp
index 98951c1..6ad1577 100644
--- a/tests/unit-tests/configuration.t.cpp
+++ b/tests/unit-tests/configuration.t.cpp
@@ -57,8 +57,9 @@
 
   std::vector<std::tuple<std::string, std::string>> params;
   params.emplace_back("email", "1@1.edu");
+  params.emplace_back("group", "irl");
   BOOST_CHECK_EQUAL(config.m_nameAssignmentFunc(params).size(), 1);
-  BOOST_CHECK_EQUAL(config.m_nameAssignmentFunc(params)[0], Name("1@1.edu"));
+  BOOST_CHECK_EQUAL(config.m_nameAssignmentFunc(params)[0], Name("/irl/1@1.edu"));
 }
 
 BOOST_AUTO_TEST_CASE(CAConfigFileWithErrors)
diff --git a/tests/unit-tests/name-assignment.t.cpp b/tests/unit-tests/name-assignment.t.cpp
index ab3afc3..1fc7f6a 100644
--- a/tests/unit-tests/name-assignment.t.cpp
+++ b/tests/unit-tests/name-assignment.t.cpp
@@ -39,7 +39,7 @@
 BOOST_AUTO_TEST_CASE(NameAssignmentParam)
 {
   AssignmentParam paramAssignment;
-  auto func = paramAssignment.getFunction("abc:xyz");
+  auto func = paramAssignment.getFunction("/abc/xyz/");
   std::vector<std::tuple<std::string, std::string>> requirements;
   requirements.emplace_back("abc", "123");
   BOOST_CHECK_EQUAL(func(requirements).size(), 0);
@@ -56,7 +56,7 @@
 BOOST_AUTO_TEST_CASE(NameAssignmentHash)
 {
   AssignmentHash hashAssignment;
-  auto func = hashAssignment.getFunction("abc:xyz");
+  auto func = hashAssignment.getFunction("/abc/xyz");
   std::vector<std::tuple<std::string, std::string>> requirements;
   requirements.emplace_back("abc", "123");
   BOOST_CHECK_EQUAL(func(requirements).size(), 0);