diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2018-09-13 10:51:55 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2018-09-13 10:51:55 +0200 |
commit | e6c49f90583b8e13bf900be110d4aa4cb99a26cf (patch) | |
tree | 79bf053442cae3b032178db3c9c07cad11ef2eef | |
parent | fb0aa3e2df91dec55dcdcee6dfcfabf88fdedf5d (diff) |
Add deprecation comments and some renaming.
16 files changed, 98 insertions, 71 deletions
diff --git a/docproc/src/main/java/com/yahoo/docproc/proxy/ProxyDocumentUpdate.java b/docproc/src/main/java/com/yahoo/docproc/proxy/ProxyDocumentUpdate.java index 39186555883..fe09f794de0 100644 --- a/docproc/src/main/java/com/yahoo/docproc/proxy/ProxyDocumentUpdate.java +++ b/docproc/src/main/java/com/yahoo/docproc/proxy/ProxyDocumentUpdate.java @@ -41,11 +41,13 @@ public class ProxyDocumentUpdate extends DocumentUpdate implements DocumentOpera } @Override + @Deprecated public FieldUpdate getFieldUpdate(Field field) { return getFieldUpdate(field.getName()); } @Override + @Deprecated @SuppressWarnings( "deprecation" ) public FieldUpdate getFieldUpdate(int index) { return docU.getFieldUpdate(index); @@ -62,13 +64,14 @@ public class ProxyDocumentUpdate extends DocumentUpdate implements DocumentOpera } @Override + @Deprecated @SuppressWarnings( "deprecation" ) public List<FieldUpdate> getFieldUpdates() { return docU.getFieldUpdates(); } @Override - public Collection<FieldUpdate> getFieldUpdatesCollection() { - return docU.getFieldUpdatesCollection(); + public Collection<FieldUpdate> fieldUpdates() { + return docU.fieldUpdates(); } @Override public DocumentId getId() { diff --git a/docproc/src/test/java/com/yahoo/docproc/proxy/SchemaMappingAndAccessesTest.java b/docproc/src/test/java/com/yahoo/docproc/proxy/SchemaMappingAndAccessesTest.java index c8ac2e31585..9b61686ad6a 100644 --- a/docproc/src/test/java/com/yahoo/docproc/proxy/SchemaMappingAndAccessesTest.java +++ b/docproc/src/test/java/com/yahoo/docproc/proxy/SchemaMappingAndAccessesTest.java @@ -334,10 +334,10 @@ public class SchemaMappingAndAccessesTest { fieldMap.put("a", "artist"); ProxyDocumentUpdate pup = new ProxyDocumentUpdate(dud, fieldMap); pup.addFieldUpdate(assignSingle); - assertEquals(pup.getFieldUpdatesCollection().toString(), dud.getFieldUpdatesCollection().toString()); + assertEquals(pup.fieldUpdates().toString(), dud.fieldUpdates().toString()); assertEquals(pup.getDocumentType(), dud.getDocumentType()); assertEquals(pup.getFieldUpdate(new com.yahoo.document.Field("title")).size(), 1); - assertEquals(pup.getFieldUpdate(0), dud.getFieldUpdatesCollection().iterator().next()); + assertEquals(pup.getFieldUpdate(0), dud.fieldUpdates().iterator().next()); assertEquals(pup.getFieldUpdate("title"), dud.getFieldUpdate("title")); assertEquals(pup.getId(), dud.getId()); assertEquals(pup.getType(), dud.getType()); diff --git a/docprocs/src/main/java/com/yahoo/docprocs/indexing/DocumentScript.java b/docprocs/src/main/java/com/yahoo/docprocs/indexing/DocumentScript.java index 088d6d0ecaf..62be2868708 100644 --- a/docprocs/src/main/java/com/yahoo/docprocs/indexing/DocumentScript.java +++ b/docprocs/src/main/java/com/yahoo/docprocs/indexing/DocumentScript.java @@ -51,7 +51,7 @@ public class DocumentScript { } public DocumentUpdate execute(AdapterFactory adapterFactory, DocumentUpdate update) { - for (FieldUpdate fieldUpdate : update.getFieldUpdatesCollection()) { + for (FieldUpdate fieldUpdate : update.fieldUpdates()) { requireThatFieldIsDeclaredInDocument(fieldUpdate.getField()); for (ValueUpdate<?> valueUpdate : fieldUpdate.getValueUpdates()) { removeAnyLinguisticsSpanTree(valueUpdate); diff --git a/docprocs/src/test/java/com/yahoo/docprocs/indexing/DocumentScriptTestCase.java b/docprocs/src/test/java/com/yahoo/docprocs/indexing/DocumentScriptTestCase.java index 41fd72e2336..c0a5cfd2153 100644 --- a/docprocs/src/test/java/com/yahoo/docprocs/indexing/DocumentScriptTestCase.java +++ b/docprocs/src/test/java/com/yahoo/docprocs/indexing/DocumentScriptTestCase.java @@ -230,7 +230,7 @@ public class DocumentScriptTestCase { DocumentUpdate update = f.executeWithUpdate("structfield", new AssignFieldPathUpdate(f.type, "structfield.title", newTitleValue)); assertEquals(1, update.getFieldPathUpdates().size()); - assertEquals(0, update.getFieldUpdatesCollection().size()); + assertEquals(0, update.fieldUpdates().size()); assertTrue(update.getFieldPathUpdates().get(0) instanceof AssignFieldPathUpdate); AssignFieldPathUpdate assignUpdate = (AssignFieldPathUpdate)update.getFieldPathUpdates().get(0); assertEquals("structfield.title", assignUpdate.getOriginalFieldPath()); diff --git a/docprocs/src/test/java/com/yahoo/docprocs/indexing/IndexingProcessorTestCase.java b/docprocs/src/test/java/com/yahoo/docprocs/indexing/IndexingProcessorTestCase.java index a0dd0ac9b89..5979672524d 100644 --- a/docprocs/src/test/java/com/yahoo/docprocs/indexing/IndexingProcessorTestCase.java +++ b/docprocs/src/test/java/com/yahoo/docprocs/indexing/IndexingProcessorTestCase.java @@ -13,7 +13,6 @@ import com.yahoo.document.datatypes.StringFieldValue; import com.yahoo.document.update.AssignValueUpdate; import com.yahoo.document.update.FieldUpdate; import com.yahoo.document.update.ValueUpdate; -import com.yahoo.language.Linguistics; import com.yahoo.language.simple.SimpleLinguistics; import com.yahoo.vespa.configdefinition.IlscriptsConfig; import org.junit.Test; @@ -63,7 +62,7 @@ public class IndexingProcessorTestCase { assertTrue(output instanceof DocumentUpdate); DocumentUpdate docUpdate = (DocumentUpdate) output; - assertEquals(3, docUpdate.getFieldUpdatesCollection().size()); + assertEquals(3, docUpdate.fieldUpdates().size()); { FieldUpdate fieldUpdate = docUpdate.getFieldUpdate("song"); assertEquals("song", fieldUpdate.getField().getName()); diff --git a/document/src/main/java/com/yahoo/document/DocumentUpdate.java b/document/src/main/java/com/yahoo/document/DocumentUpdate.java index 4f8e3ef3b82..bbd5cfe75fe 100644 --- a/document/src/main/java/com/yahoo/document/DocumentUpdate.java +++ b/document/src/main/java/com/yahoo/document/DocumentUpdate.java @@ -40,6 +40,8 @@ import java.util.Optional; * @see com.yahoo.document.update.FieldUpdate * @see com.yahoo.document.update.ValueUpdate */ +//TODO Vespa 7 Remove all deprecated methods + public class DocumentUpdate extends DocumentOperation implements Iterable<FieldPathUpdate> { //see src/vespa/document/util/identifiableid.h @@ -169,6 +171,7 @@ public class DocumentUpdate extends DocumentOperation implements Iterable<FieldP * Get an unmodifiable list of all field updates that this document update specifies. * * @return a list of all FieldUpdates in this DocumentUpdate + * @deprecated Use fieldUpdates() instead. */ @Deprecated public List<FieldUpdate> getFieldUpdates() { @@ -178,9 +181,9 @@ public class DocumentUpdate extends DocumentOperation implements Iterable<FieldP /** * Get an unmodifiable collection of all field updates that this document update specifies. * - * @return a list of all FieldUpdates in this DocumentUpdate + * @return a collection of all FieldUpdates in this DocumentUpdate */ - public Collection<FieldUpdate> getFieldUpdatesCollection() { + public Collection<FieldUpdate> fieldUpdates() { return Collections.unmodifiableCollection(id2FieldUpdateMap.values()); } @@ -188,11 +191,22 @@ public class DocumentUpdate extends DocumentOperation implements Iterable<FieldP * Get an unmodifiable list of all field path updates this document update specifies. * * @return Returns a list of all field path updates in this document update. + * @deprecated Use fieldPathUpdates() instead. */ + @Deprecated public List<FieldPathUpdate> getFieldPathUpdates() { return Collections.unmodifiableList(fieldPathUpdates); } + /** + * Get an unmodifiable collection of all field path updates that this document update specifies. + * + * @return a collection of all FieldPathUpdates in this DocumentUpdate + */ + public Collection<FieldPathUpdate> fieldPathUpdates() { + return Collections.unmodifiableCollection(fieldPathUpdates); + } + /** Returns the type of the document this updates * * @return The documentype of the document @@ -215,6 +229,7 @@ public class DocumentUpdate extends DocumentOperation implements Iterable<FieldP * @param index the index of the FieldUpdate to return * @return the FieldUpdate at the specified index * @throws IndexOutOfBoundsException if index is out of range + * @deprecated use getFieldUpdate(Field field) instead. */ @Deprecated public FieldUpdate getFieldUpdate(int index) { @@ -228,6 +243,7 @@ public class DocumentUpdate extends DocumentOperation implements Iterable<FieldP * @param upd the FieldUpdate to be stored at the specified position * @return the FieldUpdate previously at the specified position * @throws IndexOutOfBoundsException if index is out of range + * @deprecated Use removeFieldUpdate/addFieldUpdate instead */ @Deprecated public FieldUpdate setFieldUpdate(int index, FieldUpdate upd) { @@ -274,11 +290,14 @@ public class DocumentUpdate extends DocumentOperation implements Iterable<FieldP * * @param fieldUpdates the new list of updates of this * @throws NullPointerException if the argument passed is null + * @deprecated Iterate and use addFieldUpdate instead */ + @Deprecated public void setFieldUpdates(Collection<FieldUpdate> fieldUpdates) { if (fieldUpdates == null) { throw new NullPointerException("The field updates of a document update can not be null"); } + fieldUpdates.clear(); for (FieldUpdate fieldUpdate : fieldUpdates) { addFieldUpdate(fieldUpdate); } @@ -347,7 +366,7 @@ public class DocumentUpdate extends DocumentOperation implements Iterable<FieldP if (!documentType.equals(update.documentType)) { throw new IllegalArgumentException("Expected " + documentType + ", got " + update.documentType + "."); } - for (FieldUpdate fieldUpd : update.id2FieldUpdateMap.values()) { + for (FieldUpdate fieldUpd : update.fieldUpdates()) { addFieldUpdate(fieldUpd); } for (FieldPathUpdate pathUpd : update.fieldPathUpdates) { @@ -361,6 +380,7 @@ public class DocumentUpdate extends DocumentOperation implements Iterable<FieldP * @param index the index of the FieldUpdate to remove * @return the FieldUpdate previously at the specified position * @throws IndexOutOfBoundsException if index is out of range + * @deprecated use removeFieldUpdate(Field field) instead. */ @Deprecated public FieldUpdate removeFieldUpdate(int index) { diff --git a/document/src/main/java/com/yahoo/document/json/DocumentUpdateJsonSerializer.java b/document/src/main/java/com/yahoo/document/json/DocumentUpdateJsonSerializer.java index 5b1dda0f71c..6adae27cadc 100644 --- a/document/src/main/java/com/yahoo/document/json/DocumentUpdateJsonSerializer.java +++ b/document/src/main/java/com/yahoo/document/json/DocumentUpdateJsonSerializer.java @@ -47,6 +47,7 @@ import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.Optional; import java.util.regex.Matcher; @@ -105,11 +106,11 @@ public class DocumentUpdateJsonSerializer } generator.writeObjectFieldStart("fields"); - for (FieldUpdate up : update.getFieldUpdatesCollection()) { + for (FieldUpdate up : update.fieldUpdates()) { up.serialize(this); } - update.getFieldPathUpdates().stream() + update.fieldPathUpdates().stream() .collect(Collectors.groupingBy(FieldPathUpdate::getFieldPath)) .forEach((fieldPath, fieldPathUpdates) -> wrapIOException(() -> write(fieldPath, fieldPathUpdates, generator))); @@ -120,7 +121,7 @@ public class DocumentUpdateJsonSerializer }); } - private void write(FieldPath fieldPath, List<FieldPathUpdate> fieldPathUpdates, JsonGenerator generator) throws IOException { + private void write(FieldPath fieldPath, Collection<FieldPathUpdate> fieldPathUpdates, JsonGenerator generator) throws IOException { generator.writeObjectFieldStart(fieldPath.toString()); for (FieldPathUpdate update : fieldPathUpdates) { diff --git a/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java b/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java index b04fece0ef4..cf8161c4306 100644 --- a/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java +++ b/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java @@ -3,7 +3,6 @@ package com.yahoo.document; import com.yahoo.document.datatypes.*; import com.yahoo.document.fieldpathupdate.FieldPathUpdate; -import com.yahoo.document.select.parser.ParseException; import com.yahoo.document.serialization.*; import com.yahoo.document.update.AssignValueUpdate; import com.yahoo.document.update.FieldUpdate; @@ -259,7 +258,7 @@ public class DocumentUpdateTestCase { update.addFieldUpdate(FieldUpdate.createAssign(field, new IntegerFieldValue(1))); update.addFieldUpdate(FieldUpdate.createAssign(field, new IntegerFieldValue(2))); - assertEquals(1, update.getFieldUpdatesCollection().size()); + assertEquals(1, update.fieldUpdates().size()); FieldUpdate fieldUpdate = update.getFieldUpdate(field); assertNotNull(fieldUpdate); assertEquals(field, fieldUpdate.getField()); @@ -418,7 +417,7 @@ public class DocumentUpdateTestCase { barUpdate.addFieldUpdate(barField); fooUpdate.addAll(barUpdate); - assertEquals(1, fooUpdate.getFieldUpdatesCollection().size()); + assertEquals(1, fooUpdate.fieldUpdates().size()); FieldUpdate fieldUpdate = fooUpdate.getFieldUpdate(field); assertNotNull(fieldUpdate); assertEquals(field, fieldUpdate.getField()); @@ -463,6 +462,7 @@ public class DocumentUpdateTestCase { } @Test + @SuppressWarnings("deprecation") public void testFieldUpdatesInDocUp() { DocumentType t1 = new DocumentType("doo"); Field f1 = new Field("field1", DataType.STRING); diff --git a/document/src/test/java/com/yahoo/document/json/JsonReaderTestCase.java b/document/src/test/java/com/yahoo/document/json/JsonReaderTestCase.java index b1f114bfbc5..32f63e6c0b3 100644 --- a/document/src/test/java/com/yahoo/document/json/JsonReaderTestCase.java +++ b/document/src/test/java/com/yahoo/document/json/JsonReaderTestCase.java @@ -292,8 +292,8 @@ public class JsonReaderTestCase { + "\"skuggsjaa\": {" + "\"assign\": { \"sandra\": \"person\"," + " \"cloud\": \"another person\"}}}}"); - assertEquals(1, put.getFieldUpdatesCollection().size()); - FieldUpdate fu = put.getFieldUpdatesCollection().iterator().next(); + assertEquals(1, put.fieldUpdates().size()); + FieldUpdate fu = put.fieldUpdates().iterator().next(); assertEquals(1, fu.getValueUpdates().size()); ValueUpdate vu = fu.getValueUpdate(0); assertTrue(vu instanceof AssignValueUpdate); @@ -315,8 +315,8 @@ public class JsonReaderTestCase { + " \"fields\": { " + "\"skuggsjaa\": {" + "\"assign\": { }}}}"); - assertEquals(1, put.getFieldUpdatesCollection().size()); - FieldUpdate fu = put.getFieldUpdatesCollection().iterator().next(); + assertEquals(1, put.fieldUpdates().size()); + FieldUpdate fu = put.fieldUpdates().iterator().next(); assertEquals(1, fu.getValueUpdates().size()); ValueUpdate vu = fu.getValueUpdate(0); assertTrue(vu instanceof AssignValueUpdate); diff --git a/document/src/test/java/com/yahoo/vespaxmlparser/UriParserTestCase.java b/document/src/test/java/com/yahoo/vespaxmlparser/UriParserTestCase.java index 7b855818721..dcdea0975ad 100644 --- a/document/src/test/java/com/yahoo/vespaxmlparser/UriParserTestCase.java +++ b/document/src/test/java/com/yahoo/vespaxmlparser/UriParserTestCase.java @@ -46,8 +46,8 @@ public class UriParserTestCase { DocumentUpdate upd = nextUpdate(it); assertNotNull(upd); - assertEquals(1, upd.getFieldUpdatesCollection().size()); - FieldUpdate fieldUpd = upd.getFieldUpdatesCollection().iterator().next(); + assertEquals(1, upd.fieldUpdates().size()); + FieldUpdate fieldUpd = upd.fieldUpdates().iterator().next(); assertNotNull(fieldUpd); assertEquals(docType.getField("my_arr"), fieldUpd.getField()); assertEquals(1, fieldUpd.getValueUpdates().size()); diff --git a/document/src/test/java/com/yahoo/vespaxmlparser/VespaXMLReaderTestCase.java b/document/src/test/java/com/yahoo/vespaxmlparser/VespaXMLReaderTestCase.java index 4c64f7c35cb..1aad59f4c56 100755 --- a/document/src/test/java/com/yahoo/vespaxmlparser/VespaXMLReaderTestCase.java +++ b/document/src/test/java/com/yahoo/vespaxmlparser/VespaXMLReaderTestCase.java @@ -5,6 +5,7 @@ import com.yahoo.document.*; import com.yahoo.document.datatypes.*; import com.yahoo.document.fieldpathupdate.AddFieldPathUpdate; import com.yahoo.document.fieldpathupdate.AssignFieldPathUpdate; +import com.yahoo.document.fieldpathupdate.FieldPathUpdate; import com.yahoo.document.fieldpathupdate.RemoveFieldPathUpdate; import com.yahoo.document.serialization.DeserializationException; import com.yahoo.document.update.AddValueUpdate; @@ -16,6 +17,7 @@ import org.junit.Before; import org.junit.Test; import java.io.ByteArrayInputStream; +import java.util.Iterator; import java.util.List; import static org.junit.Assert.*; @@ -687,103 +689,105 @@ public class VespaXMLReaderTestCase { DocumentUpdate docUpdate = op.getDocumentUpdate(); - assertEquals(20, docUpdate.getFieldPathUpdates().size()); + assertEquals(20, docUpdate.fieldPathUpdates().size()); + Iterator<FieldPathUpdate> updates = docUpdate.fieldPathUpdates().iterator(); { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(0); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); assertEquals("url", ass.getOriginalFieldPath()); assertEquals(new StringFieldValue("assignUrl"), ass.getNewValue()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(1); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); assertEquals("title", ass.getOriginalFieldPath()); assertEquals(new StringFieldValue("assignTitle"), ass.getNewValue()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(2); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); assertEquals("last_downloaded", ass.getOriginalFieldPath()); assertEquals("1", ass.getExpression()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(3); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); assertEquals("value_long", ass.getOriginalFieldPath()); assertEquals("2", ass.getExpression()); } + updates.next(); // Skip number 5 { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(5); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); assertEquals("stringarr", ass.getOriginalFieldPath()); assertEquals("[assignString1, assignString2]", ass.getNewValue().toString()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(6); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); assertEquals("intarr", ass.getOriginalFieldPath()); assertEquals("[3, 4]", ass.getNewValue().toString()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(7); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); assertEquals("longarr", ass.getOriginalFieldPath()); assertEquals("[5, 6]", ass.getNewValue().toString()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(8); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); assertEquals("bytearr", ass.getOriginalFieldPath()); assertEquals("[7, 8]", ass.getNewValue().toString()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(9); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); assertEquals("floatarr", ass.getOriginalFieldPath()); assertEquals("[9.0, 10.0]", ass.getNewValue().toString()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(10); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); assertEquals("weightedsetint", ass.getOriginalFieldPath()); WeightedSet set = (WeightedSet)ass.getNewValue(); assertEquals(Integer.valueOf(11), set.get(new IntegerFieldValue(11))); assertEquals(Integer.valueOf(12), set.get(new IntegerFieldValue(12))); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(11); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); assertEquals("weightedsetstring", ass.getOriginalFieldPath()); WeightedSet set = (WeightedSet)ass.getNewValue(); assertEquals(Integer.valueOf(13), set.get(new StringFieldValue("assign13"))); assertEquals(Integer.valueOf(14), set.get(new StringFieldValue("assign14"))); } { - AddFieldPathUpdate ass = (AddFieldPathUpdate)docUpdate.getFieldPathUpdates().get(12); + AddFieldPathUpdate ass = (AddFieldPathUpdate)updates.next(); assertEquals("stringarr", ass.getOriginalFieldPath()); assertEquals("[addString1, addString2]", ass.getNewValues().toString()); } { - AddFieldPathUpdate ass = (AddFieldPathUpdate)docUpdate.getFieldPathUpdates().get(13); + AddFieldPathUpdate ass = (AddFieldPathUpdate)updates.next(); assertEquals("longarr", ass.getOriginalFieldPath()); assertEquals("[5]", ass.getNewValues().toString()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(14); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); assertEquals("weightedsetint{13}", ass.getOriginalFieldPath()); assertEquals("13", ass.getExpression()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(15); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); assertEquals("weightedsetint{14}", ass.getOriginalFieldPath()); assertEquals("14", ass.getExpression()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(16); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); assertEquals("weightedsetstring{add13}", ass.getOriginalFieldPath()); assertEquals("1", ass.getExpression()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(17); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); assertEquals("weightedsetstring{assign13}", ass.getOriginalFieldPath()); assertEquals("130", ass.getExpression()); } { - RemoveFieldPathUpdate ass = (RemoveFieldPathUpdate)docUpdate.getFieldPathUpdates().get(18); + RemoveFieldPathUpdate ass = (RemoveFieldPathUpdate)updates.next(); assertEquals("weightedsetstring{assign14}", ass.getOriginalFieldPath()); } { - RemoveFieldPathUpdate ass = (RemoveFieldPathUpdate)docUpdate.getFieldPathUpdates().get(19); + RemoveFieldPathUpdate ass = (RemoveFieldPathUpdate)updates.next(); assertEquals("bytearr", ass.getOriginalFieldPath()); } Document doc = new Document(manager.getDocumentType("news"), new DocumentId("doc:test:test:test")); diff --git a/indexinglanguage/src/main/java/com/yahoo/vespa/indexinglanguage/SimpleAdapterFactory.java b/indexinglanguage/src/main/java/com/yahoo/vespa/indexinglanguage/SimpleAdapterFactory.java index ee5896b2e0d..2ccd8abffda 100644 --- a/indexinglanguage/src/main/java/com/yahoo/vespa/indexinglanguage/SimpleAdapterFactory.java +++ b/indexinglanguage/src/main/java/com/yahoo/vespa/indexinglanguage/SimpleAdapterFactory.java @@ -57,7 +57,7 @@ public class SimpleAdapterFactory implements AdapterFactory { ret.add(new IdentityFieldPathUpdateAdapter(fieldUpd, newDocumentAdapter(complete, true))); } } - for (FieldUpdate fieldUpd : upd.getFieldUpdatesCollection()) { + for (FieldUpdate fieldUpd : upd.fieldUpdates()) { Field field = fieldUpd.getField(); for (ValueUpdate valueUpd : fieldUpd.getValueUpdates()) { if (FieldUpdateHelper.isComplete(field, valueUpd)) { diff --git a/indexinglanguage/src/test/java/com/yahoo/vespa/indexinglanguage/DocumentToValueUpdateTestCase.java b/indexinglanguage/src/test/java/com/yahoo/vespa/indexinglanguage/DocumentToValueUpdateTestCase.java index af094744832..83947b5f64d 100644 --- a/indexinglanguage/src/test/java/com/yahoo/vespa/indexinglanguage/DocumentToValueUpdateTestCase.java +++ b/indexinglanguage/src/test/java/com/yahoo/vespa/indexinglanguage/DocumentToValueUpdateTestCase.java @@ -40,8 +40,8 @@ public class DocumentToValueUpdateTestCase { UpdateAdapter adapter = FieldUpdateAdapter.fromPartialUpdate(new SimpleDocumentAdapter(null, doc), valueUpd); DocumentUpdate docUpd = adapter.getOutput(); assertNotNull(docUpd); - assertEquals(1, docUpd.getFieldUpdatesCollection().size()); - assertEquals("my_int", docUpd.getFieldUpdatesCollection().iterator().next().getField().getName()); + assertEquals(1, docUpd.fieldUpdates().size()); + assertEquals("my_int", docUpd.fieldUpdates().iterator().next().getField().getName()); } @Test @@ -56,9 +56,9 @@ public class DocumentToValueUpdateTestCase { UpdateAdapter adapter = FieldUpdateAdapter.fromPartialUpdate(new SimpleDocumentAdapter(null, doc), valueUpd); DocumentUpdate docUpd = adapter.getOutput(); assertNotNull(docUpd); - assertEquals(1, docUpd.getFieldUpdatesCollection().size()); + assertEquals(1, docUpd.fieldUpdates().size()); - FieldUpdate fieldUpd = docUpd.getFieldUpdatesCollection().iterator().next(); + FieldUpdate fieldUpd = docUpd.fieldUpdates().iterator().next(); assertNotNull(fieldUpd); assertEquals(docType.getField("my_int"), fieldUpd.getField()); @@ -80,9 +80,9 @@ public class DocumentToValueUpdateTestCase { UpdateAdapter adapter = FieldUpdateAdapter.fromPartialUpdate(new SimpleDocumentAdapter(null, doc), valueUpd); DocumentUpdate docUpd = adapter.getOutput(); assertNotNull(docUpd); - assertEquals(1, docUpd.getFieldUpdatesCollection().size()); + assertEquals(1, docUpd.fieldUpdates().size()); - FieldUpdate fieldUpd = docUpd.getFieldUpdatesCollection().iterator().next(); + FieldUpdate fieldUpd = docUpd.fieldUpdates().iterator().next(); assertNotNull(fieldUpd); assertEquals(docType.getField("my_int"), fieldUpd.getField()); @@ -103,9 +103,9 @@ public class DocumentToValueUpdateTestCase { UpdateAdapter adapter = FieldUpdateAdapter.fromPartialUpdate(new SimpleDocumentAdapter(null, doc), valueUpd); DocumentUpdate docUpd = adapter.getOutput(); assertNotNull(docUpd); - assertEquals(1, docUpd.getFieldUpdatesCollection().size()); + assertEquals(1, docUpd.fieldUpdates().size()); - FieldUpdate fieldUpd = docUpd.getFieldUpdatesCollection().iterator().next(); + FieldUpdate fieldUpd = docUpd.fieldUpdates().iterator().next(); assertNotNull(fieldUpd); assertEquals(docType.getField("my_str"), fieldUpd.getField()); @@ -136,9 +136,9 @@ public class DocumentToValueUpdateTestCase { UpdateAdapter adapter = FieldUpdateAdapter.fromPartialUpdate(new SimpleDocumentAdapter(null, doc), valueUpd); DocumentUpdate docUpd = adapter.getOutput(); assertNotNull(docUpd); - assertEquals(1, docUpd.getFieldUpdatesCollection().size()); + assertEquals(1, docUpd.fieldUpdates().size()); - FieldUpdate fieldUpd = docUpd.getFieldUpdatesCollection().iterator().next(); + FieldUpdate fieldUpd = docUpd.fieldUpdates().iterator().next(); assertNotNull(fieldUpd); assertEquals(docType.getField("a"), fieldUpd.getField()); @@ -166,9 +166,9 @@ public class DocumentToValueUpdateTestCase { UpdateAdapter adapter = FieldUpdateAdapter.fromPartialUpdate(new SimpleDocumentAdapter(null, doc), valueUpd); DocumentUpdate docUpd = adapter.getOutput(); assertNotNull(docUpd); - assertEquals(1, docUpd.getFieldUpdatesCollection().size()); + assertEquals(1, docUpd.fieldUpdates().size()); - FieldUpdate fieldUpd = docUpd.getFieldUpdatesCollection().iterator().next(); + FieldUpdate fieldUpd = docUpd.fieldUpdates().iterator().next(); assertNotNull(fieldUpd); assertEquals(docType.getField("my_arr"), fieldUpd.getField()); @@ -196,9 +196,9 @@ public class DocumentToValueUpdateTestCase { UpdateAdapter adapter = FieldUpdateAdapter.fromPartialUpdate(new SimpleDocumentAdapter(null, doc), valueUpd); DocumentUpdate docUpd = adapter.getOutput(); assertNotNull(docUpd); - assertEquals(1, docUpd.getFieldUpdatesCollection().size()); + assertEquals(1, docUpd.fieldUpdates().size()); - FieldUpdate fieldUpd = docUpd.getFieldUpdatesCollection().iterator().next(); + FieldUpdate fieldUpd = docUpd.fieldUpdates().iterator().next(); assertNotNull(fieldUpd); assertEquals(docType.getField("my_arr"), fieldUpd.getField()); @@ -231,9 +231,9 @@ public class DocumentToValueUpdateTestCase { UpdateAdapter adapter = FieldUpdateAdapter.fromPartialUpdate(new SimpleDocumentAdapter(null, doc), valueUpd); DocumentUpdate docUpd = adapter.getOutput(); assertNotNull(docUpd); - assertEquals(1, docUpd.getFieldUpdatesCollection().size()); + assertEquals(1, docUpd.fieldUpdates().size()); - FieldUpdate fieldUpd = docUpd.getFieldUpdatesCollection().iterator().next(); + FieldUpdate fieldUpd = docUpd.fieldUpdates().iterator().next(); assertNotNull(fieldUpd); assertEquals(docType.getField("a"), fieldUpd.getField()); @@ -261,9 +261,9 @@ public class DocumentToValueUpdateTestCase { UpdateAdapter adapter = FieldUpdateAdapter.fromPartialUpdate(new SimpleDocumentAdapter(null, doc), valueUpd); DocumentUpdate docUpd = adapter.getOutput(); assertNotNull(docUpd); - assertEquals(1, docUpd.getFieldUpdatesCollection().size()); + assertEquals(1, docUpd.fieldUpdates().size()); - FieldUpdate fieldUpd = docUpd.getFieldUpdatesCollection().iterator().next(); + FieldUpdate fieldUpd = docUpd.fieldUpdates().iterator().next(); assertNotNull(fieldUpd); assertEquals(docType.getField("my_wset"), fieldUpd.getField()); @@ -294,9 +294,9 @@ public class DocumentToValueUpdateTestCase { UpdateAdapter adapter = FieldUpdateAdapter.fromPartialUpdate(new SimpleDocumentAdapter(null, doc), valueUpd); DocumentUpdate docUpd = adapter.getOutput(); assertNotNull(docUpd); - assertEquals(1, docUpd.getFieldUpdatesCollection().size()); + assertEquals(1, docUpd.fieldUpdates().size()); - FieldUpdate fieldUpd = docUpd.getFieldUpdatesCollection().iterator().next(); + FieldUpdate fieldUpd = docUpd.fieldUpdates().iterator().next(); assertNotNull(fieldUpd); assertEquals(docType.getField("my_wset"), fieldUpd.getField()); @@ -326,9 +326,9 @@ public class DocumentToValueUpdateTestCase { UpdateAdapter adapter = FieldUpdateAdapter.fromPartialUpdate(new SimpleDocumentAdapter(null, doc), valueUpd); DocumentUpdate docUpd = adapter.getOutput(); assertNotNull(docUpd); - assertEquals(1, docUpd.getFieldUpdatesCollection().size()); + assertEquals(1, docUpd.fieldUpdates().size()); - FieldUpdate fieldUpd = docUpd.getFieldUpdatesCollection().iterator().next(); + FieldUpdate fieldUpd = docUpd.fieldUpdates().iterator().next(); assertNotNull(fieldUpd); assertEquals(docType.getField("my_wset"), fieldUpd.getField()); diff --git a/indexinglanguage/src/test/java/com/yahoo/vespa/indexinglanguage/DocumentUpdateTestCase.java b/indexinglanguage/src/test/java/com/yahoo/vespa/indexinglanguage/DocumentUpdateTestCase.java index cf19f5fe5b5..3efee6621e2 100644 --- a/indexinglanguage/src/test/java/com/yahoo/vespa/indexinglanguage/DocumentUpdateTestCase.java +++ b/indexinglanguage/src/test/java/com/yahoo/vespa/indexinglanguage/DocumentUpdateTestCase.java @@ -33,9 +33,9 @@ public class DocumentUpdateTestCase { assertNotNull(docUpdate); assertEquals(0, docUpdate.getFieldPathUpdates().size()); - assertEquals(1, docUpdate.getFieldUpdatesCollection().size()); + assertEquals(1, docUpdate.fieldUpdates().size()); - FieldUpdate fieldUpd = docUpdate.getFieldUpdatesCollection().iterator().next(); + FieldUpdate fieldUpd = docUpdate.fieldUpdates().iterator().next(); assertNotNull(fieldUpd); assertEquals(docType.getField("my_pos"), fieldUpd.getField()); assertEquals(1, fieldUpd.getValueUpdates().size()); diff --git a/indexinglanguage/src/test/java/com/yahoo/vespa/indexinglanguage/expressions/GuardTestCase.java b/indexinglanguage/src/test/java/com/yahoo/vespa/indexinglanguage/expressions/GuardTestCase.java index 0b9c8b22845..29e5ad0f51f 100644 --- a/indexinglanguage/src/test/java/com/yahoo/vespa/indexinglanguage/expressions/GuardTestCase.java +++ b/indexinglanguage/src/test/java/com/yahoo/vespa/indexinglanguage/expressions/GuardTestCase.java @@ -73,9 +73,9 @@ public class GuardTestCase { assertNotNull(docUpdate = Expression.execute(Expression.fromString("guard { input my_str | to_int | attribute my_lng }"), docUpdate)); assertEquals(0, docUpdate.getFieldPathUpdates().size()); - assertEquals(1, docUpdate.getFieldUpdatesCollection().size()); + assertEquals(1, docUpdate.fieldUpdates().size()); - FieldUpdate fieldUpd = docUpdate.getFieldUpdatesCollection().iterator().next(); + FieldUpdate fieldUpd = docUpdate.fieldUpdates().iterator().next(); assertNotNull(fieldUpd); assertEquals(docType.getField("my_lng"), fieldUpd.getField()); assertEquals(1, fieldUpd.getValueUpdates().size()); diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/MockedOperationHandler.java b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/MockedOperationHandler.java index 769bf036651..237a7d21aef 100644 --- a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/MockedOperationHandler.java +++ b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/MockedOperationHandler.java @@ -36,7 +36,7 @@ public class MockedOperationHandler implements OperationHandler { @Override public void update(RestUri restUri, VespaXMLFeedReader.Operation data, Optional<String> route) throws RestApiException { log.append("UPDATE: " + data.getDocumentUpdate().getId()); - log.append(data.getDocumentUpdate().getFieldUpdatesCollection().toString()); + log.append(data.getDocumentUpdate().fieldUpdates().toString()); if (data.getDocumentUpdate().getCreateIfNonExistent()) { log.append("[CREATE IF NON EXISTENT IS TRUE]"); } |