fw: FaceTable::get returns Face* instead of shared_ptr
refs #3205
Change-Id: I1c61493382fe065389266ff3519ab2b265fe4f79
diff --git a/tests/daemon/fw/face-table.t.cpp b/tests/daemon/fw/face-table.t.cpp
index 59bb7c8..4616efb 100644
--- a/tests/daemon/fw/face-table.t.cpp
+++ b/tests/daemon/fw/face-table.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -38,8 +38,8 @@
BOOST_AUTO_TEST_CASE(AddRemove)
{
Forwarder forwarder;
-
FaceTable& faceTable = forwarder.getFaceTable();
+
std::vector<FaceId> addHistory;
std::vector<FaceId> removeHistory;
faceTable.afterAdd.connect([&] (shared_ptr<Face> face) { addHistory.push_back(face->getId()); });
@@ -50,15 +50,20 @@
BOOST_CHECK_EQUAL(face1->getId(), face::INVALID_FACEID);
BOOST_CHECK_EQUAL(face2->getId(), face::INVALID_FACEID);
+ BOOST_CHECK(faceTable.get(face::INVALID_FACEID) == nullptr);
+ BOOST_CHECK_EQUAL(faceTable.size(), 0);
- forwarder.addFace(face1);
- forwarder.addFace(face2);
+ faceTable.add(face1);
+ faceTable.add(face2);
+ BOOST_CHECK_EQUAL(faceTable.size(), 2);
BOOST_CHECK_NE(face1->getId(), face::INVALID_FACEID);
BOOST_CHECK_NE(face2->getId(), face::INVALID_FACEID);
BOOST_CHECK_NE(face1->getId(), face2->getId());
BOOST_CHECK_GT(face1->getId(), face::FACEID_RESERVED_MAX);
BOOST_CHECK_GT(face2->getId(), face::FACEID_RESERVED_MAX);
+ BOOST_CHECK(faceTable.get(face1->getId()) == face1.get());
+ BOOST_CHECK(faceTable.get(face2->getId()) == face2.get());
FaceId oldId1 = face1->getId();
faceTable.add(face1);
@@ -72,6 +77,8 @@
face1->close();
BOOST_CHECK_EQUAL(face1->getId(), face::INVALID_FACEID);
+ BOOST_CHECK_EQUAL(faceTable.size(), 1);
+ BOOST_CHECK(faceTable.get(oldId1) == nullptr);
BOOST_REQUIRE_EQUAL(removeHistory.size(), 1);
BOOST_CHECK_EQUAL(removeHistory[0], addHistory[0]);
diff --git a/tests/daemon/mgmt/fib-manager.t.cpp b/tests/daemon/mgmt/fib-manager.t.cpp
index 9e5f285..3e5ee0e 100644
--- a/tests/daemon/mgmt/fib-manager.t.cpp
+++ b/tests/daemon/mgmt/fib-manager.t.cpp
@@ -38,7 +38,7 @@
FibManagerFixture()
: m_fib(m_forwarder.getFib())
, m_faceTable(m_forwarder.getFaceTable())
- , m_manager(m_fib, bind(&Forwarder::getFace, &m_forwarder, _1), m_dispatcher, m_validator)
+ , m_manager(m_fib, m_faceTable, m_dispatcher, m_validator)
{
setPrivilege("fib");
}