encoding: remove duplicate buf() and get() methods from Buffer class
Change-Id: If885d4199d6c9df9b9b46664c3641c9a14a77eab
diff --git a/tests/unit-tests/security/pib/detail/identity-impl.t.cpp b/tests/unit-tests/security/pib/detail/identity-impl.t.cpp
index 2f35d2f..0eaabdb 100644
--- a/tests/unit-tests/security/pib/detail/identity-impl.t.cpp
+++ b/tests/unit-tests/security/pib/detail/identity-impl.t.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
@@ -22,9 +22,9 @@
#include "security/pib/detail/identity-impl.hpp"
#include "security/pib/pib.hpp"
#include "security/pib/pib-memory.hpp"
-#include "../pib-data-fixture.hpp"
#include "boost-test.hpp"
+#include "../pib-data-fixture.hpp"
namespace ndn {
namespace security {
@@ -64,7 +64,7 @@
BOOST_REQUIRE_THROW(identity1.setDefaultKey(id1Key1Name), Pib::Error);
// add key
- identity1.addKey(id1Key1.buf(), id1Key1.size(), id1Key1Name);
+ identity1.addKey(id1Key1.data(), id1Key1.size(), id1Key1Name);
BOOST_CHECK_NO_THROW(identity1.getKey(id1Key1Name));
// new key becomes default key when there is no default key
@@ -79,7 +79,7 @@
BOOST_CHECK_THROW(identity1.getDefaultKey(), Pib::Error);
// set default key directly
- BOOST_REQUIRE_NO_THROW(identity1.setDefaultKey(id1Key1.buf(), id1Key1.size(), id1Key1Name));
+ BOOST_REQUIRE_NO_THROW(identity1.setDefaultKey(id1Key1.data(), id1Key1.size(), id1Key1Name));
BOOST_REQUIRE_NO_THROW(identity1.getDefaultKey());
BOOST_CHECK_NO_THROW(identity1.getKey(id1Key1Name));
@@ -89,7 +89,7 @@
BOOST_CHECK(defaultKey1.getPublicKey() == id1Key1);
// add another key
- identity1.addKey(id1Key2.buf(), id1Key2.size(), id1Key2Name);
+ identity1.addKey(id1Key2.data(), id1Key2.size(), id1Key2Name);
BOOST_CHECK_EQUAL(identity1.getKeys().size(), 2);
// set default key through name
@@ -105,7 +105,7 @@
BOOST_CHECK_EQUAL(identity1.getKeys().size(), 1);
// set default key directly again, change the default setting
- BOOST_REQUIRE_NO_THROW(identity1.setDefaultKey(id1Key1.buf(), id1Key1.size(), id1Key1Name));
+ BOOST_REQUIRE_NO_THROW(identity1.setDefaultKey(id1Key1.data(), id1Key1.size(), id1Key1Name));
const Key& defaultKey3 = identity1.getDefaultKey();
BOOST_CHECK_EQUAL(defaultKey3.getName(), id1Key1Name);
BOOST_CHECK(defaultKey3.getPublicKey() == id1Key1);
@@ -126,10 +126,10 @@
auto pibImpl = make_shared<pib::PibMemory>();
IdentityImpl identity1(id1, pibImpl, true);
- identity1.addKey(id1Key1.buf(), id1Key1.size(), id1Key1Name);
+ identity1.addKey(id1Key1.data(), id1Key1.size(), id1Key1Name);
BOOST_CHECK(identity1.getKey(id1Key1Name).getPublicKey() == id1Key1);
- identity1.addKey(id1Key2.buf(), id1Key2.size(), id1Key1Name); // overwriting key should work
+ identity1.addKey(id1Key2.data(), id1Key2.size(), id1Key1Name); // overwriting key should work
BOOST_CHECK(identity1.getKey(id1Key1Name).getPublicKey() == id1Key2);
}
@@ -140,11 +140,11 @@
BOOST_CHECK_THROW(IdentityImpl(id1, pibImpl, false), Pib::Error);
IdentityImpl identity1(id1, pibImpl, true);
- identity1.addKey(id1Key1.buf(), id1Key1.size(), id1Key1Name);
- BOOST_CHECK_THROW(identity1.addKey(id2Key1.buf(), id2Key1.size(), id2Key1Name), std::invalid_argument);
+ identity1.addKey(id1Key1.data(), id1Key1.size(), id1Key1Name);
+ BOOST_CHECK_THROW(identity1.addKey(id2Key1.data(), id2Key1.size(), id2Key1Name), std::invalid_argument);
BOOST_CHECK_THROW(identity1.removeKey(id2Key1Name), std::invalid_argument);
BOOST_CHECK_THROW(identity1.getKey(id2Key1Name), std::invalid_argument);
- BOOST_CHECK_THROW(identity1.setDefaultKey(id2Key1.buf(), id2Key1.size(), id2Key1Name), std::invalid_argument);
+ BOOST_CHECK_THROW(identity1.setDefaultKey(id2Key1.data(), id2Key1.size(), id2Key1Name), std::invalid_argument);
BOOST_CHECK_THROW(identity1.setDefaultKey(id2Key1Name), std::invalid_argument);
}
diff --git a/tests/unit-tests/security/pib/detail/key-impl.t.cpp b/tests/unit-tests/security/pib/detail/key-impl.t.cpp
index 5257113..ec51751 100644
--- a/tests/unit-tests/security/pib/detail/key-impl.t.cpp
+++ b/tests/unit-tests/security/pib/detail/key-impl.t.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
@@ -36,14 +36,14 @@
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Pib)
BOOST_AUTO_TEST_SUITE(Detail)
-BOOST_FIXTURE_TEST_SUITE(TestKeyImpl, ndn::security::tests::PibDataFixture)
+BOOST_FIXTURE_TEST_SUITE(TestKeyImpl, security::tests::PibDataFixture)
using security::Pib;
BOOST_AUTO_TEST_CASE(Basic)
{
auto pibImpl = make_shared<pib::PibMemory>();
- KeyImpl key11(id1Key1Name, id1Key1.buf(), id1Key1.size(), pibImpl);
+ KeyImpl key11(id1Key1Name, id1Key1.data(), id1Key1.size(), pibImpl);
BOOST_CHECK_EQUAL(key11.getName(), id1Key1Name);
BOOST_CHECK_EQUAL(key11.getIdentity(), id1);
@@ -60,7 +60,7 @@
BOOST_AUTO_TEST_CASE(CertificateOperation)
{
auto pibImpl = make_shared<pib::PibMemory>();
- KeyImpl key11(id1Key1Name, id1Key1.buf(), id1Key1.size(), pibImpl);
+ KeyImpl key11(id1Key1Name, id1Key1.data(), id1Key1.size(), pibImpl);
BOOST_CHECK_NO_THROW(KeyImpl(id1Key1Name, pibImpl));
// key does not have any certificate
@@ -141,10 +141,10 @@
auto pibImpl = make_shared<pib::PibMemory>();
BOOST_CHECK_THROW(KeyImpl(id1Key1Name, pibImpl), Pib::Error);
- KeyImpl(id1Key1Name, id1Key1.buf(), id1Key1.size(), pibImpl);
+ KeyImpl(id1Key1Name, id1Key1.data(), id1Key1.size(), pibImpl);
KeyImpl key1(id1Key1Name, pibImpl);
- KeyImpl(id1Key1Name, id1Key2.buf(), id1Key2.size(), pibImpl); // overwriting of the key should work
+ KeyImpl(id1Key1Name, id1Key2.data(), id1Key2.size(), pibImpl); // overwriting of the key should work
KeyImpl key2(id1Key1Name, pibImpl);
BOOST_CHECK(key1.getPublicKey() != key2.getPublicKey()); // key1 cached the original public key
@@ -173,12 +173,12 @@
auto pibImpl = make_shared<pib::PibMemory>();
BOOST_CHECK_THROW(KeyImpl(id1Key1Name, pibImpl), Pib::Error);
- KeyImpl key11(id1Key1Name, id1Key1.buf(), id1Key1.size(), pibImpl);
+ KeyImpl key11(id1Key1Name, id1Key1.data(), id1Key1.size(), pibImpl);
BOOST_CHECK_THROW(KeyImpl(Name("/wrong"), pibImpl), std::invalid_argument);
- BOOST_CHECK_THROW(KeyImpl(Name("/wrong"), id1Key1.buf(), id1Key1.size(), pibImpl), std::invalid_argument);
+ BOOST_CHECK_THROW(KeyImpl(Name("/wrong"), id1Key1.data(), id1Key1.size(), pibImpl), std::invalid_argument);
Buffer wrongKey;
- BOOST_CHECK_THROW(KeyImpl(id1Key2Name, wrongKey.buf(), wrongKey.size(), pibImpl), std::invalid_argument);
+ BOOST_CHECK_THROW(KeyImpl(id1Key2Name, wrongKey.data(), wrongKey.size(), pibImpl), std::invalid_argument);
key11.addCertificate(id1Key1Cert1);
BOOST_CHECK_THROW(key11.addCertificate(id1Key2Cert1), std::invalid_argument);