Search in sources :

Example 16 with PutDocumentMessage

use of com.yahoo.documentapi.messagebus.protocol.PutDocumentMessage in project vespa by vespa-engine.

the class VisitorDataQueueTest method multiple_messages_are_enqueued_and_dequeued_in_fifo_order.

@Test
public void multiple_messages_are_enqueued_and_dequeued_in_fifo_order() {
    final VisitorDataQueue queue = new VisitorDataQueue();
    final PutDocumentMessage firstPut = createPutMessage("id:foo:testdoc::foo");
    final PutDocumentMessage secondPut = createPutMessage("id:foo:testdoc::baz");
    queue.onMessage(firstPut, createDummyAckToken());
    queue.onMessage(createRemoveMessage("id:foo:testdoc::bar"), createDummyAckToken());
    queue.onMessage(secondPut, createDummyAckToken());
    queue.onMessage(createRemoveMessage("id:foo:testdoc::fleeb"), createDummyAckToken());
    assertResponseHasSinglePut(queue.getNext(), firstPut.getDocumentPut());
    assertResponseHasSingleRemove(queue.getNext(), "id:foo:testdoc::bar");
    assertResponseHasSinglePut(queue.getNext(), secondPut.getDocumentPut());
    assertResponseHasSingleRemove(queue.getNext(), "id:foo:testdoc::fleeb");
}
Also used : PutDocumentMessage(com.yahoo.documentapi.messagebus.protocol.PutDocumentMessage) Test(org.junit.Test)

Aggregations

PutDocumentMessage (com.yahoo.documentapi.messagebus.protocol.PutDocumentMessage)16 DocumentPut (com.yahoo.document.DocumentPut)5 RemoveDocumentMessage (com.yahoo.documentapi.messagebus.protocol.RemoveDocumentMessage)5 Message (com.yahoo.messagebus.Message)5 Test (org.junit.Test)5 UpdateDocumentMessage (com.yahoo.documentapi.messagebus.protocol.UpdateDocumentMessage)4 StringFieldValue (com.yahoo.document.datatypes.StringFieldValue)3 Reply (com.yahoo.messagebus.Reply)3 Document (com.yahoo.document.Document)2 DocumentMessage (com.yahoo.documentapi.messagebus.protocol.DocumentMessage)2 Splitter (com.google.common.base.Splitter)1 Tuple2 (com.yahoo.collections.Tuple2)1 HttpRequest (com.yahoo.container.jdisc.HttpRequest)1 HttpResponse (com.yahoo.container.jdisc.HttpResponse)1 SessionCache (com.yahoo.container.jdisc.messagebus.SessionCache)1 AccessLog (com.yahoo.container.logging.AccessLog)1 DataType (com.yahoo.document.DataType)1 DocumentOperation (com.yahoo.document.DocumentOperation)1 DocumentType (com.yahoo.document.DocumentType)1 DocumentTypeManager (com.yahoo.document.DocumentTypeManager)1