/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2014-2018, Regents of the University of California.
 *
 * This file is part of NDNS (Named Data Networking Domain Name Service).
 * See AUTHORS.md for complete list of NDNS authors and contributors.
 *
 * NDNS is free software: you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * NDNS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "mgmt/management-tool.hpp"
#include "test-common.hpp"
#include "daemon/rrset-factory.hpp"
#include "util/cert-helper.hpp"
#include "ndns-enum.hpp"
#include "ndns-label.hpp"
#include "ndns-tlv.hpp"

#include <random>

#include <boost/algorithm/string/replace.hpp>
#include <boost/range/adaptors.hpp>

#include <ndn-cxx/util/io.hpp>
#include <ndn-cxx/util/regex.hpp>
#include <ndn-cxx/security/transform.hpp>

using boost::test_tools::output_test_stream;

namespace ndn {
namespace ndns {
namespace tests {

static const boost::filesystem::path TEST_DATABASE = TEST_CONFIG_PATH "/management_tool.db";
static const boost::filesystem::path TEST_CERTDIR = TEST_CONFIG_PATH "/management_tool_certs";
static const Name FAKE_ROOT("/fake-root/123456789");

/**
 * @brief Recursive copy a directory using Boost Filesystem
 *
 * Based on from http://stackoverflow.com/q/8593608/2150331
 */
void
copyDir(const boost::filesystem::path& source, const boost::filesystem::path& destination)
{
  namespace fs = boost::filesystem;

  fs::create_directory(destination);
  for (fs::directory_iterator file(source); file != fs::directory_iterator(); ++file) {
    fs::path current(file->path());
    if (is_directory(current)) {
      copyDir(current, destination / current.filename());
    }
    else {
      // cannot use fs::copy_file, see https://svn.boost.org/trac/boost/ticket/10038
      // fs::copy works, as it doesn't use problematic private API
      copy(current, destination / current.filename());
    }
  }
}

class TestHome : boost::noncopyable
{
public:
  TestHome()
  {
    if (std::getenv("HOME"))
      m_origHome = std::getenv("HOME");

    setenv("HOME", TEST_CONFIG_PATH "/tests/unit/mgmt/", 1);
    boost::filesystem::remove_all(TEST_CONFIG_PATH "/tests/unit/mgmt/");
    boost::filesystem::create_directories(TEST_CONFIG_PATH "/tests/unit/mgmt");
    copyDir("tests/unit/mgmt/.ndn", TEST_CONFIG_PATH "/tests/unit/mgmt/.ndn");
  }

  ~TestHome()
  {
    if (!m_origHome.empty())
      setenv("HOME", m_origHome.c_str(), 1);
    else
      unsetenv("HOME");
  }

protected:
  std::string m_origHome;
};


class ManagementToolFixture : public TestHome, public IdentityManagementFixture
{
public:
  class Error : public std::runtime_error
  {
  public:
    explicit
    Error(const std::string& what)
      : std::runtime_error(what)
    {
    }
  };

  class PreviousStateCleaner
  {
  public:
    PreviousStateCleaner()
    {
      boost::filesystem::remove(TEST_DATABASE);
      boost::filesystem::remove_all(TEST_CERTDIR);
    }
  };

  ManagementToolFixture()
    : m_tool(TEST_DATABASE.string().c_str(), m_keyChain)
    , m_dbMgr(TEST_DATABASE.string().c_str())
  {
    boost::filesystem::create_directory(TEST_CERTDIR);
    Identity root = addIdentity("NDNS");
    Key ksk = root.getDefaultKey();
    m_keyChain.deleteCertificate(ksk, ksk.getDefaultCertificate().getName());
    Certificate kskCert = CertHelper::createCertificate(m_keyChain, ksk, ksk, "CERT");
    m_keyChain.addCertificate(ksk, kskCert);
    rootKsk = kskCert.getName();

    Key dsk = m_keyChain.createKey(root);
    // replace rootDsk's default cert with ksk-signing cert
    m_keyChain.deleteCertificate(dsk, dsk.getDefaultCertificate().getName());
    Certificate dskCert = CertHelper::createCertificate(m_keyChain, dsk, ksk, "CERT");
    m_keyChain.addCertificate(dsk, dskCert);
    rootDsk = dskCert.getName();

    Identity other = addIdentity("/ndns-test/NDNS");
    Key otherKskKey = other.getDefaultKey();
    m_keyChain.deleteCertificate(otherKskKey, otherKskKey.getDefaultCertificate().getName());
    Certificate otherKskCert = CertHelper::createCertificate(m_keyChain, otherKskKey, otherKskKey, "CERT");
    m_keyChain.addCertificate(otherKskKey, otherKskCert);
    otherKsk  = otherKskCert.getName();

    // replace rootDsk's default cert with ksk-signing cert
    Key otherDskKey = m_keyChain.createKey(other);
    m_keyChain.deleteCertificate(otherDskKey, otherDskKey.getDefaultCertificate().getName());
    Certificate otherDskCert = CertHelper::createCertificate(m_keyChain, otherDskKey, otherKskKey, "CERT");
    m_keyChain.addCertificate(otherDskKey, otherDskCert);
    otherDsk = otherDskCert.getName();

    Certificate rootDkeyCert = CertHelper::createCertificate(m_keyChain, otherDskKey, otherKskKey, "CERT");
    m_keyChain.addCertificate(otherDskKey, rootDkeyCert);
    rootDkey = rootDkeyCert.getName();
  }

  ~ManagementToolFixture()
  {
  }

  std::vector<Certificate>
  getCerts(const Name& zoneName)
  {
    Zone zone(zoneName);
    std::vector<Certificate> certs;
    std::map<std::string, Block> zoneInfo = m_dbMgr.getZoneInfo(zone);
    // ksk are always the first key
    certs.push_back(Certificate(zoneInfo["ksk"]));
    certs.push_back(Certificate(zoneInfo["dsk"]));
    return certs;
  }

  Rrset
  findRrSet(Zone& zone, const Name& label, const name::Component& type)
  {
    Rrset rrset(&zone);
    rrset.setLabel(label);
    rrset.setType(type);

    if (!m_dbMgr.find(rrset))
      BOOST_THROW_EXCEPTION(Error("Record not found"));
    else
      return rrset;
  }

  Name
  getLabel(const Zone& zone, const Name& fullName)
  {
    size_t zoneNameSize = zone.getName().size();
    return fullName.getSubName(zoneNameSize + 1, fullName.size() - zoneNameSize - 3);
  }

  Certificate
  findCertFromIdentity(const Name& identityName, const Name& certName)
  {
    Certificate rtn;
    Identity identity = CertHelper::getIdentity(m_keyChain, identityName);
    for (const auto& key : identity.getKeys()) {
      for (const auto& cert : key.getCertificates()) {
        if (cert.getName() == certName) {
          rtn = cert;
          return rtn;
        }
      }
    }
    BOOST_THROW_EXCEPTION(Error("Certificate not found in keyChain"));
    return rtn;
  }

  Certificate
  findCertFromDb(Zone& zone, const Name& fullName)
  {
    Rrset rrset = findRrSet(zone, getLabel(zone, fullName), label::CERT_RR_TYPE);
    Certificate cert;
    cert.wireDecode(rrset.getData());
    return cert;
  }

  Certificate
  findDkeyFromDb(const Name& zoneName)
  {
    Zone zone(zoneName);
    std::map<std::string, Block> zoneInfo = m_dbMgr.getZoneInfo(zone);
    return Certificate(zoneInfo["dkey"]);
  }

  Response
  findResponse(Zone& zone, const Name& label, const name::Component& type)
  {
    Rrset rrset = findRrSet(zone, label, type);
    Data data(rrset.getData());
    Response resp;
    resp.fromData(zone.getName(), data);
    return resp;
  }

public:
  PreviousStateCleaner cleaner; // must be first variable
  ndns::ManagementTool m_tool;
  ndns::DbMgr m_dbMgr;

  // Names of pre-created certificates
  // Uncomment and run InitPreconfiguredKeys test case and then update names in the
  // constructor.
  Name rootKsk;
  Name rootDsk;
  Name otherKsk;
  Name otherDsk;
  Name rootDkey;
};

BOOST_FIXTURE_TEST_SUITE(ManagementTool, ManagementToolFixture)

// BOOST_FIXTURE_TEST_CASE(InitPreconfiguredKeys, ManagementToolFixture)
// {
//   using time::seconds;

//   auto generateCerts = [this] (const Name& zone, const Name& parentCert = Name()) -> Name {
//     // to re-generate certificates, uncomment and then update rootKsk/rootDsk names
//     Name kskName = m_keyChain.generateRsaKeyPair(zone, true);
//     auto kskCert = m_keyChain
//       .prepareUnsignedIdentityCertificate(kskName, zone, time::fromUnixTimestamp(seconds(0)),
//                                           time::fromUnixTimestamp(seconds(2147483648)), {});
//     if (parentCert.empty()) {
//       m_keyChain.selfSign(*kskCert);
//     }
//     else {
//       m_keyChain.sign(*kskCert, parentCert);
//     }
//     m_keyChain.addCertificate(*kskCert);

//     Name dskName = m_keyChain.generateRsaKeyPair(zone, false);
//     auto dskCert = m_keyChain
//       .prepareUnsignedIdentityCertificate(dskName, zone, time::fromUnixTimestamp(seconds(0)),
//                                           time::fromUnixTimestamp(seconds(2147483648)), {});
//     m_keyChain.sign(*dskCert, kskCert->getName());
//     m_keyChain.addCertificate(*dskCert);

//     return dskCert->getName();
//   };

//   Name rootDsk = generateCerts(ROOT_ZONE);
//   generateCerts("/ndns-test", rootDsk);

//   copyDir(TEST_CONFIG_PATH "/tests/unit/mgmt/.ndn", "/tmp/.ndn");
//   std::cout << "Manually copy contents of /tmp/.ndn into tests/unit/mgmt/.ndn" << std::endl;
// }

BOOST_AUTO_TEST_CASE(SqliteLabelOrder)
{
  // the correctness of our DoE design rely on the ordering of SQLite
  // this unit test make sure that our label::isSmallerInLabelOrder
  // is the same as the ordering of BLOB in SQLite

  std::random_device seed;
  std::mt19937 gen(seed());

  auto genRandomString = [&] (int length) -> std::string {
    std::string charset =
    "0123456789"
    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    "abcdefghijklmnopqrstuvwxyz";
    std::uniform_int_distribution<size_t> dist(0, charset.size() - 1);

    std::string str(length, 0);
    std::generate_n(str.begin(), length, [&] { return charset[dist(gen)];} );
    return str;
  };

  auto genRandomLabel = [&]() -> Name {
    std::uniform_int_distribution<size_t> numberOfLabelsDist(1, 5);
    std::uniform_int_distribution<size_t> labelSizeDist(1, 10);
    Name nm;
    size_t length = numberOfLabelsDist(gen);
    for (size_t i = 0; i < length; i++) {
      nm.append(genRandomString(labelSizeDist(gen)));
    }
    return nm;
  };

  const size_t NGENERATED_LABELS = 10;

  Zone zone = m_tool.createZone("/net/ndnsim", "/net");
  RrsetFactory rrsetFactory(TEST_DATABASE.string(), zone.getName(),
                            m_keyChain, DEFAULT_CERT);
  rrsetFactory.checkZoneKey();
  std::vector<Rrset> rrsets;
  std::vector<Name> names;
  for (size_t i = 0; i < NGENERATED_LABELS; i++) {
    Name randomLabel = genRandomLabel();
    Rrset randomTxt = rrsetFactory.generateTxtRrset(randomLabel,
                                                    VERSION_USE_UNIX_TIMESTAMP,
                                                    DEFAULT_CACHE_TTL,
                                                    {});

    rrsets.push_back(randomTxt);
    m_dbMgr.insert(randomTxt);
    names.push_back(randomLabel);
  }

  std::sort(rrsets.begin(), rrsets.end());

  using boost::adaptors::filtered;
  using boost::adaptors::transformed;

  std::vector<Rrset> rrsetsFromDb = m_dbMgr.findRrsets(zone);
  auto fromDbFiltered = rrsetsFromDb | filtered([] (const Rrset& rrset) {
      return rrset.getType() == label::TXT_RR_TYPE;
    });

  auto extractLabel = [] (const Rrset& rr) {
    return rr.getLabel();
  };
  auto expected = rrsets | transformed(extractLabel);
  auto actual = fromDbFiltered | transformed(extractLabel);

  BOOST_CHECK_EQUAL_COLLECTIONS(expected.begin(), expected.end(),
                                actual.begin(), actual.end());
}

BOOST_AUTO_TEST_CASE(CreateDeleteRootFixture)
{
  // creating root_zone need a rootDkey
  BOOST_CHECK_THROW(m_tool.createZone(ROOT_ZONE, ROOT_ZONE,
                                      time::seconds(4600),
                                      time::seconds(4600),
                                      rootKsk, rootDsk), ndns::ManagementTool::Error);

  m_tool.createZone(ROOT_ZONE, ROOT_ZONE,
                    time::seconds(4600),
                    time::seconds(4600),
                    rootKsk, rootDsk, rootDkey);

  Zone zone(ROOT_ZONE);
  Name zoneIdentityName = Name(ROOT_ZONE).append("NDNS");
  BOOST_REQUIRE_EQUAL(m_dbMgr.find(zone), true);
  BOOST_REQUIRE_NO_THROW(findCertFromDb(zone, rootDsk));
  BOOST_CHECK_EQUAL(findCertFromDb(zone, rootDsk).getName(), rootDsk);
  BOOST_CHECK_EQUAL(findCertFromDb(zone, rootKsk).getName(), rootKsk);
  BOOST_CHECK_EQUAL(findDkeyFromDb(ROOT_ZONE).getName(), rootDkey);

  BOOST_CHECK_EQUAL(findCertFromIdentity(zoneIdentityName, rootDsk).getName(), rootDsk);
  BOOST_CHECK_EQUAL(findCertFromIdentity(zoneIdentityName, rootKsk).getName(), rootKsk);

  BOOST_CHECK_NO_THROW(m_tool.deleteZone(ROOT_ZONE));
  BOOST_CHECK_EQUAL(m_dbMgr.find(zone), false);
}

BOOST_AUTO_TEST_CASE(CreateDeleteChildFixture)
{
  Name parentZoneName("/ndns-test");
  Name zoneName = Name(parentZoneName).append("child-zone");

  Zone zone1(zoneName);
  Name zoneIdentityName = Name(zoneName).append(label::NDNS_ITERATIVE_QUERY);
  BOOST_REQUIRE_EQUAL(m_dbMgr.find(zone1), false);

  // will generate keys automatically
  m_tool.createZone(zoneName, parentZoneName);
  BOOST_CHECK_EQUAL(CertHelper::doesIdentityExist(m_keyChain, zoneIdentityName), true);

  std::vector<Certificate>&& certs = getCerts(zoneName);
  BOOST_REQUIRE_EQUAL(certs.size(), 2);

  const Name& ksk = certs[0].getName();
  const Name& dsk = certs[1].getName();

  Zone zone(zoneName);
  BOOST_REQUIRE_EQUAL(m_dbMgr.find(zone), true);
  BOOST_REQUIRE_NO_THROW(findCertFromDb(zone, dsk));
  BOOST_CHECK_EQUAL(findCertFromDb(zone, dsk).getName(), dsk);
  BOOST_CHECK_EQUAL(findCertFromDb(zone, ksk).getName(), ksk);

  BOOST_CHECK_EQUAL(findCertFromIdentity(zoneIdentityName, dsk), findCertFromDb(zone, dsk));
  BOOST_CHECK_EQUAL(findCertFromIdentity(zoneIdentityName, ksk), findCertFromDb(zone, ksk));

  BOOST_CHECK_NO_THROW(m_tool.deleteZone(zoneName));

  BOOST_CHECK_THROW(m_tool.deleteZone(zoneName), ndns::ManagementTool::Error);
  BOOST_CHECK_THROW(m_tool.deleteZone("/non/existing/zone"), ndns::ManagementTool::Error);
}

BOOST_AUTO_TEST_CASE(CreateZoneWithFixture)
{
  Name parentZoneName("/ndns-test");
  Name zoneName = Name(parentZoneName).append("child-zone");
  Name zoneIdentityName = Name(zoneName).append(label::NDNS_ITERATIVE_QUERY);

  m_tool.createZone(zoneName, parentZoneName, time::seconds(4200), time::days(30));
  BOOST_CHECK_EQUAL(CertHelper::doesIdentityExist(m_keyChain, zoneIdentityName), true);

  std::vector<Certificate>&& certs = getCerts(zoneName);
  BOOST_REQUIRE_EQUAL(certs.size(), 2);

  const Name& dsk = certs[1].getName();

  // Check zone ttl
  Zone zone(zoneName);
  BOOST_REQUIRE_EQUAL(m_dbMgr.find(zone), true);
  BOOST_CHECK_EQUAL(zone.getTtl(), time::seconds(4200));

  // check dkey name
  Name dkeyName = Name(parentZoneName).append("NDNS").append(zoneName.getSubName(parentZoneName.size()));
  Certificate dkey = findDkeyFromDb(zoneName);
  BOOST_CHECK(dkeyName.isPrefixOf(dkey.getName()));

  // TODO: check signing hierarchy

  // Check dsk rrset ttl
  Rrset rrset;
  BOOST_REQUIRE_NO_THROW(rrset = findRrSet(zone, getLabel(zone, dsk), label::CERT_RR_TYPE));
  BOOST_CHECK_EQUAL(rrset.getTtl(), time::seconds(4200));

  // Check certificate freshnessPeriod and validity
  Certificate cert = CertHelper::getCertificate(m_keyChain, zoneIdentityName, dsk);
  time::system_clock::TimePoint beg,end;
  std::tie(beg, end) = cert.getValidityPeriod().getPeriod();

  BOOST_REQUIRE_NO_THROW(cert = findCertFromDb(zone, dsk));
  BOOST_CHECK_EQUAL(cert.getFreshnessPeriod(), time::seconds(4200));
  BOOST_CHECK_EQUAL(end - beg, time::days(30));
  m_tool.deleteZone(zoneName);
}

BOOST_AUTO_TEST_CASE(ZoneCreatePreconditions)
{
  BOOST_CHECK_NO_THROW(m_tool.createZone("/net/ndnsim", "/net"));
  BOOST_CHECK_THROW(m_tool.createZone("/net/ndnsim", "/net"), ndns::ManagementTool::Error);

  std::vector<Certificate>&& certs = getCerts("/net/ndnsim");
  BOOST_REQUIRE_EQUAL(certs.size(), 2);

  const Name& ksk = certs[0].getName();
  const Name& dsk = certs[1].getName();

  m_tool.deleteZone("/net/ndnsim");
  // identity will still exist after the zone is deleted

  BOOST_CHECK_THROW(m_tool.createZone("/net/ndnsim", "/net/ndnsim"), ndns::ManagementTool::Error);

  BOOST_CHECK_THROW(m_tool.createZone("/net/ndnsim", "/com"), ndns::ManagementTool::Error);

  BOOST_CHECK_NO_THROW(m_tool.createZone("/net/ndnsim", "/",
                                         time::seconds(1), time::days(1), ksk, dsk));
  BOOST_CHECK_EQUAL(getCerts("/net/ndnsim").size(), 2);
  m_tool.deleteZone("/net/ndnsim");

  BOOST_CHECK_NO_THROW(m_tool.createZone("/net/ndnsim", "/",
                                         time::seconds(1), time::days(1), Name(), dsk));

  m_tool.deleteZone("/net/ndnsim");

  BOOST_CHECK_NO_THROW(m_tool.createZone("/net/ndnsim", "/",
                                         time::seconds(1), time::days(1), ksk, Name()));
  m_tool.deleteZone("/net/ndnsim");

  BOOST_CHECK_THROW(m_tool.createZone("/net/ndnsim", "/net",
                                      time::seconds(1), time::days(1), "/com/ndnsim"),
                                      ndns::ManagementTool::Error);

  Identity id = addIdentity("/net/ndnsim/NDNS");
  Certificate cert = id.getDefaultKey().getDefaultCertificate();
  BOOST_CHECK_NO_THROW(m_tool.createZone("/net/ndnsim", "/net",
                                         time::seconds(1), time::days(1), cert.getName()));

  id = addIdentity("/com/ndnsim/NDNS");
  cert = id.getDefaultKey().getDefaultCertificate();

  BOOST_CHECK_THROW(m_tool.createZone("/net/ndnsim", "/net",
                                      time::seconds(1), time::days(1), cert.getName()),
                    ndns::ManagementTool::Error);

  id = addIdentity("/net/ndnsim/www/NDNS");
  cert = id.getDefaultKey().getDefaultCertificate();
  BOOST_CHECK_THROW(m_tool.createZone("/net/ndnsim", "/net",
                                      time::seconds(1), time::days(1), cert.getName()),
                    ndns::ManagementTool::Error);

  id = addIdentity("/net/ndnsim/NDNS");
  cert = id.getDefaultKey().getDefaultCertificate();
  m_keyChain.deleteCertificate(id.getDefaultKey(), cert.getName());
  BOOST_CHECK_THROW(m_tool.createZone("/net/ndnsim", "/net",
                                      time::seconds(1), time::days(1), cert.getName()),
                    ndns::ManagementTool::Error);

  // for root zone special case (requires a valid DKEY to be specified)
  BOOST_CHECK_THROW(m_tool.createZone("/", "/"), ndns::ManagementTool::Error);

  BOOST_CHECK_NO_THROW(m_tool.createZone("/", "/", time::seconds(1), time::days(1),
                                         DEFAULT_CERT, DEFAULT_CERT, rootDkey));
}

class OutputTester
{
public:
  OutputTester()
    : savedBuf(std::clog.rdbuf())
  {
    std::cout.rdbuf(buffer.rdbuf());
  }

  ~OutputTester()
  {
    std::cout.rdbuf(savedBuf);
  }

public:
  std::stringstream buffer;
  std::streambuf* savedBuf;
};

// BOOST_AUTO_TEST_CASE(ExportCertificate)
// {
//   std::string outputFile = TEST_CERTDIR.string() + "/ss.cert";

//   BOOST_REQUIRE_THROW(m_tool.exportCertificate("/random/name", outputFile),
//                       ndns::ManagementTool::Error);

//   BOOST_REQUIRE_EQUAL(boost::filesystem::exists(outputFile), false);
//   // doesn't check the zone, export from KeyChain directly
//   BOOST_CHECK_NO_THROW(m_tool.exportCertificate(otherDsk, outputFile));
//   BOOST_REQUIRE_EQUAL(boost::filesystem::exists(outputFile), true);

//   std::string dskValue =
//     "Bv0C3Ac3CAluZG5zLXRlc3QIA0tFWQgRZHNrLTE0MTY5NzQwMDY2NTkIB0lELUNF\n"
//     "UlQICf0AAAFJ6jt6DhQDGAECFf0BYTCCAV0wIhgPMTk3MDAxMDEwMDAwMDBaGA8y\n"
//     "MDM4MDExOTAzMTQwOFowEzARBgNVBCkTCi9uZG5zLXRlc3QwggEgMA0GCSqGSIb3\n"
//     "DQEBAQUAA4IBDQAwggEIAoIBAQDIFUL7Fz8mmxxIT8l3FtWm+CuH9+iQ0Uj/a30P\n"
//     "mKe4gWvtxzhb4vIngYbXGv2iUzHswdqYlTVeDdW6eOFKMvyY5p5eVtLqDFZ7EEK0\n"
//     "0rpTh648HjCSz+Awgp2nbiYAAVvhP6YF+NxGBH412uPI7kLY6ozypsNmYP+K4SYT\n"
//     "oY9ee4xLSjqzXfLMyP1h8OHcN/aNmccRJlyYblCmCDbZPnzu3ttHHwdrYQLeFvb0\n"
//     "B5grCAQoPHwkfxkEnzQBA/fbUdvKNdayEkuibPLlIlmj2cBtk5iVk8JCSibP3Zlz\n"
//     "36Sks1DAO+1EvCRnjoH5vYmkpMUBFue+6A40IQG4brM2CiIRAgERFjMbAQEcLgcs\n"
//     "CAluZG5zLXRlc3QIA0tFWQgRa3NrLTE0MTY5NzQwMDY1NzcIB0lELUNFUlQX/QEA\n"
//     "GP2bQqp/7rfb8tShwDbXihWrPojwEFqlfwLibK9aM1RxwpHVqbtRsPYmuWc87LaU\n"
//     "OztPOZinHGL80ypFC+wYadVGnE8MPdTkUYUik7mbHDEsYWADoyGMVhoZv+OTJ/5m\n"
//     "MUh/kR1FMiqtZcIQtLB3cdCeGlZBl9wm2SvhMKVUym3RsQO46RpnmsEQcCfWMBZg\n"
//     "u5U6mhYIpiQPZ/sYyZ9zXstwsIfaF1p0V+1dW5y99PZJXIegVKhkGGU0ibjYoJy7\n"
//     "6uUjqBBDX8KMdt6n/Zy1/pGG1eOchMyV0JZ8+MJxWuiTEh5PJeYMFHTV/BVp8aPy\n"
//     "8UNqhMpjAZwW6pdvOZADVg==\n";

//   {
//     std::ifstream ifs(outputFile.c_str());
//     std::string actualValue((std::istreambuf_iterator<char>(ifs)),
//                             std::istreambuf_iterator<char>());
//     BOOST_CHECK_EQUAL(actualValue, dskValue);
//   }
//   boost::filesystem::remove(outputFile);

//   // doesn't check the zone, export from KeyChain directly
//   BOOST_CHECK_NO_THROW(m_tool.exportCertificate(otherKsk, outputFile));
//   boost::filesystem::remove(outputFile);

//   Name zoneName("/ndns-test");
//   m_tool.createZone(zoneName, ROOT_ZONE, time::seconds(4200), time::days(30),
//                     otherKsk, otherDsk);

//   m_keyChain.deleteCertificate(otherKsk);
//   m_keyChain.deleteCertificate(otherDsk);

//   // retrieve cert from the zone
//   BOOST_CHECK_NO_THROW(m_tool.exportCertificate(otherDsk, outputFile));
//   {
//     std::ifstream ifs(outputFile.c_str());
//     std::string actualValue((std::istreambuf_iterator<char>(ifs)),
//                             std::istreambuf_iterator<char>());
//     BOOST_CHECK_EQUAL(actualValue, dskValue);
//   }
//   boost::filesystem::remove(outputFile);

//   BOOST_REQUIRE_THROW(m_tool.exportCertificate(otherKsk, outputFile),
//                       ndns::ManagementTool::Error);

//   // output to std::cout
//   std::string acutalOutput;
//   {
//     OutputTester tester;
//     m_tool.exportCertificate(otherDsk, "-");
//     acutalOutput = tester.buffer.str();
//   }
//   BOOST_CHECK_EQUAL(acutalOutput, dskValue);
// }

BOOST_AUTO_TEST_CASE(AddRrset)
{
  Name zoneName("/ndns-test");
  Zone zone(zoneName);

  time::seconds ttl1(4200);
  time::seconds ttl2(4500);
  m_tool.createZone(zoneName, ROOT_ZONE, ttl1);

  RrsetFactory rf(TEST_DATABASE, zoneName, m_keyChain, DEFAULT_CERT);
  rf.checkZoneKey();
  Rrset rrset1 = rf.generateNsRrset("/l1", 7654, ttl2, DelegationList());

  BOOST_CHECK_NO_THROW(m_tool.addRrset(rrset1));
  Rrset rrset2 = findRrSet(zone, "/l1", label::NS_RR_TYPE);
  BOOST_CHECK_EQUAL(rrset1, rrset2);
}

BOOST_AUTO_TEST_CASE(AddMultiLevelLabelRrset)
{
  Name zoneName("/ndns-test");
  Zone zone(zoneName);

  time::seconds ttl(4200);
  m_tool.createZone(zoneName, ROOT_ZONE, ttl);

  RrsetFactory rf(TEST_DATABASE, zoneName, m_keyChain, DEFAULT_CERT);
  rf.checkZoneKey();

  auto checkRrset = [&zone, &zoneName, this](Name label,
                                             name::Component type,
                                             NdnsContentType contentType) -> void {
    Rrset rr1 = findRrSet(zone, label, type);
    BOOST_CHECK_EQUAL(Data(rr1.getData()).getContentType(), contentType);
    Response response1;
    response1.fromData(zoneName, Data(rr1.getData()));
    BOOST_CHECK_EQUAL(response1.getRrLabel(), label);
  };

  Name labelName("/l1/l2/l3");

  Rrset rrset1 = rf.generateNsRrset(labelName, 7654, ttl, DelegationList());

  //add NS NDNS_AUTH and check user-defined ttl
  BOOST_CHECK_NO_THROW(m_tool.addMultiLevelLabelRrset(rrset1, rf, ttl));
  Rrset rrset2 = findRrSet(zone, labelName, label::NS_RR_TYPE);
  BOOST_CHECK_EQUAL(rrset1, rrset2);

  checkRrset("/l1", label::NS_RR_TYPE, ndns::NDNS_AUTH);
  checkRrset("/l1/l2", label::NS_RR_TYPE, ndns::NDNS_AUTH);

  // insert a same-name rrset with TXT type
  Rrset txtRr = rf.generateTxtRrset("/l1/l2/l3", 7654, ttl, std::vector<std::string>());
  BOOST_CHECK_NO_THROW(m_tool.addMultiLevelLabelRrset(txtRr, rf, ttl));

  checkRrset("/l1", label::NS_RR_TYPE, ndns::NDNS_AUTH);
  checkRrset("/l1/l2", label::NS_RR_TYPE, ndns::NDNS_AUTH);
  checkRrset("/l1/l2/l3", label::TXT_RR_TYPE, ndns::NDNS_RESP);
  // check that there is no confliction
  checkRrset("/l1/l2/l3", label::NS_RR_TYPE, ndns::NDNS_LINK);

  // insert a shorter NS, when there are longer NS or TXT
  Rrset shorterNs = rf.generateNsRrset("/l1/l2", 7654, ttl, DelegationList());
  BOOST_CHECK_THROW(m_tool.addMultiLevelLabelRrset(shorterNs, rf, ttl),
                    ndns::ManagementTool::Error);

  // insert a longer NS, when there is already a shorter NS
  Rrset longerNs = rf.generateNsRrset("/l1/l2/l3/l4", 7654, ttl, DelegationList());
  BOOST_CHECK_THROW(m_tool.addMultiLevelLabelRrset(longerNs, rf, ttl),
                    ndns::ManagementTool::Error);

  // insert a smaller TXT, when there are longer NS and TXT
  Rrset shorterTxt = rf.generateTxtRrset("/l1/l2", 7654, ttl, std::vector<std::string>());
  BOOST_CHECK_NO_THROW(m_tool.addMultiLevelLabelRrset(shorterTxt, rf, ttl));

  // insert a smaller NS, when there is long TXT
  Rrset longTxt = rf.generateTxtRrset("/k1/k2/k3", 7654, ttl, std::vector<std::string>());
  Rrset smallerNs = rf.generateNsRrset("/k1/k2", 7654, ttl, DelegationList());
  BOOST_CHECK_NO_THROW(m_tool.addMultiLevelLabelRrset(longTxt, rf, ttl));
  BOOST_CHECK_THROW(m_tool.addMultiLevelLabelRrset(smallerNs, rf, ttl),
                    ndns::ManagementTool::Error);

  // inserting a longer TXT, when there is shoter TXT
  Rrset longerTxt = rf.generateTxtRrset("/k1/k2/k3/k4", 7654, ttl, std::vector<std::string>());
  BOOST_CHECK_NO_THROW(m_tool.addMultiLevelLabelRrset(longerTxt, rf, ttl));
}

BOOST_AUTO_TEST_CASE(AddRrSetDskCertPreConditon)
{
  // check pre-condition
  Name zoneName("/ndns-test");

  // Check: throw if zone not exist
  std::string certPath = TEST_CERTDIR.string();
  BOOST_CHECK_THROW(m_tool.addRrsetFromFile(zoneName, certPath), ndns::ManagementTool::Error);

  m_tool.createZone(zoneName, ROOT_ZONE);

  // Check: throw if certificate does not match
  BOOST_CHECK_THROW(m_tool.addRrsetFromFile(zoneName, certPath), ndns::ManagementTool::Error);

  std::string rightCertPath = TEST_CERTDIR.string() + "/ss.cert";
  std::vector<Certificate>&& certs = getCerts(zoneName);
  const Name& ksk = certs[0].getName();
  m_tool.exportCertificate(ksk, rightCertPath);

  // Check: throw if it's a duplicated certificate
  BOOST_CHECK_THROW(m_tool.addRrsetFromFile(zoneName, rightCertPath), ndns::ManagementTool::Error);
}

BOOST_AUTO_TEST_CASE(AddRrSetDskCert)
{
  Name parentZoneName("/ndns-test");
  Name zoneName("/ndns-test/child-zone");
  Name zoneIdentityName = Name(zoneName).append(label::NDNS_ITERATIVE_QUERY);

  m_tool.createZone(parentZoneName, ROOT_ZONE, time::seconds(1), time::days(1), otherKsk, otherDsk);
  m_tool.createZone(zoneName, parentZoneName);

  Zone zone(zoneName);
  Zone parentZone(parentZoneName);

  Certificate dkey(findDkeyFromDb(zone.getName()));
  std::string output = TEST_CERTDIR.string() + "/ss.cert";
  ndn::io::save(dkey, output);

  BOOST_CHECK_NO_THROW(m_tool.addRrsetFromFile(parentZoneName, output));
  // Check if child zone's d-key could be inserted correctly
  BOOST_CHECK_NO_THROW(findRrSet(parentZone, getLabel(parentZone, dkey.getName()), label::CERT_RR_TYPE));
}

BOOST_AUTO_TEST_CASE(AddRrSetDskCertUserProvidedCert)
{
  //check using user provided certificate
  Name parentZoneName("/ndns-test");
  Name parentZoneIdentityName = Name(parentZoneName).append(label::NDNS_ITERATIVE_QUERY);
  Name zoneName("/ndns-test/child-zone");
  Name zoneIdentityName = Name(zoneName).append(label::NDNS_ITERATIVE_QUERY);

  // Name dskName = m_keyChain.generateRsaKeyPair(parentZoneName, false);
  Identity id = CertHelper::getIdentity(m_keyChain, parentZoneIdentityName);
  Key dsk = m_keyChain.createKey(id);
  Certificate dskCert = dsk.getDefaultCertificate();

  // check addRrsetFromFile1
  m_tool.createZone(parentZoneName, ROOT_ZONE, time::seconds(1), time::days(1), otherKsk, otherDsk);
  m_tool.createZone(zoneName, parentZoneName);

  Certificate dkey(findDkeyFromDb(zoneName));
  std::string output = TEST_CERTDIR.string() + "/ss.cert";
  ndn::io::save(dkey, output);

  BOOST_CHECK_NO_THROW(m_tool.addRrsetFromFile(parentZoneName, output, time::seconds(4600),
                                               dskCert.getName()));
}

BOOST_AUTO_TEST_CASE(AddRrSetDskCertInvalidOutput)
{
  //check invalid output
  Name parentZoneName("/ndns-test");
  Name zoneName = Name(parentZoneName).append("child-zone");
  m_tool.createZone(zoneName, parentZoneName);

  Name content = "invalid data packet";
  std::string output = TEST_CERTDIR.string() + "/ss.cert";
  ndn::io::save(content, output);

  BOOST_CHECK_THROW(m_tool.addRrsetFromFile(zoneName, output), ndns::ManagementTool::Error);
}

BOOST_AUTO_TEST_CASE(AddRrSetVersionControl)
{
  //check version control
  time::seconds ttl(4200);
  Name parentZoneName("/ndns-test");
  Name zoneName = Name(parentZoneName).append("child-zone");
  m_tool.createZone(zoneName, parentZoneName);

  Name label("/label");
  uint64_t version = 110;

  RrsetFactory rf(TEST_DATABASE, zoneName, m_keyChain, DEFAULT_CERT);
  rf.checkZoneKey();

  Rrset rrset1 = rf.generateTxtRrset(label, version, ttl, {});

  m_tool.addRrset(rrset1);
  // throw error when adding duplicated rrset with the same version
  BOOST_CHECK_THROW(m_tool.addRrset(rrset1),
                    ndns::ManagementTool::Error);
  version--;
  Rrset rrset2 = rf.generateTxtRrset(label, version, ttl, {});
  // throw error when adding duplicated rrset with older version
  BOOST_CHECK_THROW(m_tool.addRrset(rrset2),
                    ndns::ManagementTool::Error);

  version++;
  version++;
  Rrset rrset3 = rf.generateTxtRrset(label, version, ttl, {});
  BOOST_CHECK_NO_THROW(m_tool.addRrset(rrset3));

  Zone zone(zoneName);
  m_dbMgr.find(zone);
  Rrset rrset;
  rrset.setZone(&zone);
  rrset.setLabel(label);
  rrset.setType(label::TXT_RR_TYPE);
  m_dbMgr.find(rrset);

  BOOST_CHECK_EQUAL(rrset.getVersion(), name::Component::fromVersion(version));
}

BOOST_AUTO_TEST_CASE(AddRrSetDskCertFormat)
{
  //check input with different formats
  Name parentZoneName("/ndns-test");
  Name zoneName = Name(parentZoneName).append("child-zone");
  Zone parentZone(parentZoneName);

  m_tool.createZone(parentZoneName, ROOT_ZONE, time::seconds(1), time::days(1), otherKsk, otherDsk);
  m_tool.createZone(zoneName, parentZoneName);

  Certificate cert(findDkeyFromDb(zoneName));
  std::string output = TEST_CERTDIR.string() + "/a.cert";

  Name parentZoneIdentityName = Name(parentZoneName).append(label::NDNS_ITERATIVE_QUERY);

  // base64
  ndn::io::save(cert, output, ndn::io::BASE64);
  BOOST_CHECK_NO_THROW(
    m_tool.addRrsetFromFile(parentZoneName, output, DEFAULT_CACHE_TTL, DEFAULT_CERT, ndn::io::BASE64));
  m_tool.removeRrSet(parentZoneName, getLabel(parentZone, cert.getName()), label::CERT_RR_TYPE);

  // raw
  ndn::io::save(cert, output, ndn::io::NO_ENCODING);
  BOOST_CHECK_NO_THROW(
    m_tool.addRrsetFromFile(parentZoneName, output, DEFAULT_CACHE_TTL, DEFAULT_CERT, ndn::io::NO_ENCODING));
  m_tool.removeRrSet(parentZoneName, getLabel(parentZone, cert.getName()), label::CERT_RR_TYPE);

  // hex
  ndn::io::save(cert, output, ndn::io::HEX);
  BOOST_CHECK_NO_THROW(
    m_tool.addRrsetFromFile(parentZoneName, output, DEFAULT_CACHE_TTL, DEFAULT_CERT, ndn::io::HEX));
  m_tool.removeRrSet(parentZoneName, getLabel(parentZone, cert.getName()), label::CERT_RR_TYPE);

  // incorrect encoding input
  ndn::io::save(cert, output, ndn::io::HEX);
  BOOST_CHECK_THROW(
    m_tool.addRrsetFromFile(parentZoneName, output, DEFAULT_CACHE_TTL, DEFAULT_CERT,
                            static_cast<ndn::io::IoEncoding>(127)),
    ndns::ManagementTool::Error);
}

BOOST_AUTO_TEST_CASE(ListAllZones)
{
  m_tool.createZone(ROOT_ZONE, ROOT_ZONE, time::seconds(1), time::days(1), rootKsk, rootDsk, rootDkey);
  m_tool.createZone("/ndns-test", ROOT_ZONE, time::seconds(10), time::days(1), otherKsk, otherDsk);

  Name rootDskName = CertHelper::getCertificate(m_keyChain, "/NDNS/", rootDsk).getKeyName();
  Name otherDskName = CertHelper::getCertificate(m_keyChain, "/ndns-test/NDNS/", otherDsk).getKeyName();

  std::string expectedValue =
  "/           ; default-ttl=1 default-key=" + rootDskName.toUri() +  " "
  "default-certificate=" + rootDsk.toUri() + "\n"
  "/ndns-test  ; default-ttl=10 default-key=" + otherDskName.toUri() +  " "
  "default-certificate=" + otherDsk.toUri() + "\n";

  output_test_stream testOutput;
  m_tool.listAllZones(testOutput);
  BOOST_CHECK(testOutput.is_equal(expectedValue));
}

// Test need to fix values of keys, otherwise it produces different values every time

// BOOST_AUTO_TEST_CASE(ListZone)
// {
//   m_tool.createZone("/ndns-test", ROOT_ZONE, time::seconds(10), time::days(1), otherKsk, otherDsk);

//   RrsetFactory rf(TEST_DATABASE, "/ndns-test", m_keyChain, DEFAULT_CERT);
//   rf.checkZoneKey();

//   // Add NS with NDNS_RESP
//   Delegation del;
//   del.preference = 10;
//   del.name = Name("/get/link");
//   DelegationList ds = {del};
//   Rrset rrset1 = rf.generateNsRrset("/label1", 100, DEFAULT_RR_TTL, ds);
//   m_tool.addRrset(rrset1);

//   // Add NS with NDNS_AUTH
//   Rrset rrset2 = rf.generateAuthRrset("/label2", 100000, DEFAULT_RR_TTL);
//   m_tool.addRrset(rrset2);

//   // Add TXT from file
//   std::string output = TEST_CERTDIR.string() + "/a.rrset";
//   Response re1;
//   re1.setZone("/ndns-test");
//   re1.setQueryType(label::NDNS_ITERATIVE_QUERY);
//   re1.setRrLabel("/label2");
//   re1.setRrType(label::TXT_RR_TYPE);
//   re1.setContentType(NDNS_RESP);
//   re1.setVersion(name::Component::fromVersion(654321));
//   re1.addRr("First RR");
//   re1.addRr("Second RR");
//   re1.addRr("Last RR");
//   shared_ptr<Data> data1 = re1.toData();
//   m_keyChain.sign(*data1, security::signingByCertificate(otherDsk));
//   ndn::io::save(*data1, output);
//   m_tool.addRrsetFromFile("/ndns-test", output);

//   // Add TXT in normal way
//   Rrset rrset3 = rf.generateTxtRrset("/label3", 3333, DEFAULT_RR_TTL, {"Hello", "World"});
//   m_tool.addRrset(rrset3);

//   m_tool.listZone("/ndns-test", std::cout, true);

//   output_test_stream testOutput;
//   m_tool.listZone("/ndns-test", testOutput, true);

//   std::string expectedValue =
//     R"VALUE(; Zone /ndns-test

// ; rrset=/ type=DOE version=%FD%00%00%01b%26e%AE%99 signed-by=/ndns-test/NDNS/KEY/%12%05t%90%3AjvA
// /                                 3600  DOE   Bw0IBmxhYmVsMwgDVFhU
// /                                 3600  DOE   BxUIA0tFWQgIEgV0kDpqdkEIBENFUlQ=

// /KEY/%12%05t%90%3AjvA             10    CERT  ; content-type=KEY version=%FD%00%00%01b%26e%AEY signed-by=/ndns-test/NDNS/KEY/%8D%1Dj%1E%BE%B0%2A%E4
// Certificate name:
//   /ndns-test/NDNS/KEY/%12%05t%90%3AjvA/CERT/%FD%00%00%01b%26e%AEY
// Validity:
//   NotBefore: 20180314T212340
//   NotAfter: 20180324T212340
// Public key bits:
//   MIIBSzCCAQMGByqGSM49AgEwgfcCAQEwLAYHKoZIzj0BAQIhAP////8AAAABAAAA
//   AAAAAAAAAAAA////////////////MFsEIP////8AAAABAAAAAAAAAAAAAAAA////
//   ///////////8BCBaxjXYqjqT57PrvVV2mIa8ZR0GsMxTsPY7zjw+J9JgSwMVAMSd
//   NgiG5wSTamZ44ROdJreBn36QBEEEaxfR8uEsQkf4vOblY6RA8ncDfYEt6zOg9KE5
//   RdiYwpZP40Li/hp/m47n60p8D54WK84zV2sxXs7LtkBoN79R9QIhAP////8AAAAA
//   //////////+85vqtpxeehPO5ysL8YyVRAgEBA0IABHU62fbCa6KR7G1iyMr6/NtF
//   5oHrAdzttIgh5pk1VS1YcFO1zhpUnpJS43FlduYHVBLrXwYS6tZ15Ge/D3uy1f4=
// Signature Information:
//   Signature Type: SignatureSha256WithEcdsa
//   Key Locator: Name=/ndns-test/NDNS/KEY/%8D%1Dj%1E%BE%B0%2A%E4

// ; rrset=/KEY/%12%05t%90%3AjvA/CERT type=DOE version=%FD%00%00%01b%26e%AE%91 signed-by=/ndns-test/NDNS/KEY/%12%05t%90%3AjvA
// /KEY/%12%05t%90%3AjvA/CERT        3600  DOE   BxUIA0tFWQgIEgV0kDpqdkEIBENFUlQ=
// /KEY/%12%05t%90%3AjvA/CERT        3600  DOE   BxUIA0tFWQgIjR1qHr6wKuQIBENFUlQ=

// /KEY/%8D%1Dj%1E%BE%B0%2A%E4       10    CERT  ; content-type=KEY version=%FD%00%00%01b%26e%AEX signed-by=/ndns-test/NDNS/KEY/%8D%1Dj%1E%BE%B0%2A%E4
// Certificate name:
//   /ndns-test/NDNS/KEY/%8D%1Dj%1E%BE%B0%2A%E4/CERT/%FD%00%00%01b%26e%AEX
// Validity:
//   NotBefore: 20180314T212340
//   NotAfter: 20180324T212340
// Public key bits:
//   MIIBSzCCAQMGByqGSM49AgEwgfcCAQEwLAYHKoZIzj0BAQIhAP////8AAAABAAAA
//   AAAAAAAAAAAA////////////////MFsEIP////8AAAABAAAAAAAAAAAAAAAA////
//   ///////////8BCBaxjXYqjqT57PrvVV2mIa8ZR0GsMxTsPY7zjw+J9JgSwMVAMSd
//   NgiG5wSTamZ44ROdJreBn36QBEEEaxfR8uEsQkf4vOblY6RA8ncDfYEt6zOg9KE5
//   RdiYwpZP40Li/hp/m47n60p8D54WK84zV2sxXs7LtkBoN79R9QIhAP////8AAAAA
//   //////////+85vqtpxeehPO5ysL8YyVRAgEBA0IABMRVD/FUfCQVvjcwQLe9k1aS
//   5pZ/xmFndOHn1+a0OYVzxCV1JcxL1eojcij42tCP5mtocrj9DjYyFBv4Atg1RZE=
// Signature Information:
//   Signature Type: SignatureSha256WithEcdsa
//   Key Locator: Self-Signed Name=/ndns-test/NDNS/KEY/%8D%1Dj%1E%BE%B0%2A%E4

// ; rrset=/KEY/%8D%1Dj%1E%BE%B0%2A%E4/CERT type=DOE version=%FD%00%00%01b%26e%AE%93 signed-by=/ndns-test/NDNS/KEY/%12%05t%90%3AjvA
// /KEY/%8D%1Dj%1E%BE%B0%2A%E4/CERT  3600  DOE   BxUIA0tFWQgIjR1qHr6wKuQIBENFUlQ=
// /KEY/%8D%1Dj%1E%BE%B0%2A%E4/CERT  3600  DOE   BwwIBmxhYmVsMQgCTlM=

// ; rrset=/label1 type=NS version=%FDd signed-by=/ndns-test/NDNS/KEY/%12%05t%90%3AjvA
// /label1                           10    NS    10

// ; rrset=/label1/NS type=DOE version=%FD%00%00%01b%26e%AE%94 signed-by=/ndns-test/NDNS/KEY/%12%05t%90%3AjvA
// /label1/NS                        3600  DOE   BwwIBmxhYmVsMQgCTlM=
// /label1/NS                        3600  DOE   BwwIBmxhYmVsMggCTlM=

// ; rrset=/label2 type=NS version=%FD%00%01%86%A0 signed-by=/ndns-test/NDNS/KEY/%12%05t%90%3AjvA
// /label2                           10    NS    NDNS-Auth

// ; rrset=/label2 type=TXT version=%FD%00%09%FB%F1 signed-by=/ndns-test/NDNS/KEY/%12%05t%90%3AjvA
// /label2                           10    TXT   First RR
// /label2                           10    TXT   Second RR
// /label2                           10    TXT   Last RR

// ; rrset=/label2/NS type=DOE version=%FD%00%00%01b%26e%AE%96 signed-by=/ndns-test/NDNS/KEY/%12%05t%90%3AjvA
// /label2/NS                        3600  DOE   BwwIBmxhYmVsMggCTlM=
// /label2/NS                        3600  DOE   Bw0IBmxhYmVsMggDVFhU

// ; rrset=/label2/TXT type=DOE version=%FD%00%00%01b%26e%AE%97 signed-by=/ndns-test/NDNS/KEY/%12%05t%90%3AjvA
// /label2/TXT                       3600  DOE   Bw0IBmxhYmVsMggDVFhU
// /label2/TXT                       3600  DOE   Bw0IBmxhYmVsMwgDVFhU

// ; rrset=/label3 type=TXT version=%FD%0D%05 signed-by=/ndns-test/NDNS/KEY/%12%05t%90%3AjvA
// /label3                           10    TXT   Hello
// /label3                           10    TXT   World

// ; rrset=/label3/TXT type=DOE version=%FD%00%00%01b%26e%AE%98 signed-by=/ndns-test/NDNS/KEY/%12%05t%90%3AjvA
// /label3/TXT                       3600  DOE   Bw0IBmxhYmVsMwgDVFhU
// /label3/TXT                       3600  DOE   BxUIA0tFWQgIEgV0kDpqdkEIBENFUlQ=

// )VALUE";

//   BOOST_CHECK(testOutput.is_equal(expectedValue));
// }

BOOST_FIXTURE_TEST_CASE(GetRrSet, ManagementToolFixture)
{
  Name zoneName("/ndns-test");
  m_tool.createZone(zoneName, ROOT_ZONE, time::seconds(1), time::days(1), otherKsk, otherDsk);
  RrsetFactory rf(TEST_DATABASE, zoneName, m_keyChain, DEFAULT_CERT);
  rf.checkZoneKey();
  Rrset rrset1 = rf.generateTxtRrset("/label", 100, DEFAULT_RR_TTL, {"Value1", "Value2"});

  m_tool.addRrset(rrset1);

  std::stringstream os;

  using security::transform::base64Encode;
  using security::transform::streamSink;
  using security::transform::bufferSource;

  bufferSource(rrset1.getData().wire(), rrset1.getData().size()) >> base64Encode() >> streamSink(os);

  std::string expectedValue = os.str();

  output_test_stream testOutput;
  m_tool.getRrSet(zoneName, "/label",label::TXT_RR_TYPE, testOutput);
  BOOST_CHECK(testOutput.is_equal(expectedValue));
}

BOOST_FIXTURE_TEST_CASE(RemoveRrSet, ManagementToolFixture)
{
  Name zoneName("/ndns-test");

  m_tool.createZone(zoneName, ROOT_ZONE);
  RrsetFactory rf(TEST_DATABASE, zoneName, m_keyChain, DEFAULT_CERT);
  rf.checkZoneKey();

  Rrset rrset1 = rf.generateTxtRrset("/label", 100, DEFAULT_RR_TTL, {});

  BOOST_CHECK_NO_THROW(m_tool.addRrset(rrset1));

  Zone zone(zoneName);
  BOOST_CHECK_NO_THROW(findRrSet(zone, "/label", label::TXT_RR_TYPE));

  BOOST_CHECK_NO_THROW(m_tool.removeRrSet(zoneName, "/label", label::NS_RR_TYPE));

  BOOST_CHECK_THROW(findRrSet(zone, "/label", label::NS_RR_TYPE), Error);
}

BOOST_AUTO_TEST_SUITE_END()

} // namespace tests
} // namespace ndns
} // namespace ndn
