refactor client module to requester

Change-Id: I2b9835af7f03942bfdb6a886c95cfb4b907e2068
diff --git a/tests/unit-tests/bench.t.cpp b/tests/unit-tests/bench.t.cpp
index da7e699..28850a8 100644
--- a/tests/unit-tests/bench.t.cpp
+++ b/tests/unit-tests/bench.t.cpp
@@ -19,7 +19,7 @@
  */
 
 #include "ca-module.hpp"
-#include "client-module.hpp"
+#include "requester.hpp"
 #include "challenge-modules/challenge-pin.hpp"
 #include "protocol-detail/info.hpp"
 #include "test-common.hpp"
@@ -90,18 +90,17 @@
   advanceClocks(time::milliseconds(20), 60);
 
   // generate NEW Interest
-  ClientModule client(m_keyChain);
-  CaConfigItem item;
+  CaProfile item;
   item.m_caPrefix = Name("/ndn");
   item.m_cert = std::make_shared<security::v2::Certificate>(cert);
-  client.getClientConf().m_caItems.push_back(item);
-  auto newInterest = client.generateNewInterest(time::system_clock::now(),
-                                                time::system_clock::now() + time::days(1), Name("/ndn/alice"));
+  RequesterState state(m_keyChain, item, RequestType::NEW);
+  auto newInterest = Requester::genNewInterest(state, Name("/ndn/alice"),
+                                               time::system_clock::now(),
+                                               time::system_clock::now() + time::days(1));
 
   std::cout << "New Interest Size: " << newInterest->wireEncode().size() << std::endl;
 
   // generate CHALLENGE Interest
-  ChallengePin pinChallenge;
   shared_ptr<Interest> challengeInterest = nullptr;
   shared_ptr<Interest> challengeInterest2 = nullptr;
   shared_ptr<Interest> challengeInterest3 = nullptr;
@@ -110,49 +109,41 @@
   face.onSendData.connect([&](const Data& response) {
     if (Name("/ndn/CA/NEW").isPrefixOf(response.getName())) {
       std::cout << "NEW Data Size: " << response.wireEncode().size() << std::endl;
-      client.onNewRenewRevokeResponse(response);
-      auto paramList = pinChallenge.getRequestedParameterList(client.m_status, client.m_challengeStatus);
-      challengeInterest = client.generateChallengeInterest(pinChallenge.genChallengeRequestTLV(client.m_status,
-                                                                                               client.m_challengeStatus,
-                                                                                               std::move(paramList)));
+      auto challengeList = Requester::onNewRenewRevokeResponse(state, response);
+      auto paramList = Requester::selectOrContinueChallenge(state, "pin");
+      challengeInterest = Requester::genChallengeInterest(state, std::move(paramList));
     }
     else if (Name("/ndn/CA/CHALLENGE").isPrefixOf(response.getName()) && count == 0) {
       count++;
       BOOST_CHECK(security::verifySignature(response, cert));
 
-      client.onChallengeResponse(response);
-      BOOST_CHECK(client.m_status == Status::CHALLENGE);
-      BOOST_CHECK_EQUAL(client.m_challengeStatus, ChallengePin::NEED_CODE);
-
-      auto paramList = pinChallenge.getRequestedParameterList(client.m_status, client.m_challengeStatus);
-      challengeInterest2 = client.generateChallengeInterest(pinChallenge.genChallengeRequestTLV(client.m_status,
-                                                                                                client.m_challengeStatus,
-                                                                                                std::move(paramList)));
+      Requester::onChallengeResponse(state, response);
+      BOOST_CHECK(state.m_status == Status::CHALLENGE);
+      BOOST_CHECK_EQUAL(state.m_challengeStatus, ChallengePin::NEED_CODE);
+      auto paramList = Requester::selectOrContinueChallenge(state, "pin");
+      challengeInterest2 = Requester::genChallengeInterest(state, std::move(paramList));
     }
     else if (Name("/ndn/CA/CHALLENGE").isPrefixOf(response.getName()) && count == 1) {
       count++;
       BOOST_CHECK(security::verifySignature(response, cert));
 
-      client.onChallengeResponse(response);
-      BOOST_CHECK(client.m_status == Status::CHALLENGE);
-      BOOST_CHECK_EQUAL(client.m_challengeStatus, ChallengePin::WRONG_CODE);
+      Requester::onChallengeResponse(state, response);
+      BOOST_CHECK(state.m_status == Status::CHALLENGE);
+      BOOST_CHECK_EQUAL(state.m_challengeStatus, ChallengePin::WRONG_CODE);
 
-      auto paramList = pinChallenge.getRequestedParameterList(client.m_status, client.m_challengeStatus);
+      auto paramList = Requester::selectOrContinueChallenge(state, "pin");
       auto request = ca.getCertificateRequest(*challengeInterest2);
       auto secret = request.m_challengeState->m_secrets.get(ChallengePin::PARAMETER_KEY_CODE, "");
       std::get<1>(paramList[0]) = secret;
-      challengeInterest3 = client.generateChallengeInterest(pinChallenge.genChallengeRequestTLV(client.m_status,
-                                                                                                client.m_challengeStatus,
-                                                                                                std::move(paramList)));
+      challengeInterest3 = Requester::genChallengeInterest(state, std::move(paramList));
       std::cout << "CHALLENGE Interest Size: " << challengeInterest3->wireEncode().size() << std::endl;
     }
     else if (Name("/ndn/CA/CHALLENGE").isPrefixOf(response.getName()) && count == 2) {
       std::cout << "CHALLENGE Data Size: " << response.wireEncode().size() << std::endl;
       count++;
       BOOST_CHECK(security::verifySignature(response, cert));
-
-      client.onChallengeResponse(response);
-      BOOST_CHECK(client.m_status == Status::SUCCESS);
+      Requester::onChallengeResponse(state, response);
+      BOOST_CHECK(state.m_status == Status::SUCCESS);
     }
   });
 
diff --git a/tests/unit-tests/ca-module.t.cpp b/tests/unit-tests/ca-module.t.cpp
index d6a2980..ff139c6 100644
--- a/tests/unit-tests/ca-module.t.cpp
+++ b/tests/unit-tests/ca-module.t.cpp
@@ -22,8 +22,8 @@
 #include "challenge-module.hpp"
 #include "challenge-modules/challenge-email.hpp"
 #include "challenge-modules/challenge-pin.hpp"
-#include "client-module.hpp"
 #include "protocol-detail/info.hpp"
+#include "requester.hpp"
 #include "test-common.hpp"
 
 namespace ndn {
@@ -171,15 +171,13 @@
   CaModule ca(face, m_keyChain, "tests/unit-tests/config-files/config-ca-1", "ca-storage-memory");
   advanceClocks(time::milliseconds(20), 60);
 
-  ClientModule client(m_keyChain);
-  CaConfigItem item;
+  CaProfile item;
   item.m_caPrefix = Name("/ndn");
   item.m_cert = std::make_shared<security::v2::Certificate>(cert);
-  client.getClientConf().m_caItems.push_back(item);
-
-  auto interest = client.generateNewInterest(time::system_clock::now(),
-                                             time::system_clock::now() + time::days(1),
-                                             Name("/ndn/zhiyi"));
+  RequesterState state(m_keyChain, item, RequestType::NEW);
+  auto interest = Requester::genNewInterest(state, Name("/ndn/zhiyi"),
+                                            time::system_clock::now(),
+                                            time::system_clock::now() + time::days(1));
 
   int count = 0;
   face.onSendData.connect([&](const Data& response) {
@@ -201,9 +199,9 @@
 
     BOOST_CHECK(challengeBlockCount != 0);
 
-    client.onNewRenewRevokeResponse(response);
+    auto challengeList = Requester::onNewRenewRevokeResponse(state, response);
     auto ca_encryption_key = ca.getCaStorage()->getRequest(readString(contentBlock.get(tlv_request_id))).m_encryptionKey;
-    BOOST_CHECK_EQUAL_COLLECTIONS(client.m_aesKey, client.m_aesKey + sizeof(client.m_aesKey),
+    BOOST_CHECK_EQUAL_COLLECTIONS(state.m_aesKey, state.m_aesKey + sizeof(state.m_aesKey),
                                   ca_encryption_key.value(), ca_encryption_key.value() + ca_encryption_key.value_size());
   });
   face.receive(*interest);
@@ -222,19 +220,14 @@
   CaModule ca(face, m_keyChain, "tests/unit-tests/config-files/config-ca-1");
   advanceClocks(time::milliseconds(20), 60);
 
-  ClientModule client(m_keyChain);
-  CaConfigItem item;
+  CaProfile item;
   item.m_caPrefix = Name("/ndn");
   item.m_cert = std::make_shared<security::v2::Certificate>(cert);
-  client.getClientConf().m_caItems.push_back(item);
+  RequesterState state(m_keyChain, item, RequestType::NEW);
   auto current_tp = time::system_clock::now();
-  auto interest1 = client.generateNewInterest(current_tp, current_tp - time::hours(1),
-                                              Name("/ndn/zhiyi"));
-  auto interest2 = client.generateNewInterest(current_tp, current_tp + time::days(361),
-                                              Name("/ndn/zhiyi"));
-  auto interest3 = client.generateNewInterest(current_tp - time::hours(1),
-                                              current_tp + time::hours(2),
-                                              Name("/ndn/zhiyi"));
+  auto interest1 = Requester::genNewInterest(state, Name("/ndn/zhiyi"), current_tp, current_tp - time::hours(1));
+  auto interest2 = Requester::genNewInterest(state, Name("/ndn/zhiyi"), current_tp, current_tp + time::days(361));
+  auto interest3 = Requester::genNewInterest(state, Name("/ndn/zhiyi"), current_tp - time::hours(1), current_tp + time::hours(2));
   face.onSendData.connect([&](const Data& response) {
     auto contentTlv = response.getContent();
     contentTlv.parse();
@@ -258,21 +251,17 @@
   CaModule ca(face, m_keyChain, "tests/unit-tests/config-files/config-ca-1", "ca-storage-memory");
   advanceClocks(time::milliseconds(20), 60);
 
-  ClientModule client(m_keyChain);
-  CaConfigItem item;
+  CaProfile item;
   item.m_caPrefix = Name("/ndn");
   item.m_cert = std::make_shared<security::v2::Certificate>(cert);
-  client.getClientConf().m_caItems.push_back(item);
+  RequesterState state(m_keyChain, item, RequestType::NEW);
 
-  auto interest1 = client.generateNewInterest(time::system_clock::now(),
-                                              time::system_clock::now() + time::days(1),
-                                              Name("/ndn/a"));
-  auto interest2 = client.generateNewInterest(time::system_clock::now(),
-                                              time::system_clock::now() + time::days(1),
-                                              Name("/ndn/a/b"));
-  auto interest3 = client.generateNewInterest(time::system_clock::now(),
-                                              time::system_clock::now() + time::days(1),
-                                              Name("/ndn/a/b/c/d"));
+  auto interest1 = Requester::genNewInterest(state, Name("/ndn/a"), time::system_clock::now(),
+                                              time::system_clock::now() + time::days(1));
+  auto interest2 = Requester::genNewInterest(state, Name("/ndn/a/b"), time::system_clock::now(),
+                                              time::system_clock::now() + time::days(1));
+  auto interest3 = Requester::genNewInterest(state, Name("/ndn/a/b/c/d"), time::system_clock::now(),
+                                              time::system_clock::now() + time::days(1));
 
   face.onSendData.connect([&](const Data& response) {
     auto contentTlv = response.getContent();
@@ -303,14 +292,14 @@
   CaModule ca(face, m_keyChain, "tests/unit-tests/config-files/config-ca-1");
   advanceClocks(time::milliseconds(20), 60);
 
-  ClientModule client(m_keyChain);
-  CaConfigItem item;
+  CaProfile item;
   item.m_caPrefix = Name("/ndn");
   item.m_cert = std::make_shared<security::v2::Certificate>(cert);
-  client.getClientConf().m_caItems.push_back(item);
+  RequesterState state(m_keyChain, item, RequestType::NEW);
+
   auto current_tp = time::system_clock::now();
-  auto interest1 = client.generateNewInterest(current_tp, current_tp + time::days(1), Name("/ndn"));
-  auto interest2 = client.generateNewInterest(current_tp, current_tp + time::days(1), Name("/ndn/a/b/c/d"));
+  auto interest1 = Requester::genNewInterest(state, Name("/ndn"), current_tp, current_tp + time::days(1));
+  auto interest2 = Requester::genNewInterest(state, Name("/ndn/a/b/c/d"), current_tp, current_tp + time::days(1));
   face.onSendData.connect([&](const Data& response) {
     auto contentTlv = response.getContent();
     contentTlv.parse();
@@ -334,16 +323,15 @@
   advanceClocks(time::milliseconds(20), 60);
 
   // generate NEW Interest
-  ClientModule client(m_keyChain);
-  CaConfigItem item;
+  CaProfile item;
   item.m_caPrefix = Name("/ndn");
   item.m_cert = std::make_shared<security::v2::Certificate>(cert);
-  client.getClientConf().m_caItems.push_back(item);
-  auto newInterest = client.generateNewInterest(time::system_clock::now(),
-                                                time::system_clock::now() + time::days(1), Name("/ndn/zhiyi"));
+  RequesterState state(m_keyChain, item, RequestType::NEW);
+
+  auto newInterest = Requester::genNewInterest(state, Name("/ndn/zhiyi"), time::system_clock::now(),
+                                                time::system_clock::now() + time::days(1));
 
   // generate CHALLENGE Interest
-  ChallengePin pinChallenge;
   shared_ptr<Interest> challengeInterest = nullptr;
   shared_ptr<Interest> challengeInterest2 = nullptr;
   shared_ptr<Interest> challengeInterest3 = nullptr;
@@ -351,47 +339,40 @@
   int count = 0;
   face.onSendData.connect([&](const Data& response) {
     if (Name("/ndn/CA/NEW").isPrefixOf(response.getName())) {
-      client.onNewRenewRevokeResponse(response);
-      auto paramList = pinChallenge.getRequestedParameterList(client.m_status, client.m_challengeStatus);
-      challengeInterest = client.generateChallengeInterest(pinChallenge.genChallengeRequestTLV(client.m_status,
-                                                                                               client.m_challengeStatus,
-                                                                                               std::move(paramList)));
+      auto challengeList = Requester::onNewRenewRevokeResponse(state, response);
+      auto paramList = Requester::selectOrContinueChallenge(state, "pin");
+      challengeInterest = Requester::genChallengeInterest(state, std::move(paramList));
     }
     else if (Name("/ndn/CA/CHALLENGE").isPrefixOf(response.getName()) && count == 0) {
       count++;
       BOOST_CHECK(security::verifySignature(response, cert));
 
-      client.onChallengeResponse(response);
-      BOOST_CHECK(client.m_status == Status::CHALLENGE);
-      BOOST_CHECK_EQUAL(client.m_challengeStatus, ChallengePin::NEED_CODE);
-
-      auto paramList = pinChallenge.getRequestedParameterList(client.m_status, client.m_challengeStatus);
-      challengeInterest2 = client.generateChallengeInterest(pinChallenge.genChallengeRequestTLV(client.m_status,
-                                                                                                client.m_challengeStatus,
-                                                                                                std::move(paramList)));
+      Requester::onChallengeResponse(state, response);
+      BOOST_CHECK(state.m_status == Status::CHALLENGE);
+      BOOST_CHECK_EQUAL(state.m_challengeStatus, ChallengePin::NEED_CODE);
+      auto paramList = Requester::selectOrContinueChallenge(state, "pin");
+      challengeInterest2 = Requester::genChallengeInterest(state, std::move(paramList));
     }
     else if (Name("/ndn/CA/CHALLENGE").isPrefixOf(response.getName()) && count == 1) {
       count++;
       BOOST_CHECK(security::verifySignature(response, cert));
 
-      client.onChallengeResponse(response);
-      BOOST_CHECK(client.m_status == Status::CHALLENGE);
-      BOOST_CHECK_EQUAL(client.m_challengeStatus, ChallengePin::WRONG_CODE);
+      Requester::onChallengeResponse(state, response);
+      BOOST_CHECK(state.m_status == Status::CHALLENGE);
+      BOOST_CHECK_EQUAL(state.m_challengeStatus, ChallengePin::WRONG_CODE);
 
-      auto paramList = pinChallenge.getRequestedParameterList(client.m_status, client.m_challengeStatus);
+      auto paramList = Requester::selectOrContinueChallenge(state, "pin");
       auto request = ca.getCertificateRequest(*challengeInterest2);
       auto secret = request.m_challengeState->m_secrets.get(ChallengePin::PARAMETER_KEY_CODE, "");
       std::get<1>(paramList[0]) = secret;
-      challengeInterest3 = client.generateChallengeInterest(pinChallenge.genChallengeRequestTLV(client.m_status,
-                                                                                                client.m_challengeStatus,
-                                                                                                std::move(paramList)));
+      challengeInterest3 = Requester::genChallengeInterest(state, std::move(paramList));
+      std::cout << "CHALLENGE Interest Size: " << challengeInterest3->wireEncode().size() << std::endl;
     }
     else if (Name("/ndn/CA/CHALLENGE").isPrefixOf(response.getName()) && count == 2) {
       count++;
       BOOST_CHECK(security::verifySignature(response, cert));
-
-      client.onChallengeResponse(response);
-      BOOST_CHECK(client.m_status == Status::SUCCESS);
+      Requester::onChallengeResponse(state, response);
+      BOOST_CHECK(state.m_status == Status::SUCCESS);
     }
   });
 
@@ -431,13 +412,12 @@
   RequestState certRequest(Name("/ndn"), "122", RequestType::NEW, Status::SUCCESS, clientCert, makeEmptyBlock(tlv::ContentType_Key));
   auto issuedCert = ca.issueCertificate(certRequest);
 
-  ClientModule client(m_keyChain);
-  CaConfigItem item;
+  CaProfile item;
   item.m_caPrefix = Name("/ndn");
   item.m_cert = std::make_shared<security::v2::Certificate>(cert);
-  client.getClientConf().m_caItems.push_back(item);
+  RequesterState state(m_keyChain, item, RequestType::REVOKE);
 
-  auto interest = client.generateRevokeInterest(issuedCert);
+  auto interest = Requester::genRevokeInterest(state, issuedCert);
 
   int count = 0;
   face.onSendData.connect([&](const Data& response) {
@@ -459,9 +439,9 @@
 
     BOOST_CHECK(challengeBlockCount != 0);
 
-    client.onNewRenewRevokeResponse(response);
+    auto challengeList = Requester::onNewRenewRevokeResponse(state, response);
     auto ca_encryption_key = ca.getCaStorage()->getRequest(readString(contentBlock.get(tlv_request_id))).m_encryptionKey;
-    BOOST_CHECK_EQUAL_COLLECTIONS(client.m_aesKey, client.m_aesKey + sizeof(client.m_aesKey),
+    BOOST_CHECK_EQUAL_COLLECTIONS(state.m_aesKey, state.m_aesKey + sizeof(state.m_aesKey),
                                   ca_encryption_key.value(), ca_encryption_key.value() + ca_encryption_key.value_size());
   });
   face.receive(*interest);
@@ -493,13 +473,12 @@
                                                            time::system_clock::now() + time::hours(10)));
   m_keyChain.sign(clientCert, signingByKey(clientKey.getName()).setSignatureInfo(signatureInfo));
 
-  ClientModule client(m_keyChain);
-  CaConfigItem item;
+  CaProfile item;
   item.m_caPrefix = Name("/ndn");
   item.m_cert = std::make_shared<security::v2::Certificate>(cert);
-  client.getClientConf().m_caItems.push_back(item);
+  RequesterState state(m_keyChain, item, RequestType::NEW);
 
-  auto interest = client.generateRevokeInterest(clientCert);
+  auto interest = Requester::genRevokeInterest(state, clientCert);
 
   bool receiveData = false;
   face.onSendData.connect([&](const Data& response) {
diff --git a/tests/unit-tests/client-module.t.cpp b/tests/unit-tests/client-module.t.cpp
index eb4cd45..79baee2 100644
--- a/tests/unit-tests/client-module.t.cpp
+++ b/tests/unit-tests/client-module.t.cpp
@@ -19,7 +19,7 @@
  */
 
 #include <protocol-detail/error.hpp>
-#include "client-module.hpp"
+#include "requester.hpp"
 #include "challenge-module.hpp"
 #include "ca-module.hpp"
 #include "test-common.hpp"
@@ -28,43 +28,7 @@
 namespace ndncert {
 namespace tests {
 
-BOOST_FIXTURE_TEST_SUITE(TestClientModule, IdentityManagementTimeFixture)
-
-BOOST_AUTO_TEST_CASE(ClientModuleInitialize)
-{
-  ClientModule client(m_keyChain);
-  client.getClientConf().load("tests/unit-tests/config-files/config-client-1");
-  BOOST_CHECK_EQUAL(client.getClientConf().m_caItems.size(), 2);
-}
-
-BOOST_AUTO_TEST_CASE(Probe)
-{
-  ClientModule client(m_keyChain);
-  client.getClientConf().load("tests/unit-tests/config-files/config-client-1");
-
-  auto identity = addIdentity(Name("/site"));
-  auto key = identity.getDefaultKey();
-  auto cert = key.getDefaultCertificate();
-
-  CaConfigItem item;
-  item.m_probeParameterKeys.push_back("email");
-  item.m_probeParameterKeys.push_back("uid");
-  item.m_probeParameterKeys.push_back("name");
-  item.m_caPrefix = Name("/site");
-  item.m_cert = std::make_shared<security::v2::Certificate>(cert);
-  client.getClientConf().m_caItems.push_back(item);
-
-  std::vector<std::tuple<std::string, std::string>> probeParams;
-  probeParams.push_back(std::make_tuple("email", "zhiyi@cs.ucla.edu"));
-  probeParams.push_back(std::make_tuple("uid", "987654321"));
-  probeParams.push_back(std::make_tuple("name", "Zhiyi Zhang"));
-  auto firstInterest = client.generateProbeInterest(item, std::move(probeParams));
-  BOOST_CHECK(firstInterest->getName().at(-1).isParametersSha256Digest());
-  // ignore the last name component (ParametersSha256Digest)
-  BOOST_CHECK_EQUAL(firstInterest->getName().getPrefix(-1), "/site/CA/PROBE");
-  BOOST_CHECK_EQUAL(readString(firstInterest->getApplicationParameters().get(tlv_parameter_value)),
-                    "zhiyi@cs.ucla.edu");
-}
+BOOST_FIXTURE_TEST_SUITE(TestRequester, IdentityManagementTimeFixture)
 
 BOOST_AUTO_TEST_CASE(ErrorHandling)
 {
@@ -72,47 +36,24 @@
   auto key = identity.getDefaultKey();
   auto cert = key.getDefaultCertificate();
 
-  ClientModule client(m_keyChain);
-  CaConfigItem item;
+  CaProfile item;
   item.m_caPrefix = Name("/site");
   item.m_cert = std::make_shared<security::v2::Certificate>(cert);
-  client.getClientConf().m_caItems.push_back(item);
-
-  client.generateProbeInterest(item,std::vector<std::tuple<std::string, std::string>>());
+  RequesterState state(m_keyChain, item, RequestType::NEW);
 
   Data errorPacket;
   errorPacket.setName(Name("/site/pretend/this/is/error/packet"));
   errorPacket.setFreshnessPeriod(time::seconds(100));
-  errorPacket.setContent(ErrorTLV::encodeDataContent(ErrorCode::NO_ERROR, "This is a test."));
+  errorPacket.setContent(ErrorTLV::encodeDataContent(ErrorCode::INVALID_PARAMETER, "This is a test."));
   m_keyChain.sign(errorPacket, signingByIdentity(identity));
 
-  BOOST_CHECK_THROW(client.onProbeResponse(errorPacket), std::exception);
-  BOOST_CHECK_THROW(client.onNewRenewRevokeResponse(errorPacket), std::exception);
-  BOOST_CHECK_THROW(client.onChallengeResponse(errorPacket), std::exception);
+  std::vector<Name> ids, cas;
+  BOOST_CHECK_THROW(Requester::onProbeResponse(errorPacket, item, ids, cas), std::runtime_error);
+  BOOST_CHECK_THROW(Requester::onNewRenewRevokeResponse(state, errorPacket), std::runtime_error);
+  BOOST_CHECK_THROW(Requester::onChallengeResponse(state, errorPacket), std::runtime_error);
 }
 
-// BOOST_AUTO_TEST_CASE(GenProbeRequestJson)
-// {
-//   ClientModule client(m_keyChain);
-//   client.getClientConf().load("tests/unit-tests/config-files/config-client-1");
-
-//   auto identity = addIdentity(Name("/site"));
-//   auto key = identity.getDefaultKey();
-//   auto cert = key.getDefaultCertificate();
-
-//   CaConfigItem item;
-//   item.m_probe = "email:uid:name";
-//   item.m_caPrefix = Name("/site");
-//   item.m_cert = std::make_shared<security::v2::Certificate>(cert);
-//   client.getClientConf().m_caItems.push_back(item);
-
-//   auto interestPacket = client.genProbeRequestJson(item, "yufeng@ucla.edu:123456789:Yufeng Zhang");
-//   BOOST_CHECK_EQUAL(interestPacket.get("email", ""), "yufeng@ucla.edu");
-//   BOOST_CHECK_EQUAL(interestPacket.get("uid", ""), "123456789");
-//   BOOST_CHECK_EQUAL(interestPacket.get("name", ""), "Yufeng Zhang");
-// }
-
-BOOST_AUTO_TEST_SUITE_END() // TestClientModule
+BOOST_AUTO_TEST_SUITE_END() // TestRequester
 
 } // namespace tests
 } // namespace ndncert
diff --git a/tests/unit-tests/configuration.t.cpp b/tests/unit-tests/configuration.t.cpp
index ec47f9d..d7cb506 100644
--- a/tests/unit-tests/configuration.t.cpp
+++ b/tests/unit-tests/configuration.t.cpp
@@ -67,9 +67,9 @@
   BOOST_CHECK_THROW(config.load("tests/unit-tests/config-files/config-ca-4"), std::runtime_error);
 }
 
-BOOST_AUTO_TEST_CASE(ClientConfigFile)
+BOOST_AUTO_TEST_CASE(RequesterCaCacheFile)
 {
-  ClientConfig config;
+  RequesterCaCache config;
   config.load("tests/unit-tests/config-files/config-client-1");
   BOOST_CHECK_EQUAL(config.m_caItems.size(), 2);
 
@@ -93,9 +93,9 @@
                     "/ndn/site1/KEY/%11%BC%22%F4c%15%FF%17/self/%FD%00%00%01Y%C8%14%D9%A5");
 }
 
-BOOST_AUTO_TEST_CASE(ClientConfigFileWithErrors)
+BOOST_AUTO_TEST_CASE(RequesterCaCacheFileWithErrors)
 {
-  ClientConfig config;
+  RequesterCaCache config;
   // nonexistent file
   BOOST_CHECK_THROW(config.load("tests/unit-tests/config-files/Nonexist"), std::runtime_error);
   // missing certificate
@@ -104,12 +104,12 @@
   BOOST_CHECK_THROW(config.load("tests/unit-tests/config-files/config-client-3"), std::runtime_error);
 }
 
-BOOST_AUTO_TEST_CASE(ClientConfigFileAddAndRemoveCaItem)
+BOOST_AUTO_TEST_CASE(RequesterCaCacheFileAddAndremoveCaProfile)
 {
-  ClientConfig config;
+  RequesterCaCache config;
   config.load("tests/unit-tests/config-files/config-client-1");
 
-  CaConfigItem item;
+  CaProfile item;
   item.m_caPrefix = Name("/test");
   item.m_caInfo = "test";
 
@@ -118,7 +118,7 @@
   auto lastItem = config.m_caItems.back();
   BOOST_CHECK_EQUAL(lastItem.m_caPrefix, "/test");
 
-  config.removeCaItem(Name("/test"));
+  config.removeCaProfile(Name("/test"));
   BOOST_CHECK_EQUAL(config.m_caItems.size(), 2);
   lastItem = config.m_caItems.back();
   BOOST_CHECK_EQUAL(lastItem.m_caPrefix, "/ndn/edu/ucla/zhiyi");