aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java')
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java44
1 files changed, 42 insertions, 2 deletions
diff --git a/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java b/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java
index b89ed2b6b08..622c7b2237f 100644
--- a/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java
@@ -599,10 +599,50 @@ search annotationsimplicitstruct {
assertTrue(array.getNestedType() instanceof StructDataType);
}
+ @Test
+ public void declared_struct_types_available() {
+ var manager = DocumentTypeManager.fromFile("src/test/document/documentmanager.declstruct.cfg");
+ var docType = manager.getDocumentType("foo");
+ var struct = docType.getDeclaredStructType("mystructinfoo");
+ assertNotNull(struct);
+ assertNotNull(struct.getField("f1"));
+ struct = docType.getDeclaredStructType("mystructinbar");
+ assertNull(struct);
+ struct = docType.getDeclaredStructType("mystructinfoobar");
+ assertNull(struct);
+ struct = docType.getDeclaredStructType("mystruct");
+ assertNotNull(struct);
+ assertNotNull(struct.getField("f0"));
+
+ docType = manager.getDocumentType("bar");
+ struct = docType.getDeclaredStructType("mystructinfoo");
+ assertNull(struct);
+ struct = docType.getDeclaredStructType("mystructinbar");
+ assertNotNull(struct);
+ assertNotNull(struct.getField("f2"));
+ struct = docType.getDeclaredStructType("mystructinfoobar");
+ assertNull(struct);
+ struct = docType.getDeclaredStructType("mystruct");
+ assertNotNull(struct);
+ assertNotNull(struct.getField("f0"));
+
+ docType = manager.getDocumentType("foobar");
+ struct = docType.getDeclaredStructType("mystructinfoo");
+ assertNotNull(struct);
+ assertNotNull(struct.getField("f1"));
+ struct = docType.getDeclaredStructType("mystructinbar");
+ assertNotNull(struct);
+ assertNotNull(struct.getField("f2"));
+ struct = docType.getDeclaredStructType("mystructinfoobar");
+ assertNotNull(struct);
+ assertNotNull(struct.getField("f3"));
+ struct = docType.getDeclaredStructType("mystruct");
+ assertNotNull(struct);
+ assertNotNull(struct.getField("f0"));
+ }
+
// TODO test clone(). Also fieldSets not part of clone()..!
// TODO add imported field to equals()/hashCode() for DocumentType? fieldSets not part of this...
- // TODO test reference to own doc type
-
}