face: allow the creation of permanent TCP faces

Change-Id: I516c176b000a78012f2ef7bd7f1f3e74c1758a94
Refs: #3167
diff --git a/tests/daemon/mgmt/face-manager-create-face.t.cpp b/tests/daemon/mgmt/face-manager-create-face.t.cpp
index 5cfe952..f96e532 100644
--- a/tests/daemon/mgmt/face-manager-create-face.t.cpp
+++ b/tests/daemon/mgmt/face-manager-create-face.t.cpp
@@ -27,8 +27,6 @@
 #include "face-manager-command-fixture.hpp"
 #include "nfd-manager-common-fixture.hpp"
 
-#include <thread>
-
 namespace nfd {
 namespace tests {
 
@@ -40,7 +38,7 @@
 class TcpFaceOnDemand
 {
 public:
-  ControlParameters
+  static ControlParameters
   getParameters()
   {
     return ControlParameters()
@@ -52,7 +50,7 @@
 class TcpFacePersistent
 {
 public:
-  ControlParameters
+  static ControlParameters
   getParameters()
   {
     return ControlParameters()
@@ -64,7 +62,7 @@
 class TcpFacePermanent
 {
 public:
-  ControlParameters
+  static ControlParameters
   getParameters()
   {
     return ControlParameters()
@@ -76,7 +74,7 @@
 class UdpFaceOnDemand
 {
 public:
-  ControlParameters
+  static ControlParameters
   getParameters()
   {
     return ControlParameters()
@@ -88,7 +86,7 @@
 class UdpFacePersistent
 {
 public:
-  ControlParameters
+  static ControlParameters
   getParameters()
   {
     return ControlParameters()
@@ -100,7 +98,7 @@
 class UdpFacePermanent
 {
 public:
-  ControlParameters
+  static ControlParameters
   getParameters()
   {
     return ControlParameters()
@@ -113,7 +111,7 @@
                            // fails because remote endpoint is prohibited
 {
 public:
-  ControlParameters
+  static ControlParameters
   getParameters()
   {
     return ControlParameters()
@@ -124,7 +122,7 @@
 class LocalTcpFaceLocalFieldsEnabled
 {
 public:
-  ControlParameters
+  static ControlParameters
   getParameters()
   {
     return ControlParameters()
@@ -137,7 +135,7 @@
 class LocalTcpFaceLocalFieldsDisabled
 {
 public:
-  ControlParameters
+  static ControlParameters
   getParameters()
   {
     return ControlParameters()
@@ -150,7 +148,7 @@
 class NonLocalUdpFaceLocalFieldsEnabled // won't work because non-local scope
 {
 public:
-  ControlParameters
+  static ControlParameters
   getParameters()
   {
     return ControlParameters()
@@ -163,7 +161,7 @@
 class NonLocalUdpFaceLocalFieldsDisabled
 {
 public:
-  ControlParameters
+  static ControlParameters
   getParameters()
   {
     return ControlParameters()
@@ -176,9 +174,10 @@
 namespace mpl = boost::mpl;
 
 // pairs of CreateCommand and Success/Failure status
-typedef mpl::vector<mpl::pair<TcpFaceOnDemand, CommandFailure<406>>,
+using TestCases = mpl::vector<
+                    mpl::pair<TcpFaceOnDemand, CommandFailure<406>>,
                     mpl::pair<TcpFacePersistent, CommandSuccess>,
-                    mpl::pair<TcpFacePermanent, CommandFailure<406>>,
+                    mpl::pair<TcpFacePermanent, CommandSuccess>,
                     mpl::pair<UdpFaceOnDemand, CommandFailure<406>>,
                     mpl::pair<UdpFacePersistent, CommandSuccess>,
                     mpl::pair<UdpFacePermanent, CommandSuccess>,
@@ -186,16 +185,16 @@
                     mpl::pair<LocalTcpFaceLocalFieldsEnabled, CommandSuccess>,
                     mpl::pair<LocalTcpFaceLocalFieldsDisabled, CommandSuccess>,
                     mpl::pair<NonLocalUdpFaceLocalFieldsEnabled, CommandFailure<406>>,
-                    mpl::pair<NonLocalUdpFaceLocalFieldsDisabled, CommandSuccess>> Faces;
+                    mpl::pair<NonLocalUdpFaceLocalFieldsDisabled, CommandSuccess>>;
 
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(NewFace, T, Faces, FaceManagerCommandFixture)
+BOOST_FIXTURE_TEST_CASE_TEMPLATE(NewFace, T, TestCases, FaceManagerCommandFixture)
 {
-  typedef typename T::first FaceType;
-  typedef typename T::second CreateResult;
+  using FaceType = typename T::first;
+  using CreateResult = typename T::second;
 
   Name commandName("/localhost/nfd/faces");
   commandName.append("create");
-  commandName.append(FaceType().getParameters().wireEncode());
+  commandName.append(FaceType::getParameters().wireEncode());
   auto command = makeInterest(commandName);
   m_keyChain.sign(*command);
 
@@ -206,12 +205,12 @@
     }
 
     ControlResponse actual(response.getContent().blockFromValue());
-    ControlResponse expected(CreateResult().getExpected());
+    ControlResponse expected(CreateResult::getExpected());
     BOOST_TEST_MESSAGE(actual.getText());
     BOOST_CHECK_EQUAL(expected.getCode(), actual.getCode());
 
     if (actual.getBody().hasWire()) {
-      ControlParameters expectedParams(FaceType().getParameters());
+      ControlParameters expectedParams(FaceType::getParameters());
       ControlParameters actualParams(actual.getBody());
 
       BOOST_CHECK(actualParams.hasFaceId());
@@ -234,7 +233,7 @@
 
     if (actual.getCode() != 200) {
       // ensure face not created
-      FaceUri uri(FaceType().getParameters().getUri());
+      FaceUri uri(FaceType::getParameters().getUri());
       auto& faceTable = this->node1.manager.m_faceTable;
       BOOST_CHECK(std::none_of(faceTable.begin(), faceTable.end(), [uri] (Face& face) {
         return face.getRemoteUri() == uri;
@@ -259,7 +258,7 @@
 
     Name commandName("/localhost/nfd/faces");
     commandName.append("create");
-    commandName.append(FaceType().getParameters().wireEncode());
+    commandName.append(FaceType::getParameters().wireEncode());
     auto command = makeInterest(commandName);
     m_keyChain.sign(*command);
 
@@ -268,7 +267,7 @@
   }
 
   // find the created face
-  auto foundFace = this->node1.findFaceByUri(FaceType().getParameters().getUri());
+  auto foundFace = this->node1.findFaceByUri(FaceType::getParameters().getUri());
   BOOST_REQUIRE(foundFace != nullptr);
 
   {
@@ -276,7 +275,7 @@
 
     Name commandName("/localhost/nfd/faces");
     commandName.append("create");
-    commandName.append(FaceType().getParameters().wireEncode());
+    commandName.append(FaceType::getParameters().wireEncode());
     auto command = makeInterest(commandName);
     m_keyChain.sign(*command);