diff --git a/tests/unit-tests/test-data-fetch-and-publish.cpp.outdated b/tests/integrated-tests/test-data-fetch-and-publish.cpp.outdated
similarity index 100%
rename from tests/unit-tests/test-data-fetch-and-publish.cpp.outdated
rename to tests/integrated-tests/test-data-fetch-and-publish.cpp.outdated
diff --git a/tests/integrated-tests/test-logic.cpp b/tests/integrated-tests/test-logic.cpp
new file mode 100644
index 0000000..088b8fb
--- /dev/null
+++ b/tests/integrated-tests/test-logic.cpp
@@ -0,0 +1,307 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2012-2014 University of California, Los Angeles
+ *
+ * This file is part of ChronoSync, synchronization library for distributed realtime
+ * applications for NDN.
+ *
+ * ChronoSync 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.
+ *
+ * ChronoSync 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
+ * ChronoSync, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "logic.hpp"
+
+#include "boost-test.hpp"
+
+namespace chronosync {
+namespace test {
+
+using std::vector;
+
+class Handler
+{
+public:
+  Handler(ndn::Face& face,
+          const Name& syncPrefix,
+          const Name& userPrefix)
+    : logic(face,
+            syncPrefix,
+            userPrefix,
+            bind(&Handler::onUpdate, this, _1))
+  {
+  }
+
+  void
+  onUpdate(const vector<MissingDataInfo>& v)
+  {
+    for (size_t i = 0; i < v.size(); i++) {
+      update(v[i].session, v[i].high, v[i].low);
+    }
+  }
+
+  void
+  update(const Name& p, const SeqNo& high, const SeqNo& low)
+  {
+    map[p] = high;
+  }
+
+  void
+  updateSeqNo(const SeqNo& seqNo)
+  {
+    logic.updateSeqNo(seqNo);
+  }
+
+  void
+  check(const Name& sessionName, const SeqNo& seqNo)
+  {
+    BOOST_CHECK_EQUAL(map[sessionName], seqNo);
+  }
+
+  Logic logic;
+  std::map<Name, SeqNo> map;
+};
+
+class LogicFixture
+{
+public:
+  LogicFixture()
+    : syncPrefix("/ndn/broadcast/sync")
+    , scheduler(io)
+  {
+    syncPrefix.appendVersion();
+    userPrefix[0] = Name("/user0");
+    userPrefix[1] = Name("/user1");
+    userPrefix[2] = Name("/user2");
+
+    faces[0] = make_shared<ndn::Face>(ref(io));
+    faces[1] = make_shared<ndn::Face>(ref(io));
+    faces[2] = make_shared<ndn::Face>(ref(io));
+  }
+
+  void
+  createHandler(size_t idx)
+  {
+    handler[idx] = make_shared<Handler>(ref(*faces[idx]), syncPrefix, userPrefix[idx]);
+  }
+
+  void
+  updateSeqNo(size_t idx, const SeqNo& seqNo)
+  {
+    handler[idx]->updateSeqNo(seqNo);
+  }
+
+  void
+  checkSeqNo(size_t sIdx, size_t dIdx, const SeqNo& seqNo)
+  {
+    handler[sIdx]->check(handler[dIdx]->logic.getSessionName(), seqNo);
+  }
+
+  void
+  terminate()
+  {
+    io.stop();
+  }
+
+  Name syncPrefix;
+  Name userPrefix[3];
+
+  boost::asio::io_service io;
+  shared_ptr<ndn::Face> faces[3];
+  ndn::Scheduler scheduler;
+  shared_ptr<Handler> handler[3];
+};
+
+BOOST_FIXTURE_TEST_SUITE(LogicTests, LogicFixture)
+
+void
+onUpdate(const vector<MissingDataInfo>& v)
+{
+}
+
+BOOST_AUTO_TEST_CASE(Constructor)
+{
+  Name syncPrefix("/ndn/broadcast/sync");
+  Name userPrefix("/user");
+  ndn::Face face;
+  BOOST_REQUIRE_NO_THROW(Logic(face, syncPrefix, userPrefix,
+                               bind(onUpdate, _1)));
+}
+
+BOOST_AUTO_TEST_CASE(TwoBasic)
+{
+  scheduler.scheduleEvent(ndn::time::milliseconds(100),
+                          bind(&LogicFixture::createHandler, this, 0));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(200),
+                          bind(&LogicFixture::createHandler, this, 1));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(300),
+                          bind(&LogicFixture::updateSeqNo, this, 0, 1));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(1000),
+                          bind(&LogicFixture::checkSeqNo, this, 1, 0, 1));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(1100),
+                          bind(&LogicFixture::updateSeqNo, this, 0, 2));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(1800),
+                          bind(&LogicFixture::checkSeqNo, this, 1, 0, 2));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(1900),
+                          bind(&LogicFixture::updateSeqNo, this, 1, 2));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(2600),
+                          bind(&LogicFixture::checkSeqNo, this, 0, 1, 2));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(2800),
+                          bind(&LogicFixture::terminate, this));
+
+  io.run();
+}
+
+BOOST_AUTO_TEST_CASE(ThreeBasic)
+{
+  scheduler.scheduleEvent(ndn::time::milliseconds(100),
+                          bind(&LogicFixture::createHandler, this, 0));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(200),
+                          bind(&LogicFixture::createHandler, this, 1));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(300),
+                          bind(&LogicFixture::createHandler, this, 2));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(500),
+                          bind(&LogicFixture::updateSeqNo, this, 0, 1));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(1400),
+                          bind(&LogicFixture::checkSeqNo, this, 1, 0, 1));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(1450),
+                          bind(&LogicFixture::checkSeqNo, this, 2, 0, 1));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(1500),
+                          bind(&LogicFixture::updateSeqNo, this, 1, 2));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(2400),
+                          bind(&LogicFixture::checkSeqNo, this, 0, 1, 2));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(2450),
+                          bind(&LogicFixture::checkSeqNo, this, 2, 1, 2));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(2500),
+                          bind(&LogicFixture::updateSeqNo, this, 2, 4));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(4400),
+                          bind(&LogicFixture::checkSeqNo, this, 0, 2, 4));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(4450),
+                          bind(&LogicFixture::checkSeqNo, this, 1, 2, 4));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(4500),
+                          bind(&LogicFixture::terminate, this));
+
+  io.run();
+}
+
+BOOST_AUTO_TEST_CASE(ResetRecover)
+{
+  scheduler.scheduleEvent(ndn::time::milliseconds(100),
+                          bind(&LogicFixture::createHandler, this, 0));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(200),
+                          bind(&LogicFixture::createHandler, this, 1));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(500),
+                          bind(&LogicFixture::updateSeqNo, this, 0, 1));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(1400),
+                          bind(&LogicFixture::checkSeqNo, this, 1, 0, 1));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(1500),
+                          bind(&LogicFixture::updateSeqNo, this, 1, 2));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(2400),
+                          bind(&LogicFixture::checkSeqNo, this, 0, 1, 2));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(2500),
+                          bind(&LogicFixture::createHandler, this, 2));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(3000),
+                          bind(&LogicFixture::checkSeqNo, this, 1, 0, 1));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(3050),
+                          bind(&LogicFixture::checkSeqNo, this, 0, 1, 2));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(3100),
+                          bind(&LogicFixture::updateSeqNo, this, 2, 4));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(4000),
+                          bind(&LogicFixture::checkSeqNo, this, 1, 2, 4));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(4050),
+                          bind(&LogicFixture::checkSeqNo, this, 0, 2, 4));
+
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(4500),
+                          bind(&LogicFixture::terminate, this));
+
+  io.run();
+}
+
+BOOST_AUTO_TEST_CASE(RecoverConflict)
+{
+  scheduler.scheduleEvent(ndn::time::milliseconds(0),
+                          bind(&LogicFixture::createHandler, this, 0));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(50),
+                          bind(&LogicFixture::createHandler, this, 1));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(100),
+                          bind(&LogicFixture::createHandler, this, 2));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(500),
+                          bind(&LogicFixture::updateSeqNo, this, 0, 1));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(1400),
+                          bind(&LogicFixture::checkSeqNo, this, 1, 0, 1));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(1400),
+                          bind(&LogicFixture::checkSeqNo, this, 2, 0, 1));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(1500),
+                          bind(&LogicFixture::updateSeqNo, this, 1, 2));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(1500),
+                          bind(&LogicFixture::updateSeqNo, this, 2, 4));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(2400),
+                          bind(&LogicFixture::checkSeqNo, this, 0, 1, 2));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(2450),
+                          bind(&LogicFixture::checkSeqNo, this, 0, 2, 4));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(2500),
+                          bind(&LogicFixture::checkSeqNo, this, 1, 2, 4));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(2550),
+                          bind(&LogicFixture::checkSeqNo, this, 2, 1, 2));
+
+  scheduler.scheduleEvent(ndn::time::milliseconds(4500),
+                          bind(&LogicFixture::terminate, this));
+
+  io.run();
+}
+
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace test
+} // namespace chronosync
diff --git a/tests/unit-tests/test-socket.cpp.outdated b/tests/integrated-tests/test-socket.cpp.outdated
similarity index 100%
rename from tests/unit-tests/test-socket.cpp.outdated
rename to tests/integrated-tests/test-socket.cpp.outdated
diff --git a/tests/unit-tests/test-scheduler.cc.tmp b/tests/unit-tests/test-scheduler.cc.tmp
deleted file mode 100644
index 2a53a22..0000000
--- a/tests/unit-tests/test-scheduler.cc.tmp
+++ /dev/null
@@ -1,175 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2012-2014 University of California, Los Angeles
- *
- * This file is part of ChronoSync, synchronization library for distributed realtime
- * applications for NDN.
- *
- * ChronoSync 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.
- *
- * ChronoSync 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
- * ChronoSync, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <boost/test/unit_test.hpp>
-#include <boost/test/output_test_stream.hpp>
-#include <map>
-using boost::test_tools::output_test_stream;
-
-#include <boost/make_shared.hpp>
-#include "sync-scheduler.h"
-#include "sync-logic.h"
-
-using namespace Sync;
-using namespace std;
-using namespace boost;
-
-
-
-// void funcUpdate (const std::string &, const SeqNo &newSeq, const SeqNo &oldSeq)
-// {
-//   cout << "funcUpdate\n";
-// }
-
-// void funcRemove (const std::string &)
-// {
-//   cout << "funcRemove\n";
-// }
-
-enum SCHEDULE_LABELS
-  {
-    TEST_LABEL,
-    ANOTHER_LABEL
-  };
-
-struct SchedulerFixture
-{
-  SchedulerFixture ()
-    : counter (0)
-  {}
-
-  int counter;
-
-  Scheduler *scheduler;
-
-  void everySecond ()
-  {
-    // cout << "." << flush;
-    counter ++;
-
-    if (counter < 9)
-    scheduler->schedule (boost::posix_time::milliseconds (100),
-                         boost::bind (&SchedulerFixture::everySecond, this),
-                         TEST_LABEL);
-  }
-
-  void setCounterFive ()
-  {
-    counter = 5;
-  }
-
-  void setCounterThree ()
-  {
-    counter = 3;
-  }
-};
-
-
-#ifdef _DEBUG
-
-BOOST_FIXTURE_TEST_SUITE (SchedulerTestSuite, SchedulerFixture)
-
-BOOST_AUTO_TEST_CASE (BasicTest)
-{
-  BOOST_CHECK_NO_THROW (scheduler = new Scheduler ());
-
-  scheduler->schedule (posix_time::milliseconds (100),
-                       bind (&SchedulerFixture::everySecond, this),
-                       TEST_LABEL);
-
-  sleep (1);
-  // cout << counter << endl;
-  BOOST_CHECK_EQUAL (counter, 9); // generally, should be 9
-
-  scheduler->schedule (posix_time::seconds (2),
-		       bind (&SchedulerFixture::setCounterFive, this),
-                       TEST_LABEL);
-
-  this_thread::sleep (posix_time::milliseconds (400)); // just in case
-
-  scheduler->schedule (posix_time::milliseconds (600),
-		       bind (&SchedulerFixture::setCounterThree, this),
-                       TEST_LABEL);
-
-  this_thread::sleep (posix_time::milliseconds (500));
-  BOOST_CHECK_EQUAL (counter, 9); // still 9
-
-  this_thread::sleep (posix_time::milliseconds (200));
-  BOOST_CHECK_EQUAL (counter, 3);
-
-  this_thread::sleep (posix_time::milliseconds (1000));
-  BOOST_CHECK_EQUAL (counter, 5);
-
-  scheduler->schedule (posix_time::milliseconds (100),
-		       bind (&SchedulerFixture::setCounterThree, this),
-                       ANOTHER_LABEL);
-  this_thread::sleep (posix_time::milliseconds (50));
-  scheduler->cancel (ANOTHER_LABEL);
-  this_thread::sleep (posix_time::milliseconds (150));
-  BOOST_CHECK_EQUAL (counter, 5);
-
-  BOOST_CHECK_NO_THROW (delete scheduler);
-}
-
-BOOST_AUTO_TEST_SUITE_END ()
-
-
-void funcUpdate( const std::string &/*prefix*/, const SeqNo &/*newSeq*/, const SeqNo &/*oldSeq*/ )
-{
-}
-
-void funcPass( const std::vector<MissingDataInfo> &v)
-{
-}
-
-void funcRemove( const std::string &/*prefix*/ )
-{
-}
-
-BOOST_AUTO_TEST_CASE (SyncLogicSchedulerTest)
-{
-  SyncLogic *logic = 0;
-  BOOST_CHECK_NO_THROW (logic = new SyncLogic ("/prefix", funcPass, funcRemove));
-  this_thread::sleep (posix_time::milliseconds (100));
-
-  Scheduler &scheduler = logic->getScheduler ();
-  BOOST_CHECK_EQUAL (scheduler.getEventsSize (), 1);
-
-  BOOST_CHECK_NO_THROW (logic->respondSyncInterest ("/prefix/e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e"));
-  BOOST_CHECK_EQUAL (scheduler.getEventsSize (), 2);
-
-  this_thread::sleep (posix_time::milliseconds (100)); // max waiting time
-  BOOST_CHECK_EQUAL (scheduler.getEventsSize (), 1);
-
-  BOOST_CHECK_NO_THROW (logic->respondSyncInterest ("/prefix/e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e"));
-  BOOST_CHECK_NO_THROW (logic->respondSyncInterest ("/prefix/e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e"));
-  BOOST_CHECK_NO_THROW (logic->respondSyncInterest ("/prefix/e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e"));
-  BOOST_CHECK_NO_THROW (logic->respondSyncInterest ("/prefix/e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e"));
-  BOOST_CHECK_EQUAL (scheduler.getEventsSize (), 5);
-
-  this_thread::sleep (posix_time::milliseconds (19)); // min waiting time is 20
-  BOOST_CHECK_EQUAL (scheduler.getEventsSize (), 5);
-
-  this_thread::sleep (posix_time::milliseconds (100)); // max waiting time
-  BOOST_CHECK_EQUAL (scheduler.getEventsSize (), 1);
-
-  BOOST_CHECK_NO_THROW (delete logic);
-}
-
-#endif
diff --git a/tests/unit-tests/test-sync-logic.cpp.outdated b/tests/unit-tests/test-sync-logic.cpp.outdated
deleted file mode 100644
index e916ad5..0000000
--- a/tests/unit-tests/test-sync-logic.cpp.outdated
+++ /dev/null
@@ -1,181 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2012-2014 University of California, Los Angeles
- *
- * This file is part of ChronoSync, synchronization library for distributed realtime
- * applications for NDN.
- *
- * ChronoSync 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.
- *
- * ChronoSync 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
- * ChronoSync, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <boost/test/unit_test.hpp>
-#include <boost/test/output_test_stream.hpp>
-#include <map>
-using boost::test_tools::output_test_stream;
-
-#include <boost/make_shared.hpp>
-
-#include <ndn-cxx/security/validator-null.hpp>
-#include "sync-logic.h"
-#include "sync-seq-no.h"
-
-using namespace std;
-using namespace boost;
-using namespace Sync;
-
-struct Handler
-{
-  string instance;
-
-  Handler (const string &_instance)
-  : instance (_instance)
-  {
-  }
-
-  void wrapper (const vector<MissingDataInfo> &v) {
-    int n = v.size();
-    for (int i = 0; i < n; i++) {
-      onUpdate (v[i].prefix, v[i].high, v[i].low);
-    }
-  }
-
-  void onUpdate (const string &p/*prefix*/, const SeqNo &seq/*newSeq*/, const SeqNo &oldSeq/*oldSeq*/)
-  {
-    m_map[p] = seq.getSeq ();
-
-    // cout << instance << "\t";
-    // if (!oldSeq.isValid ())
-    //   cout << "Inserted: " << p << " (" << seq << ")" << endl;
-    // else
-    //   cout << "Updated: " << p << "  ( " << oldSeq << ".." << seq << ")" << endl;
-  }
-
-  void onRemove (const string &p/*prefix*/)
-  {
-    // cout << instance << "\tRemoved: " << p << endl;
-    m_map.erase (p);
-  }
-
-  map<string, uint32_t> m_map;
-};
-
-class TestCore
-{
-public:
-  TestCore(ndn::shared_ptr<boost::asio::io_service> ioService)
-    : m_ioService(ioService)
-  {
-    m_l[0] = 0;
-    m_l[1] = 0;
-
-    m_validator = ndn::make_shared<ndn::ValidatorNull>();
-  }
-
-  ~TestCore()
-  {
-    if(m_l[0] != 0)
-      delete m_l[0];
-
-    if(m_l[1] != 0)
-      delete m_l[1];
-  }
-
-  void
-  finish(ndn::shared_ptr<boost::asio::io_service> ioService)
-  {
-    ioService->stop();
-  }
-
-  void
-  createSyncLogic(int index,
-                  ndn::shared_ptr<Handler> h)
-  {
-    ndn::Name identity("/tmp-" + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()));
-    ndn::shared_ptr<ndn::IdentityCertificate> cert = m_keyChain.getCertificate(m_keyChain.createIdentity(identity));
-    m_faces[index] = ndn::make_shared<ndn::Face>(ndn::ref(*m_ioService));
-    m_l[index] = new SyncLogic(ndn::Name("/bcast"),
-                               *cert,
-                               m_validator, m_faces[index],
-                               bind (&Handler::wrapper, &*h, _1),
-                               bind (&Handler::onRemove, &*h, _1));
-  }
-
-  void
-  getOldDigestForOne()
-  {
-    m_oldDigest = m_l[0]->getRootDigest();
-  }
-
-  void
-  getNewDigestForOne()
-  {
-    m_newDigest = m_l[0]->getRootDigest();
-  }
-
-  void
-  addLocalNamesForOne(ndn::Name name, uint64_t session, uint64_t seq)
-  {
-    m_l[0]->addLocalNames(name, session, seq);
-  }
-
-  void
-  removeForOne(ndn::Name name)
-  {
-    m_l[0]->remove(name);
-  }
-
-  void
-  checkDigest()
-  {
-    BOOST_CHECK(m_oldDigest != m_newDigest);
-  }
-
-
-public:
-  ndn::KeyChain m_keyChain;
-  ndn::shared_ptr<boost::asio::io_service> m_ioService;
-  SyncLogic* m_l[2];
-  ndn::shared_ptr<ndn::Face> m_faces[2];
-  ndn::shared_ptr<ndn::ValidatorNull> m_validator;
-  string m_oldDigest;
-  string m_newDigest;
-};
-
-void
-checkMapSize(ndn::shared_ptr<Handler> h, int size)
-{ BOOST_CHECK_EQUAL (h->m_map.size (), size); }
-
-
-BOOST_AUTO_TEST_CASE (SyncLogicTest)
-{
-  ndn::shared_ptr<boost::asio::io_service> ioService = ndn::make_shared<boost::asio::io_service>();
-  ndn::Scheduler scheduler(*ioService);
-  TestCore testCore(ioService);
-
-  ndn::shared_ptr<Handler> h1 = ndn::make_shared<Handler>("1");
-  ndn::shared_ptr<Handler> h2 = ndn::make_shared<Handler>("2");
-
-  scheduler.scheduleEvent(ndn::time::milliseconds(0), ndn::bind(&TestCore::createSyncLogic, &testCore, 0, h1));
-  scheduler.scheduleEvent(ndn::time::milliseconds(100), ndn::bind(&TestCore::getOldDigestForOne, &testCore));
-  scheduler.scheduleEvent(ndn::time::milliseconds(200), ndn::bind(&TestCore::addLocalNamesForOne, &testCore, "/one", 1, 2));
-  scheduler.scheduleEvent(ndn::time::milliseconds(300), ndn::bind(&checkMapSize, h1, 0));
-  scheduler.scheduleEvent(ndn::time::milliseconds(400), ndn::bind(&TestCore::createSyncLogic, &testCore, 1, h2));
-  scheduler.scheduleEvent(ndn::time::milliseconds(500), ndn::bind(&checkMapSize, h1, 0));
-  scheduler.scheduleEvent(ndn::time::milliseconds(600), ndn::bind(&checkMapSize, h2, 1));
-  scheduler.scheduleEvent(ndn::time::milliseconds(700), ndn::bind(&TestCore::removeForOne, &testCore, "/one"));
-  scheduler.scheduleEvent(ndn::time::milliseconds(800), ndn::bind(&TestCore::getNewDigestForOne, &testCore));
-  scheduler.scheduleEvent(ndn::time::milliseconds(900), ndn::bind(&TestCore::checkDigest, &testCore));
-  scheduler.scheduleEvent(ndn::time::milliseconds(1000), ndn::bind(&TestCore::finish, &testCore, ioService));
-
-  ioService->run();
-
-}
diff --git a/tests/unit-tests/test-sync-validator.cpp.outdated b/tests/unit-tests/test-sync-validator.cpp.outdated
deleted file mode 100644
index 7c8c300..0000000
--- a/tests/unit-tests/test-sync-validator.cpp.outdated
+++ /dev/null
@@ -1,349 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2012-2014 University of California, Los Angeles
- *
- * This file is part of ChronoSync, synchronization library for distributed realtime
- * applications for NDN.
- *
- * ChronoSync 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.
- *
- * ChronoSync 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
- * ChronoSync, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <boost/test/unit_test.hpp>
-#include "sync-validator.h"
-
-#include <boost/lexical_cast.hpp>
-#include <boost/asio.hpp>
-#include <ndn-cxx/util/scheduler.hpp>
-
-BOOST_AUTO_TEST_SUITE(TestSyncValidator)
-
-void
-onValidated(const ndn::shared_ptr<const ndn::Data>& data)
-{
-  BOOST_CHECK(true);
-}
-
-void
-onValidationFailed(const ndn::shared_ptr<const ndn::Data>& data,
-                   const std::string& failureInfo)
-{
-  BOOST_CHECK(false);
-}
-
-void
-onValidated2(const ndn::shared_ptr<const ndn::Data>& data)
-{
-  BOOST_CHECK(false);
-}
-
-void
-onValidationFailed2(const ndn::shared_ptr<const ndn::Data>& data,
-                    const std::string& failureInfo)
-{
-  BOOST_CHECK(true);
-}
-
-void
-publishData(const uint8_t* buf, size_t len, int freshness)
-{
-}
-
-BOOST_AUTO_TEST_CASE (Graph)
-{
-  using namespace Sync;
-  using namespace ndn;
-
-  Name prefix("/Sync/TestSyncValidator/AddEdge");
-  KeyChain keychain;
-
-  Name identity1("/TestSyncValidator/AddEdge-1/" + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()));
-  Name certName1 = keychain.createIdentity(identity1);
-  shared_ptr<IdentityCertificate> anchor = keychain.getCertificate(certName1);
-
-  Name identity2("/TestSyncValidator/AddEdge-2/" + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()));
-  Name certName2 = keychain.createIdentity(identity2);
-  shared_ptr<IdentityCertificate> introducer = keychain.getCertificate(certName2);
-
-  Name identity3("/TestSyncValidator/AddEdge-3/" + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()));
-  Name certName3 = keychain.createIdentity(identity3);
-  shared_ptr<IdentityCertificate> introducee = keychain.getCertificate(certName3);
-
-  Name identity4("/TestSyncValidator/AddEdge-4/" + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()));
-  Name certName4 = keychain.createIdentity(identity4);
-  shared_ptr<IdentityCertificate> introducer2 = keychain.getCertificate(certName4);
-
-  Name identity5("/TestSyncValidator/AddEdge-5/" + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()));
-  Name certName5 = keychain.createIdentity(identity5);
-  shared_ptr<IdentityCertificate> introducee2 = keychain.getCertificate(certName5);
-
-  shared_ptr<boost::asio::io_service> ioService = make_shared<boost::asio::io_service>();
-  shared_ptr<Face> face = make_shared<Face>(ref(*ioService));
-  shared_ptr<SecRuleRelative> rule;
-  SyncValidator validator(prefix, *anchor, *face,
-                          bind(&publishData, _1, _2, _3),
-                          rule);
-
-  validator.addParticipant(*introducer);
-  BOOST_CHECK(validator.canTrust(certName2));
-
-  IntroCertificate introCert(prefix, *introducee, certName2.getPrefix(-1));
-  keychain.sign(introCert, certName2);
-  validator.addParticipant(introCert);
-  BOOST_CHECK(validator.canTrust(certName3));
-
-  IntroCertificate introCert1(prefix, *anchor, certName3.getPrefix(-1));
-  keychain.sign(introCert1, certName3);
-  validator.addParticipant(introCert1);
-  validator.setAnchor(*introducer);
-  BOOST_CHECK(validator.canTrust(certName2));
-  BOOST_CHECK(validator.canTrust(certName3));
-  BOOST_CHECK(validator.canTrust(certName1));
-
-  IntroCertificate introCert2(prefix, *introducee2, certName4.getPrefix(-1));
-  keychain.sign(introCert2, certName4);
-  validator.addParticipant(introCert2);
-  BOOST_CHECK(validator.canTrust(certName5) == false);
-  BOOST_CHECK(validator.canTrust(certName4) == false);
-
-  IntroCertificate introCert3(prefix, *introducee, certName5.getPrefix(-1));
-  keychain.sign(introCert3, certName5);
-  validator.addParticipant(introCert3);
-  BOOST_CHECK(validator.canTrust(certName5) == false);
-  BOOST_CHECK(validator.canTrust(certName4) == false);
-
-  validator.setAnchor(*introducee2);
-  BOOST_CHECK(validator.canTrust(certName1));
-  BOOST_CHECK(validator.canTrust(certName2));
-  BOOST_CHECK(validator.canTrust(certName3));
-  BOOST_CHECK(validator.canTrust(certName4) == false);
-  BOOST_CHECK(validator.canTrust(certName5));
-
-
-  keychain.deleteIdentity(identity1);
-  keychain.deleteIdentity(identity2);
-  keychain.deleteIdentity(identity3);
-  keychain.deleteIdentity(identity4);
-  keychain.deleteIdentity(identity5);
-}
-
-BOOST_AUTO_TEST_CASE (OfflineValidate)
-{
-  using namespace Sync;
-  using namespace ndn;
-
-  Name prefix("/Sync/TestSyncValidator/OfflineValidate");
-  KeyChain keychain;
-
-  Name identity1("/TestSyncValidator/OfflineValidate-1/"
-                 + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()));
-  Name certName1 = keychain.createIdentity(identity1);
-  shared_ptr<IdentityCertificate> anchor = keychain.getCertificate(certName1);
-
-  Name identity2("/TestSyncValidator/OfflineValidate-2/"
-                 + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()));
-  Name certName2 = keychain.createIdentity(identity2);
-  shared_ptr<IdentityCertificate> introducer = keychain.getCertificate(certName2);
-
-  Name identity3("/TestSyncValidator/OfflineValidate-3/"
-                 + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()));
-  Name certName3 = keychain.createIdentity(identity3);
-  shared_ptr<IdentityCertificate> introducee = keychain.getCertificate(certName3);
-
-  Name identity4("/TestSyncValidator/OfflineValidate-4/"
-                 + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()));
-  Name certName4 = keychain.createIdentity(identity4);
-  shared_ptr<IdentityCertificate> introducer2 = keychain.getCertificate(certName4);
-
-  Name identity5("/TestSyncValidator/OfflineValidate-5/"
-                 + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()));
-  Name certName5 = keychain.createIdentity(identity5);
-  shared_ptr<IdentityCertificate> introducee2 = keychain.getCertificate(certName5);
-
-  shared_ptr<boost::asio::io_service> ioService = make_shared<boost::asio::io_service>();
-  shared_ptr<Face> face = make_shared<Face>(ref(*ioService));
-  shared_ptr<SecRuleRelative> rule;
-  SyncValidator validator(prefix, *anchor, *face,
-                          bind(&publishData, _1, _2, _3),
-                          rule);
-
-  validator.addParticipant(*introducer);
-  BOOST_CHECK(validator.canTrust(certName2));
-
-  IntroCertificate introCert(prefix, *introducee, certName2.getPrefix(-1));
-  keychain.sign(introCert, certName2);
-  validator.addParticipant(introCert);
-  BOOST_CHECK(validator.canTrust(certName3));
-
-  IntroCertificate introCert2(prefix, *introducee2, certName4.getPrefix(-1));
-  keychain.sign(introCert2, certName4);
-  validator.addParticipant(introCert2);
-  BOOST_CHECK(validator.canTrust(certName5) == false);
-  BOOST_CHECK(validator.canTrust(certName4) == false);
-
-  validator.setAnchor(*introducer2);
-  BOOST_CHECK(validator.canTrust(certName1) == false);
-  BOOST_CHECK(validator.canTrust(certName2) == false);
-  BOOST_CHECK(validator.canTrust(certName3) == false);
-  BOOST_CHECK(validator.canTrust(certName4));
-  BOOST_CHECK(validator.canTrust(certName5));
-
-  Name dataName1 = prefix;
-  dataName1.append("data-1");
-  shared_ptr<Data> data1 = make_shared<Data>(dataName1);
-  keychain.sign(*data1, certName5);
-
-  validator.validate(*data1,
-		     bind(&onValidated, _1),
-		     bind(&onValidationFailed, _1, _2));
-
-  Name dataName2 = prefix;
-  dataName2.append("data-2");
-  shared_ptr<Data> data2 = make_shared<Data>(dataName2);
-  keychain.sign(*data2, certName1);
-
-  validator.validate(*data2,
-		     bind(&onValidated2, _1),
-		     bind(&onValidationFailed2, _1, _2));
-
-  // ioService->run();
-
-  keychain.deleteIdentity(identity1);
-  keychain.deleteIdentity(identity2);
-  keychain.deleteIdentity(identity3);
-  keychain.deleteIdentity(identity4);
-  keychain.deleteIdentity(identity5);
-}
-
-struct FacesFixture
-{
-  FacesFixture()
-    : regPrefixId(0)
-    , regPrefixId2(0)
-  {}
-
-  void
-  onInterest(ndn::shared_ptr<ndn::Face> face, ndn::shared_ptr<ndn::Data> data)
-  {
-    face->put(*data);
-    face->unsetInterestFilter(regPrefixId);
-  }
-
-  void
-  onInterest2(ndn::shared_ptr<ndn::Face> face, ndn::shared_ptr<ndn::Data> data)
-  {
-    face->put(*data);
-    face->unsetInterestFilter(regPrefixId2);
-  }
-
-  void
-  onRegFailed()
-  {}
-
-  void
-  validate(ndn::shared_ptr<Sync::SyncValidator> validator, ndn::shared_ptr<ndn::Data> data,
-           const ndn::Name& certName3, const ndn::Name& certName4)
-  {
-    validator->validate(*data,
-                        bind(&onValidated, _1),
-                        bind(&onValidationFailed, _1, _2));
-
-
-    BOOST_CHECK(validator->canTrust(certName3));
-    BOOST_CHECK(validator->canTrust(certName4));
-  }
-
-  void
-  terminate(ndn::shared_ptr<ndn::Face> face)
-  {
-    face->getIoService().stop();
-  }
-
-  const ndn::RegisteredPrefixId* regPrefixId;
-  const ndn::RegisteredPrefixId* regPrefixId2;
-};
-
-BOOST_FIXTURE_TEST_CASE(OnlineValidate, FacesFixture)
-{
-  using namespace Sync;
-  using namespace ndn;
-
-  Name prefix("/Sync/TestSyncValidator/OnlineValidate");
-  KeyChain keychain;
-
-  Name identity1("/TestSyncValidator/OnlineValidate-1/"
-                 + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()));
-  Name certName1 = keychain.createIdentity(identity1);
-  shared_ptr<IdentityCertificate> anchor = keychain.getCertificate(certName1);
-
-  Name identity2("/TestSyncValidator/OnlineValidate-2/"
-                 + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()));
-  Name certName2 = keychain.createIdentity(identity2);
-  shared_ptr<IdentityCertificate> introducer = keychain.getCertificate(certName2);
-
-  Name identity3("/TestSyncValidator/OnlineValidate-3/"
-                 + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()));
-  Name certName3 = keychain.createIdentity(identity3);
-  shared_ptr<IdentityCertificate> introducee = keychain.getCertificate(certName3);
-
-  Name identity4("/TestSyncValidator/OnlineValidate-4/"
-                 + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()));
-  Name certName4 = keychain.createIdentity(identity4);
-  shared_ptr<IdentityCertificate> introducee2 = keychain.getCertificate(certName4);
-
-  shared_ptr<boost::asio::io_service> ioService = make_shared<boost::asio::io_service>();
-  shared_ptr<Face> face = make_shared<Face>(ref(*ioService));
-  shared_ptr<Face> face2 = make_shared<Face>(ref(*ioService));
-
-  shared_ptr<SecRuleRelative> rule;
-  shared_ptr<SyncValidator> validator = shared_ptr<SyncValidator>
-    (new SyncValidator(prefix, *anchor, *face2, bind(&publishData, _1, _2, _3), rule));
-
-  validator->addParticipant(*introducer);
-  BOOST_CHECK(validator->canTrust(certName2));
-
-  shared_ptr<IntroCertificate> introCert = shared_ptr<IntroCertificate>(new IntroCertificate(prefix, *introducee, certName2.getPrefix(-1)));
-  keychain.sign(*introCert, certName2);
-  BOOST_CHECK(validator->canTrust(certName3) == false);
-
-  shared_ptr<IntroCertificate> introCert2 = shared_ptr<IntroCertificate>(new IntroCertificate(prefix, *introducee2, certName3.getPrefix(-1)));
-  keychain.sign(*introCert2, certName3);
-  BOOST_CHECK(validator->canTrust(certName4) == false);
-
-  Name dataName1 = prefix;
-  dataName1.append("data-1");
-  shared_ptr<Data> data1 = make_shared<Data>(dataName1);
-  keychain.sign(*data1, certName4);
-
-  ndn::Scheduler scheduler(*ioService);
-
-  scheduler.scheduleEvent(time::seconds(1),
-                          bind(&FacesFixture::terminate, this, face));
-
-  regPrefixId = face->setInterestFilter(introCert->getName().getPrefix(-1),
-                                       bind(&FacesFixture::onInterest, this, face, introCert),
-                                       bind(&FacesFixture::onRegFailed, this));
-
-  regPrefixId2 = face->setInterestFilter(introCert2->getName().getPrefix(-1),
-					bind(&FacesFixture::onInterest2, this, face, introCert2),
-					bind(&FacesFixture::onRegFailed, this));
-
-  scheduler.scheduleEvent(time::milliseconds(200),
-                          bind(&FacesFixture::validate, this,
-			       validator, data1, certName3, certName4));
-
-  keychain.deleteIdentity(identity1);
-  keychain.deleteIdentity(identity2);
-  keychain.deleteIdentity(identity3);
-  keychain.deleteIdentity(identity4);
-}
-
-BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/wscript b/tests/wscript
index d1a61ba..384dbba 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -4,9 +4,9 @@
 top = '..'
 
 def build(bld):
-    unit_test_main = bld(
-        target='unit-tests-main',
-        name='unit-tests-main',
+    test_main = bld(
+        target='tests-main',
+        name='tests-main',
         features='cxx',
         source=bld.path.ant_glob(['main.cpp']),
         use='ChronoSync',
@@ -16,7 +16,16 @@
         target="../unit-tests",
         source=bld.path.ant_glob(['unit-tests/**/*.cpp']),
         features=['cxx', 'cxxprogram'],
-        use='ChronoSync, unit-tests-main',
+        use='ChronoSync tests-main LOG4CXX',
+        includes=['.'],
+        install_path=None,
+        )
+
+    integrated_test = bld.program(
+        target="../integrated-tests",
+        source=bld.path.ant_glob(['integrated-tests/**/*.cpp']),
+        features=['cxx', 'cxxprogram'],
+        use='ChronoSync tests-main',
         includes=['.'],
         install_path=None,
         )
