Search in sources :

Example 86 with DocumentType

use of com.yahoo.document.DocumentType in project vespa by vespa-engine.

the class JsonWriterTestCase method registerRawDocumentType.

private void registerRawDocumentType() {
    DocumentType x = new DocumentType("testraw");
    DataType d = DataType.RAW;
    x.addField(new Field("actualraw", d));
    types.registerDocumentType(x);
}
Also used : Field(com.yahoo.document.Field) DocumentType(com.yahoo.document.DocumentType) DataType(com.yahoo.document.DataType) ArrayDataType(com.yahoo.document.ArrayDataType) StructDataType(com.yahoo.document.StructDataType) MapDataType(com.yahoo.document.MapDataType) PositionDataType(com.yahoo.document.PositionDataType) TensorDataType(com.yahoo.document.TensorDataType) WeightedSetDataType(com.yahoo.document.WeightedSetDataType) ReferenceDataType(com.yahoo.document.ReferenceDataType)

Example 87 with DocumentType

use of com.yahoo.document.DocumentType in project vespa by vespa-engine.

the class PredicateFieldValueSerializationTestCase method createDocType.

private static DocumentType createDocType() {
    DocumentType type = new DocumentType("my_type");
    type.addField(PREDICATE_FIELD, DataType.PREDICATE);
    return type;
}
Also used : DocumentType(com.yahoo.document.DocumentType)

Example 88 with DocumentType

use of com.yahoo.document.DocumentType in project vespa by vespa-engine.

the class SystemTestCase method testSystemTest.

public void testSystemTest() {
    DocumentType type = manager.getDocumentType("article");
    Document inDocument = new Document(type, "doc:article:boringarticle:longarticle");
    annotate(inDocument);
    GrowableByteBuffer buffer = new GrowableByteBuffer();
    DocumentSerializer serializer = DocumentSerializerFactory.create42(buffer);
    serializer.write(inDocument);
    buffer.flip();
    DocumentDeserializer deserializer = DocumentDeserializerFactory.create42(manager, buffer);
    Document outDocument = new Document(deserializer);
    consume(outDocument);
}
Also used : DocumentType(com.yahoo.document.DocumentType) GrowableByteBuffer(com.yahoo.io.GrowableByteBuffer) Document(com.yahoo.document.Document)

Example 89 with DocumentType

use of com.yahoo.document.DocumentType in project vespa by vespa-engine.

the class ReferenceFieldValueTestCase method createDocumentType.

private static DocumentType createDocumentType(String name) {
    DocumentType type = new DocumentType(name);
    type.addField(new Field("foo", DataType.STRING));
    return type;
}
Also used : Field(com.yahoo.document.Field) DocumentType(com.yahoo.document.DocumentType)

Example 90 with DocumentType

use of com.yahoo.document.DocumentType in project vespa by vespa-engine.

the class StringTestCase method testAnnotatorConsumer.

/**
 * Test for bug 4066566. No assertions, but works if it runs without exceptions.
 */
@Test
public void testAnnotatorConsumer() {
    DocumentTypeManager manager = new DocumentTypeManager();
    DocumentTypeManagerConfigurer.configure(manager, "file:src/test/java/com/yahoo/document/datatypes/documentmanager.blog.sd");
    DocumentType blogType = manager.getDocumentType("blog");
    Document doc = new Document(blogType, "doc:blog:http://blogs.sun.com/praveenm");
    doc.setFieldValue("url", new StringFieldValue("http://blogs.sun.com/praveenm"));
    doc.setFieldValue("title", new StringFieldValue("Beginning JavaFX"));
    doc.setFieldValue("author", new StringFieldValue("Praveen Mohan"));
    doc.setFieldValue("body", new StringFieldValue("JavaFX can expand its wings across different domains such as manufacturing, logistics, retail, etc. Many companies have adopted it - IBM, Oracle, Yahoo, Honeywell. Even the non-IT industries such as GE, WIPRO, Ford etc. So it is a success for Christopher Oliver and Richard Bair. Scott Mcnealy is happy"));
    doc = annotate(doc, manager);
    doc = serializeAndDeserialize(doc, manager);
    doc = consume(doc, manager);
    System.err.println(doc);
}
Also used : DocumentTypeManager(com.yahoo.document.DocumentTypeManager) DocumentType(com.yahoo.document.DocumentType) Document(com.yahoo.document.Document) Test(org.junit.Test) AbstractTypesTest(com.yahoo.document.annotation.AbstractTypesTest)

Aggregations

DocumentType (com.yahoo.document.DocumentType)98 Test (org.junit.Test)45 Document (com.yahoo.document.Document)41 DocumentPut (com.yahoo.document.DocumentPut)35 Field (com.yahoo.document.Field)24 StringFieldValue (com.yahoo.document.datatypes.StringFieldValue)24 DocumentId (com.yahoo.document.DocumentId)20 ByteArrayInputStream (java.io.ByteArrayInputStream)19 InputStream (java.io.InputStream)19 DocumentTypeManager (com.yahoo.document.DocumentTypeManager)17 DocumentParseInfo (com.yahoo.document.json.readers.DocumentParseInfo)17 VespaJsonDocumentReader (com.yahoo.document.json.readers.VespaJsonDocumentReader)17 DocumentUpdate (com.yahoo.document.DocumentUpdate)15 IntegerFieldValue (com.yahoo.document.datatypes.IntegerFieldValue)15 StructDataType (com.yahoo.document.StructDataType)14 TensorDataType (com.yahoo.document.TensorDataType)12 TensorFieldValue (com.yahoo.document.datatypes.TensorFieldValue)11 ArrayDataType (com.yahoo.document.ArrayDataType)10 MapDataType (com.yahoo.document.MapDataType)10 ReferenceDataType (com.yahoo.document.ReferenceDataType)10