summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-08-21 07:59:11 +0200
committerGitHub <noreply@github.com>2019-08-21 07:59:11 +0200
commit415e9e002e4207809247b6bd5f9419960ab43ed1 (patch)
tree0111e27fb0b3e494401a98279d36c58b48c3d265 /document
parentbe5759f30affe0e38ea4c442586a457f9cb698f8 (diff)
Revert "doc: -> id:"
Diffstat (limited to 'document')
-rw-r--r--document/abi-spec.json14
-rw-r--r--document/src/main/java/com/yahoo/document/DocumentUpdate.java2
-rw-r--r--document/src/main/java/com/yahoo/document/idstring/DocIdString.java49
-rw-r--r--document/src/main/java/com/yahoo/document/idstring/IdString.java6
-rw-r--r--document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer6.java5
-rw-r--r--document/src/test/document/serializecpp-lz4-level9.datbin343 -> 337 bytes
-rw-r--r--document/src/test/document/serializecpp.datbin368 -> 362 bytes
-rwxr-xr-xdocument/src/test/document/serializecppsplit_body.datbin217 -> 214 bytes
-rwxr-xr-xdocument/src/test/document/serializecppsplit_header.datbin151 -> 148 bytes
-rw-r--r--document/src/test/java/com/yahoo/document/BucketIdFactoryTestCase.java57
-rw-r--r--document/src/test/java/com/yahoo/document/DocInDocTestCase.java6
-rwxr-xr-xdocument/src/test/java/com/yahoo/document/DocumentCalculatorTestCase.java2
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentIdTestCase.java21
-rwxr-xr-xdocument/src/test/java/com/yahoo/document/DocumentPathUpdateTestCase.java104
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentRemoveTestCase.java8
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java14
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentTestCase.java76
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentTestCaseBase.java2
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java38
-rw-r--r--document/src/test/java/com/yahoo/document/GlobalIdTestCase.java6
-rw-r--r--document/src/test/java/com/yahoo/document/SimpleDocumentTestCase.java2
-rw-r--r--document/src/test/java/com/yahoo/document/annotation/Bug4259784TestCase.java2
-rw-r--r--document/src/test/java/com/yahoo/document/annotation/Bug4261985TestCase.java2
-rwxr-xr-xdocument/src/test/java/com/yahoo/document/annotation/Bug4475379TestCase.java2
-rw-r--r--document/src/test/java/com/yahoo/document/annotation/Bug6394548TestCase.java2
-rwxr-xr-xdocument/src/test/java/com/yahoo/document/annotation/SystemTestCase.java2
-rw-r--r--document/src/test/java/com/yahoo/document/datatypes/StringTestCase.java2
-rw-r--r--document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java23
-rw-r--r--document/src/test/java/com/yahoo/document/serialization/ReferenceFieldValueSerializationTestCase.java2
-rw-r--r--document/src/test/java/com/yahoo/document/serialization/VespaDocumentSerializerTestCase.java4
-rw-r--r--document/src/test/java/com/yahoo/document/serialization/XmlDocumentWriterTestCase.java2
-rw-r--r--document/src/test/java/com/yahoo/document/update/FieldUpdateTestCase.java10
-rwxr-xr-x[-rw-r--r--]document/src/test/java/com/yahoo/vespaxmlparser/VespaXMLReaderTestCase.java18
-rw-r--r--document/src/test/java/com/yahoo/vespaxmlparser/VespaXmlFieldReaderTestCase.java20
-rw-r--r--document/src/test/java/com/yahoo/vespaxmlparser/VespaXmlUpdateReaderTestCase.java62
-rw-r--r--document/src/test/java/com/yahoo/vespaxmlparser/XMLNumericFieldErrorMsgTestCase.java10
-rw-r--r--document/src/test/resources/reference/reference_with_id__cppbin84 -> 84 bytes
-rw-r--r--document/src/test/resources/reference/reference_with_id__javabin83 -> 84 bytes
-rw-r--r--document/src/test/serializeddocuments/document-java-v8-uncompressed.datbin340 -> 346 bytes
-rw-r--r--document/src/test/serializeddocuments/java-6/README1
-rw-r--r--document/src/test/serializeddocuments/java-6/java-6.cfg124
-rw-r--r--document/src/test/serializeddocuments/java-6/java-6.datbin0 -> 356 bytes
-rw-r--r--document/src/test/vespaxmlparser/test01.xml2
-rw-r--r--document/src/test/vespaxmlparser/test02.xml2
-rw-r--r--document/src/test/vespaxmlparser/test03.xml2
-rw-r--r--document/src/test/vespaxmlparser/test04.xml2
-rw-r--r--document/src/test/vespaxmlparser/test05.xml2
-rw-r--r--document/src/test/vespaxmlparser/test06.xml20
-rw-r--r--document/src/test/vespaxmlparser/test07.xml12
-rw-r--r--document/src/test/vespaxmlparser/test08.xml2
-rw-r--r--document/src/test/vespaxmlparser/test09.xml6
-rw-r--r--document/src/test/vespaxmlparser/test10.xml12
-rw-r--r--document/src/test/vespaxmlparser/test12.xml10
-rw-r--r--document/src/test/vespaxmlparser/test13.xml2
-rw-r--r--document/src/test/vespaxmlparser/testXMLfile.xml6
-rw-r--r--document/src/test/vespaxmlparser/test_docindoc.xml8
-rw-r--r--document/src/test/vespaxmlparser/test_position.xml8
-rw-r--r--document/src/test/vespaxmlparser/test_uri.xml6
-rw-r--r--document/src/test/vespaxmlparser/test_url.xml6
-rw-r--r--document/src/test/vespaxmlparser/testalltypes.xml2
-rw-r--r--document/src/test/vespaxmlparser/testmapnokey.xml2
-rw-r--r--document/src/test/vespaxmlparser/testmapnovalue.xml2
-rw-r--r--document/src/tests/base/documentid_test.cpp14
-rw-r--r--document/src/tests/buckettest.cpp34
-rw-r--r--document/src/tests/cpp-globalidbucketids.txt23
-rw-r--r--document/src/tests/data/document-cpp-currentversion-lz4-9.datbin313 -> 332 bytes
-rw-r--r--document/src/tests/data/document-cpp-currentversion-uncompressed.datbin333 -> 332 bytes
-rw-r--r--document/src/tests/data/document-cpp-v7-uncompressed.datbin0 -> 354 bytes
-rw-r--r--document/src/tests/data/document-cpp-v8-uncompressed.datbin333 -> 346 bytes
-rw-r--r--document/src/tests/data/serialize-fieldpathupdate-cpp.datbin163 -> 160 bytes
-rw-r--r--document/src/tests/data/serialize-fieldpathupdate-java.datbin163 -> 160 bytes
-rw-r--r--document/src/tests/data/serializejava-compressed.datbin380 -> 384 bytes
-rw-r--r--document/src/tests/data/serializejava.datbin406 -> 405 bytes
-rw-r--r--document/src/tests/data/serializejavawithannotations.datbin475 -> 471 bytes
-rw-r--r--document/src/tests/data/serializeupdatecpp.datbin213 -> 201 bytes
-rw-r--r--document/src/tests/data/serializeupdatejava.datbin124 -> 112 bytes
-rw-r--r--document/src/tests/data/serializev6.datbin0 -> 391 bytes
-rw-r--r--document/src/tests/documentcalculatortestcase.cpp20
-rw-r--r--document/src/tests/documentidtest.cpp40
-rw-r--r--document/src/tests/documentselectparsertest.cpp62
-rw-r--r--document/src/tests/documenttestcase.cpp104
-rw-r--r--document/src/tests/documenttypetestcase.cpp2
-rw-r--r--document/src/tests/documentupdatetestcase.cpp24
-rw-r--r--document/src/tests/fieldpathupdatetestcase.cpp150
-rw-r--r--document/src/tests/fieldsettest.cpp6
-rw-r--r--document/src/tests/fieldvalue/referencefieldvalue_test.cpp15
-rw-r--r--document/src/tests/globalidtest.cpp8
-rw-r--r--document/src/tests/serialization/vespadocumentserializer_test.cpp50
-rw-r--r--document/src/tests/struct_anno/document.datbin231 -> 223 bytes
-rw-r--r--document/src/tests/testxml.cpp12
-rwxr-xr-x[-rw-r--r--]document/src/tests/vespaxml/fieldpathupdates.xml2
-rw-r--r--document/src/tests/vespaxml/test1.expected.xml5
-rw-r--r--document/src/tests/vespaxml/test1.xml9
-rw-r--r--document/src/tests/vespaxml/test10.xml9
-rw-r--r--document/src/tests/vespaxml/test11.xml8
-rw-r--r--document/src/tests/vespaxml/test12.xml9
-rw-r--r--document/src/tests/vespaxml/test13.xml7
-rw-r--r--document/src/tests/vespaxml/test14.xml8
-rw-r--r--document/src/tests/vespaxml/test15.xml8
-rw-r--r--document/src/tests/vespaxml/test16.xml8
-rw-r--r--document/src/tests/vespaxml/test17.xml9
-rw-r--r--document/src/tests/vespaxml/test18.xml9
-rw-r--r--document/src/tests/vespaxml/test2.expected.xml5
-rw-r--r--document/src/tests/vespaxml/test2.xml7
-rw-r--r--document/src/tests/vespaxml/test20.xml8
-rw-r--r--document/src/tests/vespaxml/test21.xml9
-rw-r--r--document/src/tests/vespaxml/test22.xml9
-rw-r--r--document/src/tests/vespaxml/test23.xml9
-rw-r--r--document/src/tests/vespaxml/test24.xml9
-rw-r--r--document/src/tests/vespaxml/test25.xml9
-rw-r--r--document/src/tests/vespaxml/test26.xml9
-rw-r--r--document/src/tests/vespaxml/test27.xml9
-rw-r--r--document/src/tests/vespaxml/test28.xml10
-rw-r--r--document/src/tests/vespaxml/test29.xml18
-rw-r--r--document/src/tests/vespaxml/test3.xml9
-rw-r--r--document/src/tests/vespaxml/test30.xml15
-rw-r--r--document/src/tests/vespaxml/test32.xml7
-rw-r--r--document/src/tests/vespaxml/test33.xml9
-rw-r--r--document/src/tests/vespaxml/test34.xml7
-rw-r--r--document/src/tests/vespaxml/test35.xml9
-rw-r--r--document/src/tests/vespaxml/test36.xml43
-rw-r--r--document/src/tests/vespaxml/test37.xml23
-rw-r--r--document/src/tests/vespaxml/test4.xml23
-rw-r--r--document/src/tests/vespaxml/test40.xml6
-rw-r--r--document/src/tests/vespaxml/test41.xml22
-rw-r--r--document/src/tests/vespaxml/test42.xml22
-rw-r--r--document/src/tests/vespaxml/test43.xml32
-rw-r--r--document/src/tests/vespaxml/test45.xml6
-rw-r--r--document/src/tests/vespaxml/test46.xml10
-rw-r--r--document/src/tests/vespaxml/test47.xml10
-rw-r--r--document/src/tests/vespaxml/test48.xml6
-rw-r--r--document/src/tests/vespaxml/test49.xml8
-rw-r--r--document/src/tests/vespaxml/test5.expected.xml3
-rw-r--r--document/src/tests/vespaxml/test5.xml6
-rw-r--r--document/src/tests/vespaxml/test50.xml8
-rw-r--r--document/src/tests/vespaxml/test51.xml6
-rw-r--r--document/src/tests/vespaxml/test52.xml10
-rw-r--r--document/src/tests/vespaxml/test53.xml11
-rw-r--r--document/src/tests/vespaxml/test54.xml10
-rw-r--r--document/src/tests/vespaxml/test55.xml11
-rw-r--r--document/src/tests/vespaxml/test56.xml8
-rw-r--r--document/src/tests/vespaxml/test57.xml8
-rw-r--r--document/src/tests/vespaxml/test58.xml15
-rw-r--r--document/src/tests/vespaxml/test59.xml7
-rw-r--r--document/src/tests/vespaxml/test6.xml7
-rw-r--r--document/src/tests/vespaxml/test7.xml9
-rw-r--r--document/src/tests/vespaxml/test8.xml9
-rw-r--r--document/src/tests/vespaxml/test9.xml7
-rw-r--r--document/src/tests/vespaxml/test_arraystruct.xml19
-rw-r--r--document/src/tests/vespaxml/test_doc5.xml8
-rw-r--r--document/src/tests/vespaxml/test_doc6.xml6
-rw-r--r--document/src/tests/vespaxml/test_doc8.xml9
-rw-r--r--document/src/tests/vespaxml/test_externalentity.xml11
-rw-r--r--document/src/tests/vespaxml/test_idprefix.xml13
-rw-r--r--document/src/tests/vespaxml/test_struct.xml9
-rw-r--r--document/src/tests/vespaxml/test_update1.xml12
-rw-r--r--document/src/vespa/document/base/idstring.cpp29
-rw-r--r--document/src/vespa/document/base/idstring.h22
158 files changed, 1589 insertions, 531 deletions
diff --git a/document/abi-spec.json b/document/abi-spec.json
index ba2d081348f..fc44686ad60 100644
--- a/document/abi-spec.json
+++ b/document/abi-spec.json
@@ -3448,6 +3448,19 @@
],
"fields": []
},
+ "com.yahoo.document.idstring.DocIdString": {
+ "superClass": "com.yahoo.document.idstring.IdString",
+ "interfaces": [],
+ "attributes": [
+ "public"
+ ],
+ "methods": [
+ "public void <init>(java.lang.String, java.lang.String)",
+ "public long getLocation()",
+ "public java.lang.String getSchemeSpecific()"
+ ],
+ "fields": []
+ },
"com.yahoo.document.idstring.IdIdString": {
"superClass": "com.yahoo.document.idstring.IdString",
"interfaces": [],
@@ -3482,6 +3495,7 @@
"public static com.yahoo.document.idstring.IdString$Scheme valueOf(java.lang.String)"
],
"fields": [
+ "public static final enum com.yahoo.document.idstring.IdString$Scheme doc",
"public static final enum com.yahoo.document.idstring.IdString$Scheme id"
]
},
diff --git a/document/src/main/java/com/yahoo/document/DocumentUpdate.java b/document/src/main/java/com/yahoo/document/DocumentUpdate.java
index 8de8ca6af53..ef075662ee7 100644
--- a/document/src/main/java/com/yahoo/document/DocumentUpdate.java
+++ b/document/src/main/java/com/yahoo/document/DocumentUpdate.java
@@ -31,7 +31,7 @@ import java.util.Optional;
* <pre>
* DocumentType musicType = DocumentTypeManager.getInstance().getDocumentType("music", 0);
* DocumentUpdate docUpdate = new DocumentUpdate(musicType,
- * new DocumentId("id:test:music::http://music.yahoo.com/"));
+ * new DocumentId("doc:test:http://music.yahoo.com/"));
* FieldUpdate update = FieldUpdate.createAssign(musicType.getField("artist"), "lillbabs");
* docUpdate.addFieldUpdate(update);
* </pre>
diff --git a/document/src/main/java/com/yahoo/document/idstring/DocIdString.java b/document/src/main/java/com/yahoo/document/idstring/DocIdString.java
new file mode 100644
index 00000000000..09cc27d2c89
--- /dev/null
+++ b/document/src/main/java/com/yahoo/document/idstring/DocIdString.java
@@ -0,0 +1,49 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.document.idstring;
+
+import com.yahoo.collections.MD5;
+import com.yahoo.text.Utf8;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * Representation of doc scheme in document IDs.
+ *
+ * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
+ */
+//TODO Remove no later than Vespa 8
+@Deprecated
+public class DocIdString extends IdString {
+ /**
+ * Create a doc scheme object.
+ * <code>doc:&lt;namespace&gt;:&lt;namespaceSpecific&gt;</code>
+ *
+ * @param namespace The namespace of this document id.
+ * @param namespaceSpecific The namespace specific part.
+ */
+ public DocIdString(String namespace, String namespaceSpecific) {
+ super(Scheme.doc, namespace, namespaceSpecific);
+ }
+
+ /**
+ * Get the location of this document id. The location is used for distribution
+ * in clusters. For the doc scheme, the location is a hash of the whole id.
+ *
+ * @return The 64 bit location.
+ */
+ public long getLocation() {
+ long result = 0;
+ byte[] md5sum = MD5.md5.get().digest(Utf8.toBytes(toString()));
+ for (int i=0; i<8; ++i) {
+ result |= (md5sum[i] & 0xFFl) << (8*i);
+ }
+
+ return result;
+ }
+
+ /** Get the scheme specific part. Which is non-existing for doc scheme. */
+ public String getSchemeSpecific() {
+ return "";
+ }
+}
diff --git a/document/src/main/java/com/yahoo/document/idstring/IdString.java b/document/src/main/java/com/yahoo/document/idstring/IdString.java
index 0fe382be914..d988de60cdf 100644
--- a/document/src/main/java/com/yahoo/document/idstring/IdString.java
+++ b/document/src/main/java/com/yahoo/document/idstring/IdString.java
@@ -37,7 +37,7 @@ public abstract class IdString {
return "";
}
- public enum Scheme { id }
+ public enum Scheme { doc, id }
private final Scheme scheme;
private final String namespace;
private final String namespaceSpecific;
@@ -79,6 +79,7 @@ public abstract class IdString {
}
}
+ @SuppressWarnings("deprecation")
private static IdString parseAndCreate(String id) {
String namespace;
@@ -120,6 +121,9 @@ public abstract class IdString {
currPos = colonPos + 1;
return new IdIdString(namespace, type, keyValues, id.substring(currPos));
+
+ } else if (schemeStr.equals("doc")) {
+ return new DocIdString(namespace, id.substring(currPos));
} else {
throw new IllegalArgumentException("Unknown id scheme '" + schemeStr + "'");
}
diff --git a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer6.java b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer6.java
index e80cebdcc29..ef33fb6b804 100644
--- a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer6.java
+++ b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer6.java
@@ -120,10 +120,11 @@ public class VespaDocumentDeserializer6 extends BufferSerializer implements Docu
dataPos = position();
}
- DocumentId documentId = readDocumentId();
+ doc.setId(readDocumentId());
+
Byte content = getByte(null);
+
doc.setDataType(readDocumentType());
- doc.setId(documentId);
Struct h = doc.getHeader();
Struct b = doc.getBody();
diff --git a/document/src/test/document/serializecpp-lz4-level9.dat b/document/src/test/document/serializecpp-lz4-level9.dat
index db759871107..9bc68803245 100644
--- a/document/src/test/document/serializecpp-lz4-level9.dat
+++ b/document/src/test/document/serializecpp-lz4-level9.dat
Binary files differ
diff --git a/document/src/test/document/serializecpp.dat b/document/src/test/document/serializecpp.dat
index 6435dc088ac..7e50220a046 100644
--- a/document/src/test/document/serializecpp.dat
+++ b/document/src/test/document/serializecpp.dat
Binary files differ
diff --git a/document/src/test/document/serializecppsplit_body.dat b/document/src/test/document/serializecppsplit_body.dat
index f4e687192b9..3f5db21dd18 100755
--- a/document/src/test/document/serializecppsplit_body.dat
+++ b/document/src/test/document/serializecppsplit_body.dat
Binary files differ
diff --git a/document/src/test/document/serializecppsplit_header.dat b/document/src/test/document/serializecppsplit_header.dat
index 08176e4e737..8b938c499d4 100755
--- a/document/src/test/document/serializecppsplit_header.dat
+++ b/document/src/test/document/serializecppsplit_header.dat
Binary files differ
diff --git a/document/src/test/java/com/yahoo/document/BucketIdFactoryTestCase.java b/document/src/test/java/com/yahoo/document/BucketIdFactoryTestCase.java
index 93feb198e7e..c2e1dbd611c 100644
--- a/document/src/test/java/com/yahoo/document/BucketIdFactoryTestCase.java
+++ b/document/src/test/java/com/yahoo/document/BucketIdFactoryTestCase.java
@@ -1,12 +1,11 @@
// 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.idstring.DocIdString;
import com.yahoo.document.idstring.IdIdString;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
/**
* Date: Sep 7, 2007
@@ -43,12 +42,13 @@ public class BucketIdFactoryTestCase {
}
@Test
+ @SuppressWarnings("deprecation")
public void testBucketGeneration() {
+ // TODO Rewrite in time for VESPA 8 to use IdIdString
BucketIdFactory factory = new BucketIdFactory(32, 26, 6);
- DocumentId doc1 = new DocumentId(new IdIdString("ns", "mytype", "", "1"));
- DocumentId doc2 = new DocumentId(new IdIdString("ns2", "mytype", "", "1"));
- DocumentId doc3 = new DocumentId(new IdIdString("ns", "mytype2", "", "1"));
- DocumentId doc4 = new DocumentId(new IdIdString("ns", "mytype", "", "2"));
+ DocumentId doc1 = new DocumentId(new DocIdString("ns", "spec"));
+ DocumentId doc2 = new DocumentId(new DocIdString("ns2", "spec"));
+ DocumentId doc3 = new DocumentId(new DocIdString("ns", "spec2"));
DocumentId userDoc1 = new DocumentId(new IdIdString("ns", "mytype","n=18", "spec"));
DocumentId userDoc2 = new DocumentId(new IdIdString("ns", "mytype","n=18", "spec2"));
DocumentId userDoc3 = new DocumentId(new IdIdString("ns", "mytype","n=19", "spec"));
@@ -56,19 +56,28 @@ public class BucketIdFactoryTestCase {
DocumentId groupDoc2 = new DocumentId(new IdIdString("ns2", "mytype", "g=yahoo.com", "spec2"));
DocumentId groupDoc3 = new DocumentId(new IdIdString("ns", "mytype", "g=yahoo", "spec"));
- assertEquals(new Hex(0xeb3089a300000012L), new Hex(factory.getBucketId(userDoc1).getRawId()));
- assertEquals(new Hex(0xea780a8700000012L), new Hex(factory.getBucketId(userDoc2).getRawId()));
- assertEquals(new Hex(0xe80d16fc00000013L), new Hex(factory.getBucketId(userDoc3).getRawId()));
- assertEquals(new Hex(0xeb82f2be9a1acd50L), new Hex(factory.getBucketId(groupDoc1).getRawId()));
- assertEquals(new Hex(0xebff6e379a1acd50L), new Hex(factory.getBucketId(groupDoc2).getRawId()));
- assertEquals(new Hex(0xe91b9600afe81f24L), new Hex(factory.getBucketId(groupDoc3).getRawId()));
+ BucketId docBucket1 = factory.getBucketId(doc1);
+ BucketId docBucket2 = factory.getBucketId(doc2);
+ BucketId docBucket3 = factory.getBucketId(doc3);
+ BucketId userDocBucket1 = factory.getBucketId(userDoc1);
+ BucketId userDocBucket2 = factory.getBucketId(userDoc2);
+ BucketId userDocBucket3 = factory.getBucketId(userDoc3);
+ BucketId groupDocBucket1 = factory.getBucketId(groupDoc1);
+ BucketId groupDocBucket2 = factory.getBucketId(groupDoc2);
+ BucketId groupDocBucket3 = factory.getBucketId(groupDoc3);
+
+ assertEquals(new Hex(0xeb3089a300000012L), new Hex(userDocBucket1.getRawId()));
+ assertEquals(new Hex(0xea780a8700000012L), new Hex(userDocBucket2.getRawId()));
+ assertEquals(new Hex(0xe80d16fc00000013L), new Hex(userDocBucket3.getRawId()));
- assertEquals(new Hex(0xe96b22a03842cac4L), new Hex(factory.getBucketId(doc1).getRawId()));
- assertEquals(new Hex(0xeb8ea3dd3842cac4L), new Hex(factory.getBucketId(doc2).getRawId()));
- assertEquals(new Hex(0xe9a1b4ac3842cac4L), new Hex(factory.getBucketId(doc3).getRawId()));
- assertEquals(new Hex(0xe8222c758d721ec8L), new Hex(factory.getBucketId(doc4).getRawId()));
+ assertEquals(new Hex(0xeb82f2be9a1acd50L), new Hex(groupDocBucket1.getRawId()));
+ assertEquals(new Hex(0xebff6e379a1acd50L), new Hex(groupDocBucket2.getRawId()));
+ assertEquals(new Hex(0xe91b9600afe81f24L), new Hex(groupDocBucket3.getRawId()));
+ assertEquals(new Hex(0xe980c9abd5fd8d11L), new Hex(docBucket1.getRawId()));
+ assertEquals(new Hex(0xeafe870c5f9c37b9L), new Hex(docBucket2.getRawId()));
+ assertEquals(new Hex(0xeaebe9473ecbcd69L), new Hex(docBucket3.getRawId()));
}
//Actually a BucketId testcase ...
@@ -76,11 +85,11 @@ public class BucketIdFactoryTestCase {
public void testBidContainsBid() {
BucketId bid = new BucketId(18, 0x123456789L);
- assertTrue(bid.contains(new BucketId(20, 0x123456789L)));
- assertTrue(bid.contains(new BucketId(18, 0x888f56789L)));
- assertTrue(bid.contains(new BucketId(24, 0x888456789L)));
- assertTrue(!bid.contains(new BucketId(24, 0x888886789L)));
- assertTrue(!bid.contains(new BucketId(16, 0x123456789L)));
+ assert(bid.contains(new BucketId(20, 0x123456789L)));
+ assert(bid.contains(new BucketId(18, 0x888f56789L)));
+ assert(bid.contains(new BucketId(24, 0x888456789L)));
+ assert(!bid.contains(new BucketId(24, 0x888886789L)));
+ assert(!bid.contains(new BucketId(16, 0x123456789L)));
}
@Test
@@ -88,13 +97,13 @@ public class BucketIdFactoryTestCase {
DocumentId docId = new DocumentId("id:ns:recovery:n=18:99999");
BucketIdFactory factory = new BucketIdFactory(32, 26, 6);
BucketId bid = new BucketId(16, 0x12L);
- assertTrue(bid.contains(docId, factory));
+ assert(bid.contains(docId, factory));
//split on '0'
bid = new BucketId(17, 0x12L);
- assertTrue(bid.contains(docId, factory));
+ assert(bid.contains(docId, factory));
//split on '1'
bid = new BucketId(17, (1L<<16) + 0x12L);
- assertTrue(!bid.contains(docId, factory));
+ assert(!bid.contains(docId, factory));
}
@Test
diff --git a/document/src/test/java/com/yahoo/document/DocInDocTestCase.java b/document/src/test/java/com/yahoo/document/DocInDocTestCase.java
index d81daca74f0..f5c158595d2 100644
--- a/document/src/test/java/com/yahoo/document/DocInDocTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocInDocTestCase.java
@@ -23,10 +23,10 @@ public class DocInDocTestCase {
DocumentTypeManager manager = new DocumentTypeManager();
DocumentTypeManagerConfigurer.configure(manager, "file:src/test/java/com/yahoo/document/documentmanager.docindoc.cfg");
- Document inner1 = new Document(manager.getDocumentType("docindoc"), "id:inner:docindoc::one");
+ Document inner1 = new Document(manager.getDocumentType("docindoc"), "doc:inner:number:one");
inner1.setFieldValue("name", new StringFieldValue("Donald Duck"));
inner1.setFieldValue("content", new StringFieldValue("Lives in Duckburg"));
- Document inner2 = new Document(manager.getDocumentType("docindoc"), "id:inner:docindoc::two");
+ Document inner2 = new Document(manager.getDocumentType("docindoc"), "doc:inner:number:two");
inner2.setFieldValue("name", new StringFieldValue("Uncle Scrooge"));
inner2.setFieldValue("content", new StringFieldValue("Lives in Duckburg, too."));
@@ -34,7 +34,7 @@ public class DocInDocTestCase {
innerArray.add(inner1);
innerArray.add(inner2);
- Document outer = new Document(manager.getDocumentType("outerdoc"), "id:outer:outerdoc::the:only:one");
+ Document outer = new Document(manager.getDocumentType("outerdoc"), "doc:outer:the:only:one");
outer.setFieldValue("innerdocuments", innerArray);
DocumentSerializer serializer = DocumentSerializerFactory.create6();
diff --git a/document/src/test/java/com/yahoo/document/DocumentCalculatorTestCase.java b/document/src/test/java/com/yahoo/document/DocumentCalculatorTestCase.java
index fb2d478d38b..619f6598247 100755
--- a/document/src/test/java/com/yahoo/document/DocumentCalculatorTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentCalculatorTestCase.java
@@ -34,7 +34,7 @@ public class DocumentCalculatorTestCase {
testDocType.addHeaderField("missingattr", DataType.INT);
docMan.registerDocumentType(testDocType);
- doc = new Document(testDocType, new DocumentId("id:ns:testdoc::testdoc:http://www.ntnu.no/"));
+ doc = new Document(testDocType, new DocumentId("doc:testdoc:http://www.ntnu.no/"));
doc.setFieldValue(testDocType.getField("byteattr"), new ByteFieldValue((byte)32));
doc.setFieldValue(testDocType.getField("intattr"), new IntegerFieldValue(468));
doc.setFieldValue(testDocType.getField("longattr"), new LongFieldValue((long)327));
diff --git a/document/src/test/java/com/yahoo/document/DocumentIdTestCase.java b/document/src/test/java/com/yahoo/document/DocumentIdTestCase.java
index bb4fac805ee..b8f60b5d9bc 100644
--- a/document/src/test/java/com/yahoo/document/DocumentIdTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentIdTestCase.java
@@ -44,9 +44,9 @@ public class DocumentIdTestCase {
@Test
public void testCompareTo() {
- DocumentId docId1 = new Document(manager.getDocumentType("testdoc"), new DocumentId("id:ns:testdoc::http://www.uio.no/")).getId();
- DocumentId docId2 = new Document(manager.getDocumentType("testdoc"), new DocumentId("id:ns:testdoc::http://www.uio.no/")).getId();
- DocumentId docId3 = new Document(manager.getDocumentType("testdoc"), new DocumentId("id:ns:testdoc::http://www.ntnu.no/")).getId();
+ DocumentId docId1 = new Document(manager.getDocumentType("testdoc"), new DocumentId("doc:testdoc:http://www.uio.no/")).getId();
+ DocumentId docId2 = new Document(manager.getDocumentType("testdoc"), new DocumentId("doc:testdoc:http://www.uio.no/")).getId();
+ DocumentId docId3 = new Document(manager.getDocumentType("testdoc"), new DocumentId("doc:testdoc:http://www.ntnu.no/")).getId();
assertTrue(docId1.equals(docId2));
assertTrue(!docId1.equals(docId3));
@@ -70,6 +70,8 @@ public class DocumentIdTestCase {
public void testValidInvalidUriSchemes() {
try {
//valid URIs
+ new DocumentId("doc:blabla:something");
+ new DocumentId("doc:doc:doc");
new DocumentId("id:namespace:type:n=42:whatever");
new DocumentId("id:namespace:type::whatever");
} catch (IllegalArgumentException iae) {
@@ -78,6 +80,11 @@ public class DocumentIdTestCase {
checkInvalidUri("foobar:");
checkInvalidUri("ballooo:blabla/something/");
+ checkInvalidUri("doc:");
+ checkInvalidUri("doc::");
+ checkInvalidUri("doc:::");
+ checkInvalidUri("doc::/");
+ checkInvalidUri("doc");
checkInvalidUri("id:namespace:type");
checkInvalidUri("id:namespace:type:key-values");
checkInvalidUri("id:namespace:type:n=0,n=1:foo");
@@ -175,6 +182,10 @@ public class DocumentIdTestCase {
assertFalse(none.getScheme().hasGroup());
assertFalse(none.getScheme().hasNumber());
+ none = new DocumentId("doc:ns:foo");
+ assertFalse(none.getScheme().hasGroup());
+ assertFalse(none.getScheme().hasNumber());
+
DocumentId user = new DocumentId("id:ns:type:n=42:foo");
assertFalse(user.getScheme().hasGroup());
assertTrue(user.getScheme().hasNumber());
@@ -193,9 +204,9 @@ public class DocumentIdTestCase {
@Test
public void testHashCodeOfGids() {
- DocumentId docId0 = new DocumentId("id:blabla:type::0");
+ DocumentId docId0 = new DocumentId("doc:blabla:0");
byte[] docId0Gid = docId0.getGlobalId();
- DocumentId docId0Copy = new DocumentId("id:blabla:type::0");
+ DocumentId docId0Copy = new DocumentId("doc:blabla:0");
byte[] docId0CopyGid = docId0Copy.getGlobalId();
diff --git a/document/src/test/java/com/yahoo/document/DocumentPathUpdateTestCase.java b/document/src/test/java/com/yahoo/document/DocumentPathUpdateTestCase.java
index c7cdfb01413..d5fc1386900 100755
--- a/document/src/test/java/com/yahoo/document/DocumentPathUpdateTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentPathUpdateTestCase.java
@@ -73,11 +73,11 @@ public class DocumentPathUpdateTestCase {
@Test
public void testRemoveField() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
assertNull(doc.getFieldValue("strfoo"));
doc.setFieldValue("strfoo", "cocacola");
assertEquals(new StringFieldValue("cocacola"), doc.getFieldValue("strfoo"));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::foooo"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new RemoveFieldPathUpdate(doc.getDataType(), "strfoo", null));
docUp.applyTo(doc);
assertNull(doc.getFieldValue("strfoo"));
@@ -85,7 +85,7 @@ public class DocumentPathUpdateTestCase {
@Test
public void testApplyRemoveMultiList() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
assertNull(doc.getFieldValue("strarray"));
Array<StringFieldValue> strArray = new Array<>(doc.getField("strarray").getDataType());
strArray.add(new StringFieldValue("crouching tiger, hidden value"));
@@ -93,7 +93,7 @@ public class DocumentPathUpdateTestCase {
strArray.add(new StringFieldValue("hello hello"));
doc.setFieldValue("strarray", strArray);
assertNotNull(doc.getFieldValue("strarray"));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::foooo"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new RemoveFieldPathUpdate(doc.getDataType(), "strarray[$x]", "foobar.strarray[$x] == \"remove val 1\""));
docUp.applyTo(doc);
assertEquals(2, ((List) doc.getFieldValue("strarray")).size());
@@ -104,7 +104,7 @@ public class DocumentPathUpdateTestCase {
@Test
public void testApplyRemoveMultiList2() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
assertNull(doc.getFieldValue("strarray"));
Array<StringFieldValue> strArray = new Array<>(doc.getField("strarray").getDataType());
strArray.add(new StringFieldValue("remove val 0 and 1"));
@@ -112,7 +112,7 @@ public class DocumentPathUpdateTestCase {
strArray.add(new StringFieldValue("hello hello"));
doc.setFieldValue("strarray", strArray);
assertNotNull(doc.getFieldValue("strarray"));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::foooo"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new RemoveFieldPathUpdate(doc.getDataType(), "strarray[$x]", "foobar.strarray[$x] == \"remove val 0 and 1\""));
docUp.applyTo(doc);
assertEquals(1, ((List) doc.getFieldValue("strarray")).size());
@@ -122,14 +122,14 @@ public class DocumentPathUpdateTestCase {
@Test
public void testApplyRemoveEntireListField() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
assertNull(doc.getFieldValue("strarray"));
Array<StringFieldValue> strArray = new Array<>(doc.getField("strarray").getDataType());
strArray.add(new StringFieldValue("this list"));
strArray.add(new StringFieldValue("should be"));
strArray.add(new StringFieldValue("totally removed"));
doc.setFieldValue("strarray", strArray);
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:toast:foobar::jam"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:toast:jam"));
docUp.addFieldPathUpdate(new RemoveFieldPathUpdate(doc.getDataType(), "strarray", null));
docUp.applyTo(doc);
assertNull(doc.getFieldValue("strarray"));
@@ -137,14 +137,14 @@ public class DocumentPathUpdateTestCase {
@Test
public void testApplyRemoveMultiWset() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
assertNull(doc.getFieldValue("strwset"));
WeightedSet<StringFieldValue> strwset = new WeightedSet<>(doc.getDataType().getField("strwset").getDataType());
strwset.put(new StringFieldValue("hello hello"), 10);
strwset.put(new StringFieldValue("remove val 1"), 20);
doc.setFieldValue("strwset", strwset);
assertNotNull(doc.getFieldValue("strwset"));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new RemoveFieldPathUpdate(doc.getDataType(), "strwset{remove val 1}", ""));
docUp.applyTo(doc);
assertEquals(1, ((WeightedSet) doc.getFieldValue("strwset")).size());
@@ -154,9 +154,9 @@ public class DocumentPathUpdateTestCase {
@Test
public void testApplyAssignSingle() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
assertNull(doc.getFieldValue("strfoo"));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new AssignFieldPathUpdate(doc.getDataType(), "strfoo", "", new StringFieldValue("something")));
docUp.applyTo(doc);
assertEquals(new StringFieldValue("something"), doc.getFieldValue("strfoo"));
@@ -164,9 +164,9 @@ public class DocumentPathUpdateTestCase {
@Test
public void testApplyAssignMath() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
doc.setFieldValue(doc.getField("num"), new IntegerFieldValue(34));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new AssignFieldPathUpdate(doc.getDataType(), "num", "", "($value * 2) / $value"));
docUp.applyTo(doc);
assertEquals(new IntegerFieldValue(2), doc.getFieldValue(doc.getField("num")));
@@ -174,9 +174,9 @@ public class DocumentPathUpdateTestCase {
@Test
public void testDivideByZero() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
doc.setFieldValue(doc.getField("num"), new IntegerFieldValue(10));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new AssignFieldPathUpdate(doc.getDataType(), "num", "", "100 / ($value - 10)"));
docUp.applyTo(doc);
assertEquals(new IntegerFieldValue(10), doc.getFieldValue(doc.getField("num")));
@@ -184,9 +184,9 @@ public class DocumentPathUpdateTestCase {
@Test
public void testAssignMathFieldNotSet() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
doc.setFieldValue(doc.getField("num"), new IntegerFieldValue(10));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new AssignFieldPathUpdate(doc.getDataType(), "num", "", "100 + foobar.num2"));
docUp.applyTo(doc);
assertEquals(new IntegerFieldValue(10), doc.getFieldValue(doc.getField("num")));
@@ -194,9 +194,9 @@ public class DocumentPathUpdateTestCase {
@Test
public void testAssignMathMissingField() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
doc.setFieldValue(doc.getField("num"), new IntegerFieldValue(10));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new AssignFieldPathUpdate(doc.getDataType(), "num", "", "100 + foobar.bogus"));
docUp.applyTo(doc);
assertEquals(new IntegerFieldValue(10), doc.getFieldValue(doc.getField("num")));
@@ -204,8 +204,8 @@ public class DocumentPathUpdateTestCase {
@Test
public void testAssignMathTargetFieldNotSet() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new AssignFieldPathUpdate(doc.getDataType(), "num", "", "100"));
docUp.applyTo(doc);
assertEquals(new IntegerFieldValue(100), doc.getFieldValue(doc.getField("num")));
@@ -213,8 +213,8 @@ public class DocumentPathUpdateTestCase {
@Test
public void testAssignMathTargetFieldNotSetWithValue() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new AssignFieldPathUpdate(doc.getDataType(), "num", "", "$value + 5"));
docUp.applyTo(doc);
assertEquals(new IntegerFieldValue(5), doc.getFieldValue(doc.getField("num")));
@@ -222,7 +222,7 @@ public class DocumentPathUpdateTestCase {
@Test
public void testApplyAssignMultiList() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
assertNull(doc.getFieldValue("strarray"));
Array<StringFieldValue> strArray = new Array<StringFieldValue>(doc.getField("strarray").getDataType());
strArray.add(new StringFieldValue("hello hello"));
@@ -232,7 +232,7 @@ public class DocumentPathUpdateTestCase {
Array<StringFieldValue> array = new Array<>(doc.getField("strarray").getDataType());
array.add(new StringFieldValue("assigned val 0"));
array.add(new StringFieldValue("assigned val 1"));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new AssignFieldPathUpdate(doc.getDataType(), "strarray", "", array));
docUp.applyTo(doc);
assertEquals(2, ((List) doc.getFieldValue("strarray")).size());
@@ -243,7 +243,7 @@ public class DocumentPathUpdateTestCase {
@Test
public void testApplyAssignMultiWlist() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
assertNull(doc.getFieldValue("strwset"));
WeightedSet<StringFieldValue> strwset = new WeightedSet<>(doc.getDataType().getField("strwset").getDataType());
strwset.put(new StringFieldValue("hello hello"), 164);
@@ -253,7 +253,7 @@ public class DocumentPathUpdateTestCase {
WeightedSet<StringFieldValue> assignWset = new WeightedSet<>(docType.getField("strwset").getDataType());
assignWset.put(new StringFieldValue("assigned val 0"), 5);
assignWset.put(new StringFieldValue("assigned val 1"), 10);
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new AssignFieldPathUpdate(doc.getDataType(), "strwset", "", assignWset));
docUp.applyTo(doc);
assertEquals(2, ((WeightedSet) doc.getFieldValue("strwset")).size());
@@ -264,14 +264,14 @@ public class DocumentPathUpdateTestCase {
@Test
public void testAssignWsetRemoveIfZero() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
assertNull(doc.getFieldValue(doc.getField("strwset")));
WeightedSet<StringFieldValue> strwset = new WeightedSet<>(doc.getDataType().getField("strwset").getDataType());
strwset.put(new StringFieldValue("hello hello"), 164);
strwset.put(new StringFieldValue("blahdi blahdi"), 243);
doc.setFieldValue(doc.getField("strwset"), strwset);
assertNotNull(doc.getFieldValue(doc.getField("strwset")));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
AssignFieldPathUpdate upd = new AssignFieldPathUpdate(doc.getDataType(), "strwset{hello hello}", "", "$value - 164");
upd.setRemoveIfZero(true);
docUp.addFieldPathUpdate(upd);
@@ -283,14 +283,14 @@ public class DocumentPathUpdateTestCase {
@Test
public void testApplyAddMultiList() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
assertNull(doc.getFieldValue("strarray"));
Array<StringFieldValue> addList = new Array<StringFieldValue>(doc.getField("strarray").getDataType());
addList.add(new StringFieldValue("bo"));
addList.add(new StringFieldValue("ba"));
addList.add(new StringFieldValue("by"));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new AddFieldPathUpdate(doc.getDataType(), "strarray", "", addList));
docUp.applyTo(doc);
List<StringFieldValue> values = new ArrayList<>();
@@ -302,7 +302,7 @@ public class DocumentPathUpdateTestCase {
@Test
public void testAddAndAssignList() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
assertNull(doc.getFieldValue("strarray"));
Array strArray = new Array(doc.getField("strarray").getDataType());
@@ -311,7 +311,7 @@ public class DocumentPathUpdateTestCase {
doc.setFieldValue("strarray", strArray);
assertNotNull(doc.getFieldValue("strarray"));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new AssignFieldPathUpdate(doc.getDataType(), "strarray[1]", "", new StringFieldValue("assigned val 1")));
Array adds = new Array(doc.getField("strarray").getDataType());
@@ -329,7 +329,7 @@ public class DocumentPathUpdateTestCase {
@Test
public void testAssignSimpleMapValueWithVariable() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
MapFieldValue mfv = new MapFieldValue((MapDataType)doc.getField("strmap").getDataType());
mfv.put(new StringFieldValue("foo"), new StringFieldValue("bar"));
@@ -337,7 +337,7 @@ public class DocumentPathUpdateTestCase {
doc.setFieldValue("strmap", mfv);
// Select on map value, not key
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::hargl:bargl"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:hargl:bargl"));
docUp.addFieldPathUpdate(new AssignFieldPathUpdate(doc.getDataType(), "strmap{$x}",
"foobar.strmap{$x} == \"bar\"", new StringFieldValue("shinyvalue")));
docUp.applyTo(doc);
@@ -404,7 +404,7 @@ public class DocumentPathUpdateTestCase {
@Test
public void testKeyWithEscapedChars() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
MapFieldValue mfv = new MapFieldValue((MapDataType)doc.getField("strmap").getDataType());
mfv.put(new StringFieldValue("here is a \"fancy\" :-} map key :-{"), new StringFieldValue("bar"));
@@ -412,7 +412,7 @@ public class DocumentPathUpdateTestCase {
doc.setFieldValue("strmap", mfv);
// Select on map value, not key
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::hargl:bargl"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:hargl:bargl"));
docUp.addFieldPathUpdate(new AssignFieldPathUpdate(doc.getDataType(), "strmap{\"here is a \\\"fancy\\\" :-} map key :-{\"}",
"", new StringFieldValue("shinyvalue")));
docUp.applyTo(doc);
@@ -425,7 +425,7 @@ public class DocumentPathUpdateTestCase {
@Test
public void testAssignMap() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
MapFieldValue mfv = new MapFieldValue((MapDataType)doc.getField("structmap").getDataType());
Struct fv1 = new Struct(mfv.getDataType().getValueType());
fv1.setFieldValue("title", new StringFieldValue("thomas"));
@@ -451,7 +451,7 @@ public class DocumentPathUpdateTestCase {
fv4.setFieldValue("title", new StringFieldValue("tor brede"));
fv4.setFieldValue("rating", new IntegerFieldValue(48));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new AssignFieldPathUpdate(doc.getDataType(), "structmap{bar}", "", fv4));
docUp.applyTo(doc);
@@ -463,7 +463,7 @@ public class DocumentPathUpdateTestCase {
@Test
public void testAssignMapStruct() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
MapFieldValue mfv = new MapFieldValue((MapDataType)doc.getField("structmap").getDataType());
Struct fv1 = new Struct(mfv.getDataType().getValueType());
fv1.setFieldValue("title", new StringFieldValue("thomas"));
@@ -489,7 +489,7 @@ public class DocumentPathUpdateTestCase {
fv4.setFieldValue("title", new StringFieldValue("cyril"));
fv4.setFieldValue("rating", new IntegerFieldValue(48));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new AssignFieldPathUpdate(doc.getDataType(), "structmap{bar}.rating", "", new IntegerFieldValue(48)));
docUp.applyTo(doc);
@@ -501,7 +501,7 @@ public class DocumentPathUpdateTestCase {
@Test
public void testAssignMapStructVariable() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
MapFieldValue mfv = new MapFieldValue((MapDataType)doc.getField("structmap").getDataType());
Struct fv1 = new Struct(mfv.getDataType().getValueType());
fv1.setFieldValue(fv1.getField("title"), new StringFieldValue("thomas"));
@@ -527,7 +527,7 @@ public class DocumentPathUpdateTestCase {
fv4.setFieldValue(fv4.getField("title"), new StringFieldValue("cyril"));
fv4.setFieldValue(fv4.getField("rating"), new IntegerFieldValue(48));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new AssignFieldPathUpdate(doc.getDataType(), "structmap{$x}.rating", "foobar.structmap{$x}.title == \"cyril\"", new IntegerFieldValue(48)));
docUp.applyTo(doc);
@@ -539,14 +539,14 @@ public class DocumentPathUpdateTestCase {
@Test
public void testAssignMapNoexist() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
MapFieldValue mfv = new MapFieldValue((MapDataType)doc.getField("structmap").getDataType());
Struct fv1 = new Struct(mfv.getDataType().getValueType());
fv1.setFieldValue("title", new StringFieldValue("thomas"));
fv1.setFieldValue("rating", new IntegerFieldValue(32));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
docUp.addFieldPathUpdate(new AssignFieldPathUpdate(doc.getDataType(), "structmap{foo}", "", fv1));
docUp.applyTo(doc);
@@ -556,14 +556,14 @@ public class DocumentPathUpdateTestCase {
@Test
public void testAssignMapNoexistNocreate() {
- Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("doc:something:foooo"));
MapFieldValue mfv = new MapFieldValue((MapDataType)doc.getField("structmap").getDataType());
Struct fv1 = new Struct(mfv.getDataType().getValueType());
fv1.setFieldValue("title", new StringFieldValue("thomas"));
fv1.setFieldValue("rating", new IntegerFieldValue(32));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
AssignFieldPathUpdate ass = new AssignFieldPathUpdate(doc.getDataType(), "structmap{foo}", "", fv1);
ass.setCreateMissingPath(false);
docUp.addFieldPathUpdate(ass);
@@ -575,7 +575,7 @@ public class DocumentPathUpdateTestCase {
@Test
public void testAssignSerialization() {
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
AssignFieldPathUpdate ass = new AssignFieldPathUpdate(docType, "num", "", "3");
ass.setCreateMissingPath(false);
docUp.addFieldPathUpdate(ass);
@@ -590,7 +590,7 @@ public class DocumentPathUpdateTestCase {
@Test
public void testAddSerialization() {
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
Array strArray = new Array(docType.getField("strarray").getDataType());
strArray.add(new StringFieldValue("hello hello"));
strArray.add(new StringFieldValue("blah blah"));
@@ -608,7 +608,7 @@ public class DocumentPathUpdateTestCase {
@Test
public void testRemoveSerialization() {
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
RemoveFieldPathUpdate remove = new RemoveFieldPathUpdate(docType, "num", "foobar.num > 0");
docUp.addFieldPathUpdate(remove);
@@ -633,7 +633,7 @@ public class DocumentPathUpdateTestCase {
docMan = DocumentTestCase.setUpCppDocType();
docType = docMan.getDocumentType("serializetest");
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:serializetest::xlanguage"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:serialization:xlanguage"));
AssignFieldPathUpdate ass = new AssignFieldPathUpdate(docType, "intfield", "", "3");
ass.setCreateMissingPath(false);
diff --git a/document/src/test/java/com/yahoo/document/DocumentRemoveTestCase.java b/document/src/test/java/com/yahoo/document/DocumentRemoveTestCase.java
index 8b84dc5f46b..9acd40770dc 100644
--- a/document/src/test/java/com/yahoo/document/DocumentRemoveTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentRemoveTestCase.java
@@ -16,16 +16,16 @@ public class DocumentRemoveTestCase {
@Test
public void requireThatToStringWorks() {
- DocumentId docId = new DocumentId("id:this:is::a:test");
+ DocumentId docId = new DocumentId("doc:this:is:a:test");
DocumentRemove r = new DocumentRemove(docId);
assertThat(r.toString().contains(docId.toString()), is(true));
}
@Test
public void requireThatEqualsAndHashCodeWorks() {
- DocumentRemove r1 = new DocumentRemove(new DocumentId("id:this:is::a:test"));
- DocumentRemove r2 = new DocumentRemove(new DocumentId("id:this:is::a:test"));
- DocumentRemove r3 = new DocumentRemove(new DocumentId("id:this:is::nonequal"));
+ DocumentRemove r1 = new DocumentRemove(new DocumentId("doc:this:is:a:test"));
+ DocumentRemove r2 = new DocumentRemove(new DocumentId("doc:this:is:a:test"));
+ DocumentRemove r3 = new DocumentRemove(new DocumentId("doc:this:is:nonequal"));
assertThat(r1, equalTo(r1));
assertThat(r1, equalTo(r2));
diff --git a/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java b/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java
index bc1224ca8ea..8ff168adc4b 100644
--- a/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java
@@ -89,7 +89,7 @@ public class DocumentSerializationTestCase extends AbstractTypesTest {
String path = "src/test/serializeddocuments/";
{
- Document doc = new Document(docType, "id:ns:serializetest::http://test.doc.id/");
+ Document doc = new Document(docType, "doc:serializetest:http://test.doc.id/");
doc.setFieldValue("intfield", 5);
doc.setFieldValue("floatfield", -9.23);
doc.setFieldValue("stringfield", "This is a string.");
@@ -100,7 +100,7 @@ public class DocumentSerializationTestCase extends AbstractTypesTest {
byte[] rawData = "RAW DATA".getBytes();
assertEquals(8, rawData.length);
doc.setFieldValue(docType.getField("rawfield"),new Raw(ByteBuffer.wrap("RAW DATA".getBytes())));
- Document docInDoc = new Document(docInDocType, "id:ns:docindoc::http://doc.in.doc/");
+ Document docInDoc = new Document(docInDocType, "doc:serializetest:http://doc.in.doc/");
docInDoc.setFieldValue("stringindocfield", "Elvis is dead");
doc.setFieldValue(docType.getField("docfield"), docInDoc);
Array<FloatFieldValue> floatArray = new Array<>(arrayOfFloatDataType);
@@ -146,12 +146,16 @@ public class DocumentSerializationTestCase extends AbstractTypesTest {
String cpppath = "src/tests/data/";
List<TestDoc> tests = new ArrayList<>();
- tests.add(new TestDoc(path + "document-java-currentversion-uncompressed.dat", Document.SERIALIZED_VERSION));
- tests.add(new TestDoc(path + "document-java-currentversion-lz4-9.dat", Document.SERIALIZED_VERSION));
+ tests.add(new TestDoc(path + "document-java-currentversion-uncompressed.dat",
+ Document.SERIALIZED_VERSION));
+ tests.add(new TestDoc(path + "document-java-currentversion-lz4-9.dat",
+ Document.SERIALIZED_VERSION));
tests.add(new TestDoc(path + "document-java-v8-uncompressed.dat", 8));
tests.add(new TestDoc(cpppath + "document-cpp-currentversion-uncompressed.dat", 7));
tests.add(new TestDoc(cpppath + "document-cpp-currentversion-lz4-9.dat", 7));
tests.add(new TestDoc(cpppath + "document-cpp-v8-uncompressed.dat", 7));
+ tests.add(new TestDoc(cpppath + "document-cpp-v7-uncompressed.dat", 7));
+ tests.add(new TestDoc(cpppath + "serializev6.dat", 6));
for (TestDoc test : tests) {
File f = new File(test.testFile);
FileInputStream fin = new FileInputStream(f);
@@ -202,7 +206,7 @@ public class DocumentSerializationTestCase extends AbstractTypesTest {
@Test
public void testSerializeDeserializeWithAnnotations() throws IOException {
- Document doc = new Document(docType, "id:ns:dokk::bar");
+ Document doc = new Document(docType, "doc:foo:bar");
doc.setFieldValue("age", (byte)123);
doc.setFieldValue("story", getAnnotatedString());
diff --git a/document/src/test/java/com/yahoo/document/DocumentTestCase.java b/document/src/test/java/com/yahoo/document/DocumentTestCase.java
index 141a74a24fe..28267a22a56 100644
--- a/document/src/test/java/com/yahoo/document/DocumentTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentTestCase.java
@@ -54,7 +54,7 @@ import static org.junit.Assert.fail;
public class DocumentTestCase extends DocumentTestCaseBase {
private static final String SERTEST_DOC_AS_XML_HEAD =
- "<document documenttype=\"sertest\" documentid=\"id:ns:sertest::foobar\">\n" +
+ "<document documenttype=\"sertest\" documentid=\"doc:sertest:foobar\">\n" +
" <mailid>emailfromalicetobob&amp;someone</mailid>\n" +
" <date>-2013512400</date>\n" +
" <attachmentcount>2</attachmentcount>\n" +
@@ -76,7 +76,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
" <myposfield>N37.374821;W122.057174</myposfield>\n";
private static final String SERTEST_DOC_AS_XML_FOOT =
- " <docindoc documenttype=\"docindoc\" documentid=\"id:ns:docindoc::inserted\">\n" +
+ " <docindoc documenttype=\"docindoc\" documentid=\"doc:sertest:inserted\">\n" +
" <tull>ball</tull>\n" +
" </docindoc>\n" +
" <mapfield>\n" +
@@ -143,7 +143,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
}
private Document getSertestDocument() {
- Document doc = new Document(docMan.getDocumentType("sertest"), new DocumentId("id:ns:sertest::foobar"));
+ Document doc = new Document(docMan.getDocumentType("sertest"), new DocumentId("doc:sertest:foobar"));
doc.setFieldValue("mailid", "emailfromalicetobob");
doc.setFieldValue("date", -2013512400); // 03/13/06 11:00:00
doc.setFieldValue("attachmentcount", 2);
@@ -155,7 +155,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
doc.setFieldValue("rawfield", new Raw(ByteBuffer.wrap(rawBytes)));
- Document docInDoc = new Document(docMan.getDocumentType("docindoc"), new DocumentId("id:ns:docindoc::inserted"));
+ Document docInDoc = new Document(docMan.getDocumentType("docindoc"), new DocumentId("doc:sertest:inserted"));
docInDoc.setFieldValue("tull", "ball");
doc.setFieldValue("docindoc", docInDoc);
@@ -182,7 +182,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
type.addField(new Field("long", DataType.LONG));
type.addField(new Field("string", DataType.STRING));
- Document doc = new Document(type, "id:ns:test::");
+ Document doc = new Document(type, "doc:scheme:");
FieldValue stringVal = new StringFieldValue("69");
FieldValue doubleVal = new DoubleFieldValue(6.9);
FieldValue floatVal = new FloatFieldValue(6.9f);
@@ -256,7 +256,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
iiiaV.add(iiaV);
}
- Document doc = new Document(type, new DocumentId("id:ns:test::"));
+ Document doc = new Document(type, new DocumentId("doc:foo:testdoc"));
doc.setFieldValue("iiiarray", iiiaV);
{
@@ -299,7 +299,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
@Test
public void testGetRecursiveValue() {
- Document doc = new Document(testDocType, new DocumentId("id:ns:testdoc::"));
+ Document doc = new Document(testDocType, new DocumentId("doc:ns:testdoc"));
doc.setFieldValue("primitive1", 1);
Struct l1s1 = new Struct(doc.getField("l1s1").getDataType());
@@ -478,7 +478,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
@Test
public void testModifyDocument() {
- Document doc = new Document(testDocType, new DocumentId("id:ns:testdoc::"));
+ Document doc = new Document(testDocType, new DocumentId("doc:ns:testdoc"));
doc.setFieldValue("primitive1", 1);
Struct l1s1 = new Struct(doc.getField("l1s1").getDataType());
@@ -601,7 +601,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
@Test
public void testNoType() {
try {
- new Document(null, new DocumentId("id:null:type::URI"));
+ new Document(null, new DocumentId("doc:null:URI"));
fail("Should have gotten an Exception");
} catch (NullPointerException | IllegalArgumentException e) {
// Success
@@ -610,7 +610,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
@Test
public void testURI() {
- String uri = "id:ns:testdoc::http://www.ntnu.no/";
+ String uri = "doc:testdoc:http://www.ntnu.no/";
DocumentType documentType = docMan.getDocumentType("testdoc");
assertNotNull(documentType);
@@ -620,7 +620,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
@Test
public void testSetGet() {
- Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("id:ns:testdoc::test"));
+ Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("doc:testdoc:test"));
Object val = doc.getFieldValue(minField.getName());
assertNull(val);
doc.setFieldValue(minField.getName(), 500);
@@ -662,6 +662,16 @@ public class DocumentTestCase extends DocumentTestCaseBase {
validateCppDoc(doc);
}
+ @Test
+ public void testV6Doc() throws IOException {
+ docMan = setUpCppDocType();
+ byte[] data = readFile("src/tests/data/serializev6.dat");
+ ByteBuffer buf = ByteBuffer.wrap(data);
+
+ Document doc = docMan.createDocument(new GrowableByteBuffer(buf));
+ validateCppDocNotMap(doc);
+ }
+
public void validateCppDoc(Document doc) throws IOException {
validateCppDocNotMap(doc);
MapFieldValue map = (MapFieldValue)doc.getFieldValue("mapfield");
@@ -672,7 +682,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
@SuppressWarnings("unchecked")
public void validateCppDocNotMap(Document doc) throws IOException {
// in practice to validate v6 serialization
- assertEquals("id:ns:serializetest::http://test.doc.id/", doc.getId().toString());
+ assertEquals("doc:serializetest:http://test.doc.id/", doc.getId().toString());
assertEquals(new IntegerFieldValue(5), doc.getFieldValue("intfield"));
assertEquals(new FloatFieldValue((float)-9.23), doc.getFieldValue("floatfield"));
assertEquals(new StringFieldValue("This is a string."), doc.getFieldValue("stringfield"));
@@ -686,7 +696,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
Document docindoc = (Document)doc.getFieldValue("docfield");
assertEquals(docMan.getDocumentType("docindoc"), docindoc.getDataType());
- assertEquals(new DocumentId("id:ns:docindoc::http://embedded"), docindoc.getId());
+ assertEquals(new DocumentId("doc:docindoc:http://embedded"), docindoc.getId());
Array<FloatFieldValue> array = (Array<FloatFieldValue>)doc.getFieldValue("arrayoffloatfield");
assertEquals(new FloatFieldValue(1.0f), array.get(0));
@@ -703,10 +713,10 @@ public class DocumentTestCase extends DocumentTestCaseBase {
docMan = setUpCppDocType();
Document doc = new Document(docMan.getDocumentType("serializetest"),
- new DocumentId("id:ns:serializetest::http://test.doc.id/"));
+ new DocumentId("doc:serializetest:http://test.doc.id/"));
Document docindoc = new Document(docMan.getDocumentType("docindoc"),
- new DocumentId("id:ns:docindoc::http://doc.in.doc/"));
+ new DocumentId("doc:serializetest:http://doc.in.doc/"));
docindoc.setFieldValue("stringindocfield", "Elvis is dead");
doc.setFieldValue("docfield", docindoc);
@@ -892,7 +902,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
DocumentTypeManager manager = new DocumentTypeManager();
manager.register(childType);
- Document child = new Document(childType, new DocumentId("id:ns:child::what:test"));
+ Document child = new Document(childType, new DocumentId("doc:what:test"));
child.setFieldValue(childType.getField("parentbodyint"), new IntegerFieldValue(4));
child.setFieldValue("parentheaderint", 6);
child.setFieldValue("overwritten", 7);
@@ -939,7 +949,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
//just checks that isAssignableFrom() in Document.setFieldValue() goes the right way
- Document doc = new Document(docMan.getDocumentType("impl"), new DocumentId("id:ns:impl::fooooobardoc"));
+ Document doc = new Document(docMan.getDocumentType("impl"), new DocumentId("doc:doctest:fooooobardoc"));
Array<StringFieldValue> testlist = new Array<>(doc.getField("something").getDataType());
doc.setFieldValue("something", testlist);
}
@@ -952,7 +962,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
DocumentTypeManager docMan = new DocumentTypeManager();
docMan.configure("file:src/tests/data/cppdocument.cfg");
- Document doc = new Document(docMan.getDocumentType("serializetest"), new DocumentId("id:ns:serializetest::test"));
+ Document doc = new Document(docMan.getDocumentType("serializetest"), new DocumentId("doc:test:test"));
doc.setFieldValue("stringfield",
"compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me ");
@@ -965,7 +975,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
DocumentTypeManager docMan = new DocumentTypeManager();
docMan.configure("file:src/tests/data/compressed.cfg");
- Document doc = new Document(docMan.getDocumentType("serializetest"), new DocumentId("id:ns:serializetest::test"));
+ Document doc = new Document(docMan.getDocumentType("serializetest"), new DocumentId("doc:test:test"));
doc.setFieldValue("stringfield",
"compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me compress me ");
@@ -987,8 +997,8 @@ public class DocumentTestCase extends DocumentTestCaseBase {
docMan.getDocumentType("outerdoc");
//create document and necessary structures
- Document outerdoc = new Document(docMan.getDocumentType("outerdoc"), new DocumentId("id:recursion:outerdoc::"));
- Document innerdoc = new Document(docMan.getDocumentType("innerdoc"), new DocumentId("id:recursion:innerdoc::"));
+ Document outerdoc = new Document(docMan.getDocumentType("outerdoc"), new DocumentId("doc:recursion:outerdoc"));
+ Document innerdoc = new Document(docMan.getDocumentType("innerdoc"), new DocumentId("doc:recursion:innerdoc"));
innerdoc.setFieldValue("intfield", 55);
@@ -1012,7 +1022,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
@Test
public void testTimestamp() {
- Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("id:ns:testdoc::timetest"));
+ Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("doc:testdoc:timetest"));
assertNull(doc.getLastModified());
doc.setLastModified(4350129845023985L);
assertEquals(Long.valueOf(4350129845023985L), doc.getLastModified());
@@ -1062,18 +1072,18 @@ public class DocumentTestCase extends DocumentTestCaseBase {
@Test
public void testSingleFieldToXml() {
- Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("id:ns:testdoc::xmltest"));
+ Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("doc:testdoc:xmltest"));
doc.setFieldValue("stringattr", new StringFieldValue("hello world"));
assertEquals("<value>hello world</value>\n", doc.getFieldValue("stringattr").toXml());
}
@Test
public void testDelegatedDocumentToXml() {
- Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("id:ns:testdoc::xmltest"));
+ Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("doc:testdoc:xmltest"));
doc.setFieldValue("stringattr", new StringFieldValue("hello universe"));
// Should just delegate to toXML
assertEquals(
- "<document documenttype=\"testdoc\" documentid=\"id:ns:testdoc::xmltest\">\n" +
+ "<document documenttype=\"testdoc\" documentid=\"doc:testdoc:xmltest\">\n" +
" <stringattr>hello universe</stringattr>\n" +
"</document>\n",
doc.toXml());
@@ -1086,7 +1096,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
String json = doc.toJson();
Map<String, Object> parsed = new ObjectMapper().readValue(json, new TypeReference<Map<String, Object>>() {
});
- assertEquals(parsed.get("id"), "id:ns:sertest::foobar");
+ assertEquals(parsed.get("id"), "doc:sertest:foobar");
assertThat(parsed.get("fields"), instanceOf(Map.class));
Object fieldMap = parsed.get("fields");
if (fieldMap instanceof Map) {
@@ -1111,7 +1121,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
GrowableByteBuffer grbuf = new GrowableByteBuffer();
{
- Document doc = new Document(docType, new DocumentId("id:ns:emptystrings::"));
+ Document doc = new Document(docType, new DocumentId("doc:a:b:emptystrings"));
doc.setFieldValue("emptystring", "");
doc.removeFieldValue("nullstring");
@@ -1147,7 +1157,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
GrowableByteBuffer grbuf = new GrowableByteBuffer();
- Document doc = new Document(docType, new DocumentId("id:ns:bug2354045::strings"));
+ Document doc = new Document(docType, new DocumentId("doc:a:b:strings"));
doc.removeFieldValue("string");
assertNull(doc.getFieldValue("string"));
@@ -1175,7 +1185,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
typeWithDinner.addField("dinner", DataType.DOUBLE);
docTypeManasjer.registerDocumentType(typeWithDinner);
- Document docWithDinner = new Document(typeWithDinner, "id:ns:elvis::has:left:the:building");
+ Document docWithDinner = new Document(typeWithDinner, "doc:elvis:has:left:the:building");
docWithDinner.setFieldValue("breakfast", "peanut butter");
docWithDinner.setFieldValue("lunch", 14);
docWithDinner.setFieldValue("dinner", 5.43d);
@@ -1209,11 +1219,11 @@ public class DocumentTestCase extends DocumentTestCaseBase {
Document doc;
- doc = new Document(type, "id:ns:foo::bar:bar");
+ doc = new Document(type, "doc:foo:bar:bar");
doc.removeFieldValue("productdesc");
assertNull(doc.getFieldValue("productdesc"));
- doc = new Document(type, "id:ns:foo::bar:bar");
+ doc = new Document(type, "doc:foo:bar:bar");
assertNull(doc.getFieldValue("productdesc"));
}
@@ -1281,13 +1291,13 @@ public class DocumentTestCase extends DocumentTestCaseBase {
docType.addField(new Field("float", 0, DataType.FLOAT, true));
docMan.register(docType);
- Document doc1 = new Document(docType, new DocumentId("id:ns:bug2354045::bug6394548"));
+ Document doc1 = new Document(docType, new DocumentId("doc:a:b:bug6394548"));
doc1.setFieldValue("string", new StringFieldValue("hello world"));
doc1.setFieldValue("int", new IntegerFieldValue(1234));
doc1.setFieldValue("float", new FloatFieldValue(5.5f));
String doc1Before = doc1.toXml();
- Document doc2 = new Document(docType, new DocumentId("id:ns:bug2354045::bug6394548"));
+ Document doc2 = new Document(docType, new DocumentId("doc:a:b:bug6394548"));
doc2.setFieldValue("string", new StringFieldValue("aardvark"));
doc2.setFieldValue("int", new IntegerFieldValue(90909));
doc2.setFieldValue("float", new FloatFieldValue(777.15f));
diff --git a/document/src/test/java/com/yahoo/document/DocumentTestCaseBase.java b/document/src/test/java/com/yahoo/document/DocumentTestCaseBase.java
index 68fe1c8cc57..48fb44fa260 100644
--- a/document/src/test/java/com/yahoo/document/DocumentTestCaseBase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentTestCaseBase.java
@@ -65,7 +65,7 @@ public class DocumentTestCaseBase {
}
public Document getTestDocument() {
- Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("id:ns:testdoc::http://www.ntnu.no/"));
+ Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("doc:testdoc:http://www.ntnu.no/"));
doc.setFieldValue(byteField.getName(), (byte) 30);
doc.setFieldValue(byteField.getName(), (byte)30);
doc.setFieldValue(intField.getName(), 50);
diff --git a/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java b/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java
index 5f180beab35..0712adca3a5 100644
--- a/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java
@@ -64,7 +64,7 @@ public class DocumentUpdateTestCase {
private FieldUpdate addMultiList = null;
private FieldUpdate addMultiWset = null;
- private final String documentId = "id:ns:foobar::foooo";
+ private final String documentId = "doc:something:foooo";
private final String tensorField = "tensorfield";
private final TensorType tensorType = new TensorType.Builder().mapped("x").build();
@@ -92,11 +92,11 @@ public class DocumentUpdateTestCase {
docType2.addField(new Field("strinother", DataType.STRING));
docMan.register(docType2);
- docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
+ docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
assignSingle = FieldUpdate.createAssign(docType.getField("strfoo"), new StringFieldValue("something"));
- Array<StringFieldValue> assignList = new Array<>(docType.getField("strarray").getDataType());
+ Array<StringFieldValue> assignList = new Array<StringFieldValue>(docType.getField("strarray").getDataType());
assignList.add(new StringFieldValue("assigned val 0"));
assignList.add(new StringFieldValue("assigned val 1"));
assignMultiList = FieldUpdate.createAssign(docType.getField("strarray"), assignList);
@@ -266,7 +266,7 @@ public class DocumentUpdateTestCase {
Field field = new Field("my_int", DataType.INT);
docType.addField(field);
- DocumentUpdate update = new DocumentUpdate(docType, new DocumentId("id:ns:my_type::foo:"));
+ DocumentUpdate update = new DocumentUpdate(docType, new DocumentId("doc:foo:"));
update.addFieldUpdate(FieldUpdate.createAssign(field, new IntegerFieldValue(1)));
update.addFieldUpdate(FieldUpdate.createAssign(field, new IntegerFieldValue(2)));
@@ -287,7 +287,7 @@ public class DocumentUpdateTestCase {
@Test
public void testUpdateToWrongField() {
DocumentType docType = new DocumentType("my_type");
- DocumentUpdate update = new DocumentUpdate(docType, new DocumentId("id:ns:my_type::foo:"));
+ DocumentUpdate update = new DocumentUpdate(docType, new DocumentId("doc:foo:"));
try {
update.addFieldUpdate(FieldUpdate.createIncrement(new Field("my_int", DataType.INT), 1));
fail();
@@ -313,7 +313,7 @@ public class DocumentUpdateTestCase {
}
assertEquals(2 // version
- + (17 + 1) //docid id:ns:foobar:bar\0
+ + (11 + 1) //docid doc:foo:bar\0
+ 1 //contents
+ (6 + 1 + 2) //doctype foobar\0\0\0
+ 4 //num field updates
@@ -349,7 +349,7 @@ public class DocumentUpdateTestCase {
DocumentUpdate upd = new DocumentUpdate(buf);
- assertEquals(new DocumentId("id:ns:serializetest::update"), upd.getId());
+ assertEquals(new DocumentId("doc:update:test"), upd.getId());
assertEquals(type, upd.getType());
FieldUpdate serAssignFU = upd.getFieldUpdate(type.getField("intfield"));
@@ -390,7 +390,7 @@ public class DocumentUpdateTestCase {
docMan = DocumentTestCase.setUpCppDocType();
DocumentType type = docMan.getDocumentType("serializetest");
- DocumentUpdate upd = new DocumentUpdate(type, new DocumentId("id:ns:serializetest::update"));
+ DocumentUpdate upd = new DocumentUpdate(type, new DocumentId("doc:update:test"));
FieldUpdate serAssign = FieldUpdate.createAssign(type.getField("intfield"), new IntegerFieldValue(4));
upd.addFieldUpdate(serAssign);
FieldUpdate serClearField = FieldUpdate.createClearField(type.getField("floatfield"));
@@ -422,11 +422,11 @@ public class DocumentUpdateTestCase {
docType.addField(field);
FieldUpdate fooField = FieldUpdate.createAssign(field, new IntegerFieldValue(1));
- DocumentUpdate fooUpdate = new DocumentUpdate(docType, new DocumentId("id:ns:my_type::foo:"));
+ DocumentUpdate fooUpdate = new DocumentUpdate(docType, new DocumentId("doc:foo:"));
fooUpdate.addFieldUpdate(fooField);
FieldUpdate barField = FieldUpdate.createAssign(field, new IntegerFieldValue(2));
- DocumentUpdate barUpdate = new DocumentUpdate(docType, new DocumentId("id:ns:my_type::foo:"));
+ DocumentUpdate barUpdate = new DocumentUpdate(docType, new DocumentId("doc:foo:"));
barUpdate.addFieldUpdate(barField);
fooUpdate.addAll(barUpdate);
@@ -451,7 +451,7 @@ public class DocumentUpdateTestCase {
Field your_int = new Field("your_int", DataType.INT);
docType.addField(my_int);
docType.addField(your_int);
- DocumentUpdate update = new DocumentUpdate(docType, new DocumentId("id:this:my_type::is:a:test"));
+ DocumentUpdate update = new DocumentUpdate(docType, new DocumentId("doc:this:is:a:test"));
update.addFieldUpdate(FieldUpdate.createAssign(my_int, new IntegerFieldValue(2)));
assertNull(update.getFieldUpdate("none-existing-field"));
@@ -473,8 +473,8 @@ public class DocumentUpdateTestCase {
@Test
public void testInstantiationAndEqualsHashCode() {
DocumentType type = new DocumentType("doo");
- DocumentUpdate d1 = new DocumentUpdate(type, new DocumentId("id:this:doo::is:a:test"));
- DocumentUpdate d2 = new DocumentUpdate(type, "id:this:doo::is:a:test");
+ DocumentUpdate d1 = new DocumentUpdate(type, new DocumentId("doc:this:is:a:test"));
+ DocumentUpdate d2 = new DocumentUpdate(type, "doc:this:is:a:test");
assertEquals(d1, d2);
assertEquals(d1, d1);
@@ -487,10 +487,10 @@ public class DocumentUpdateTestCase {
@Test
public void testThatApplyingToWrongTypeFails() {
DocumentType t1 = new DocumentType("doo");
- DocumentUpdate documentUpdate = new DocumentUpdate(t1, new DocumentId("id:this:doo::is:a:test"));
+ DocumentUpdate documentUpdate = new DocumentUpdate(t1, new DocumentId("doc:this:is:a:test"));
DocumentType t2 = new DocumentType("foo");
- Document document = new Document(t2, "id:this:foo::is:another:test");
+ Document document = new Document(t2, "doc:this:is:another:test");
try {
documentUpdate.applyTo(document);
@@ -509,7 +509,7 @@ public class DocumentUpdateTestCase {
t1.addField(f1);
t1.addField(f2);
- DocumentUpdate documentUpdate = new DocumentUpdate(t1, new DocumentId("id:ns:doo::is:a:test"));
+ DocumentUpdate documentUpdate = new DocumentUpdate(t1, new DocumentId("doc:this:is:a:test"));
assertEquals(0, documentUpdate.size());
@@ -569,8 +569,8 @@ public class DocumentUpdateTestCase {
t1.addField(f1);
t2.addField(f2);
- DocumentUpdate du1 = new DocumentUpdate(t1, new DocumentId("id:this:doo::is:a:test"));
- DocumentUpdate du2 = new DocumentUpdate(t2, "id:this:foo::is:another:test");
+ DocumentUpdate du1 = new DocumentUpdate(t1, new DocumentId("doc:this:is:a:test"));
+ DocumentUpdate du2 = new DocumentUpdate(t2, "doc:this:is:another:test");
FieldUpdate fu1 = FieldUpdate.createAssign(f1, new StringFieldValue("banana"));
FieldUpdate fu2 = FieldUpdate.createAssign(f2, new StringFieldValue("apple"));
@@ -586,7 +586,7 @@ public class DocumentUpdateTestCase {
//ok!
}
- DocumentUpdate du3 = new DocumentUpdate(t2, new DocumentId("id:this:foo::is:a:test"));
+ DocumentUpdate du3 = new DocumentUpdate(t2, new DocumentId("doc:this:is:a:test"));
try {
du1.addAll(du3);
diff --git a/document/src/test/java/com/yahoo/document/GlobalIdTestCase.java b/document/src/test/java/com/yahoo/document/GlobalIdTestCase.java
index 77049a1c535..cb818f12d3f 100644
--- a/document/src/test/java/com/yahoo/document/GlobalIdTestCase.java
+++ b/document/src/test/java/com/yahoo/document/GlobalIdTestCase.java
@@ -90,9 +90,9 @@ public class GlobalIdTestCase {
verifyGidToBucketIdMapping("id:ns:mytype:n=1000:abc");
verifyGidToBucketIdMapping("id:hsgf:mytype:n=9146744073700000000:dfdfsdfg");
verifyGidToBucketIdMapping("id:ns:mytype:g=somegroup:hmm");
- verifyGidToBucketIdMapping("id:foo:mytype::test");
- verifyGidToBucketIdMapping("id:myns:mytype::http://foo.bar");
- verifyGidToBucketIdMapping("id:jsrthsdf:mytype::a234aleingzldkifvasdfgadf");
+ verifyGidToBucketIdMapping("doc:foo:test");
+ verifyGidToBucketIdMapping("doc:myns:http://foo.bar");
+ verifyGidToBucketIdMapping("doc:jsrthsdf:a234aleingzldkifvasdfgadf");
}
}
diff --git a/document/src/test/java/com/yahoo/document/SimpleDocumentTestCase.java b/document/src/test/java/com/yahoo/document/SimpleDocumentTestCase.java
index c6bf2b07443..049b401c39f 100644
--- a/document/src/test/java/com/yahoo/document/SimpleDocumentTestCase.java
+++ b/document/src/test/java/com/yahoo/document/SimpleDocumentTestCase.java
@@ -16,7 +16,7 @@ public class SimpleDocumentTestCase {
public void requireThatAccessorsWorks() {
DocumentType type = new DocumentType("test");
type.addField("int", DataType.INT);
- Document doc = new Document(type, "id:ns:test::");
+ Document doc = new Document(type, "doc:scheme:");
SimpleDocument simple = new SimpleDocument(doc);
assertNull(simple.get("int"));
diff --git a/document/src/test/java/com/yahoo/document/annotation/Bug4259784TestCase.java b/document/src/test/java/com/yahoo/document/annotation/Bug4259784TestCase.java
index 454d34195e5..0a7739fd8c1 100644
--- a/document/src/test/java/com/yahoo/document/annotation/Bug4259784TestCase.java
+++ b/document/src/test/java/com/yahoo/document/annotation/Bug4259784TestCase.java
@@ -26,7 +26,7 @@ public class Bug4259784TestCase {
DocumentTypeManagerConfigurer.configure(manager, "file:src/test/java/com/yahoo/document/annotation/documentmanager.bug4259784.cfg");
DocumentType type = manager.getDocumentType("blog");
- Document doc = new Document(type, "id:this:blog::is:a:test");
+ Document doc = new Document(type, "doc:this:is:a:test");
doc.setFieldValue("body", new StringFieldValue("bla bla bla bla bla bla bla" +
"bla bla bla bla bla bla bla"));
annotate(doc, manager);
diff --git a/document/src/test/java/com/yahoo/document/annotation/Bug4261985TestCase.java b/document/src/test/java/com/yahoo/document/annotation/Bug4261985TestCase.java
index 72a141ecc93..a3b33d4b915 100644
--- a/document/src/test/java/com/yahoo/document/annotation/Bug4261985TestCase.java
+++ b/document/src/test/java/com/yahoo/document/annotation/Bug4261985TestCase.java
@@ -26,7 +26,7 @@ public class Bug4261985TestCase {
DocumentTypeManagerConfigurer.configure(manager, "file:src/test/java/com/yahoo/document/annotation/documentmanager.bug4261985.cfg");
DocumentType type = manager.getDocumentType("blog");
- Document doc = new Document(type, "id:this:blog::is:a:test");
+ Document doc = new Document(type, "doc:this:is:a:test");
doc.setFieldValue("body", new StringFieldValue("bla bla bla bla bla bla bla" +
"bla bla bla bla bla bla bla"));
annotate(doc, manager);
diff --git a/document/src/test/java/com/yahoo/document/annotation/Bug4475379TestCase.java b/document/src/test/java/com/yahoo/document/annotation/Bug4475379TestCase.java
index 6ca076ad3c6..0291e23c888 100755
--- a/document/src/test/java/com/yahoo/document/annotation/Bug4475379TestCase.java
+++ b/document/src/test/java/com/yahoo/document/annotation/Bug4475379TestCase.java
@@ -27,7 +27,7 @@ public class Bug4475379TestCase {
DocumentTypeManagerConfigurer.configure(manager, "file:src/test/java/com/yahoo/document/annotation/documentmanager.bug4475379.cfg");
DocumentType type = manager.getDocumentType("blog");
- Document doc = new Document(type, "id:this:blog::is:a:test");
+ Document doc = new Document(type, "doc:this:is:a:test");
doc.setFieldValue("body", new StringFieldValue(""));
annotate(manager, doc);
diff --git a/document/src/test/java/com/yahoo/document/annotation/Bug6394548TestCase.java b/document/src/test/java/com/yahoo/document/annotation/Bug6394548TestCase.java
index a0315c53dc3..8b9649d697f 100644
--- a/document/src/test/java/com/yahoo/document/annotation/Bug6394548TestCase.java
+++ b/document/src/test/java/com/yahoo/document/annotation/Bug6394548TestCase.java
@@ -25,7 +25,7 @@ public class Bug6394548TestCase {
AnnotationType featureSetType = registry.getType("morty.RICK_FEATURESET");
assertNotNull(featureSetType);
- Document doc = new Document(manager.getDocumentType("article"), "id:ns:article::test");
+ Document doc = new Document(manager.getDocumentType("article"), "doc:article:test");
StringFieldValue sfv = new StringFieldValue("badger waltz");
SpanList root = new SpanList();
diff --git a/document/src/test/java/com/yahoo/document/annotation/SystemTestCase.java b/document/src/test/java/com/yahoo/document/annotation/SystemTestCase.java
index 5382c471963..9163b773bcf 100755
--- a/document/src/test/java/com/yahoo/document/annotation/SystemTestCase.java
+++ b/document/src/test/java/com/yahoo/document/annotation/SystemTestCase.java
@@ -120,7 +120,7 @@ public class SystemTestCase {
@Test
public void testSystemTest() {
DocumentType type = manager.getDocumentType("article");
- Document inDocument = new Document(type, "id:ns:article::boringarticle:longarticle");
+ Document inDocument = new Document(type, "doc:article:boringarticle:longarticle");
annotate(inDocument);
GrowableByteBuffer buffer = new GrowableByteBuffer();
diff --git a/document/src/test/java/com/yahoo/document/datatypes/StringTestCase.java b/document/src/test/java/com/yahoo/document/datatypes/StringTestCase.java
index 514b793f28e..296ab1ac3fc 100644
--- a/document/src/test/java/com/yahoo/document/datatypes/StringTestCase.java
+++ b/document/src/test/java/com/yahoo/document/datatypes/StringTestCase.java
@@ -203,7 +203,7 @@ public class StringTestCase extends AbstractTypesTest {
.configure(manager, "file:src/test/java/com/yahoo/document/datatypes/documentmanager.blog.sd");
DocumentType blogType = manager.getDocumentType("blog");
- Document doc = new Document(blogType, "id:ns:blog::http://blogs.sun.com/praveenm");
+ 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"));
diff --git a/document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java b/document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java
index 0ff0bd81d90..6457a3deb82 100644
--- a/document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java
+++ b/document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java
@@ -244,7 +244,7 @@ public class DocumentSelectorTestCase {
@Test
public void testDocumentUpdate() throws ParseException {
- DocumentUpdate upd = new DocumentUpdate(manager.getDocumentType("test"), new DocumentId("id:myspace:test::anything"));
+ DocumentUpdate upd = new DocumentUpdate(manager.getDocumentType("test"), new DocumentId("doc:myspace:anything"));
assertEquals(Result.TRUE, evaluate("test", upd));
assertEquals(Result.FALSE, evaluate("music", upd));
assertEquals(Result.TRUE, evaluate("test or music", upd));
@@ -289,8 +289,8 @@ public class DocumentSelectorTestCase {
@Test
public void testInvalidLogic() throws ParseException {
- DocumentPut put = new DocumentPut(manager.getDocumentType("test"), new DocumentId("id:ns:test::"));
- DocumentUpdate upd = new DocumentUpdate(manager.getDocumentType("test"), new DocumentId("id:ns:test::"));
+ DocumentPut put = new DocumentPut(manager.getDocumentType("test"), new DocumentId("doc:scheme:"));
+ DocumentUpdate upd = new DocumentUpdate(manager.getDocumentType("test"), new DocumentId("doc:scheme:"));
assertEquals(Result.FALSE, evaluate("test.content", put)); // BROKEN
assertEquals(Result.INVALID, evaluate("test.content", upd));
@@ -325,13 +325,13 @@ public class DocumentSelectorTestCase {
List<DocumentPut> createDocs() {
List<DocumentPut> documents = new ArrayList<>();
- documents.add(createDocument("id:myspace:test::anything", 24, 2.0f, "foo", "bar"));
- documents.add(createDocument("id:anotherspace:test::foo", 13, 4.1f, "bar", "foo"));
+ documents.add(createDocument("doc:myspace:anything", 24, 2.0f, "foo", "bar"));
+ documents.add(createDocument("doc:anotherspace:foo", 13, 4.1f, "bar", "foo"));
documents.add(createDocument("id:myspace:test:n=1234:mail1", 15, 1.0f, "some", "some"));
documents.add(createDocument("id:myspace:test:n=5678:bar", 14, 2.4f, "Yet", "More"));
documents.add(createDocument("id:myspace:test:n=2345:mail2", 15, 1.0f, "bar", "baz"));
documents.add(createDocument("id:myspace:test:g=mygroup:qux", 15, 1.0f, "quux", "corge"));
- documents.add(createDocument("id:myspace:test::missingint", null, 2.0f, null, "bar"));
+ documents.add(createDocument("doc:myspace:missingint", null, 2.0f, null, "bar"));
// Add some array/struct info to doc 1
Struct sval = new Struct(documents.get(1).getDocument().getField("mystruct").getDataType());
@@ -521,11 +521,11 @@ public class DocumentSelectorTestCase {
assertEquals(Result.FALSE, evaluate("not test.hint and false", doc1234));
// Id values.
- assertEquals(Result.TRUE, evaluate("id == \"id:myspace:test::anything\"", documents.get(0)));
- assertEquals(Result.TRUE, evaluate(" iD== \"id:myspace:test::anything\" ", documents.get(0)));
- assertEquals(Result.FALSE, evaluate("id == \"id:myspa:test::nything\"", documents.get(0)));
- assertEquals(Result.FALSE, evaluate("Id.scHeme == \"xyz\"", documents.get(0)));
- assertEquals(Result.TRUE, evaluate("id.scheme == \"id\"", documents.get(0)));
+ assertEquals(Result.TRUE, evaluate("id == \"doc:myspace:anything\"", documents.get(0)));
+ assertEquals(Result.TRUE, evaluate(" iD== \"doc:myspace:anything\" ", documents.get(0)));
+ assertEquals(Result.FALSE, evaluate("id == \"doc:myspa:nything\"", documents.get(0)));
+ assertEquals(Result.TRUE, evaluate("Id.scHeme == \"doc\"", documents.get(0)));
+ assertEquals(Result.FALSE, evaluate("id.scheme == \"id\"", documents.get(0)));
assertEquals(Result.TRUE, evaluate("id.type == \"test\"", documents.get(4)));
assertEquals(Result.FALSE, evaluate("id.type == \"wrong\"", documents.get(4)));
assertEquals(Result.TRUE, evaluate("Id.namespaCe == \"myspace\"", documents.get(0)));
@@ -538,6 +538,7 @@ public class DocumentSelectorTestCase {
assertError("id.user == 1234", documents.get(0), "User identifier is null.");
assertError("id.group == 1234", documents.get(3), "Group identifier is null.");
assertError("id.group == \"yahoo\"", documents.get(3), "Group identifier is null.");
+ assertError("id.type == \"unknown\"", documents.get(0), "Document id doesn't have doc type.");
// Branch operators.
assertEquals(Result.FALSE, evaluate("true and false", documents.get(0)));
diff --git a/document/src/test/java/com/yahoo/document/serialization/ReferenceFieldValueSerializationTestCase.java b/document/src/test/java/com/yahoo/document/serialization/ReferenceFieldValueSerializationTestCase.java
index 227f33d8d27..aa8b43e7abb 100644
--- a/document/src/test/java/com/yahoo/document/serialization/ReferenceFieldValueSerializationTestCase.java
+++ b/document/src/test/java/com/yahoo/document/serialization/ReferenceFieldValueSerializationTestCase.java
@@ -21,7 +21,7 @@ public class ReferenceFieldValueSerializationTestCase {
static class Fixture {
final TestDocumentFactory documentFactory;
// Note: these must match their C++ serialization test counterparts.
- final static String REF_TARGET_DOC_TYPE_NAME = "my_doctype";
+ final static String REF_TARGET_DOC_TYPE_NAME = "my document";
final static String REF_SOURCE_DOC_TYPE_NAME = "doc_with_ref";
final static int REF_TYPE_ID = 789;
final static String SOURCE_REF_FIELD_NAME = "ref_field";
diff --git a/document/src/test/java/com/yahoo/document/serialization/VespaDocumentSerializerTestCase.java b/document/src/test/java/com/yahoo/document/serialization/VespaDocumentSerializerTestCase.java
index 6effbc9a452..5a8d458c74b 100644
--- a/document/src/test/java/com/yahoo/document/serialization/VespaDocumentSerializerTestCase.java
+++ b/document/src/test/java/com/yahoo/document/serialization/VespaDocumentSerializerTestCase.java
@@ -35,7 +35,7 @@ public class VespaDocumentSerializerTestCase {
DocumentType docType = new DocumentType("my_type");
docType.addField("my_str", DataType.STRING);
docType.addField("my_int", DataType.INT);
- Document doc = new Document(docType, "id:ns:my_type::");
+ Document doc = new Document(docType, "doc:scheme:");
doc.setFieldValue("my_str", new StringFieldValue("foo"));
doc.setFieldValue("my_int", new IntegerFieldValue(69));
@@ -49,7 +49,7 @@ public class VespaDocumentSerializerTestCase {
DocumentType docType = new DocumentType("my_type");
Field field = new Field("my_predicate", DataType.PREDICATE);
docType.addField(field);
- Document doc = new Document(docType, "id:ns:my_type::");
+ Document doc = new Document(docType, "doc:scheme:");
PredicateFieldValue predicate = Mockito.mock(PredicateFieldValue.class);
doc.setFieldValue("my_predicate", predicate);
diff --git a/document/src/test/java/com/yahoo/document/serialization/XmlDocumentWriterTestCase.java b/document/src/test/java/com/yahoo/document/serialization/XmlDocumentWriterTestCase.java
index 4e8e73dc6af..3d8875cff52 100644
--- a/document/src/test/java/com/yahoo/document/serialization/XmlDocumentWriterTestCase.java
+++ b/document/src/test/java/com/yahoo/document/serialization/XmlDocumentWriterTestCase.java
@@ -19,7 +19,7 @@ public class XmlDocumentWriterTestCase {
DocumentType docType = new DocumentType("my_type");
Field field = new Field("my_predicate", DataType.PREDICATE);
docType.addField(field);
- Document doc = new Document(docType, "id:ns:my_type::");
+ Document doc = new Document(docType, "doc:scheme:");
PredicateFieldValue predicate = Mockito.mock(PredicateFieldValue.class);
doc.setFieldValue("my_predicate", predicate);
diff --git a/document/src/test/java/com/yahoo/document/update/FieldUpdateTestCase.java b/document/src/test/java/com/yahoo/document/update/FieldUpdateTestCase.java
index ba872b11c28..11e0cc783af 100644
--- a/document/src/test/java/com/yahoo/document/update/FieldUpdateTestCase.java
+++ b/document/src/test/java/com/yahoo/document/update/FieldUpdateTestCase.java
@@ -196,7 +196,7 @@ public class FieldUpdateTestCase {
@Test
public void testApplyToSingleValue() {
- Document testDoc = new Document(docman.getDocumentType("foobar"), new DocumentId("id:ns:foobar::ballooo"));
+ Document testDoc = new Document(docman.getDocumentType("foobar"), new DocumentId("doc:test:ballooo"));
FieldUpdate alter = FieldUpdate.create(strfoo);
ValueUpdate assign = ValueUpdate.createAssign(new StringFieldValue("potato"));
@@ -216,7 +216,7 @@ public class FieldUpdateTestCase {
Array<StringFieldValue> fruitList = new Array<>(DataType.getArray(DataType.STRING));
fruitList.add(new StringFieldValue("kiwi"));
fruitList.add(new StringFieldValue("mango"));
- Document testDoc = new Document(docman.getDocumentType("foobar"), new DocumentId("id:ns:foobar::ballooo"));
+ Document testDoc = new Document(docman.getDocumentType("foobar"), new DocumentId("doc:test:ballooo"));
FieldUpdate alter = FieldUpdate.create(strarray);
alter.addValueUpdate(ValueUpdate.createAdd(new StringFieldValue("banana")));
@@ -261,7 +261,7 @@ public class FieldUpdateTestCase {
WeightedSet fruitWs = new WeightedSet(DataType.getWeightedSet(DataType.STRING));
fruitWs.put(new StringFieldValue("pineapple"), 50);
fruitWs.put(new StringFieldValue("apple"), 10);
- Document testDoc = new Document(docman.getDocumentType("foobar"), new DocumentId("id:ns:foobar::ballooo"));
+ Document testDoc = new Document(docman.getDocumentType("foobar"), new DocumentId("doc:test:ballooo"));
FieldUpdate alter = FieldUpdate.create(strws);
FieldUpdate alter2 = FieldUpdate.create(strws2);
@@ -365,7 +365,9 @@ public class FieldUpdateTestCase {
@Test
public void testArithmeticUpdatesOnAutoCreatedWSetItemsAreZeroBased() {
- Document testDoc = new Document(docman.getDocumentType("foobar"), new DocumentId("id:ns:foobar::ballooo"));
+ Document testDoc = new Document(
+ docman.getDocumentType("foobar"),
+ new DocumentId("doc:test:ballooo"));
// strws2 is fixture weightedset type with create-if-non-existing
// and remove-if-zero attributes set.
FieldUpdate update = FieldUpdate.create(strws2);
diff --git a/document/src/test/java/com/yahoo/vespaxmlparser/VespaXMLReaderTestCase.java b/document/src/test/java/com/yahoo/vespaxmlparser/VespaXMLReaderTestCase.java
index 6e975a707cc..e33dbfe8898 100644..100755
--- a/document/src/test/java/com/yahoo/vespaxmlparser/VespaXMLReaderTestCase.java
+++ b/document/src/test/java/com/yahoo/vespaxmlparser/VespaXMLReaderTestCase.java
@@ -338,7 +338,7 @@ public class VespaXMLReaderTestCase {
// empty string
FeedOperation op = parser.read();
- assertEquals("id:ns:news::http://news6b", op.getDocument().getId().toString());
+ assertEquals("doc:news:http://news6b", op.getDocument().getId().toString());
// int array with text
try {
@@ -397,7 +397,7 @@ public class VespaXMLReaderTestCase {
}
op = parser.read();
- assertEquals("id:ns:news::http://news6j", op.getDocument().getId().toString());
+ assertEquals("doc:news:http://news6j", op.getDocument().getId().toString());
op = parser.read();
assertEquals(FeedOperation.Type.INVALID, op.getType());
@@ -514,13 +514,13 @@ public class VespaXMLReaderTestCase {
FeedOperation op = parser.read();
assertEquals(FeedOperation.Type.REMOVE, op.getType());
- assertEquals("id:ns:news::http://news9a", op.getRemove().toString());
+ assertEquals("doc:news:http://news9a", op.getRemove().toString());
}
{
FeedOperation op = parser.read();
assertEquals(FeedOperation.Type.REMOVE, op.getType());
- assertEquals("id:ns:news::http://news9b", op.getRemove().toString());
+ assertEquals("doc:news:http://news9b", op.getRemove().toString());
}
{
// Remove without documentid. Not supported.
@@ -648,7 +648,7 @@ public class VespaXMLReaderTestCase {
}
{
FeedOperation op = parser.read();
- assertEquals("id:ns:news::http://news10e", op.getRemove().toString());
+ assertEquals("doc:news:http://news10e", op.getRemove().toString());
}
{
// Illegal remove without documentid attribute
@@ -773,7 +773,7 @@ public class VespaXMLReaderTestCase {
RemoveFieldPathUpdate ass = (RemoveFieldPathUpdate)updates.next();
assertEquals("bytearr", ass.getOriginalFieldPath());
}
- Document doc = new Document(manager.getDocumentType("news"), new DocumentId("id:ns:news::test"));
+ Document doc = new Document(manager.getDocumentType("news"), new DocumentId("doc:test:test:test"));
docUpdate.applyTo(doc);
}
@@ -798,7 +798,7 @@ public class VespaXMLReaderTestCase {
Document doc = op.getDocument();
assertEquals("outerdoc", doc.getDataType().getName());
- assertEquals("id:outer:outerdoc::this:is:outer:doc", doc.getId().toString());
+ assertEquals("doc:outer:this:is:outer:doc", doc.getId().toString());
assertEquals(1, doc.getFieldCount());
Array lst = (Array)doc.getFieldValue("innerdocuments");
@@ -833,7 +833,7 @@ public class VespaXMLReaderTestCase {
String input =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<vespafeed>\n" +
- " <document documenttype=\"foo\" documentid=\"id:ns:foo::baz\"> \n" +
+ " <document documenttype=\"foo\" documentid=\"doc:foo:bar:baz\"> \n" +
" <title binaryencoding=\"base64\">testTitle</title>\n" +
" </document>\n" +
"</vespafeed>\n";
@@ -854,7 +854,7 @@ public class VespaXMLReaderTestCase {
String input =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<vespafeed>\n" +
- " <document documenttype=\"foo\" documentid=\"id:ns:foo::baz\"> \n" +
+ " <document documenttype=\"foo\" documentid=\"doc:foo:bar:baz\"> \n" +
" <title>test\uFDDFTitle</title>\n" +
" </document>\n" +
"</vespafeed>\n";
diff --git a/document/src/test/java/com/yahoo/vespaxmlparser/VespaXmlFieldReaderTestCase.java b/document/src/test/java/com/yahoo/vespaxmlparser/VespaXmlFieldReaderTestCase.java
index 29621426a85..99960b205b0 100644
--- a/document/src/test/java/com/yahoo/vespaxmlparser/VespaXmlFieldReaderTestCase.java
+++ b/document/src/test/java/com/yahoo/vespaxmlparser/VespaXmlFieldReaderTestCase.java
@@ -41,21 +41,21 @@ public class VespaXmlFieldReaderTestCase {
public void requireThatArrayItemDeserializeExceptionIncludesFieldName() throws Exception {
assertThrows(new Field("my_field", DataType.getArray(DataType.BYTE)),
"<item>-129</item>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 74)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 70)");
}
@Test
public void requireThatMapKeyDeserializeExceptionIncludesFieldName() throws Exception {
assertThrows(new Field("my_field", DataType.getMap(DataType.BYTE, DataType.STRING)),
"<item><key>-129</key><value>foo</value></item>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 78)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 74)");
}
@Test
public void requireThatMapValueDeserializeExceptionIncludesFieldName() throws Exception {
assertThrows(new Field("my_field", DataType.getMap(DataType.STRING, DataType.BYTE)),
"<item><key>foo</key><value>-129</value></item>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 96)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 92)");
}
@Test
@@ -64,14 +64,14 @@ public class VespaXmlFieldReaderTestCase {
structType.addField(new Field("my_byte", DataType.BYTE));
assertThrows(new Field("my_field", structType),
"<my_byte>-129</my_byte>",
- "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 80)");
+ "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 76)");
}
@Test
public void requireThatWSetItemDeserializeExceptionIncludesFieldName() throws Exception {
assertThrows(new Field("my_field", DataType.getWeightedSet(DataType.BYTE)),
"<item>-129</item>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 74)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 70)");
}
@Test
@@ -141,10 +141,10 @@ public class VespaXmlFieldReaderTestCase {
docType.addField(field);
docManager.register(docType);
- String documentXml = "<document id='id:ns:my_type::' type='my_type'><" + field.getName() + ">" +
+ String documentXml = "<document id='doc:scheme:' type='my_type'><" + field.getName() + ">" +
fieldXml + "</" + field.getName() + "></document>";
InputStream in = new ByteArrayInputStream(documentXml.getBytes(StandardCharsets.UTF_8));
- Document doc = new Document(docType, "id:ns:my_type::");
+ Document doc = new Document(docType, "doc:scheme:");
try {
new VespaXMLFieldReader(in, docManager).read(null, doc);
fail();
@@ -155,11 +155,11 @@ public class VespaXmlFieldReaderTestCase {
private static void assertReadable(Predicate predicate) throws Exception {
assertRead(predicate,
- "<document id='id:ns:my_type::' type='my_type'>" +
+ "<document id='doc:scheme:' type='my_type'>" +
" <my_predicate>" + predicate + "</my_predicate>" +
"</document>");
assertRead(predicate,
- "<document id='id:ns:my_type::' type='my_type'>" +
+ "<document id='doc:scheme:' type='my_type'>" +
" <my_predicate binaryencoding='base64'>" +
Base64.encodeBase64String(BinaryFormat.encode(predicate)) +
" </my_predicate>" +
@@ -173,7 +173,7 @@ public class VespaXmlFieldReaderTestCase {
docManager.register(docType);
InputStream in = new ByteArrayInputStream(documentXml.getBytes(StandardCharsets.UTF_8));
- Document doc = new Document(docType, "id:ns:my_type::");
+ Document doc = new Document(docType, "doc:scheme:");
new VespaXMLFieldReader(in, docManager).read(null, doc);
FieldValue value = doc.getFieldValue("my_predicate");
assertTrue(value instanceof PredicateFieldValue);
diff --git a/document/src/test/java/com/yahoo/vespaxmlparser/VespaXmlUpdateReaderTestCase.java b/document/src/test/java/com/yahoo/vespaxmlparser/VespaXmlUpdateReaderTestCase.java
index a6e14f25bea..424e8bb1bca 100644
--- a/document/src/test/java/com/yahoo/vespaxmlparser/VespaXmlUpdateReaderTestCase.java
+++ b/document/src/test/java/com/yahoo/vespaxmlparser/VespaXmlUpdateReaderTestCase.java
@@ -79,7 +79,7 @@ public class VespaXmlUpdateReaderTestCase {
public void requireThatDeserializeExceptionIncludesFieldName() throws Exception {
assertThrows(new Field("my_field", DataType.BYTE),
"<assign field='my_field'>-129</assign>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 82)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 79)");
}
@Test
@@ -87,19 +87,19 @@ public class VespaXmlUpdateReaderTestCase {
Field field = new Field("my_field", DataType.getArray(DataType.BYTE));
assertThrows(field,
"<assign field='my_field'><item>-129</item></assign>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 86)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 83)");
assertThrows(field,
"<assign fieldpath='my_field'><item>-129</item></assign>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 90)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 87)");
assertThrows(field,
"<add field='my_field'><item>-129</item></add>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 83)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 80)");
assertThrows(field,
"<add fieldpath='my_field'><item>-129</item></add>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 87)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 84)");
assertThrows(field,
"<remove field='my_field'><item>-129</item></remove>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 86)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 83)");
}
@Test
@@ -107,19 +107,19 @@ public class VespaXmlUpdateReaderTestCase {
Field field = new Field("my_field", DataType.getMap(DataType.BYTE, DataType.STRING));
assertThrows(field,
"<assign field='my_field'><item><key>-129</key><value>foo</value></item></assign>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 90)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 87)");
assertThrows(field,
"<assign fieldpath='my_field'><item><key>-129</key><value>foo</value></item></assign>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 94)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 91)");
assertThrows(field,
"<add field='my_field'><item><key>-129</key><value>foo</value></item></add>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 87)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 84)");
assertThrows(field,
"<add fieldpath='my_field'><item><key>-129</key><value>foo</value></item></add>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 91)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 88)");
assertThrows(field,
"<remove field='my_field'><item><key>-129</key><value>foo</value></item></remove>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 90)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 87)");
try {
readUpdate(field, "<remove fieldpath='my_field{-129}' />");
fail();
@@ -133,19 +133,19 @@ public class VespaXmlUpdateReaderTestCase {
Field field = new Field("my_field", DataType.getMap(DataType.STRING, DataType.BYTE));
assertThrows(field,
"<assign field='my_field'><item><key>foo</key><value>-129</value></item></assign>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 108)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 105)");
assertThrows(field,
"<assign fieldpath='my_field'><item><key>foo</key><value>-129</value></item></assign>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 112)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 109)");
assertThrows(field,
"<add field='my_field'><item><key>foo</key><value>-129</value></item></add>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 105)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 102)");
assertThrows(field,
"<add fieldpath='my_field'><item><key>foo</key><value>-129</value></item></add>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 109)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 106)");
assertThrows(field,
"<remove field='my_field'><item><key>foo</key><value>-129</value></item></remove>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 108)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 105)");
}
@Test
@@ -155,19 +155,19 @@ public class VespaXmlUpdateReaderTestCase {
Field field = new Field("my_field", structType);
assertThrows(field,
"<assign field='my_field'><my_byte>-129</my_byte></assign>",
- "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 92)");
+ "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 89)");
assertThrows(field,
"<assign fieldpath='my_field'><my_byte>-129</my_byte></assign>",
- "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 96)");
+ "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 93)");
assertThrows(field,
"<add field='my_field'><my_byte>-129</my_byte></add>",
- "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 89)");
+ "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 86)");
assertThrows(field,
"<add fieldpath='my_field'><my_byte>-129</my_byte></add>",
- "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 93)");
+ "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 90)");
assertThrows(field,
"<remove field='my_field'><my_byte>-129</my_byte></remove>",
- "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 92)");
+ "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 89)");
}
@Test
@@ -175,19 +175,19 @@ public class VespaXmlUpdateReaderTestCase {
Field field = new Field("my_field", DataType.getWeightedSet(DataType.BYTE));
assertThrows(field,
"<assign field='my_field'><item>-129</item></assign>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 86)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 83)");
assertThrows(field,
"<assign fieldpath='my_field'><item>-129</item></assign>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 90)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 87)");
assertThrows(field,
"<add field='my_field'><item>-129</item></add>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 83)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 80)");
assertThrows(field,
"<add fieldpath='my_field'><item>-129</item></add>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 87)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 84)");
assertThrows(field,
"<remove field='my_field'><item>-129</item></remove>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 86)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 83)");
try {
readUpdate(field, "<remove fieldpath='my_field{-129}' />");
fail();
@@ -206,12 +206,12 @@ public class VespaXmlUpdateReaderTestCase {
@Test
public void requireThatCreateIfNonExistentFlagIsValidated() throws Exception {
- String documentXml = "<update id='id:ns:my_doc::' type='my_type' create-if-non-existent='illegal'></update>";
+ String documentXml = "<update id='doc:scheme:' type='my_type' create-if-non-existent='illegal'></update>";
try {
readUpdateHelper(null, documentXml);
fail();
} catch (DeserializationException e) {
- assertEquals(printStackTrace(e), "'create-if-non-existent' must be either 'true' or 'false', was 'illegal' (at line 1, column 77)", e.getMessage());
+ assertEquals(printStackTrace(e), "'create-if-non-existent' must be either 'true' or 'false', was 'illegal' (at line 1, column 74)", e.getMessage());
}
}
@@ -231,12 +231,12 @@ public class VespaXmlUpdateReaderTestCase {
}
private static DocumentUpdate readUpdate(Field field, String fieldXml) throws Exception {
- String documentXml = "<update id='id:ns:my_doc::' type='my_type'>" + fieldXml + "</update>";
+ String documentXml = "<update id='doc:scheme:' type='my_type'>" + fieldXml + "</update>";
return readUpdateHelper(field, documentXml);
}
private static DocumentUpdate readUpdate(boolean createIfNonExistent) throws Exception {
- String documentXml = "<update id='id:ns:my_doc::' type='my_type' create-if-non-existent='" + (createIfNonExistent ? "true" : "false") + "'></update>";
+ String documentXml = "<update id='doc:scheme:' type='my_type' create-if-non-existent='" + (createIfNonExistent ? "true" : "false") + "'></update>";
return readUpdateHelper(null, documentXml);
}
@@ -249,7 +249,7 @@ public class VespaXmlUpdateReaderTestCase {
docManager.register(docType);
InputStream in = new ByteArrayInputStream(documentXml.getBytes(StandardCharsets.UTF_8));
- DocumentUpdate doc = new DocumentUpdate(docType, "id:ns:my_doc::");
+ DocumentUpdate doc = new DocumentUpdate(docType, "doc:scheme:");
VespaXMLUpdateReader reader = new VespaXMLUpdateReader(in, docManager);
reader.reader.next(); // initialize reader
reader.read(doc);
diff --git a/document/src/test/java/com/yahoo/vespaxmlparser/XMLNumericFieldErrorMsgTestCase.java b/document/src/test/java/com/yahoo/vespaxmlparser/XMLNumericFieldErrorMsgTestCase.java
index 298960ff8ba..73984f1746c 100644
--- a/document/src/test/java/com/yahoo/vespaxmlparser/XMLNumericFieldErrorMsgTestCase.java
+++ b/document/src/test/java/com/yahoo/vespaxmlparser/XMLNumericFieldErrorMsgTestCase.java
@@ -38,7 +38,7 @@ public class XMLNumericFieldErrorMsgTestCase {
DocumentTypeManager dtm = setupTypes();
try {
VespaXMLDocumentReader documentReader = new VespaXMLDocumentReader(
- new ByteArrayInputStream(("<document id=\"id:ns:doctype::bar\" type=\"doctype\">" +
+ new ByteArrayInputStream(("<document id=\"doc:foo:bar\" type=\"doctype\">" +
" <floatfield></floatfield>" +
"</document>").getBytes(StandardCharsets.UTF_8)), dtm);
new Document(documentReader);
@@ -53,7 +53,7 @@ public class XMLNumericFieldErrorMsgTestCase {
DocumentTypeManager dtm = setupTypes();
try {
VespaXMLDocumentReader documentReader = new VespaXMLDocumentReader(
- new ByteArrayInputStream(("<document id=\"id:ns:doctype::bar\" type=\"doctype\">" +
+ new ByteArrayInputStream(("<document id=\"doc:foo:bar\" type=\"doctype\">" +
" <doublefield></doublefield>" +
"</document>").getBytes(StandardCharsets.UTF_8)), dtm);
new Document(documentReader);
@@ -68,7 +68,7 @@ public class XMLNumericFieldErrorMsgTestCase {
DocumentTypeManager dtm = setupTypes();
try {
VespaXMLDocumentReader documentReader = new VespaXMLDocumentReader(
- new ByteArrayInputStream(("<document id=\"id:ns:doctype::bar\" type=\"doctype\">" +
+ new ByteArrayInputStream(("<document id=\"doc:foo:bar\" type=\"doctype\">" +
" <longfield></longfield>" +
"</document>").getBytes(StandardCharsets.UTF_8)), dtm);
new Document(documentReader);
@@ -83,7 +83,7 @@ public class XMLNumericFieldErrorMsgTestCase {
DocumentTypeManager dtm = setupTypes();
try {
VespaXMLDocumentReader documentReader = new VespaXMLDocumentReader(
- new ByteArrayInputStream(("<document id=\"id:ns:doctype::bar\" type=\"doctype\">" +
+ new ByteArrayInputStream(("<document id=\"doc:foo:bar\" type=\"doctype\">" +
" <intfield></intfield>" +
"</document>").getBytes(StandardCharsets.UTF_8)), dtm);
new Document(documentReader);
@@ -98,7 +98,7 @@ public class XMLNumericFieldErrorMsgTestCase {
DocumentTypeManager dtm = setupTypes();
try {
VespaXMLDocumentReader documentReader = new VespaXMLDocumentReader(
- new ByteArrayInputStream(("<document id=\"id:ns:doctype::bar\" type=\"doctype\">" +
+ new ByteArrayInputStream(("<document id=\"doc:foo:bar\" type=\"doctype\">" +
" <bytefield></bytefield>" +
"</document>").getBytes(StandardCharsets.UTF_8)), dtm);
new Document(documentReader);
diff --git a/document/src/test/resources/reference/reference_with_id__cpp b/document/src/test/resources/reference/reference_with_id__cpp
index d2668f8a5b1..d165328676c 100644
--- a/document/src/test/resources/reference/reference_with_id__cpp
+++ b/document/src/test/resources/reference/reference_with_id__cpp
Binary files differ
diff --git a/document/src/test/resources/reference/reference_with_id__java b/document/src/test/resources/reference/reference_with_id__java
index 6e9158827d7..d165328676c 100644
--- a/document/src/test/resources/reference/reference_with_id__java
+++ b/document/src/test/resources/reference/reference_with_id__java
Binary files differ
diff --git a/document/src/test/serializeddocuments/document-java-v8-uncompressed.dat b/document/src/test/serializeddocuments/document-java-v8-uncompressed.dat
index 3ff1e64410e..8f3ea65be2a 100644
--- a/document/src/test/serializeddocuments/document-java-v8-uncompressed.dat
+++ b/document/src/test/serializeddocuments/document-java-v8-uncompressed.dat
Binary files differ
diff --git a/document/src/test/serializeddocuments/java-6/README b/document/src/test/serializeddocuments/java-6/README
new file mode 100644
index 00000000000..6dc8465bcbe
--- /dev/null
+++ b/document/src/test/serializeddocuments/java-6/README
@@ -0,0 +1 @@
+A document serialized from Java, at serialized version 6.
diff --git a/document/src/test/serializeddocuments/java-6/java-6.cfg b/document/src/test/serializeddocuments/java-6/java-6.cfg
new file mode 100644
index 00000000000..eb11f9c9c04
--- /dev/null
+++ b/document/src/test/serializeddocuments/java-6/java-6.cfg
@@ -0,0 +1,124 @@
+datatype[9]
+datatype[0].id -260050933
+datatype[0].arraytype[0]
+datatype[0].weightedsettype[0]
+datatype[0].structtype[1]
+datatype[0].structtype[0].name serializetest.header
+datatype[0].structtype[0].version 0
+datatype[0].structtype[0].field[5]
+datatype[0].structtype[0].field[0].name floatfield
+datatype[0].structtype[0].field[0].id[0]
+datatype[0].structtype[0].field[0].datatype 1
+datatype[0].structtype[0].field[1].name stringfield
+datatype[0].structtype[0].field[1].id[0]
+datatype[0].structtype[0].field[1].datatype 2
+datatype[0].structtype[0].field[2].name longfield
+datatype[0].structtype[0].field[2].id[0]
+datatype[0].structtype[0].field[2].datatype 4
+datatype[0].structtype[0].field[3].name timestampfield
+datatype[0].structtype[0].field[3].id[0]
+datatype[0].structtype[0].field[3].datatype 9
+datatype[0].structtype[0].field[4].name urifield
+datatype[0].structtype[0].field[4].id[0]
+datatype[0].structtype[0].field[4].datatype 10
+datatype[0].documenttype[0]
+datatype[1].id 1001
+datatype[1].arraytype[1]
+datatype[1].arraytype[0].datatype 1
+datatype[1].weightedsettype[0]
+datatype[1].structtype[0]
+datatype[1].documenttype[0]
+datatype[2].id 2001
+datatype[2].arraytype[1]
+datatype[2].arraytype[0].datatype 1001
+datatype[2].weightedsettype[0]
+datatype[2].structtype[0]
+datatype[2].documenttype[0]
+datatype[3].id 437829
+datatype[3].arraytype[0]
+datatype[3].weightedsettype[1]
+datatype[3].weightedsettype[0].datatype 2
+datatype[3].weightedsettype[0].createifnonexistant false
+datatype[3].weightedsettype[0].removeifzero false
+datatype[3].structtype[0]
+datatype[3].documenttype[0]
+datatype[4].id 1026122976
+datatype[4].arraytype[0]
+datatype[4].weightedsettype[0]
+datatype[4].structtype[1]
+datatype[4].structtype[0].name serializetest.body
+datatype[4].structtype[0].version 0
+datatype[4].structtype[0].field[11]
+datatype[4].structtype[0].field[0].name intfield
+datatype[4].structtype[0].field[0].id[0]
+datatype[4].structtype[0].field[0].datatype 0
+datatype[4].structtype[0].field[1].name rawfield
+datatype[4].structtype[0].field[1].id[0]
+datatype[4].structtype[0].field[1].datatype 3
+datatype[4].structtype[0].field[2].name doublefield
+datatype[4].structtype[0].field[2].id[0]
+datatype[4].structtype[0].field[2].datatype 5
+datatype[4].structtype[0].field[3].name exactstringfield
+datatype[4].structtype[0].field[3].id[0]
+datatype[4].structtype[0].field[3].datatype 11
+datatype[4].structtype[0].field[4].name contentfield
+datatype[4].structtype[0].field[4].id[0]
+datatype[4].structtype[0].field[4].datatype 12
+datatype[4].structtype[0].field[5].name termboostfield
+datatype[4].structtype[0].field[5].id[0]
+datatype[4].structtype[0].field[5].datatype 15
+datatype[4].structtype[0].field[6].name bytefield
+datatype[4].structtype[0].field[6].id[0]
+datatype[4].structtype[0].field[6].datatype 16
+datatype[4].structtype[0].field[7].name arrayoffloatfield
+datatype[4].structtype[0].field[7].id[0]
+datatype[4].structtype[0].field[7].datatype 1001
+datatype[4].structtype[0].field[8].name arrayofarrayoffloatfield
+datatype[4].structtype[0].field[8].id[0]
+datatype[4].structtype[0].field[8].datatype 2001
+datatype[4].structtype[0].field[9].name docfield
+datatype[4].structtype[0].field[9].id[0]
+datatype[4].structtype[0].field[9].datatype 8
+datatype[4].structtype[0].field[10].name wsfield
+datatype[4].structtype[0].field[10].id[0]
+datatype[4].structtype[0].field[10].datatype 437829
+datatype[4].documenttype[0]
+datatype[5].id 1306012852
+datatype[5].arraytype[0]
+datatype[5].weightedsettype[0]
+datatype[5].structtype[0]
+datatype[5].documenttype[1]
+datatype[5].documenttype[0].name serializetest
+datatype[5].documenttype[0].version 0
+datatype[5].documenttype[0].inherits[0]
+datatype[5].documenttype[0].headerstruct -260050933
+datatype[5].documenttype[0].bodystruct 1026122976
+datatype[6].id -1686125086
+datatype[6].arraytype[0]
+datatype[6].weightedsettype[0]
+datatype[6].structtype[1]
+datatype[6].structtype[0].name docindoc.header
+datatype[6].structtype[0].version 0
+datatype[6].structtype[0].field[0]
+datatype[6].documenttype[0]
+datatype[7].id 2030224503
+datatype[7].arraytype[0]
+datatype[7].weightedsettype[0]
+datatype[7].structtype[1]
+datatype[7].structtype[0].name docindoc.body
+datatype[7].structtype[0].version 0
+datatype[7].structtype[0].field[1]
+datatype[7].structtype[0].field[0].name stringindocfield
+datatype[7].structtype[0].field[0].id[0]
+datatype[7].structtype[0].field[0].datatype 2
+datatype[7].documenttype[0]
+datatype[8].id 1447635645
+datatype[8].arraytype[0]
+datatype[8].weightedsettype[0]
+datatype[8].structtype[0]
+datatype[8].documenttype[1]
+datatype[8].documenttype[0].name docindoc
+datatype[8].documenttype[0].version 0
+datatype[8].documenttype[0].inherits[0]
+datatype[8].documenttype[0].headerstruct -1686125086
+datatype[8].documenttype[0].bodystruct 2030224503
diff --git a/document/src/test/serializeddocuments/java-6/java-6.dat b/document/src/test/serializeddocuments/java-6/java-6.dat
new file mode 100644
index 00000000000..723754892a2
--- /dev/null
+++ b/document/src/test/serializeddocuments/java-6/java-6.dat
Binary files differ
diff --git a/document/src/test/vespaxmlparser/test01.xml b/document/src/test/vespaxmlparser/test01.xml
index c73410c70d6..52de6146f19 100644
--- a/document/src/test/vespaxmlparser/test01.xml
+++ b/document/src/test/vespaxmlparser/test01.xml
@@ -6,7 +6,7 @@
<vespafeed>
- <document documenttype="news" documentid="id:ns:news::http://news1">
+ <document documenttype="news" documentid="doc:news:http://news1">
<url>testUrl</url>
<title>testTitle</title>
<last_downloaded>1</last_downloaded>
diff --git a/document/src/test/vespaxmlparser/test02.xml b/document/src/test/vespaxmlparser/test02.xml
index 7a02a4f7929..31f21358070 100644
--- a/document/src/test/vespaxmlparser/test02.xml
+++ b/document/src/test/vespaxmlparser/test02.xml
@@ -5,7 +5,7 @@
-->
<vespafeed>
- <document documenttype="news" documentid="id:ns:news::http://news2">
+ <document documenttype="news" documentid="doc:news:http://news2">
<url>testUrl2</url>
<title>testTitle2</title>
<weightedsetint>
diff --git a/document/src/test/vespaxmlparser/test03.xml b/document/src/test/vespaxmlparser/test03.xml
index a3090cc95a1..ed71e8ddec5 100644
--- a/document/src/test/vespaxmlparser/test03.xml
+++ b/document/src/test/vespaxmlparser/test03.xml
@@ -9,7 +9,7 @@
-->
<vespafeed>
- <update documenttype="news" documentid="id:ns:news::http://news3">
+ <update documenttype="news" documentid="doc:news:http://news3">
<assign field="url">assignUrl</assign>
<assign field="title">assignTitle</assign>
<assign field="last_downloaded">1</assign>
diff --git a/document/src/test/vespaxmlparser/test04.xml b/document/src/test/vespaxmlparser/test04.xml
index 8dc1a90caab..d73cc5905b5 100644
--- a/document/src/test/vespaxmlparser/test04.xml
+++ b/document/src/test/vespaxmlparser/test04.xml
@@ -9,7 +9,7 @@
-->
<vespafeed>
- <update documenttype="news" documentid="id:ns:news::http://news4">
+ <update documenttype="news" documentid="doc:news:http://news4">
<assign field="url">assignUrl</assign>
<assign field="value_long">2</assign>
<assign field="stringarr">
diff --git a/document/src/test/vespaxmlparser/test05.xml b/document/src/test/vespaxmlparser/test05.xml
index af2e019d168..cb27fff83ad 100644
--- a/document/src/test/vespaxmlparser/test05.xml
+++ b/document/src/test/vespaxmlparser/test05.xml
@@ -9,7 +9,7 @@
-->
<vespafeed>
- <update documenttype="news" documentid="id:ns:news::http://news5">
+ <update documenttype="news" documentid="doc:news:http://news5">
<add field="stringarr">
<item>addString1</item>
<item>addString2</item>
diff --git a/document/src/test/vespaxmlparser/test06.xml b/document/src/test/vespaxmlparser/test06.xml
index 3c6b293e82b..bae65abda51 100644
--- a/document/src/test/vespaxmlparser/test06.xml
+++ b/document/src/test/vespaxmlparser/test06.xml
@@ -11,66 +11,66 @@
<vespafeed>
- <document documenttype="news" documentid="id:ns:news::http://news6a">
+ <document documenttype="news" documentid="doc:news:http://news6a">
<value_long>txt</value_long>
</document>
- <document documenttype="news" documentid="id:ns:news::http://news6b">
+ <document documenttype="news" documentid="doc:news:http://news6b">
<stringarr>
<item>stringarrItem1</item>
<item></item>
</stringarr>
</document>
- <document documenttype="news" documentid="id:ns:news::http://news6c">
+ <document documenttype="news" documentid="doc:news:http://news6c">
<intarr>
<item>1</item>
<item>txt</item>
</intarr>
</document>
- <document documenttype="news" documentid="id:ns:news::http://news6d">
+ <document documenttype="news" documentid="doc:news:http://news6d">
<longarr>
<item>1</item>
<item> </item>
</longarr>
</document>
- <document documenttype="news" documentid="id:ns:news::http://news6e">
+ <document documenttype="news" documentid="doc:news:http://news6e">
<bytearr>
<item>1</item>
<item>128</item>
</bytearr>
</document>
- <document documenttype="news" documentid="id:ns:news::http://news6f">
+ <document documenttype="news" documentid="doc:news:http://news6f">
<floatarr>
<item>1.0</item>
<item>two</item>
</floatarr>
</document>
- <document documenttype="news" documentid="id:ns:news::http://news6g">
+ <document documenttype="news" documentid="doc:news:http://news6g">
<weightedsetint>
<item>1</item>
<item weight="12">txt</item>
</weightedsetint>
</document>
- <document documenttype="news" documentid="id:ns:news::http://news6h">
+ <document documenttype="news" documentid="doc:news:http://news6h">
<weightedsetint>
<item weight="1">2</item>
<item weight="three">4</item>
</weightedsetint>
</document>
- <document documenttype="news" documentid="id:ns:news::http://news6i">
+ <document documenttype="news" documentid="doc:news:http://news6i">
<weightedsetstring>
<item weight="txt">aString</item>
</weightedsetstring>
</document>
- <document documenttype="news" documentid="id:ns:news::http://news6j">
+ <document documenttype="news" documentid="doc:news:http://news6j">
<title>myTitle</title>
</document>
diff --git a/document/src/test/vespaxmlparser/test07.xml b/document/src/test/vespaxmlparser/test07.xml
index 5f2873f6f20..ac3d0ccf91a 100644
--- a/document/src/test/vespaxmlparser/test07.xml
+++ b/document/src/test/vespaxmlparser/test07.xml
@@ -7,7 +7,7 @@
- some fields in this documenttype are assigned invalid values
-->
<vespafeed>
- <update documenttype="news" documentid="id:ns:news::http://news7a">
+ <update documenttype="news" documentid="doc:news:http://news7a">
<alter field="last_downloaded">
<increment by="2" />
<decrement by="3" />
@@ -36,7 +36,7 @@
</divide>
</update>
- <update documenttype="news" documentid="id:ns:news::http://news7b">
+ <update documenttype="news" documentid="doc:news:http://news7b">
<alter field="title">
<increment by="2" />
<decrement by="3" />
@@ -45,25 +45,25 @@
</alter>
</update>
- <update documenttype="news" documentid="id:ns:news::http://news7c">
+ <update documenttype="news" documentid="doc:news:http://news7c">
<increment field="weightedsetint" by="five">
<key>1</key>
</increment>
</update>
- <update documenttype="news" documentid="id:ns:news::http://news7d">
+ <update documenttype="news" documentid="doc:news:http://news7d">
<decrement field="weightedsetint" by="2">
<key></key>
</decrement>
</update>
- <update documenttype="news" documentid="id:ns:news::http://news7e">
+ <update documenttype="news" documentid="doc:news:http://news7e">
<multiply field="floatarr">
<key>3</key>
</multiply>
</update>
- <update documenttype="news" documentid="id:ns:news::http://news7f">
+ <update documenttype="news" documentid="doc:news:http://news7f">
<divide field="floatarr" by="3">
<key>four</key>
</divide>
diff --git a/document/src/test/vespaxmlparser/test08.xml b/document/src/test/vespaxmlparser/test08.xml
index e3d0c00800c..1ae56c14d78 100644
--- a/document/src/test/vespaxmlparser/test08.xml
+++ b/document/src/test/vespaxmlparser/test08.xml
@@ -10,7 +10,7 @@
-->
<vespafeed>
- <update documenttype="news" documentid="id:ns:news::http://news8a">
+ <update documenttype="news" documentid="doc:news:http://news8a">
<remove field="stringarr">
<item>removeString1</item>
<item>removeString2</item>
diff --git a/document/src/test/vespaxmlparser/test09.xml b/document/src/test/vespaxmlparser/test09.xml
index b3df5202030..8d30a9196f2 100644
--- a/document/src/test/vespaxmlparser/test09.xml
+++ b/document/src/test/vespaxmlparser/test09.xml
@@ -10,13 +10,13 @@
-->
<vespafeed>
- <remove documentid="id:ns:news::http://news9a" />
+ <remove documentid="doc:news:http://news9a" />
- <remove documentid="id:ns:news::http://news9b">
+ <remove documentid="doc:news:http://news9b">
</remove>
<remove>
- <uri>id:ns:news::http://news9c</uri>
+ <uri>doc:news:http://news9c</uri>
</remove>
</vespafeed>
diff --git a/document/src/test/vespaxmlparser/test10.xml b/document/src/test/vespaxmlparser/test10.xml
index ba7abd53738..b5d1146bec6 100644
--- a/document/src/test/vespaxmlparser/test10.xml
+++ b/document/src/test/vespaxmlparser/test10.xml
@@ -11,7 +11,7 @@
<vespafeed>
- <document documenttype="news" documentid="id:ns:news::http://news10a">
+ <document documenttype="news" documentid="doc:news:http://news10a">
<url>testUrl</url>
<title>testTitle</title>
<last_downloaded>1</last_downloaded>
@@ -47,11 +47,11 @@
</weightedsetstring>
</document>
- <document documenttype="news" documentid="id:ns:news::http://news10b">
+ <document documenttype="news" documentid="doc:news:http://news10b">
<url>testUrl2</url>
</document>
- <update documenttype="news" documentid="id:ns:news::http://news10c">
+ <update documenttype="news" documentid="doc:news:http://news10c">
<add field="stringarr">
<item>addString1</item>
<item>addString2</item>
@@ -68,7 +68,7 @@
</add>
</update>
- <update documenttype="news" documentid="id:ns:news::http://news10d">
+ <update documenttype="news" documentid="doc:news:http://news10d">
<assign field="url">assignUrl</assign>
<assign field="value_long">2</assign>
<assign field="stringarr">
@@ -85,10 +85,10 @@
</assign>
</update>
- <remove documentid="id:ns:news::http://news10e"/>
+ <remove documentid="doc:news:http://news10e"/>
<remove>
- <uri>id:ns:news::http://news10f</uri>
+ <uri>doc:news:http://news10f</uri>
</remove>
</vespafeed>
diff --git a/document/src/test/vespaxmlparser/test12.xml b/document/src/test/vespaxmlparser/test12.xml
index 4d02b2db8d8..c1473778b3f 100644
--- a/document/src/test/vespaxmlparser/test12.xml
+++ b/document/src/test/vespaxmlparser/test12.xml
@@ -10,29 +10,29 @@
</vespaadd>
<!-- bad document: -->
- <document documenttype="news" documentid="id:ns:news::http://news12b">
+ <document documenttype="news" documentid="doc:news:http://news12b">
<value_long>testUrlB</value_long>
</document>
<!-- OK document -->
- <document documenttype="news" documentid="id:ns:news::http://news12c">
+ <document documenttype="news" documentid="doc:news:http://news12c">
<url>testUrl</url>
<title>testTitle</title>
</document>
<!-- bad document: -->
- <document documenttype="news" documentid="id:ns:news::http://news12d">
+ <document documenttype="news" documentid="doc:news:http://news12d">
<value_long>testUrlC</value_long>
</documen>
<!-- OK document -->
- <document documenttype="news" documentid="id:ns:news::http://news12e">
+ <document documenttype="news" documentid="doc:news:http://news12e">
<url>testUrl</url>
<title>testTitle</title>
</document>
<!-- bad document: -->
- <document documenttype="news" documentid="id:ns:news::http://news12f">
+ <document documenttype="news" documentid="doc:news:http://news12f">
<value_long>testUrlD</value_long>
</document>
diff --git a/document/src/test/vespaxmlparser/test13.xml b/document/src/test/vespaxmlparser/test13.xml
index 54194f15f0e..74cede712ba 100644
--- a/document/src/test/vespaxmlparser/test13.xml
+++ b/document/src/test/vespaxmlparser/test13.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
<vespafeed>
- <document documenttype="alltypes" documentid="id:ns:alltypes::http://all.types">
+ <document documenttype="alltypes" documentid="doc:foobar:http://all.types">
<stringval>Banana</stringval>
<intval1>2146983647</intval1>
<intval2>4294967291</intval2>
diff --git a/document/src/test/vespaxmlparser/testXMLfile.xml b/document/src/test/vespaxmlparser/testXMLfile.xml
index 29b6041a14a..d8100efa327 100644
--- a/document/src/test/vespaxmlparser/testXMLfile.xml
+++ b/document/src/test/vespaxmlparser/testXMLfile.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
<vespafeed>
- <document documenttype="music" documentid="id:ns::music::http://music.yahoo.com/bobdylan/BestOf">
+ <document documenttype="music" documentid="doc:music:http://music.yahoo.com/bobdylan/BestOf">
<url>http://music.yahoo.com/bobdylan/BestOf</url>
<songs>Knockin on Heaven's Door; Mr. Tambourine Man</songs>
<title>Best of Bob Dylan</title>
@@ -18,9 +18,9 @@
</popularity>
</document>
- <remove documentid="id:ns:music::http://music.yahoo.com/BritneySpears/HitMe"/>
+ <remove documentid="doc:music:http://music.yahoo.com/BritneySpears/HitMe"/>
- <update documenttype="music" documentid="id:ns:music::http://music.yahoo.com/bobdylan/BestOf">
+ <update documenttype="music" documentid="doc:music:http://music.yahoo.com/bobdylan/BestOf">
<assign field="title">The Best of Bob Dylan</assign>
<add field="tracks">
<item>Man Of Constant Sorrow</item>
diff --git a/document/src/test/vespaxmlparser/test_docindoc.xml b/document/src/test/vespaxmlparser/test_docindoc.xml
index 5734a0e635b..60146780d77 100644
--- a/document/src/test/vespaxmlparser/test_docindoc.xml
+++ b/document/src/test/vespaxmlparser/test_docindoc.xml
@@ -2,22 +2,22 @@
<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
<vespafeed>
- <document type="outerdoc" id="id:outer:outerdoc::this:is:outer:doc">
+ <document type="outerdoc" id="doc:outer:this:is:outer:doc">
<innerdocuments>
<item>
- <document type="docindoc" id="id:inner:docindoc::this:is:inner:doc:a">
+ <document type="docindoc" id="doc:inner:this:is:inner:doc:a">
<name>Peter Sellers</name>
<content>Comedian</content>
</document>
</item>
<item>
- <document type="docindoc" id="id:inner:docindoc::this:is:inner:doc:b">
+ <document type="docindoc" id="doc:inner:this:is:inner:doc:b">
<name>Ole Olsen</name>
<content>Common man</content>
</document>
</item>
<item>
- <document type="docindoc" id="id:inner:docindoc::this:is:inner:doc:c">
+ <document type="docindoc" id="doc:inner:this:is:inner:doc:c">
<name>Stein Nilsen</name>
<content>Worker</content>
</document>
diff --git a/document/src/test/vespaxmlparser/test_position.xml b/document/src/test/vespaxmlparser/test_position.xml
index ee1e95580f2..609fe187973 100644
--- a/document/src/test/vespaxmlparser/test_position.xml
+++ b/document/src/test/vespaxmlparser/test_position.xml
@@ -1,15 +1,15 @@
<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
<vespafeed>
- <document documenttype="my_doc" documentid="id:ns:my_doc::">
+ <document documenttype="my_doc" documentid="doc:scheme:">
<my_pos><x>1</x><y>2</y></my_pos>
</document>
- <document documenttype="my_doc" documentid="id:ns:my_doc::">
+ <document documenttype="my_doc" documentid="doc:scheme:">
<my_pos>E3;N4</my_pos>
</document>
- <document documenttype="my_doc" documentid="id:ns:my_doc::">
+ <document documenttype="my_doc" documentid="doc:scheme:">
<my_pos>5;6</my_pos>
</document>
- <document documenttype="my_doc" documentid="id:ns:my_doc::">
+ <document documenttype="my_doc" documentid="doc:scheme:">
<my_pos binaryencoding="base64">Nzs4</my_pos>
</document>
</vespafeed>
diff --git a/document/src/test/vespaxmlparser/test_uri.xml b/document/src/test/vespaxmlparser/test_uri.xml
index 92f77d8ec99..d1240af105f 100644
--- a/document/src/test/vespaxmlparser/test_uri.xml
+++ b/document/src/test/vespaxmlparser/test_uri.xml
@@ -1,12 +1,12 @@
<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
<vespafeed>
- <document documenttype="my_doc" documentid="id:ns:my_doc::">
+ <document documenttype="my_doc" documentid="doc:scheme:">
<my_uri>scheme://host</my_uri>
</document>
- <document documenttype="my_doc" documentid="id:ns:my_doc::">
+ <document documenttype="my_doc" documentid="doc:scheme:">
<my_arr><item>scheme://host</item></my_arr>
</document>
- <update documenttype="my_doc" documentid="id:ns:my_doc::">
+ <update documenttype="my_doc" documentid="doc:scheme:">
<add field="my_arr">
<item>scheme://host</item>
</add>
diff --git a/document/src/test/vespaxmlparser/test_url.xml b/document/src/test/vespaxmlparser/test_url.xml
index c66625a6fe6..23c0c78fa8c 100644
--- a/document/src/test/vespaxmlparser/test_url.xml
+++ b/document/src/test/vespaxmlparser/test_url.xml
@@ -1,6 +1,6 @@
<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
<vespafeed>
- <document documenttype="my_doc" documentid="id:ns:my_doc::">
+ <document documenttype="my_doc" documentid="doc:scheme:">
<my_url>
<all>scheme://user@host:99/path?query#fragment</all>
<scheme>scheme</scheme>
@@ -11,10 +11,10 @@
<fragment>fragment</fragment>
</my_url>
</document>
- <document documenttype="my_doc" documentid="id:ns:my_doc::">
+ <document documenttype="my_doc" documentid="doc:scheme:">
<my_url>scheme://user@host:99/path?query#fragment</my_url>
</document>
- <document documenttype="my_doc" documentid="id:ns:my_doc::">
+ <document documenttype="my_doc" documentid="doc:scheme:">
<my_url binaryencoding="base64">c2NoZW1lOi8vdXNlckBob3N0Ojk5L3BhdGg/cXVlcnkjZnJhZ21lbnQ=</my_url>
</document>
</vespafeed>
diff --git a/document/src/test/vespaxmlparser/testalltypes.xml b/document/src/test/vespaxmlparser/testalltypes.xml
index 072a77ff609..a63fc77645a 100644
--- a/document/src/test/vespaxmlparser/testalltypes.xml
+++ b/document/src/test/vespaxmlparser/testalltypes.xml
@@ -6,7 +6,7 @@
<vespafeed>
- <document documenttype="news" documentid="id:ns:news::http://news1">
+ <document documenttype="news" documentid="doc:news:http://news1">
<url>testUrl</url>
<title>testTitle</title>
<last_downloaded>1</last_downloaded>
diff --git a/document/src/test/vespaxmlparser/testmapnokey.xml b/document/src/test/vespaxmlparser/testmapnokey.xml
index 6e198d4319e..7dc8a3af4e0 100644
--- a/document/src/test/vespaxmlparser/testmapnokey.xml
+++ b/document/src/test/vespaxmlparser/testmapnokey.xml
@@ -6,7 +6,7 @@
<vespafeed>
- <document documenttype="news" documentid="id:ns:news::http://news1">
+ <document documenttype="news" documentid="doc:news:http://news1">
<arrmap>
<item>
diff --git a/document/src/test/vespaxmlparser/testmapnovalue.xml b/document/src/test/vespaxmlparser/testmapnovalue.xml
index ffcca1e3676..ac04ea8e967 100644
--- a/document/src/test/vespaxmlparser/testmapnovalue.xml
+++ b/document/src/test/vespaxmlparser/testmapnovalue.xml
@@ -6,7 +6,7 @@
<vespafeed>
- <document documenttype="news" documentid="id:ns:news::http://news1">
+ <document documenttype="news" documentid="doc:news:http://news1">
<arrmap>
<item>
diff --git a/document/src/tests/base/documentid_test.cpp b/document/src/tests/base/documentid_test.cpp
index 741a490210f..9994fa5b60b 100644
--- a/document/src/tests/base/documentid_test.cpp
+++ b/document/src/tests/base/documentid_test.cpp
@@ -42,6 +42,11 @@ void checkType(const string &id, const string &doc_type) {
EXPECT_EQUAL(doc_type, doc_id.getDocType());
}
+TEST("require that doc id can be parsed") {
+ const string id = "doc:" + ns + ":" + ns_id;
+ checkId(id, IdString::DOC, ns, ns_id);
+}
+
TEST("require that id id can be parsed") {
const string id = "id:" + ns + ":" + type + "::" + ns_id;
checkId(id, IdString::ID, ns, ns_id);
@@ -53,6 +58,10 @@ TEST("require that we allow ':' in namespace specific part") {
string id="id:" + ns + ":" + type + "::" + nss;
checkId(id, IdString::ID, ns, nss);
checkType(id, type);
+
+ id="doc:" + ns + ":" + nss;
+ checkId(id, IdString::DOC, ns, nss);
+
}
TEST("require that id id can specify location") {
@@ -148,6 +157,11 @@ TEST("require that id strings reports features (hasNumber, hasGroup)") {
EXPECT_FALSE(none.getScheme().hasGroup());
EXPECT_EQUAL("foo", none.getScheme().getNamespaceSpecific());
+ none = DocumentId("doc:ns:foo");
+ EXPECT_FALSE(none.getScheme().hasNumber());
+ EXPECT_FALSE(none.getScheme().hasGroup());
+ EXPECT_EQUAL("foo", none.getScheme().getNamespaceSpecific());
+
DocumentId user("id:ns:type:n=42:foo");
EXPECT_TRUE(user.getScheme().hasNumber());
EXPECT_FALSE(user.getScheme().hasGroup());
diff --git a/document/src/tests/buckettest.cpp b/document/src/tests/buckettest.cpp
index 763575ece4c..72e0a38c749 100644
--- a/document/src/tests/buckettest.cpp
+++ b/document/src/tests/buckettest.cpp
@@ -79,10 +79,9 @@ TEST(BucketTest, testGetBit)
TEST(BucketTest, testBucketGeneration)
{
BucketIdFactory factory;
- DocumentId doc1("id:ns:type::1");
- DocumentId doc2("id:ns2:type::1");
- DocumentId doc3("id:ns:type2::1");
- DocumentId doc4("id:ns:type::2");
+ DocumentId doc1("doc:ns:spec");
+ DocumentId doc2("doc:ns2:spec");
+ DocumentId doc3("doc:ns:spec2");
DocumentId userDoc1("id:ns:mytype:n=18:spec");
DocumentId userDoc2("id:ns2:mytype:n=18:spec2");
DocumentId userDoc3("id:ns:mytype:n=19:spec");
@@ -90,10 +89,9 @@ TEST(BucketTest, testBucketGeneration)
DocumentId groupDoc2("id:ns2:mytype:g=yahoo.com:spec2");
DocumentId groupDoc3("id:ns:mytype:g=yahoo:spec");
- BucketId docBucket1 = factory.getBucketId(doc1);
- BucketId docBucket2 = factory.getBucketId(doc2);
- BucketId docBucket3 = factory.getBucketId(doc3);
- BucketId docBucket4 = factory.getBucketId(doc4);
+ BucketId docBucket1(factory.getBucketId(doc1));
+ BucketId docBucket2(factory.getBucketId(doc2));
+ BucketId docBucket3(factory.getBucketId(doc3));
BucketId userDocBucket1(factory.getBucketId(userDoc1));
BucketId userDocBucket2(factory.getBucketId(userDoc2));
BucketId userDocBucket3(factory.getBucketId(userDoc3));
@@ -123,30 +121,28 @@ TEST(BucketTest, testBucketGeneration)
groupDocBucket3.setUsedBits(16);
EXPECT_EQ(Hex(0x4000000000001f24ull), Hex(groupDocBucket3.getId()));
- EXPECT_EQ(Hex(0xe9362c053842cac4ull), Hex(docBucket1.getRawId()));
- EXPECT_EQ(Hex(0xe960b5773842cac4ull), Hex(docBucket2.getRawId()));
- EXPECT_EQ(Hex(0xe8daaf763842cac4ull), Hex(docBucket3.getRawId()));
- EXPECT_EQ(Hex(0xeb5016ab8d721ec8ull), Hex(docBucket4.getRawId()));
+ EXPECT_EQ(Hex(0xe980c9abd5fd8d11ull), Hex(docBucket1.getRawId()));
+ EXPECT_EQ(Hex(0xeafe870c5f9c37b9ull), Hex(docBucket2.getRawId()));
+ EXPECT_EQ(Hex(0xeaebe9473ecbcd69ull), Hex(docBucket3.getRawId()));
docBucket1.setUsedBits(16);
- EXPECT_EQ(Hex(0x400000000000cac4ull), Hex(docBucket1.getId()));
+ EXPECT_EQ(Hex(0x4000000000008d11ull), Hex(docBucket1.getId()));
docBucket2.setUsedBits(16);
- EXPECT_EQ(Hex(0x400000000000cac4ull), Hex(docBucket2.getId()));
+ EXPECT_EQ(Hex(0x40000000000037b9ull), Hex(docBucket2.getId()));
docBucket3.setUsedBits(16);
- EXPECT_EQ(Hex(0x400000000000cac4ull), Hex(docBucket3.getId()));
- docBucket4.setUsedBits(16);
- EXPECT_EQ(Hex(0x4000000000001ec8ull), Hex(docBucket4.getId()));
+ EXPECT_EQ(Hex(0x400000000000cd69ull), Hex(docBucket3.getId()));
}
TEST(BucketTest, testBucketSerialization)
{
BucketIdFactory factory;
- DocumentId doc("id:ns:test::1");
+ DocumentId doc(DocIdString("ns", "spec"));
BucketId bucket(factory.getBucketId(doc));
std::ostringstream ost;
ost << bucket.getRawId();
- EXPECT_EQ(std::string("16910189189155441348"), ost.str());
+ EXPECT_EQ(std::string("16825669947722927377"),
+ ost.str());
BucketId::Type id;
std::istringstream ist(ost.str());
diff --git a/document/src/tests/cpp-globalidbucketids.txt b/document/src/tests/cpp-globalidbucketids.txt
index 0798f88faf8..40bb505ad16 100644
--- a/document/src/tests/cpp-globalidbucketids.txt
+++ b/document/src/tests/cpp-globalidbucketids.txt
@@ -1,3 +1,26 @@
+doc:ns:specific - gid(0x2c01a21163cb7d0ce85fddd6) - BucketId(0xeadd5fe811a2012c)
+doc:another:specific - gid(0xcd2ba528d1135e40605ce372) - BucketId(0xeae35c6028a52bcd)
+doc:ns:another - gid(0x1d5324270601e76a7a1f58b7) - BucketId(0xeb581f7a2724531d)
+doc:ns:0 - gid(0x87817cf2f6d05976505e74be) - BucketId(0xea745e50f27c8187)
+doc:ns:1 - gid(0x911a03b253cb5b1c283b2024) - BucketId(0xe8203b28b2031a91)
+doc:ns:2 - gid(0x1d82e56be428cda364ed6875) - BucketId(0xe968ed646be5821d)
+doc:ns:3 - gid(0xf8d223e4e68e0d571b95a6d8) - BucketId(0xe8a6951be423d2f8)
+doc:ns:4 - gid(0xdab024c2e41747dc92a1b8e3) - BucketId(0xebb8a192c224b0da)
+doc:ns:5 - gid(0xdb9023e3080c94901734f948) - BucketId(0xe8f93417e32390db)
+doc:ns:6 - gid(0xbd84ae30c63f7fdef9edbf69) - BucketId(0xe9bfedf930ae84bd)
+doc:ns:7 - gid(0x463977cf070d06e204b8166f) - BucketId(0xeb16b804cf773946)
+doc:ns:8 - gid(0x46cf1241cec694a0c07af5e2) - BucketId(0xeaf57ac04112cf46)
+doc:ns:9 - gid(0x909b77593ef7b309a06d22ef) - BucketId(0xeb226da059779b90)
+doc:ns:10 - gid(0x4888f0b3796031003a8840fb) - BucketId(0xeb40883ab3f08848)
+doc:ns:11 - gid(0x18fae4cbc359765470c10fcd) - BucketId(0xe90fc170cbe4fa18)
+doc:ns:12 - gid(0xc902059d4ac551616aea5431) - BucketId(0xe954ea6a9d0502c9)
+doc:ns:13 - gid(0x639b6aa505018e29ca4e342d) - BucketId(0xe9344ecaa56a9b63)
+doc:ns:14 - gid(0x5fa1f02be952a9d0811e8ddd) - BucketId(0xe98d1e812bf0a15f)
+doc:ns:15 - gid(0xfbc851f81830365c84229c49) - BucketId(0xe99c2284f851c8fb)
+doc:ns:16 - gid(0x06313edc8072f4495329fb5b) - BucketId(0xebfb2953dc3e3106)
+doc:ns:17 - gid(0x3d9df3e147de3a5fbd5664e4) - BucketId(0xe86456bde1f39d3d)
+doc:ns:18 - gid(0x75512f41a8dbde1c8f86a97d) - BucketId(0xe9a9868f412f5175)
+doc:ns:19 - gid(0x15ae3aa9919b2e1e46d84ada) - BucketId(0xea4ad846a93aae15)
id:ns:type::specific - gid(0x2067d966823ebdfb79537da1) - BucketId(0xe97d537966d96720)
id:another:type::specific - gid(0x2067d9664809eb39a3b72218) - BucketId(0xe822b7a366d96720)
id:ns:type::another - gid(0xb32d73e53e034c30c58a01ff) - BucketId(0xeb018ac5e5732db3)
diff --git a/document/src/tests/data/document-cpp-currentversion-lz4-9.dat b/document/src/tests/data/document-cpp-currentversion-lz4-9.dat
index 7b0650996db..5f31ac0ab78 100644
--- a/document/src/tests/data/document-cpp-currentversion-lz4-9.dat
+++ b/document/src/tests/data/document-cpp-currentversion-lz4-9.dat
Binary files differ
diff --git a/document/src/tests/data/document-cpp-currentversion-uncompressed.dat b/document/src/tests/data/document-cpp-currentversion-uncompressed.dat
index 2b39c42f8a4..6a5c5e90b84 100644
--- a/document/src/tests/data/document-cpp-currentversion-uncompressed.dat
+++ b/document/src/tests/data/document-cpp-currentversion-uncompressed.dat
Binary files differ
diff --git a/document/src/tests/data/document-cpp-v7-uncompressed.dat b/document/src/tests/data/document-cpp-v7-uncompressed.dat
new file mode 100644
index 00000000000..5f073e33438
--- /dev/null
+++ b/document/src/tests/data/document-cpp-v7-uncompressed.dat
Binary files differ
diff --git a/document/src/tests/data/document-cpp-v8-uncompressed.dat b/document/src/tests/data/document-cpp-v8-uncompressed.dat
index 2b39c42f8a4..429334fc102 100644
--- a/document/src/tests/data/document-cpp-v8-uncompressed.dat
+++ b/document/src/tests/data/document-cpp-v8-uncompressed.dat
Binary files differ
diff --git a/document/src/tests/data/serialize-fieldpathupdate-cpp.dat b/document/src/tests/data/serialize-fieldpathupdate-cpp.dat
index 025882da825..cf5f20f7a0c 100644
--- a/document/src/tests/data/serialize-fieldpathupdate-cpp.dat
+++ b/document/src/tests/data/serialize-fieldpathupdate-cpp.dat
Binary files differ
diff --git a/document/src/tests/data/serialize-fieldpathupdate-java.dat b/document/src/tests/data/serialize-fieldpathupdate-java.dat
index 025882da825..cf5f20f7a0c 100644
--- a/document/src/tests/data/serialize-fieldpathupdate-java.dat
+++ b/document/src/tests/data/serialize-fieldpathupdate-java.dat
Binary files differ
diff --git a/document/src/tests/data/serializejava-compressed.dat b/document/src/tests/data/serializejava-compressed.dat
index 0ac391422ff..0f6cb55ff85 100644
--- a/document/src/tests/data/serializejava-compressed.dat
+++ b/document/src/tests/data/serializejava-compressed.dat
Binary files differ
diff --git a/document/src/tests/data/serializejava.dat b/document/src/tests/data/serializejava.dat
index 10873c9d905..53ef6a8fbc2 100644
--- a/document/src/tests/data/serializejava.dat
+++ b/document/src/tests/data/serializejava.dat
Binary files differ
diff --git a/document/src/tests/data/serializejavawithannotations.dat b/document/src/tests/data/serializejavawithannotations.dat
index fe683d1580e..a648b72404f 100644
--- a/document/src/tests/data/serializejavawithannotations.dat
+++ b/document/src/tests/data/serializejavawithannotations.dat
Binary files differ
diff --git a/document/src/tests/data/serializeupdatecpp.dat b/document/src/tests/data/serializeupdatecpp.dat
index f972b505fb4..73d83b2ab45 100644
--- a/document/src/tests/data/serializeupdatecpp.dat
+++ b/document/src/tests/data/serializeupdatecpp.dat
Binary files differ
diff --git a/document/src/tests/data/serializeupdatejava.dat b/document/src/tests/data/serializeupdatejava.dat
index cef1ad96812..20c56228bde 100644
--- a/document/src/tests/data/serializeupdatejava.dat
+++ b/document/src/tests/data/serializeupdatejava.dat
Binary files differ
diff --git a/document/src/tests/data/serializev6.dat b/document/src/tests/data/serializev6.dat
new file mode 100644
index 00000000000..555acb9ecc7
--- /dev/null
+++ b/document/src/tests/data/serializev6.dat
Binary files differ
diff --git a/document/src/tests/documentcalculatortestcase.cpp b/document/src/tests/documentcalculatortestcase.cpp
index b6ca27f6bc7..744a7556f1b 100644
--- a/document/src/tests/documentcalculatortestcase.cpp
+++ b/document/src/tests/documentcalculatortestcase.cpp
@@ -24,7 +24,7 @@ TEST_F(DocumentCalculatorTest, testConstant) {
auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(), "4.0");
- Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("id:ns:testdoctype1::foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
EXPECT_EQ(4.0, calc.evaluate(doc, std::move(variables)));
}
@@ -32,7 +32,7 @@ TEST_F(DocumentCalculatorTest, testSimple) {
auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(), "(3 + 5) / 2");
- Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("id:ns:testdoctype1::foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
EXPECT_EQ(4.0, calc.evaluate(doc, std::move(variables)));
}
@@ -42,7 +42,7 @@ TEST_F(DocumentCalculatorTest, testVariables) {
(*variables)["y"] = 5.0;
DocumentCalculator calc(getRepo(), "($x + $y) / 2");
- Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("id:ns:testdoctype1::foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
EXPECT_EQ(4.0, calc.evaluate(doc, std::move(variables)));
}
@@ -53,7 +53,7 @@ TEST_F(DocumentCalculatorTest, testFields) {
DocumentCalculator calc(getRepo(), "(testdoctype1.headerval + testdoctype1"
".hfloatval) / testdoctype1.headerlongval");
- Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("id:ns:testdoctype1::foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
doc.setValue(doc.getField("headerval"), IntFieldValue(5));
doc.setValue(doc.getField("hfloatval"), FloatFieldValue(3.0));
doc.setValue(doc.getField("headerlongval"), LongFieldValue(2));
@@ -67,7 +67,7 @@ TEST_F(DocumentCalculatorTest, testFieldsDivZero) {
DocumentCalculator calc(getRepo(), "(testdoctype1.headerval + testdoctype1"
".hfloatval) / testdoctype1.headerlongval");
- Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("id:ns:testdoctype1::foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
doc.setValue(doc.getField("headerval"), IntFieldValue(5));
doc.setValue(doc.getField("hfloatval"), FloatFieldValue(3.0));
doc.setValue(doc.getField("headerlongval"), LongFieldValue(0));
@@ -79,7 +79,7 @@ TEST_F(DocumentCalculatorTest, testDivideByZero) {
auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(), "(3 + 5) / 0");
- Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("id:ns:testdoctype1::foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
EXPECT_THROW(calc.evaluate(doc, std::move(variables)),
vespalib::IllegalArgumentException);
}
@@ -88,7 +88,7 @@ TEST_F(DocumentCalculatorTest, testModByZero) {
auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(), "(3 + 5) % 0");
- Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("id:ns:testdoctype1::foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
EXPECT_THROW(calc.evaluate(doc, std::move(variables)),
vespalib::IllegalArgumentException);
}
@@ -98,7 +98,7 @@ TEST_F(DocumentCalculatorTest, testFieldNotSet) {
DocumentCalculator calc(getRepo(), "(testdoctype1.headerval + testdoctype1"
".hfloatval) / testdoctype1.headerlongval");
- Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("id:ns:testdoctype1::foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
doc.setValue(doc.getField("hfloatval"), FloatFieldValue(3.0));
doc.setValue(doc.getField("headerlongval"), LongFieldValue(2));
EXPECT_THROW(calc.evaluate(doc, std::move(variables)),
@@ -111,7 +111,7 @@ TEST_F(DocumentCalculatorTest, testFieldNotFound) {
"(testdoctype1.mynotfoundfield + testdoctype1"
".hfloatval) / testdoctype1.headerlongval");
- Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("id:ns:testdoctype1::foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
doc.setValue(doc.getField("hfloatval"), FloatFieldValue(3.0));
doc.setValue(doc.getField("headerlongval"), LongFieldValue(2));
EXPECT_THROW(calc.evaluate(doc, std::move(variables)),
@@ -122,7 +122,7 @@ TEST_F(DocumentCalculatorTest, testByteSubtractionZeroResult) {
auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(), "testdoctype1.byteval - 3");
- Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("id:ns:testdoctype1::foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
doc.setValue(doc.getField("byteval"), ByteFieldValue(3));
EXPECT_EQ(0.0, calc.evaluate(doc, std::move(variables)));
}
diff --git a/document/src/tests/documentidtest.cpp b/document/src/tests/documentidtest.cpp
index a6255cc148a..9befac431f6 100644
--- a/document/src/tests/documentidtest.cpp
+++ b/document/src/tests/documentidtest.cpp
@@ -23,6 +23,14 @@ TEST(DocumentIdTest, generateJavaComplianceFile)
{ // Generate file with globalids and bucket ID of various document ids,
// which java will use to ensure equal implementations.
std::ostringstream ost;
+ writeGlobalIdBucketId(ost, "doc:ns:specific");
+ writeGlobalIdBucketId(ost, "doc:another:specific");
+ writeGlobalIdBucketId(ost, "doc:ns:another");
+ for (uint32_t i=0; i<20; ++i) {
+ std::ostringstream ost2;
+ ost2 << i;
+ writeGlobalIdBucketId(ost, "doc:ns:"+ost2.str());
+ }
writeGlobalIdBucketId(ost, "id:ns:type::specific");
writeGlobalIdBucketId(ost, "id:another:type::specific");
writeGlobalIdBucketId(ost, "id:ns:type::another");
@@ -43,16 +51,17 @@ TEST(DocumentIdTest, generateJavaComplianceFile)
TEST(DocumentIdTest, testOutput)
{
- DocumentId id("id:ns:news::crawler:http://www.yahoo.com");
+ DocumentId id(DocIdString("crawler", "http://www.yahoo.com"));
std::ostringstream ost;
ost << id;
- std::string expected("id:ns:news::crawler:http://www.yahoo.com");
+ std::string expected("doc:crawler:http://www.yahoo.com");
EXPECT_EQ(expected, ost.str());
EXPECT_EQ(vespalib::string(expected), id.toString());
- expected = "DocumentId(id = id:ns:news::crawler:http://www.yahoo.com, gid(0xa516a5abd7c7fa26944b72f7))";
+ expected = "DocumentId(id = doc:crawler:http://www.yahoo.com, "
+ "gid(0x928baffb39cf32004542fb60))";
EXPECT_EQ(expected, static_cast<Printable&>(id).toString(true));
}
@@ -68,11 +77,11 @@ namespace {
TEST(DocumentIdTest, testEqualityOperator)
{
- std::string uri("id:ns:news::crawler:http://www.yahoo.com");
+ std::string uri(DocIdString("crawler", "http://www.yahoo.com").toString());
DocumentId id1(uri);
DocumentId id2(uri);
- DocumentId id3("id:ns:news::crawler:http://www.yahoo.no/");
+ DocumentId id3("doc:crawler:http://www.yahoo.no/");
EXPECT_EQ(id1, id2);
EXPECT_NE(id1, id3);
@@ -80,11 +89,11 @@ TEST(DocumentIdTest, testEqualityOperator)
TEST(DocumentIdTest, testCopying)
{
- std::string uri("id:crawler:news::http://www.yahoo.com");
+ std::string uri(DocIdString("crawler", "http://www.yahoo.com/").toString());
DocumentId id1(uri);
DocumentId id2(id1);
- DocumentId id3("id:ns:foo::");
+ DocumentId id3("doc:ns:foo");
id3 = id2;
EXPECT_EQ(id1, id2);
@@ -93,8 +102,21 @@ TEST(DocumentIdTest, testCopying)
TEST(DocumentIdTest, checkNtnuGlobalId)
{
- DocumentId id("id:ns:news::crawler:http://www.ntnu.no/");
- EXPECT_EQ(vespalib::string("gid(0x1e9d7fc69ac6c1da44dd87e0)"), id.getGlobalId().toString());
+ DocumentId id("doc:crawler:http://www.ntnu.no/");
+ EXPECT_EQ(vespalib::string("gid(0xb8863740be14221c0ac77896)"), id.getGlobalId().toString());
+}
+
+TEST(DocumentIdTest, testDocGlobalId)
+{
+ // Test that location of doc scheme documents are set correctly, such
+ // that the location is the first bytes of the original GID.
+ std::string id("doc:crawler:http://www.ntnu.no/");
+ DocumentId did(id);
+
+ unsigned char key[16];
+ fastc_md5sum(reinterpret_cast<const unsigned char*>(id.c_str()), id.size(), key);
+
+ EXPECT_EQ(GlobalId(key), did.getGlobalId());
}
TEST(DocumentIdTest, freestandingLocationFromGroupNameFuncMatchesIdLocation)
diff --git a/document/src/tests/documentselectparsertest.cpp b/document/src/tests/documentselectparsertest.cpp
index 79b849c5ba9..97921109c60 100644
--- a/document/src/tests/documentselectparsertest.cpp
+++ b/document/src/tests/documentselectparsertest.cpp
@@ -132,8 +132,10 @@ void
DocumentSelectParserTest::createDocs()
{
_doc.clear();
- _doc.push_back(createDoc("testdoctype1", "id:myspace:testdoctype1::anything", 24, 2.0, "foo", "bar", 0)); // DOC 0
- _doc.push_back(createDoc("testdoctype1", "id:anotherspace:testdoctype1::foo", 13, 4.1, "bar", "foo", 0)); // DOC 1
+ _doc.push_back(createDoc(
+ "testdoctype1", "doc:myspace:anything", 24, 2.0, "foo", "bar", 0)); // DOC 0
+ _doc.push_back(createDoc(
+ "testdoctype1", "doc:anotherspace:foo", 13, 4.1, "bar", "foo", 0)); // DOC 1
// Add some arrays and structs to doc 1
{
StructFieldValue sval(_doc.back()->getField("mystruct").getDataType());
@@ -206,8 +208,10 @@ DocumentSelectParserTest::createDocs()
_doc.back()->getField("structarray").getDataType());
_doc.back()->setValue("structarray", aval);
}
- _doc.push_back(createDoc("testdoctype1", "id:myspace:testdoctype1:g=yahoo:bar", 14, 2.4, "Yet", "\xE4\xB8\xBA\xE4\xBB\x80", 0)); // DOC 3
- _doc.push_back(createDoc("testdoctype2", "id:myspace:testdoctype2::inheriteddoc", 10, 1.4, "inherited", "")); // DOC 4
+ _doc.push_back(createDoc(
+ "testdoctype1", "id:myspace:testdoctype1:g=yahoo:bar", 14, 2.4, "Yet", "\xE4\xB8\xBA\xE4\xBB\x80", 0)); // DOC 3
+ _doc.push_back(createDoc(
+ "testdoctype2", "doc:myspace:inheriteddoc", 10, 1.4, "inherited", "")); // DOC 4
_doc.push_back(createDoc(
"testdoctype1", "id:footype:testdoctype1:n=123456789:aardvark",
10, 1.4, "inherited", "", 0)); // DOC 5
@@ -218,7 +222,7 @@ DocumentSelectParserTest::createDocs()
"testdoctype1", "id:footype:testdoctype1:n=1234:highlong",
10, 1.4, "inherited", "", -2651257743)); // DOC 7
_doc.push_back(createDoc( // DOC 8. As DOC 0 but with version 2.
- "testdoctype1", "id:myspace:testdoctype1::anything", 24, 2.0, "foo", "bar", 0));
+ "testdoctype1", "doc:myspace:anything", 24, 2.0, "foo", "bar", 0));
_doc.push_back(createDoc(
"testdoctype1", "id:footype:testdoctype1:n=12345:foo",
10, 1.4, "inherited", "", 42)); // DOC 9
@@ -227,11 +231,16 @@ DocumentSelectParserTest::createDocs()
10, 1.4, "inherited", "", 42)); // DOC 10
_update.clear();
- _update.push_back(createUpdate("testdoctype1", "id:myspace:testdoctype1::anything", 20, "hmm"));
- _update.push_back(createUpdate("testdoctype1", "id:anotherspace:testdoctype1::foo", 10, "foo"));
- _update.push_back(createUpdate("testdoctype1", "id:myspace:testdoctype1:n=1234:footype1", 0, "foo"));
- _update.push_back(createUpdate("testdoctype1", "id:myspace:testdoctype1:g=yahoo:bar", 3, "\xE4\xBA\xB8\xE4\xBB\x80"));
- _update.push_back(createUpdate("testdoctype2", "id:myspace:testdoctype2::inheriteddoc", 10, "bar"));
+ _update.push_back(createUpdate(
+ "testdoctype1", "doc:myspace:anything", 20, "hmm"));
+ _update.push_back(createUpdate(
+ "testdoctype1", "doc:anotherspace:foo", 10, "foo"));
+ _update.push_back(createUpdate(
+ "testdoctype1", "id:myspace:testdoctype1:n=1234:footype1", 0, "foo"));
+ _update.push_back(createUpdate(
+ "testdoctype1", "id:myspace:testdoctype1:g=yahoo:bar", 3, "\xE4\xBA\xB8\xE4\xBB\x80"));
+ _update.push_back(createUpdate(
+ "testdoctype2", "doc:myspace:inheriteddoc", 10, "bar"));
}
namespace {
@@ -613,14 +622,14 @@ void DocumentSelectParserTest::testOperators2()
createDocs();
// Id values
- PARSEI("id == \"id:myspace:testdoctype1::anything\"", *_doc[0], True);
- PARSEI(" iD== \"id:myspace:testdoctype1::anything\" ", *_doc[0], True);
- PARSEI("id == \"id:myspa:testdoctype1::nything\"", *_doc[0], False);
- PARSEI("Id.scHeme == \"doc\"", *_doc[0], False);
- PARSEI("id.scheme == \"id\"", *_doc[0], True);
+ PARSEI("id == \"doc:myspace:anything\"", *_doc[0], True);
+ PARSEI(" iD== \"doc:myspace:anything\" ", *_doc[0], True);
+ PARSEI("id == \"doc:myspa:nything\"", *_doc[0], False);
+ PARSEI("Id.scHeme == \"doc\"", *_doc[0], True);
+ PARSEI("id.scheme == \"id\"", *_doc[0], False);
PARSEI("id.type == \"testdoctype1\"", *_doc[9], True);
PARSEI("id.type == \"wrong_type\"", *_doc[9], False);
- PARSEI("id.type == \"unknown\"", *_doc[0], False);
+ PARSEI("id.type == \"unknown\"", *_doc[0], Invalid);
PARSEI("Id.namespaCe == \"myspace\"", *_doc[0], True);
PARSEI("id.NaMespace == \"pace\"", *_doc[0], False);
PARSEI("id.specific == \"anything\"", *_doc[0], True);
@@ -638,17 +647,17 @@ void DocumentSelectParserTest::testOperators3()
createDocs();
{
std::ostringstream ost;
- ost << "id.bucket == " << BucketId(16, 0xe1f0).getId() ;
+ ost << "id.bucket == " << BucketId(16, 4006).getId() ;
PARSEI(ost.str(), *_doc[0], True);
}
{
std::ostringstream ost;
- ost << "id.bucket == " << BucketId(18, 0xe1f0).getId() ;
+ ost << "id.bucket == " << BucketId(17, 4006).getId() ;
PARSEI(ost.str(), *_doc[0], False);
}
{
std::ostringstream ost;
- ost << "id.bucket == " << BucketId(18, 0x2e1f0).getId() ;
+ ost << "id.bucket == " << BucketId(17, 69542).getId() ;
PARSEI(ost.str(), *_doc[0], True);
}
{
@@ -1099,11 +1108,11 @@ void DocumentSelectParserTest::testDocumentUpdates2()
createDocs();
// Id values
- PARSEI("id == \"id:myspace:testdoctype1::anything\"", *_update[0], True);
- PARSEI(" iD== \"id:myspace:testdoctype1::anything\" ", *_update[0], True);
- PARSEI("id == \"id:myspa:testdoctype1::nything\"", *_update[0], False);
- PARSEI("Id.scHeme == \"doc\"", *_update[0], False);
- PARSEI("id.scheme == \"id\"", *_update[0], True);
+ PARSEI("id == \"doc:myspace:anything\"", *_update[0], True);
+ PARSEI(" iD== \"doc:myspace:anything\" ", *_update[0], True);
+ PARSEI("id == \"doc:myspa:nything\"", *_update[0], False);
+ PARSEI("Id.scHeme == \"doc\"", *_update[0], True);
+ PARSEI("id.scheme == \"id\"", *_update[0], False);
PARSEI("Id.namespaCe == \"myspace\"", *_update[0], True);
PARSEI("id.NaMespace == \"pace\"", *_update[0], False);
PARSEI("id.specific == \"anything\"", *_update[0], True);
@@ -1114,7 +1123,7 @@ void DocumentSelectParserTest::testDocumentUpdates2()
PARSEI("id.bucket == 1234", *_update[0], False);
{
std::ostringstream ost;
- ost << "id.bucket == " << BucketId(16, 0xe1f0).getId();
+ ost << "id.bucket == " << BucketId(16, 4006).getId();
PARSEI(ost.str(), *_update[0], True);
}
PARSEI("id.bucket == \"foo\"", *_update[0], Invalid);
@@ -1192,7 +1201,8 @@ TEST_F(DocumentSelectParserTest, testUtf8)
// boost::u32regex rx = boost::make_u32regex("H.kon");
// EXPECT_EQ(true, boost::u32regex_match(utf8name, rx));
- _doc.push_back(createDoc("testdoctype1", "id:myspace:testdoctype1::utf8doc", 24, 2.0, utf8name, "bar"));
+ _doc.push_back(createDoc(
+ "testdoctype1", "doc:myspace:utf8doc", 24, 2.0, utf8name, "bar"));
// PARSE("testdoctype1.hstringval = \"H?kon\"", *_doc[_doc.size()-1], True);
// PARSE("testdoctype1.hstringval =~ \"H.kon\"", *_doc[_doc.size()-1], True);
}
diff --git a/document/src/tests/documenttestcase.cpp b/document/src/tests/documenttestcase.cpp
index fa59358f6d3..089ab5a2a2d 100644
--- a/document/src/tests/documenttestcase.cpp
+++ b/document/src/tests/documenttestcase.cpp
@@ -112,7 +112,7 @@ TEST(DocumentTest, testTraversing)
type.addField(primitive1);
type.addField(structl1s1);
- Document doc(type, DocumentId("id:ns:test::1"));
+ Document doc(type, DocumentId("doc::testdoc"));
doc.setValue(primitive1, IntFieldValue(1));
StructFieldValue l1s1(struct3);
@@ -184,7 +184,7 @@ TEST(DocumentTest, testVariables)
iiiaV.add(iiaV);
}
- Document doc(type, DocumentId("id:ns:test::1"));
+ Document doc(type, DocumentId("doc::testdoc"));
doc.setValue(iiiarrF, iiiaV);
{
@@ -291,7 +291,7 @@ TEST(DocumentTest, testModifyDocument)
type.addField(primitive1);
type.addField(structl1s1);
- Document::UP doc(new Document(type, DocumentId("id:ns:test::1")));
+ Document::UP doc(new Document(type, DocumentId("doc::testdoc")));
doc->setValue(primitive1, IntFieldValue(1));
StructFieldValue l1s1(struct3);
@@ -364,7 +364,7 @@ TEST(DocumentTest, testSimpleUsage)
type->addField(strF);
DocumentTypeRepo repo(*type);
- Document value(*repo.getDocumentType("test"), DocumentId("id:ns:test::1"));
+ Document value(*repo.getDocumentType("test"), DocumentId("doc::testdoc"));
// Initially empty
EXPECT_EQ(size_t(0), value.getSetFieldCount());
@@ -393,7 +393,7 @@ TEST(DocumentTest, testSimpleUsage)
value2.deserialize(repo, *buffer);
EXPECT_TRUE(value2.hasValue(intF));
EXPECT_EQ(value, value2);
- EXPECT_EQ(DocumentId("id:ns:test::1"), value2.getId());
+ EXPECT_EQ(DocumentId("doc::testdoc"), value2.getId());
// Various ways of removing
{
@@ -446,11 +446,11 @@ TEST(DocumentTest, testSimpleUsage)
// Output
EXPECT_EQ(
- std::string("Document(id:ns:test::1, DocumentType(test))"),
+ std::string("Document(doc::testdoc, DocumentType(test))"),
value.toString(false));
EXPECT_EQ(
std::string(
-" Document(id:ns:test::1\n"
+" Document(doc::testdoc\n"
" DocumentType(test, id -877171244)\n"
" : DocumentType(document) {\n"
" StructDataType(test.header, id 306916075) {\n"
@@ -465,7 +465,7 @@ TEST(DocumentTest, testSimpleUsage)
" " + value.toString(true, " "));
EXPECT_EQ(
std::string(
- "<document documenttype=\"test\" documentid=\"id:ns:test::1\">\n"
+ "<document documenttype=\"test\" documentid=\"doc::testdoc\">\n"
" <int>1</int>\n"
" <long>2</long>\n"
"</document>"),
@@ -483,10 +483,11 @@ TEST(DocumentTest, testSimpleUsage)
// Refuse to accept non-document types
try{
StructDataType otherType("foo", 4);
- Document value6(otherType, DocumentId("id:ns:foo::1"));
+ Document value6(otherType, DocumentId("doc::"));
FAIL() << "Didn't complain about non-document type";
} catch (std::exception& e) {
- EXPECT_THAT(e.what(), HasSubstr("Cannot generate a document with non-document type"));
+ EXPECT_THAT(e.what(), HasSubstr("Cannot generate a document with "
+ "non-document type"));
}
// Refuse to set wrong types
@@ -562,7 +563,7 @@ TEST(DocumentTest, testReadSerializedFile)
ByteBuffer buf(len);
lseek(fd,0,SEEK_SET);
if (read(fd, buf.getBuffer(), len) != (ssize_t)len) {
- throw vespalib::Exception("read failed");
+ throw vespalib::Exception("read failed");
}
close(fd);
@@ -596,7 +597,7 @@ TEST(DocumentTest, testReadSerializedFileCompressed)
ByteBuffer buf(len);
lseek(fd,0,SEEK_SET);
if (read(fd, buf.getBuffer(), len) != len) {
- throw vespalib::Exception("read failed");
+ throw vespalib::Exception("read failed");
}
close(fd);
@@ -644,7 +645,6 @@ namespace {
* When adding new fields to the documents, use the version tagged with each
* file to ignore these field for old types.
*/
-
TEST(DocumentTest,testReadSerializedAllVersions)
{
const int array_id = 1650586661;
@@ -679,7 +679,8 @@ TEST(DocumentTest,testReadSerializedAllVersions)
// Create a memory instance of document
{
- Document doc(*docType, DocumentId("id:ns:serializetest::http://test.doc.id/"));
+ Document doc(*docType,
+ DocumentId("doc:serializetest:http://test.doc.id/"));
doc.set("intfield", 5);
doc.set("floatfield", -9.23);
doc.set("stringfield", "This is a string.");
@@ -687,7 +688,8 @@ TEST(DocumentTest,testReadSerializedAllVersions)
doc.set("doublefield", 98374532.398820);
doc.set("bytefield", -2);
doc.setValue("rawfield", RawFieldValue("RAW DATA", 8));
- Document docInDoc(*docInDocType, DocumentId("id:ns:docindoc::http://doc.in.doc/"));
+ Document docInDoc(*docInDocType,
+ DocumentId("doc:serializetest:http://doc.in.doc/"));
docInDoc.set("stringindocfield", "Elvis is dead");
//docInDoc.setCompression(CompressionConfig(CompressionConfig::NONE, 0, 0));
doc.setValue("docfield", docInDoc);
@@ -733,6 +735,7 @@ TEST(DocumentTest,testReadSerializedAllVersions)
std::vector<TestDoc> tests;
tests.push_back(TestDoc(TEST_PATH("data/document-cpp-v8-uncompressed.dat"), 8));
+ tests.push_back(TestDoc(TEST_PATH("data/document-cpp-v7-uncompressed.dat"), 7));
tests.push_back(TestDoc(jpath + "document-java-v8-uncompressed.dat", 8));
for (uint32_t i=0; i<tests.size(); ++i) {
int version = tests[i]._createdVersion;
@@ -746,7 +749,7 @@ TEST(DocumentTest,testReadSerializedAllVersions)
ByteBuffer buf(len);
lseek(fd,0,SEEK_SET);
if (read(fd, buf.getBuffer(), len) != len) {
- throw vespalib::Exception("read failed");
+ throw vespalib::Exception("read failed");
}
close(fd);
@@ -830,7 +833,9 @@ TEST(DocumentTest, testGenerateSerializedFile)
{
const std::string file_name = TEST_PATH("data/crossplatform-java-cpp-doctypes.cfg");
DocumentTypeRepo repo(readDocumenttypesConfig(file_name));
- Document doc(*repo.getDocumentType("serializetest"), DocumentId("id:ns:serializetest::http://test.doc.id/"));
+ Document doc(*repo.getDocumentType("serializetest"),
+ DocumentId(DocIdString("serializetest",
+ "http://test.doc.id/")));
doc.set("intfield", 5);
doc.set("floatfield", -9.23);
@@ -843,7 +848,8 @@ TEST(DocumentTest, testGenerateSerializedFile)
const DocumentType *docindoc_type = repo.getDocumentType("docindoc");
EXPECT_TRUE(docindoc_type);
- Document embedDoc(*docindoc_type, DocumentId("id:ns:docindoc::http://embedded"));
+ Document embedDoc(*docindoc_type,
+ DocumentId(DocIdString("docindoc", "http://embedded")));
doc.setValue("docfield", embedDoc);
@@ -868,7 +874,7 @@ TEST(DocumentTest, testGenerateSerializedFile)
int fd = open((serializedDir + "/serializecpp.dat").c_str(),
O_WRONLY | O_TRUNC | O_CREAT, 0644);
if (write(fd, buf->getBuffer(), buf->getPos()) != (ssize_t)buf->getPos()) {
- throw vespalib::Exception("write failed");
+ throw vespalib::Exception("write failed");
}
close(fd);
@@ -877,16 +883,16 @@ TEST(DocumentTest, testGenerateSerializedFile)
fd = open((serializedDir + "/serializecppsplit_header.dat").c_str(),
O_WRONLY | O_TRUNC | O_CREAT, 0644);
if (write(fd, hBuf.getBuffer(), hBuf.getPos()) != (ssize_t)hBuf.getPos()) {
- throw vespalib::Exception("write failed");
+ throw vespalib::Exception("write failed");
}
close(fd);
ByteBuffer bBuf(getSerializedSizeBody(doc));
doc.serializeBody(bBuf);
- fd = open((serializedDir+ "/serializecppsplit_body.dat").c_str(),
+ fd = open(TEST_PATH("/serializecppsplit_body.dat").c_str(),
O_WRONLY | O_TRUNC | O_CREAT, 0644);
if (write(fd, bBuf.getBuffer(), bBuf.getPos()) != (ssize_t)bBuf.getPos()) {
- throw vespalib::Exception("write failed");
+ throw vespalib::Exception("write failed");
}
close(fd);
@@ -898,10 +904,10 @@ TEST(DocumentTest, testGenerateSerializedFile)
doc.serialize(lz4buf);
lz4buf.flip();
- fd = open((serializedDir + "/serializecpp-lz4-level9.dat").c_str(),
+ fd = open(TEST_PATH("/serializecpp-lz4-level9.dat").c_str(),
O_WRONLY | O_TRUNC | O_CREAT, 0644);
if (write(fd, lz4buf.getBufferAtPos(), lz4buf.getRemaining()) != (ssize_t)lz4buf.getRemaining()) {
- throw vespalib::Exception("write failed");
+ throw vespalib::Exception("write failed");
}
close(fd);
}
@@ -909,14 +915,15 @@ TEST(DocumentTest, testGenerateSerializedFile)
TEST(DocumentTest, testGetURIFromSerialized)
{
TestDocRepo test_repo;
- Document doc(*test_repo.getDocumentType("testdoctype1"), DocumentId("id:ns:testdoctype1::1"));
+ Document doc(*test_repo.getDocumentType("testdoctype1"),
+ DocumentId("doc:ns:testdoc"));
{
std::unique_ptr<ByteBuffer> serialized = doc.serialize();
serialized->flip();
EXPECT_EQ(
- vespalib::string("id:ns:testdoctype1::1"),
+ vespalib::string(DocIdString("ns", "testdoc").toString()),
Document::getIdFromSerialized(*serialized).toString());
EXPECT_EQ(vespalib::string("testdoctype1"),
@@ -930,7 +937,8 @@ TEST(DocumentTest, testGetURIFromSerialized)
serialized->flip();
Document doc2(test_repo.getTypeRepo(), *serialized, false, NULL);
- EXPECT_EQ(vespalib::string("id:ns:testdoctype1::1"), doc2.getId().toString());
+ EXPECT_EQ(
+ vespalib::string(DocIdString("ns", "testdoc").toString()), doc2.getId().toString());
EXPECT_EQ(vespalib::string("testdoctype1"), doc2.getType().getName());
}
}
@@ -939,7 +947,8 @@ TEST(DocumentTest, testBogusserialize)
{
TestDocRepo test_repo;
try {
- auto buf = std::make_unique<ByteBuffer>("aoifjweprjwoejr203r+2+4r823++!",100);
+ std::unique_ptr<ByteBuffer> buf(
+ new ByteBuffer("aoifjweprjwoejr203r+2+4r823++!",100));
Document doc(test_repo.getTypeRepo(), *buf);
FAIL() << "Failed to throw exception deserializing bogus data";
} catch (DeserializeException& e) {
@@ -947,7 +956,7 @@ TEST(DocumentTest, testBogusserialize)
}
try {
- auto buf = std::make_unique<ByteBuffer>("",0);
+ std::unique_ptr<ByteBuffer> buf(new ByteBuffer("",0));
Document doc(test_repo.getTypeRepo(), *buf);
FAIL() << "Failed to throw exception deserializing empty buffer";
} catch (DeserializeException& e) {
@@ -958,17 +967,19 @@ TEST(DocumentTest, testBogusserialize)
TEST(DocumentTest, testCRC32)
{
TestDocRepo test_repo;
- Document doc(*test_repo.getDocumentType("testdoctype1"), DocumentId("id:ns:testdoctype1::crawler:http://www.ntnu.no/"));
+ Document doc(*test_repo.getDocumentType("testdoctype1"),
+ DocumentId(DocIdString("crawler", "http://www.ntnu.no/")));
- doc.setValue(doc.getField("hstringval"), StringFieldValue("bla bla bla bla bla"));
+ doc.setValue(doc.getField("hstringval"),
+ StringFieldValue("bla bla bla bla bla"));
uint32_t crc = doc.calculateChecksum();
- EXPECT_EQ(3987392271u, crc);
+ EXPECT_EQ(277496115u, crc);
std::unique_ptr<ByteBuffer> buf = doc.serialize();
buf->flip();
- int pos = 30;
+ int pos = 20;
// Corrupt serialization.
buf->getBuffer()[pos] ^= 72;
@@ -991,11 +1002,12 @@ TEST(DocumentTest, testHasChanged)
{
TestDocRepo test_repo;
Document doc(*test_repo.getDocumentType("testdoctype1"),
- DocumentId("id:ns:testdoctype1::crawler:http://www.ntnu.no/"));
+ DocumentId(DocIdString("crawler", "http://www.ntnu.no/")));
// Before deserialization we are changed.
EXPECT_TRUE(doc.hasChanged());
- doc.setValue(doc.getField("hstringval"), StringFieldValue("bla bla bla bla bla"));
+ doc.setValue(doc.getField("hstringval"),
+ StringFieldValue("bla bla bla bla bla"));
// Still changed after setting a value of course.
EXPECT_TRUE(doc.hasChanged());
@@ -1066,7 +1078,8 @@ TEST(DocumentTest, testSliceSerialize)
// bytebuffer.
TestDocMan testDocMan;
Document::UP doc = testDocMan.createDocument();
- Document::UP doc2 = testDocMan.createDocument("Some other content", "id:ns:testdoctype1::anotherdoc");
+ Document::UP doc2 = testDocMan.createDocument(
+ "Some other content", "doc:test:anotherdoc");
ArrayFieldValue val(doc2->getField("rawarray").getDataType());
val.add(RawFieldValue("hei", 3));
@@ -1078,13 +1091,15 @@ TEST(DocumentTest, testSliceSerialize)
doc->serialize(buf);
EXPECT_EQ(getSerializedSize(*doc), buf.getPos());
doc2->serialize(buf);
- EXPECT_EQ(getSerializedSize(*doc) + getSerializedSize(*doc2), buf.getPos());
+ EXPECT_EQ(getSerializedSize(*doc) + getSerializedSize(*doc2),
+ buf.getPos());
buf.flip();
Document doc3(testDocMan.getTypeRepo(), buf);
EXPECT_EQ(getSerializedSize(*doc), buf.getPos());
Document doc4(testDocMan.getTypeRepo(), buf);
- EXPECT_EQ(getSerializedSize(*doc) + getSerializedSize(*doc2), buf.getPos());
+ EXPECT_EQ(getSerializedSize(*doc) + getSerializedSize(*doc2),
+ buf.getPos());
EXPECT_EQ(*doc, doc3);
EXPECT_EQ(*doc2, doc4);
@@ -1127,8 +1142,9 @@ TEST(DocumentTest, testCompressionConfigured)
Struct("serializetest.body").setId(45)
.addField("stringfield", DataType::T_STRING));
DocumentTypeRepo repo(builder.config());
- Document doc_uncompressed(*repo.getDocumentType("serializetest"),
- DocumentId("id:ns:serializetest::1"));
+ Document doc_uncompressed(
+ *repo.getDocumentType("serializetest"),
+ DocumentId("doc:test:test"));
std::string bigString("compress me");
for (int i = 0; i < 8; ++i) { bigString += bigString; }
@@ -1190,7 +1206,7 @@ TEST(DocumentTest, testUnknownEntries)
DocumentTypeRepo repo(type2);
- Document doc1(type1, DocumentId("id:ns:test::1"));
+ Document doc1(type1, DocumentId("doc::testdoc"));
doc1.setValue(field1, IntFieldValue(1));
doc1.setValue(field2, IntFieldValue(2));
doc1.setValue(field3, IntFieldValue(3));
@@ -1219,12 +1235,12 @@ TEST(DocumentTest, testUnknownEntries)
doc3.deserializeBody(repo, body);
EXPECT_EQ(std::string(
- "<document documenttype=\"test\" documentid=\"id:ns:test::1\">\n"
+ "<document documenttype=\"test\" documentid=\"doc::testdoc\">\n"
"<int3>3</int3>\n"
"<int4>4</int4>\n"
"</document>"), doc2.toXml());
EXPECT_EQ(std::string(
- "<document documenttype=\"test\" documentid=\"id:ns:test::1\">\n"
+ "<document documenttype=\"test\" documentid=\"doc::testdoc\">\n"
"<int3>3</int3>\n"
"<int4>4</int4>\n"
"</document>"), doc3.toXml());
@@ -1281,7 +1297,7 @@ TEST(DocumentTest, testAnnotationDeserialization)
ByteBuffer buf(len);
lseek(fd,0,SEEK_SET);
if (read(fd, buf.getBuffer(), len) != len) {
- throw vespalib::Exception("read failed");
+ throw vespalib::Exception("read failed");
}
close(fd);
diff --git a/document/src/tests/documenttypetestcase.cpp b/document/src/tests/documenttypetestcase.cpp
index caddfbc70fc..649367d76f3 100644
--- a/document/src/tests/documenttypetestcase.cpp
+++ b/document/src/tests/documenttypetestcase.cpp
@@ -118,7 +118,7 @@ TEST(DocumentTypeTest, testMultipleInheritance)
EXPECT_TRUE(docType3->hasField("tmp"));
EXPECT_TRUE(docType3->hasField("tall"));
- Document doc(*docType3, DocumentId("id:ns:test3::1"));
+ Document doc(*docType3, DocumentId(DocIdString("test", "test")));
IntFieldValue intVal(3);
doc.setValue(doc.getField("nalle"), intVal);
diff --git a/document/src/tests/documentupdatetestcase.cpp b/document/src/tests/documentupdatetestcase.cpp
index b22edfd1ad6..b9568d546c5 100644
--- a/document/src/tests/documentupdatetestcase.cpp
+++ b/document/src/tests/documentupdatetestcase.cpp
@@ -140,14 +140,14 @@ TEST(DocumentUpdateTest, testSimpleUsage)
EXPECT_EQ(fieldUpdate, fieldUpdateCopy);
// Test that a document update can be serialized
- DocumentUpdate docUpdate(repo, *docType, DocumentId("id:ns:test::1"));
+ DocumentUpdate docUpdate(repo, *docType, DocumentId("doc::testdoc"));
docUpdate.addUpdate(fieldUpdateCopy);
ByteBuffer::UP docBuf = serializeHEAD(docUpdate);
docBuf->flip();
auto docUpdateCopy(DocumentUpdate::createHEAD(repo, nbostream(docBuf->getBufferAtPos(), docBuf->getRemaining())));
// Create a test document
- Document doc(*docType, DocumentId("id:ns:test::1"));
+ Document doc(*docType, DocumentId("doc::testdoc"));
doc.set("bytef", 0);
doc.set("intf", 5);
ArrayFieldValue array(*arrayType);
@@ -158,7 +158,7 @@ TEST(DocumentUpdateTest, testSimpleUsage)
// Verify that we can apply simple updates to it
{
Document updated(doc);
- DocumentUpdate upd(repo, *docType, DocumentId("id:ns:test::1"));
+ DocumentUpdate upd(repo, *docType, DocumentId("doc::testdoc"));
upd.addUpdate(FieldUpdate(docType->getField("intf")).addUpdate(ClearValueUpdate()));
upd.applyTo(updated);
EXPECT_NE(doc, updated);
@@ -166,7 +166,7 @@ TEST(DocumentUpdateTest, testSimpleUsage)
}
{
Document updated(doc);
- DocumentUpdate upd(repo, *docType, DocumentId("id:ns:test::1"));
+ DocumentUpdate upd(repo, *docType, DocumentId("doc::testdoc"));
upd.addUpdate(FieldUpdate(docType->getField("intf")).addUpdate(AssignValueUpdate(IntFieldValue(15))));
upd.applyTo(updated);
EXPECT_NE(doc, updated);
@@ -174,7 +174,7 @@ TEST(DocumentUpdateTest, testSimpleUsage)
}
{
Document updated(doc);
- DocumentUpdate upd(repo, *docType, DocumentId("id:ns:test::1"));
+ DocumentUpdate upd(repo, *docType, DocumentId("doc::testdoc"));
upd.addUpdate(FieldUpdate(docType->getField("intf")).addUpdate(ArithmeticValueUpdate(ArithmeticValueUpdate::Add, 15)));
upd.applyTo(updated);
EXPECT_NE(doc, updated);
@@ -182,7 +182,7 @@ TEST(DocumentUpdateTest, testSimpleUsage)
}
{
Document updated(doc);
- DocumentUpdate upd(repo, *docType, DocumentId("id:ns:test::1"));
+ DocumentUpdate upd(repo, *docType, DocumentId("doc::testdoc"));
upd.addUpdate(FieldUpdate(docType->getField("intarr")).addUpdate(AddValueUpdate(IntFieldValue(4))));
upd.applyTo(updated);
EXPECT_NE(doc, updated);
@@ -192,7 +192,7 @@ TEST(DocumentUpdateTest, testSimpleUsage)
}
{
Document updated(doc);
- DocumentUpdate upd(repo, *docType, DocumentId("id:ns:test::1"));
+ DocumentUpdate upd(repo, *docType, DocumentId("doc::testdoc"));
upd.addUpdate(FieldUpdate(docType->getField("intarr")).addUpdate(RemoveValueUpdate(IntFieldValue(3))));
upd.applyTo(updated);
EXPECT_NE(doc, updated);
@@ -202,7 +202,7 @@ TEST(DocumentUpdateTest, testSimpleUsage)
}
{
Document updated(doc);
- DocumentUpdate upd(repo, *docType, DocumentId("id:ns:test::1"));
+ DocumentUpdate upd(repo, *docType, DocumentId("doc::testdoc"));
upd.addUpdate(FieldUpdate(docType->getField("bytef"))
.addUpdate(ArithmeticValueUpdate(ArithmeticValueUpdate::Add, 15)));
upd.applyTo(updated);
@@ -409,9 +409,9 @@ WeightedSetAutoCreateFixture::~WeightedSetAutoCreateFixture() = default;
WeightedSetAutoCreateFixture::WeightedSetAutoCreateFixture()
: repo(makeConfig()),
docType(repo.getDocumentType("test")),
- doc(*docType, DocumentId("id:ns:test::1")),
+ doc(*docType, DocumentId("doc::testdoc")),
field(docType->getField("strwset")),
- update(repo, *docType, DocumentId("id:ns:test::1"))
+ update(repo, *docType, DocumentId("doc::testdoc"))
{
update.addUpdate(FieldUpdate(field)
.addUpdate(MapValueUpdate(StringFieldValue("foo"),
@@ -475,7 +475,7 @@ TEST(DocumentUpdateTest, testReadSerializedFile)
DocumentUpdate& upd(*updp);
const DocumentType *type = repo.getDocumentType("serializetest");
- EXPECT_EQ(DocumentId("id:ns:serializetest::update"), upd.getId());
+ EXPECT_EQ(DocumentId(DocIdString("update", "test")), upd.getId());
EXPECT_EQ(*type, upd.getType());
// Verify assign value update.
@@ -533,7 +533,7 @@ TEST(DocumentUpdateTest, testGenerateSerializedFile)
DocumentTypeRepo repo(readDocumenttypesConfig(file_name));
const DocumentType *type(repo.getDocumentType("serializetest"));
- DocumentUpdate upd(repo, *type, DocumentId("id:ns:serializetest::update"));
+ DocumentUpdate upd(repo, *type, DocumentId(DocIdString("update", "test")));
upd.addUpdate(FieldUpdate(type->getField("intfield"))
.addUpdate(AssignValueUpdate(IntFieldValue(4))));
upd.addUpdate(FieldUpdate(type->getField("floatfield"))
diff --git a/document/src/tests/fieldpathupdatetestcase.cpp b/document/src/tests/fieldpathupdatetestcase.cpp
index 36a1c339ebb..74e2c20ad86 100644
--- a/document/src/tests/fieldpathupdatetestcase.cpp
+++ b/document/src/tests/fieldpathupdatetestcase.cpp
@@ -83,7 +83,7 @@ createTestDocument(const DocumentTypeRepo &repo)
const DataType* structmap(repo.getDataType(*type, "Map<String,struct2>"));
const DataType* wset(repo.getDataType(*type, "WeightedSet<String>"));
const DataType* structwset(repo.getDataType(*type, "WeightedSet<struct2>"));
- Document::UP doc(new Document(*type, DocumentId("id:ns:test::1")));
+ Document::UP doc(new Document(*type, DocumentId("doc::testdoc")));
doc->setRepo(repo);
doc->setValue("primitive1", IntFieldValue(1));
StructFieldValue l1s1(*struct3);
@@ -296,12 +296,12 @@ TEST_F(FieldPathUpdateTestCase, testNoIterateMapValues)
TEST_F(FieldPathUpdateTestCase, testRemoveField)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::things:thangs")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:things:thangs")));
EXPECT_TRUE(doc->hasValue("strfoo") == false);
doc->setValue("strfoo", StringFieldValue("cocacola"));
EXPECT_EQ(vespalib::string("cocacola"), doc->getValue("strfoo")->getAsString());
//doc->print(std::cerr, true, "");
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(new RemoveFieldPathUpdate("strfoo")));
docUp.applyTo(*doc);
EXPECT_TRUE(doc->hasValue("strfoo") == false);
@@ -309,7 +309,7 @@ TEST_F(FieldPathUpdateTestCase, testRemoveField)
TEST_F(FieldPathUpdateTestCase, testApplyRemoveMultiList)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::things:thangs")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:things:thangs")));
doc->setRepo(*_repo);
EXPECT_TRUE(doc->hasValue("strarray") == false);
{
@@ -321,7 +321,7 @@ TEST_F(FieldPathUpdateTestCase, testApplyRemoveMultiList)
}
EXPECT_TRUE(doc->hasValue("strarray"));
//doc->print(std::cerr, true, "");
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(
new RemoveFieldPathUpdate("strarray[$x]", "foobar.strarray[$x] == \"remove val 1\"")));
docUp.applyTo(*doc);
@@ -335,7 +335,7 @@ TEST_F(FieldPathUpdateTestCase, testApplyRemoveMultiList)
TEST_F(FieldPathUpdateTestCase, testApplyRemoveMultiList2)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::things:thangs")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:things:thangs")));
doc->setRepo(*_repo);
EXPECT_TRUE(doc->hasValue("strarray") == false);
{
@@ -347,7 +347,7 @@ TEST_F(FieldPathUpdateTestCase, testApplyRemoveMultiList2)
}
EXPECT_TRUE(doc->hasValue("strarray"));
//doc->print(std::cerr, true, "");
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(
new RemoveFieldPathUpdate("strarray[$x]", "foobar.strarray[$x] == \"remove val 1\"")));
docUp.applyTo(*doc);
@@ -360,7 +360,7 @@ TEST_F(FieldPathUpdateTestCase, testApplyRemoveMultiList2)
TEST_F(FieldPathUpdateTestCase, testApplyRemoveEntireListField)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::things:thangs")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:things:thangs")));
EXPECT_TRUE(doc->hasValue("strarray") == false);
{
ArrayFieldValue strArray(doc->getType().getField("strarray").getDataType());
@@ -370,7 +370,7 @@ TEST_F(FieldPathUpdateTestCase, testApplyRemoveEntireListField)
doc->setValue("strarray", strArray);
}
//doc->print(std::cerr, true, "");
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(new RemoveFieldPathUpdate("strarray", "")));
docUp.applyTo(*doc);
EXPECT_TRUE(!doc->hasValue("strarray"));
@@ -378,7 +378,7 @@ TEST_F(FieldPathUpdateTestCase, testApplyRemoveEntireListField)
TEST_F(FieldPathUpdateTestCase, testApplyRemoveMultiWset)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::helan:halvan")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:helan:halvan")));
EXPECT_TRUE(doc->hasValue("strwset") == false);
{
WeightedSetFieldValue strWset(doc->getType().getField("strwset").getDataType());
@@ -388,7 +388,7 @@ TEST_F(FieldPathUpdateTestCase, testApplyRemoveMultiWset)
}
EXPECT_TRUE(doc->hasValue("strwset"));
//doc->print(std::cerr, true, "");
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(new RemoveFieldPathUpdate("strwset{remove val 1}")));
docUp.applyTo(*doc);
{
@@ -400,17 +400,17 @@ TEST_F(FieldPathUpdateTestCase, testApplyRemoveMultiWset)
TEST_F(FieldPathUpdateTestCase, testApplyAssignSingle)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::drekka:karsk")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:drekka:karsk")));
EXPECT_TRUE(doc->hasValue("strfoo") == false);
// Test assignment of non-existing
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(
new AssignFieldPathUpdate(*doc->getDataType(), "strfoo", std::string(), StringFieldValue("himert"))));
docUp.applyTo(*doc);
EXPECT_TRUE(doc->hasValue("strfoo"));
EXPECT_EQ(vespalib::string("himert"), doc->getValue("strfoo")->getAsString());
// Test overwriting existing
- DocumentUpdate docUp2(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp2(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp2.addFieldPathUpdate(FieldPathUpdate::CP(
new AssignFieldPathUpdate(*doc->getDataType(), "strfoo", std::string(), StringFieldValue("wunderbaum"))));
docUp2.applyTo(*doc);
@@ -419,10 +419,10 @@ TEST_F(FieldPathUpdateTestCase, testApplyAssignSingle)
TEST_F(FieldPathUpdateTestCase, testApplyAssignMath)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::bat:man")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:bat:man")));
doc->setValue("num", IntFieldValue(34));
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(new AssignFieldPathUpdate("num", "", "($value * 2) / $value")));
docUp.applyTo(*doc);
EXPECT_EQ(static_cast<const FieldValue&>(IntFieldValue(2)), *doc->getValue("num"));
@@ -430,10 +430,10 @@ TEST_F(FieldPathUpdateTestCase, testApplyAssignMath)
TEST_F(FieldPathUpdateTestCase, testApplyAssignMathByteToZero)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::bat:man")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:bat:man")));
doc->setValue("byteval", ByteFieldValue(3));
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(new AssignFieldPathUpdate("byteval", "", "$value - 3")));
docUp.applyTo(*doc);
EXPECT_EQ(static_cast<const FieldValue&>(ByteFieldValue(0)), *doc->getValue("byteval"));
@@ -442,10 +442,10 @@ TEST_F(FieldPathUpdateTestCase, testApplyAssignMathByteToZero)
TEST_F(FieldPathUpdateTestCase, testApplyAssignMathNotModifiedOnUnderflow)
{
int low_value = -126;
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::bat:man")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:bat:man")));
doc->setValue("byteval", ByteFieldValue(low_value));
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(new AssignFieldPathUpdate("byteval", "", "$value - 4")));
docUp.applyTo(*doc);
// Over/underflow will happen. You must have control of your data types.
@@ -454,10 +454,10 @@ TEST_F(FieldPathUpdateTestCase, testApplyAssignMathNotModifiedOnUnderflow)
TEST_F(FieldPathUpdateTestCase, testApplyAssignMathNotModifiedOnOverflow)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::bat:man")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:bat:man")));
doc->setValue("byteval", ByteFieldValue(127));
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(new AssignFieldPathUpdate("byteval", "", "$value + 200")));
docUp.applyTo(*doc);
// Over/underflow will happen. You must have control of your data types.
@@ -466,11 +466,11 @@ TEST_F(FieldPathUpdateTestCase, testApplyAssignMathNotModifiedOnOverflow)
TEST_F(FieldPathUpdateTestCase, testApplyAssignMathDivZero)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::bat:man")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:bat:man")));
EXPECT_TRUE(doc->hasValue("num") == false);
doc->setValue("num", IntFieldValue(10));
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(new AssignFieldPathUpdate("num", "", "$value / ($value - 10)")));
docUp.applyTo(*doc);
EXPECT_EQ(static_cast<const FieldValue&>(IntFieldValue(10)), *doc->getValue("num"));
@@ -478,12 +478,12 @@ TEST_F(FieldPathUpdateTestCase, testApplyAssignMathDivZero)
TEST_F(FieldPathUpdateTestCase, testApplyAssignFieldNotExistingInExpression)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::bat:man")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:bat:man")));
doc->setRepo(*_repo);
EXPECT_TRUE(doc->hasValue("num") == false);
doc->setValue("num", IntFieldValue(10));
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(new AssignFieldPathUpdate("num", "", "foobar.num2 + $value")));
docUp.applyTo(*doc);
EXPECT_EQ(static_cast<const FieldValue&>(IntFieldValue(10)), *doc->getValue("num"));
@@ -491,10 +491,10 @@ TEST_F(FieldPathUpdateTestCase, testApplyAssignFieldNotExistingInExpression)
TEST_F(FieldPathUpdateTestCase, testApplyAssignFieldNotExistingInPath)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::bat:man")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:bat:man")));
doc->setRepo(*_repo);
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
try {
docUp.addFieldPathUpdate(FieldPathUpdate::CP(new AssignFieldPathUpdate("nosuchnum", "", "foobar.num + $value")));
docUp.applyTo(*doc);
@@ -505,10 +505,10 @@ TEST_F(FieldPathUpdateTestCase, testApplyAssignFieldNotExistingInPath)
TEST_F(FieldPathUpdateTestCase, testApplyAssignTargetNotExisting)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::bat:man")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:bat:man")));
EXPECT_TRUE(doc->hasValue("num") == false);
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(new AssignFieldPathUpdate("num", "", "$value + 5")));
docUp.applyTo(*doc);
EXPECT_EQ(static_cast<const FieldValue&>(IntFieldValue(5)), *doc->getValue("num"));
@@ -516,7 +516,7 @@ TEST_F(FieldPathUpdateTestCase, testApplyAssignTargetNotExisting)
TEST_F(FieldPathUpdateTestCase, testAssignSimpleMapValueWithVariable)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::bug:hunter")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:bug:hunter")));
doc->setRepo(*_repo);
MapFieldValue mfv(doc->getType().getField("strmap").getDataType());
@@ -524,7 +524,7 @@ TEST_F(FieldPathUpdateTestCase, testAssignSimpleMapValueWithVariable)
mfv.put(StringFieldValue("baz"), StringFieldValue("bananas"));
doc->setValue("strmap", mfv);
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
// Select on value, not key
docUp.addFieldPathUpdate(FieldPathUpdate::CP(
new AssignFieldPathUpdate(*doc->getDataType(),
@@ -544,12 +544,12 @@ TEST_F(FieldPathUpdateTestCase, testAssignSimpleMapValueWithVariable)
TEST_F(FieldPathUpdateTestCase, testApplyAssignMathRemoveIfZero)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::bat:man")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:bat:man")));
EXPECT_TRUE(doc->hasValue("num") == false);
doc->setValue("num", IntFieldValue(34));
EXPECT_TRUE(doc->hasValue("num") == true);
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
FieldPathUpdate::CP up1(new AssignFieldPathUpdate("num", "", "($value * 2) / $value - 2"));
static_cast<AssignFieldPathUpdate&>(*up1).setRemoveIfZero(true);
docUp.addFieldPathUpdate(up1);
@@ -560,7 +560,7 @@ TEST_F(FieldPathUpdateTestCase, testApplyAssignMathRemoveIfZero)
TEST_F(FieldPathUpdateTestCase, testApplyAssignMultiList)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::fest:skinnvest")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:fest:skinnvest")));
EXPECT_TRUE(doc->hasValue("strarray") == false);
{
@@ -575,7 +575,7 @@ TEST_F(FieldPathUpdateTestCase, testApplyAssignMultiList)
updateArray.add(StringFieldValue("assigned val 0"));
updateArray.add(StringFieldValue("assigned val 1"));
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(
new AssignFieldPathUpdate(*doc->getDataType(), "strarray", std::string(), updateArray)));
docUp.applyTo(*doc);
@@ -591,7 +591,7 @@ TEST_F(FieldPathUpdateTestCase, testApplyAssignMultiList)
TEST_F(FieldPathUpdateTestCase, testApplyAssignMultiWset)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::fest:skinnvest")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:fest:skinnvest")));
EXPECT_TRUE(doc->hasValue("strarray") == false);
{
@@ -606,7 +606,7 @@ TEST_F(FieldPathUpdateTestCase, testApplyAssignMultiWset)
assignWset.add(StringFieldValue("assigned val 0"), 5);
assignWset.add(StringFieldValue("assigned val 1"), 10);
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(
new AssignFieldPathUpdate(*doc->getDataType(), "strwset", std::string(), assignWset)));
//doc->print(std::cerr, true, "");
@@ -622,7 +622,7 @@ TEST_F(FieldPathUpdateTestCase, testApplyAssignMultiWset)
TEST_F(FieldPathUpdateTestCase, testAssignWsetRemoveIfZero)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::tronder:bataljon")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:tronder:bataljon")));
EXPECT_TRUE(doc->hasValue("strarray") == false);
{
@@ -634,7 +634,7 @@ TEST_F(FieldPathUpdateTestCase, testAssignWsetRemoveIfZero)
}
{
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
IntFieldValue zeroWeight(0);
FieldPathUpdate::CP assignUpdate(
new AssignFieldPathUpdate(*doc->getDataType(), "strwset{you say goodbye}", std::string(), zeroWeight));
@@ -653,7 +653,7 @@ TEST_F(FieldPathUpdateTestCase, testAssignWsetRemoveIfZero)
TEST_F(FieldPathUpdateTestCase, testApplyAddMultiList)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::george:costanza")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:george:costanza")));
EXPECT_TRUE(doc->hasValue("strarray") == false);
ArrayFieldValue adds(doc->getType().getField("strarray").getDataType());
@@ -661,7 +661,7 @@ TEST_F(FieldPathUpdateTestCase, testApplyAddMultiList)
adds.add(StringFieldValue("a festivus for the rest of us"));
adds.add(StringFieldValue("george is getting upset!"));
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(
new AddFieldPathUpdate(*doc->getDataType(), "strarray", std::string(), adds)));
//doc->print(std::cerr, true, "");
@@ -672,7 +672,7 @@ TEST_F(FieldPathUpdateTestCase, testApplyAddMultiList)
TEST_F(FieldPathUpdateTestCase, testAddAndAssignList)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::fancy:pants")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:fancy:pants")));
EXPECT_TRUE(doc->hasValue("strarray") == false);
{
@@ -683,7 +683,7 @@ TEST_F(FieldPathUpdateTestCase, testAddAndAssignList)
EXPECT_TRUE(doc->hasValue("strarray"));
}
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(
new AssignFieldPathUpdate(*doc->getDataType(),
"strarray[1]", std::string(), StringFieldValue("assigned val 1"))));
@@ -730,9 +730,9 @@ struct Fixture {
Fixture(const DocumentType &doc_type, const Keys &k);
};
-Fixture::~Fixture() = default;
+Fixture::~Fixture() { }
Fixture::Fixture(const DocumentType &doc_type, const Keys &k)
- : doc(new Document(doc_type, DocumentId("id:ns:" + doc_type.getName() + "::planet:express"))),
+ : doc(new Document(doc_type, DocumentId("doc:planet:express"))),
mfv(getMapType(doc_type)),
fv1(getMapType(doc_type).getValueType()),
fv2(getMapType(doc_type).getValueType()),
@@ -764,7 +764,7 @@ TEST_F(FieldPathUpdateTestCase, testAssignMap)
Keys k;
Fixture f(_foobar_type, k);
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(
new AssignFieldPathUpdate(*f.doc->getDataType(), "structmap{" + k.key2 + "}", std::string(), f.fv4)));
docUp.applyTo(*f.doc);
@@ -784,7 +784,7 @@ TEST_F(FieldPathUpdateTestCase, testAssignMapStruct)
Keys k;
Fixture f(_foobar_type, k);
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(
new AssignFieldPathUpdate(*f.doc->getDataType(), "structmap{" + k.key2 + "}.rating",
std::string(), IntFieldValue(48))));
@@ -805,7 +805,7 @@ TEST_F(FieldPathUpdateTestCase, testAssignMapStructVariable)
Keys k;
Fixture f(_foobar_type, k);
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(
new AssignFieldPathUpdate(*f.doc->getDataType(), "structmap{$x}.rating",
"foobar.structmap{$x}.title == \"farnsworth\"", IntFieldValue(48))));
@@ -824,14 +824,14 @@ TEST_F(FieldPathUpdateTestCase, testAssignMapStructVariable)
TEST_F(FieldPathUpdateTestCase, testAssignMapNoExist)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::planet:express")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:planet:express")));
MapFieldValue mfv(doc->getType().getField("structmap").getDataType());
StructFieldValue fv1(dynamic_cast<const MapDataType&>(*mfv.getDataType()).getValueType());
fv1.setValue("title", StringFieldValue("fry"));
fv1.setValue("rating", IntFieldValue(30));
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(
new AssignFieldPathUpdate(*doc->getDataType(), "structmap{foo}", std::string(), fv1)));
//doc->print(std::cerr, true, "");
@@ -846,14 +846,14 @@ TEST_F(FieldPathUpdateTestCase, testAssignMapNoExist)
TEST_F(FieldPathUpdateTestCase, testAssignMapNoExistNoCreate)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::planet:express")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:planet:express")));
MapFieldValue mfv(doc->getType().getField("structmap").getDataType());
StructFieldValue fv1(dynamic_cast<const MapDataType&>(*mfv.getDataType()).getValueType());
fv1.setValue("title", StringFieldValue("fry"));
fv1.setValue("rating", IntFieldValue(30));
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
FieldPathUpdate::CP assignUpdate(
new AssignFieldPathUpdate(*doc->getDataType(), "structmap{foo}", std::string(), fv1));
static_cast<AssignFieldPathUpdate&>(*assignUpdate).setCreateMissingPath(false);
@@ -874,7 +874,7 @@ TEST_F(FieldPathUpdateTestCase, testQuotedStringKey)
const char field_path[] = "structmap{\"here is a \\\"fancy\\\" 'map' :-} key :-{\"}";
Fixture f(_foobar_type, k);
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(
new AssignFieldPathUpdate(*f.doc->getDataType(), field_path, std::string(), f.fv4)));
docUp.applyTo(*f.doc);
@@ -891,7 +891,7 @@ TEST_F(FieldPathUpdateTestCase, testQuotedStringKey)
TEST_F(FieldPathUpdateTestCase, testEqualityComparison)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::foo:zoo")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:foo:zoo")));
MapFieldValue mfv(doc->getType().getField("structmap").getDataType());
StructFieldValue fv4(dynamic_cast<const MapDataType&>(*mfv.getDataType()).getValueType());
@@ -899,8 +899,8 @@ TEST_F(FieldPathUpdateTestCase, testEqualityComparison)
fv4.setValue("rating", IntFieldValue(95));
{
- DocumentUpdate docUp1(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
- DocumentUpdate docUp2(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp1(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
+ DocumentUpdate docUp2(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
EXPECT_TRUE(docUp1 == docUp2);
FieldPathUpdate::CP assignUp1(new AssignFieldPathUpdate(*doc->getDataType(),
@@ -911,8 +911,8 @@ TEST_F(FieldPathUpdateTestCase, testEqualityComparison)
EXPECT_TRUE(docUp1 == docUp2);
}
{
- DocumentUpdate docUp1(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
- DocumentUpdate docUp2(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp1(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
+ DocumentUpdate docUp2(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
// where-clause diff
FieldPathUpdate::CP assignUp1(new AssignFieldPathUpdate(*doc->getDataType(),
"structmap{here be dragons}", std::string(), fv4));
@@ -923,8 +923,8 @@ TEST_F(FieldPathUpdateTestCase, testEqualityComparison)
EXPECT_TRUE(docUp1 != docUp2);
}
{
- DocumentUpdate docUp1(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
- DocumentUpdate docUp2(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp1(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
+ DocumentUpdate docUp2(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
// fieldpath diff
FieldPathUpdate::CP assignUp1(new AssignFieldPathUpdate(*doc->getDataType(),
"structmap{here be dragons}", std::string(), fv4));
@@ -939,7 +939,7 @@ TEST_F(FieldPathUpdateTestCase, testEqualityComparison)
TEST_F(FieldPathUpdateTestCase, testAffectsDocumentBody)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::things:stuff")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:things:stuff")));
MapFieldValue mfv(doc->getType().getField("structmap").getDataType());
StructFieldValue fv4(dynamic_cast<const MapDataType&>(*mfv.getDataType()).getValueType());
@@ -948,7 +948,7 @@ TEST_F(FieldPathUpdateTestCase, testAffectsDocumentBody)
// structmap is body field
{
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
FieldPathUpdate::CP update1(new AssignFieldPathUpdate(*doc->getDataType(),
"structmap{janitor}", std::string(), fv4));
@@ -958,7 +958,7 @@ TEST_F(FieldPathUpdateTestCase, testAffectsDocumentBody)
// strfoo is header field
{
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
FieldPathUpdate::CP update1(new AssignFieldPathUpdate(*doc->getDataType(),
"strfoo", std::string(), StringFieldValue("helloworld")));
static_cast<AssignFieldPathUpdate&>(*update1).setCreateMissingPath(true);
@@ -969,10 +969,10 @@ TEST_F(FieldPathUpdateTestCase, testAffectsDocumentBody)
TEST_F(FieldPathUpdateTestCase, testIncompatibleDataTypeFails)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::things:stuff")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:things:stuff")));
MapFieldValue mfv(doc->getType().getField("structmap").getDataType());
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
try {
FieldPathUpdate::CP update1(new AssignFieldPathUpdate(*doc->getDataType(), "structmap{foo}",
@@ -985,14 +985,14 @@ TEST_F(FieldPathUpdateTestCase, testIncompatibleDataTypeFails)
TEST_F(FieldPathUpdateTestCase, testSerializeAssign)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::weloveto:serializestuff")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:weloveto:serializestuff")));
MapFieldValue mfv(doc->getType().getField("structmap").getDataType());
StructFieldValue val(dynamic_cast<const MapDataType&>(*mfv.getDataType()).getValueType());
val.setValue("title", StringFieldValue("cool frog"));
val.setValue("rating", IntFieldValue(100));
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
FieldPathUpdate::CP update1(new AssignFieldPathUpdate(*doc->getDataType(), "structmap{ribbit}", "true", val));
static_cast<AssignFieldPathUpdate&>(*update1).setCreateMissingPath(true);
@@ -1003,7 +1003,7 @@ TEST_F(FieldPathUpdateTestCase, testSerializeAssign)
TEST_F(FieldPathUpdateTestCase, testSerializeAdd)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::george:costanza")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:george:costanza")));
EXPECT_TRUE(doc->hasValue("strarray") == false);
ArrayFieldValue adds(doc->getType().getField("strarray").getDataType());
@@ -1011,7 +1011,7 @@ TEST_F(FieldPathUpdateTestCase, testSerializeAdd)
adds.add(StringFieldValue("a festivus for the rest of us"));
adds.add(StringFieldValue("george is getting upset!"));
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
FieldPathUpdate::CP update1(new AddFieldPathUpdate(*doc->getDataType(), "strarray", std::string(), adds));
docUp.addFieldPathUpdate(update1);
@@ -1021,10 +1021,10 @@ TEST_F(FieldPathUpdateTestCase, testSerializeAdd)
TEST_F(FieldPathUpdateTestCase, testSerializeRemove)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::weloveto:serializestuff")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:weloveto:serializestuff")));
MapFieldValue mfv(doc->getType().getField("structmap").getDataType());
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
FieldPathUpdate::CP update1(new RemoveFieldPathUpdate("structmap{ribbit}", std::string()));
docUp.addFieldPathUpdate(update1);
@@ -1034,11 +1034,11 @@ TEST_F(FieldPathUpdateTestCase, testSerializeRemove)
TEST_F(FieldPathUpdateTestCase, testSerializeAssignMath)
{
- Document::UP doc(new Document(_foobar_type, DocumentId("id:ns:foobar::bat:man")));
+ Document::UP doc(new Document(_foobar_type, DocumentId("doc:bat:man")));
EXPECT_TRUE(doc->hasValue("num") == false);
doc->setValue("num", IntFieldValue(34));
- DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("id:ns:foobar::barbar:foofoo"));
+ DocumentUpdate docUp(*_repo, _foobar_type, DocumentId("doc:barbar:foofoo"));
docUp.addFieldPathUpdate(FieldPathUpdate::CP(new AssignFieldPathUpdate("num", "", "($value * 2) / $value")));
testSerialize(*_repo, docUp);
}
@@ -1047,7 +1047,7 @@ DocumentUpdate::UP
FieldPathUpdateTestCase::createDocumentUpdateForSerialization(const DocumentTypeRepo& repo)
{
const DocumentType *docType(repo.getDocumentType("serializetest"));
- DocumentUpdate::UP docUp(new DocumentUpdate(repo, *docType, DocumentId("id:ns:serializetest::xlanguage")));
+ DocumentUpdate::UP docUp(new DocumentUpdate(repo, *docType, DocumentId("doc:serialization:xlanguage")));
FieldPathUpdate::CP assign(new AssignFieldPathUpdate("intfield", "", "3"));
static_cast<AssignFieldPathUpdate&>(*assign).setRemoveIfZero(true);
diff --git a/document/src/tests/fieldsettest.cpp b/document/src/tests/fieldsettest.cpp
index b0cad61b72a..0297e7bdda4 100644
--- a/document/src/tests/fieldsettest.cpp
+++ b/document/src/tests/fieldsettest.cpp
@@ -169,7 +169,7 @@ FieldSetTest::doCopyFields(const Document& src,
const std::string& fieldSetStr,
Document* dest) const
{
- Document destDoc(src.getType(), DocumentId("id:ns:" + src.getType().getName() + "::fieldset"));
+ Document destDoc(src.getType(), DocumentId("doc:test:fieldsdest"));
if (!dest) {
dest = &destDoc;
}
@@ -195,7 +195,7 @@ Document::UP
FieldSetTest::createTestDocument(const TestDocMan& testDocMan) const
{
Document::UP doc(testDocMan.createDocument("megafoo megabar",
- "id:ns:testdoctype1::1",
+ "doc:test:fieldssrc",
"testdoctype1"));
doc->setValue(doc->getField("headerval"), IntFieldValue(5678));
doc->setValue(doc->getField("hstringval"),
@@ -225,7 +225,7 @@ TEST_F(FieldSetTest, testCopyDocumentFields)
doCopyFields(*src, repo, "testdoctype1:hstringval,content"));
// Test that we overwrite already set fields in destination document
{
- Document dest(src->getType(), DocumentId("id:ns:" + src->getType().getName() + "::bar"));
+ Document dest(src->getType(), DocumentId("doc:foo:bar"));
dest.setValue(dest.getField("content"), StringFieldValue("overwriteme"));
EXPECT_EQ(std::string("content: megafoo megabar\n"),
doCopyFields(*src, repo, "[body]", &dest));
diff --git a/document/src/tests/fieldvalue/referencefieldvalue_test.cpp b/document/src/tests/fieldvalue/referencefieldvalue_test.cpp
index 17fb5ac74e6..d34bbff8a54 100644
--- a/document/src/tests/fieldvalue/referencefieldvalue_test.cpp
+++ b/document/src/tests/fieldvalue/referencefieldvalue_test.cpp
@@ -23,8 +23,8 @@ struct Fixture {
~Fixture();
};
- Fixture::Fixture() = default;
- Fixture::~Fixture() = default;
+ Fixture::Fixture() { }
+ Fixture::~Fixture() { }
}
using vespalib::IllegalArgumentException;
@@ -60,6 +60,17 @@ TEST_F("Exception is thrown if constructor doc ID type does not match referenced
"to reference of document type 'foo'");
}
+TEST_F("Exception is thrown if doc ID does not have a type", Fixture) {
+ // Could have had a special cased message for this, but type-less IDs are
+ // not expected to be allowed through the feed pipeline at all. We just
+ // want to ensure it fails in a controlled fashion if encountered.
+ EXPECT_EXCEPTION(
+ ReferenceFieldValue(f.refType, DocumentId("doc:foo:bario")),
+ IllegalArgumentException,
+ "Can't assign document ID 'doc:foo:bario' (of type '') "
+ "to reference of document type 'foo'");
+}
+
TEST_F("assign()ing a non-reference field value throws exception", Fixture) {
ReferenceFieldValue fv(f.refType);
EXPECT_EXCEPTION(fv.assign(StringFieldValue("waluigi time!!")),
diff --git a/document/src/tests/globalidtest.cpp b/document/src/tests/globalidtest.cpp
index f612b9e341c..ab2af875e9f 100644
--- a/document/src/tests/globalidtest.cpp
+++ b/document/src/tests/globalidtest.cpp
@@ -88,9 +88,9 @@ TEST_F(GlobalIdTest, testBucketIdConversion)
verifyDocumentId("id:ns:test:n=1000:abc");
verifyDocumentId("id:hsgf:test:n=18446744073700000000:dfdfsdfg");
verifyDocumentId("id:ns:mytype:g=somegroup:hmm");
- verifyDocumentId("id:ns:test::");
- verifyDocumentId("id:myns:test::http://foo.bar");
- verifyDocumentId("id:ns:test::jsrthsdf:a234aleingzldkifvasdfgadf");
+ verifyDocumentId("doc::test");
+ verifyDocumentId("doc:myns:http://foo.bar");
+ verifyDocumentId("doc:jsrthsdf:a234aleingzldkifvasdfgadf");
}
void
@@ -155,7 +155,7 @@ TEST_F(GlobalIdTest, testGidRangeConversion)
}
uint32_t scheme = randomizer.nextUint32(0, 2);
switch (scheme) {
- case 0: ost << "id:" << name_space.str() << ":mytype::";
+ case 0: ost << "doc:" << name_space.str() << ":";
break;
case 1: ost << "id:" << name_space.str() << ":mytype:n=";
ost << randomizer.nextUint32() << ":";
diff --git a/document/src/tests/serialization/vespadocumentserializer_test.cpp b/document/src/tests/serialization/vespadocumentserializer_test.cpp
index 98a03b0ac89..b83c59fdaec 100644
--- a/document/src/tests/serialization/vespadocumentserializer_test.cpp
+++ b/document/src/tests/serialization/vespadocumentserializer_test.cpp
@@ -33,9 +33,11 @@
#include <vespa/document/repo/configbuilder.h>
#include <vespa/document/repo/fixedtyperepo.h>
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/serialization/util.h>
#include <vespa/document/serialization/vespadocumentdeserializer.h>
#include <vespa/document/serialization/vespadocumentserializer.h>
#include <vespa/document/serialization/annotationserializer.h>
+#include <vespa/eval/tensor/types.h>
#include <vespa/eval/tensor/tensor.h>
#include <vespa/eval/tensor/default_tensor_engine.h>
#include <vespa/vespalib/io/fileutil.h>
@@ -61,12 +63,12 @@ using namespace document::config_builder;
namespace {
const int doc_type_id = 1234;
-const string doc_name = "my_doctype";
+const string doc_name = "my document";
const int body_id = 94;
const int inner_type_id = 95;
const int outer_type_id = 96;
-const string type_name = "outer_doc";
-const string inner_name = "inner_doc";
+const string type_name = "outer doc";
+const string inner_name = "inner doc";
const int a_id = 12345;
const string a_name = "annotation";
const int predicate_doc_type_id = 321;
@@ -81,9 +83,9 @@ constexpr uint16_t serialization_version = Document::getNewestSerializationVersi
DocumenttypesConfig getDocTypesConfig() {
DocumenttypesConfigBuilderHelper builder;
builder.document(doc_type_id, doc_name,
- Struct(doc_name + ".header")
+ Struct("my document.header")
.addField("header field", DataType::T_INT),
- Struct(doc_name + ".body")
+ Struct("my document.body")
.addField("body field", DataType::T_STRING))
.annotationType(42, "foo_type", DataType::T_INT);
builder.document(inner_type_id, inner_name,
@@ -574,7 +576,7 @@ template <typename T, int N> int arraysize(const T (&)[N]) { return N; }
TEST("requireThatDocumentCanBeSerialized") {
const DocumentType &type = repo.getDocumentType();
- DocumentId doc_id("id:ns:" + type.getName() + "::");
+ DocumentId doc_id("doc::testdoc");
Document value(type, doc_id);
value.setValue(type.getField("header field"), IntFieldValue(42));
@@ -587,7 +589,7 @@ TEST("requireThatDocumentCanBeSerialized") {
uint32_t size;
stream >> read_version >> size;
EXPECT_EQUAL(serialization_version, read_version);
- EXPECT_EQUAL(70u, size);
+ EXPECT_EQUAL(65u, size);
EXPECT_EQUAL(doc_id.getScheme().toString(), stream.peek());
stream.adjustReadPos(doc_id.getScheme().toString().size() + 1);
uint8_t content_code;
@@ -602,7 +604,7 @@ TEST("requireThatDocumentCanBeSerialized") {
TEST("requireThatOldVersionDocumentCanBeDeserialized") {
uint16_t old_version = 6;
uint16_t data_size = 432;
- string doc_id = "id:ns:my_doctype::";
+ string doc_id = "doc::testdoc";
uint8_t content_code = 0x01;
uint32_t crc = 42;
@@ -626,19 +628,19 @@ TEST("requireThatUnmodifiedDocumentRetainsUnknownFieldOnSerialization") {
DocumenttypesConfigBuilderHelper builder1, builder2;
builder1.document(doc_type_id, doc_name,
- Struct("my_doctype.header")
+ Struct("my document.header")
.addField("field2", DataType::T_STRING),
- Struct("my_doctype.body"));
+ Struct("my document.body"));
builder2.document(doc_type_id, doc_name,
- Struct("my_doctype.header")
+ Struct("my document.header")
.addField("field1", DataType::T_INT)
.addField("field2", DataType::T_STRING),
- Struct("my_doctype.body"));
+ Struct("my document.body"));
DocumentTypeRepo repo1Field(builder1.config());
DocumentTypeRepo repo2Fields(builder2.config());
- DocumentId doc_id("id:ns:my_doctype::");
+ DocumentId doc_id("doc::testdoc");
Document value(*repo2Fields.getDocumentType(doc_type_id), doc_id);
value.setValue("field1", IntFieldValue(42));
@@ -682,20 +684,21 @@ TEST("requireThatDocumentWithDocumentCanBeSerialized") {
const DocumentTypeRepo &my_repo = repo.getDocumentTypeRepo();
const DocumentType *inner_type = my_repo.getDocumentType(inner_type_id);
ASSERT_TRUE(inner_type);
- const AnnotationType *a_type =my_repo.getAnnotationType(*inner_type, a_id);
+ const AnnotationType *a_type =
+ my_repo.getAnnotationType(*inner_type, a_id);
StringFieldValue str("foo");
- auto tree = std::make_unique<SpanTree>("name", std::make_unique<Span>(0, 3));
- tree->annotate(std::make_unique<Annotation>(*a_type));
+ SpanTree::UP tree(new SpanTree("name", Span::UP(new Span(0, 3))));
+ tree->annotate(Annotation::UP(new Annotation(*a_type)));
setSpanTree(str, *tree);
const Field str_field("str", *DataType::STRING, false);
- Document inner(*inner_type, DocumentId("id:ns:" + inner_type->getName() + "::"));
+ Document inner(*inner_type, DocumentId("doc::in"));
inner.setValue(str_field, str);
const DocumentType *type = my_repo.getDocumentType(outer_type_id);
ASSERT_TRUE(type);
- DocumentId doc_id("id:ns:" + type->getName() + "::");
+ DocumentId doc_id("doc::testdoc");
Document value(*type, doc_id);
const Field doc_field(inner_name, *inner_type, false);
value.setValue(doc_field, inner);
@@ -1037,7 +1040,8 @@ TEST_F("Empty ReferenceFieldValue can be roundtrip serialized", RefFixture) {
}
TEST_F("ReferenceFieldValue with ID can be roundtrip serialized", RefFixture) {
- ReferenceFieldValue ref_with_id(f.ref_type(), DocumentId("id:ns:" + doc_name + "::foo"));
+ ReferenceFieldValue ref_with_id(
+ f.ref_type(), DocumentId("id:ns:" + doc_name + "::foo"));
nbostream stream;
serializeAndDeserialize(ref_with_id, stream, f.fixed_repo);
}
@@ -1051,7 +1055,8 @@ TEST_F("Empty ReferenceFieldValue has changed-flag cleared after deserialization
}
TEST_F("ReferenceFieldValue with ID has changed-flag cleared after deserialization", RefFixture) {
- ReferenceFieldValue src(f.ref_type(), DocumentId("id:ns:" + doc_name + "::foo"));
+ ReferenceFieldValue src(
+ f.ref_type(), DocumentId("id:ns:" + doc_name + "::foo"));
ReferenceFieldValue dest(f.ref_type());
f.roundtrip_serialize(src, dest);
@@ -1064,13 +1069,14 @@ TEST_F("Empty ReferenceFieldValue serialization matches Java", RefFixture) {
}
TEST_F("ReferenceFieldValue with ID serialization matches Java", RefFixture) {
- ReferenceFieldValue value(f.ref_type(), DocumentId("id:ns:" + doc_name + "::bar"));
+ ReferenceFieldValue value(
+ f.ref_type(), DocumentId("id:ns:" + doc_name + "::bar"));
f.verify_cross_language_serialization("reference_with_id", value);
}
struct AssociatedDocumentRepoFixture {
const DocumentType& doc_type{repo.getDocumentType()};
- DocumentId doc_id{"id:ns:" + doc_type.getName() + "::"};
+ DocumentId doc_id{"doc::testdoc"};
Document source_doc{doc_type, doc_id};
std::unique_ptr<Document> roundtrip_serialize_source_document() {
diff --git a/document/src/tests/struct_anno/document.dat b/document/src/tests/struct_anno/document.dat
index 2a372d19f10..243b5f05a92 100644
--- a/document/src/tests/struct_anno/document.dat
+++ b/document/src/tests/struct_anno/document.dat
Binary files differ
diff --git a/document/src/tests/testxml.cpp b/document/src/tests/testxml.cpp
index e6c8716b251..cf1c783e582 100644
--- a/document/src/tests/testxml.cpp
+++ b/document/src/tests/testxml.cpp
@@ -24,7 +24,7 @@ Document::UP createTestDocument(const DocumentTypeRepo& repo)
const DocumentType* type(repo.getDocumentType("testdoc"));
Document::UP
doc(new Document(*type,
- DocumentId("id:ns:testdoc::crawler/http://www.ntnu.no/")));
+ DocumentId("doc:crawler/http://www.ntnu.no/")));
doc->setRepo(repo);
std::string s("humlepungens buffer");
ByteBuffer bb(s.c_str(), s.size());
@@ -48,7 +48,7 @@ Document::UP createTestDocument(const DocumentTypeRepo& repo)
doc->setValue(doc->getField("rawarrayattr"), val);
Document::UP doc2(new Document(*type, DocumentId(
- "id:ns:testdoc::crawler/http://www.ntnu.no/2")));
+ "doc:crawler/http://www.ntnu.no/2")));
doc2->setValue(doc2->getField("stringattr"), StringFieldValue("tjo hei paa du"));
doc->setValue(doc->getField("docfield"), *doc2);
@@ -59,7 +59,7 @@ DocumentUpdate::UP
createTestDocumentUpdate(const DocumentTypeRepo& repo)
{
const DocumentType* type(repo.getDocumentType("testdoc"));
- DocumentId id("id:ns:testdoc::crawler/http://www.ntnu.no/");
+ DocumentId id("doc:crawler/http://www.ntnu.no/");
DocumentUpdate::UP up(new DocumentUpdate(repo, *type, id));
up->addUpdate(FieldUpdate(type->getField("intattr"))
@@ -86,7 +86,7 @@ TEST(TestXml, testSimpleUsage)
doc1->setValue(doc1->getField("stringattr"), StringFieldValue("tjohei���"));
std::string expected =
- "<document documenttype=\"testdoc\" documentid=\"id:ns:testdoc::crawler/http://www.ntnu.no/\">\n"
+ "<document documenttype=\"testdoc\" documentid=\"doc:crawler/http://www.ntnu.no/\">\n"
" <doubleattr>17.7862</doubleattr>\n"
" <intattr>50</intattr>\n"
" <floatattr>3.56</floatattr>\n"
@@ -100,7 +100,7 @@ TEST(TestXml, testSimpleUsage)
" <rawattr binaryencoding=\"base64\">cmVhZGFibA==</rawattr>\n"
" <stringattr>tjohei���</stringattr>\n"
" <docfield>\n"
- " <document documenttype=\"testdoc\" documentid=\"id:ns:testdoc::crawler/http://www.ntnu.no/2\">\n"
+ " <document documenttype=\"testdoc\" documentid=\"doc:crawler/http://www.ntnu.no/2\">\n"
" <stringattr>tjo hei paa du</stringattr>\n"
" </document>\n"
" </docfield>\n"
@@ -114,7 +114,7 @@ TEST(TestXml, testDocumentUpdate)
DocumentUpdate::UP up1(createTestDocumentUpdate(repo));
std::string expected =
- "<document type=\"testdoc\" id=\"id:ns:testdoc::crawler/http://www.ntnu.no/\">\n"
+ "<document type=\"testdoc\" id=\"doc:crawler/http://www.ntnu.no/\">\n"
" <alter field=\"intattr\">\n"
" <assign>7</assign>\n"
" </alter>\n"
diff --git a/document/src/tests/vespaxml/fieldpathupdates.xml b/document/src/tests/vespaxml/fieldpathupdates.xml
index 6c9719a86b9..3b81aaf4ba2 100644..100755
--- a/document/src/tests/vespaxml/fieldpathupdates.xml
+++ b/document/src/tests/vespaxml/fieldpathupdates.xml
@@ -1,6 +1,6 @@
<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
<vespafeed>
- <update documenttype="news" documentid="id:ns:news::http://www.ntnu.no/">
+ <update documenttype="news" documentid="doc:test:http://www.ntnu.no/">
<assign fieldpath="url">assignUrl</assign>
<assign fieldpath="title">assignTitle</assign>
<assign fieldpath="last_downloaded">1</assign>
diff --git a/document/src/tests/vespaxml/test1.expected.xml b/document/src/tests/vespaxml/test1.expected.xml
new file mode 100644
index 00000000000..198ed29690d
--- /dev/null
+++ b/document/src/tests/vespaxml/test1.expected.xml
@@ -0,0 +1,5 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<document documenttype="news" documentid="doc:crawler:http://www.ntnu.no/">
+ <title>TestTitle</title>
+ <last_downloaded>100</last_downloaded>
+</document>
diff --git a/document/src/tests/vespaxml/test1.xml b/document/src/tests/vespaxml/test1.xml
new file mode 100644
index 00000000000..1ec09a0b61f
--- /dev/null
+++ b/document/src/tests/vespaxml/test1.xml
@@ -0,0 +1,9 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd idprefix="doc:crawler:">
+ <document documenttype="news" documentid="http://www.ntnu.no/">
+ <title>TestTitle</title>
+ <last_downloaded>100</last_downloaded>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test10.xml b/document/src/tests/vespaxml/test10.xml
new file mode 100644
index 00000000000..832734faf48
--- /dev/null
+++ b/document/src/tests/vespaxml/test10.xml
@@ -0,0 +1,9 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd>
+ <document type="news" id="doc:crawler/http://www.ntnu.no/">
+ <title>Test<Title</title>
+ <last_downloaded>hundred</last_downloaded>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test11.xml b/document/src/tests/vespaxml/test11.xml
new file mode 100644
index 00000000000..10daff34be3
--- /dev/null
+++ b/document/src/tests/vespaxml/test11.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vesparemove>
+ <document type="news" id="doc:crawler/http://www.ntnu���.no/">
+ </document>
+ </vesparemove>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test12.xml b/document/src/tests/vespaxml/test12.xml
new file mode 100644
index 00000000000..3bfd2658404
--- /dev/null
+++ b/document/src/tests/vespaxml/test12.xml
@@ -0,0 +1,9 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd>
+ <document type="news" id="doc:crawler/http://www.ntnu.no/">
+ <title></title>
+ <last_downloaded></last_downloaded>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test13.xml b/document/src/tests/vespaxml/test13.xml
new file mode 100644
index 00000000000..4e55558abc6
--- /dev/null
+++ b/document/src/tests/vespaxml/test13.xml
@@ -0,0 +1,7 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <document type="news" id="doc:crawler:http://www.ntnu.no/">
+ <title>TestTitle</title>
+ <last_downloaded>100</last_downloaded>
+ </document>
+</vespa>
diff --git a/document/src/tests/vespaxml/test14.xml b/document/src/tests/vespaxml/test14.xml
new file mode 100644
index 00000000000..8b345f8c654
--- /dev/null
+++ b/document/src/tests/vespaxml/test14.xml
@@ -0,0 +1,8 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd>
+ <document type="news" id="doc:crawler/http://www.ntnu.no/">
+ <last_downloaded>123</last_downloaded>
+ </doc>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test15.xml b/document/src/tests/vespaxml/test15.xml
new file mode 100644
index 00000000000..32707f1636b
--- /dev/null
+++ b/document/src/tests/vespaxml/test15.xml
@@ -0,0 +1,8 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd>
+ <document type="news" id="doc:crawler/http://www.ntnu.no/">
+ <title>TestTitle</tit>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test16.xml b/document/src/tests/vespaxml/test16.xml
new file mode 100644
index 00000000000..3b3179446e9
--- /dev/null
+++ b/document/src/tests/vespaxml/test16.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd>
+ <documentid type="news" id="doc:crawler:http://www.ntnu.no/">
+ </documentid>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test17.xml b/document/src/tests/vespaxml/test17.xml
new file mode 100644
index 00000000000..aefcc5708e7
--- /dev/null
+++ b/document/src/tests/vespaxml/test17.xml
@@ -0,0 +1,9 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+ <vespaadd>
+ <document type="news" id="doc:crawler/http://www.ntnu.no/1">
+ </document>
+ </vespaadd>
+ <vespaadd>
+ <document type="news" id="doc:crawler/http://www.ntnu.no/2">
+ </document>
+ </vespaadd>
diff --git a/document/src/tests/vespaxml/test18.xml b/document/src/tests/vespaxml/test18.xml
new file mode 100644
index 00000000000..852dd55c134
--- /dev/null
+++ b/document/src/tests/vespaxml/test18.xml
@@ -0,0 +1,9 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd>
+ <document type="article" id="doc:crawler/http://www.ntnu.no/">
+ <title>TestTitle</title>
+ <last_downloaded>100</last_downloaded>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test2.expected.xml b/document/src/tests/vespaxml/test2.expected.xml
new file mode 100644
index 00000000000..198ed29690d
--- /dev/null
+++ b/document/src/tests/vespaxml/test2.expected.xml
@@ -0,0 +1,5 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<document documenttype="news" documentid="doc:crawler:http://www.ntnu.no/">
+ <title>TestTitle</title>
+ <last_downloaded>100</last_downloaded>
+</document>
diff --git a/document/src/tests/vespaxml/test2.xml b/document/src/tests/vespaxml/test2.xml
new file mode 100644
index 00000000000..8194fb1de5e
--- /dev/null
+++ b/document/src/tests/vespaxml/test2.xml
@@ -0,0 +1,7 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <document documenttype="news" documentid="doc:crawler:http://www.ntnu.no/">
+ <title>TestTitle</title>
+ <last_downloaded>100</last_downloaded>
+ </document>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test20.xml b/document/src/tests/vespaxml/test20.xml
new file mode 100644
index 00000000000..ca502100f67
--- /dev/null
+++ b/document/src/tests/vespaxml/test20.xml
@@ -0,0 +1,8 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <endoffeed>
+ <name>default</name>
+ <generations>10</generations>
+ <increment>11</increment>
+ </endoffeed>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test21.xml b/document/src/tests/vespaxml/test21.xml
new file mode 100644
index 00000000000..45ef52a3e67
--- /dev/null
+++ b/document/src/tests/vespaxml/test21.xml
@@ -0,0 +1,9 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd>
+ <document type="news" id="doc:crawler/http://www.ntnu.no/">
+ <title>TestTitle</title>
+ <last_downloaded>21474836480</last_downloaded>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test22.xml b/document/src/tests/vespaxml/test22.xml
new file mode 100644
index 00000000000..c9f5a0af841
--- /dev/null
+++ b/document/src/tests/vespaxml/test22.xml
@@ -0,0 +1,9 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd>
+ <document type="news" id="doc:crawler:http://www.ntnu.no/">
+ <title>TestTitle</title>
+ <value_long>9223372036854775807</value_long>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test23.xml b/document/src/tests/vespaxml/test23.xml
new file mode 100644
index 00000000000..e052c3f2c7f
--- /dev/null
+++ b/document/src/tests/vespaxml/test23.xml
@@ -0,0 +1,9 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd>
+ <document type="news" id="doc:crawler:http://www.ntnu.no/">
+ <title>TestTitle</title>
+ <value_long>-9223372036854775807</value_long>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test24.xml b/document/src/tests/vespaxml/test24.xml
new file mode 100644
index 00000000000..3d36eea7dc8
--- /dev/null
+++ b/document/src/tests/vespaxml/test24.xml
@@ -0,0 +1,9 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd>
+ <document type="news" id="doc:crawler:http://www.ntnu.no/">
+ <title>TestTitle</title>
+ <value_long>18446744073709551615</value_long>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test25.xml b/document/src/tests/vespaxml/test25.xml
new file mode 100644
index 00000000000..9a499195a6b
--- /dev/null
+++ b/document/src/tests/vespaxml/test25.xml
@@ -0,0 +1,9 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd>
+ <document type="news" id="doc:crawler/http://www.ntnu.no/">
+ <title>TestTitle</title>
+ <value_long>18446744073709551616</value_long>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test26.xml b/document/src/tests/vespaxml/test26.xml
new file mode 100644
index 00000000000..2d6ae226c68
--- /dev/null
+++ b/document/src/tests/vespaxml/test26.xml
@@ -0,0 +1,9 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd>
+ <document type="news" id="doc:crawler:http://www.ntnu.no/">
+ <title>TestTitle</title>
+ <last_downloaded>0x123</last_downloaded>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test27.xml b/document/src/tests/vespaxml/test27.xml
new file mode 100644
index 00000000000..f8adb8b11f8
--- /dev/null
+++ b/document/src/tests/vespaxml/test27.xml
@@ -0,0 +1,9 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd>
+ <document type="news" id="doc:crawler/http://www.ntnu.no/">
+ <title>TestTitle</title>
+ <last_downloaded>0x123</last_downloaded>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test28.xml b/document/src/tests/vespaxml/test28.xml
new file mode 100644
index 00000000000..929ba7415d0
--- /dev/null
+++ b/document/src/tests/vespaxml/test28.xml
@@ -0,0 +1,10 @@
+<!-- Test content -->
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd>
+ <document type="news" id="doc:crawler:http://www.ntnu.no/">
+ <title>TestTitleContent</title>
+ <value_content contenttype="text/html" encoding="utf-8" language="en"><![CDATA[<html><body><h1>This is the title</h1></body></html>]]></value_content>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test29.xml b/document/src/tests/vespaxml/test29.xml
new file mode 100644
index 00000000000..1b863e5637e
--- /dev/null
+++ b/document/src/tests/vespaxml/test29.xml
@@ -0,0 +1,18 @@
+<!-- Test field attribute -->
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd>
+ <document type="news">
+ <field name="uri">doc:crawler:http://www.ntnu.no/</field>
+ <field name="title">TestTitleContent</field>
+ <field name="value_content" contenttype="text/html" encoding="UTF-8" language="NO">This is content</field>
+ <last_downloaded>345</last_downloaded>
+ </document>
+ <document type="news">
+ <field name="uri">doc:crawler:http://www.ntnu.no/2</field>
+ <field name="title">TestTitleContent2</field>
+ <field name="value_content">This is content2</field>
+ <last_downloaded>345</last_downloaded>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test3.xml b/document/src/tests/vespaxml/test3.xml
new file mode 100644
index 00000000000..f328115b5ca
--- /dev/null
+++ b/document/src/tests/vespaxml/test3.xml
@@ -0,0 +1,9 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vesparemove idprefix="doc:crawler:">
+ <documentid type="news">
+ <uri>http://www.ntnu.no/</uri>
+ <last_downloaded></last_downloaded>
+ </documentid>
+ </vesparemove>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test30.xml b/document/src/tests/vespaxml/test30.xml
new file mode 100644
index 00000000000..fa24e99cd83
--- /dev/null
+++ b/document/src/tests/vespaxml/test30.xml
@@ -0,0 +1,15 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed xmlns:xsd="http://www.w3.org/2001/XMLSchema-datatypes"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <vespaadd>
+ <document type="news" id="doc:crawler:http://www.ntnu.no/">
+ <title xsi:type="xsd:hexBinary">E5AEB6E59BADE3808220044BE680AC</title>
+ <last_downloaded>100</last_downloaded>
+ </document>
+ <document type="news" id="doc:crawler:http://www.ntnu.org/">
+ <title xsi:type="xsd:base64Binary">5a625Zut44CCIARL5oCs</title>
+ <last_downloaded>100</last_downloaded>
+ </document>
+ </vespaadd>
+</vespafeed>
+
diff --git a/document/src/tests/vespaxml/test32.xml b/document/src/tests/vespaxml/test32.xml
new file mode 100644
index 00000000000..53993f57d19
--- /dev/null
+++ b/document/src/tests/vespaxml/test32.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vesparemove>
+ <documentid id="doc:crawler:http://www.ntnu���.no/"/>
+ </vesparemove>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test33.xml b/document/src/tests/vespaxml/test33.xml
new file mode 100644
index 00000000000..d63c059aa6e
--- /dev/null
+++ b/document/src/tests/vespaxml/test33.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vesparemove>
+ <documentid>
+ <uri>http://www.ntnu.no/</uri>
+ </documentid>
+ </vesparemove>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test34.xml b/document/src/tests/vespaxml/test34.xml
new file mode 100644
index 00000000000..384c7ae8111
--- /dev/null
+++ b/document/src/tests/vespaxml/test34.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vesparemove>
+ <documentid id="http://www.ntnu.no/"/>
+ </vesparemove>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test35.xml b/document/src/tests/vespaxml/test35.xml
new file mode 100644
index 00000000000..e69f032ef49
--- /dev/null
+++ b/document/src/tests/vespaxml/test35.xml
@@ -0,0 +1,9 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd>
+ <document type="news" id="doc:crawler:http://www.ntnu.no/">
+ <title binaryencoding="base64">VmVzcGEgcnVsZXM=</title>
+ <last_downloaded>100</last_downloaded>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test36.xml b/document/src/tests/vespaxml/test36.xml
new file mode 100644
index 00000000000..bfd4547b6c8
--- /dev/null
+++ b/document/src/tests/vespaxml/test36.xml
@@ -0,0 +1,43 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd idprefix="doc:crawler:">
+ <document type="news" id="http://www.ntnu.no/1">
+ <title>TestTitle1</title>
+ <last_downloaded>100</last_downloaded>
+ <stringarr>
+ <item>one</item>
+ <item>two</item>
+ <item>three</item>
+ <item>four</item>
+ <item>five</item>
+ </stringarr>
+ <intarr>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ <item>5</item>
+ </intarr>
+ </document>
+ <document type="news" id="http://www.ntnu.no/2">
+ <title>TestTitle2</title>
+ <intarr>
+ <item>o1</item>
+ </intarr>
+ </document>
+ <document type="news" id="http://www.ntnu.no/3">
+ <title>TestTitle3</title>
+ <intarr>
+ <tem>1</tem>
+ </intarr>
+ </document>
+ <document type="news" id="http://www.ntnu.no/4">
+ <title>TestTitle4</title>
+ <intarr></intarr>
+ </document>
+ <document type="news" id="http://www.ntnu.no/5">
+ <title>TestTitle5</title>
+ <intarr>1</intarr>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test37.xml b/document/src/tests/vespaxml/test37.xml
new file mode 100644
index 00000000000..8993dd99640
--- /dev/null
+++ b/document/src/tests/vespaxml/test37.xml
@@ -0,0 +1,23 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd idprefix="doc:crawler:">
+ <document type="news" id="http://www.ntnu.no/1">
+ <title>TestTitle1</title>
+ <last_downloaded>100</last_downloaded>
+ <weightedsetstring>
+ <item>one</item>
+ <item>two</item>
+ <item>three</item>
+ <item>four</item>
+ <item>five</item>
+ </weightedsetstring>
+ <weightedsetint>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ <item>5</item>
+ </weightedsetint>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test4.xml b/document/src/tests/vespaxml/test4.xml
new file mode 100644
index 00000000000..8a4777344d6
--- /dev/null
+++ b/document/src/tests/vespaxml/test4.xml
@@ -0,0 +1,23 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+
+ <vespaadd idprefix="doc:crawler:">
+ <document type="news" id="http://www.uio.no/">
+ <title>TestTitle</title>
+ <last_downloaded>100</last_downloaded>
+ </document>
+
+ <document type="news" id="http://www.dagbladet.no/">
+ <title>Title2</title>
+ <last_downloaded>100</last_downloaded>
+ </document>
+ </vespaadd>
+
+ <vespaadd>
+ <document type="news" id="doc:crawler2:http://www.vg.no/">
+ <title>Title2</title>
+ <last_downloaded>100</last_downloaded>
+ </document>
+ </vespaadd>
+
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test40.xml b/document/src/tests/vespaxml/test40.xml
new file mode 100644
index 00000000000..68210920df2
--- /dev/null
+++ b/document/src/tests/vespaxml/test40.xml
@@ -0,0 +1,6 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <update documenttype="news" documentid="doc:crawler:http://www.ntnu.no/">
+ <assign field="title">TestTitle</assign>
+ </update>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test41.xml b/document/src/tests/vespaxml/test41.xml
new file mode 100644
index 00000000000..b92c2e586a8
--- /dev/null
+++ b/document/src/tests/vespaxml/test41.xml
@@ -0,0 +1,22 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <update documenttype="news" documentid="doc:crawler:http://www.ntnu.no/">
+ <assign field="stringarr">
+ <item>First</item>
+ <item>Second</item>
+ </assign>
+ <add field="stringarr">
+ <item>Third</item>
+ <item>Fourth</item>
+ </add>
+ <remove field="stringarr">
+ <item>Fifth</item>
+ <item>Sixth</item>
+ </remove>
+ <assign field="intarr">
+ <item>100</item>
+ <item>200</item>
+ </assign>
+ <assign field="intarr"></assign>
+ </update>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test42.xml b/document/src/tests/vespaxml/test42.xml
new file mode 100644
index 00000000000..479509776fa
--- /dev/null
+++ b/document/src/tests/vespaxml/test42.xml
@@ -0,0 +1,22 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <update documenttype="news" documentid="doc:crawler:http://www.ntnu.no/">
+ <assign field="weightedsetstring">
+ <item weight="1">First</item>
+ <item weight="2">Second</item>
+ </assign>
+ <add field="weightedsetstring">
+ <item weight="3">Third</item>
+ <item weight="4">Fourth</item>
+ </add>
+ <remove field="weightedsetstring">
+ <item>Fifth</item>
+ <item>Sixth</item>
+ </remove>
+ <assign field="weightedsetint">
+ <item weight="1">100</item>
+ <item weight="2">200</item>
+ </assign>
+ <assign field="weightedsetint"></assign>
+ </update>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test43.xml b/document/src/tests/vespaxml/test43.xml
new file mode 100644
index 00000000000..874deada10c
--- /dev/null
+++ b/document/src/tests/vespaxml/test43.xml
@@ -0,0 +1,32 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <document documenttype="news" documentid="doc:crawler:http://www.ntnu.no/">
+ <value_long>1008</value_long>
+ <weightedsetstring>
+ <item weight="1">First</item>
+ <item weight="2">Second</item>
+ </weightedsetstring>
+ </document>
+ <update documenttype="news" documentid="doc:crawler:http://www.ntnu.no/">
+ <increment field="value_long" by="1" />
+ <decrement field="value_long" by="2" />
+ <divide field="value_long" by="3" />
+ <multiply field="value_long" by="4" />
+ </update>
+ <update documenttype="news" documentid="doc:crawler:http://www.ntnu.no/">
+ <alter field="value_long">
+ <increment by="5" />
+ <decrement by="6" />
+ </alter>
+ <alter field="value_long">
+ <divide by="7" />
+ <multiply by="8" />
+ </alter>
+ </update>
+ <update documenttype="news" documentid="doc:crawler:http://www.ntnu.no/">
+ <increment field="weightedsetstring" by="9">
+ <key>First</key>
+ <key>Second</key>
+ </increment>
+ </update>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test45.xml b/document/src/tests/vespaxml/test45.xml
new file mode 100644
index 00000000000..ccc1a475a86
--- /dev/null
+++ b/document/src/tests/vespaxml/test45.xml
@@ -0,0 +1,6 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <update documenttype="news" documentid="doc:crawler:http://www.ntnu.no/">
+ <remove field="floatarr" />
+ </update>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test46.xml b/document/src/tests/vespaxml/test46.xml
new file mode 100644
index 00000000000..118dfdd810d
--- /dev/null
+++ b/document/src/tests/vespaxml/test46.xml
@@ -0,0 +1,10 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <document documenttype="news" documentid="doc:crawler:http://www.blargh.example.com/" lastmodified="98798787">
+ <value_long>1008</value_long>
+ <weightedsetstring>
+ <item weight="1">First</item>
+ <item weight="2">Second</item>
+ </weightedsetstring>
+ </document>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test47.xml b/document/src/tests/vespaxml/test47.xml
new file mode 100644
index 00000000000..e9499c32810
--- /dev/null
+++ b/document/src/tests/vespaxml/test47.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <!-- VERY BAD: -->
+ <vespaadd>
+ <documentid type="news">
+ <uri>doc:this:is:very:bad</uri>
+ </documentid>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test48.xml b/document/src/tests/vespaxml/test48.xml
new file mode 100644
index 00000000000..119d3ea82d4
--- /dev/null
+++ b/document/src/tests/vespaxml/test48.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <!-- VERY BAD: -->
+ <documentid type="news" id="doc:this:is:even:worse" />
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test49.xml b/document/src/tests/vespaxml/test49.xml
new file mode 100644
index 00000000000..d3fa4dc9637
--- /dev/null
+++ b/document/src/tests/vespaxml/test49.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <!-- VERY BAD: -->
+ <documentid type="news">
+ <uri>doc:this:is:very:very:ugly</uri>
+ </documentid>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test5.expected.xml b/document/src/tests/vespaxml/test5.expected.xml
new file mode 100644
index 00000000000..5b851a4601e
--- /dev/null
+++ b/document/src/tests/vespaxml/test5.expected.xml
@@ -0,0 +1,3 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<remove documentid="doc:crawler:http://www.ntnu.no/"/>
+
diff --git a/document/src/tests/vespaxml/test5.xml b/document/src/tests/vespaxml/test5.xml
new file mode 100644
index 00000000000..bdfa496cb86
--- /dev/null
+++ b/document/src/tests/vespaxml/test5.xml
@@ -0,0 +1,6 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vesparemove>
+ <documentid documentid="doc:crawler:http://www.ntnu.no/"/>
+ </vesparemove>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test50.xml b/document/src/tests/vespaxml/test50.xml
new file mode 100644
index 00000000000..45c4c0a4d13
--- /dev/null
+++ b/document/src/tests/vespaxml/test50.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <!-- OK: -->
+ <vesparemove>
+ <documentid type="news" id="doc:this:an:ok:removal"/>
+ </vesparemove>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test51.xml b/document/src/tests/vespaxml/test51.xml
new file mode 100644
index 00000000000..9e91d45d930
--- /dev/null
+++ b/document/src/tests/vespaxml/test51.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <!-- OK: -->
+ <remove documentid="doc:this:is:also:an:ok:removal"/>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test52.xml b/document/src/tests/vespaxml/test52.xml
new file mode 100644
index 00000000000..a8617df42da
--- /dev/null
+++ b/document/src/tests/vespaxml/test52.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <!-- OK: -->
+ <vespaadd>
+ <document documentid="doc:blah:blah:blah" documenttype="news">
+ <value_long>2345</value_long>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test53.xml b/document/src/tests/vespaxml/test53.xml
new file mode 100644
index 00000000000..6449436ff54
--- /dev/null
+++ b/document/src/tests/vespaxml/test53.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <!-- HALF BAD, BUT NOT ALLOWED: -->
+ <vespaadd>
+ <document documentid="doc:blah:blah:blah" documenttype="news">
+ <value_long>2345</value_long>
+ </document>
+ <documentid type="news" id="doc:half:bad:add"/>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test54.xml b/document/src/tests/vespaxml/test54.xml
new file mode 100644
index 00000000000..7535f4b93ea
--- /dev/null
+++ b/document/src/tests/vespaxml/test54.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <!-- VERY BAD: -->
+ <vesparemove>
+ <document documentid="doc:bluh:bluh:bluh" documenttype="news">
+ <value_long>45</value_long>
+ </document>
+ </vesparemove>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test55.xml b/document/src/tests/vespaxml/test55.xml
new file mode 100644
index 00000000000..b2134a29a46
--- /dev/null
+++ b/document/src/tests/vespaxml/test55.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <!-- HALF BAD, BUT NOT ALLOWED: -->
+ <vesparemove>
+ <documentid type="news" id="doc:this:remove:is:half:bad"/>
+ <document documentid="doc:bluh:bluh:bluh" documenttype="news">
+ <value_long>45</value_long>
+ </document>
+ </vesparemove>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test56.xml b/document/src/tests/vespaxml/test56.xml
new file mode 100644
index 00000000000..1dd36a57b68
--- /dev/null
+++ b/document/src/tests/vespaxml/test56.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <!-- VERY BAD: -->
+ <vesparemove>
+ <document documentid="doc:bluh:bluh:bluh" documenttype="news" />
+ </vesparemove>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test57.xml b/document/src/tests/vespaxml/test57.xml
new file mode 100644
index 00000000000..d75e6d4d099
--- /dev/null
+++ b/document/src/tests/vespaxml/test57.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <!-- OK: -->
+ <document documentid="doc:blih:blih:blih" documenttype="news">
+ <value_long>235</value_long>
+ </document>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test58.xml b/document/src/tests/vespaxml/test58.xml
new file mode 100644
index 00000000000..8711a2a49e4
--- /dev/null
+++ b/document/src/tests/vespaxml/test58.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+
+ <document type="news" id="doc:music:http://music.yahoo.com">
+ <url>http://music.yahoo.com</url>
+ <stringarr>
+ <item>yahoo<item>
+ <item>hello</item>
+ </stringarr>
+ </document>
+
+
+
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test59.xml b/document/src/tests/vespaxml/test59.xml
new file mode 100644
index 00000000000..e7708351c93
--- /dev/null
+++ b/document/src/tests/vespaxml/test59.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <update documentid="doc:blih:blih:blih" documenttype="news">
+ <increment field="title" by="3549" />
+ </update>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test6.xml b/document/src/tests/vespaxml/test6.xml
new file mode 100644
index 00000000000..3739690d2fe
--- /dev/null
+++ b/document/src/tests/vespaxml/test6.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vesparemove>
+ <documentid type="news" id="doc:crawler:http://www.ntnu���.no/"/>
+ </vesparemove>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test7.xml b/document/src/tests/vespaxml/test7.xml
new file mode 100644
index 00000000000..129773678f1
--- /dev/null
+++ b/document/src/tests/vespaxml/test7.xml
@@ -0,0 +1,9 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed idprefix="doc:crawler:">
+ <vespaadd>
+ <document type="news" id="http://www.ntnu.no/">
+ <title>TestTitle</title>
+ <last_downloaded>100.5</last_downloaded>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test8.xml b/document/src/tests/vespaxml/test8.xml
new file mode 100644
index 00000000000..272791511c1
--- /dev/null
+++ b/document/src/tests/vespaxml/test8.xml
@@ -0,0 +1,9 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd>
+ <document type="news" id="doc:crawler:http://www.ntnu.no/">
+ <title>TestTitle</title>
+ <last_downloaded>hundred</last_downloaded>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test9.xml b/document/src/tests/vespaxml/test9.xml
new file mode 100644
index 00000000000..b733c66a797
--- /dev/null
+++ b/document/src/tests/vespaxml/test9.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vesparemove>
+ <documentid id="doc:crawler/http://www.ntnu���.no/"/>
+ </vesparemove>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test_arraystruct.xml b/document/src/tests/vespaxml/test_arraystruct.xml
new file mode 100644
index 00000000000..ba5c3233e16
--- /dev/null
+++ b/document/src/tests/vespaxml/test_arraystruct.xml
@@ -0,0 +1,19 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <document documenttype="news" documentid="doc:test:struct">
+ <mystructarr>
+ <item>
+ <intval>36</intval>
+ <stringval>test</stringval>
+ </item>
+ <item>
+ <intval>39</intval>
+ <stringval>test2</stringval>
+ </item>
+ <item>
+ <intval>100</intval>
+ <stringval>cooool</stringval>
+ </item>
+ </mystructarr>
+ </document>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test_doc5.xml b/document/src/tests/vespaxml/test_doc5.xml
new file mode 100644
index 00000000000..30ce5f7b8f8
--- /dev/null
+++ b/document/src/tests/vespaxml/test_doc5.xml
@@ -0,0 +1,8 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <endoffeed>
+ <name>default</name>
+ <generation>10</generation>
+ <increment>20</increment>
+ </endoffeed>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test_doc6.xml b/document/src/tests/vespaxml/test_doc6.xml
new file mode 100644
index 00000000000..52015073f96
--- /dev/null
+++ b/document/src/tests/vespaxml/test_doc6.xml
@@ -0,0 +1,6 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <endoffeed>
+ <name>default</name>
+ </endoffeed>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test_doc8.xml b/document/src/tests/vespaxml/test_doc8.xml
new file mode 100644
index 00000000000..f5c7a2090ae
--- /dev/null
+++ b/document/src/tests/vespaxml/test_doc8.xml
@@ -0,0 +1,9 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd>
+ <document type="news" version="13" id="http://www.ntnu.no/">
+ <title>TestTitle</title>
+ <last_downloaded>100</last_downloaded>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test_externalentity.xml b/document/src/tests/vespaxml/test_externalentity.xml
new file mode 100644
index 00000000000..014d67d32bc
--- /dev/null
+++ b/document/src/tests/vespaxml/test_externalentity.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<!DOCTYPE vespafeed [<!ENTITY xxe SYSTEM "xxe.txt">]>
+<vespafeed>
+ <vespaadd idprefix="doc:crawler:">
+ <document documenttype="news" documentid="http://www.ntnu.no/">
+ <title>&xxe;</title>
+ <last_downloaded>100</last_downloaded>
+ </document>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test_idprefix.xml b/document/src/tests/vespaxml/test_idprefix.xml
new file mode 100644
index 00000000000..2b0487d0b94
--- /dev/null
+++ b/document/src/tests/vespaxml/test_idprefix.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+
+ <document type="news" id="http://music.yahoo.com/bobdylan/BestOf">
+ <title>Best of Bob Dylan</title>
+ </document>
+
+ <document type="news" id="http://music.yahoo.com/metallica/BestOf">
+ <title>Best of Metallica</title>
+ </document>
+
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test_struct.xml b/document/src/tests/vespaxml/test_struct.xml
new file mode 100644
index 00000000000..251b8b4896d
--- /dev/null
+++ b/document/src/tests/vespaxml/test_struct.xml
@@ -0,0 +1,9 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <document documenttype="news" documentid="doc:test:struct">
+ <mystruct>
+ <intval>36</intval>
+ <stringval>test</stringval>
+ </mystruct>
+ </document>
+</vespafeed>
diff --git a/document/src/tests/vespaxml/test_update1.xml b/document/src/tests/vespaxml/test_update1.xml
new file mode 100644
index 00000000000..89dcb978e3b
--- /dev/null
+++ b/document/src/tests/vespaxml/test_update1.xml
@@ -0,0 +1,12 @@
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<vespafeed>
+ <vespaadd idprefix="doc:crawler:">
+ <document type="news" id="http://www.ntnu.no/">
+ <title>TestTitle</title>
+ <last_downloaded>100</last_downloaded>
+ </document>
+ <update documenttype="news" documentid="http://www.ntnu.no/">
+ <divide field="last_downloaded" by="0" />
+ </update>
+ </vespaadd>
+</vespafeed>
diff --git a/document/src/vespa/document/base/idstring.cpp b/document/src/vespa/document/base/idstring.cpp
index 2c922ef6092..785a56a4e45 100644
--- a/document/src/vespa/document/base/idstring.cpp
+++ b/document/src/vespa/document/base/idstring.cpp
@@ -18,7 +18,8 @@ VESPA_IMPLEMENT_EXCEPTION(IdParseException, vespalib::Exception);
namespace {
-string _G_typeName[2] = {
+string _G_typeName[6] = {
+ "doc",
"id",
"null"
};
@@ -184,10 +185,12 @@ IdString::UP
IdString::createIdString(const char * id, size_t sz_)
{
if (sz_ > 4) {
- if (_G_id.as16 == *reinterpret_cast<const uint16_t *>(id) && id[2] == ':') {
- return std::make_unique<IdIdString>(stringref(id, sz_));
+ if (_G_doc.as32 == *reinterpret_cast<const uint32_t *>(id)) {
+ return IdString::UP(new DocIdString(stringref(id, sz_)));
} else if ((sz_ == 6) && (_G_null.as32 == *reinterpret_cast<const uint32_t *>(id)) && (id[4] == ':') && (id[5] == ':')) {
- return std::make_unique<NullIdString>();
+ return IdString::UP(new NullIdString());
+ } else if (_G_id.as16 == *reinterpret_cast<const uint16_t *>(id) && id[2] == ':') {
+ return IdString::UP(new IdIdString(stringref(id, sz_)));
} else if (sz_ > 8) {
reportNoSchemeSeparator(id);
} else {
@@ -280,4 +283,22 @@ IdIdString::IdIdString(stringref id)
}
}
+IdString::LocationType
+DocIdString::getLocation() const
+{
+ return makeLocation(toString());
+}
+
+DocIdString::DocIdString(stringref ns, stringref id) :
+ IdString(2, 4, "doc:" + ns + ":" + id)
+{
+ validate();
+}
+
+DocIdString::DocIdString(stringref rawId) :
+ IdString(2, 4, rawId)
+{
+ validate();
+}
+
} // document
diff --git a/document/src/vespa/document/base/idstring.h b/document/src/vespa/document/base/idstring.h
index cddf6d036b1..55ff767a3ff 100644
--- a/document/src/vespa/document/base/idstring.h
+++ b/document/src/vespa/document/base/idstring.h
@@ -20,7 +20,7 @@ public:
typedef std::unique_ptr<IdString> UP;
typedef vespalib::CloneablePtr<IdString> CP;
typedef uint64_t LocationType;
- enum Type { ID=0, NULLID };
+ enum Type { DOC=0, ID, NULLID };
static const vespalib::string & getTypeName(Type t);
/** @throws document::IdParseException If parsing of id scheme failed. */
@@ -118,4 +118,24 @@ private:
vespalib::stringref getNamespaceSpecific() const override { return getComponent(3); }
};
+/**
+ * \class document::DocIdString
+ * \ingroup base
+ *
+ * \brief Scheme for documents with no forced distribution.
+ *
+ * By using this scheme, documents will be evenly distributed within VDS,
+ * as the location of a doc identifier is a hash of the entire URI.
+ */
+class DocIdString final : public IdString {
+public:
+ DocIdString(vespalib::stringref ns, vespalib::stringref id);
+ DocIdString(vespalib::stringref rawId);
+private:
+ DocIdString* clone() const override { return new DocIdString(*this); }
+ Type getType() const override { return DOC; }
+ LocationType getLocation() const override;
+ vespalib::stringref getNamespaceSpecific() const override { return getComponent(1); }
+};
+
} // document