diff --git a/tests/unit/daemon/name-server.cpp b/tests/unit/daemon/name-server.cpp
new file mode 100644
index 0000000..578533d
--- /dev/null
+++ b/tests/unit/daemon/name-server.cpp
@@ -0,0 +1,246 @@
+/* -*- 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 "daemon/db-mgr.hpp"
+#include "daemon/name-server.hpp"
+#include "clients/response.hpp"
+#include "clients/query.hpp"
+#include "logger.hpp"
+
+#include "../database-test-data.hpp"
+#include "../../boost-test.hpp"
+
+#include <boost/filesystem.hpp>
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/util/dummy-client-face.hpp>
+
+namespace ndn {
+namespace ndns {
+namespace tests {
+
+NDNS_LOG_INIT("NameServerTest");
+
+class NameServerFixture : public DbTestData
+{
+public:
+  NameServerFixture()
+    : face(ndn::util::makeDummyClientFace({ false, true }))
+    , zone(m_net.getName())
+    , validator(*face)
+    , server(zone, m_certName, *face, m_session, m_keyChain, validator)
+  {
+    // ensure prefix is registered
+    run();
+  }
+
+  void
+  run()
+  {
+    face->getIoService().poll();
+    face->getIoService().reset();
+  }
+
+public:
+  shared_ptr<ndn::util::DummyClientFace> face;
+  Name hint;
+  const Name& zone;
+  Validator validator;
+  ndns::NameServer server;
+};
+
+BOOST_FIXTURE_TEST_SUITE(NameServer, NameServerFixture)
+
+BOOST_AUTO_TEST_CASE(NdnsQuery)
+{
+  Query q(hint, zone, ndns::label::NDNS_ITERATIVE_QUERY);
+  q.setRrLabel(Name("ndnsim"));
+  q.setRrType(ndns::label::NS_RR_TYPE);
+
+  bool hasDataBack = false;
+
+  face->onData += [&] (const Data& data) {
+    hasDataBack = true;
+    NDNS_LOG_TRACE("get Data back");
+    BOOST_CHECK_EQUAL(data.getName().getPrefix(-1), q.toInterest().getName());
+
+    Response resp;
+    BOOST_CHECK_NO_THROW(resp.fromData(hint, zone, data));
+    BOOST_CHECK_EQUAL(resp.getNdnsType(), NDNS_RESP);
+  };
+
+  face->receive(q.toInterest());
+
+  run();
+
+  BOOST_CHECK_EQUAL(hasDataBack, true);
+}
+
+BOOST_AUTO_TEST_CASE(KeyQuery)
+{
+  Query q(hint, zone, ndns::label::NDNS_ITERATIVE_QUERY);
+  q.setQueryType(ndns::label::NDNS_CERT_QUERY);
+  q.setRrType(ndns::label::CERT_RR_TYPE);
+
+  size_t nDataBack = 0;
+
+  // will ask for non-existing record
+  face->onData += [&] (const Data& data) {
+    ++nDataBack;
+    NDNS_LOG_TRACE("get Data back");
+    BOOST_CHECK_EQUAL(data.getName().getPrefix(-1), q.toInterest().getName());
+
+    Response resp;
+    BOOST_CHECK_NO_THROW(resp.fromData(hint, zone, data));
+    BOOST_CHECK_EQUAL(resp.getNdnsType(), NDNS_NACK);
+  };
+
+  face->receive(q.toInterest());
+  run();
+
+  // will ask for the existing record (will have type NDNS_RAW, as it is certificate)
+  face->onData.clear();
+  face->onData += [&] (const Data& data) {
+    ++nDataBack;
+    NDNS_LOG_TRACE("get Data back");
+    BOOST_CHECK_EQUAL(data.getName().getPrefix(-1), q.toInterest().getName());
+
+    Response resp;
+    BOOST_CHECK_NO_THROW(resp.fromData(hint, zone, data));
+    BOOST_CHECK_EQUAL(resp.getNdnsType(), NDNS_RAW);
+  };
+
+  q.setRrLabel("dsk-3");
+
+  face->receive(q.toInterest());
+  run();
+
+  BOOST_CHECK_EQUAL(nDataBack, 2);
+}
+
+BOOST_AUTO_TEST_CASE(UpdateReplaceRr)
+{
+  Response re;
+  re.setZone(zone);
+  re.setQueryType(label::NDNS_ITERATIVE_QUERY);
+  re.setRrLabel(Name("ndnsim"));
+  re.setRrType(label::NS_RR_TYPE);
+  re.setNdnsType(NDNS_RESP);
+
+  std::string str = "ns1.ndnsim.net";
+  re.addRr(dataBlock(ndns::tlv::RrData, str.c_str(), str.size()));
+  str = "ns2.ndnsim.net";
+  re.addRr(dataBlock(ndns::tlv::RrData, str.c_str(), str.size()));
+
+  shared_ptr<Data> data = re.toData();
+  m_keyChain.sign(*data, m_certName);
+
+  Query q(Name(hint), Name(zone), ndns::label::NDNS_ITERATIVE_QUERY);
+  const Block& block = data->wireEncode();
+  Name name;
+  name.append(block);
+
+  q.setRrLabel(name);
+  q.setRrType(label::NDNS_UPDATE_LABEL);
+
+  bool hasDataBack = false;
+
+  face->onData += [&] (const Data& data) {
+    hasDataBack = true;
+    NDNS_LOG_TRACE("get Data back");
+    BOOST_CHECK_EQUAL(data.getName().getPrefix(-1), q.toInterest().getName());
+    Response resp;
+
+    BOOST_CHECK_NO_THROW(resp.fromData(hint, zone, data));
+    std::cout << resp << std::endl;
+    BOOST_CHECK_EQUAL(resp.getNdnsType(), NDNS_RESP); // by default NDNS_RAW is enough
+    BOOST_CHECK_GT(resp.getRrs().size(), 0);
+    Block block = resp.getRrs()[0];
+    block.parse();
+    int ret = -1;
+    BOOST_CHECK_EQUAL(block.type(), ndns::tlv::RrData);
+    Block::element_const_iterator val = block.elements_begin();
+    BOOST_CHECK_EQUAL(val->type(), ndns::tlv::UpdateReturnCode); // the first must be return code
+    ret = readNonNegativeInteger(*val);
+    BOOST_CHECK_EQUAL(ret, 0);
+  };
+
+  face->receive(q.toInterest());
+  run();
+
+  BOOST_CHECK_EQUAL(hasDataBack, true);
+}
+
+BOOST_AUTO_TEST_CASE(UpdateInsertNewRr)
+{
+  Response re;
+  re.setZone(zone);
+  re.setQueryType(label::NDNS_ITERATIVE_QUERY);
+  re.setRrLabel(Name("ndnsim-XYZ")); // insert new records
+  re.setRrType(label::NS_RR_TYPE);
+  re.setNdnsType(NDNS_RESP);
+
+  std::string str = "ns1.ndnsim.net";
+  re.addRr(dataBlock(ndns::tlv::RrData, str.c_str(), str.size()));
+  str = "ns2.ndnsim.net";
+  re.addRr(dataBlock(ndns::tlv::RrData, str.c_str(), str.size()));
+
+  shared_ptr<Data> data = re.toData();
+  m_keyChain.sign(*data, m_certName);
+
+  Query q(Name(hint), Name(zone), ndns::label::NDNS_ITERATIVE_QUERY);
+  const Block& block = data->wireEncode();
+  Name name;
+  name.append(block);
+
+  q.setRrLabel(name);
+  q.setRrType(label::NDNS_UPDATE_LABEL);
+
+  bool hasDataBack = false;
+
+  face->onData += [&] (const Data& data) {
+    hasDataBack = true;
+    NDNS_LOG_TRACE("get Data back");
+    BOOST_CHECK_EQUAL(data.getName().getPrefix(-1), q.toInterest().getName());
+    Response resp;
+
+    BOOST_CHECK_NO_THROW(resp.fromData(hint, zone, data));
+    std::cout << resp << std::endl;
+    BOOST_CHECK_EQUAL(resp.getNdnsType(), NDNS_RESP); // by default NDNS_RAW is enough
+    BOOST_CHECK_GT(resp.getRrs().size(), 0);
+    Block block = resp.getRrs()[0];
+    block.parse();
+    int ret = -1;
+    BOOST_CHECK_EQUAL(block.type(), ndns::tlv::RrData);
+    Block::element_const_iterator val = block.elements_begin();
+    BOOST_CHECK_EQUAL(val->type(), ndns::tlv::UpdateReturnCode); // the first must be return code
+    ret = readNonNegativeInteger(*val);
+    BOOST_CHECK_EQUAL(ret, 0);
+  };
+
+  face->receive(q.toInterest());
+  run();
+
+  BOOST_CHECK_EQUAL(hasDataBack, true);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace ndns
+} // namespace ndn
diff --git a/tests/unit/daemon/rrset.cpp b/tests/unit/daemon/rrset.cpp
index db51d27..ddcff15 100644
--- a/tests/unit/daemon/rrset.cpp
+++ b/tests/unit/daemon/rrset.cpp
@@ -32,7 +32,7 @@
 {
   ndns::Rrset rrset1;
   rrset1.setId(1);
-  rrset1.setZone(0);
+  rrset1.setZone(nullptr);
   rrset1.setLabel("/www/1");
   rrset1.setType(name::Component("NS"));
   rrset1.setVersion(name::Component::fromVersion(1));
@@ -40,29 +40,36 @@
   rrset1.setData(Name("/test/1").wireEncode());
 
   BOOST_CHECK_EQUAL(rrset1.getId(), 1);
-  BOOST_CHECK_EQUAL(rrset1.getZone(), static_cast<Zone*>(0));
+  BOOST_CHECK_EQUAL(rrset1.getZone() == nullptr, true);
   BOOST_CHECK_EQUAL(rrset1.getLabel(), Name("/www/1"));
   BOOST_CHECK_EQUAL(rrset1.getType(), name::Component("NS"));
   BOOST_CHECK_EQUAL(rrset1.getVersion(), name::Component::fromVersion(1));
   BOOST_CHECK_EQUAL(rrset1.getTtl(), time::seconds(10));
   BOOST_CHECK(rrset1.getData() == Name("/test/1").wireEncode());
 
-  Name zoneName("/net/ndnsim");
-
   ndns::Rrset rrset2(rrset1);
-  BOOST_CHECK_EQUAL(rrset1, rrset2);
+  // rrset2.setZone(nullptr);
+  BOOST_CHECK_EQUAL(rrset1, rrset2); // zone point to nullptr
 
   rrset2.setId(2);
-  BOOST_CHECK_EQUAL(rrset1, rrset2);
-  rrset2 = rrset1;
+  BOOST_CHECK_EQUAL(rrset1, rrset2); // with different Id
 
-  Zone zone;
+  Zone zone("/ndn");
+  Zone zone2("/ndn2");
   rrset2.setZone(&zone);
+  BOOST_CHECK_NE(rrset1, rrset2); // with different zone name
+
+  rrset1.setZone(&zone);
+  BOOST_CHECK_EQUAL(rrset1, rrset2);
+
+  Zone zone3("/ndn");
+  rrset1.setZone(&zone3);
+  BOOST_CHECK_EQUAL(rrset1, rrset2);
+
+  rrset1.setZone(&zone2);
   BOOST_CHECK_NE(rrset1, rrset2);
 
   rrset2 = rrset1;
-  BOOST_CHECK_EQUAL(rrset1, rrset2);
-
   rrset2.setLabel(Name("/www/2"));
   BOOST_CHECK_NE(rrset1, rrset2);
   rrset2 = rrset1;
diff --git a/tests/unit/database-test-data.cpp b/tests/unit/database-test-data.cpp
index 3db2335..bee2cd9 100644
--- a/tests/unit/database-test-data.cpp
+++ b/tests/unit/database-test-data.cpp
@@ -28,53 +28,42 @@
 NDNS_LOG_INIT("TestFakeData")
 
 const boost::filesystem::path DbTestData::TEST_DATABASE = TEST_CONFIG_PATH "/" "test-ndns.db";
-const Name DbTestData::TEST_IDENTITY_NAME("/");
+const Name DbTestData::TEST_IDENTITY_NAME("/test19");
 const boost::filesystem::path DbTestData::TEST_CERT =
   TEST_CONFIG_PATH "/" "anchors/root.cert";
 
 DbTestData::DbTestData()
-  : doesTestIdentityExist(false)
-  , m_session(TEST_DATABASE.string())
+  : 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_certName = m_keyChain.createIdentity(TEST_IDENTITY_NAME);
 
-  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());
+  ndn::io::save(*(m_keyChain.getCertificate(m_certName)), TEST_CERT.string());
+  NDNS_LOG_INFO("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_root = Zone(TEST_IDENTITY_NAME);
+  Name name(TEST_IDENTITY_NAME);
+    name.append("net");
+  m_net = Zone(name);
+  name.append("ndnsim");
+  m_ndnsim =Zone(name);
 
-  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_session.insert(m_root);
+  BOOST_CHECK_GT(m_root.getId(), 0);
+  m_session.insert(m_net);
+  BOOST_CHECK_GT(m_net.getId(), 0);
+  m_session.insert(m_ndnsim);
+  BOOST_CHECK_GT(m_ndnsim.getId(), 0);
 
-  m_zones.push_back(root);
-  m_zones.push_back(net);
-  m_zones.push_back(ndnsim);
+  m_zones.push_back(m_root);
+  m_zones.push_back(m_net);
+  m_zones.push_back(m_ndnsim);
 
   int certificateIndex = 0;
   function<void(const Name&,Zone&,const name::Component&)> addQueryRrset =
@@ -93,26 +82,26 @@
 
     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);
+  addQueryRrset("/dsk-1", m_root, label::CERT_RR_TYPE);
+  addQueryRrset("/net/ksk-2", m_root, label::CERT_RR_TYPE);
+  addQueryRrset("/dsk-3", m_net, label::CERT_RR_TYPE);
+  addQueryRrset("/ndnsim/ksk-4", m_net, label::CERT_RR_TYPE);
+  addQueryRrset("/dsk-5", m_ndnsim, label::CERT_RR_TYPE);
+
+  addQueryRrset("net", m_root, label::NS_RR_TYPE);
+  addQueryRrset("ndnsim", m_net, label::NS_RR_TYPE);
+  addQueryRrset("www", m_ndnsim, label::TXT_RR_TYPE);
+  addQueryRrset("doc/www", m_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(""));
+  addRrset(m_ndnsim, Name("doc"), label::NS_RR_TYPE , time::seconds(2000),
+           name::Component::fromVersion(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,
@@ -163,14 +152,7 @@
   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);
-  }
+  // m_keyChain.deleteIdentity(TEST_IDENTITY_NAME);
 
   NDNS_LOG_INFO("remove database: " << TEST_DATABASE);
 }
diff --git a/tests/unit/database-test-data.hpp b/tests/unit/database-test-data.hpp
index 38b1d43..f79d6a5 100644
--- a/tests/unit/database-test-data.hpp
+++ b/tests/unit/database-test-data.hpp
@@ -26,8 +26,8 @@
 #include "validator.hpp"
 
 #include "../boost-test.hpp"
-
 #include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/util/dummy-client-face.hpp>
 #include <boost/filesystem.hpp>
 
 namespace ndn {
@@ -48,15 +48,16 @@
 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);
+           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;
+  Zone m_root;
+  Zone m_net;
+  Zone m_ndnsim;
   DbMgr m_session;
   KeyChain m_keyChain;
 };
