update ca-profile
Change-Id: Iae0124f4ea1e366976eed307a96e3dd540a56278
diff --git a/tests/unit-tests/ca-module.t.cpp b/tests/unit-tests/ca-module.t.cpp
index bd6828d..f9b6ba2 100644
--- a/tests/unit-tests/ca-module.t.cpp
+++ b/tests/unit-tests/ca-module.t.cpp
@@ -38,7 +38,7 @@
{
util::DummyClientFace face(io, m_keyChain, {true, true});
CaModule ca(face, m_keyChain, "tests/unit-tests/config-files/config-ca-1", "ca-storage-memory");
- BOOST_CHECK_EQUAL(ca.getCaConf().m_caItem.m_caPrefix, "/ndn");
+ BOOST_CHECK_EQUAL(ca.getCaConf().m_caProfile.m_caPrefix, "/ndn");
advanceClocks(time::milliseconds(20), 60);
BOOST_CHECK_EQUAL(ca.m_registeredPrefixHandles.size(), 1); // removed local discovery registration
diff --git a/tests/unit-tests/configuration.t.cpp b/tests/unit-tests/configuration.t.cpp
index c2f84e8..9b5c8b5 100644
--- a/tests/unit-tests/configuration.t.cpp
+++ b/tests/unit-tests/configuration.t.cpp
@@ -33,27 +33,27 @@
{
ca::CaConfig config;
config.load("tests/unit-tests/config-files/config-ca-1");
- BOOST_CHECK_EQUAL(config.m_caItem.m_caPrefix, "/ndn");
- BOOST_CHECK_EQUAL(config.m_caItem.m_caInfo, "ndn testbed ca");
- BOOST_CHECK_EQUAL(config.m_caItem.m_maxValidityPeriod, time::seconds(864000));
- BOOST_CHECK_EQUAL(*config.m_caItem.m_maxSuffixLength, 3);
- BOOST_CHECK_EQUAL(config.m_caItem.m_probeParameterKeys.size(), 1);
- BOOST_CHECK_EQUAL(config.m_caItem.m_probeParameterKeys.front(), "full name");
- BOOST_CHECK_EQUAL(config.m_caItem.m_supportedChallenges.size(), 1);
- BOOST_CHECK_EQUAL(config.m_caItem.m_supportedChallenges.front(), "pin");
+ BOOST_CHECK_EQUAL(config.m_caProfile.m_caPrefix, "/ndn");
+ BOOST_CHECK_EQUAL(config.m_caProfile.m_caInfo, "ndn testbed ca");
+ BOOST_CHECK_EQUAL(config.m_caProfile.m_maxValidityPeriod, time::seconds(864000));
+ BOOST_CHECK_EQUAL(*config.m_caProfile.m_maxSuffixLength, 3);
+ BOOST_CHECK_EQUAL(config.m_caProfile.m_probeParameterKeys.size(), 1);
+ BOOST_CHECK_EQUAL(config.m_caProfile.m_probeParameterKeys.front(), "full name");
+ BOOST_CHECK_EQUAL(config.m_caProfile.m_supportedChallenges.size(), 1);
+ BOOST_CHECK_EQUAL(config.m_caProfile.m_supportedChallenges.front(), "pin");
config.load("tests/unit-tests/config-files/config-ca-2");
- BOOST_CHECK_EQUAL(config.m_caItem.m_caPrefix, "/ndn");
- BOOST_CHECK_EQUAL(config.m_caItem.m_caInfo, "missing max validity period, max suffix length, and probe");
- BOOST_CHECK_EQUAL(config.m_caItem.m_maxValidityPeriod, time::seconds(86400));
- BOOST_CHECK(!config.m_caItem.m_maxSuffixLength.has_value());
- BOOST_CHECK_EQUAL(config.m_caItem.m_probeParameterKeys.size(), 0);
- BOOST_CHECK_EQUAL(config.m_caItem.m_supportedChallenges.size(), 2);
- BOOST_CHECK_EQUAL(config.m_caItem.m_supportedChallenges.front(), "pin");
- BOOST_CHECK_EQUAL(config.m_caItem.m_supportedChallenges.back(), "email");
+ BOOST_CHECK_EQUAL(config.m_caProfile.m_caPrefix, "/ndn");
+ BOOST_CHECK_EQUAL(config.m_caProfile.m_caInfo, "missing max validity period, max suffix length, and probe");
+ BOOST_CHECK_EQUAL(config.m_caProfile.m_maxValidityPeriod, time::seconds(86400));
+ BOOST_CHECK(!config.m_caProfile.m_maxSuffixLength.has_value());
+ BOOST_CHECK_EQUAL(config.m_caProfile.m_probeParameterKeys.size(), 0);
+ BOOST_CHECK_EQUAL(config.m_caProfile.m_supportedChallenges.size(), 2);
+ BOOST_CHECK_EQUAL(config.m_caProfile.m_supportedChallenges.front(), "pin");
+ BOOST_CHECK_EQUAL(config.m_caProfile.m_supportedChallenges.back(), "email");
config.load("tests/unit-tests/config-files/config-ca-5");
- BOOST_CHECK_EQUAL(config.m_redirection->at(0)->getName(),
+ BOOST_CHECK_EQUAL(config.m_redirection[0]->getName(),
"/ndn/site1/KEY/%11%BC%22%F4c%15%FF%17/self/%FD%00%00%01Y%C8%14%D9%A5");
BOOST_CHECK_EQUAL(config.m_nameAssignmentFuncs.size(), 3);
BOOST_CHECK_EQUAL(config.m_nameAssignmentFuncs[0]->m_nameFormat[0], "group");
@@ -91,9 +91,9 @@
{
requester::ProfileStorage profileStorage;
profileStorage.load("tests/unit-tests/config-files/config-client-1");
- BOOST_CHECK_EQUAL(profileStorage.getCaItems().size(), 2);
+ BOOST_CHECK_EQUAL(profileStorage.getCaProfiles().size(), 2);
- auto& profile1 = profileStorage.getCaItems().front();
+ auto& profile1 = profileStorage.getCaProfiles().front();
BOOST_CHECK_EQUAL(profile1.m_caPrefix, "/ndn/edu/ucla");
BOOST_CHECK_EQUAL(profile1.m_caInfo, "ndn testbed ca");
BOOST_CHECK_EQUAL(profile1.m_maxValidityPeriod, time::seconds(864000));
@@ -103,7 +103,7 @@
BOOST_CHECK_EQUAL(profile1.m_cert->getName(),
"/ndn/site1/KEY/%11%BC%22%F4c%15%FF%17/self/%FD%00%00%01Y%C8%14%D9%A5");
- auto& profile2 = profileStorage.getCaItems().back();
+ auto& profile2 = profileStorage.getCaProfiles().back();
BOOST_CHECK_EQUAL(profile2.m_caPrefix, "/ndn/edu/ucla/zhiyi");
BOOST_CHECK_EQUAL(profile2.m_caInfo, "");
BOOST_CHECK_EQUAL(profile2.m_maxValidityPeriod, time::seconds(86400));
@@ -134,13 +134,13 @@
item.m_caInfo = "test";
profileStorage.addCaProfile(item);
- BOOST_CHECK_EQUAL(profileStorage.getCaItems().size(), 3);
- auto lastItem = profileStorage.getCaItems().back();
+ BOOST_CHECK_EQUAL(profileStorage.getCaProfiles().size(), 3);
+ auto lastItem = profileStorage.getCaProfiles().back();
BOOST_CHECK_EQUAL(lastItem.m_caPrefix, "/test");
profileStorage.removeCaProfile(Name("/test"));
- BOOST_CHECK_EQUAL(profileStorage.getCaItems().size(), 2);
- lastItem = profileStorage.getCaItems().back();
+ BOOST_CHECK_EQUAL(profileStorage.getCaProfiles().size(), 2);
+ lastItem = profileStorage.getCaProfiles().back();
BOOST_CHECK_EQUAL(lastItem.m_caPrefix, "/ndn/edu/ucla/zhiyi");
}
diff --git a/tests/unit-tests/protocol-encoders.t.cpp b/tests/unit-tests/protocol-encoders.t.cpp
index 94673b8..a570e6e 100644
--- a/tests/unit-tests/protocol-encoders.t.cpp
+++ b/tests/unit-tests/protocol-encoders.t.cpp
@@ -40,17 +40,17 @@
requester::ProfileStorage caCache;
caCache.load("tests/unit-tests/config-files/config-client-1");
- auto& cert = caCache.getCaItems().front().m_cert;
+ auto& cert = caCache.getCaProfiles().front().m_cert;
- auto b = infotlv::encodeDataContent(config.m_caItem, *cert);
+ auto b = infotlv::encodeDataContent(config.m_caProfile, *cert);
auto item = infotlv::decodeDataContent(b);
BOOST_CHECK_EQUAL(*item.m_cert, *cert);
- BOOST_CHECK_EQUAL(item.m_caInfo, config.m_caItem.m_caInfo);
- BOOST_CHECK_EQUAL(item.m_caPrefix, config.m_caItem.m_caPrefix);
+ BOOST_CHECK_EQUAL(item.m_caInfo, config.m_caProfile.m_caInfo);
+ BOOST_CHECK_EQUAL(item.m_caPrefix, config.m_caProfile.m_caPrefix);
BOOST_CHECK_EQUAL_COLLECTIONS(item.m_probeParameterKeys.begin(), item.m_probeParameterKeys.end(),
- config.m_caItem.m_probeParameterKeys.begin(), config.m_caItem.m_probeParameterKeys.end());
- BOOST_CHECK_EQUAL(item.m_maxValidityPeriod, config.m_caItem.m_maxValidityPeriod);
+ config.m_caProfile.m_probeParameterKeys.begin(), config.m_caProfile.m_probeParameterKeys.end());
+ BOOST_CHECK_EQUAL(item.m_maxValidityPeriod, config.m_caProfile.m_maxValidityPeriod);
}
BOOST_AUTO_TEST_CASE(ErrorEncoding)
@@ -92,10 +92,10 @@
BOOST_CHECK_EQUAL(it1->first, *it2);
BOOST_CHECK_EQUAL(it1->second, 2);
}
- BOOST_CHECK_EQUAL(redirection.size(), config.m_redirection->size());
+ BOOST_CHECK_EQUAL(redirection.size(), config.m_redirection.size());
auto it3 = redirection.begin();
- auto it4 = config.m_redirection->begin();
- for (; it3 != redirection.end() && it4 != config.m_redirection->end(); it3++, it4++) {
+ auto it4 = config.m_redirection.begin();
+ for (; it3 != redirection.end() && it4 != config.m_redirection.end(); it3++, it4++) {
BOOST_CHECK_EQUAL(*it3, (*it4)->getFullName());
}
}
@@ -104,7 +104,7 @@
{
requester::ProfileStorage caCache;
caCache.load("tests/unit-tests/config-files/config-client-1");
- auto& certRequest = caCache.getCaItems().front().m_cert;
+ auto& certRequest = caCache.getCaProfiles().front().m_cert;
std::vector<uint8_t> pub = ECDHState().getSelfPubKey();
auto b = requesttlv::encodeApplicationParameters(RequestType::REVOKE, pub, *certRequest);
std::vector<uint8_t> returnedPub;
@@ -145,7 +145,7 @@
0xe0, 0xff, 0x56, 0x83, 0xf2, 0x43, 0xb2, 0x13};
requester::ProfileStorage caCache;
caCache.load("tests/unit-tests/config-files/config-client-1");
- security::Certificate certRequest = *caCache.getCaItems().front().m_cert;
+ security::Certificate certRequest = *caCache.getCaProfiles().front().m_cert;
RequestId id = {{102}};
std::array<uint8_t, 16> aesKey;
std::memcpy(aesKey.data(), key, sizeof(key));
@@ -154,7 +154,7 @@
std::move(aesKey), 0);
auto contentBlock = challengetlv::encodeDataContent(state, Name("/ndn/ucla/a/b/c"));
- requester::RequestState context(m_keyChain, caCache.getCaItems().front(), RequestType::NEW);
+ requester::RequestState context(m_keyChain, caCache.getCaProfiles().front(), RequestType::NEW);
context.m_requestId = id;
std::memcpy(context.m_aesKey.data(), key, sizeof(key));
challengetlv::decodeDataContent(contentBlock, context);