ims: move InMemoryStorage from util/
refs #3940
Change-Id: I4468fe9b65ef6263a62800701eb6b03df28fa274
diff --git a/src/util/in-memory-storage-entry.cpp b/src/ims/in-memory-storage-entry.cpp
similarity index 87%
rename from src/util/in-memory-storage-entry.cpp
rename to src/ims/in-memory-storage-entry.cpp
index c0f5e59..daf12c5 100644
--- a/src/util/in-memory-storage-entry.cpp
+++ b/src/ims/in-memory-storage-entry.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * 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,7 +22,6 @@
#include "in-memory-storage-entry.hpp"
namespace ndn {
-namespace util {
InMemoryStorageEntry::InMemoryStorageEntry()
: m_isFresh(true)
@@ -44,7 +43,7 @@
}
void
-InMemoryStorageEntry::setMarkStaleEventId(unique_ptr<scheduler::ScopedEventId>&& markStaleEventId)
+InMemoryStorageEntry::setMarkStaleEventId(unique_ptr<util::scheduler::ScopedEventId> markStaleEventId)
{
m_markStaleEventId = std::move(markStaleEventId);
}
@@ -55,5 +54,4 @@
m_isFresh = false;
}
-} // namespace util
} // namespace ndn
diff --git a/src/util/in-memory-storage-entry.hpp b/src/ims/in-memory-storage-entry.hpp
similarity index 82%
rename from src/util/in-memory-storage-entry.hpp
rename to src/ims/in-memory-storage-entry.hpp
index 6e77b3d..721a90d 100644
--- a/src/util/in-memory-storage-entry.hpp
+++ b/src/ims/in-memory-storage-entry.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,23 +19,20 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_UTIL_IN_MEMORY_STORAGE_ENTRY_HPP
-#define NDN_UTIL_IN_MEMORY_STORAGE_ENTRY_HPP
+#ifndef NDN_IMS_IN_MEMORY_STORAGE_ENTRY_HPP
+#define NDN_IMS_IN_MEMORY_STORAGE_ENTRY_HPP
-#include "../common.hpp"
-#include "../interest.hpp"
#include "../data.hpp"
-#include "scheduler-scoped-event-id.hpp"
+#include "../interest.hpp"
+#include "../util/scheduler-scoped-event-id.hpp"
namespace ndn {
-namespace util {
- /** @brief Represents an in-memory storage entry
+/** @brief Represents an in-memory storage entry
*/
class InMemoryStorageEntry : noncopyable
{
public:
-
/** @brief Create an entry
*/
InMemoryStorageEntry();
@@ -62,7 +59,6 @@
return m_dataPacket->getFullName();
}
-
/** @brief Returns the Data packet stored in the in-memory storage entry
*/
const Data&
@@ -71,7 +67,6 @@
return *m_dataPacket;
}
-
/** @brief Changes the content of in-memory storage entry
*
* This method also allows data to satisfy Interest with MustBeFresh
@@ -82,7 +77,7 @@
/** @brief Set eventId for the markStale event.
*/
void
- setMarkStaleEventId(unique_ptr<scheduler::ScopedEventId>&& eventId);
+ setMarkStaleEventId(unique_ptr<util::scheduler::ScopedEventId> eventId);
/** @brief Disable the data from satisfying interest with MustBeFresh
*/
@@ -101,10 +96,9 @@
shared_ptr<const Data> m_dataPacket;
bool m_isFresh;
- unique_ptr<scheduler::ScopedEventId> m_markStaleEventId;
+ unique_ptr<util::scheduler::ScopedEventId> m_markStaleEventId;
};
-} // namespace util
} // namespace ndn
-#endif // NDN_UTIL_IN_MEMORY_STORAGE_ENTRY_HPP
+#endif // NDN_IMS_IN_MEMORY_STORAGE_ENTRY_HPP
diff --git a/src/util/in-memory-storage-fifo.cpp b/src/ims/in-memory-storage-fifo.cpp
similarity index 94%
rename from src/util/in-memory-storage-fifo.cpp
rename to src/ims/in-memory-storage-fifo.cpp
index 0899024..df6e173 100644
--- a/src/util/in-memory-storage-fifo.cpp
+++ b/src/ims/in-memory-storage-fifo.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * 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,7 +22,6 @@
#include "in-memory-storage-fifo.hpp"
namespace ndn {
-namespace util {
InMemoryStorageFifo::InMemoryStorageFifo(size_t limit)
: InMemoryStorage(limit)
@@ -62,5 +61,4 @@
m_cleanupIndex.get<byEntity>().erase(it);
}
-} // namespace util
} // namespace ndn
diff --git a/src/util/in-memory-storage-fifo.hpp b/src/ims/in-memory-storage-fifo.hpp
similarity index 86%
rename from src/util/in-memory-storage-fifo.hpp
rename to src/ims/in-memory-storage-fifo.hpp
index 2bc1880..6991451 100644
--- a/src/util/in-memory-storage-fifo.hpp
+++ b/src/ims/in-memory-storage-fifo.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,20 +19,18 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_UTIL_IN_MEMORY_STORAGE_FIFO_HPP
-#define NDN_UTIL_IN_MEMORY_STORAGE_FIFO_HPP
+#ifndef NDN_IMS_IN_MEMORY_STORAGE_FIFO_HPP
+#define NDN_IMS_IN_MEMORY_STORAGE_FIFO_HPP
#include "in-memory-storage.hpp"
#include <boost/multi_index_container.hpp>
-#include <boost/multi_index/sequenced_index.hpp>
#include <boost/multi_index/hashed_index.hpp>
+#include <boost/multi_index/sequenced_index.hpp>
namespace ndn {
-namespace util {
-/** @brief Provides in-memory storage employing FIFO replacement policy, which is first in first
- * out.
+/** @brief Provides in-memory storage employing First-In-First-Out (FIFO) replacement policy.
*/
class InMemoryStorageFifo : public InMemoryStorage
{
@@ -62,7 +60,7 @@
beforeErase(InMemoryStorageEntry* entry) override;
private:
- //multi_index_container to implement FIFO
+ // multi_index_container to implement FIFO
class byArrival;
class byEntity;
@@ -87,7 +85,6 @@
CleanupIndex m_cleanupIndex;
};
-} // namespace util
} // namespace ndn
-#endif // NDN_UTIL_IN_MEMORY_STORAGE_FIFO_HPP
+#endif // NDN_IMS_IN_MEMORY_STORAGE_FIFO_HPP
diff --git a/src/util/in-memory-storage-lfu.cpp b/src/ims/in-memory-storage-lfu.cpp
similarity index 95%
rename from src/util/in-memory-storage-lfu.cpp
rename to src/ims/in-memory-storage-lfu.cpp
index 0c08f1c..a155f60 100644
--- a/src/util/in-memory-storage-lfu.cpp
+++ b/src/ims/in-memory-storage-lfu.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * 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,7 +22,6 @@
#include "in-memory-storage-lfu.hpp"
namespace ndn {
-namespace util {
InMemoryStorageLfu::InMemoryStorageLfu(size_t limit)
: InMemoryStorage(limit)
@@ -72,5 +71,4 @@
m_cleanupIndex.get<byEntity>().modify(it, &incrementFrequency);
}
-} // namespace util
} // namespace ndn
diff --git a/src/util/in-memory-storage-lfu.hpp b/src/ims/in-memory-storage-lfu.hpp
similarity index 92%
rename from src/util/in-memory-storage-lfu.hpp
rename to src/ims/in-memory-storage-lfu.hpp
index 8a21d4c..7633cfd 100644
--- a/src/util/in-memory-storage-lfu.hpp
+++ b/src/ims/in-memory-storage-lfu.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,19 +19,18 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_UTIL_IN_MEMORY_STORAGE_LFU_HPP
-#define NDN_UTIL_IN_MEMORY_STORAGE_LFU_HPP
+#ifndef NDN_IMS_IN_MEMORY_STORAGE_LFU_HPP
+#define NDN_IMS_IN_MEMORY_STORAGE_LFU_HPP
#include "in-memory-storage.hpp"
-#include <boost/multi_index/member.hpp>
#include <boost/multi_index_container.hpp>
-#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/identity.hpp>
+#include <boost/multi_index/member.hpp>
+#include <boost/multi_index/ordered_index.hpp>
namespace ndn {
-namespace util {
/** @brief Provides an in-memory storage with Least Frequently Used (LFU) replacement policy.
* @note The frequency right now is usage count.
@@ -88,7 +87,7 @@
}
private:
- //multi_index_container to implement LFU
+ // multi_index_container to implement LFU
class byFrequency;
class byEntity;
@@ -115,7 +114,6 @@
CleanupIndex m_cleanupIndex;
};
-} // namespace util
} // namespace ndn
-#endif // NDN_UTIL_IN_MEMORY_STORAGE_LFU_HPP
+#endif // NDN_IMS_IN_MEMORY_STORAGE_LFU_HPP
diff --git a/src/util/in-memory-storage-lru.cpp b/src/ims/in-memory-storage-lru.cpp
similarity index 95%
rename from src/util/in-memory-storage-lru.cpp
rename to src/ims/in-memory-storage-lru.cpp
index 01c8b12..22c463d 100644
--- a/src/util/in-memory-storage-lru.cpp
+++ b/src/ims/in-memory-storage-lru.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * 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,7 +22,6 @@
#include "in-memory-storage-lru.hpp"
namespace ndn {
-namespace util {
InMemoryStorageLru::InMemoryStorageLru(size_t limit)
: InMemoryStorage(limit)
@@ -71,5 +70,4 @@
afterInsert(entry);
}
-} // namespace util
} // namespace ndn
diff --git a/src/util/in-memory-storage-lru.hpp b/src/ims/in-memory-storage-lru.hpp
similarity index 86%
rename from src/util/in-memory-storage-lru.hpp
rename to src/ims/in-memory-storage-lru.hpp
index 48b79a8..3dd9dfe 100644
--- a/src/util/in-memory-storage-lru.hpp
+++ b/src/ims/in-memory-storage-lru.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,22 +19,20 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_UTIL_IN_MEMORY_STORAGE_LRU_HPP
-#define NDN_UTIL_IN_MEMORY_STORAGE_LRU_HPP
+#ifndef NDN_IMS_IN_MEMORY_STORAGE_LRU_HPP
+#define NDN_IMS_IN_MEMORY_STORAGE_LRU_HPP
#include "in-memory-storage.hpp"
-#include <boost/multi_index/member.hpp>
#include <boost/multi_index_container.hpp>
-#include <boost/multi_index/sequenced_index.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/identity.hpp>
+#include <boost/multi_index/member.hpp>
+#include <boost/multi_index/sequenced_index.hpp>
namespace ndn {
-namespace util {
-/** @brief Provides in-memory storage employing LRU replacement policy, of which the least
- * recently used entry will be evict first.
+/** @brief Provides in-memory storage employing Least Recently Used (LRU) replacement policy.
*/
class InMemoryStorageLru : public InMemoryStorage
{
@@ -70,7 +68,7 @@
beforeErase(InMemoryStorageEntry* entry) override;
private:
- //multi_index_container to implement LRU
+ // multi_index_container to implement LRU
class byUsedTime;
class byEntity;
@@ -95,7 +93,6 @@
CleanupIndex m_cleanupIndex;
};
-} // namespace util
} // namespace ndn
-#endif // NDN_UTIL_IN_MEMORY_STORAGE_LRU_HPP
+#endif // NDN_IMS_IN_MEMORY_STORAGE_LRU_HPP
diff --git a/src/util/in-memory-storage-persistent.cpp b/src/ims/in-memory-storage-persistent.cpp
similarity index 92%
rename from src/util/in-memory-storage-persistent.cpp
rename to src/ims/in-memory-storage-persistent.cpp
index 954e9c1..ff6a3a9 100644
--- a/src/util/in-memory-storage-persistent.cpp
+++ b/src/ims/in-memory-storage-persistent.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * 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,7 +22,6 @@
#include "in-memory-storage-persistent.hpp"
namespace ndn {
-namespace util {
InMemoryStoragePersistent::InMemoryStoragePersistent()
: InMemoryStorage()
@@ -40,5 +39,4 @@
return false;
}
-} // namespace util
} // namespace ndn
diff --git a/src/util/in-memory-storage-persistent.hpp b/src/ims/in-memory-storage-persistent.hpp
similarity index 81%
rename from src/util/in-memory-storage-persistent.hpp
rename to src/ims/in-memory-storage-persistent.hpp
index 7e1a977..5920ef3 100644
--- a/src/util/in-memory-storage-persistent.hpp
+++ b/src/ims/in-memory-storage-persistent.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,16 +19,15 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_UTIL_IN_MEMORY_STORAGE_PERSISTENT_HPP
-#define NDN_UTIL_IN_MEMORY_STORAGE_PERSISTENT_HPP
+#ifndef NDN_IMS_IN_MEMORY_STORAGE_PERSISTENT_HPP
+#define NDN_IMS_IN_MEMORY_STORAGE_PERSISTENT_HPP
#include "in-memory-storage.hpp"
namespace ndn {
-namespace util {
/** @brief Provides application cache with persistent storage, of which no replacement policy will
- * be employed. Entries will only be deleted by explicitly application control.
+ * be employed. Entries will only be deleted by explicit application control.
*/
class InMemoryStoragePersistent : public InMemoryStorage
{
@@ -49,7 +48,6 @@
evictItem() override;
};
-} // namespace util
} // namespace ndn
-#endif // NDN_UTIL_IN_MEMORY_STORAGE_PERSISTENT_HPP
+#endif // NDN_IMS_IN_MEMORY_STORAGE_PERSISTENT_HPP
diff --git a/src/util/in-memory-storage.cpp b/src/ims/in-memory-storage.cpp
similarity index 98%
rename from src/util/in-memory-storage.cpp
rename to src/ims/in-memory-storage.cpp
index bc1beac..0dc7df7 100644
--- a/src/util/in-memory-storage.cpp
+++ b/src/ims/in-memory-storage.cpp
@@ -22,10 +22,7 @@
#include "in-memory-storage.hpp"
#include "in-memory-storage-entry.hpp"
-#include "../security/signature-sha256-with-rsa.hpp"
-
namespace ndn {
-namespace util {
const time::milliseconds InMemoryStorage::INFINITE_WINDOW(-1);
const time::milliseconds InMemoryStorage::ZERO_WINDOW(0);
@@ -189,7 +186,7 @@
m_nPackets++;
entry->setData(data);
if (m_scheduler != nullptr && mustBeFreshProcessingWindow > ZERO_WINDOW) {
- auto eventId = make_unique<scheduler::ScopedEventId>(*m_scheduler);
+ auto eventId = make_unique<util::scheduler::ScopedEventId>(*m_scheduler);
*eventId = m_scheduler->scheduleEvent(mustBeFreshProcessingWindow,
bind(&InMemoryStorageEntry::markStale, entry));
entry->setMarkStaleEventId(std::move(eventId));
@@ -449,5 +446,4 @@
os << (*it)->getFullName() << std::endl;
}
-} // namespace util
} // namespace ndn
diff --git a/src/util/in-memory-storage.hpp b/src/ims/in-memory-storage.hpp
similarity index 96%
rename from src/util/in-memory-storage.hpp
rename to src/ims/in-memory-storage.hpp
index 0b6e523..9e61e7a 100644
--- a/src/util/in-memory-storage.hpp
+++ b/src/ims/in-memory-storage.hpp
@@ -19,34 +19,29 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_UTIL_IN_MEMORY_STORAGE_HPP
-#define NDN_UTIL_IN_MEMORY_STORAGE_HPP
+#ifndef NDN_IMS_IN_MEMORY_STORAGE_HPP
+#define NDN_IMS_IN_MEMORY_STORAGE_HPP
-#include "../common.hpp"
-#include "../interest.hpp"
-#include "../data.hpp"
-#include "scheduler.hpp"
#include "in-memory-storage-entry.hpp"
-#include <boost/multi_index/member.hpp>
+#include <iterator>
+#include <stack>
+
#include <boost/multi_index_container.hpp>
-#include <boost/multi_index/ordered_index.hpp>
-#include <boost/multi_index/sequenced_index.hpp>
#include <boost/multi_index/identity.hpp>
#include <boost/multi_index/mem_fun.hpp>
-
-#include <stack>
-#include <iterator>
+#include <boost/multi_index/member.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include <boost/multi_index/sequenced_index.hpp>
namespace ndn {
-namespace util {
/** @brief Represents in-memory storage
*/
class InMemoryStorage : noncopyable
{
public:
- //multi_index_container to implement storage
+ // multi_index_container to implement storage
class byFullName;
typedef boost::multi_index_container<
@@ -341,7 +336,6 @@
unique_ptr<Scheduler> m_scheduler;
};
-} // namespace util
} // namespace ndn
-#endif // NDN_UTIL_IN_MEMORY_STORAGE_HPP
+#endif // NDN_IMS_IN_MEMORY_STORAGE_HPP
diff --git a/src/mgmt/dispatcher.hpp b/src/mgmt/dispatcher.hpp
index b3c9967..2de6f78 100644
--- a/src/mgmt/dispatcher.hpp
+++ b/src/mgmt/dispatcher.hpp
@@ -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).
@@ -23,9 +23,9 @@
#define NDN_MGMT_DISPATCHER_HPP
#include "../face.hpp"
-#include "../security/key-chain.hpp"
#include "../encoding/block.hpp"
-#include "../util/in-memory-storage-fifo.hpp"
+#include "../security/key-chain.hpp"
+#include "../ims/in-memory-storage-fifo.hpp"
#include "control-response.hpp"
#include "control-parameters.hpp"
#include "status-dataset-context.hpp"
@@ -473,7 +473,7 @@
std::unordered_map<Name, uint64_t> m_streams;
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
- util::InMemoryStorageFifo m_storage;
+ InMemoryStorageFifo m_storage;
};
template<typename CP>
diff --git a/tests/unit-tests/util/in-memory-storage-fifo.t.cpp b/tests/unit-tests/ims/in-memory-storage-fifo.t.cpp
similarity index 87%
rename from tests/unit-tests/util/in-memory-storage-fifo.t.cpp
rename to tests/unit-tests/ims/in-memory-storage-fifo.t.cpp
index 6175837..7455ec0 100644
--- a/tests/unit-tests/util/in-memory-storage-fifo.t.cpp
+++ b/tests/unit-tests/ims/in-memory-storage-fifo.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).
@@ -19,20 +19,18 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "util/in-memory-storage-fifo.hpp"
+#include "ims/in-memory-storage-fifo.hpp"
#include "boost-test.hpp"
#include "../make-interest-data.hpp"
namespace ndn {
-namespace util {
namespace tests {
using namespace ndn::tests;
-BOOST_AUTO_TEST_SUITE(Util)
-BOOST_AUTO_TEST_SUITE(TestInMemoryStorage)
-BOOST_AUTO_TEST_SUITE(Fifo)
+BOOST_AUTO_TEST_SUITE(Ims)
+BOOST_AUTO_TEST_SUITE(TestInMemoryStorageFifo)
BOOST_AUTO_TEST_CASE(ArrivalQueue)
{
@@ -75,10 +73,8 @@
BOOST_CHECK(found2 == nullptr);
}
-BOOST_AUTO_TEST_SUITE_END() // Fifo
-BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorage
-BOOST_AUTO_TEST_SUITE_END() // Util
+BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorageFifo
+BOOST_AUTO_TEST_SUITE_END() // Ims
} // namespace tests
-} // namespace util
} // namespace ndn
diff --git a/tests/unit-tests/util/in-memory-storage-lfu.t.cpp b/tests/unit-tests/ims/in-memory-storage-lfu.t.cpp
similarity index 92%
rename from tests/unit-tests/util/in-memory-storage-lfu.t.cpp
rename to tests/unit-tests/ims/in-memory-storage-lfu.t.cpp
index 5c37e56..b3462de 100644
--- a/tests/unit-tests/util/in-memory-storage-lfu.t.cpp
+++ b/tests/unit-tests/ims/in-memory-storage-lfu.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).
@@ -19,20 +19,18 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "util/in-memory-storage-lfu.hpp"
+#include "ims/in-memory-storage-lfu.hpp"
#include "boost-test.hpp"
#include "../make-interest-data.hpp"
namespace ndn {
-namespace util {
namespace tests {
using namespace ndn::tests;
-BOOST_AUTO_TEST_SUITE(Util)
-BOOST_AUTO_TEST_SUITE(TestInMemoryStorage)
-BOOST_AUTO_TEST_SUITE(Lfu)
+BOOST_AUTO_TEST_SUITE(Ims)
+BOOST_AUTO_TEST_SUITE(TestInMemoryStorageLfu)
BOOST_AUTO_TEST_CASE(FrequencyQueue)
{
@@ -130,10 +128,8 @@
BOOST_CHECK_EQUAL(found3->getName(), name3);
}
-BOOST_AUTO_TEST_SUITE_END() // Lfu
-BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorage
-BOOST_AUTO_TEST_SUITE_END() // Util
+BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorageLfu
+BOOST_AUTO_TEST_SUITE_END() // Ims
} // namespace tests
-} // namespace util
} // namespace ndn
diff --git a/tests/unit-tests/util/in-memory-storage-lru.t.cpp b/tests/unit-tests/ims/in-memory-storage-lru.t.cpp
similarity index 92%
rename from tests/unit-tests/util/in-memory-storage-lru.t.cpp
rename to tests/unit-tests/ims/in-memory-storage-lru.t.cpp
index 67068bd..f371f9b 100644
--- a/tests/unit-tests/util/in-memory-storage-lru.t.cpp
+++ b/tests/unit-tests/ims/in-memory-storage-lru.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).
@@ -19,20 +19,18 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "util/in-memory-storage-lru.hpp"
+#include "ims/in-memory-storage-lru.hpp"
#include "boost-test.hpp"
#include "../make-interest-data.hpp"
namespace ndn {
-namespace util {
namespace tests {
using namespace ndn::tests;
-BOOST_AUTO_TEST_SUITE(Util)
-BOOST_AUTO_TEST_SUITE(TestInMemoryStorage)
-BOOST_AUTO_TEST_SUITE(Lru)
+BOOST_AUTO_TEST_SUITE(Ims)
+BOOST_AUTO_TEST_SUITE(TestInMemoryStorageLru)
BOOST_AUTO_TEST_CASE(UsedTimeQueue)
{
@@ -132,10 +130,8 @@
BOOST_CHECK_EQUAL(found3->getName(), name3);
}
-BOOST_AUTO_TEST_SUITE_END() // Lru
-BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorage
-BOOST_AUTO_TEST_SUITE_END() // Util
+BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorageLru
+BOOST_AUTO_TEST_SUITE_END() // Ims
} // namespace tests
-} // namespace util
} // namespace ndn
diff --git a/tests/unit-tests/util/in-memory-storage-persistent.t.cpp b/tests/unit-tests/ims/in-memory-storage-persistent.t.cpp
similarity index 84%
rename from tests/unit-tests/util/in-memory-storage-persistent.t.cpp
rename to tests/unit-tests/ims/in-memory-storage-persistent.t.cpp
index 9770ef3..69c0d7e 100644
--- a/tests/unit-tests/util/in-memory-storage-persistent.t.cpp
+++ b/tests/unit-tests/ims/in-memory-storage-persistent.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).
@@ -19,20 +19,18 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "util/in-memory-storage-persistent.hpp"
+#include "ims/in-memory-storage-persistent.hpp"
#include "boost-test.hpp"
#include "../make-interest-data.hpp"
namespace ndn {
-namespace util {
namespace tests {
using namespace ndn::tests;
-BOOST_AUTO_TEST_SUITE(Util)
-BOOST_AUTO_TEST_SUITE(TestInMemoryStorage)
-BOOST_AUTO_TEST_SUITE(Persistent)
+BOOST_AUTO_TEST_SUITE(Ims)
+BOOST_AUTO_TEST_SUITE(TestInMemoryStoragePersistent)
BOOST_AUTO_TEST_CASE(GetLimit)
{
@@ -60,10 +58,8 @@
BOOST_CHECK_EQUAL(ims.getCapacity(), 20);
}
-BOOST_AUTO_TEST_SUITE_END() // Persistent
-BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorage
-BOOST_AUTO_TEST_SUITE_END() // Util
+BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStoragePersistent
+BOOST_AUTO_TEST_SUITE_END() // Ims
} // namespace tests
-} // namespace util
} // namespace ndn
diff --git a/tests/unit-tests/util/in-memory-storage-common.t.cpp b/tests/unit-tests/ims/in-memory-storage.t.cpp
similarity index 96%
rename from tests/unit-tests/util/in-memory-storage-common.t.cpp
rename to tests/unit-tests/ims/in-memory-storage.t.cpp
index 5c83391..691321a 100644
--- a/tests/unit-tests/util/in-memory-storage-common.t.cpp
+++ b/tests/unit-tests/ims/in-memory-storage.t.cpp
@@ -19,12 +19,13 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "util/in-memory-storage-persistent.hpp"
-#include "util/in-memory-storage-fifo.hpp"
-#include "util/in-memory-storage-lfu.hpp"
-#include "util/in-memory-storage-lru.hpp"
-#include "util/digest.hpp"
+#include "ims/in-memory-storage.hpp"
+#include "ims/in-memory-storage-fifo.hpp"
+#include "ims/in-memory-storage-lfu.hpp"
+#include "ims/in-memory-storage-lru.hpp"
+#include "ims/in-memory-storage-persistent.hpp"
#include "security/signature-sha256-with-rsa.hpp"
+#include "util/digest.hpp"
#include "boost-test.hpp"
#include "../make-interest-data.hpp"
@@ -33,14 +34,12 @@
#include <boost/mpl/list.hpp>
namespace ndn {
-namespace util {
namespace tests {
using namespace ndn::tests;
-BOOST_AUTO_TEST_SUITE(Util)
+BOOST_AUTO_TEST_SUITE(Ims)
BOOST_AUTO_TEST_SUITE(TestInMemoryStorage)
-BOOST_AUTO_TEST_SUITE(Common)
using InMemoryStorages = boost::mpl::list<InMemoryStoragePersistent,
InMemoryStorageFifo,
@@ -274,7 +273,7 @@
{
shared_ptr<Data> data = makeData("/digest/compute");
- ConstBufferPtr digest1 = Sha256::computeDigest(data->wireEncode().wire(), data->wireEncode().size());
+ ConstBufferPtr digest1 = util::Sha256::computeDigest(data->wireEncode().wire(), data->wireEncode().size());
BOOST_CHECK_EQUAL(digest1->size(), 32);
InMemoryStorageEntry entry;
@@ -372,7 +371,7 @@
shared_ptr<Data> data7 = makeData("/c/c/1");
ims.insert(*data7);
- ConstBufferPtr digest1 = Sha256::computeDigest(data->wireEncode().wire(), data->wireEncode().size());
+ ConstBufferPtr digest1 = util::Sha256::computeDigest(data->wireEncode().wire(), data->wireEncode().size());
Name name("/a");
ims.erase(name);
@@ -393,7 +392,7 @@
shared_ptr<Data> data3 = makeData("/z/z/z");
ims.insert(*data3);
- ConstBufferPtr digest1 = Sha256::computeDigest(data->wireEncode().wire(), data->wireEncode().size());
+ ConstBufferPtr digest1 = util::Sha256::computeDigest(data->wireEncode().wire(), data->wireEncode().size());
shared_ptr<Interest> interest = makeInterest("");
interest->setName(Name(name).appendImplicitSha256Digest(digest1->buf(), digest1->size()));
@@ -506,7 +505,6 @@
SignatureSha256WithRsa fakeSignature;
fakeSignature.setValue(makeEmptyBlock(tlv::SignatureValue));
-
fakeSignature.setKeyLocator(locator);
data2->setSignature(fakeSignature);
data2->wireEncode();
@@ -694,8 +692,7 @@
BOOST_CHECK(found == nullptr);
}
-///as Find function is implemented at the base case, therefore testing for one derived class is
-///sufficient for all
+// Find function is implemented at the base case, so it's sufficient to test for one derived class.
class FindFixture : public tests::UnitTestTimeFixture
{
protected:
@@ -928,9 +925,9 @@
Name n2 = insert(2, "ndn:/A");
insert(3, "ndn:/A/B");
- uint8_t digest00[Sha256::DIGEST_SIZE];
+ uint8_t digest00[util::Sha256::DIGEST_SIZE];
std::fill_n(digest00, sizeof(digest00), 0x00);
- uint8_t digestFF[Sha256::DIGEST_SIZE];
+ uint8_t digestFF[util::Sha256::DIGEST_SIZE];
std::fill_n(digestFF, sizeof(digestFF), 0xFF);
Exclude excludeDigest;
@@ -1050,10 +1047,8 @@
}
BOOST_AUTO_TEST_SUITE_END() // Find
-BOOST_AUTO_TEST_SUITE_END() // Common
BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorage
-BOOST_AUTO_TEST_SUITE_END() // Util
+BOOST_AUTO_TEST_SUITE_END() // Ims
} // namespace tests
-} // namespace util
} // namespace ndn
diff --git a/tests/unit-tests/mgmt/dispatcher.t.cpp b/tests/unit-tests/mgmt/dispatcher.t.cpp
index 6127ea0..536616c 100644
--- a/tests/unit-tests/mgmt/dispatcher.t.cpp
+++ b/tests/unit-tests/mgmt/dispatcher.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).
@@ -47,7 +47,7 @@
public:
util::DummyClientFace face;
mgmt::Dispatcher dispatcher;
- util::InMemoryStorageFifo& storage;
+ InMemoryStorageFifo& storage;
};
class VoidParameters : public mgmt::ControlParameters