Search in sources :

Example 11 with StringFieldValue

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

the class EchoTestCase method requireThatValueIsEchoed.

@Test
public void requireThatValueIsEchoed() {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    ExecutionContext ctx = new ExecutionContext(new SimpleTestAdapter());
    ctx.setValue(new StringFieldValue("69"));
    new EchoExpression(new PrintStream(out)).execute(ctx);
    assertEquals("69" + System.getProperty("line.separator"), out.toString());
}
Also used : PrintStream(java.io.PrintStream) SimpleTestAdapter(com.yahoo.vespa.indexinglanguage.SimpleTestAdapter) StringFieldValue(com.yahoo.document.datatypes.StringFieldValue) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Example 12 with StringFieldValue

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

the class ExecutionContextTestCase method requireThatValueCanBeSet.

@Test
public void requireThatValueCanBeSet() {
    ExecutionContext ctx = new ExecutionContext();
    FieldValue val = new StringFieldValue("foo");
    ctx.setValue(val);
    assertSame(val, ctx.getValue());
}
Also used : StringFieldValue(com.yahoo.document.datatypes.StringFieldValue) StringFieldValue(com.yahoo.document.datatypes.StringFieldValue) FieldValue(com.yahoo.document.datatypes.FieldValue) Test(org.junit.Test)

Example 13 with StringFieldValue

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

the class ExecutionContextTestCase method requireThatClearRemovesVariables.

@Test
public void requireThatClearRemovesVariables() {
    ExecutionContext ctx = new ExecutionContext();
    ctx.setVariable("foo", new StringFieldValue("foo"));
    ctx.clear();
    assertNull(ctx.getVariable("foo"));
}
Also used : StringFieldValue(com.yahoo.document.datatypes.StringFieldValue) Test(org.junit.Test)

Example 14 with StringFieldValue

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

the class ExecutionContextTestCase method requireThatClearRemovesValue.

@Test
public void requireThatClearRemovesValue() {
    ExecutionContext ctx = new ExecutionContext();
    ctx.setValue(new StringFieldValue("foo"));
    ctx.clear();
    assertNull(ctx.getValue());
}
Also used : StringFieldValue(com.yahoo.document.datatypes.StringFieldValue) Test(org.junit.Test)

Example 15 with StringFieldValue

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

the class ExecutionContextTestCase method requireThatLanguageCanBeResolved.

@Test
public void requireThatLanguageCanBeResolved() {
    ExecutionContext ctx = new ExecutionContext();
    ctx.setValue(new StringFieldValue("\u3072\u3089\u304c\u306a"));
    assertEquals(Language.JAPANESE, ctx.resolveLanguage(new SimpleLinguistics()));
    ctx.setValue(new StringFieldValue("\ud55c\uae00\uacfc"));
    assertEquals(Language.KOREAN, ctx.resolveLanguage(new SimpleLinguistics()));
}
Also used : SimpleLinguistics(com.yahoo.language.simple.SimpleLinguistics) StringFieldValue(com.yahoo.document.datatypes.StringFieldValue) Test(org.junit.Test)

Aggregations

StringFieldValue (com.yahoo.document.datatypes.StringFieldValue)210 Test (org.junit.Test)136 FieldValue (com.yahoo.document.datatypes.FieldValue)49 SimpleTestAdapter (com.yahoo.vespa.indexinglanguage.SimpleTestAdapter)40 IntegerFieldValue (com.yahoo.document.datatypes.IntegerFieldValue)37 Document (com.yahoo.document.Document)30 Array (com.yahoo.document.datatypes.Array)25 DocumentType (com.yahoo.document.DocumentType)21 LongFieldValue (com.yahoo.document.datatypes.LongFieldValue)21 Struct (com.yahoo.document.datatypes.Struct)21 DocumentPut (com.yahoo.document.DocumentPut)20 GrowableByteBuffer (com.yahoo.io.GrowableByteBuffer)20 MapFieldValue (com.yahoo.document.datatypes.MapFieldValue)18 SpanTree (com.yahoo.document.annotation.SpanTree)15 FieldUpdate (com.yahoo.document.update.FieldUpdate)15 DocumentUpdate (com.yahoo.document.DocumentUpdate)12 Field (com.yahoo.document.Field)12 Annotation (com.yahoo.document.annotation.Annotation)12 FloatFieldValue (com.yahoo.document.datatypes.FloatFieldValue)12 HashMap (java.util.HashMap)12