summaryrefslogtreecommitdiffstats
path: root/storage/src/tests/distributor
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-05-02 14:42:00 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-05-02 14:42:00 +0200
commitc0518dde43775f24955612ab46398a1c21f3ff50 (patch)
tree7e0482a7db41e4cf407c53b07aa516760c63d9af /storage/src/tests/distributor
parent0f646f10b377b90fc37e9911f9fe383d112ff157 (diff)
Fix warnings hidden earlier due to including application headers as system includes
Diffstat (limited to 'storage/src/tests/distributor')
-rw-r--r--storage/src/tests/distributor/bucketdatabasetest.cpp2
-rw-r--r--storage/src/tests/distributor/bucketdatabasetest.h7
-rw-r--r--storage/src/tests/distributor/distributortestutil.cpp14
-rw-r--r--storage/src/tests/distributor/distributortestutil.h18
-rw-r--r--storage/src/tests/distributor/maintenancemocks.h30
-rw-r--r--storage/src/tests/distributor/messagesenderstub.cpp18
-rw-r--r--storage/src/tests/distributor/messagesenderstub.h16
7 files changed, 45 insertions, 60 deletions
diff --git a/storage/src/tests/distributor/bucketdatabasetest.cpp b/storage/src/tests/distributor/bucketdatabasetest.cpp
index 5d1bb17a1c6..a0d8e90b9d3 100644
--- a/storage/src/tests/distributor/bucketdatabasetest.cpp
+++ b/storage/src/tests/distributor/bucketdatabasetest.cpp
@@ -1,5 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <tests/distributor/bucketdatabasetest.h>
+#include "bucketdatabasetest.h"
#include <vespa/storageframework/defaultimplementation/clock/realclock.h>
#include <iomanip>
diff --git a/storage/src/tests/distributor/bucketdatabasetest.h b/storage/src/tests/distributor/bucketdatabasetest.h
index 63c3a4cc4eb..321f4dafe49 100644
--- a/storage/src/tests/distributor/bucketdatabasetest.h
+++ b/storage/src/tests/distributor/bucketdatabasetest.h
@@ -1,12 +1,11 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/document/bucket/bucketid.h>
#include <vespa/storage/bucketdb/bucketdatabase.h>
-#include <vespa/vespalib/util/document_runnable.h>
+#include <vespa/storage/storageutil/utils.h>
#include <vespa/vdstestlib/cppunit/macros.h>
+#include <vespa/vespalib/util/document_runnable.h>
#include <cppunit/extensions/HelperMacros.h>
-#include <vespa/storage/storageutil/utils.h>
#define SETUP_DATABASE_TESTS() \
CPPUNIT_TEST(testUpdateGetAndRemove); \
@@ -24,7 +23,7 @@ namespace storage {
namespace distributor {
struct BucketDatabaseTest : public CppUnit::TestFixture {
- void setUp();
+ void setUp() override ;
void testUpdateGetAndRemove();
void testClear();
diff --git a/storage/src/tests/distributor/distributortestutil.cpp b/storage/src/tests/distributor/distributortestutil.cpp
index 1570aa98acc..7c709eed097 100644
--- a/storage/src/tests/distributor/distributortestutil.cpp
+++ b/storage/src/tests/distributor/distributortestutil.cpp
@@ -1,16 +1,12 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/document/base/testdocman.h>
-#include <vespa/storageframework/defaultimplementation/memory/nomemorymanager.h>
-#include <tests/distributor/distributortestutil.h>
+#include "distributortestutil.h"
#include <vespa/storage/distributor/distributor.h>
#include <vespa/config-stor-distribution.h>
-namespace storage {
-
-namespace distributor {
+namespace storage::distributor {
DistributorTestUtil::DistributorTestUtil()
- : _messageSender(_sender, _senderDown)
+ : _messageSender(_sender, _senderDown)
{
_config = getStandardConfig(false);
}
@@ -358,7 +354,3 @@ DistributorTestUtil::getDistribution() const {
}
}
-
-}
-
-
diff --git a/storage/src/tests/distributor/distributortestutil.h b/storage/src/tests/distributor/distributortestutil.h
index d984e486cee..0c2609780dc 100644
--- a/storage/src/tests/distributor/distributortestutil.h
+++ b/storage/src/tests/distributor/distributortestutil.h
@@ -1,18 +1,19 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
+#include "messagesenderstub.h"
+#include <tests/common/teststorageapp.h>
+#include <tests/common/testhelper.h>
#include <tests/common/dummystoragelink.h>
-#include <vespa/storageframework/defaultimplementation/clock/fakeclock.h>
#include <vespa/storage/common/hostreporter/hostinfo.h>
#include <vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h>
#include <vespa/storage/storageutil/utils.h>
-#include <tests/common/teststorageapp.h>
-#include <tests/distributor/messagesenderstub.h>
+#include <vespa/storageframework/defaultimplementation/clock/fakeclock.h>
#include <vespa/storageapi/message/state.h>
-#include <tests/common/testhelper.h>
namespace storage {
- namespace framework { class TickingThreadPool; }
+
+namespace framework { class TickingThreadPool; }
namespace distributor {
@@ -149,7 +150,7 @@ public:
void setRedundancy(uint32_t redundancy);
- virtual void notifyDoneInitializing() {}
+ void notifyDoneInitializing() override {}
// Must implement this for storage server interface for now
virtual api::Timestamp getUniqueTimestamp() {
@@ -176,10 +177,10 @@ protected:
MessageSenderImpl(MessageSenderStub& up, MessageSenderStub& down)
: _sender(up), _senderDown(down) {}
- void sendUp(const std::shared_ptr<api::StorageMessage>& msg) {
+ void sendUp(const std::shared_ptr<api::StorageMessage>& msg) override {
_sender.send(msg);
}
- void sendDown(const std::shared_ptr<api::StorageMessage>& msg) {
+ void sendDown(const std::shared_ptr<api::StorageMessage>& msg) override {
_senderDown.send(msg);
}
};
@@ -189,4 +190,3 @@ protected:
}
}
-
diff --git a/storage/src/tests/distributor/maintenancemocks.h b/storage/src/tests/distributor/maintenancemocks.h
index 923f7edec2b..a3c8400fd3c 100644
--- a/storage/src/tests/distributor/maintenancemocks.h
+++ b/storage/src/tests/distributor/maintenancemocks.h
@@ -1,12 +1,12 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <sstream>
#include <vespa/storage/distributor/maintenance/maintenanceprioritygenerator.h>
#include <vespa/storage/distributor/maintenance/maintenanceoperationgenerator.h>
#include <vespa/storage/distributor/operationstarter.h>
#include <vespa/storage/distributor/operations/operation.h>
#include <vespa/storageframework/defaultimplementation/clock/fakeclock.h>
+#include <sstream>
namespace storage {
namespace distributor {
@@ -16,7 +16,7 @@ class MockMaintenancePriorityGenerator
{
MaintenancePriorityAndType prioritize(
const document::BucketId&,
- NodeMaintenanceStatsTracker& stats) const
+ NodeMaintenanceStatsTracker& stats) const override
{
stats.incMovingOut(1);
stats.incCopyingIn(2);
@@ -38,23 +38,18 @@ public:
_shouldBlock(false)
{}
- std::string toString() const {
+ std::string toString() const override {
return _bucketId.toString();
}
- void onClose(DistributorMessageSender&) {
- }
- const char* getName() const {
- return "MockOperation";
- }
- virtual const std::string& getDetailedReason() const {
+ void onClose(DistributorMessageSender&) override {}
+ const char* getName() const override { return "MockOperation"; }
+ const std::string& getDetailedReason() const override {
return _reason;
}
- void onStart(DistributorMessageSender&) {
- }
- void onReceive(DistributorMessageSender&, const std::shared_ptr<api::StorageReply>&) {
- }
- bool isBlocked(const PendingMessageTracker&) const {
+ void onStart(DistributorMessageSender&) override {}
+ void onReceive(DistributorMessageSender&, const std::shared_ptr<api::StorageReply>&) override {}
+ bool isBlocked(const PendingMessageTracker&) const override {
return _shouldBlock;
}
void setShouldBlock(bool shouldBlock) {
@@ -66,13 +61,13 @@ class MockMaintenanceOperationGenerator
: public MaintenanceOperationGenerator
{
public:
- MaintenanceOperation::SP generate(const document::BucketId& id) const {
+ MaintenanceOperation::SP generate(const document::BucketId& id) const override {
return MaintenanceOperation::SP(new MockOperation(id));
}
std::vector<MaintenanceOperation::SP> generateAll(
const document::BucketId& id,
- NodeMaintenanceStatsTracker& tracker) const
+ NodeMaintenanceStatsTracker& tracker) const override
{
(void) tracker;
std::vector<MaintenanceOperation::SP> ret;
@@ -93,8 +88,7 @@ public:
: _shouldStart(true)
{}
- bool start(const std::shared_ptr<Operation>& operation,
- Priority priority)
+ bool start(const std::shared_ptr<Operation>& operation, Priority priority) override
{
if (_shouldStart) {
_started << operation->toString()
diff --git a/storage/src/tests/distributor/messagesenderstub.cpp b/storage/src/tests/distributor/messagesenderstub.cpp
index 88210a94848..fae49f033a1 100644
--- a/storage/src/tests/distributor/messagesenderstub.cpp
+++ b/storage/src/tests/distributor/messagesenderstub.cpp
@@ -1,20 +1,23 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
-#include <tests/distributor/messagesenderstub.h>
-#include <tests/distributor/distributortestutil.h>
+
+#include "messagesenderstub.h"
+#include "distributortestutil.h"
namespace storage {
+MessageSenderStub::MessageSenderStub()
+ : _clusterName("storage"),
+ _pendingMessageTracker(0)
+{}
+MessageSenderStub::~MessageSenderStub() {}
+
std::string
MessageSenderStub::getLastCommand(bool verbose) const
{
if (commands.empty()) {
throw std::logic_error("Expected command where there was none");
}
- return dumpMessage(*commands[commands.size() - 1],
- true,
- verbose);
-
+ return dumpMessage(*commands[commands.size() - 1], true, verbose);
}
std::string
@@ -85,4 +88,3 @@ MessageSenderStub::getReplies(bool includeAddress, bool verbose) const
}
}
-
diff --git a/storage/src/tests/distributor/messagesenderstub.h b/storage/src/tests/distributor/messagesenderstub.h
index 629c1c6e346..07da2b861e2 100644
--- a/storage/src/tests/distributor/messagesenderstub.h
+++ b/storage/src/tests/distributor/messagesenderstub.h
@@ -11,21 +11,19 @@ struct MessageSenderStub : distributor::DistributorMessageSender
std::vector<std::shared_ptr<api::StorageCommand> > commands;
std::vector<std::shared_ptr<api::StorageReply> > replies;
- MessageSenderStub()
- : _clusterName("storage"),
- _pendingMessageTracker(0)
- {}
+ MessageSenderStub();
+ ~MessageSenderStub();
void clear() {
commands.clear();
replies.clear();
}
- virtual void sendCommand(const std::shared_ptr<api::StorageCommand>& cmd) {
+ void sendCommand(const std::shared_ptr<api::StorageCommand>& cmd) override {
commands.push_back(cmd);
}
- virtual void sendReply(const std::shared_ptr<api::StorageReply>& reply) {
+ void sendReply(const std::shared_ptr<api::StorageReply>& reply) override {
replies.push_back(reply);
}
@@ -44,15 +42,15 @@ struct MessageSenderStub : distributor::DistributorMessageSender
bool includeAddress,
bool verbose) const;
- virtual int getDistributorIndex() const {
+ int getDistributorIndex() const override {
return 0;
}
- virtual const std::string& getClusterName() const {
+ const std::string& getClusterName() const override {
return _clusterName;
}
- virtual const distributor::PendingMessageTracker& getPendingMessageTracker() const {
+ const distributor::PendingMessageTracker& getPendingMessageTracker() const override {
assert(_pendingMessageTracker);
return *_pendingMessageTracker;
}