diff options
author | Henning Baldersheim <balder@oath.com> | 2018-06-13 13:39:39 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2018-06-14 09:41:07 +0200 |
commit | 555b143ec639c9a635d043a6b8d4923c0890d0ac (patch) | |
tree | 7ee4d6af04e18c9942156f324731a2779a8c555c /document/src/tests | |
parent | 3302fb4a790925ad0437d2bd7b4747c4d02a971b (diff) |
ByteBuffer -> nbostream
Diffstat (limited to 'document/src/tests')
-rw-r--r-- | document/src/tests/documentupdatetestcase.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/document/src/tests/documentupdatetestcase.cpp b/document/src/tests/documentupdatetestcase.cpp index 2a77d610420..1f12e5d03f8 100644 --- a/document/src/tests/documentupdatetestcase.cpp +++ b/document/src/tests/documentupdatetestcase.cpp @@ -119,35 +119,29 @@ ByteBuffer::UP serialize42(const DocumentUpdate & update) return retVal; } -ByteBuffer::UP serialize(const ValueUpdate & update) +nbostream serialize(const ValueUpdate & update) { nbostream stream; VespaDocumentSerializer serializer(stream); serializer.write(update); - ByteBuffer::UP retVal(new ByteBuffer(stream.size())); - retVal->putBytes(stream.peek(), stream.size()); - return retVal; + return stream; } -ByteBuffer::UP serialize(const FieldUpdate & update) +nbostream serialize(const FieldUpdate & update) { nbostream stream; VespaDocumentSerializer serializer(stream); serializer.write(update); - ByteBuffer::UP retVal(new ByteBuffer(stream.size())); - retVal->putBytes(stream.peek(), stream.size()); - return retVal; + return stream; } template<typename UpdateType> void testValueUpdate(const UpdateType& update, const DataType &type) { try{ DocumentTypeRepo repo; - ByteBuffer::UP buf = serialize(update); - buf->flip(); + nbostream stream = serialize(update); typename UpdateType::UP copy(dynamic_cast<UpdateType*>( - ValueUpdate::createInstance(repo, type, *buf, - Document::getNewestSerializationVersion()) + ValueUpdate::createInstance(repo, type, stream, Document::getNewestSerializationVersion()) .release())); CPPUNIT_ASSERT_EQUAL(update, *copy); } catch (std::exception& e) { @@ -189,9 +183,8 @@ DocumentUpdateTest::testSimpleUsage() { FieldUpdate fieldUpdate(docType->getField("intf")); fieldUpdate.addUpdate(AssignValueUpdate(IntFieldValue(1))); - ByteBuffer::UP fieldBuf = serialize(fieldUpdate); - fieldBuf->flip(); - FieldUpdate fieldUpdateCopy(repo, *docType, *fieldBuf, Document::getNewestSerializationVersion()); + nbostream stream = serialize(fieldUpdate); + FieldUpdate fieldUpdateCopy(repo, *docType, stream, Document::getNewestSerializationVersion()); CPPUNIT_ASSERT_EQUAL(fieldUpdate, fieldUpdateCopy); // Test that a document update can be serialized |