From 688961517b28efd58f3b0a3505bfacb608664a8f Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 18 Sep 2018 10:34:25 +0200 Subject: Revert "Revert "Revert "Do not expose fieldupdates as a list. Hide implementation details ins…""" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yahoo/document/DocumentUpdate.java | 129 +++++++-------------- .../json/DocumentUpdateJsonSerializer.java | 7 +- .../serialization/VespaDocumentDeserializer42.java | 2 +- .../VespaDocumentDeserializerHead.java | 2 +- .../com/yahoo/document/DocumentUpdateTestCase.java | 78 +++++-------- .../yahoo/document/json/JsonReaderTestCase.java | 8 +- .../yahoo/vespaxmlparser/UriParserTestCase.java | 4 +- .../vespaxmlparser/VespaXMLReaderTestCase.java | 44 ++++--- 8 files changed, 97 insertions(+), 177 deletions(-) (limited to 'document/src') diff --git a/document/src/main/java/com/yahoo/document/DocumentUpdate.java b/document/src/main/java/com/yahoo/document/DocumentUpdate.java index 301d6af0f54..ad93942c1c0 100644 --- a/document/src/main/java/com/yahoo/document/DocumentUpdate.java +++ b/document/src/main/java/com/yahoo/document/DocumentUpdate.java @@ -13,12 +13,9 @@ import com.yahoo.document.update.ValueUpdate; import com.yahoo.io.GrowableByteBuffer; import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; -import java.util.HashMap; import java.util.Iterator; import java.util.List; -import java.util.Map; import java.util.Optional; /** @@ -40,17 +37,14 @@ 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 { //see src/vespa/document/util/identifiableid.h public static final int CLASSID = 0x1000 + 6; private DocumentId docId; - private final List fieldUpdates; - private final Map id2FieldUpdateMap; - private final List fieldPathUpdates; + private List fieldUpdates; + private List fieldPathUpdates; private DocumentType documentType; private Optional createIfNonExistent = Optional.empty(); @@ -61,7 +55,7 @@ public class DocumentUpdate extends DocumentOperation implements Iterable()); + this(docType, docId, new ArrayList()); } /** @@ -71,7 +65,6 @@ public class DocumentUpdate extends DocumentOperation implements Iterable(); - id2FieldUpdateMap = new HashMap<>(); fieldPathUpdates = new ArrayList<>(); reader.read(this); } @@ -86,11 +79,10 @@ public class DocumentUpdate extends DocumentOperation implements Iterable id2fieldUpdateMap) { + private DocumentUpdate(DocumentType docType, DocumentId docId, List fieldUpdates) { this.docId = docId; this.documentType = docType; - this.fieldUpdates = new ArrayList<>(id2fieldUpdateMap.values()); - id2FieldUpdateMap = id2fieldUpdateMap; + this.fieldUpdates = fieldUpdates; this.fieldPathUpdates = new ArrayList<>(); } @@ -122,7 +114,7 @@ public class DocumentUpdate extends DocumentOperation implements Iterable> iter = id2FieldUpdateMap.entrySet().iterator(); iter.hasNext();) { - Map.Entry entry = iter.next(); - FieldUpdate update = entry.getValue(); + for (Iterator iter = fieldUpdates.iterator(); iter.hasNext();) { + FieldUpdate update = iter.next(); if (!update.isEmpty()) { ValueUpdate last = update.getValueUpdate(update.size() - 1); if (last instanceof AssignValueUpdate) { @@ -171,42 +162,20 @@ public class DocumentUpdate extends DocumentOperation implements Iterable getFieldUpdates() { return Collections.unmodifiableList(fieldUpdates); } - /** - * Get an unmodifiable collection of all field updates that this document update specifies. - * - * @return a collection of all FieldUpdates in this DocumentUpdate - */ - public Collection fieldUpdates() { - return Collections.unmodifiableCollection(id2FieldUpdateMap.values()); - } - /** * 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 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 fieldPathUpdates() { - return Collections.unmodifiableCollection(fieldPathUpdates); - } - /** Returns the type of the document this updates * * @return The documentype of the document @@ -229,9 +198,7 @@ public class DocumentUpdate extends DocumentOperation implements Iterable fieldUpdates) { + public void setFieldUpdates(List fieldUpdates) { if (fieldUpdates == null) { throw new NullPointerException("The field updates of a document update can not be null"); } - clearFieldUpdates(); - addFieldUpdates(fieldUpdates); - } - - public void addFieldUpdates(Collection fieldUpdates) { - for (FieldUpdate fieldUpdate : fieldUpdates) { - addFieldUpdate(fieldUpdate); - } + this.fieldUpdates = fieldUpdates; } /** @@ -313,7 +266,7 @@ public class DocumentUpdate extends DocumentOperation implements Iterable i = id2FieldUpdateMap.values().iterator(); i.hasNext();) { + for (Iterator i = fieldUpdates.iterator(); i.hasNext();) { FieldUpdate fieldUpdate = i.next(); string.append(fieldUpdate); if (i.hasNext()) { @@ -483,7 +432,7 @@ public class DocumentUpdate extends DocumentOperation implements Iterable wrapIOException(() -> write(fieldPath, fieldPathUpdates, generator))); @@ -121,7 +120,7 @@ public class DocumentUpdateJsonSerializer }); } - private void write(FieldPath fieldPath, Collection fieldPathUpdates, JsonGenerator generator) throws IOException { + private void write(FieldPath fieldPath, List fieldPathUpdates, JsonGenerator generator) throws IOException { generator.writeObjectFieldStart(fieldPath.toString()); for (FieldPathUpdate update : fieldPathUpdates) { diff --git a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer42.java b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer42.java index 3f885844987..a048ea349eb 100644 --- a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer42.java +++ b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer42.java @@ -472,7 +472,7 @@ public class VespaDocumentDeserializer42 extends VespaDocumentSerializer42 imple for (int i = 0; i < size; i++) { // TODO: Should use checked method, but doesn't work according to test now. - update.addFieldUpdate(new FieldUpdate(this, update.getDocumentType(), serializationVersion)); + update.addFieldUpdateNoCheck(new FieldUpdate(this, update.getDocumentType(), serializationVersion)); } } diff --git a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializerHead.java b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializerHead.java index 4f8a26d3777..7bdc6fd5355 100644 --- a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializerHead.java +++ b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializerHead.java @@ -29,7 +29,7 @@ public class VespaDocumentDeserializerHead extends VespaDocumentDeserializer42 { for (int i = 0; i < size; i++) { // TODO: Should use checked method, but doesn't work according to test now. - update.addFieldUpdate(new FieldUpdate(this, update.getDocumentType(), 8)); + update.addFieldUpdateNoCheck(new FieldUpdate(this, update.getDocumentType(), 8)); } int sizeAndFlags = getInt(null); diff --git a/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java b/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java index 53f68ca182c..15319985591 100644 --- a/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java +++ b/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java @@ -1,19 +1,10 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.document; -import com.yahoo.document.datatypes.Array; -import com.yahoo.document.datatypes.FloatFieldValue; -import com.yahoo.document.datatypes.IntegerFieldValue; -import com.yahoo.document.datatypes.StringFieldValue; -import com.yahoo.document.datatypes.TensorFieldValue; -import com.yahoo.document.datatypes.WeightedSet; +import com.yahoo.document.datatypes.*; import com.yahoo.document.fieldpathupdate.FieldPathUpdate; -import com.yahoo.document.serialization.DocumentDeserializer; -import com.yahoo.document.serialization.DocumentDeserializerFactory; -import com.yahoo.document.serialization.DocumentSerializer; -import com.yahoo.document.serialization.DocumentSerializerFactory; -import com.yahoo.document.serialization.DocumentUpdateFlags; -import com.yahoo.document.serialization.DocumentUpdateWriter; +import com.yahoo.document.select.parser.ParseException; +import com.yahoo.document.serialization.*; import com.yahoo.document.update.AssignValueUpdate; import com.yahoo.document.update.FieldUpdate; import com.yahoo.document.update.ValueUpdate; @@ -268,8 +259,8 @@ public class DocumentUpdateTestCase { update.addFieldUpdate(FieldUpdate.createAssign(field, new IntegerFieldValue(1))); update.addFieldUpdate(FieldUpdate.createAssign(field, new IntegerFieldValue(2))); - assertEquals(1, update.fieldUpdates().size()); - FieldUpdate fieldUpdate = update.getFieldUpdate(field); + assertEquals(1, update.getFieldUpdates().size()); + FieldUpdate fieldUpdate = update.getFieldUpdate(0); assertNotNull(fieldUpdate); assertEquals(field, fieldUpdate.getField()); assertEquals(2, fieldUpdate.getValueUpdates().size()); @@ -351,16 +342,13 @@ public class DocumentUpdateTestCase { assertEquals(new DocumentId("doc:update:test"), upd.getId()); assertEquals(type, upd.getType()); - FieldUpdate serAssignFU = upd.getFieldUpdate(type.getField("intfield")); + FieldUpdate serAssignFU = upd.getFieldUpdate(0); assertEquals(type.getField("intfield"), serAssignFU.getField()); ValueUpdate serAssign = serAssignFU.getValueUpdate(0); assertEquals(ValueUpdate.ValueUpdateClassID.ASSIGN, serAssign.getValueUpdateClassID()); assertEquals(new IntegerFieldValue(4), serAssign.getValue()); - ValueUpdate serArith = serAssignFU.getValueUpdate(1); - assertEquals(ValueUpdate.ValueUpdateClassID.ARITHMETIC, serArith.getValueUpdateClassID()); - - FieldUpdate serAddFU = upd.getFieldUpdate(type.getField("arrayoffloatfield")); + FieldUpdate serAddFU = upd.getFieldUpdate(2); assertEquals(type.getField("arrayoffloatfield"), serAddFU.getField()); ValueUpdate serAdd1 = serAddFU.getValueUpdate(0); assertEquals(ValueUpdate.ValueUpdateClassID.ADD, serAdd1.getValueUpdateClassID()); @@ -375,7 +363,12 @@ public class DocumentUpdateTestCase { FloatFieldValue addparam3 = (FloatFieldValue)serAdd3.getValue(); assertEquals(new FloatFieldValue(-1.00f), addparam3); - FieldUpdate wsetFU = upd.getFieldUpdate(type.getField("wsfield")); + FieldUpdate arithFU = upd.getFieldUpdate(3); + assertEquals(type.getField("intfield"), serAssignFU.getField()); + ValueUpdate serArith = arithFU.getValueUpdate(0); + assertEquals(ValueUpdate.ValueUpdateClassID.ARITHMETIC, serArith.getValueUpdateClassID()); + + FieldUpdate wsetFU = upd.getFieldUpdate(4); assertEquals(type.getField("wsfield"), wsetFU.getField()); assertEquals(2, wsetFU.size()); ValueUpdate mapUpd = wsetFU.getValueUpdate(0); @@ -427,8 +420,8 @@ public class DocumentUpdateTestCase { barUpdate.addFieldUpdate(barField); fooUpdate.addAll(barUpdate); - assertEquals(1, fooUpdate.fieldUpdates().size()); - FieldUpdate fieldUpdate = fooUpdate.getFieldUpdate(field); + assertEquals(1, fooUpdate.getFieldUpdates().size()); + FieldUpdate fieldUpdate = fooUpdate.getFieldUpdate(0); assertNotNull(fieldUpdate); assertEquals(field, fieldUpdate.getField()); assertEquals(2, fieldUpdate.getValueUpdates().size()); @@ -441,30 +434,6 @@ public class DocumentUpdateTestCase { assertEquals(new IntegerFieldValue(2), valueUpdate.getValue()); } - @Test - public void testgetAndRemoveByName() { - DocumentType docType = new DocumentType("my_type"); - Field my_int = new Field("my_int", DataType.INT); - Field your_int = new Field("your_int", DataType.INT); - docType.addField(my_int); - docType.addField(your_int); - DocumentUpdate update = new DocumentUpdate(docType, new DocumentId("doc:this:is:a:test")); - - update.addFieldUpdate(FieldUpdate.createAssign(my_int, new IntegerFieldValue(2))); - assertNull(update.getFieldUpdate("your_int")); - assertEquals(new IntegerFieldValue(2), update.getFieldUpdate("my_int").getValueUpdate(0).getValue()); - assertNull(update.removeFieldUpdate("your_int")); - assertEquals(new IntegerFieldValue(2), update.removeFieldUpdate("my_int").getValueUpdate(0).getValue()); - assertNull(update.getFieldUpdate("my_int")); - - update.addFieldUpdate(FieldUpdate.createAssign(my_int, new IntegerFieldValue(2))); - assertNull(update.getFieldUpdate(your_int)); - assertEquals(new IntegerFieldValue(2), update.getFieldUpdate(my_int).getValueUpdate(0).getValue()); - assertNull(update.removeFieldUpdate(your_int)); - assertEquals(new IntegerFieldValue(2), update.removeFieldUpdate(my_int).getValueUpdate(0).getValue()); - assertNull(update.getFieldUpdate(my_int)); - } - @Test public void testInstantiationAndEqualsHashCode() { DocumentType type = new DocumentType("doo"); @@ -496,7 +465,6 @@ public class DocumentUpdateTestCase { } @Test - @SuppressWarnings("deprecation") public void testFieldUpdatesInDocUp() { DocumentType t1 = new DocumentType("doo"); Field f1 = new Field("field1", DataType.STRING); @@ -525,6 +493,14 @@ public class DocumentUpdateTestCase { assertSame(fu1, documentUpdate.getFieldUpdate(f1)); + assertSame(fu1, documentUpdate.getFieldUpdate(0)); + assertSame(fu2, documentUpdate.getFieldUpdate(1)); + + documentUpdate.setFieldUpdate(0, fu2); + documentUpdate.setFieldUpdate(1, fu1); + assertEquals(2, documentUpdate.size()); + assertSame(fu1, documentUpdate.getFieldUpdate(1)); + assertSame(fu2, documentUpdate.getFieldUpdate(0)); try { documentUpdate.setFieldUpdates(null); @@ -539,12 +515,12 @@ public class DocumentUpdateTestCase { documentUpdate.setFieldUpdates(fus); assertEquals(2, documentUpdate.size()); - assertSame(fu1, documentUpdate.getFieldUpdate(fu1.getField())); - assertSame(fu2, documentUpdate.getFieldUpdate(fu2.getField())); + assertSame(fu1, documentUpdate.getFieldUpdate(0)); + assertSame(fu2, documentUpdate.getFieldUpdate(1)); - documentUpdate.removeFieldUpdate(fu2.getField()); + documentUpdate.removeFieldUpdate(1); assertEquals(1, documentUpdate.size()); - assertSame(fu1, documentUpdate.getFieldUpdate(fu1.getField())); + assertSame(fu1, documentUpdate.getFieldUpdate(0)); documentUpdate.toString(); 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 32f63e6c0b3..1fd45cb07c4 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.fieldUpdates().size()); - FieldUpdate fu = put.fieldUpdates().iterator().next(); + assertEquals(1, put.getFieldUpdates().size()); + FieldUpdate fu = put.getFieldUpdate(0); 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.fieldUpdates().size()); - FieldUpdate fu = put.fieldUpdates().iterator().next(); + assertEquals(1, put.getFieldUpdates().size()); + FieldUpdate fu = put.getFieldUpdate(0); 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 dcdea0975ad..ea954f0da40 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.fieldUpdates().size()); - FieldUpdate fieldUpd = upd.fieldUpdates().iterator().next(); + assertEquals(1, upd.getFieldUpdates().size()); + FieldUpdate fieldUpd = upd.getFieldUpdate(0); 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 1aad59f4c56..4c64f7c35cb 100755 --- a/document/src/test/java/com/yahoo/vespaxmlparser/VespaXMLReaderTestCase.java +++ b/document/src/test/java/com/yahoo/vespaxmlparser/VespaXMLReaderTestCase.java @@ -5,7 +5,6 @@ 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; @@ -17,7 +16,6 @@ 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.*; @@ -689,105 +687,103 @@ public class VespaXMLReaderTestCase { DocumentUpdate docUpdate = op.getDocumentUpdate(); - assertEquals(20, docUpdate.fieldPathUpdates().size()); + assertEquals(20, docUpdate.getFieldPathUpdates().size()); - Iterator updates = docUpdate.fieldPathUpdates().iterator(); { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(0); assertEquals("url", ass.getOriginalFieldPath()); assertEquals(new StringFieldValue("assignUrl"), ass.getNewValue()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(1); assertEquals("title", ass.getOriginalFieldPath()); assertEquals(new StringFieldValue("assignTitle"), ass.getNewValue()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(2); assertEquals("last_downloaded", ass.getOriginalFieldPath()); assertEquals("1", ass.getExpression()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(3); assertEquals("value_long", ass.getOriginalFieldPath()); assertEquals("2", ass.getExpression()); } - updates.next(); // Skip number 5 { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(5); assertEquals("stringarr", ass.getOriginalFieldPath()); assertEquals("[assignString1, assignString2]", ass.getNewValue().toString()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(6); assertEquals("intarr", ass.getOriginalFieldPath()); assertEquals("[3, 4]", ass.getNewValue().toString()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(7); assertEquals("longarr", ass.getOriginalFieldPath()); assertEquals("[5, 6]", ass.getNewValue().toString()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(8); assertEquals("bytearr", ass.getOriginalFieldPath()); assertEquals("[7, 8]", ass.getNewValue().toString()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(9); assertEquals("floatarr", ass.getOriginalFieldPath()); assertEquals("[9.0, 10.0]", ass.getNewValue().toString()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(10); 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)updates.next(); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(11); 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)updates.next(); + AddFieldPathUpdate ass = (AddFieldPathUpdate)docUpdate.getFieldPathUpdates().get(12); assertEquals("stringarr", ass.getOriginalFieldPath()); assertEquals("[addString1, addString2]", ass.getNewValues().toString()); } { - AddFieldPathUpdate ass = (AddFieldPathUpdate)updates.next(); + AddFieldPathUpdate ass = (AddFieldPathUpdate)docUpdate.getFieldPathUpdates().get(13); assertEquals("longarr", ass.getOriginalFieldPath()); assertEquals("[5]", ass.getNewValues().toString()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(14); assertEquals("weightedsetint{13}", ass.getOriginalFieldPath()); assertEquals("13", ass.getExpression()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(15); assertEquals("weightedsetint{14}", ass.getOriginalFieldPath()); assertEquals("14", ass.getExpression()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(16); assertEquals("weightedsetstring{add13}", ass.getOriginalFieldPath()); assertEquals("1", ass.getExpression()); } { - AssignFieldPathUpdate ass = (AssignFieldPathUpdate)updates.next(); + AssignFieldPathUpdate ass = (AssignFieldPathUpdate)docUpdate.getFieldPathUpdates().get(17); assertEquals("weightedsetstring{assign13}", ass.getOriginalFieldPath()); assertEquals("130", ass.getExpression()); } { - RemoveFieldPathUpdate ass = (RemoveFieldPathUpdate)updates.next(); + RemoveFieldPathUpdate ass = (RemoveFieldPathUpdate)docUpdate.getFieldPathUpdates().get(18); assertEquals("weightedsetstring{assign14}", ass.getOriginalFieldPath()); } { - RemoveFieldPathUpdate ass = (RemoveFieldPathUpdate)updates.next(); + RemoveFieldPathUpdate ass = (RemoveFieldPathUpdate)docUpdate.getFieldPathUpdates().get(19); assertEquals("bytearr", ass.getOriginalFieldPath()); } Document doc = new Document(manager.getDocumentType("news"), new DocumentId("doc:test:test:test")); -- cgit v1.2.3