base catalog version on ChronoSync

* remove the redundant TableColumns in publishAdapter
* share chonosync::Socket in adapters to allow queryAdapter to use digest as version
* add various levels of log messages

refs: #2770

Change-Id: Id5aca0f84d9b7963fc63bf0329fbc6394f2b5777
diff --git a/catalog/tests/unit-tests/publish/test-publish-adapter.cpp b/catalog/tests/unit-tests/publish/test-publish-adapter.cpp
index 8ff0486..99d7e90 100644
--- a/catalog/tests/unit-tests/publish/test-publish-adapter.cpp
+++ b/catalog/tests/unit-tests/publish/test-publish-adapter.cpp
@@ -35,8 +35,9 @@
   {
   public:
     PublishAdapterTest(const std::shared_ptr<ndn::util::DummyClientFace>& face,
-                       const std::shared_ptr<ndn::KeyChain>& keyChain)
-      : publish::PublishAdapter<std::string>(face, keyChain)
+                       const std::shared_ptr<ndn::KeyChain>& keyChain,
+                       std::shared_ptr<chronosync::Socket>& syncSocket)
+      : publish::PublishAdapter<std::string>(face, keyChain, syncSocket)
     {
     }
 
@@ -111,8 +112,8 @@
       : face(makeDummyClientFace(io))
       , keyChain(new ndn::KeyChain())
       , databaseTable("cmip5")
-      , publishAdapterTest1(face, keyChain)
-      , publishAdapterTest2(face, keyChain)
+      , publishAdapterTest1(face, keyChain, syncSocket)
+      , publishAdapterTest2(face, keyChain, syncSocket)
     {
       std::string cx("sha256"), c0("name"), c1("activity"), c2("product"), c3("organization");
       std::string c4("model"), c5("experiment"), c6("frequency"), c7("modeling_realm");
@@ -197,6 +198,7 @@
   protected:
     std::shared_ptr<DummyClientFace> face;
     std::shared_ptr<ndn::KeyChain> keyChain;
+    std::shared_ptr<chronosync::Socket> syncSocket;
     std::vector<std::string> tableFields;
     std::string databaseTable;
     PublishAdapterTest publishAdapterTest1;
diff --git a/catalog/tests/unit-tests/query/test-query-adapter.cpp b/catalog/tests/unit-tests/query/test-query-adapter.cpp
index 8b210b7..c9252d3 100644
--- a/catalog/tests/unit-tests/query/test-query-adapter.cpp
+++ b/catalog/tests/unit-tests/query/test-query-adapter.cpp
@@ -35,8 +35,9 @@
   {
   public:
     QueryAdapterTest(const std::shared_ptr<ndn::util::DummyClientFace>& face,
-                     const std::shared_ptr<ndn::KeyChain>& keyChain)
-      : query::QueryAdapter<std::string>(face, keyChain)
+                     const std::shared_ptr<ndn::KeyChain>& keyChain,
+                     const std::shared_ptr<chronosync::Socket>& syncSocket)
+      : query::QueryAdapter<std::string>(face, keyChain, syncSocket)
     {
     }
 
@@ -131,21 +132,6 @@
     }
 
     std::shared_ptr<const ndn::Data>
-    getDataFromActiveQuery(const std::string& jsonQuery)
-    {
-      m_mutex.lock();
-      if (m_activeQueryToFirstResponse.find(jsonQuery) != m_activeQueryToFirstResponse.end()) {
-        auto iter = m_activeQueryToFirstResponse.find(jsonQuery);
-        if (iter != m_activeQueryToFirstResponse.end()) {
-          m_mutex.unlock();
-          return iter->second;
-        }
-      }
-      m_mutex.unlock();
-      return std::shared_ptr<const ndn::Data>();
-    }
-
-    std::shared_ptr<const ndn::Data>
     getDataFromCache(const ndn::Interest& interest)
     {
       return m_cache.find(interest);
@@ -181,8 +167,8 @@
       : face(makeDummyClientFace(io))
       , keyChain(new ndn::KeyChain())
       , databaseTable("cmip5")
-      , queryAdapterTest1(face, keyChain)
-      , queryAdapterTest2(face, keyChain)
+      , queryAdapterTest1(face, keyChain, syncSocket)
+      , queryAdapterTest2(face, keyChain, syncSocket)
     {
       std::string c1("activity"), c2("product"), c3("organization"), c4("model");
       std::string c5("experiment"), c6("frequency"), c7("modeling_realm"), c8("variable_name");
@@ -261,6 +247,7 @@
   protected:
     std::shared_ptr<DummyClientFace> face;
     std::shared_ptr<ndn::KeyChain> keyChain;
+    std::shared_ptr<chronosync::Socket> syncSocket;
     std::string databaseTable;
     std::vector<std::string> nameFields;
     QueryAdapterTest queryAdapterTest1;