summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-03-24 16:24:54 +0100
committerGitHub <noreply@github.com>2022-03-24 16:24:54 +0100
commitba214e38d46c2e5805724f94cfd88b93cd92ffd2 (patch)
treee28a24bc299e00155b9e1420acdad6321e44df75
parentf416926eae65fd7e104ffcb2d6dd5cfc5f4e5672 (diff)
parent26cd6d14f516f7f734daebb27e4f86a2f656c42f (diff)
Merge pull request #21809 from vespa-engine/arnej/avoid-bad-getdatatype
Arnej/avoid bad getdatatype
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/parser/ConvertParsedTypes.java21
-rw-r--r--document/src/main/java/com/yahoo/document/DocumentTypeManager.java17
-rw-r--r--document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java2
-rw-r--r--document/src/test/java/com/yahoo/document/DataTypeTestCase.java6
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java18
-rw-r--r--document/src/test/java/com/yahoo/document/annotation/Bug4259784TestCase.java9
-rw-r--r--document/src/test/java/com/yahoo/document/annotation/Bug4261985TestCase.java9
-rwxr-xr-xdocument/src/test/java/com/yahoo/document/annotation/Bug4475379TestCase.java14
-rw-r--r--document/src/test/java/com/yahoo/document/annotation/DocTestCase.java3
-rwxr-xr-xdocument/src/test/java/com/yahoo/document/annotation/SystemTestCase.java19
-rw-r--r--document/src/test/java/com/yahoo/document/datatypes/StringTestCase.java14
-rw-r--r--documentgen-test/src/test/java/com/yahoo/vespa/config/DocumentGenPluginTest.java8
12 files changed, 92 insertions, 48 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ConvertParsedTypes.java b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ConvertParsedTypes.java
index 8e27b581769..3644cb9d924 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ConvertParsedTypes.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ConvertParsedTypes.java
@@ -248,11 +248,30 @@ public class ConvertParsedTypes {
return new NewDocumentReferenceDataType(findDocFromSchemas(ref.name()));
}
+ private DataType getBuiltinType(String name) {
+ switch (name) {
+ case "bool": return DataType.BOOL;
+ case "byte": return DataType.BYTE;
+ case "int": return DataType.INT;
+ case "long": return DataType.LONG;
+ case "string": return DataType.STRING;
+ case "float": return DataType.FLOAT;
+ case "double": return DataType.DOUBLE;
+ case "uri": return DataType.URI;
+ case "predicate": return DataType.PREDICATE;
+ case "raw": return DataType.RAW;
+ case "tag": return DataType.TAG;
+ case "float16": return DataType.FLOAT16;
+ default:
+ throw new IllegalArgumentException("Unknown builtin type: "+name);
+ }
+ }
+
private DataType resolveFromContext(ParsedType pType, ParsedDocument context) {
String name = pType.name();
switch (pType.getVariant()) {
case NONE: return DataType.NONE;
- case BUILTIN: return docMan.getDataType(name);
+ case BUILTIN: return getBuiltinType(name);
case POSITION: return PositionDataType.INSTANCE;
case ARRAY: return createArray(pType, context);
case WSET: return createWset(pType, context);
diff --git a/document/src/main/java/com/yahoo/document/DocumentTypeManager.java b/document/src/main/java/com/yahoo/document/DocumentTypeManager.java
index 7cbda1410c2..e8e3ef64c98 100644
--- a/document/src/main/java/com/yahoo/document/DocumentTypeManager.java
+++ b/document/src/main/java/com/yahoo/document/DocumentTypeManager.java
@@ -134,7 +134,24 @@ public class DocumentTypeManager {
return dataTypes.containsKey(code);
}
+ /**
+ * @deprecated //TODO Will be package-private or removed on Vespa 8
+ * Use constants and factories in DataType instead.
+ * For structs, use getStructType() in DocumentType.
+ * For annotation payloads, use getDataType() in AnnotationType.
+ **/
+ @Deprecated
public DataType getDataType(String name) {
+ return getDataTypeInternal(name);
+ }
+
+ /**
+ * For internal use only, avoid whenever possible.
+ * Use constants and factories in DataType instead.
+ * For structs, use getStructType() in DocumentType.
+ * For annotation payloads, use getDataType() in AnnotationType.
+ **/
+ DataType getDataTypeInternal(String name) {
if (name.startsWith("tensor(")) // built-in dynamic
return new TensorDataType(TensorType.fromSpec(name));
diff --git a/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java b/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java
index cb615c27116..662fe8665f3 100644
--- a/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java
+++ b/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java
@@ -395,7 +395,7 @@ public class DocumentTypeManagerConfigurer implements ConfigSubscriber.SingleSub
void createSimpleTypes() {
for (var typeconf : docTypeConfig.primitivetype()) {
- DataType type = manager.getDataType(typeconf.name());
+ DataType type = manager.getDataTypeInternal(typeconf.name());
if (! (type instanceof PrimitiveDataType)) {
throw new IllegalArgumentException("Needed primitive type for '"+typeconf.name()+"' [idx "+typeconf.idx()+"] but got: "+type);
}
diff --git a/document/src/test/java/com/yahoo/document/DataTypeTestCase.java b/document/src/test/java/com/yahoo/document/DataTypeTestCase.java
index 4e522af527f..c81018c723f 100644
--- a/document/src/test/java/com/yahoo/document/DataTypeTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DataTypeTestCase.java
@@ -34,9 +34,9 @@ public class DataTypeTestCase {
public void testTagType() {
DocumentTypeManager manager = new DocumentTypeManager();
//assertEquals(DataType.getWeightedSet(DataType.STRING,true,true),DataType.TAG.getBaseType());
- assertNotNull(manager.getDataType("tag"));
- assertEquals(DataType.TAG, manager.getDataType("tag"));
- assertEquals(manager.getDataType("tag").getCode(), 18);
+ assertNotNull(manager.getDataTypeInternal("tag"));
+ assertEquals(DataType.TAG, manager.getDataTypeInternal("tag"));
+ assertEquals(manager.getDataTypeInternal("tag").getCode(), 18);
assertEquals(DataType.getWeightedSet(DataType.STRING,true,true).getCode(), 18);
}
diff --git a/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java b/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java
index 5770b998c69..6829c7e6862 100644
--- a/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java
@@ -46,16 +46,16 @@ public class DocumentTypeManagerTestCase {
@Test
public void testBasicTypes() {
DocumentTypeManager dtm = new DocumentTypeManager();
- DataType intType = dtm.getDataType("int");
+ DataType intType = dtm.getDataTypeInternal("int");
assertSame(DataType.INT, intType);
- DataType stringType = dtm.getDataType("string");
+ DataType stringType = dtm.getDataTypeInternal("string");
assertSame(DataType.STRING, stringType);
- DataType longType = dtm.getDataType("long");
+ DataType longType = dtm.getDataTypeInternal("long");
assertSame(DataType.LONG, longType);
- DataType doubleType = dtm.getDataType("double");
+ DataType doubleType = dtm.getDataTypeInternal("double");
assertSame(DataType.DOUBLE, doubleType);
}
@@ -78,12 +78,12 @@ public class DocumentTypeManagerTestCase {
manager.register(docType2);
assertEquals(struct, manager.getDataType(struct.getId()));
- assertEquals(struct, manager.getDataType("mystruct"));
+ assertEquals(struct, manager.getDataTypeInternal("mystruct"));
assertEquals(wset1, manager.getDataType(wset1.getId()));
assertEquals(wset2, manager.getDataType(wset2.getId()));
assertEquals(array, manager.getDataType(array.getId()));
- assertEquals(docType, manager.getDataType("mydoc"));
- assertEquals(docType2, manager.getDataType("myotherdoc"));
+ assertEquals(docType, manager.getDataTypeInternal("mydoc"));
+ assertEquals(docType2, manager.getDataTypeInternal("myotherdoc"));
assertEquals(docType, manager.getDocumentType(new DataTypeName("mydoc")));
assertEquals(docType2, manager.getDocumentType(new DataTypeName("myotherdoc")));
}
@@ -418,13 +418,13 @@ search annotationsimplicitstruct {
DocumentTypeManager manager = createConfiguredManager("file:src/test/document/documentmanager.structsanyorder.cfg");
- StructDataType foo = (StructDataType) manager.getDataType("foo");
+ StructDataType foo = (StructDataType) manager.getDataTypeInternal("foo");
assertNotNull(foo);
assertEquals(1, foo.getFields().size());
Field foos1 = foo.getField("s1");
assertSame(DataType.INT, foos1.getDataType());
- StructDataType sct = (StructDataType) manager.getDataType("sct");
+ StructDataType sct = (StructDataType) manager.getDataTypeInternal("sct");
assertNotNull(sct);
assertEquals(4, sct.getFields().size());
Field s1 = sct.getField("s1");
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 afe327b7179..20f7c38cb5f 100644
--- a/document/src/test/java/com/yahoo/document/annotation/Bug4259784TestCase.java
+++ b/document/src/test/java/com/yahoo/document/annotation/Bug4259784TestCase.java
@@ -39,6 +39,7 @@ public class Bug4259784TestCase {
private void annotate(Document document, DocumentTypeManager manager) {
+ DocumentType docType = manager.getDocumentType("blog");
AnnotationTypeRegistry registry = manager.getAnnotationTypeRegistry();
AnnotationType company = registry.getType("company");
@@ -81,25 +82,25 @@ public class Bug4259784TestCase {
Annotation compAn = new Annotation(company, companyValue);
tree.annotate(span2, compAn);
- Struct locationVal = new Struct(manager.getDataType("annotation.location"));
+ Struct locationVal = new Struct(location.getDataType());
locationVal.setFieldValue("lat", 37.774929);
locationVal.setFieldValue("lon", -122.419415);
Annotation locAnnotation = new Annotation(location, locationVal);
tree.annotate(span3, locAnnotation);
- Struct dirValue1 = new Struct(manager.getDataType("annotation.person"));
+ Struct dirValue1 = new Struct(person.getDataType());
dirValue1.setFieldValue("name", "Jonathan Schwartz");
Annotation dirAnnotation1 = new Annotation(person, dirValue1);
tree.annotate(span5, dirAnnotation1);
- Struct dirValue2 = new Struct(manager.getDataType("annotation.person"));
+ Struct dirValue2 = new Struct(person.getDataType());
dirValue2.setFieldValue("name", "Scott Mcnealy");
Annotation dirAnnotation2 = new Annotation(person, dirValue2);
tree.annotate(span6, dirAnnotation2);
- Struct indValue = new Struct(manager.getDataType("annotation.industry"));
+ Struct indValue = new Struct(industry.getDataType());
indValue.setFieldValue("vertical", "Manufacturing");
Annotation indAn = new Annotation(industry, indValue);
tree.annotate(span4, indAn);
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 b98c916862c..96b4d0f018c 100644
--- a/document/src/test/java/com/yahoo/document/annotation/Bug4261985TestCase.java
+++ b/document/src/test/java/com/yahoo/document/annotation/Bug4261985TestCase.java
@@ -38,6 +38,7 @@ public class Bug4261985TestCase {
}
public void annotate(Document document, DocumentTypeManager manager) {
+ DocumentType docType = manager.getDocumentType("blog");
AnnotationTypeRegistry registry = manager.getAnnotationTypeRegistry();
AnnotationType company = registry.getType("company");
@@ -90,7 +91,7 @@ public class Bug4261985TestCase {
Struct companyValue = (Struct) company.getDataType().createFieldValue();
companyValue.setFieldValue("name", "Sun");
- Struct locationVal = new Struct(manager.getDataType("annotation.location"));
+ Struct locationVal = new Struct(location.getDataType());
locationVal.setFieldValue("lat", 37.774929);
locationVal.setFieldValue("lon", -122.419415);
Annotation locAnnotation = new Annotation(location, locationVal);
@@ -106,10 +107,10 @@ public class Bug4261985TestCase {
companyValue.setFieldValue(compLocField, compLocFieldVal);
companyValue.setFieldValue("vertical", "software");
- Struct dirValue1 = new Struct(manager.getDataType("annotation.person"));
+ Struct dirValue1 = new Struct(person.getDataType());
dirValue1.setFieldValue("name", "Jonathan Schwartz");
Annotation dirAnnotation1 = new Annotation(person, dirValue1);
- Struct dirValue2 = new Struct(manager.getDataType("annotation.person"));
+ Struct dirValue2 = new Struct(person.getDataType());
dirValue2.setFieldValue("name", "Scott Mcnealy");
Annotation dirAnnotation2 = new Annotation(person, dirValue2);
Field dirField = ((StructDataType) company.getDataType()).getField("directors");
@@ -142,7 +143,7 @@ public class Bug4261985TestCase {
tree.annotate(span5, dirAnnotation1);
tree.annotate(span6, dirAnnotation2);
- Struct indValue = new Struct(manager.getDataType("annotation.industry"));
+ Struct indValue = new Struct(industry.getDataType());
indValue.setFieldValue("vertical", "Manufacturing");
Annotation indAn = new Annotation(industry, indValue);
tree.annotate(span4, indAn);
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 69003ebd036..e6afeedd7f1 100755
--- a/document/src/test/java/com/yahoo/document/annotation/Bug4475379TestCase.java
+++ b/document/src/test/java/com/yahoo/document/annotation/Bug4475379TestCase.java
@@ -37,6 +37,8 @@ public class Bug4475379TestCase {
}
public void annotate(DocumentTypeManager manager, Document document) {
+ DocumentType docType = manager.getDocumentType("blog");
+
AnnotationTypeRegistry registry = manager.getAnnotationTypeRegistry();
AnnotationType company = registry.getType("company");
@@ -64,17 +66,17 @@ public class Bug4475379TestCase {
compAn1 = new Annotation(company, companyValue1);
}
{
- Struct personValue1 = new Struct(manager.getDataType("annotation.person"));
+ Struct personValue1 = new Struct(person.getDataType());
personValue1.setFieldValue("name", new StringFieldValue("Richard Bair"));
personAn1 = new Annotation(person, personValue1);
}
{
- Struct locValue1 = new Struct(manager.getDataType("annotation.location"));
+ Struct locValue1 = new Struct(location.getDataType());
locValue1.setFieldValue("name", new StringFieldValue("Prinsens Gate"));
locAn1 = new Annotation(location, locValue1);
}
{
- Struct indValue1 = new Struct(manager.getDataType("annotation.industry"));
+ Struct indValue1 = new Struct(industry.getDataType());
indValue1.setFieldValue("vertical", new StringFieldValue("Software Services"));
indAn1 = new Annotation(industry, indValue1);
}
@@ -89,17 +91,17 @@ public class Bug4475379TestCase {
compAn2 = new Annotation(company, companyValue2);
}
{
- Struct personValue2 = new Struct(manager.getDataType("annotation.person"));
+ Struct personValue2 = new Struct(person.getDataType());
personValue2.setFieldValue("name", new StringFieldValue("Kim Johansen"));
personAn2 = new Annotation(person, personValue2);
}
{
- Struct locValue2 = new Struct(manager.getDataType("annotation.location"));
+ Struct locValue2 = new Struct(location.getDataType());
locValue2.setFieldValue("name", new StringFieldValue("RT Nagar"));
locAn2 = new Annotation(location, locValue2);
}
{
- Struct indValue2 = new Struct(manager.getDataType("annotation.industry"));
+ Struct indValue2 = new Struct(industry.getDataType());
indValue2.setFieldValue("vertical", new StringFieldValue("Software Consulting"));
indAn2 = new Annotation(industry, indValue2);
}
diff --git a/document/src/test/java/com/yahoo/document/annotation/DocTestCase.java b/document/src/test/java/com/yahoo/document/annotation/DocTestCase.java
index fafca72ba7c..e260754bd5d 100644
--- a/document/src/test/java/com/yahoo/document/annotation/DocTestCase.java
+++ b/document/src/test/java/com/yahoo/document/annotation/DocTestCase.java
@@ -242,7 +242,8 @@ public class DocTestCase {
SpanList root = new SpanList();
SpanTree tree = new SpanTree("html", root);
- StructDataType positionType = (StructDataType) dtm.getDataType("position");
+ var docType = dtm.getDocumentType("blogpost");
+ StructDataType positionType = docType.getDeclaredStructType("position");
AnnotationType textType = atr.getType("text");
AnnotationType beginTag = atr.getType("begintag");
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 678639c89d9..fa2e6108afb 100755
--- a/document/src/test/java/com/yahoo/document/annotation/SystemTestCase.java
+++ b/document/src/test/java/com/yahoo/document/annotation/SystemTestCase.java
@@ -5,6 +5,7 @@ import com.yahoo.document.Document;
import com.yahoo.document.DocumentType;
import com.yahoo.document.DocumentTypeManager;
import com.yahoo.document.DocumentTypeManagerConfigurer;
+import com.yahoo.document.StructDataType;
import com.yahoo.document.datatypes.StringFieldValue;
import com.yahoo.document.datatypes.Struct;
import com.yahoo.document.serialization.*;
@@ -42,33 +43,35 @@ public class SystemTestCase {
root.add(dateSpan);
root.add(placeSpan);
- Struct personValue = new Struct(manager.getDataType("annotation.person"));
+ DocumentType docType = document.getDataType();
+ Struct personValue = new Struct(personType.getDataType());
personValue.setFieldValue("name", "george washington");
Annotation person = new Annotation(personType, personValue);
tree.annotate(personSpan, person);
- Struct artistValue = new Struct(manager.getDataType("annotation.artist"));
+ Struct artistValue = new Struct((StructDataType) artistType.getDataType());
artistValue.setFieldValue("name", "elvis presley");
artistValue.setFieldValue("instrument", 20);
Annotation artist = new Annotation(artistType, artistValue);
tree.annotate(artistSpan, artist);
- Struct dateValue = new Struct(manager.getDataType("annotation.date"));
+ Struct dateValue = new Struct((StructDataType) dateType.getDataType());
dateValue.setFieldValue("exacttime", 123456789L);
Annotation date = new Annotation(dateType, dateValue);
tree.annotate(dateSpan, date);
- Struct placeValue = new Struct(manager.getDataType("annotation.place"));
+ Struct placeValue = new Struct((StructDataType) placeType.getDataType());
placeValue.setFieldValue("lat", 1467L);
placeValue.setFieldValue("lon", 789L);
Annotation place = new Annotation(placeType, placeValue);
tree.annotate(placeSpan, place);
- Struct eventValue = new Struct(manager.getDataType("annotation.event"));
+ var eventStruct = (StructDataType) eventType.getDataType();
+ Struct eventValue = new Struct(eventStruct);
eventValue.setFieldValue("description", "Big concert");
- eventValue.setFieldValue("person", new AnnotationReference((AnnotationReferenceDataType) manager.getDataType("annotationreference<person>"), person));
- eventValue.setFieldValue("date", new AnnotationReference((AnnotationReferenceDataType) manager.getDataType("annotationreference<date>"), date));
- eventValue.setFieldValue("place", new AnnotationReference((AnnotationReferenceDataType) manager.getDataType("annotationreference<place>"), place));
+ eventValue.setFieldValue("person", new AnnotationReference((AnnotationReferenceDataType) eventStruct.getField("person").getDataType(), person));
+ eventValue.setFieldValue("date", new AnnotationReference((AnnotationReferenceDataType) eventStruct.getField("date").getDataType(), date));
+ eventValue.setFieldValue("place", new AnnotationReference((AnnotationReferenceDataType) eventStruct.getField("place").getDataType(), place));
Annotation event = new Annotation(eventType, eventValue);
tree.annotate(root, event);
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 fe52e3e8485..9c38656a984 100644
--- a/document/src/test/java/com/yahoo/document/datatypes/StringTestCase.java
+++ b/document/src/test/java/com/yahoo/document/datatypes/StringTestCase.java
@@ -256,17 +256,17 @@ public class StringTestCase extends AbstractTypesTest {
Annotation compAn = new Annotation(company, companyValue);
tree.annotate(companySpan, compAn);
- Struct personValue = new Struct(manager.getDataType("annotation.person"));
+ Struct personValue = new Struct(person.getDataType());
personValue.setFieldValue("name", new StringFieldValue("Richard Bair"));
Annotation personAn = new Annotation(person, personValue);
tree.annotate(personSpan, personAn);
- Struct locValue = new Struct(manager.getDataType("annotation.location"));
+ Struct locValue = new Struct(location.getDataType());
locValue.setFieldValue("name", new StringFieldValue("Prinsens Gate"));
Annotation loc = new Annotation(location, locValue);
tree.annotate(locationSpan, loc);
- Struct locValue2 = new Struct(manager.getDataType("annotation.location"));
+ Struct locValue2 = new Struct(location.getDataType());
locValue2.setFieldValue("name", new StringFieldValue("Kongens Gate"));
Annotation locAn = new Annotation(location, locValue2);
tree.annotate(locationSpan, locAn);
@@ -281,17 +281,17 @@ public class StringTestCase extends AbstractTypesTest {
branch.add(span3);
branch.add(span2);
- Struct industryValue = new Struct(manager.getDataType("annotation.industry"));
+ Struct industryValue = new Struct(industry.getDataType());
industryValue.setFieldValue("vertical", new StringFieldValue("Manufacturing"));
Annotation ind = new Annotation(industry, industryValue);
tree.annotate(span1, ind);
- Struct pValue = new Struct(manager.getDataType("annotation.person"));
+ Struct pValue = new Struct(person.getDataType());
pValue.setFieldValue("name", new StringFieldValue("Praveen Mohan"));
Annotation pAn = new Annotation(person, pValue);
tree.annotate(span2, pAn);
- Struct lValue = new Struct(manager.getDataType("annotation.location"));
+ Struct lValue = new Struct(location.getDataType());
lValue.setFieldValue("name", new StringFieldValue("Embassy Golf Links"));
Annotation locn = new Annotation(location, lValue);
tree.annotate(span3, locn);
@@ -305,7 +305,7 @@ public class StringTestCase extends AbstractTypesTest {
Annotation cAn = new Annotation(company, cValue);
tree.annotate(branch, cAn);
- Struct pVal = new Struct(manager.getDataType("annotation.person"));
+ Struct pVal = new Struct(person.getDataType());
pVal.setFieldValue("name", new StringFieldValue("Kim Omar"));
Annotation an = new Annotation(person, pVal);
tree.annotate(root, an);
diff --git a/documentgen-test/src/test/java/com/yahoo/vespa/config/DocumentGenPluginTest.java b/documentgen-test/src/test/java/com/yahoo/vespa/config/DocumentGenPluginTest.java
index dffe388546f..2284e3e010c 100644
--- a/documentgen-test/src/test/java/com/yahoo/vespa/config/DocumentGenPluginTest.java
+++ b/documentgen-test/src/test/java/com/yahoo/vespa/config/DocumentGenPluginTest.java
@@ -592,10 +592,10 @@ public class DocumentGenPluginTest {
bookGeneric.setFieldValue("title", title);
bookGeneric.setFieldValue("year", new IntegerFieldValue(1851));
- Struct myS0 = new Struct(mgr.getDataType("ss0"));
+ Struct myS0 = new Struct(bookT.getStructType("ss0"));
myS0.setFieldValue("s0", new StringFieldValue("My s0"));
myS0.setFieldValue("d0", new DoubleFieldValue(99));
- Struct myS1 = new Struct(mgr.getDataType("ss1"));
+ Struct myS1 = new Struct(bookT.getStructType("ss1"));
myS1.setFieldValue("s1", new StringFieldValue("My s1"));
myS1.setFieldValue("l1", new LongFieldValue(89));
Array<StringFieldValue> myAs1 = new Array<>(DataType.getArray(DataType.STRING));
@@ -648,10 +648,10 @@ public class DocumentGenPluginTest {
assertEquals(((StructuredFieldValue) titleAnnCheck.getFieldValue()).getFieldValue("exacttime").getWrappedValue(), 99L);
bookGeneric.setFieldValue("year", new IntegerFieldValue(1851));
- Struct myS0 = new Struct(mgr.getDataType("ss0"));
+ Struct myS0 = new Struct(bookT.getStructType("ss0"));
myS0.setFieldValue("s0", new StringFieldValue("My s0"));
myS0.setFieldValue("d0", new DoubleFieldValue(99));
- Struct myS1 = new Struct(mgr.getDataType("ss1"));
+ Struct myS1 = new Struct(bookT.getStructType("ss1"));
myS1.setFieldValue("s1", new StringFieldValue("My s1"));
myS1.setFieldValue("l1", new LongFieldValue(89));
Array<StringFieldValue> myAs1 = new Array<>(DataType.getArray(DataType.STRING));