aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/tests/persistence
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-03-28 06:42:13 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-03-28 10:08:43 +0000
commit02b5efaa3bbc043e50e2c64b968241f842c3cffc (patch)
treeb9f9ea83f0dd49656791439322d5ba3d3b6be0b9 /storage/src/tests/persistence
parentbb59611ce9611986ee97f19d2bb725dc1d160074 (diff)
Avoid the need for clone by using unique_ptr.
Diffstat (limited to 'storage/src/tests/persistence')
-rw-r--r--storage/src/tests/persistence/persistencetestutils.cpp6
-rw-r--r--storage/src/tests/persistence/testandsettest.cpp2
2 files changed, 3 insertions, 5 deletions
diff --git a/storage/src/tests/persistence/persistencetestutils.cpp b/storage/src/tests/persistence/persistencetestutils.cpp
index 0adeff5bc34..dfb245b2a52 100644
--- a/storage/src/tests/persistence/persistencetestutils.cpp
+++ b/storage/src/tests/persistence/persistencetestutils.cpp
@@ -225,8 +225,7 @@ PersistenceTestUtils::createBodyUpdate(const document::DocumentId& docId, const
{
const DocumentType* docType(getTypeRepo()->getDocumentType("testdoctype1"));
auto update = std::make_shared<document::DocumentUpdate>(*getTypeRepo(), *docType, docId);
- auto assignUpdate = std::make_shared<document::AssignValueUpdate>(updateValue);
- update->addUpdate(std::move(document::FieldUpdate(docType->getField("content")).addUpdate(*assignUpdate)));
+ update->addUpdate(std::move(document::FieldUpdate(docType->getField("content")).addUpdate(std::make_unique<document::AssignValueUpdate>(updateValue))));
return update;
}
@@ -235,8 +234,7 @@ PersistenceTestUtils::createHeaderUpdate(const document::DocumentId& docId, cons
{
const DocumentType* docType(getTypeRepo()->getDocumentType("testdoctype1"));
auto update = std::make_shared<document::DocumentUpdate>(*getTypeRepo(), *docType, docId);
- auto assignUpdate = std::make_shared<document::AssignValueUpdate>(updateValue);
- update->addUpdate(std::move(document::FieldUpdate(docType->getField("headerval")).addUpdate(*assignUpdate)));
+ update->addUpdate(std::move(document::FieldUpdate(docType->getField("headerval")).addUpdate(std::make_unique<document::AssignValueUpdate>(updateValue))));
return update;
}
diff --git a/storage/src/tests/persistence/testandsettest.cpp b/storage/src/tests/persistence/testandsettest.cpp
index 267569b0bc5..30a9886cf44 100644
--- a/storage/src/tests/persistence/testandsettest.cpp
+++ b/storage/src/tests/persistence/testandsettest.cpp
@@ -159,7 +159,7 @@ std::shared_ptr<api::UpdateCommand>
TestAndSetTest::conditional_update_test(bool createIfMissing, api::Timestamp updateTimestamp)
{
auto docUpdate = std::make_shared<document::DocumentUpdate>(_env->_testDocMan.getTypeRepo(), testDoc->getType(), testDocId);
- docUpdate->addUpdate(std::move(document::FieldUpdate(testDoc->getField("content")).addUpdate(document::AssignValueUpdate(NEW_CONTENT))));
+ docUpdate->addUpdate(std::move(document::FieldUpdate(testDoc->getField("content")).addUpdate(std::make_unique<document::AssignValueUpdate>(NEW_CONTENT))));
docUpdate->setCreateIfNonExistent(createIfMissing);
auto updateUp = std::make_unique<api::UpdateCommand>(BUCKET, docUpdate, updateTimestamp);