use of com.yahoo.documentapi.messagebus.protocol.BatchDocumentUpdateMessage in project vespa by vespa-engine.
the class DocumentProcessingHandlerAllMessageTypesTestCase method batchDocumentUpdate.
private void batchDocumentUpdate() throws InterruptedException {
DocumentUpdate doc1 = new DocumentUpdate(getType(), new DocumentId("userdoc:test:12345:multi:1"));
DocumentUpdate doc2 = new DocumentUpdate(getType(), new DocumentId("userdoc:test:12345:multi:2"));
Field testField = getType().getField("blahblah");
doc1.addFieldUpdate(FieldUpdate.createAssign(testField, new StringFieldValue("1 not yet processed")));
doc2.addFieldUpdate(FieldUpdate.createAssign(testField, new StringFieldValue("2 not yet processed")));
BatchDocumentUpdateMessage message = new BatchDocumentUpdateMessage(12345);
message.addUpdate(doc1);
message.addUpdate(doc2);
assertTrue(sendMessage(FOOBAR, message));
Message remote1 = remoteServer.awaitMessage(60, TimeUnit.SECONDS);
assertTrue(remote1 instanceof UpdateDocumentMessage);
remoteServer.ackMessage(remote1);
assertNull(driver.client().awaitReply(100, TimeUnit.MILLISECONDS));
Message remote2 = remoteServer.awaitMessage(60, TimeUnit.SECONDS);
assertTrue(remote2 instanceof UpdateDocumentMessage);
remoteServer.ackMessage(remote2);
Reply reply = driver.client().awaitReply(60, TimeUnit.SECONDS);
assertNotNull(reply);
assertFalse(reply.hasErrors());
}
Aggregations