face: Minor updates of TCP faces
Change-Id: I9a11fb4b2cd1aaaa670313cab0b08f097554e1fc
diff --git a/tests/face/tcp.cpp b/tests/face/tcp.cpp
index b601be2..ff5dc50 100644
--- a/tests/face/tcp.cpp
+++ b/tests/face/tcp.cpp
@@ -18,11 +18,11 @@
BOOST_AUTO_TEST_CASE(ChannelMap)
{
TcpFactory factory;
-
+
shared_ptr<TcpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
shared_ptr<TcpChannel> channel1a = factory.createChannel("127.0.0.1", "20070");
BOOST_CHECK_EQUAL(channel1, channel1a);
-
+
shared_ptr<TcpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
BOOST_CHECK_NE(channel1, channel2);
}
@@ -39,7 +39,7 @@
bind(&EndToEndFixture::face1_onReceiveInterest, this, _1);
m_face1->onReceiveData +=
bind(&EndToEndFixture::face1_onReceiveData, this, _1);
- m_face1->onFail +=
+ m_face1->onFail +=
bind(&EndToEndFixture::face1_onFail, this);
this->afterIo();
@@ -52,7 +52,7 @@
this->afterIo();
}
-
+
void
face1_onReceiveInterest(const Interest& interest)
{
@@ -60,7 +60,7 @@
this->afterIo();
}
-
+
void
face1_onReceiveData(const Data& data)
{
@@ -85,7 +85,7 @@
bind(&EndToEndFixture::face2_onReceiveInterest, this, _1);
m_face2->onReceiveData +=
bind(&EndToEndFixture::face2_onReceiveData, this, _1);
- m_face2->onFail +=
+ m_face2->onFail +=
bind(&EndToEndFixture::face2_onFail, this);
this->afterIo();
@@ -98,7 +98,7 @@
this->afterIo();
}
-
+
void
face2_onReceiveInterest(const Interest& interest)
{
@@ -106,7 +106,7 @@
this->afterIo();
}
-
+
void
face2_onReceiveData(const Data& data)
{
@@ -142,14 +142,14 @@
{
BOOST_CHECK_EQUAL(m_faces.size(), shouldBe);
}
-
+
void
abortTestCase(const std::string& message)
{
g_io.stop();
BOOST_FAIL(message);
}
-
+
private:
void
afterIo()
@@ -180,13 +180,13 @@
scheduler::schedule(time::seconds(10),
bind(&EndToEndFixture::abortTestCase, this,
"TcpChannel error: cannot connect or cannot accept connection"));
-
+
shared_ptr<TcpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
shared_ptr<TcpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
-
+
channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated, this, _1),
bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
-
+
channel2->connect("127.0.0.1", "20070",
bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
bind(&EndToEndFixture::channel2_onConnectFailed, this, _1),
@@ -207,7 +207,7 @@
BOOST_CHECK_EQUAL(static_cast<bool>(dynamic_pointer_cast<LocalFace>(m_face2)), true);
// integrated tests needs to check that TcpFace for non-loopback fails these tests...
-
+
abortEvent =
scheduler::schedule(time::seconds(10),
bind(&EndToEndFixture::abortTestCase, this,
@@ -222,11 +222,11 @@
ndn::SignatureSha256WithRsa fakeSignature;
fakeSignature.setValue(ndn::dataBlock(tlv::SignatureValue, reinterpret_cast<const uint8_t*>(0), 0));
-
+
// set fake signature on data1 and data2
data1.setSignature(fakeSignature);
data2.setSignature(fakeSignature);
-
+
m_face1->sendInterest(interest1);
m_face1->sendData (data1 );
m_face2->sendInterest(interest2);
@@ -241,7 +241,7 @@
BOOST_REQUIRE_EQUAL(m_face1_receivedDatas .size(), 1);
BOOST_REQUIRE_EQUAL(m_face2_receivedInterests.size(), 1);
BOOST_REQUIRE_EQUAL(m_face2_receivedDatas .size(), 1);
-
+
BOOST_CHECK_EQUAL(m_face1_receivedInterests[0].getName(), interest2.getName());
BOOST_CHECK_EQUAL(m_face1_receivedDatas [0].getName(), data2.getName());
BOOST_CHECK_EQUAL(m_face2_receivedInterests[0].getName(), interest1.getName());
@@ -256,13 +256,13 @@
scheduler::schedule(time::seconds(10),
bind(&EndToEndFixture::abortTestCase, this,
"TcpChannel error: cannot connect or cannot accept connection"));
-
+
shared_ptr<TcpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
shared_ptr<TcpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
-
+
channel1->listen(bind(&EndToEndFixture::channel_onFaceCreated, this, _1),
bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
-
+
channel2->connect("127.0.0.1", "20070",
bind(&EndToEndFixture::channel_onFaceCreated, this, _1),
bind(&EndToEndFixture::channel_onConnectFailed, this, _1),
@@ -274,7 +274,7 @@
scheduler::cancel(abortEvent);
BOOST_CHECK_EQUAL(m_faces.size(), 2);
-
+
shared_ptr<TcpChannel> channel3 = factory.createChannel("127.0.0.1", "20072");
channel3->connect("127.0.0.1", "20070",
bind(&EndToEndFixture::channel_onFaceCreated, this, _1),
@@ -285,7 +285,7 @@
shared_ptr<TcpChannel> channel4 = factory.createChannel("127.0.0.1", "20073");
BOOST_CHECK_NE(channel3, channel4);
-
+
scheduler
::schedule
(time::seconds(1),
@@ -297,16 +297,16 @@
static_cast<TcpChannel::ConnectFailedCallback>(bind(&EndToEndFixture::
channel_onConnectFailed, this, _1)),
time::seconds(4)));
-
+
m_ioRemaining = 4; // 2 connects and 2 accepts
- abortEvent =
+ abortEvent =
scheduler::schedule(time::seconds(10),
bind(&EndToEndFixture::abortTestCase, this,
"TcpChannel error: cannot connect or cannot accept multiple connections"));
scheduler::schedule(time::seconds(0.5),
bind(&EndToEndFixture::checkFaceList, this, 4));
-
+
g_io.run();
g_io.reset();
scheduler::cancel(abortEvent);
@@ -323,13 +323,13 @@
scheduler::schedule(time::seconds(10),
bind(&EndToEndFixture::abortTestCase, this,
"TcpChannel error: cannot connect or cannot accept connection"));
-
+
shared_ptr<TcpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
shared_ptr<TcpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
-
+
channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated, this, _1),
bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
-
+
channel2->connect("127.0.0.1", "20070",
bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
bind(&EndToEndFixture::channel2_onConnectFailed, this, _1),
@@ -355,7 +355,7 @@
m_ioRemaining = 2;
// just double check that we are calling the virtual method
static_pointer_cast<Face>(m_face1)->close();
-
+
BOOST_REQUIRE_NO_THROW(g_io.run());
g_io.reset();
scheduler::cancel(abortEvent);
@@ -363,7 +363,7 @@
// both faces should get closed
BOOST_CHECK(!static_cast<bool>(m_face1));
BOOST_CHECK(!static_cast<bool>(m_face2));
-
+
BOOST_CHECK_EQUAL(channel1->size(), 0);
BOOST_CHECK_EQUAL(channel2->size(), 0);
}