lsa: simplify initializeFromContent and improve naming
refs: #4354
Change-Id: I5ddd5a9f482f59e6ca52061ac92514feab8c3070
diff --git a/tests/mocks/lsa.cpp b/tests/mocks/lsa.cpp
index f4f6348..3ab6689 100644
--- a/tests/mocks/lsa.cpp
+++ b/tests/mocks/lsa.cpp
@@ -31,22 +31,15 @@
}
bool
-MockLsa::initializeFromContent(const std::string& content)
+MockLsa::deserialize(const std::string& content)
{
boost::char_separator<char> sep("|");
boost::tokenizer<boost::char_separator<char> >tokens(content, sep);
boost::tokenizer<boost::char_separator<char> >::iterator tok_iter =
tokens.begin();
- m_origRouter = ndn::Name(*tok_iter++);
- if (!(m_origRouter.size() > 0)) {
- return false;
- }
+
try {
- if (*tok_iter++ != std::to_string(Lsa::Type::MOCK)) {
- return false;
- }
- m_lsSeqNo = boost::lexical_cast<uint32_t>(*tok_iter++);
- m_expirationTimePoint = ndn::time::fromIsoString(*tok_iter++);
+ deserializeCommon(tok_iter);
}
catch (const std::exception& e) {
return false;
diff --git a/tests/mocks/lsa.hpp b/tests/mocks/lsa.hpp
index 738ad8f..0ce6e3a 100644
--- a/tests/mocks/lsa.hpp
+++ b/tests/mocks/lsa.hpp
@@ -42,7 +42,7 @@
serialize() const override;
bool
- initializeFromContent(const std::string& content) override;
+ deserialize(const std::string& content) override;
};
} // namespace test