diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-04-28 08:24:57 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-04-29 14:14:03 +0000 |
commit | eb7b71781ca079b5577a13b300beafee388bc1ce (patch) | |
tree | 8a5194ed759a8fc8433fef14118e67ac6bfc2632 /searchcore/src/tests | |
parent | 9499865f8a43aa097841606795a2bea8d0273ef9 (diff) |
- Add async interface to put
- Use MessageTracker for keeping context.
- implement putAsync, but still use it synchronously.
Diffstat (limited to 'searchcore/src/tests')
5 files changed, 7 insertions, 9 deletions
diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp index 55d524519b8..e1785e1e48d 100644 --- a/searchcore/src/tests/proton/docsummary/docsummary.cpp +++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp @@ -255,8 +255,7 @@ public: storage::spi::Timestamp ts(0); DbDocumentId dbdId(lid); DbDocumentId prevDbdId(0); - document::Document::SP xdoc(new document::Document(doc)); - PutOperation op(bucketId, ts, xdoc); + PutOperation op(bucketId, ts, std::make_shared<document::Document>(doc)); op.setSerialNum(serialNum); op.setDbDocumentId(dbdId); op.setPrevDbDocumentId(prevDbdId); diff --git a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp index 796ec4436fe..18235116d27 100644 --- a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp @@ -544,7 +544,7 @@ TEST_F("require that outdated remove is ignored", FeedHandlerFixture) TEST_F("require that outdated put is ignored", FeedHandlerFixture) { DocumentContext doc_context("id:ns:searchdocument::foo", *f.schema.builder); - auto op =std::make_unique<PutOperation>(doc_context.bucketId, Timestamp(10), doc_context.doc); + auto op =std::make_unique<PutOperation>(doc_context.bucketId, Timestamp(10), std::move(doc_context.doc)); static_cast<DocumentOperation &>(*op).setPrevTimestamp(Timestamp(10000)); FeedTokenContext token_context; f.handler.performOperation(std::move(token_context.token), std::move(op)); @@ -673,7 +673,7 @@ TEST_F("require that put is rejected if resource limit is reached", FeedHandlerF f.writeFilter._message = "Attribute resource limit reached"; DocumentContext docCtx("id:test:searchdocument::foo", *f.schema.builder); - auto op = std::make_unique<PutOperation>(docCtx.bucketId, Timestamp(10), docCtx.doc); + auto op = std::make_unique<PutOperation>(docCtx.bucketId, Timestamp(10), std::move(docCtx.doc)); FeedTokenContext token; f.handler.performOperation(std::move(token.token), std::move(op)); EXPECT_EQUAL(0, f.feedView.put_count); @@ -801,7 +801,7 @@ TEST_F("require that put with different document type repo is ok", FeedHandlerFi TwoFieldsSchemaContext schema; DocumentContext doc_context("id:ns:searchdocument::foo", *schema.builder); auto op = std::make_unique<PutOperation>(doc_context.bucketId, - Timestamp(10), doc_context.doc); + Timestamp(10), std::move(doc_context.doc)); FeedTokenContext token_context; EXPECT_EQUAL(schema.getRepo().get(), op->getDocument()->getRepo()); EXPECT_NOT_EQUAL(f.schema.getRepo().get(), op->getDocument()->getRepo()); diff --git a/searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp b/searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp index 5fffd70f11d..53fdcb7757f 100644 --- a/searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp +++ b/searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp @@ -190,7 +190,7 @@ TEST("require that toString() on derived classes are meaningful") PutOperation().toString()); EXPECT_EQUAL("Put(id::::, BucketId(0x000000000000002a), timestamp=10, dbdId=(subDbId=0, lid=0), " "prevDbdId=(subDbId=0, lid=0), prevMarkedAsRemoved=false, prevTimestamp=0, serialNum=0)", - PutOperation(bucket_id1, timestamp, doc).toString()); + PutOperation(bucket_id1, timestamp, std::move(doc)).toString()); EXPECT_EQUAL("Remove(id::::, BucketId(0x0000000000000000), timestamp=0, dbdId=(subDbId=0, lid=0), " "prevDbdId=(subDbId=0, lid=0), prevMarkedAsRemoved=false, prevTimestamp=0, serialNum=0)", diff --git a/searchcore/src/tests/proton/persistenceengine/persistence_handler_map/persistence_handler_map_test.cpp b/searchcore/src/tests/proton/persistenceengine/persistence_handler_map/persistence_handler_map_test.cpp index 35590cc68f6..0c72d11899a 100644 --- a/searchcore/src/tests/proton/persistenceengine/persistence_handler_map/persistence_handler_map_test.cpp +++ b/searchcore/src/tests/proton/persistenceengine/persistence_handler_map/persistence_handler_map_test.cpp @@ -15,7 +15,7 @@ using HandlerSnapshot = PersistenceHandlerMap::HandlerSnapshot; struct DummyPersistenceHandler : public IPersistenceHandler { using SP = std::shared_ptr<DummyPersistenceHandler>; void initialize() override {} - void handlePut(FeedToken, const storage::spi::Bucket &, storage::spi::Timestamp, const document::Document::SP &) override {} + void handlePut(FeedToken, const storage::spi::Bucket &, storage::spi::Timestamp, DocumentSP) override {} void handleUpdate(FeedToken, const storage::spi::Bucket &, storage::spi::Timestamp, const document::DocumentUpdate::SP &) override {} void handleRemove(FeedToken, const storage::spi::Bucket &, storage::spi::Timestamp, const document::DocumentId &) override {} void handleListBuckets(IBucketIdListResultHandler &) override {} diff --git a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp index 19d9d41c3e4..4fb4abcb7c5 100644 --- a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp +++ b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp @@ -9,7 +9,6 @@ #include <vespa/document/update/documentupdate.h> #include <vespa/persistence/spi/documentselection.h> #include <vespa/persistence/spi/test.h> -#include <vespa/persistence/spi/test.h> #include <vespa/searchcore/proton/persistenceengine/bucket_guard.h> #include <vespa/searchcore/proton/persistenceengine/ipersistenceengineowner.h> #include <vespa/searchcore/proton/persistenceengine/persistenceengine.h> @@ -199,7 +198,7 @@ struct MyHandler : public IPersistenceHandler, IBucketFreezer { void initialize() override { initialized = true; } void handlePut(FeedToken token, const Bucket& bucket, - Timestamp timestamp, const document::Document::SP& doc) override { + Timestamp timestamp, DocumentSP doc) override { token->setResult(ResultUP(new storage::spi::Result()), false); handle(token, bucket, timestamp, doc->getId()); } |