Search in sources :

Example 11 with DocumentId

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());
}
Also used : Version(com.yahoo.component.Version) DocumentId(com.yahoo.document.DocumentId) Test(org.junit.Test)

Example 12 with DocumentId

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;
}
Also used : GetDocumentMessage(com.yahoo.documentapi.messagebus.protocol.GetDocumentMessage) DocumentId(com.yahoo.document.DocumentId)

Example 13 with DocumentId

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);
}
Also used : StatBucketReply(com.yahoo.documentapi.messagebus.protocol.StatBucketReply) DocumentId(com.yahoo.document.DocumentId) BucketId(com.yahoo.document.BucketId) Test(org.junit.Test)

Example 14 with DocumentId

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());
}
Also used : GetBucketListReply(com.yahoo.documentapi.messagebus.protocol.GetBucketListReply) DocumentId(com.yahoo.document.DocumentId) BucketId(com.yahoo.document.BucketId) Test(org.junit.Test)

Example 15 with DocumentId

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);
}
Also used : FastHit(com.yahoo.prelude.fastsearch.FastHit) Hit(com.yahoo.search.result.Hit) DocumentId(com.yahoo.document.DocumentId) JSONString(com.yahoo.prelude.hitfield.JSONString) Result(com.yahoo.search.Result) Test(org.junit.Test)

Aggregations

DocumentId (com.yahoo.document.DocumentId)61 Test (org.junit.Test)28 DocumentType (com.yahoo.document.DocumentType)20 Document (com.yahoo.document.Document)16 DocumentPut (com.yahoo.document.DocumentPut)12 StringFieldValue (com.yahoo.document.datatypes.StringFieldValue)9 BucketId (com.yahoo.document.BucketId)7 DocumentRemove (com.yahoo.document.DocumentRemove)5 DocumentUpdate (com.yahoo.document.DocumentUpdate)5 BucketIdFactory (com.yahoo.document.BucketIdFactory)4 FieldUpdate (com.yahoo.document.update.FieldUpdate)4 DocumentOperation (com.yahoo.document.DocumentOperation)3 FastHit (com.yahoo.prelude.fastsearch.FastHit)3 Hit (com.yahoo.search.result.Hit)3 HashMap (java.util.HashMap)3 TestDocumentProcessor1 (com.yahoo.docproc.DocumentProcessingAbstractTestCase.TestDocumentProcessor1)2 Field (com.yahoo.document.Field)2 GlobalId (com.yahoo.document.GlobalId)2 StructDataType (com.yahoo.document.StructDataType)2 Struct (com.yahoo.document.datatypes.Struct)2