use of com.yahoo.document.DocumentId in project vespa by vespa-engine.
the class DocumentProtocolTest method requireThat50SerializationPrecedes5xSerialization.
@SuppressWarnings("deprecation")
@Test
public void requireThat50SerializationPrecedes5xSerialization() {
DocumentProtocol protocol = new DocumentProtocol(manager);
GetDocumentMessage prev = new GetDocumentMessage(new DocumentId("doc:scheme:"), "foo");
byte[] buf = protocol.encode(new Version(5, 0), prev);
GetDocumentMessage next = (GetDocumentMessage) protocol.decode(new Version(5, 0), buf);
assertEquals(GetDocumentMessage.DEFAULT_FIELD_SET, next.getFieldSet());
}
use of com.yahoo.document.DocumentId in project vespa by vespa-engine.
the class DocumentRetriever method createDocumentRequest.
private Message createDocumentRequest(String docid, LoadType loadType) {
GetDocumentMessage msg = new GetDocumentMessage(new DocumentId(docid), params.fieldSet);
msg.setPriority(params.priority);
msg.setRetryEnabled(!params.noRetry);
if (loadType != null) {
msg.setLoadType(loadType);
}
return msg;
}
use of com.yahoo.document.DocumentId in project vespa by vespa-engine.
the class BucketStatsRetrieverTest method testRetrieveBucketStats.
@Test
public void testRetrieveBucketStats() throws BucketStatsException {
String docId = "id:ns:type::another";
String bucketInfo = "I like turtles!";
BucketId bucketId = bucketIdFactory.getBucketId(new DocumentId(docId));
StatBucketReply reply = new StatBucketReply();
reply.setResults(bucketInfo);
when(mockedSession.syncSend(any())).thenReturn(reply);
String result = createRetriever().retrieveBucketStats(ClientParameters.SelectionType.DOCUMENT, docId, bucketId, bucketSpace);
verify(mockedSession, times(1)).syncSend(any());
assertEquals(bucketInfo, result);
}
use of com.yahoo.document.DocumentId in project vespa by vespa-engine.
the class BucketStatsRetrieverTest method testRetrieveBucketList.
@Test
public void testRetrieveBucketList() throws BucketStatsException {
String bucketInfo = "I like turtles!";
BucketId bucketId = bucketIdFactory.getBucketId(new DocumentId("id:ns:type::another"));
GetBucketListReply reply = new GetBucketListReply();
reply.getBuckets().add(new GetBucketListReply.BucketInfo(bucketId, bucketInfo));
when(mockedSession.syncSend(any())).thenReturn(reply);
List<GetBucketListReply.BucketInfo> bucketList = createRetriever().retrieveBucketList(bucketId, bucketSpace);
verify(mockedSession, times(1)).syncSend(any());
assertEquals(1, bucketList.size());
assertEquals(bucketInfo, bucketList.get(0).getBucketInformation());
}
use of com.yahoo.document.DocumentId in project vespa by vespa-engine.
the class JsonRendererTestCase method testDocumentId.
@Test
public void testDocumentId() throws IOException, InterruptedException, ExecutionException, JSONException {
String expected = "{\n" + " \"root\": {\n" + " \"children\": [\n" + " {\n" + " \"fields\": {\n" + " \"documentid\": \"id:unittest:smoke::whee\"\n" + " },\n" + " \"id\": \"id:unittest:smoke::whee\",\n" + " \"relevance\": 1.0\n" + " }\n" + " ],\n" + " \"fields\": {\n" + " \"totalCount\": 1\n" + " },\n" + " \"id\": \"toplevel\",\n" + " \"relevance\": 1.0\n" + " }\n" + "}\n";
Result r = newEmptyResult();
Hit h = new Hit("docIdTest");
h.setField("documentid", new DocumentId("id:unittest:smoke::whee"));
r.hits().add(h);
r.setTotalHitCount(1L);
String summary = render(r);
assertEqualJson(expected, summary);
}
Aggregations