aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/searchdefinition/ArraysTestCase.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
commit72231250ed81e10d66bfe70701e64fa5fe50f712 (patch)
tree2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /config-model/src/test/java/com/yahoo/searchdefinition/ArraysTestCase.java
Publish
Diffstat (limited to 'config-model/src/test/java/com/yahoo/searchdefinition/ArraysTestCase.java')
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/ArraysTestCase.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/ArraysTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/ArraysTestCase.java
new file mode 100644
index 00000000000..210f2d92ac0
--- /dev/null
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/ArraysTestCase.java
@@ -0,0 +1,34 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.searchdefinition;
+
+import com.yahoo.document.ArrayDataType;
+import com.yahoo.document.CollectionDataType;
+import com.yahoo.document.DataType;
+import com.yahoo.searchdefinition.document.SDField;
+import com.yahoo.searchdefinition.parser.ParseException;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+/**
+ * tests importing of document containing array type fields
+ *
+ * @author <a href="bratseth@yahoo-inc.com">Jon Bratseth</a>
+ */
+public class ArraysTestCase extends SearchDefinitionTestCase {
+
+ @Test
+ public void testArrayImporting() throws IOException, ParseException {
+ Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/arrays.sd");
+
+ SDField tags = (SDField)search.getDocument().getField("tags");
+ assertEquals(DataType.STRING, ((CollectionDataType)tags.getDataType()).getNestedType());
+
+ SDField ratings = (SDField)search.getDocument().getField("ratings");
+ assertTrue(ratings.getDataType() instanceof ArrayDataType);
+ assertEquals(DataType.INT, ((ArrayDataType)ratings.getDataType()).getNestedType());
+ }
+
+}