summaryrefslogtreecommitdiffstats
path: root/storage/src/tests/common
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2017-10-17 01:19:04 +0200
committerTor Egge <Tor.Egge@oath.com>2017-10-17 12:02:29 +0000
commita110f409b9d56fc7542b110cd50956e3fefdb806 (patch)
tree567d9ad6afdb65c5ffe40dccb55cc1cedab06226 /storage/src/tests/common
parentdde45a05b010b6de1c62643cd9ecd37c091fdba9 (diff)
Take document::Bucket instead of document::BucketId as constructor
argument to storage commands that inherit from BucketCommand.
Diffstat (limited to 'storage/src/tests/common')
-rw-r--r--storage/src/tests/common/CMakeLists.txt1
-rw-r--r--storage/src/tests/common/make_document_bucket.cpp16
-rw-r--r--storage/src/tests/common/make_document_bucket.h13
-rw-r--r--storage/src/tests/common/storagelinktest.cpp5
4 files changed, 34 insertions, 1 deletions
diff --git a/storage/src/tests/common/CMakeLists.txt b/storage/src/tests/common/CMakeLists.txt
index c7243e68146..dc322c345e3 100644
--- a/storage/src/tests/common/CMakeLists.txt
+++ b/storage/src/tests/common/CMakeLists.txt
@@ -3,6 +3,7 @@ vespa_add_library(storage_testcommon TEST
SOURCES
dummystoragelink.cpp
testhelper.cpp
+ make_document_bucket.cpp
metricstest.cpp
storagelinktest.cpp
testnodestateupdater.cpp
diff --git a/storage/src/tests/common/make_document_bucket.cpp b/storage/src/tests/common/make_document_bucket.cpp
new file mode 100644
index 00000000000..cef33c515ee
--- /dev/null
+++ b/storage/src/tests/common/make_document_bucket.cpp
@@ -0,0 +1,16 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "make_document_bucket.h"
+
+using document::Bucket;
+using document::BucketId;
+using document::BucketSpace;
+
+namespace storage::test {
+
+Bucket makeDocumentBucket(BucketId bucketId)
+{
+ return Bucket(BucketSpace::placeHolder(), bucketId);
+}
+
+}
diff --git a/storage/src/tests/common/make_document_bucket.h b/storage/src/tests/common/make_document_bucket.h
new file mode 100644
index 00000000000..a95bc501c65
--- /dev/null
+++ b/storage/src/tests/common/make_document_bucket.h
@@ -0,0 +1,13 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+#include <vespa/document/bucket/bucket.h>
+
+namespace storage::test {
+
+// Helper function used by unit tests
+
+document::Bucket makeDocumentBucket(document::BucketId bucketId);
+
+}
diff --git a/storage/src/tests/common/storagelinktest.cpp b/storage/src/tests/common/storagelinktest.cpp
index 88b66339127..0490581d7ff 100644
--- a/storage/src/tests/common/storagelinktest.cpp
+++ b/storage/src/tests/common/storagelinktest.cpp
@@ -1,10 +1,13 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <tests/common/storagelinktest.h>
+#include <tests/common/make_document_bucket.h>
#include <iostream>
#include <string>
#include <vespa/storageapi/message/stat.h>
+using storage::test::makeDocumentBucket;
+
namespace storage {
CPPUNIT_TEST_SUITE_REGISTRATION(StorageLinkTest);
@@ -41,7 +44,7 @@ void StorageLinkTest::testNotImplemented() {
// Test that a message that nobody handles fails with NOT_IMPLEMENTED
_replier->setIgnore(true);
_feeder->sendDown(api::StorageCommand::SP(
- new api::StatBucketCommand(document::BucketId(0), "")));
+ new api::StatBucketCommand(makeDocumentBucket(document::BucketId(0)), "")));
_feeder->close();
_feeder->flush();
CPPUNIT_ASSERT_EQUAL((size_t) 1, _feeder->getNumReplies());