From 20abbaa6eb1b411bbc43b98c3bb5bc8e79a86153 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Thu, 6 Jan 2022 12:44:51 +0000 Subject: Use enum class for the flags. --- storage/src/tests/visiting/visitortest.cpp | 53 +++++++++++++++--------------- 1 file changed, 27 insertions(+), 26 deletions(-) (limited to 'storage/src/tests/visiting/visitortest.cpp') diff --git a/storage/src/tests/visiting/visitortest.cpp b/storage/src/tests/visiting/visitortest.cpp index 82ccdb60736..945a08d910e 100644 --- a/storage/src/tests/visiting/visitortest.cpp +++ b/storage/src/tests/visiting/visitortest.cpp @@ -24,6 +24,8 @@ using namespace std::chrono_literals; using document::test::makeBucketSpace; +using document::Document; +using document::DocumentId; using namespace ::testing; namespace storage { @@ -55,7 +57,7 @@ struct TestParams { struct VisitorTest : Test { static uint32_t docCount; - std::vector _documents; + std::vector _documents; std::unique_ptr _messageSessionFactory; std::unique_ptr _node; std::unique_ptr _top; @@ -93,11 +95,11 @@ struct VisitorTest : Test { void getMessagesAndReply( int expectedCount, TestVisitorMessageSession& session, - std::vector& docs, - std::vector& docIds, + std::vector & docs, + std::vector& docIds, std::vector& infoMessages, api::ReturnCode::Result returnCode = api::ReturnCode::OK); - uint32_t getMatchingDocuments(std::vector& docs); + uint32_t getMatchingDocuments(std::vector& docs); protected: void doTestVisitorInstanceHasConsistencyLevel( @@ -213,7 +215,7 @@ VisitorTest::initializeTest(const TestParams& params) uri << "id:test:testdoctype1:n=" << i % 10 << ":http://www.ntnu.no/" << i << ".html"; - _documents.push_back(document::Document::SP( + _documents.push_back(Document::SP( _node->getTestDocMan().createDocument(content, uri.str()))); const document::DocumentType& type(_documents.back()->getType()); _documents.back()->setValue(type.getField("headerval"), @@ -276,8 +278,8 @@ void VisitorTest::getMessagesAndReply( int expectedCount, TestVisitorMessageSession& session, - std::vector& docs, - std::vector& docIds, + std::vector& docs, + std::vector& docIds, std::vector& infoMessages, api::ReturnCode::Result result) { @@ -352,7 +354,7 @@ VisitorTest::verifyCreateVisitorReply( } uint32_t -VisitorTest::getMatchingDocuments(std::vector& docs) { +VisitorTest::getMatchingDocuments(std::vector& docs) { uint32_t equalCount = 0; for (uint32_t i=0; igetEntries().push_back(spi::DocEntry::create(spi::Timestamp(1000 + i), spi::NONE, - document::Document::UP(_documents[i]->clone()))); + reply->getEntries().push_back(spi::DocEntry::create(spi::Timestamp(1000 + i), Document::UP(_documents[i]->clone()))); } if (documentCount == _documents.size() || overrideCompleted) { reply->setCompleted(); @@ -479,8 +480,8 @@ TEST_F(VisitorTest, normal_usage) { sendGetIterReply(*getIterCmd); - std::vector docs; - std::vector docIds; + std::vector docs; + std::vector docIds; std::vector infoMessages; getMessagesAndReply(_documents.size(), getSession(0), docs, docIds, infoMessages); ASSERT_EQ(0, infoMessages.size()); @@ -545,8 +546,8 @@ TEST_F(VisitorTest, document_api_client_error) { sendGetIterReply(*getIterCmd, api::ReturnCode(api::ReturnCode::OK), 1); } - std::vector docs; - std::vector docIds; + std::vector docs; + std::vector docIds; std::vector infoMessages; getMessagesAndReply(1, getSession(0), docs, docIds, infoMessages, api::ReturnCode::INTERNAL_FAILURE); @@ -585,8 +586,8 @@ TEST_F(VisitorTest, no_document_api_resending_for_failed_visitor) { sendGetIterReply(*getIterCmd, api::ReturnCode(api::ReturnCode::OK), 2, true); } - std::vector docs; - std::vector docIds; + std::vector docs; + std::vector docIds; std::vector infoMessages; // Use non-critical result. Visitor info message should be received // after we send a NOT_CONNECTED reply. Failing this message as well @@ -688,8 +689,8 @@ TEST_F(VisitorTest, no_visitor_notification_for_transient_failures) { ASSERT_NO_FATAL_FAILURE(initializeTest()); ASSERT_NO_FATAL_FAILURE(sendInitialCreateVisitorAndGetIterRound()); - std::vector docs; - std::vector docIds; + std::vector docs; + std::vector docIds; std::vector infoMessages; // Have to make sure time increases in visitor thread so that resend // times are reached. @@ -732,8 +733,8 @@ TEST_F(VisitorTest, notification_sent_if_transient_error_retried_many_times) { ASSERT_NO_FATAL_FAILURE(initializeTest()); sendInitialCreateVisitorAndGetIterRound(); - std::vector docs; - std::vector docIds; + std::vector docs; + std::vector docIds; std::vector infoMessages; // Have to make sure time increases in visitor thread so that resend // times are reached. @@ -772,8 +773,8 @@ VisitorTest::doCompleteVisitingSession( 1, true); - std::vector docs; - std::vector docIds; + std::vector docs; + std::vector docIds; std::vector infoMessages; getMessagesAndReply(1, getSession(0), docs, docIds, infoMessages); @@ -833,8 +834,8 @@ TEST_F(VisitorTest, no_more_iterators_sent_while_memory_used_above_limit) { std::this_thread::sleep_for(100ms); ASSERT_EQ(0, _bottom->getNumCommands()); - std::vector docs; - std::vector docIds; + std::vector docs; + std::vector docIds; std::vector infoMessages; getMessagesAndReply(1, getSession(0), docs, docIds, infoMessages); @@ -896,8 +897,8 @@ struct ReindexingVisitorTest : VisitorTest { void respond_to_client_put(api::ReturnCode::Result result) { // Reply to the Put from "client" back to the visitor - std::vector docs; - std::vector doc_ids; + std::vector docs; + std::vector doc_ids; std::vector info_messages; getMessagesAndReply(1, getSession(0), docs, doc_ids, info_messages, result); } -- cgit v1.2.3