test: change namespace to chronochat
Change-Id: I7a8a43cb37b6b2002111264a797992f12269105e
Refs: #2591
diff --git a/test/test-chatroom-info.cpp b/test/chatroom-info.t.cpp
similarity index 98%
rename from test/test-chatroom-info.cpp
rename to test/chatroom-info.t.cpp
index 39a5006..f138172 100644
--- a/test/test-chatroom-info.cpp
+++ b/test/chatroom-info.t.cpp
@@ -2,9 +2,9 @@
#include <boost/test/unit_test.hpp>
#include <ndn-cxx/encoding/block.hpp>
-namespace chronos {
+namespace chronochat {
-namespace test {
+namespace tests {
using std::string;
@@ -353,6 +353,6 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace test
+} // namespace tests
-} // namespace chronos
+} // namespace chronochat
diff --git a/test/test-contact-storage.cpp b/test/contact-storage.t.cpp
similarity index 90%
rename from test/test-contact-storage.cpp
rename to test/contact-storage.t.cpp
index cc97e08..07be3e7 100644
--- a/test/test-contact-storage.cpp
+++ b/test/contact-storage.t.cpp
@@ -11,7 +11,8 @@
#include "cryptopp.hpp"
#include <boost/filesystem.hpp>
-namespace chronos {
+namespace chronochat {
+namespace tests {
using std::string;
namespace fs = boost::filesystem;
@@ -32,4 +33,5 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace chronos
+} // namespace tests
+} // namespace chronochat
diff --git a/test/dummy-client-face.hpp b/test/dummy-client-face.hpp
deleted file mode 100644
index 52e871e..0000000
--- a/test/dummy-client-face.hpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2014 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library 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 Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#ifndef NDN_TESTS_UNIT_TESTS_DUMMY_CLIENT_FACE_HPP
-#define NDN_TESTS_UNIT_TESTS_DUMMY_CLIENT_FACE_HPP
-
-#include <ndn-cxx/face.hpp>
-#include <ndn-cxx/transport/transport.hpp>
-
-namespace chronos {
-namespace test {
-
-class DummyClientTransport : public ndn::Transport
-{
-public:
- void
- receive(const Block& block)
- {
- if (static_cast<bool>(m_receiveCallback))
- m_receiveCallback(block);
- }
-
- virtual void
- close()
- {
- }
-
- virtual void
- pause()
- {
- }
-
- virtual void
- resume()
- {
- }
-
- virtual void
- send(const Block& wire)
- {
- if (wire.type() == tlv::Interest) {
- m_sentInterests->push_back(Interest(wire));
- }
- else if (wire.type() == tlv::Data) {
- m_sentDatas->push_back(Data(wire));
- }
- }
-
- virtual void
- send(const Block& header, const Block& payload)
- {
- this->send(payload);
- }
-
-public:
- std::vector<Interest>* m_sentInterests;
- std::vector<Data>* m_sentDatas;
-};
-
-
-/** \brief a client-side face for unit testing
- */
-class DummyClientFace : public ndn::Face
-{
-public:
- explicit
- DummyClientFace(shared_ptr<DummyClientTransport> transport)
- : Face(transport)
- , m_transport(transport)
- {
- m_transport->m_sentInterests = &m_sentInterests;
- m_transport->m_sentDatas = &m_sentDatas;
- }
-
- DummyClientFace(shared_ptr<DummyClientTransport> transport, boost::asio::io_service& ioService)
- : Face(transport, ioService)
- , m_transport(transport)
- {
- m_transport->m_sentInterests = &m_sentInterests;
- m_transport->m_sentDatas = &m_sentDatas;
- }
-
- /** \brief cause the Face to receive a packet
- */
- template<typename Packet>
- void
- receive(const Packet& packet)
- {
- m_transport->receive(packet.wireEncode());
- }
-
-public:
- /** \brief sent Interests
- * \note After .expressInterest, .processEvents must be called before
- * the Interest would show up here.
- */
- std::vector<Interest> m_sentInterests;
- /** \brief sent Datas
- * \note After .put, .processEvents must be called before
- * the Interest would show up here.
- */
- std::vector<Data> m_sentDatas;
-
-private:
- shared_ptr<DummyClientTransport> m_transport;
-};
-
-inline shared_ptr<DummyClientFace>
-makeDummyClientFace()
-{
- return make_shared<DummyClientFace>(make_shared<DummyClientTransport>());
-}
-
-inline shared_ptr<DummyClientFace>
-makeDummyClientFace(boost::asio::io_service& ioService)
-{
- return make_shared<DummyClientFace>(make_shared<DummyClientTransport>(), ref(ioService));
-}
-
-} // namespace tests
-} // namespace ndn
-
-#endif // NDN_TESTS_UNIT_TESTS_DUMMY_CLIENT_FACE_HPP
diff --git a/test/test-endorse-certificate.cpp b/test/endorse-certificate.t.cpp
similarity index 92%
rename from test/test-endorse-certificate.cpp
rename to test/endorse-certificate.t.cpp
index 09eb935..8d97173 100644
--- a/test/test-endorse-certificate.cpp
+++ b/test/endorse-certificate.t.cpp
@@ -14,6 +14,7 @@
#endif
#include <boost/test/unit_test.hpp>
+#include <boost/filesystem.hpp>
#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/encoding/buffer-stream.hpp>
@@ -22,7 +23,8 @@
#include "cryptopp.hpp"
#include "endorse-certificate.hpp"
-namespace chronos {
+namespace chronochat {
+namespace tests {
using std::vector;
using std::string;
@@ -156,7 +158,11 @@
endorseList.push_back("homepage");
EndorseCertificate endorseCertificate(*idCert, profile, endorseList);
- KeyChain keyChain("sqlite3", "file");
+ boost::filesystem::path keyChainTmpPath =
+ boost::filesystem::path(TEST_CERT_PATH) / "TestEndorseCertificate";
+ KeyChain keyChain(std::string("sqlite3:").append(keyChainTmpPath.string()),
+ std::string("tpm-file:").append(keyChainTmpPath.string()));
+
keyChain.signWithSha256(endorseCertificate);
const Block& endorseDataBlock = endorseCertificate.wireEncode();
@@ -190,7 +196,11 @@
Name signer("/EndorseCertificateTests/Singer/ksk-1234567890");
EndorseCertificate endorseCertificate(rawEndorse, signer, endorseList);
- KeyChain keyChain("sqlite3", "file");
+ boost::filesystem::path keyChainTmpPath =
+ boost::filesystem::path(TEST_CERT_PATH) / "TestEndorseCertificate";
+ KeyChain keyChain(std::string("sqlite3:").append(keyChainTmpPath.string()),
+ std::string("tpm-file:").append(keyChainTmpPath.string()));
+
keyChain.signWithSha256(endorseCertificate);
const Block& endorseDataBlock = endorseCertificate.wireEncode();
@@ -214,4 +224,5 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace chronos
+} // namespace tests
+} // namespace chronochat
diff --git a/test/test-profile.cpp b/test/profile.t.cpp
similarity index 92%
rename from test/test-profile.cpp
rename to test/profile.t.cpp
index 9848685..c003c70 100644
--- a/test/test-profile.cpp
+++ b/test/profile.t.cpp
@@ -10,7 +10,8 @@
#include "profile.hpp"
#include <ndn-cxx/encoding/buffer-stream.hpp>
-namespace chronos {
+namespace chronochat {
+namespace tests {
using std::string;
@@ -42,4 +43,5 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace chronos
+} // namespace tests
+} // namespace chronochat
diff --git a/wscript b/wscript
index e1d56e6..d0337ba 100644
--- a/wscript
+++ b/wscript
@@ -77,6 +77,7 @@
use = 'BOOST ChronoChat',
includes = "src .",
install_path = None,
+ defines = 'TEST_CERT_PATH=\"%s/cert-test\"' %(bld.bldnode),
)
# Debug tools