face, mgmt: add channel status dataset publisher

Expose channel maps in protocol factories

Change-Id: I057b1bba638bfc9372867318653d71ba7d0e9888
Refs: #1631, #1653
diff --git a/tests/daemon/face/ethernet.cpp b/tests/daemon/face/ethernet.cpp
index 7df879c..905e2e7 100644
--- a/tests/daemon/face/ethernet.cpp
+++ b/tests/daemon/face/ethernet.cpp
@@ -1,11 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014  Regents of the University of California,
- *                     Arizona Board of Regents,
- *                     Colorado State University,
- *                     University Pierre & Marie Curie, Sorbonne University,
- *                     Washington University in St. Louis,
- *                     Beijing Institute of Technology
+ * Copyright (c) 2014,  Regents of the University of California,
+ *                      Arizona Board of Regents,
+ *                      Colorado State University,
+ *                      University Pierre & Marie Curie, Sorbonne University,
+ *                      Washington University in St. Louis,
+ *                      Beijing Institute of Technology,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * You should have received a copy of the GNU General Public License along with
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
 
 #include "face/ethernet-factory.hpp"
 #include "core/network-interface.hpp"
@@ -34,6 +35,14 @@
 
 BOOST_FIXTURE_TEST_SUITE(FaceEthernet, BaseFixture)
 
+BOOST_AUTO_TEST_CASE(GetChannels)
+{
+  EthernetFactory factory;
+
+  std::list<shared_ptr<const Channel> > channels = factory.getChannels();
+  BOOST_CHECK_EQUAL(channels.empty(), true);
+}
+
 class InterfacesFixture : protected BaseFixture
 {
 protected:
diff --git a/tests/daemon/face/tcp.cpp b/tests/daemon/face/tcp.cpp
index 166f257..0f64099 100644
--- a/tests/daemon/face/tcp.cpp
+++ b/tests/daemon/face/tcp.cpp
@@ -1,11 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014  Regents of the University of California,
- *                     Arizona Board of Regents,
- *                     Colorado State University,
- *                     University Pierre & Marie Curie, Sorbonne University,
- *                     Washington University in St. Louis,
- *                     Beijing Institute of Technology
+ * Copyright (c) 2014,  Regents of the University of California,
+ *                      Arizona Board of Regents,
+ *                      Colorado State University,
+ *                      University Pierre & Marie Curie, Sorbonne University,
+ *                      Washington University in St. Louis,
+ *                      Beijing Institute of Technology,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * You should have received a copy of the GNU General Public License along with
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
 
 #include "face/tcp-factory.hpp"
 #include "core/resolver.hpp"
@@ -54,6 +55,30 @@
   BOOST_CHECK_EQUAL(channel3->getUri().toString(), "tcp6://[::1]:20071");
 }
 
+BOOST_AUTO_TEST_CASE(GetChannels)
+{
+  TcpFactory factory;
+  BOOST_REQUIRE_EQUAL(factory.getChannels().empty(), true);
+
+  std::vector<shared_ptr<const Channel> > expectedChannels;
+  expectedChannels.push_back(factory.createChannel("127.0.0.1", "20070"));
+  expectedChannels.push_back(factory.createChannel("127.0.0.1", "20071"));
+  expectedChannels.push_back(factory.createChannel("::1", "20071"));
+
+  std::list<shared_ptr<const Channel> > channels = factory.getChannels();
+  for (std::list<shared_ptr<const Channel> >::const_iterator i = channels.begin();
+       i != channels.end(); ++i)
+    {
+      std::vector<shared_ptr<const Channel> >::iterator pos =
+        std::find(expectedChannels.begin(), expectedChannels.end(), *i);
+
+      BOOST_REQUIRE(pos != expectedChannels.end());
+      expectedChannels.erase(pos);
+    }
+
+  BOOST_CHECK_EQUAL(expectedChannels.size(), 0);
+}
+
 class EndToEndFixture : protected BaseFixture
 {
 public:
diff --git a/tests/daemon/face/udp.cpp b/tests/daemon/face/udp.cpp
index 2dfca3a..f2d3417 100644
--- a/tests/daemon/face/udp.cpp
+++ b/tests/daemon/face/udp.cpp
@@ -1,11 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014  Regents of the University of California,
- *                     Arizona Board of Regents,
- *                     Colorado State University,
- *                     University Pierre & Marie Curie, Sorbonne University,
- *                     Washington University in St. Louis,
- *                     Beijing Institute of Technology
+ * Copyright (c) 2014,  Regents of the University of California,
+ *                      Arizona Board of Regents,
+ *                      Colorado State University,
+ *                      University Pierre & Marie Curie, Sorbonne University,
+ *                      Washington University in St. Louis,
+ *                      Beijing Institute of Technology,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * You should have received a copy of the GNU General Public License along with
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
 
 #include "face/udp-factory.hpp"
 
@@ -32,6 +33,31 @@
 
 BOOST_FIXTURE_TEST_SUITE(FaceUdp, BaseFixture)
 
+BOOST_AUTO_TEST_CASE(GetChannels)
+{
+  UdpFactory factory;
+  BOOST_REQUIRE_EQUAL(factory.getChannels().empty(), true);
+
+  std::vector<shared_ptr<const Channel> > expectedChannels;
+
+  expectedChannels.push_back(factory.createChannel("127.0.0.1", "20070"));
+  expectedChannels.push_back(factory.createChannel("127.0.0.1", "20071"));
+  expectedChannels.push_back(factory.createChannel("::1", "20071"));
+
+  std::list<shared_ptr<const Channel> > channels = factory.getChannels();
+  for (std::list<shared_ptr<const Channel> >::const_iterator i = channels.begin();
+       i != channels.end(); ++i)
+    {
+      std::vector<shared_ptr<const Channel> >::iterator pos =
+        std::find(expectedChannels.begin(), expectedChannels.end(), *i);
+
+      BOOST_REQUIRE(pos != expectedChannels.end());
+      expectedChannels.erase(pos);
+    }
+
+  BOOST_CHECK_EQUAL(expectedChannels.size(), 0);
+}
+
 class FactoryErrorCheck : protected BaseFixture
 {
 public:
diff --git a/tests/daemon/face/unix-stream.cpp b/tests/daemon/face/unix-stream.cpp
index 7d86f39..cb48db4 100644
--- a/tests/daemon/face/unix-stream.cpp
+++ b/tests/daemon/face/unix-stream.cpp
@@ -1,11 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014  Regents of the University of California,
- *                     Arizona Board of Regents,
- *                     Colorado State University,
- *                     University Pierre & Marie Curie, Sorbonne University,
- *                     Washington University in St. Louis,
- *                     Beijing Institute of Technology
+ * Copyright (c) 2014,  Regents of the University of California,
+ *                      Arizona Board of Regents,
+ *                      Colorado State University,
+ *                      University Pierre & Marie Curie, Sorbonne University,
+ *                      Washington University in St. Louis,
+ *                      Beijing Institute of Technology,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * You should have received a copy of the GNU General Public License along with
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
 
 #include "face/unix-stream-factory.hpp"
 
@@ -55,6 +56,30 @@
   BOOST_CHECK_NE(channel1, channel2);
 }
 
+BOOST_AUTO_TEST_CASE(GetChannels)
+{
+  UnixStreamFactory factory;
+  BOOST_REQUIRE_EQUAL(factory.getChannels().empty(), true);
+
+  std::vector<shared_ptr<const Channel> > expectedChannels;
+
+  expectedChannels.push_back(factory.createChannel(CHANNEL_PATH1));
+  expectedChannels.push_back(factory.createChannel(CHANNEL_PATH2));
+
+  std::list<shared_ptr<const Channel> > channels = factory.getChannels();
+  for (std::list<shared_ptr<const Channel> >::const_iterator i = channels.begin();
+       i != channels.end(); ++i)
+    {
+      std::vector<shared_ptr<const Channel> >::iterator pos =
+        std::find(expectedChannels.begin(), expectedChannels.end(), *i);
+
+      BOOST_REQUIRE(pos != expectedChannels.end());
+      expectedChannels.erase(pos);
+    }
+
+  BOOST_CHECK_EQUAL(expectedChannels.size(), 0);
+}
+
 class EndToEndFixture : protected BaseFixture
 {
 public:
diff --git a/tests/daemon/face/websocket.cpp b/tests/daemon/face/websocket.cpp
new file mode 100644
index 0000000..6897a2a
--- /dev/null
+++ b/tests/daemon/face/websocket.cpp
@@ -0,0 +1,62 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014,  Regents of the University of California,
+ *                      Arizona Board of Regents,
+ *                      Colorado State University,
+ *                      University Pierre & Marie Curie, Sorbonne University,
+ *                      Washington University in St. Louis,
+ *                      Beijing Institute of Technology,
+ *                      The University of Memphis
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD 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.
+ *
+ * NFD 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
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "face/websocket-factory.hpp"
+#include "tests/test-common.hpp"
+
+namespace nfd {
+namespace tests {
+
+BOOST_FIXTURE_TEST_SUITE(FaceWebSocket, BaseFixture)
+
+BOOST_AUTO_TEST_CASE(GetChannels)
+{
+  WebSocketFactory factory("19596");
+  BOOST_REQUIRE_EQUAL(factory.getChannels().empty(), true);
+
+  std::vector<shared_ptr<const Channel> > expectedChannels;
+
+  expectedChannels.push_back(factory.createChannel("127.0.0.1", "20070"));
+  expectedChannels.push_back(factory.createChannel("127.0.0.1", "20071"));
+  expectedChannels.push_back(factory.createChannel("::1", "20071"));
+
+  std::list<shared_ptr<const Channel> > channels = factory.getChannels();
+  for (std::list<shared_ptr<const Channel> >::const_iterator i = channels.begin();
+       i != channels.end(); ++i)
+    {
+      std::vector<shared_ptr<const Channel> >::iterator pos =
+        std::find(expectedChannels.begin(), expectedChannels.end(), *i);
+
+      BOOST_REQUIRE(pos != expectedChannels.end());
+      expectedChannels.erase(pos);
+    }
+
+  BOOST_CHECK_EQUAL(expectedChannels.size(), 0);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace nfd
diff --git a/tests/daemon/mgmt/channel-status-common.hpp b/tests/daemon/mgmt/channel-status-common.hpp
new file mode 100644
index 0000000..4954cc3
--- /dev/null
+++ b/tests/daemon/mgmt/channel-status-common.hpp
@@ -0,0 +1,97 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014,  Regents of the University of California,
+ *                      Arizona Board of Regents,
+ *                      Colorado State University,
+ *                      University Pierre & Marie Curie, Sorbonne University,
+ *                      Washington University in St. Louis,
+ *                      Beijing Institute of Technology,
+ *                      The University of Memphis
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD 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.
+ *
+ * NFD 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
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NFD_TESTS_NFD_MGMT_CHANNEL_STATUS_COMMON_HPP
+#define NFD_TESTS_NFD_MGMT_CHANNEL_STATUS_COMMON_HPP
+
+#include "face/protocol-factory.hpp"
+#include "face/channel.hpp"
+
+#include "tests/test-common.hpp"
+
+#include <ndn-cxx/management/nfd-channel-status.hpp>
+
+
+
+namespace nfd {
+namespace tests {
+
+class DummyChannel : public Channel
+{
+public:
+
+  DummyChannel(const std::string& uri)
+  {
+    setUri(FaceUri(uri));
+  }
+
+  virtual
+  ~DummyChannel()
+  {
+  }
+};
+
+class DummyProtocolFactory : public ProtocolFactory
+{
+public:
+
+  DummyProtocolFactory()
+  {
+
+  }
+
+  virtual void
+  createFace(const FaceUri& uri,
+             const FaceCreatedCallback& onCreated,
+             const FaceConnectFailedCallback& onConnectFailed)
+  {
+  }
+
+  virtual void
+  addChannel(const std::string& channelUri)
+  {
+    m_channels.push_back(make_shared<DummyChannel>(channelUri));
+  }
+
+  virtual std::list<shared_ptr<const Channel> >
+  getChannels() const
+  {
+    return m_channels;
+  }
+
+  virtual size_t
+  getNChannels() const
+  {
+    return m_channels.size();
+  }
+
+private:
+  std::list<shared_ptr<const Channel> > m_channels;
+};
+
+} // namespace tests
+} // namespace nfd
+
+#endif // NFD_TESTS_NFD_MGMT_CHANNEL_STATUS_COMMON_HPP
diff --git a/tests/daemon/mgmt/channel-status-publisher.cpp b/tests/daemon/mgmt/channel-status-publisher.cpp
new file mode 100644
index 0000000..04625af
--- /dev/null
+++ b/tests/daemon/mgmt/channel-status-publisher.cpp
@@ -0,0 +1,185 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014,  Regents of the University of California,
+ *                      Arizona Board of Regents,
+ *                      Colorado State University,
+ *                      University Pierre & Marie Curie, Sorbonne University,
+ *                      Washington University in St. Louis,
+ *                      Beijing Institute of Technology,
+ *                      The University of Memphis
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD 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.
+ *
+ * NFD 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
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "mgmt/channel-status-publisher.hpp"
+#include "mgmt/internal-face.hpp"
+
+#include "channel-status-common.hpp"
+
+#include "core/logger.hpp"
+NFD_LOG_INIT("TestChannelStatusPublisher");
+
+namespace nfd {
+namespace tests {
+
+class ChannelStatusPublisherFixture : BaseFixture
+{
+public:
+  ChannelStatusPublisherFixture()
+    : m_face(make_shared<InternalFace>())
+    , m_publisher(m_factories, m_face, "/localhost/nfd/faces/channels")
+    , m_finished(false)
+  {
+  }
+
+  virtual
+  ~ChannelStatusPublisherFixture()
+  {
+  }
+
+  // virtual shared_ptr<DummyProtocolFactory>
+  // addProtocolFactory(const std::string& protocol)
+  // {
+  //   shared_ptr<DummyProtocolFactory> factory(make_shared<DummyProtocolFactory>());
+  //   m_factories[protocol] = factory;
+
+  //   return factory;
+  // }
+
+  void
+  validatePublish(const Data& data)
+  {
+    Block payload = data.getContent();
+
+    m_buffer.appendByteArray(payload.value(), payload.value_size());
+
+    BOOST_CHECK_NO_THROW(data.getName()[-1].toSegment());
+    if (data.getFinalBlockId() != data.getName()[-1])
+      {
+        return;
+      }
+
+    // wrap the Channel Status entries in a single Content TLV for easy parsing
+    m_buffer.prependVarNumber(m_buffer.size());
+    m_buffer.prependVarNumber(ndn::Tlv::Content);
+
+    ndn::Block parser(m_buffer.buf(), m_buffer.size());
+    parser.parse();
+
+    BOOST_REQUIRE_EQUAL(parser.elements_size(), m_expectedEntries.size());
+
+    for (Block::element_const_iterator i = parser.elements_begin();
+         i != parser.elements_end();
+         ++i)
+      {
+        if (i->type() != ndn::tlv::nfd::ChannelStatus)
+          {
+            BOOST_FAIL("expected ChannelStatus, got type #" << i->type());
+          }
+
+        ndn::nfd::ChannelStatus entry(*i);
+
+        NFD_LOG_DEBUG("looking for channelstatus " << entry.getLocalUri());
+
+        std::map<std::string, ndn::nfd::ChannelStatus>::const_iterator expectedEntryPos =
+          m_expectedEntries.find(entry.getLocalUri());
+
+        BOOST_REQUIRE(expectedEntryPos != m_expectedEntries.end());
+        const ndn::nfd::ChannelStatus& expectedEntry = expectedEntryPos->second;
+
+        BOOST_CHECK_EQUAL(entry.getLocalUri(), expectedEntry.getLocalUri());
+
+        m_matchedEntries.insert(entry.getLocalUri());
+      }
+
+    BOOST_CHECK_EQUAL(m_matchedEntries.size(), m_expectedEntries.size());
+
+    m_finished = true;
+  }
+
+protected:
+  ChannelStatusPublisher::FactoryMap m_factories;
+  shared_ptr<InternalFace> m_face;
+  ChannelStatusPublisher m_publisher;
+
+  ndn::EncodingBuffer m_buffer;
+
+  std::map<std::string, ndn::nfd::ChannelStatus> m_expectedEntries;
+  std::set<std::string> m_matchedEntries;
+
+  bool m_finished;
+};
+
+BOOST_FIXTURE_TEST_SUITE(MgmtChannelStatusPublisher, ChannelStatusPublisherFixture)
+
+BOOST_AUTO_TEST_CASE(Publish)
+{
+  const std::string protocol = "dummy";
+
+  shared_ptr<DummyProtocolFactory> factory(make_shared<DummyProtocolFactory>());
+  m_factories[protocol] = factory;
+
+  for (int i = 0; i < 10; ++i)
+    {
+      const std::string uri = protocol + "://path" + boost::lexical_cast<std::string>(i);
+      factory->addChannel(uri);
+
+      ndn::nfd::ChannelStatus expectedEntry;
+      expectedEntry.setLocalUri(DummyChannel(uri).getUri().toString());
+
+      m_expectedEntries[expectedEntry.getLocalUri()] = expectedEntry;
+    }
+
+  m_face->onReceiveData +=
+    bind(&ChannelStatusPublisherFixture::validatePublish, this, _1);
+
+  m_publisher.publish();
+  BOOST_REQUIRE(m_finished);
+}
+
+BOOST_AUTO_TEST_CASE(DuplicateFactories)
+{
+  const std::string protocol1 = "dummy1";
+  const std::string protocol2 = "dummy2";
+
+  shared_ptr<DummyProtocolFactory> factory(make_shared<DummyProtocolFactory>());
+  m_factories[protocol1] = factory;
+  m_factories[protocol2] = factory;
+
+  for (int i = 0; i < 10; ++i)
+    {
+      ndn::nfd::ChannelStatus expectedEntry;
+      const std::string uri = protocol1 + "://path" + boost::lexical_cast<std::string>(i);
+
+      factory->addChannel(uri);
+
+      expectedEntry.setLocalUri(DummyChannel(uri).getUri().toString());
+      m_expectedEntries[expectedEntry.getLocalUri()] = expectedEntry;
+    }
+
+  m_face->onReceiveData +=
+    bind(&ChannelStatusPublisherFixture::validatePublish, this, _1);
+
+  m_publisher.publish();
+  BOOST_REQUIRE(m_finished);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+
+
+
+} // namespace nfd
diff --git a/tests/daemon/mgmt/face-manager.cpp b/tests/daemon/mgmt/face-manager.cpp
index 0f53b93..92ec987 100644
--- a/tests/daemon/mgmt/face-manager.cpp
+++ b/tests/daemon/mgmt/face-manager.cpp
@@ -1,11 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014  Regents of the University of California,
- *                     Arizona Board of Regents,
- *                     Colorado State University,
- *                     University Pierre & Marie Curie, Sorbonne University,
- *                     Washington University in St. Louis,
- *                     Beijing Institute of Technology
+ * Copyright (c) 2014,  Regents of the University of California,
+ *                      Arizona Board of Regents,
+ *                      Colorado State University,
+ *                      University Pierre & Marie Curie, Sorbonne University,
+ *                      Washington University in St. Louis,
+ *                      Beijing Institute of Technology,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * You should have received a copy of the GNU General Public License along with
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
 
 #include "mgmt/face-manager.hpp"
 #include "mgmt/internal-face.hpp"
@@ -37,6 +38,7 @@
 #include "tests/test-common.hpp"
 #include "validation-common.hpp"
 #include "face-status-publisher-common.hpp"
+#include "channel-status-common.hpp"
 
 #include <ndn-cxx/encoding/tlv.hpp>
 #include <ndn-cxx/management/nfd-face-event-notification.hpp>
@@ -254,8 +256,6 @@
 
 protected:
   shared_ptr<InternalFace> m_face;
-
-private:
   bool m_callbackFired;
 };
 
@@ -311,7 +311,7 @@
     m_faceTable.reset();
   }
 
-private:
+protected:
   FaceManager m_manager;
   ConfigFile m_config;
 };
@@ -1690,7 +1690,6 @@
 };
 
 BOOST_FIXTURE_TEST_CASE(TestFaceList, FaceListFixture)
-
 {
   Name commandName("/localhost/nfd/faces/list");
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
@@ -1730,6 +1729,46 @@
   BOOST_REQUIRE(m_finished);
 }
 
+class ChannelStatusFixture : public FaceManagerFixture
+{
+public:
+  void
+  validatePublish(const Data& data, const ndn::nfd::ChannelStatus& expectedEntry)
+  {
+    m_callbackFired = true;
+    Block b = data.getContent().blockFromValue();
+    ndn::nfd::ChannelStatus entry(b);
+    BOOST_CHECK_EQUAL(entry.getLocalUri(), expectedEntry.getLocalUri());
+  }
+
+  virtual shared_ptr<DummyProtocolFactory>
+  addProtocolFactory(const std::string& protocol)
+  {
+    shared_ptr<DummyProtocolFactory> factory(make_shared<DummyProtocolFactory>());
+    m_manager.m_factories[protocol] = factory;
+
+    return factory;
+  }
+};
+
+BOOST_FIXTURE_TEST_CASE(TestChannelStatus, ChannelStatusFixture)
+{
+  shared_ptr<DummyProtocolFactory> factory(addProtocolFactory("dummy"));
+  factory->addChannel("dummy://");
+
+  Name requestName("/localhost/nfd/faces/channels");
+  shared_ptr<Interest> request(make_shared<Interest>(requestName));
+
+  ndn::nfd::ChannelStatus expectedEntry;
+  expectedEntry.setLocalUri(DummyChannel("dummy://").getUri().toString());
+
+  m_face->onReceiveData +=
+    bind(&ChannelStatusFixture::validatePublish, this, _1, expectedEntry);
+
+  m_manager.listChannels(*request);
+  BOOST_REQUIRE(m_callbackFired);
+}
+
 BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace tests
diff --git a/tests/wscript b/tests/wscript
index ca58e3b..c2cc536 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -64,7 +64,7 @@
             source=bld.path.ant_glob(['daemon/**/*.cpp'],
                                      excl=['daemon/face/ethernet.cpp',
                                            'daemon/face/unix-*.cpp',
-                                           'daemon/face/websocket-*.cpp']),
+                                           'daemon/face/websocket*.cpp']),
             use='daemon-objects unit-tests-base unit-tests-main',
             includes='.',
             install_path=None,
@@ -77,14 +77,14 @@
             unit_tests_nfd.source += bld.path.ant_glob('daemon/face/unix-*.cpp')
 
         if bld.env['HAVE_WEBSOCKET']:
-            unit_tests_nfd.source += bld.path.ant_glob('daemon/face/websocket-*.cpp')
+            unit_tests_nfd.source += bld.path.ant_glob('daemon/face/websocket*.cpp')
 
         unit_tests_rib = bld.program(
             target='../unit-tests-rib',
             features='cxx cxxprogram',
             source=bld.path.ant_glob(['rib/**/*.cpp']),
             use='rib-objects unit-tests-base unit-tests-main',
-            includes=['.'],
+            includes='.',
             install_path=None,
           )