name: change default name component encoding convention to typed

refs #5044

Change-Id: I0062b31d25e4362d20e6b0f1fc9167306f346cac
diff --git a/ndn-cxx/name-component.cpp b/ndn-cxx/name-component.cpp
index 36460b0..786b514 100644
--- a/ndn-cxx/name-component.cpp
+++ b/ndn-cxx/name-component.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -42,7 +42,7 @@
 static_assert(std::is_base_of<tlv::Error, Component::Error>::value,
               "name::Component::Error must inherit from tlv::Error");
 
-static Convention g_conventionEncoding = Convention::MARKER;
+static Convention g_conventionEncoding = Convention::TYPED;
 static Convention g_conventionDecoding = Convention::EITHER;
 
 Convention
diff --git a/ndn-cxx/name-component.hpp b/ndn-cxx/name-component.hpp
index d1dc236..6b09467 100644
--- a/ndn-cxx/name-component.hpp
+++ b/ndn-cxx/name-component.hpp
@@ -68,7 +68,7 @@
 
 /** @brief Return which Naming Conventions style to use while encoding.
  *
- *  The current library default is Convention::MARKER, but this will change in the future.
+ *  The library default is Convention::TYPED.
  */
 Convention
 getConventionEncoding();
diff --git a/tests/unit/mgmt/dispatcher.t.cpp b/tests/unit/mgmt/dispatcher.t.cpp
index d89da1b..a6054c2 100644
--- a/tests/unit/mgmt/dispatcher.t.cpp
+++ b/tests/unit/mgmt/dispatcher.t.cpp
@@ -449,10 +449,10 @@
   advanceClocks(1_ms, 10);
 
   BOOST_REQUIRE_EQUAL(face.sentData.size(), 4);
-  BOOST_CHECK_EQUAL(face.sentData[0].getName(), "/root/test/%FE%00");
-  BOOST_CHECK_EQUAL(face.sentData[1].getName(), "/root/test/%FE%01");
-  BOOST_CHECK_EQUAL(face.sentData[2].getName(), "/root/test/%FE%02");
-  BOOST_CHECK_EQUAL(face.sentData[3].getName(), "/root/test/%FE%03");
+  BOOST_CHECK_EQUAL(face.sentData[0].getName(), "/root/test/seq=0");
+  BOOST_CHECK_EQUAL(face.sentData[1].getName(), "/root/test/seq=1");
+  BOOST_CHECK_EQUAL(face.sentData[2].getName(), "/root/test/seq=2");
+  BOOST_CHECK_EQUAL(face.sentData[3].getName(), "/root/test/seq=3");
 
   BOOST_CHECK_EQUAL(face.sentData[0].getContent().blockFromValue(), block);
   BOOST_CHECK_EQUAL(face.sentData[1].getContent().blockFromValue(), block);
@@ -463,10 +463,10 @@
   std::vector<Data> dataInStorage;
   std::copy(storage.begin(), storage.end(), std::back_inserter(dataInStorage));
   BOOST_REQUIRE_EQUAL(dataInStorage.size(), 4);
-  BOOST_CHECK_EQUAL(dataInStorage[0].getName(), "/root/test/%FE%00");
-  BOOST_CHECK_EQUAL(dataInStorage[1].getName(), "/root/test/%FE%01");
-  BOOST_CHECK_EQUAL(dataInStorage[2].getName(), "/root/test/%FE%02");
-  BOOST_CHECK_EQUAL(dataInStorage[3].getName(), "/root/test/%FE%03");
+  BOOST_CHECK_EQUAL(dataInStorage[0].getName(), "/root/test/seq=0");
+  BOOST_CHECK_EQUAL(dataInStorage[1].getName(), "/root/test/seq=1");
+  BOOST_CHECK_EQUAL(dataInStorage[2].getName(), "/root/test/seq=2");
+  BOOST_CHECK_EQUAL(dataInStorage[3].getName(), "/root/test/seq=3");
 
   BOOST_CHECK_EQUAL(dataInStorage[0].getContent().blockFromValue(), block);
   BOOST_CHECK_EQUAL(dataInStorage[1].getContent().blockFromValue(), block);
diff --git a/tests/unit/name-component.t.cpp b/tests/unit/name-component.t.cpp
index 87a3652..06e3d25 100644
--- a/tests/unit/name-component.t.cpp
+++ b/tests/unit/name-component.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -335,20 +335,20 @@
 
 class ConventionMarker
 {
+public:
+  ConventionMarker()
+  {
+    name::setConventionEncoding(name::Convention::MARKER);
+  }
+
+  ~ConventionMarker()
+  {
+    name::setConventionEncoding(name::Convention::TYPED);
+  }
 };
 
 class ConventionTyped
 {
-public:
-  ConventionTyped()
-  {
-    name::setConventionEncoding(name::Convention::TYPED);
-  }
-
-  ~ConventionTyped()
-  {
-    name::setConventionEncoding(name::Convention::MARKER);
-  }
 };
 
 class NumberWithMarker
diff --git a/tests/unit/prefix-announcement.t.cpp b/tests/unit/prefix-announcement.t.cpp
index d154484..e7399b0 100644
--- a/tests/unit/prefix-announcement.t.cpp
+++ b/tests/unit/prefix-announcement.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -34,8 +34,8 @@
 makePrefixAnnData()
 {
   return Data(
-    "067A 071A announced-name=/net/example 08036E6574 08076578616D706C65"
-    "          keyword-prefix-ann=20025041 version=0802FD01 segment=08020000"
+    "0678 0718 announced-name=/net/example 08036E6574 08076578616D706C65"
+    "          keyword-prefix-ann=20025041 version=230101 segment=210100"
     "     1403 content-type=prefix-ann 180105"
     "     1530 expire in one hour 6D040036EE80"
     "          validity FD00FD26 FD00FE0F323031383130333054303030303030"
@@ -171,7 +171,7 @@
   BOOST_CHECK(!pa.getValidityPeriod());
 
   const Data& data = pa.toData(m_keyChain, signingWithSha256(), 5);
-  BOOST_CHECK_EQUAL(data.getName(), "/32=PA/%FD%05/%00%00");
+  BOOST_CHECK_EQUAL(data.getName(), "/32=PA/v=5/seg=0");
   BOOST_CHECK_EQUAL(data.getContentType(), tlv::ContentType_PrefixAnn);
   BOOST_REQUIRE(pa.getData());
   BOOST_CHECK_EQUAL(*pa.getData(), data);
@@ -192,7 +192,7 @@
   pa.setExpiration(1_h);
 
   const Data& data = pa.toData(m_keyChain, signingWithSha256(), 1);
-  BOOST_CHECK_EQUAL(data.getName(), "/net/example/32=PA/%FD%01/%00%00");
+  BOOST_CHECK_EQUAL(data.getName(), "/net/example/32=PA/v=1/seg=0");
   BOOST_CHECK_EQUAL(data.getContentType(), tlv::ContentType_PrefixAnn);
 
   const Block& payload = data.getContent();
diff --git a/tests/unit/util/notification-stream.t.cpp b/tests/unit/util/notification-stream.t.cpp
index 2df3014..3ff6ed9 100644
--- a/tests/unit/util/notification-stream.t.cpp
+++ b/tests/unit/util/notification-stream.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020 Regents of the University of California,
+ * Copyright (c) 2014-2021 Regents of the University of California,
  *                         Arizona Board of Regents,
  *                         Colorado State University,
  *                         University Pierre & Marie Curie, Sorbonne University,
@@ -52,7 +52,7 @@
   advanceClocks(1_ms);
 
   BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
-  BOOST_CHECK_EQUAL(face.sentData[0].getName(), "/localhost/nfd/NotificationStreamTest/%FE%00");
+  BOOST_CHECK_EQUAL(face.sentData[0].getName(), "/localhost/nfd/NotificationStreamTest/seq=0");
   SimpleNotification decoded1;
   BOOST_CHECK_NO_THROW(decoded1.wireDecode(face.sentData[0].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(decoded1.getMessage(), "msg1");
@@ -63,7 +63,7 @@
   advanceClocks(1_ms);
 
   BOOST_REQUIRE_EQUAL(face.sentData.size(), 2);
-  BOOST_CHECK_EQUAL(face.sentData[1].getName(), "/localhost/nfd/NotificationStreamTest/%FE%01");
+  BOOST_CHECK_EQUAL(face.sentData[1].getName(), "/localhost/nfd/NotificationStreamTest/seq=1");
   SimpleNotification decoded2;
   BOOST_CHECK_NO_THROW(decoded2.wireDecode(face.sentData[1].getContent().blockFromValue()));
   BOOST_CHECK_EQUAL(decoded2.getMessage(), "msg2");