diff --git a/tests/unit/daemon/db-mgr.cpp b/tests/unit/daemon/db-mgr.cpp
new file mode 100644
index 0000000..fb621d2
--- /dev/null
+++ b/tests/unit/daemon/db-mgr.cpp
@@ -0,0 +1,221 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014, Regents of the University of California.
+ *
+ * This file is part of NDNS (Named Data Networking Domain Name Service).
+ * See AUTHORS.md for complete list of NDNS authors and contributors.
+ *
+ * NDNS is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NDNS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.hpp"
+#include "daemon/db-mgr.hpp"
+#include "logger.hpp"
+
+#include "../../boost-test.hpp"
+#include <boost/filesystem.hpp>
+
+#include <algorithm>    // std::sort
+
+namespace ndn {
+namespace ndns {
+namespace tests {
+
+NDNS_LOG_INIT("DbMgrTest")
+
+BOOST_AUTO_TEST_SUITE(DbMgr)
+
+static const boost::filesystem::path TEST_DATABASE2 = TEST_CONFIG_PATH "/" "test-ndns.db";
+
+class DbMgrFixture
+{
+public:
+  DbMgrFixture()
+    : session(TEST_DATABASE2.string())
+  {
+  }
+
+  ~DbMgrFixture()
+  {
+    session.close();
+    boost::filesystem::remove(TEST_DATABASE2);
+    NDNS_LOG_INFO("remove database " << TEST_DATABASE2);
+  }
+
+public:
+  ndns::DbMgr session;
+};
+
+
+
+BOOST_FIXTURE_TEST_CASE(Zones, DbMgrFixture)
+{
+  Zone zone1;
+  zone1.setName("/net");
+  zone1.setTtl(time::seconds(4600));
+  BOOST_CHECK_NO_THROW(session.insert(zone1));
+  BOOST_CHECK_GT(zone1.getId(), 0);
+
+  Zone zone2;
+  zone2.setName("/net");
+  session.find(zone2);
+  BOOST_CHECK_EQUAL(zone2.getId(), zone1.getId());
+  BOOST_CHECK_EQUAL(zone2.getTtl(), zone1.getTtl());
+
+  BOOST_CHECK_NO_THROW(session.insert(zone2)); // zone2 already has id.  Nothing to execute
+
+  zone2.setId(0);
+  BOOST_CHECK_THROW(session.insert(zone2), ndns::DbMgr::ExecuteError);
+
+  BOOST_CHECK_NO_THROW(session.remove(zone1));
+  BOOST_CHECK_EQUAL(zone1.getId(), 0);
+
+  // record shouldn't exist at this point
+  BOOST_CHECK_NO_THROW(session.find(zone2));
+  BOOST_CHECK_EQUAL(zone2.getId(), 0);
+}
+
+BOOST_FIXTURE_TEST_CASE(Rrsets, DbMgrFixture)
+{
+  Zone zone("/net");
+  Rrset rrset1(&zone);
+
+  // Add
+
+  rrset1.setLabel("/net/ksk-123");
+  rrset1.setType(name::Component("ID-CERT"));
+  rrset1.setVersion(name::Component::fromVersion(567));
+  rrset1.setTtl(time::seconds(4600));
+
+  static const std::string DATA1 = "SOME DATA";
+  rrset1.setData(dataBlock(ndn::tlv::Content, DATA1.c_str(), DATA1.size()));
+
+  BOOST_CHECK_EQUAL(rrset1.getId(), 0);
+  BOOST_CHECK_NO_THROW(session.insert(rrset1));
+  BOOST_CHECK_GT(rrset1.getId(), 0);
+  BOOST_CHECK_GT(rrset1.getZone()->getId(), 0);
+
+  // Lookup
+
+  Rrset rrset2(&zone);
+  rrset2.setLabel("/net/ksk-123");
+  rrset2.setType(name::Component("ID-CERT"));
+
+  bool isFound = false;
+  BOOST_CHECK_NO_THROW(isFound = session.find(rrset2));
+  BOOST_CHECK_EQUAL(isFound, true);
+
+  BOOST_CHECK_EQUAL(rrset2.getId(),      rrset1.getId());
+  BOOST_CHECK_EQUAL(rrset2.getLabel(),   rrset1.getLabel());
+  BOOST_CHECK_EQUAL(rrset2.getType(),    rrset1.getType());
+  BOOST_CHECK_EQUAL(rrset2.getVersion(), rrset1.getVersion());
+  BOOST_CHECK_EQUAL(rrset2.getTtl(),     rrset1.getTtl());
+  BOOST_CHECK(rrset2.getData() == rrset1.getData());
+
+  // Replace
+
+  rrset1.setVersion(name::Component::fromVersion(890));
+  static const std::string DATA2 = "ANOTHER DATA";
+  rrset1.setData(dataBlock(ndn::tlv::Content, DATA2.c_str(), DATA2.size()));
+
+  BOOST_CHECK_NO_THROW(session.update(rrset1));
+
+  rrset2 = Rrset(&zone);
+  rrset2.setLabel("/net/ksk-123");
+  rrset2.setType(name::Component("ID-CERT"));
+
+  isFound = false;
+  BOOST_CHECK_NO_THROW(isFound = session.find(rrset2));
+  BOOST_CHECK_EQUAL(isFound, true);
+
+  BOOST_CHECK_EQUAL(rrset2.getId(),      rrset1.getId());
+  BOOST_CHECK_EQUAL(rrset2.getLabel(),   rrset1.getLabel());
+  BOOST_CHECK_EQUAL(rrset2.getType(),    rrset1.getType());
+  BOOST_CHECK_EQUAL(rrset2.getVersion(), rrset1.getVersion());
+  BOOST_CHECK_EQUAL(rrset2.getTtl(),     rrset1.getTtl());
+  BOOST_CHECK(rrset2.getData() == rrset1.getData());
+
+  // Remove
+
+  BOOST_CHECK_NO_THROW(session.remove(rrset1));
+
+  rrset2 = Rrset(&zone);
+  rrset2.setLabel("/net/ksk-123");
+  rrset2.setType(name::Component("ID-CERT"));
+
+  isFound = false;
+  BOOST_CHECK_NO_THROW(isFound = session.find(rrset2));
+  BOOST_CHECK_EQUAL(isFound, false);
+
+  // Check error handling
+
+  rrset1 = Rrset();
+  BOOST_CHECK_THROW(session.insert(rrset1),  ndns::DbMgr::RrsetError);
+  BOOST_CHECK_THROW(session.find(rrset1),  ndns::DbMgr::RrsetError);
+
+  rrset1.setId(1);
+  BOOST_CHECK_THROW(session.update(rrset1), ndns::DbMgr::RrsetError);
+
+  rrset1.setId(0);
+  rrset1.setZone(&zone);
+  BOOST_CHECK_THROW(session.update(rrset1), ndns::DbMgr::RrsetError);
+
+  BOOST_CHECK_THROW(session.remove(rrset1),  ndns::DbMgr::RrsetError);
+
+  rrset1.setId(1);
+  BOOST_CHECK_NO_THROW(session.remove(rrset1));
+
+  rrset1.setZone(0);
+  rrset1.setId(1);
+  BOOST_CHECK_NO_THROW(session.remove(rrset1));
+}
+
+
+BOOST_FIXTURE_TEST_CASE(FindRrsets, DbMgrFixture)
+{
+  Zone zone("/");
+  Rrset rrset1(&zone);
+  rrset1.setLabel("/net/ksk-123");
+  rrset1.setType(name::Component("ID-CERT"));
+  rrset1.setVersion(name::Component::fromVersion(567));
+  rrset1.setTtl(time::seconds(4600));
+
+  static const std::string DATA1 = "SOME DATA";
+  rrset1.setData(dataBlock(ndn::tlv::Content, DATA1.data(), DATA1.size()));
+  session.insert(rrset1);
+
+  Rrset rrset2(&zone);
+  rrset2.setLabel("/net");
+  rrset2.setType(name::Component("NS"));
+  rrset2.setVersion(name::Component::fromVersion(232));
+  rrset2.setTtl(time::seconds(2100));
+  std::string data2 = "host1.net";
+  rrset2.setData(dataBlock(ndn::tlv::Content, data2.c_str(), data2.size()));
+  session.insert(rrset2);
+
+  std::vector<Rrset> vec = session.findRrsets(zone);
+  BOOST_CHECK_EQUAL(vec.size(), 2);
+
+  std::sort(vec.begin(),
+            vec.end(),
+            [] (const Rrset& n1, const Rrset& n2) {
+              return n1.getLabel().size() < n2.getLabel().size();
+            });
+  BOOST_CHECK_EQUAL(vec[0].getLabel(), "/net");
+  BOOST_CHECK_EQUAL(vec[1].getLabel(), "/net/ksk-123");
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace ndns
+} // namespace ndn
diff --git a/tests/unit/database-test-data.cpp b/tests/unit/database-test-data.cpp
new file mode 100644
index 0000000..3db2335
--- /dev/null
+++ b/tests/unit/database-test-data.cpp
@@ -0,0 +1,180 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014, Regents of the University of California.
+ *
+ * This file is part of NDNS (Named Data Networking Domain Name Service).
+ * See AUTHORS.md for complete list of NDNS authors and contributors.
+ *
+ * NDNS is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NDNS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "database-test-data.hpp"
+#include "logger.hpp"
+
+#include <boost/filesystem.hpp>
+
+namespace ndn {
+namespace ndns {
+namespace tests {
+NDNS_LOG_INIT("TestFakeData")
+
+const boost::filesystem::path DbTestData::TEST_DATABASE = TEST_CONFIG_PATH "/" "test-ndns.db";
+const Name DbTestData::TEST_IDENTITY_NAME("/");
+const boost::filesystem::path DbTestData::TEST_CERT =
+  TEST_CONFIG_PATH "/" "anchors/root.cert";
+
+DbTestData::DbTestData()
+  : doesTestIdentityExist(false)
+  , m_session(TEST_DATABASE.string())
+{
+  NDNS_LOG_TRACE("start creating test data");
+  // m_session.clearAllData();
+
+  ndns::Validator::VALIDATOR_CONF_FILE = TEST_CONFIG_PATH "/" "validator.conf";
+
+  if (!m_keyChain.doesIdentityExist(TEST_IDENTITY_NAME)) {
+    m_keyChain.createIdentity(TEST_IDENTITY_NAME);
+  }
+  else {
+    doesTestIdentityExist = true;
+  }
+
+  m_keyName = m_keyChain.generateRsaKeyPair(TEST_IDENTITY_NAME, false);
+
+  shared_ptr<IdentityCertificate> scert = m_keyChain.selfSign(m_keyName);
+  m_keyChain.addCertificate(*scert);
+  m_certName = scert->getName();
+
+  ndn::io::save(*scert, TEST_CERT.string());
+  NDNS_LOG_TRACE("test key: " << m_keyName);
+  NDNS_LOG_TRACE("save test root cert " << m_certName << " to: " << TEST_CERT.string());
+
+  BOOST_CHECK_GT(m_certName.size(), 0);
+  NDNS_LOG_TRACE("test certName: " << m_certName);
+
+  Zone root("/");
+  Zone net("/net");
+  Zone ndnsim("/net/ndnsim");
+
+  m_session.insert(root);
+  BOOST_CHECK_GT(root.getId(), 0);
+  m_session.insert(net);
+  BOOST_CHECK_GT(net.getId(), 0);
+  m_session.insert(ndnsim);
+  BOOST_CHECK_GT(ndnsim.getId(), 0);
+
+  m_zones.push_back(root);
+  m_zones.push_back(net);
+  m_zones.push_back(ndnsim);
+
+  int certificateIndex = 0;
+  function<void(const Name&,Zone&,const name::Component&)> addQueryRrset =
+    [this, &certificateIndex] (const Name& label, Zone& zone,
+                               const name::Component& type) {
+    const time::seconds ttl(3000 + 100 * certificateIndex);
+    const name::Component version = name::Component::fromVersion(100 + 1000 * certificateIndex);
+    name::Component qType(label::NDNS_ITERATIVE_QUERY);
+    NdnsType ndnsType = NDNS_RESP;
+    if (type == label::CERT_RR_TYPE) {
+      ndnsType = NDNS_RAW;
+      qType = label::NDNS_CERT_QUERY;
+    }
+    std::ostringstream os;
+    os << "a fake content: " << (++certificateIndex) << "th";
+
+    addRrset(zone, label, type, ttl, version, qType, ndnsType, os.str());
+  };
+  addQueryRrset("/dsk-1", root, label::CERT_RR_TYPE);
+  addQueryRrset("/net/ksk-2", root, label::CERT_RR_TYPE);
+  addQueryRrset("/dsk-3", net, label::CERT_RR_TYPE);
+  addQueryRrset("/ndnsim/ksk-4", net, label::CERT_RR_TYPE);
+  addQueryRrset("/dsk-5", ndnsim, label::CERT_RR_TYPE);
+
+  addQueryRrset("net", root, label::NS_RR_TYPE);
+  addQueryRrset("ndnsim", net, label::NS_RR_TYPE);
+  addQueryRrset("www", ndnsim, label::TXT_RR_TYPE);
+  addQueryRrset("doc/www", ndnsim, label::TXT_RR_TYPE);
+
+
+  addRrset(ndnsim, Name("doc"), label::NS_RR_TYPE , time::seconds(2000),
+    name::Component("1234"), label::NDNS_ITERATIVE_QUERY, NDNS_AUTH, std::string(""));
+
+  NDNS_LOG_INFO("insert testing data: OK");
+}
+
+
+
+void
+DbTestData::addRrset(Zone& zone, const Name& label, const name::Component& type,
+                     const time::seconds& ttl, const name::Component& version,
+                     const name::Component& qType, NdnsType ndnsType, const std::string& msg)
+{
+  Rrset rrset(&zone);
+  rrset.setLabel(label);
+  rrset.setType(type);
+  rrset.setTtl(ttl);
+  rrset.setVersion(version);
+
+  Response re;
+  re.setZone(zone.getName());
+  re.setQueryType(qType);
+  re.setRrLabel(label);
+  re.setRrType(type);
+  re.setVersion(version);
+  re.setNdnsType(ndnsType);
+  re.setFreshnessPeriod(ttl);
+
+  if (msg.size() > 0) {
+    if (type == label::CERT_RR_TYPE)
+      re.setAppContent(dataBlock(ndn::tlv::Content, msg.c_str(), msg.size()));
+    else
+      re.addRr(msg);
+  }
+  shared_ptr<Data> data = re.toData();
+  m_keyChain.sign(*data, m_certName); // now we ignore the certificate to sign the data
+  shared_ptr<IdentityCertificate> cert = m_keyChain.getCertificate(m_certName);
+  BOOST_CHECK_EQUAL(Validator::verifySignature(*data, cert->getPublicKeyInfo()), true);
+  rrset.setData(data->wireEncode());
+
+  m_session.insert(rrset);
+
+  m_rrsets.push_back(rrset);
+}
+
+DbTestData::~DbTestData()
+{
+  for (auto& zone : m_zones)
+    m_session.remove(zone);
+
+  for (auto& rrset : m_rrsets)
+    m_session.remove(rrset);
+
+  m_session.close();
+
+  boost::filesystem::remove(TEST_DATABASE);
+  boost::filesystem::remove(TEST_CERT);
+
+  if (doesTestIdentityExist) {
+    m_keyChain.deleteCertificate(m_certName);
+    m_keyChain.deleteKey(m_keyName);
+    NDNS_LOG_TRACE("delete key: " << m_keyName << " and certificate: " << m_certName);
+  }
+  else{
+    m_keyChain.deleteIdentity(TEST_IDENTITY_NAME);
+  }
+
+  NDNS_LOG_INFO("remove database: " << TEST_DATABASE);
+}
+
+} // namespace tests
+} // namespace ndns
+} // namespace ndn
diff --git a/tests/unit/database-test-data.hpp b/tests/unit/database-test-data.hpp
new file mode 100644
index 0000000..38b1d43
--- /dev/null
+++ b/tests/unit/database-test-data.hpp
@@ -0,0 +1,68 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014, Regents of the University of California.
+ *
+ * This file is part of NDNS (Named Data Networking Domain Name Service).
+ * See AUTHORS.md for complete list of NDNS authors and contributors.
+ *
+ * NDNS is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NDNS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NDNS_TESTS_UNIT_DATABASE_TEST_DATA_HPP
+#define NDNS_TESTS_UNIT_DATABASE_TEST_DATA_HPP
+
+#include "daemon/db-mgr.hpp"
+#include "clients/response.hpp"
+#include "clients/query.hpp"
+#include "validator.hpp"
+
+#include "../boost-test.hpp"
+
+#include <ndn-cxx/security/key-chain.hpp>
+#include <boost/filesystem.hpp>
+
+namespace ndn {
+namespace ndns {
+namespace tests {
+
+class DbTestData
+{
+public:
+  static const boost::filesystem::path TEST_DATABASE;
+  static const Name TEST_IDENTITY_NAME;
+  static const boost::filesystem::path TEST_CERT;
+
+  DbTestData();
+
+  ~DbTestData();
+
+private:
+  void
+  addRrset(Zone& zone, const Name& label, const name::Component& type,
+                       const time::seconds& ttl, const name::Component& version,
+                       const name::Component& qType, NdnsType ndnsType, const std::string& msg);
+public:
+  Name m_certName;
+  Name m_keyName;
+  std::vector<Zone>  m_zones;
+  std::vector<Rrset> m_rrsets;
+
+  bool doesTestIdentityExist;
+  DbMgr m_session;
+  KeyChain m_keyChain;
+};
+
+} // namespace tests
+} // namespace ndns
+} // namespace ndn
+
+#endif // NDNS_TESTS_UNIT_DATABASE_TEST_DATA_HPP
diff --git a/tests/unit/logger.cpp b/tests/unit/logger.cpp
index 100aa5b..c2491ad 100644
--- a/tests/unit/logger.cpp
+++ b/tests/unit/logger.cpp
@@ -19,6 +19,7 @@
 
 #include "logger.hpp"
 #include "../boost-test.hpp"
+#include "config.hpp"
 
 #include <fstream>
 
