aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/test/java
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-08-16 22:58:07 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2019-08-19 14:13:40 +0000
commit46de62c8e589ab93ba2fcc49b742d0db612ff214 (patch)
tree023c8bf6cdaf2226e81f4ea68a7f16b0b64f7bf9 /document/src/test/java
parent0180922a9d5a40142b83a17b76e2d7abe52c10bd (diff)
doc: -> id:
Unify documentid java/cpp GC old formats v6 and v7
Diffstat (limited to 'document/src/test/java')
-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
-rw-r--r--[-rwxr-xr-x]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
27 files changed, 231 insertions, 268 deletions
diff --git a/document/src/test/java/com/yahoo/document/BucketIdFactoryTestCase.java b/document/src/test/java/com/yahoo/document/BucketIdFactoryTestCase.java
index c2e1dbd611c..93feb198e7e 100644
--- a/document/src/test/java/com/yahoo/document/BucketIdFactoryTestCase.java
+++ b/document/src/test/java/com/yahoo/document/BucketIdFactoryTestCase.java
@@ -1,11 +1,12 @@
// 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
@@ -42,13 +43,12 @@ 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 DocIdString("ns", "spec"));
- DocumentId doc2 = new DocumentId(new DocIdString("ns2", "spec"));
- DocumentId doc3 = new DocumentId(new DocIdString("ns", "spec2"));
+ 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 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,28 +56,19 @@ 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()));
- 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(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()));
- 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(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(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 ...
@@ -85,11 +76,11 @@ public class BucketIdFactoryTestCase {
public void testBidContainsBid() {
BucketId bid = new BucketId(18, 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)));
+ 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)));
}
@Test
@@ -97,13 +88,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);
- assert(bid.contains(docId, factory));
+ assertTrue(bid.contains(docId, factory));
//split on '0'
bid = new BucketId(17, 0x12L);
- assert(bid.contains(docId, factory));
+ assertTrue(bid.contains(docId, factory));
//split on '1'
bid = new BucketId(17, (1L<<16) + 0x12L);
- assert(!bid.contains(docId, factory));
+ assertTrue(!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 f5c158595d2..d81daca74f0 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"), "doc:inner:number:one");
+ Document inner1 = new Document(manager.getDocumentType("docindoc"), "id:inner:docindoc::one");
inner1.setFieldValue("name", new StringFieldValue("Donald Duck"));
inner1.setFieldValue("content", new StringFieldValue("Lives in Duckburg"));
- Document inner2 = new Document(manager.getDocumentType("docindoc"), "doc:inner:number:two");
+ Document inner2 = new Document(manager.getDocumentType("docindoc"), "id:inner:docindoc::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"), "doc:outer:the:only:one");
+ Document outer = new Document(manager.getDocumentType("outerdoc"), "id:outer:outerdoc::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 619f6598247..fb2d478d38b 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("doc:testdoc:http://www.ntnu.no/"));
+ doc = new Document(testDocType, new DocumentId("id:ns:testdoc::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 b8f60b5d9bc..bb4fac805ee 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("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();
+ 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();
assertTrue(docId1.equals(docId2));
assertTrue(!docId1.equals(docId3));
@@ -70,8 +70,6 @@ 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) {
@@ -80,11 +78,6 @@ 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");
@@ -182,10 +175,6 @@ 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());
@@ -204,9 +193,9 @@ public class DocumentIdTestCase {
@Test
public void testHashCodeOfGids() {
- DocumentId docId0 = new DocumentId("doc:blabla:0");
+ DocumentId docId0 = new DocumentId("id:blabla:type::0");
byte[] docId0Gid = docId0.getGlobalId();
- DocumentId docId0Copy = new DocumentId("doc:blabla:0");
+ DocumentId docId0Copy = new DocumentId("id:blabla:type::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 d5fc1386900..c7cdfb01413 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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
assertNull(doc.getFieldValue("strfoo"));
doc.setFieldValue("strfoo", "cocacola");
assertEquals(new StringFieldValue("cocacola"), doc.getFieldValue("strfoo"));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::foooo"));
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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::foooo"));
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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::foooo"));
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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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("doc:toast:jam"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:toast:foobar::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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
assertNull(doc.getFieldValue("strfoo"));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
doc.setFieldValue(doc.getField("num"), new IntegerFieldValue(34));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
doc.setFieldValue(doc.getField("num"), new IntegerFieldValue(10));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
doc.setFieldValue(doc.getField("num"), new IntegerFieldValue(10));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
doc.setFieldValue(doc.getField("num"), new IntegerFieldValue(10));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
- DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("doc:foo:bar"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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("doc:hargl:bargl"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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("doc:hargl:bargl"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:something:foooo"));
+ Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:foo:bar"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::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("doc:serialization:xlanguage"));
+ DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:serializetest::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 9acd40770dc..8b84dc5f46b 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("doc:this:is:a:test");
+ DocumentId docId = new DocumentId("id: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("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"));
+ 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"));
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 8ff168adc4b..bc1224ca8ea 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, "doc:serializetest:http://test.doc.id/");
+ Document doc = new Document(docType, "id:ns: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, "doc:serializetest:http://doc.in.doc/");
+ Document docInDoc = new Document(docInDocType, "id:ns:docindoc::http://doc.in.doc/");
docInDoc.setFieldValue("stringindocfield", "Elvis is dead");
doc.setFieldValue(docType.getField("docfield"), docInDoc);
Array<FloatFieldValue> floatArray = new Array<>(arrayOfFloatDataType);
@@ -146,16 +146,12 @@ 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);
@@ -206,7 +202,7 @@ public class DocumentSerializationTestCase extends AbstractTypesTest {
@Test
public void testSerializeDeserializeWithAnnotations() throws IOException {
- Document doc = new Document(docType, "doc:foo:bar");
+ Document doc = new Document(docType, "id:ns:dokk::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 28267a22a56..141a74a24fe 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=\"doc:sertest:foobar\">\n" +
+ "<document documenttype=\"sertest\" documentid=\"id:ns: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=\"doc:sertest:inserted\">\n" +
+ " <docindoc documenttype=\"docindoc\" documentid=\"id:ns:docindoc::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("doc:sertest:foobar"));
+ Document doc = new Document(docMan.getDocumentType("sertest"), new DocumentId("id:ns: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("doc:sertest:inserted"));
+ Document docInDoc = new Document(docMan.getDocumentType("docindoc"), new DocumentId("id:ns:docindoc::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, "doc:scheme:");
+ Document doc = new Document(type, "id:ns:test::");
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("doc:foo:testdoc"));
+ Document doc = new Document(type, new DocumentId("id:ns:test::"));
doc.setFieldValue("iiiarray", iiiaV);
{
@@ -299,7 +299,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
@Test
public void testGetRecursiveValue() {
- Document doc = new Document(testDocType, new DocumentId("doc:ns:testdoc"));
+ Document doc = new Document(testDocType, new DocumentId("id: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("doc:ns:testdoc"));
+ Document doc = new Document(testDocType, new DocumentId("id: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("doc:null:URI"));
+ new Document(null, new DocumentId("id:null:type::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 = "doc:testdoc:http://www.ntnu.no/";
+ String uri = "id:ns: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("doc:testdoc:test"));
+ Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("id:ns:testdoc::test"));
Object val = doc.getFieldValue(minField.getName());
assertNull(val);
doc.setFieldValue(minField.getName(), 500);
@@ -662,16 +662,6 @@ 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");
@@ -682,7 +672,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
@SuppressWarnings("unchecked")
public void validateCppDocNotMap(Document doc) throws IOException {
// in practice to validate v6 serialization
- assertEquals("doc:serializetest:http://test.doc.id/", doc.getId().toString());
+ assertEquals("id:ns: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"));
@@ -696,7 +686,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
Document docindoc = (Document)doc.getFieldValue("docfield");
assertEquals(docMan.getDocumentType("docindoc"), docindoc.getDataType());
- assertEquals(new DocumentId("doc:docindoc:http://embedded"), docindoc.getId());
+ assertEquals(new DocumentId("id:ns:docindoc::http://embedded"), docindoc.getId());
Array<FloatFieldValue> array = (Array<FloatFieldValue>)doc.getFieldValue("arrayoffloatfield");
assertEquals(new FloatFieldValue(1.0f), array.get(0));
@@ -713,10 +703,10 @@ public class DocumentTestCase extends DocumentTestCaseBase {
docMan = setUpCppDocType();
Document doc = new Document(docMan.getDocumentType("serializetest"),
- new DocumentId("doc:serializetest:http://test.doc.id/"));
+ new DocumentId("id:ns:serializetest::http://test.doc.id/"));
Document docindoc = new Document(docMan.getDocumentType("docindoc"),
- new DocumentId("doc:serializetest:http://doc.in.doc/"));
+ new DocumentId("id:ns:docindoc::http://doc.in.doc/"));
docindoc.setFieldValue("stringindocfield", "Elvis is dead");
doc.setFieldValue("docfield", docindoc);
@@ -902,7 +892,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
DocumentTypeManager manager = new DocumentTypeManager();
manager.register(childType);
- Document child = new Document(childType, new DocumentId("doc:what:test"));
+ Document child = new Document(childType, new DocumentId("id:ns:child::what:test"));
child.setFieldValue(childType.getField("parentbodyint"), new IntegerFieldValue(4));
child.setFieldValue("parentheaderint", 6);
child.setFieldValue("overwritten", 7);
@@ -949,7 +939,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("doc:doctest:fooooobardoc"));
+ Document doc = new Document(docMan.getDocumentType("impl"), new DocumentId("id:ns:impl::fooooobardoc"));
Array<StringFieldValue> testlist = new Array<>(doc.getField("something").getDataType());
doc.setFieldValue("something", testlist);
}
@@ -962,7 +952,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("doc:test:test"));
+ Document doc = new Document(docMan.getDocumentType("serializetest"), new DocumentId("id:ns:serializetest::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 ");
@@ -975,7 +965,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("doc:test:test"));
+ Document doc = new Document(docMan.getDocumentType("serializetest"), new DocumentId("id:ns:serializetest::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 ");
@@ -997,8 +987,8 @@ public class DocumentTestCase extends DocumentTestCaseBase {
docMan.getDocumentType("outerdoc");
//create document and necessary structures
- Document outerdoc = new Document(docMan.getDocumentType("outerdoc"), new DocumentId("doc:recursion:outerdoc"));
- Document innerdoc = new Document(docMan.getDocumentType("innerdoc"), new DocumentId("doc:recursion:innerdoc"));
+ Document outerdoc = new Document(docMan.getDocumentType("outerdoc"), new DocumentId("id:recursion:outerdoc::"));
+ Document innerdoc = new Document(docMan.getDocumentType("innerdoc"), new DocumentId("id:recursion:innerdoc::"));
innerdoc.setFieldValue("intfield", 55);
@@ -1022,7 +1012,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
@Test
public void testTimestamp() {
- Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("doc:testdoc:timetest"));
+ Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("id:ns:testdoc::timetest"));
assertNull(doc.getLastModified());
doc.setLastModified(4350129845023985L);
assertEquals(Long.valueOf(4350129845023985L), doc.getLastModified());
@@ -1072,18 +1062,18 @@ public class DocumentTestCase extends DocumentTestCaseBase {
@Test
public void testSingleFieldToXml() {
- Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("doc:testdoc:xmltest"));
+ Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("id:ns: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("doc:testdoc:xmltest"));
+ Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("id:ns:testdoc::xmltest"));
doc.setFieldValue("stringattr", new StringFieldValue("hello universe"));
// Should just delegate to toXML
assertEquals(
- "<document documenttype=\"testdoc\" documentid=\"doc:testdoc:xmltest\">\n" +
+ "<document documenttype=\"testdoc\" documentid=\"id:ns:testdoc::xmltest\">\n" +
" <stringattr>hello universe</stringattr>\n" +
"</document>\n",
doc.toXml());
@@ -1096,7 +1086,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"), "doc:sertest:foobar");
+ assertEquals(parsed.get("id"), "id:ns:sertest::foobar");
assertThat(parsed.get("fields"), instanceOf(Map.class));
Object fieldMap = parsed.get("fields");
if (fieldMap instanceof Map) {
@@ -1121,7 +1111,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
GrowableByteBuffer grbuf = new GrowableByteBuffer();
{
- Document doc = new Document(docType, new DocumentId("doc:a:b:emptystrings"));
+ Document doc = new Document(docType, new DocumentId("id:ns:emptystrings::"));
doc.setFieldValue("emptystring", "");
doc.removeFieldValue("nullstring");
@@ -1157,7 +1147,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
GrowableByteBuffer grbuf = new GrowableByteBuffer();
- Document doc = new Document(docType, new DocumentId("doc:a:b:strings"));
+ Document doc = new Document(docType, new DocumentId("id:ns:bug2354045::strings"));
doc.removeFieldValue("string");
assertNull(doc.getFieldValue("string"));
@@ -1185,7 +1175,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
typeWithDinner.addField("dinner", DataType.DOUBLE);
docTypeManasjer.registerDocumentType(typeWithDinner);
- Document docWithDinner = new Document(typeWithDinner, "doc:elvis:has:left:the:building");
+ Document docWithDinner = new Document(typeWithDinner, "id:ns:elvis::has:left:the:building");
docWithDinner.setFieldValue("breakfast", "peanut butter");
docWithDinner.setFieldValue("lunch", 14);
docWithDinner.setFieldValue("dinner", 5.43d);
@@ -1219,11 +1209,11 @@ public class DocumentTestCase extends DocumentTestCaseBase {
Document doc;
- doc = new Document(type, "doc:foo:bar:bar");
+ doc = new Document(type, "id:ns:foo::bar:bar");
doc.removeFieldValue("productdesc");
assertNull(doc.getFieldValue("productdesc"));
- doc = new Document(type, "doc:foo:bar:bar");
+ doc = new Document(type, "id:ns:foo::bar:bar");
assertNull(doc.getFieldValue("productdesc"));
}
@@ -1291,13 +1281,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("doc:a:b:bug6394548"));
+ Document doc1 = new Document(docType, new DocumentId("id:ns:bug2354045::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("doc:a:b:bug6394548"));
+ Document doc2 = new Document(docType, new DocumentId("id:ns:bug2354045::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 48fb44fa260..68fe1c8cc57 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("doc:testdoc:http://www.ntnu.no/"));
+ Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("id:ns: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 0712adca3a5..5f180beab35 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 = "doc:something:foooo";
+ private final String documentId = "id:ns:foobar::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("doc:foo:bar"));
+ docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
assignSingle = FieldUpdate.createAssign(docType.getField("strfoo"), new StringFieldValue("something"));
- Array<StringFieldValue> assignList = new Array<StringFieldValue>(docType.getField("strarray").getDataType());
+ Array<StringFieldValue> assignList = new Array<>(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("doc:foo:"));
+ DocumentUpdate update = new DocumentUpdate(docType, new DocumentId("id:ns:my_type::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("doc:foo:"));
+ DocumentUpdate update = new DocumentUpdate(docType, new DocumentId("id:ns:my_type::foo:"));
try {
update.addFieldUpdate(FieldUpdate.createIncrement(new Field("my_int", DataType.INT), 1));
fail();
@@ -313,7 +313,7 @@ public class DocumentUpdateTestCase {
}
assertEquals(2 // version
- + (11 + 1) //docid doc:foo:bar\0
+ + (17 + 1) //docid id:ns:foobar: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("doc:update:test"), upd.getId());
+ assertEquals(new DocumentId("id:ns:serializetest::update"), 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("doc:update:test"));
+ DocumentUpdate upd = new DocumentUpdate(type, new DocumentId("id:ns:serializetest::update"));
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("doc:foo:"));
+ DocumentUpdate fooUpdate = new DocumentUpdate(docType, new DocumentId("id:ns:my_type::foo:"));
fooUpdate.addFieldUpdate(fooField);
FieldUpdate barField = FieldUpdate.createAssign(field, new IntegerFieldValue(2));
- DocumentUpdate barUpdate = new DocumentUpdate(docType, new DocumentId("doc:foo:"));
+ DocumentUpdate barUpdate = new DocumentUpdate(docType, new DocumentId("id:ns:my_type::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("doc:this:is:a:test"));
+ DocumentUpdate update = new DocumentUpdate(docType, new DocumentId("id:this:my_type::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("doc:this:is:a:test"));
- DocumentUpdate d2 = new DocumentUpdate(type, "doc:this:is:a:test");
+ DocumentUpdate d1 = new DocumentUpdate(type, new DocumentId("id:this:doo::is:a:test"));
+ DocumentUpdate d2 = new DocumentUpdate(type, "id:this:doo::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("doc:this:is:a:test"));
+ DocumentUpdate documentUpdate = new DocumentUpdate(t1, new DocumentId("id:this:doo::is:a:test"));
DocumentType t2 = new DocumentType("foo");
- Document document = new Document(t2, "doc:this:is:another:test");
+ Document document = new Document(t2, "id:this:foo::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("doc:this:is:a:test"));
+ DocumentUpdate documentUpdate = new DocumentUpdate(t1, new DocumentId("id:ns:doo::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("doc:this:is:a:test"));
- DocumentUpdate du2 = new DocumentUpdate(t2, "doc:this:is:another:test");
+ DocumentUpdate du1 = new DocumentUpdate(t1, new DocumentId("id:this:doo::is:a:test"));
+ DocumentUpdate du2 = new DocumentUpdate(t2, "id:this:foo::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("doc:this:is:a:test"));
+ DocumentUpdate du3 = new DocumentUpdate(t2, new DocumentId("id:this:foo::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 cb818f12d3f..77049a1c535 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("doc:foo:test");
- verifyGidToBucketIdMapping("doc:myns:http://foo.bar");
- verifyGidToBucketIdMapping("doc:jsrthsdf:a234aleingzldkifvasdfgadf");
+ verifyGidToBucketIdMapping("id:foo:mytype::test");
+ verifyGidToBucketIdMapping("id:myns:mytype::http://foo.bar");
+ verifyGidToBucketIdMapping("id:jsrthsdf:mytype::a234aleingzldkifvasdfgadf");
}
}
diff --git a/document/src/test/java/com/yahoo/document/SimpleDocumentTestCase.java b/document/src/test/java/com/yahoo/document/SimpleDocumentTestCase.java
index 049b401c39f..c6bf2b07443 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, "doc:scheme:");
+ Document doc = new Document(type, "id:ns:test::");
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 0a7739fd8c1..454d34195e5 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, "doc:this:is:a:test");
+ Document doc = new Document(type, "id:this:blog::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 a3b33d4b915..72a141ecc93 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, "doc:this:is:a:test");
+ Document doc = new Document(type, "id:this:blog::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 0291e23c888..6ca076ad3c6 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, "doc:this:is:a:test");
+ Document doc = new Document(type, "id:this:blog::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 8b9649d697f..a0315c53dc3 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"), "doc:article:test");
+ Document doc = new Document(manager.getDocumentType("article"), "id:ns: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 9163b773bcf..5382c471963 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, "doc:article:boringarticle:longarticle");
+ Document inDocument = new Document(type, "id:ns: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 296ab1ac3fc..514b793f28e 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, "doc:blog:http://blogs.sun.com/praveenm");
+ Document doc = new Document(blogType, "id:ns: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 6457a3deb82..5c6df7ecad0 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("doc:myspace:anything"));
+ DocumentUpdate upd = new DocumentUpdate(manager.getDocumentType("test"), new DocumentId("id:myspace:test::adocnything"));
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("doc:scheme:"));
- DocumentUpdate upd = new DocumentUpdate(manager.getDocumentType("test"), new DocumentId("doc:scheme:"));
+ DocumentPut put = new DocumentPut(manager.getDocumentType("test"), new DocumentId("id:ns:test::"));
+ DocumentUpdate upd = new DocumentUpdate(manager.getDocumentType("test"), new DocumentId("id:ns:test::"));
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("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::anything", 24, 2.0f, "foo", "bar"));
+ documents.add(createDocument("id:anotherspace:test::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("doc:myspace:missingint", null, 2.0f, null, "bar"));
+ documents.add(createDocument("id:myspace:test::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 == \"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 == \"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.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,7 +538,6 @@ 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 aa8b43e7abb..227f33d8d27 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 document";
+ final static String REF_TARGET_DOC_TYPE_NAME = "my_doctype";
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 5a8d458c74b..6effbc9a452 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, "doc:scheme:");
+ Document doc = new Document(docType, "id:ns:my_type::");
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, "doc:scheme:");
+ Document doc = new Document(docType, "id:ns:my_type::");
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 3d8875cff52..4e8e73dc6af 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, "doc:scheme:");
+ Document doc = new Document(docType, "id:ns:my_type::");
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 11e0cc783af..ba872b11c28 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("doc:test:ballooo"));
+ Document testDoc = new Document(docman.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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("doc:test:ballooo"));
+ Document testDoc = new Document(docman.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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("doc:test:ballooo"));
+ Document testDoc = new Document(docman.getDocumentType("foobar"), new DocumentId("id:ns:foobar::ballooo"));
FieldUpdate alter = FieldUpdate.create(strws);
FieldUpdate alter2 = FieldUpdate.create(strws2);
@@ -365,9 +365,7 @@ public class FieldUpdateTestCase {
@Test
public void testArithmeticUpdatesOnAutoCreatedWSetItemsAreZeroBased() {
- Document testDoc = new Document(
- docman.getDocumentType("foobar"),
- new DocumentId("doc:test:ballooo"));
+ Document testDoc = new Document(docman.getDocumentType("foobar"), new DocumentId("id:ns:foobar::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 e33dbfe8898..6e975a707cc 100755..100644
--- 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("doc:news:http://news6b", op.getDocument().getId().toString());
+ assertEquals("id:ns:news::http://news6b", op.getDocument().getId().toString());
// int array with text
try {
@@ -397,7 +397,7 @@ public class VespaXMLReaderTestCase {
}
op = parser.read();
- assertEquals("doc:news:http://news6j", op.getDocument().getId().toString());
+ assertEquals("id:ns: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("doc:news:http://news9a", op.getRemove().toString());
+ assertEquals("id:ns:news::http://news9a", op.getRemove().toString());
}
{
FeedOperation op = parser.read();
assertEquals(FeedOperation.Type.REMOVE, op.getType());
- assertEquals("doc:news:http://news9b", op.getRemove().toString());
+ assertEquals("id:ns:news::http://news9b", op.getRemove().toString());
}
{
// Remove without documentid. Not supported.
@@ -648,7 +648,7 @@ public class VespaXMLReaderTestCase {
}
{
FeedOperation op = parser.read();
- assertEquals("doc:news:http://news10e", op.getRemove().toString());
+ assertEquals("id:ns: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("doc:test:test:test"));
+ Document doc = new Document(manager.getDocumentType("news"), new DocumentId("id:ns:news::test"));
docUpdate.applyTo(doc);
}
@@ -798,7 +798,7 @@ public class VespaXMLReaderTestCase {
Document doc = op.getDocument();
assertEquals("outerdoc", doc.getDataType().getName());
- assertEquals("doc:outer:this:is:outer:doc", doc.getId().toString());
+ assertEquals("id:outer:outerdoc::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=\"doc:foo:bar:baz\"> \n" +
+ " <document documenttype=\"foo\" documentid=\"id:ns:foo::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=\"doc:foo:bar:baz\"> \n" +
+ " <document documenttype=\"foo\" documentid=\"id:ns:foo::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 99960b205b0..29621426a85 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 70)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 74)");
}
@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 74)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 78)");
}
@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 92)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 96)");
}
@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 76)");
+ "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 80)");
}
@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 70)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 74)");
}
@Test
@@ -141,10 +141,10 @@ public class VespaXmlFieldReaderTestCase {
docType.addField(field);
docManager.register(docType);
- String documentXml = "<document id='doc:scheme:' type='my_type'><" + field.getName() + ">" +
+ String documentXml = "<document id='id:ns:my_type::' type='my_type'><" + field.getName() + ">" +
fieldXml + "</" + field.getName() + "></document>";
InputStream in = new ByteArrayInputStream(documentXml.getBytes(StandardCharsets.UTF_8));
- Document doc = new Document(docType, "doc:scheme:");
+ Document doc = new Document(docType, "id:ns:my_type::");
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='doc:scheme:' type='my_type'>" +
+ "<document id='id:ns:my_type::' type='my_type'>" +
" <my_predicate>" + predicate + "</my_predicate>" +
"</document>");
assertRead(predicate,
- "<document id='doc:scheme:' type='my_type'>" +
+ "<document id='id:ns:my_type::' 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, "doc:scheme:");
+ Document doc = new Document(docType, "id:ns:my_type::");
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 424e8bb1bca..a6e14f25bea 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 79)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 82)");
}
@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 83)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 86)");
assertThrows(field,
"<assign fieldpath='my_field'><item>-129</item></assign>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 87)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 90)");
assertThrows(field,
"<add field='my_field'><item>-129</item></add>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 80)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 83)");
assertThrows(field,
"<add fieldpath='my_field'><item>-129</item></add>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 84)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 87)");
assertThrows(field,
"<remove field='my_field'><item>-129</item></remove>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 83)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 86)");
}
@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 87)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 90)");
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 91)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 94)");
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 84)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 87)");
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 88)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 91)");
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 87)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 90)");
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 105)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 108)");
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 109)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 112)");
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 102)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 105)");
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 106)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 109)");
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 105)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 108)");
}
@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 89)");
+ "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 92)");
assertThrows(field,
"<assign fieldpath='my_field'><my_byte>-129</my_byte></assign>",
- "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 93)");
+ "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 96)");
assertThrows(field,
"<add field='my_field'><my_byte>-129</my_byte></add>",
- "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 86)");
+ "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 89)");
assertThrows(field,
"<add fieldpath='my_field'><my_byte>-129</my_byte></add>",
- "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 90)");
+ "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 93)");
assertThrows(field,
"<remove field='my_field'><my_byte>-129</my_byte></remove>",
- "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 89)");
+ "Field 'my_byte': Invalid byte \"-129\". (at line 1, column 92)");
}
@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 83)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 86)");
assertThrows(field,
"<assign fieldpath='my_field'><item>-129</item></assign>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 87)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 90)");
assertThrows(field,
"<add field='my_field'><item>-129</item></add>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 80)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 83)");
assertThrows(field,
"<add fieldpath='my_field'><item>-129</item></add>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 84)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 87)");
assertThrows(field,
"<remove field='my_field'><item>-129</item></remove>",
- "Field 'my_field': Invalid byte \"-129\". (at line 1, column 83)");
+ "Field 'my_field': Invalid byte \"-129\". (at line 1, column 86)");
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='doc:scheme:' type='my_type' create-if-non-existent='illegal'></update>";
+ String documentXml = "<update id='id:ns:my_doc::' 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 74)", e.getMessage());
+ assertEquals(printStackTrace(e), "'create-if-non-existent' must be either 'true' or 'false', was 'illegal' (at line 1, column 77)", e.getMessage());
}
}
@@ -231,12 +231,12 @@ public class VespaXmlUpdateReaderTestCase {
}
private static DocumentUpdate readUpdate(Field field, String fieldXml) throws Exception {
- String documentXml = "<update id='doc:scheme:' type='my_type'>" + fieldXml + "</update>";
+ String documentXml = "<update id='id:ns:my_doc::' type='my_type'>" + fieldXml + "</update>";
return readUpdateHelper(field, documentXml);
}
private static DocumentUpdate readUpdate(boolean createIfNonExistent) throws Exception {
- String documentXml = "<update id='doc:scheme:' type='my_type' create-if-non-existent='" + (createIfNonExistent ? "true" : "false") + "'></update>";
+ String documentXml = "<update id='id:ns:my_doc::' 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, "doc:scheme:");
+ DocumentUpdate doc = new DocumentUpdate(docType, "id:ns:my_doc::");
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 73984f1746c..298960ff8ba 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=\"doc:foo:bar\" type=\"doctype\">" +
+ new ByteArrayInputStream(("<document id=\"id:ns:doctype::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=\"doc:foo:bar\" type=\"doctype\">" +
+ new ByteArrayInputStream(("<document id=\"id:ns:doctype::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=\"doc:foo:bar\" type=\"doctype\">" +
+ new ByteArrayInputStream(("<document id=\"id:ns:doctype::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=\"doc:foo:bar\" type=\"doctype\">" +
+ new ByteArrayInputStream(("<document id=\"id:ns:doctype::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=\"doc:foo:bar\" type=\"doctype\">" +
+ new ByteArrayInputStream(("<document id=\"id:ns:doctype::bar\" type=\"doctype\">" +
" <bytefield></bytefield>" +
"</document>").getBytes(StandardCharsets.UTF_8)), dtm);
new Document(documentReader);