Search in sources :

Example 16 with FieldPathUpdate

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

the class PathUpdateToDocumentTestCase method requireThatRemoveIsConverted.

@Test
public void requireThatRemoveIsConverted() {
    DocumentType docType = new DocumentType("my_type");
    ArrayDataType arrType = DataType.getArray(DataType.INT);
    docType.addField(new Field("my_arr", arrType));
    FieldPathUpdate upd = new RemoveFieldPathUpdate(docType, "my_arr", "");
    Document doc = FieldPathUpdateHelper.newPartialDocument(null, upd);
    assertNotNull(doc);
    FieldValue obj = doc.getFieldValue("my_arr");
    assertTrue(obj instanceof Array);
    Array arr = (Array) obj;
    assertEquals(0, arr.size());
}
Also used : RemoveFieldPathUpdate(com.yahoo.document.fieldpathupdate.RemoveFieldPathUpdate) AssignFieldPathUpdate(com.yahoo.document.fieldpathupdate.AssignFieldPathUpdate) FieldPathUpdate(com.yahoo.document.fieldpathupdate.FieldPathUpdate) RemoveFieldPathUpdate(com.yahoo.document.fieldpathupdate.RemoveFieldPathUpdate) AddFieldPathUpdate(com.yahoo.document.fieldpathupdate.AddFieldPathUpdate) Test(org.junit.Test)

Aggregations

FieldPathUpdate (com.yahoo.document.fieldpathupdate.FieldPathUpdate)16 AssignFieldPathUpdate (com.yahoo.document.fieldpathupdate.AssignFieldPathUpdate)13 Test (org.junit.Test)11 AddFieldPathUpdate (com.yahoo.document.fieldpathupdate.AddFieldPathUpdate)9 RemoveFieldPathUpdate (com.yahoo.document.fieldpathupdate.RemoveFieldPathUpdate)8 FieldUpdate (com.yahoo.document.update.FieldUpdate)4 IntegerFieldValue (com.yahoo.document.datatypes.IntegerFieldValue)3 StringFieldValue (com.yahoo.document.datatypes.StringFieldValue)3 FieldValue (com.yahoo.document.datatypes.FieldValue)2 Struct (com.yahoo.document.datatypes.Struct)2 ArrayList (java.util.ArrayList)2 ValueUpdate (com.yahoo.document.update.ValueUpdate)1