management: mark Controller methods deprecated

This commit adds DEPRECATED attribute to the following items:

* Controller::start overloads, except the overload taking CommandOptions
* Controller::Sign typedef
* Controller::getDefaultCommandTimeout
* ControlCommand::getPrefix
* ControlCommand::getRequestName(ControlParameters)
* Controller::Controller(Face&)

refs #2039

Change-Id: Ib6cc81711948fa9874fe350364cd8d8613013e0d
diff --git a/src/management/nfd-control-command.hpp b/src/management/nfd-control-command.hpp
index e226486..9c1d2ea 100644
--- a/src/management/nfd-control-command.hpp
+++ b/src/management/nfd-control-command.hpp
@@ -79,15 +79,17 @@
   /** \return Name prefix of this ControlCommand
    *  \deprecated use getRequestName
    */
+  DEPRECATED(
   const Name&
-  getPrefix() const;
+  getPrefix() const);
 
   /** \brief construct the Name for a request Interest
    *  \throw ArgumentError if parameters are invalid
    *  \deprecated use the two-argument overload
    */
+  DEPRECATED(
   Name
-  getRequestName(const ControlParameters& parameters) const;
+  getRequestName(const ControlParameters& parameters) const);
 
 protected:
   ControlCommand(const std::string& module, const std::string& verb);
diff --git a/src/management/nfd-controller.cpp b/src/management/nfd-controller.cpp
index 1517522..90cd454 100644
--- a/src/management/nfd-controller.cpp
+++ b/src/management/nfd-controller.cpp
@@ -84,7 +84,7 @@
 {
   BOOST_ASSERT(timeout > time::milliseconds::zero());
 
-  Name requestName = command->getRequestName(parameters);
+  Name requestName = command->getRequestName(CommandOptions::DEFAULT_PREFIX, parameters);
   Interest interest(requestName);
   interest.setInterestLifetime(timeout);
   sign(interest);
diff --git a/src/management/nfd-controller.hpp b/src/management/nfd-controller.hpp
index c94fa10..a7d1290 100644
--- a/src/management/nfd-controller.hpp
+++ b/src/management/nfd-controller.hpp
@@ -58,8 +58,9 @@
    *         and has an internal default KeyChain to sign commands
    *  \deprecated use two-parameter overload
    */
+  DEPRECATED(
   explicit
-  Controller(Face& face);
+  Controller(Face& face));
 
   /** \brief construct a Controller that uses face for transport,
    *         and uses the passed KeyChain to sign commands
@@ -82,18 +83,13 @@
   /** \brief start command execution
    *  \deprecated use the overload taking CommandOptions
    */
+  DEPRECATED(
   template<typename Command>
   void
   start(const ControlParameters& parameters,
         const CommandSucceedCallback& onSuccess,
         const CommandFailCallback& onFailure,
-        const time::milliseconds& timeout)
-  {
-    CommandOptions options;
-    options.setTimeout(timeout);
-
-    this->start<Command>(parameters, onSuccess, onFailure, options);
-  }
+        const time::milliseconds& timeout));
 
   /** \brief start command execution
    *  \param certificate the certificate used to sign request Interests.
@@ -105,60 +101,40 @@
    *
    *  \deprecated use the overload taking CommandOptions
    */
+  DEPRECATED(
   template<typename Command>
   void
   start(const ControlParameters& parameters,
         const CommandSucceedCallback& onSuccess,
         const CommandFailCallback& onFailure,
         const IdentityCertificate& certificate,
-        const time::milliseconds& timeout = getDefaultCommandTimeout())
-  {
-    CommandOptions options;
-    if (certificate.getName().empty()) {
-      options.setSigningDefault();
-    }
-    else {
-      options.setSigningCertificate(certificate);
-    }
-    options.setTimeout(timeout);
-
-    this->start<Command>(parameters, onSuccess, onFailure, options);
-  }
+        const time::milliseconds& timeout = CommandOptions::DEFAULT_TIMEOUT));
 
   /** \brief start command execution
    *  \param identity the identity used to sign request Interests
    *  \deprecated use the overload taking CommandOptions
    */
+  DEPRECATED(
   template<typename Command>
   void
   start(const ControlParameters& parameters,
         const CommandSucceedCallback& onSuccess,
         const CommandFailCallback& onFailure,
         const Name& identity,
-        const time::milliseconds& timeout = getDefaultCommandTimeout())
-  {
-    CommandOptions options;
-    options.setSigningIdentity(identity);
-    options.setTimeout(timeout);
-
-    this->start<Command>(parameters, onSuccess, onFailure, options);
-  }
+        const time::milliseconds& timeout = CommandOptions::DEFAULT_TIMEOUT));
 
   /** \brief start command execution
    *  \param sign a function to sign request Interests
    *  \deprecated arbitrary signing function is no longer supported
    */
+  DEPRECATED(
   template<typename Command>
   void
   start(const ControlParameters& parameters,
         const CommandSucceedCallback& onSuccess,
         const CommandFailCallback& onFailure,
         const Sign& sign,
-        const time::milliseconds& timeout = getDefaultCommandTimeout())
-  {
-    shared_ptr<ControlCommand> command = make_shared<Command>();
-    this->startCommand(command, parameters, onSuccess, onFailure, sign, timeout);
-  }
+        const time::milliseconds& timeout = CommandOptions::DEFAULT_TIMEOUT));
 
 private:
   void
@@ -187,11 +163,9 @@
 public:
   /** \deprecated use CommandOptions::DEFAULT_TIMEOUT
    */
+  DEPRECATED(
   static time::milliseconds
-  getDefaultCommandTimeout()
-  {
-    return time::milliseconds(10000);
-  }
+  getDefaultCommandTimeout());
 
 public:
   /** \brief error code for timeout
@@ -217,6 +191,76 @@
   KeyChain& m_keyChain;
 };
 
+
+// deprecated methods
+
+template<typename Command>
+inline void
+Controller::start(const ControlParameters& parameters,
+                  const CommandSucceedCallback& onSuccess,
+                  const CommandFailCallback& onFailure,
+                  const time::milliseconds& timeout)
+{
+  CommandOptions options;
+  options.setTimeout(timeout);
+
+  this->start<Command>(parameters, onSuccess, onFailure, options);
+}
+
+template<typename Command>
+inline void
+Controller::start(const ControlParameters& parameters,
+                  const CommandSucceedCallback& onSuccess,
+                  const CommandFailCallback& onFailure,
+                  const IdentityCertificate& certificate,
+                  const time::milliseconds& timeout)
+{
+  CommandOptions options;
+  if (certificate.getName().empty()) {
+    options.setSigningDefault();
+  }
+  else {
+    options.setSigningCertificate(certificate);
+  }
+  options.setTimeout(timeout);
+
+  this->start<Command>(parameters, onSuccess, onFailure, options);
+}
+
+template<typename Command>
+inline void
+Controller::start(const ControlParameters& parameters,
+                  const CommandSucceedCallback& onSuccess,
+                  const CommandFailCallback& onFailure,
+                  const Name& identity,
+                  const time::milliseconds& timeout)
+{
+  CommandOptions options;
+  options.setSigningIdentity(identity);
+  options.setTimeout(timeout);
+
+  this->start<Command>(parameters, onSuccess, onFailure, options);
+}
+
+template<typename Command>
+inline void
+Controller::start(const ControlParameters& parameters,
+                  const CommandSucceedCallback& onSuccess,
+                  const CommandFailCallback& onFailure,
+                  const Sign& sign,
+                  const time::milliseconds& timeout)
+{
+  shared_ptr<ControlCommand> command = make_shared<Command>();
+  this->startCommand(command, parameters, onSuccess, onFailure, sign, timeout);
+}
+
+inline time::milliseconds
+Controller::getDefaultCommandTimeout()
+{
+  return CommandOptions::DEFAULT_TIMEOUT;
+}
+
+
 } // namespace nfd
 } // namespace ndn
 
diff --git a/tests/unit-tests/management/test-nfd-controller.cpp b/tests/unit-tests/management/test-nfd-controller.cpp
index b93149f..98101f3 100644
--- a/tests/unit-tests/management/test-nfd-controller.cpp
+++ b/tests/unit-tests/management/test-nfd-controller.cpp
@@ -41,7 +41,7 @@
 protected:
   CommandFixture()
     : face(makeDummyClientFace())
-    , controller(*face)
+    , controller(*face, keyChain)
     , commandSucceedCallback(bind(&CommandFixture::onCommandSucceed, this, _1))
     , commandFailCallback(bind(&CommandFixture::onCommandFail, this, _1, _2))
   {
@@ -62,8 +62,8 @@
 
 protected:
   shared_ptr<DummyClientFace> face;
-  Controller controller;
   KeyChain keyChain;
+  Controller controller;
 
   Controller::CommandSucceedCallback commandSucceedCallback;
   typedef boost::tuple<ControlParameters> CommandSucceedArgs;
@@ -97,7 +97,7 @@
   BOOST_REQUIRE_NO_THROW(request.wireDecode(requestInterest.getName().at(4).blockFromValue()));
   BOOST_CHECK_NO_THROW(command.validateRequest(request));
   BOOST_CHECK_EQUAL(request.getUri(), parameters.getUri());
-  BOOST_CHECK_EQUAL(requestInterest.getInterestLifetime(), Controller::getDefaultCommandTimeout());
+  BOOST_CHECK_EQUAL(requestInterest.getInterestLifetime(), CommandOptions::DEFAULT_TIMEOUT);
 
   ControlParameters responseBody;
   responseBody.setUri("tcp4://192.0.2.1:6363")