diff options
author | Tor Egge <Tor.Egge@oath.com> | 2017-11-14 13:30:35 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2017-11-14 13:34:19 +0000 |
commit | 6774536c128590b70e20b6e04b442fb73e3c33bb (patch) | |
tree | ad45f5930b16735423725edc895289a70dc53614 | |
parent | a897abcdcaad0d6bd88a043df1c6d3f147bf9717 (diff) |
Consolidate makeBucketSpace() test functions to document module.
14 files changed, 38 insertions, 39 deletions
diff --git a/document/src/vespa/document/test/make_bucket_space.cpp b/document/src/vespa/document/test/make_bucket_space.cpp index a213e5e36b7..be8292fcf71 100644 --- a/document/src/vespa/document/test/make_bucket_space.cpp +++ b/document/src/vespa/document/test/make_bucket_space.cpp @@ -9,4 +9,17 @@ BucketSpace makeBucketSpace() return BucketSpace::placeHolder(); } +BucketSpace makeBucketSpace(const vespalib::string &docTypeName) +{ + // Used by persistence conformance test to map fron document type name + // to bucket space. See document::TestDocRepo for known document types. + if (docTypeName == "no") { + return BucketSpace(2); + } else if (docTypeName == "testdoctype2") { + return BucketSpace(1); + } else { + return makeBucketSpace(); + } +} + } diff --git a/document/src/vespa/document/test/make_bucket_space.h b/document/src/vespa/document/test/make_bucket_space.h index 8289ec2030a..8b17eaea1ac 100644 --- a/document/src/vespa/document/test/make_bucket_space.h +++ b/document/src/vespa/document/test/make_bucket_space.h @@ -6,8 +6,9 @@ namespace document::test { -// Helper function used by unit tests +// Helper functions used by unit tests BucketSpace makeBucketSpace(); +BucketSpace makeBucketSpace(const vespalib::string &docTypeName); } diff --git a/memfilepersistence/src/tests/spi/memfiletestutils.cpp b/memfilepersistence/src/tests/spi/memfiletestutils.cpp index 04f2e87c812..bb35aa4d03e 100644 --- a/memfilepersistence/src/tests/spi/memfiletestutils.cpp +++ b/memfilepersistence/src/tests/spi/memfiletestutils.cpp @@ -7,14 +7,15 @@ #include <vespa/memfilepersistence/memfile/memfilecache.h> #include <vespa/storageframework/defaultimplementation/memory/simplememorylogic.h> #include <vespa/document/update/assignvalueupdate.h> +#include <vespa/document/test/make_bucket_space.h> #include <vespa/persistence/spi/test.h> #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/util/exceptions.h> #include <sys/time.h> using document::DocumentType; +using document::test::makeBucketSpace; using storage::spi::test::makeSpiBucket; -using storage::spi::test::makeBucketSpace; namespace storage { namespace memfile { diff --git a/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp b/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp index 30aa19c6a86..57ebd36ce00 100644 --- a/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp +++ b/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp @@ -7,6 +7,7 @@ #include <vespa/document/fieldset/fieldsets.h> #include <vespa/document/update/documentupdate.h> #include <vespa/document/update/assignvalueupdate.h> +#include <vespa/document/test/make_bucket_space.h> #include <vespa/vdslib/state/state.h> #include <vespa/vdslib/state/node.h> #include <vespa/vdslib/state/nodestate.h> @@ -18,8 +19,8 @@ using document::BucketId; using document::BucketSpace; +using document::test::makeBucketSpace; using storage::spi::test::makeSpiBucket; -using storage::spi::test::makeBucketSpace; namespace storage::spi { diff --git a/persistence/src/vespa/persistence/spi/test.cpp b/persistence/src/vespa/persistence/spi/test.cpp index e376bd6b4d4..b58d527c598 100644 --- a/persistence/src/vespa/persistence/spi/test.cpp +++ b/persistence/src/vespa/persistence/spi/test.cpp @@ -1,33 +1,17 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "test.h" +#include <vespa/document/test/make_bucket_space.h> using document::BucketId; using document::BucketSpace; +using document::test::makeBucketSpace; namespace storage::spi::test { -BucketSpace makeBucketSpace() -{ - return BucketSpace::placeHolder(); -} - -BucketSpace makeBucketSpace(const vespalib::string &docTypeName) -{ - // Used by persistence conformance test to map fron document type name - // to bucket space. See document::TestDocRepo for known document types. - if (docTypeName == "no") { - return BucketSpace(2); - } else if (docTypeName == "testdoctype2") { - return BucketSpace(1); - } else { - return makeBucketSpace(); - } -} - Bucket makeSpiBucket(BucketId bucketId, PartitionId partitionId) { - return Bucket(document::Bucket(BucketSpace::placeHolder(), bucketId), partitionId); + return Bucket(document::Bucket(makeBucketSpace(), bucketId), partitionId); } Bucket makeSpiBucket(BucketId bucketId) diff --git a/persistence/src/vespa/persistence/spi/test.h b/persistence/src/vespa/persistence/spi/test.h index 06bade014ab..445cfc91213 100644 --- a/persistence/src/vespa/persistence/spi/test.h +++ b/persistence/src/vespa/persistence/spi/test.h @@ -8,8 +8,6 @@ namespace storage::spi::test { // Helper functions used by unit tests -document::BucketSpace makeBucketSpace(); -document::BucketSpace makeBucketSpace(const vespalib::string &docTypeName); Bucket makeSpiBucket(document::BucketId bucketId, PartitionId partitionId); Bucket makeSpiBucket(document::BucketId bucketId); diff --git a/searchcore/src/apps/tests/persistenceconformance_test.cpp b/searchcore/src/apps/tests/persistenceconformance_test.cpp index 0ea3b41f232..8bb1911e595 100644 --- a/searchcore/src/apps/tests/persistenceconformance_test.cpp +++ b/searchcore/src/apps/tests/persistenceconformance_test.cpp @@ -9,7 +9,7 @@ #include <vespa/document/base/testdocman.h> #include <vespa/fastos/file.h> #include <vespa/persistence/conformancetest/conformancetest.h> -#include <vespa/persistence/spi/test.h> +#include <vespa/document/test/make_bucket_space.h> #include <vespa/searchcommon/common/schemaconfigurer.h> #include <vespa/searchcore/proton/common/hw_info.h> #include <vespa/searchcore/proton/matching/querylimiter.h> @@ -34,7 +34,6 @@ LOG_SETUP("persistenceconformance_test"); using namespace config; using namespace proton; using namespace cloud::config::filedistribution; -using namespace storage::spi::test; using namespace vespa::config::search::core; using namespace vespa::config::search::summary; using namespace vespa::config::search; @@ -45,6 +44,7 @@ using document::DocumentType; using document::DocumentTypeRepo; using document::DocumenttypesConfig; using document::TestDocMan; +using document::test::makeBucketSpace; using search::TuneFileDocumentDB; using search::index::DummyFileHeaderContext; using search::index::Schema; diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp index bce3fb7267c..6705527dfa9 100644 --- a/searchcore/src/tests/proton/docsummary/docsummary.cpp +++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp @@ -5,7 +5,7 @@ #include <vespa/eval/tensor/default_tensor.h> #include <vespa/eval/tensor/serialization/typed_binary_format.h> #include <vespa/eval/tensor/tensor_factory.h> -#include <vespa/persistence/spi/test.h> +#include <vespa/document/test/make_bucket_space.h> #include <vespa/searchcore/proton/attribute/attribute_writer.h> #include <vespa/searchcore/proton/test/bucketfactory.h> #include <vespa/searchcore/proton/docsummary/docsumcontext.h> @@ -43,9 +43,9 @@ using namespace search::engine; using namespace search::index; using namespace search::transactionlog; using namespace search; -using namespace storage::spi::test; using document::DocumenttypesConfig; +using document::test::makeBucketSpace; using search::TuneFileDocumentDB; using search::index::DummyFileHeaderContext; using search::index::schema::CollectionType; diff --git a/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp b/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp index a997b3cc3db..c7006be2804 100644 --- a/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp @@ -2,7 +2,7 @@ #include <vespa/log/log.h> LOG_SETUP("combiningfeedview_test"); -#include <vespa/persistence/spi/test.h> +#include <vespa/document/test/make_bucket_space.h> #include <vespa/searchcore/proton/feedoperation/moveoperation.h> #include <vespa/searchcore/proton/server/combiningfeedview.h> #include <vespa/searchcore/proton/test/test.h> @@ -11,10 +11,10 @@ LOG_SETUP("combiningfeedview_test"); using document::DocumentTypeRepo; using document::DocumentUpdate; +using document::test::makeBucketSpace; using search::IDestructorCallback; using search::SerialNum; using storage::spi::Timestamp; -using storage::spi::test::makeBucketSpace; using namespace proton; typedef std::vector<IFeedView::SP> FeedViewVector; diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp index 8369ec0630d..1b94ba36dad 100644 --- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp +++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp @@ -1,6 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/persistence/spi/test.h> +#include <vespa/document/test/make_bucket_space.h> #include <vespa/searchcore/proton/attribute/imported_attributes_repo.h> #include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h> #include <vespa/searchcore/proton/common/hw_info.h> @@ -44,6 +44,7 @@ using namespace search; using namespace searchcorespi; using namespace vespalib; +using document::test::makeBucketSpace; using proton::bucketdb::BucketDBHandler; using proton::bucketdb::IBucketDBHandler; using proton::bucketdb::IBucketDBHandlerInitializer; @@ -52,7 +53,6 @@ using search::test::DirectoryHandler; using searchcorespi::IFlushTarget; using searchcorespi::index::IThreadingService; using storage::spi::Timestamp; -using storage::spi::test::makeBucketSpace; using vespa::config::search::core::ProtonConfig; using vespalib::mkdir; diff --git a/searchcore/src/tests/proton/documentdb/documentbucketmover/documentbucketmover_test.cpp b/searchcore/src/tests/proton/documentdb/documentbucketmover/documentbucketmover_test.cpp index 4419e982abf..7aa452c5aa3 100644 --- a/searchcore/src/tests/proton/documentdb/documentbucketmover/documentbucketmover_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentbucketmover/documentbucketmover_test.cpp @@ -15,7 +15,7 @@ #include <vespa/searchcore/proton/test/disk_mem_usage_notifier.h> #include <vespa/searchcore/proton/test/test.h> #include <vespa/searchlib/index/docbuilder.h> -#include <vespa/persistence/spi/test.h> +#include <vespa/document/test/make_bucket_space.h> #include <vespa/vespalib/testkit/testapp.h> using namespace proton; @@ -24,6 +24,7 @@ using document::Document; using document::DocumentId; using document::DocumentTypeRepo; using document::GlobalId; +using document::test::makeBucketSpace; using proton::bucketdb::BucketCreateNotifier; using search::DocumentIdT; using search::DocumentMetaData; @@ -32,7 +33,6 @@ using search::index::DocBuilder; using search::index::Schema; using storage::spi::BucketInfo; using storage::spi::Timestamp; -using storage::spi::test::makeBucketSpace; using vespalib::make_string; using BlockedReason = IBlockableMaintenanceJob::BlockedReason; diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp index f7e09eeec3f..58372c59193 100644 --- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp @@ -3,7 +3,7 @@ #include <tests/proton/common/dummydbowner.h> #include <vespa/document/datatype/documenttype.h> #include <vespa/fastos/file.h> -#include <vespa/persistence/spi/test.h> +#include <vespa/document/test/make_bucket_space.h> #include <vespa/searchcore/proton/attribute/flushableattribute.h> #include <vespa/searchcore/proton/common/feedtoken.h> #include <vespa/searchcore/proton/common/statusreport.h> @@ -27,12 +27,12 @@ using namespace cloud::config::filedistribution; using namespace proton; -using namespace storage::spi::test; using namespace vespalib::slime; using document::DocumentType; using document::DocumentTypeRepo; using document::DocumenttypesConfig; +using document::test::makeBucketSpace; using search::TuneFileDocumentDB; using search::index::DummyFileHeaderContext; using search::index::Schema; diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp index f20ad01bcf6..b84aa1c1c6c 100644 --- a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp +++ b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp @@ -1,6 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/persistence/spi/test.h> +#include <vespa/document/test/make_bucket_space.h> #include <vespa/searchcore/proton/attribute/attribute_usage_filter.h> #include <vespa/searchcore/proton/attribute/i_attribute_manager.h> #include <vespa/searchcore/proton/common/doctypename.h> @@ -43,6 +43,7 @@ using namespace vespalib::slime; using document::BucketId; using document::Document; using document::DocumentId; +using document::test::makeBucketSpace; using fastos::ClockSystem; using fastos::TimeStamp; using proton::bucketdb::BucketCreateNotifier; @@ -54,7 +55,6 @@ using search::IDestructorCallback; using search::SerialNum; using storage::spi::BucketInfo; using storage::spi::Timestamp; -using storage::spi::test::makeBucketSpace; using vespalib::Slime; using vespalib::makeClosure; using vespalib::makeTask; diff --git a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp index 9e13cf2ff7d..aa7c5a4eda9 100644 --- a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp +++ b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp @@ -4,6 +4,7 @@ #include <vespa/document/datatype/documenttype.h> #include <vespa/document/fieldset/fieldsets.h> #include <vespa/document/repo/documenttyperepo.h> +#include <vespa/document/test/make_bucket_space.h> #include <vespa/persistence/spi/documentselection.h> #include <vespa/persistence/spi/test.h> #include <vespa/persistence/spi/test.h> @@ -21,6 +22,7 @@ using document::BucketSpace; using document::Document; using document::DocumentId; using document::DocumentType; +using document::test::makeBucketSpace; using search::DocumentMetaData; using storage::spi::Bucket; using storage::spi::BucketChecksum; @@ -42,7 +44,6 @@ using storage::spi::Selection; using storage::spi::Timestamp; using storage::spi::UpdateResult; using storage::spi::test::makeSpiBucket; -using storage::spi::test::makeBucketSpace; using namespace proton; using namespace vespalib; |