use of com.yahoo.io.GrowableByteBuffer in project vespa by vespa-engine.
the class DocumentUpdateTestCase method testThatAssignValueUpdateForTensorFieldCanBeSerializedAndDeserialized.
public void testThatAssignValueUpdateForTensorFieldCanBeSerializedAndDeserialized() {
DocumentUpdate serializedUpdate = createTensorAssignUpdate();
DocumentSerializer serializer = DocumentSerializerFactory.createHead(new GrowableByteBuffer());
serializedUpdate.serialize(serializer);
serializer.getBuf().flip();
DocumentDeserializer deserializer = DocumentDeserializerFactory.createHead(docMan, serializer.getBuf());
DocumentUpdate deserializedUpdate = new DocumentUpdate(deserializer);
assertEquals(serializedUpdate, deserializedUpdate);
}
use of com.yahoo.io.GrowableByteBuffer in project vespa by vespa-engine.
the class AlternateSpanListTestCase method serializeAndAssert.
private void serializeAndAssert(AlternateSpanList alternateSpanList) {
GrowableByteBuffer buffer;
{
buffer = new GrowableByteBuffer(1024);
DocumentSerializer serializer = DocumentSerializerFactory.create42(buffer);
StringFieldValue value = new StringFieldValue("lkj lkj lkj lkj lkj lkj lkj lkj lkj lkj lkj lkj lkj lkj lk");
SpanTree tree = new SpanTree("bababa", alternateSpanList);
value.setSpanTree(tree);
serializer.write(null, value);
buffer.flip();
}
AlternateSpanList alternateSpanList2;
{
DocumentDeserializer deserializer = DocumentDeserializerFactory.create42(man, buffer);
StringFieldValue value = new StringFieldValue();
deserializer.read(null, value);
alternateSpanList2 = (AlternateSpanList) value.getSpanTree("bababa").getRoot();
}
assertEquals(alternateSpanList, alternateSpanList2);
assertNotSame(alternateSpanList, alternateSpanList2);
}
use of com.yahoo.io.GrowableByteBuffer in project vespa by vespa-engine.
the class Bug4261985TestCase method testAnnotate.
@Test
public void testAnnotate() {
DocumentTypeManager manager = new DocumentTypeManager();
DocumentTypeManagerConfigurer.configure(manager, "file:src/test/java/com/yahoo/document/annotation/documentmanager.bug4261985.cfg");
DocumentType type = manager.getDocumentType("blog");
Document doc = new Document(type, "doc:this:is:a:test");
doc.setFieldValue("body", new StringFieldValue("bla bla bla bla bla bla bla" + "bla bla bla bla bla bla bla"));
annotate(doc, manager);
GrowableByteBuffer buf = new GrowableByteBuffer();
doc.serialize(buf);
}
use of com.yahoo.io.GrowableByteBuffer in project vespa by vespa-engine.
the class Bug4259784TestCase method testSerialize.
@Test
public void testSerialize() {
DocumentTypeManager manager = new DocumentTypeManager();
DocumentTypeManagerConfigurer.configure(manager, "file:src/test/java/com/yahoo/document/annotation/documentmanager.bug4259784.cfg");
DocumentType type = manager.getDocumentType("blog");
Document doc = new Document(type, "doc:this:is:a:test");
doc.setFieldValue("body", new StringFieldValue("bla bla bla bla bla bla bla" + "bla bla bla bla bla bla bla"));
annotate(doc, manager);
GrowableByteBuffer buf = new GrowableByteBuffer();
doc.serialize(buf);
}
Aggregations