diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-09-19 09:15:07 -0700 |
---|---|---|
committer | Jon Bratseth <bratseth@oath.com> | 2018-09-19 09:15:07 -0700 |
commit | 86598b9ce415228981ef9ae3da0e3b9baf10283b (patch) | |
tree | db40cf9b808494266d60bbaa52da8f57c57b6a9d /config-model | |
parent | a280933161001785f900d381357e6802ee274ada (diff) |
Remove dead code
Diffstat (limited to 'config-model')
18 files changed, 32 insertions, 337 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/UnprocessingSearchBuilder.java b/config-model/src/main/java/com/yahoo/searchdefinition/UnprocessingSearchBuilder.java deleted file mode 100644 index 6c12c6c94d1..00000000000 --- a/config-model/src/main/java/com/yahoo/searchdefinition/UnprocessingSearchBuilder.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.searchdefinition; - -import com.yahoo.search.query.profile.QueryProfileRegistry; -import com.yahoo.searchdefinition.parser.ParseException; -import com.yahoo.config.application.api.ApplicationPackage; -import com.yahoo.config.application.api.DeployLogger; -import com.yahoo.vespa.model.container.search.QueryProfiles; - -import java.io.IOException; - -/** - * A SearchBuilder that does not run the processing chain for searches - */ -public class UnprocessingSearchBuilder extends SearchBuilder { - - public UnprocessingSearchBuilder(ApplicationPackage app, - RankProfileRegistry rankProfileRegistry, - QueryProfileRegistry queryProfileRegistry) { - super(app, rankProfileRegistry, queryProfileRegistry); - } - - public UnprocessingSearchBuilder() { - super(); - } - - public UnprocessingSearchBuilder(RankProfileRegistry rankProfileRegistry, - QueryProfileRegistry queryProfileRegistry) { - super(rankProfileRegistry, queryProfileRegistry); - } - - @Override - public void process(Search search, DeployLogger deployLogger, QueryProfiles queryProfiles, boolean validate) { - // empty - } - - public static Search buildUnprocessedFromFile(String fileName) throws IOException, ParseException { - SearchBuilder builder = new UnprocessingSearchBuilder(); - builder.importFile(fileName); - builder.build(); - return builder.getSearch(); - } - -} diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java index e6b6c58cb38..133adb45dd9 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java @@ -3,7 +3,6 @@ package com.yahoo.searchdefinition.derived; import com.yahoo.document.DocumenttypesConfig; import com.yahoo.document.config.DocumentmanagerConfig; import com.yahoo.searchdefinition.SearchBuilder; -import com.yahoo.searchdefinition.UnprocessingSearchBuilder; import com.yahoo.searchdefinition.parser.ParseException; import com.yahoo.vespa.configmodel.producers.DocumentManager; import com.yahoo.vespa.configmodel.producers.DocumentTypes; @@ -18,25 +17,6 @@ import java.util.List; */ public class Deriver { - /** - * Derives only document manager. - * - * - * @param sdFileNames The name of the search definition files to derive from. - * @param toDir The directory to write configuration to. - * @return The list of Search objects, possibly "unproper ones", from sd files containing only document - */ - public static SearchBuilder deriveDocuments(List<String> sdFileNames, String toDir) { - SearchBuilder builder = getUnprocessingSearchBuilder(sdFileNames); - DocumentmanagerConfig.Builder documentManagerCfg = new DocumentManager().produce(builder.getModel(), new DocumentmanagerConfig.Builder()); - try { - DerivedConfiguration.exportDocuments(documentManagerCfg, toDir); - } catch (IOException e) { - throw new IllegalArgumentException(e); - } - return builder; - } - public static SearchBuilder getSearchBuilder(List<String> sds) { SearchBuilder builder = new SearchBuilder(); try { @@ -50,19 +30,6 @@ public class Deriver { return builder; } - public static SearchBuilder getUnprocessingSearchBuilder(List<String> sds) { - SearchBuilder builder = new UnprocessingSearchBuilder(); - try { - for (String s : sds) { - builder.importFile(s); - } - } catch (ParseException | IOException e) { - throw new IllegalArgumentException(e); - } - builder.build(); - return builder; - } - public static DocumentmanagerConfig.Builder getDocumentManagerConfig(String sd) { return getDocumentManagerConfig(Collections.singletonList(sd)); } diff --git a/config-model/src/test/examples/attributeindex.sd b/config-model/src/test/examples/attributeindex.sd deleted file mode 100644 index a35be556467..00000000000 --- a/config-model/src/test/examples/attributeindex.sd +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -search attributeindex { - document attributeindex { - - field nosettings type string { - indexing: summary | attribute | index - } - - # Attribute and index have different names - field specifyname type string { - indexing: summary | attribute newname | index - } - - # # index-to: with same name as attribute - field specifyname2 type string { - indexing: summary | attribute newname2 | index - # index-to: newname2 - } - - field withstaticrankname type string { - indexing: summary | attribute | index | attribute someothername - } - } -} diff --git a/config-model/src/test/examples/attributeproperties1.sd b/config-model/src/test/examples/attributeproperties1.sd deleted file mode 100644 index 233e6656866..00000000000 --- a/config-model/src/test/examples/attributeproperties1.sd +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -search bolding { - document test { - - # Setting attribute properties for a non-existent attribute should fail - field batchid type int { - indexing: summary | index - attribute { - prefetch - } - } - - # ... but this is OK - field anotherbatchid type int { - indexing: summary | index | attribute - attribute { - prefetch - } - } - } -} diff --git a/config-model/src/test/examples/attributeproperties2.sd b/config-model/src/test/examples/attributeproperties2.sd deleted file mode 100644 index 9c5e3e1a07f..00000000000 --- a/config-model/src/test/examples/attributeproperties2.sd +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -search bolding { - document bolding { - - # This is how it usually should be - field anotherbatchid type int { - indexing: summary | index | attribute - attribute { - prefetch - } - attribute: huge - } - - # The attribute is created in the next field - field bar type int { - indexing: summary | index - attribute { - prefetch - } - } - - # Creates attribute for the previous field - field foo type int { - indexing: input bar | attribute bar - } - } -} diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/ArraysTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/ArraysTestCase.java index 76ea16e47aa..846166ae93c 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/ArraysTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/ArraysTestCase.java @@ -12,6 +12,7 @@ import java.io.IOException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; + /** * tests importing of document containing array type fields * @@ -21,7 +22,7 @@ public class ArraysTestCase extends SearchDefinitionTestCase { @Test public void testArrayImporting() throws IOException, ParseException { - Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/arrays.sd"); + Search search = SearchBuilder.buildFromFile("src/test/examples/arrays.sd"); SDField tags = (SDField)search.getDocument().getField("tags"); assertEquals(DataType.STRING, ((CollectionDataType)tags.getDataType()).getNestedType()); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/ReservedWordsAsFieldNamesTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/ReservedWordsAsFieldNamesTestCase.java index 376832c1649..5a5fc1cc312 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/ReservedWordsAsFieldNamesTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/ReservedWordsAsFieldNamesTestCase.java @@ -15,7 +15,7 @@ public class ReservedWordsAsFieldNamesTestCase extends SearchDefinitionTestCase @Test public void testIt() throws IOException, ParseException { - Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/reserved_words_as_field_names.sd"); + Search search = SearchBuilder.buildFromFile("src/test/examples/reserved_words_as_field_names.sd"); assertNotNull(search.getDocument().getField("inline")); assertNotNull(search.getDocument().getField("constants")); assertNotNull(search.getDocument().getField("reference")); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/SearchImporterTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/SearchImporterTestCase.java index 82c03c02f61..127ed7a528b 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/SearchImporterTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/SearchImporterTestCase.java @@ -5,7 +5,11 @@ import com.yahoo.config.model.application.provider.BaseDeployLogger; import com.yahoo.document.DataType; import com.yahoo.document.Document; import com.yahoo.search.query.profile.QueryProfileRegistry; -import com.yahoo.searchdefinition.document.*; +import com.yahoo.searchdefinition.document.Attribute; +import com.yahoo.searchdefinition.document.RankType; +import com.yahoo.searchdefinition.document.SDDocumentType; +import com.yahoo.searchdefinition.document.SDField; +import com.yahoo.searchdefinition.document.Stemming; import com.yahoo.searchdefinition.parser.ParseException; import com.yahoo.searchdefinition.processing.MakeAliases; import com.yahoo.vespa.documentmodel.SummaryTransform; @@ -27,7 +31,7 @@ public class SearchImporterTestCase extends SearchDefinitionTestCase { @Test public void testSimpleImporting() throws IOException, ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); - SearchBuilder sb = new UnprocessingSearchBuilder(rankProfileRegistry, new QueryProfileRegistry()); + SearchBuilder sb = new SearchBuilder(rankProfileRegistry, new QueryProfileRegistry()); sb.importFile("src/test/examples/simple.sd"); sb.build(); Search search = sb.getSearch(); @@ -36,7 +40,7 @@ public class SearchImporterTestCase extends SearchDefinitionTestCase { SDDocumentType document = search.getDocument(); assertEquals("simple", document.getName()); - assertEquals(12, document.getFieldCount()); + assertEquals(25, document.getFieldCount()); SDField field; Attribute attribute; @@ -46,7 +50,7 @@ public class SearchImporterTestCase extends SearchDefinitionTestCase { // First field field=(SDField) document.getField("title"); assertEquals(DataType.STRING,field.getDataType()); - assertEquals("{ summary | index; }", field.getIndexingScript().toString()); + assertEquals("{ input title | tokenize normalize stem:\"SHORTEST\" | summary title | index title; }", field.getIndexingScript().toString()); assertTrue(!search.getIndex("default").isPrefix()); assertTrue(search.getIndex("title").isPrefix()); Iterator<String> titleAliases=search.getIndex("title").aliasIterator(); @@ -85,7 +89,7 @@ public class SearchImporterTestCase extends SearchDefinitionTestCase { // Fifth field field=(SDField) document.getField("popularity"); - assertEquals("{ attribute; }", + assertEquals("{ input popularity | attribute popularity; }", field.getIndexingScript().toString()); // Sixth field @@ -96,19 +100,19 @@ public class SearchImporterTestCase extends SearchDefinitionTestCase { // Seventh field field= search.getConcreteField("categories"); - assertEquals("{ input categories_src | lowercase | normalize | index; }", + assertEquals("{ input categories_src | lowercase | normalize | tokenize normalize stem:\"SHORTEST\" | index categories; }", field.getIndexingScript().toString()); assertTrue(!field.isHeader()); // Eight field field= search.getConcreteField("categoriesagain"); - assertEquals("{ input categoriesagain_src | lowercase | normalize | index; }", + assertEquals("{ input categoriesagain_src | lowercase | normalize | tokenize normalize stem:\"SHORTEST\" | index categoriesagain; }", field.getIndexingScript().toString()); assertTrue(field.isHeader()); // Ninth field field= search.getConcreteField("exactemento"); - assertEquals("{ input exactemento_src | lowercase | index | summary; }", + assertEquals("{ input exactemento_src | lowercase | tokenize normalize stem:\"SHORTEST\" | index exactemento | summary exactemento; }", field.getIndexingScript().toString()); // Tenth field @@ -153,7 +157,7 @@ public class SearchImporterTestCase extends SearchDefinitionTestCase { assertEquals("exact",exact.getName()); assertEquals(Stemming.NONE,exact.getStemming()); assertTrue(!exact.getNormalizing().doRemoveAccents()); - assertEquals("{ input title . \" \" . input category | summary | index; }", + assertEquals("{ input title . \" \" . input category | tokenize | summary exact | index exact; }", exact.getIndexingScript().toString()); assertEquals(RankType.IDENTITY, exact.getRankType()); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/StemmingSettingTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/StemmingSettingTestCase.java index 5b95789bea4..defff99d51e 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/StemmingSettingTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/StemmingSettingTestCase.java @@ -20,7 +20,7 @@ public class StemmingSettingTestCase extends SearchDefinitionTestCase { @Test public void testStemmingSettings() throws IOException, ParseException { - Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/stemmingsetting.sd"); + Search search = SearchBuilder.buildFromFile("src/test/examples/stemmingsetting.sd"); SDField artist = (SDField)search.getDocument().getField("artist"); assertEquals(Stemming.SHORTEST, artist.getStemming(search)); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/DocumentDeriverTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/DocumentDeriverTestCase.java index 8e0f77c941c..424fa8fd4a9 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/DocumentDeriverTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/DocumentDeriverTestCase.java @@ -16,35 +16,10 @@ import static org.junit.Assert.*; /** * Tests deriving of documentmanager * - * @author <a href="mailto:mathiasm@yahoo-inc.com">Mathias Moelster Lidal</a> + * @author Mathias Moelster Lidal */ public class DocumentDeriverTestCase extends AbstractExportingTestCase { - @Test - public void testDocumentDeriving() { - String root = "src/test/derived/documentderiver/"; - - List<String> files = new ArrayList<>(); - files.add(root + "newsarticle.sd"); - files.add(root + "newssummary.sd"); - files.add(root + "music.sd"); - files.add(root + "mail.sd"); - files.add(root + "compression_header.sd"); - files.add(root + "compression_both.sd"); - files.add(root + "compression_body.sd"); - - File toDir = new File("temp/documentderiver/"); - toDir.mkdir(); - - SearchBuilder builder = Deriver.deriveDocuments(files, toDir.getPath()); - try { - assertEqualFiles(root + "documentmanager.cfg", toDir.getPath() + "/documentmanager.cfg"); - } catch (IOException e) { - throw new RuntimeException("Exception while comparing files", e); - } - SDDocumentType doc = builder.getSearch("newsarticle").getDocument(); - assertNotNull(doc); - } @Test public void testStructTypesNotUsed() { String root = "src/test/derived/documentderiver/"; @@ -55,8 +30,6 @@ public class DocumentDeriverTestCase extends AbstractExportingTestCase { File toDir = new File("temp/structtypesnotused/"); toDir.mkdir(); - Deriver.deriveDocuments(files, toDir.getPath()); - DocumentTypeManager dtm = new DocumentTypeManager(); int numBuiltInTypes = dtm.getDataTypes().size(); dtm.configure("file:" + toDir.getPath() + "/documentmanager.cfg"); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/InheritanceTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/InheritanceTestCase.java index 2833e0ef004..f37a39d6f93 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/InheritanceTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/InheritanceTestCase.java @@ -158,18 +158,4 @@ public class InheritanceTestCase extends AbstractExportingTestCase { assertEquals(new Index("prefixed", true), childSearch.getIndex("prefixed")); } - @Test - public void testFailTypesMismatch() throws IOException, ParseException { - String root = "src/test/derived/inheritancebadtypes/"; - List<String> files = new LinkedList<>(); - files.add(root + "parent.sd"); - files.add(root + "child.sd"); - File toDir = tmpDir.newFolder("to"); - try { - Deriver.deriveDocuments(files, toDir.getPath()); - fail("Import of child SD with type mismatch worked."); - } catch (RuntimeException e) { - assertTrue(e.getMessage().matches(".*already contains field 'a'.*")); - } - } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/MailTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/MailTestCase.java index 8cf1846ed04..187e766c315 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/MailTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/MailTestCase.java @@ -1,25 +1,13 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchdefinition.derived; -import com.yahoo.config.ConfigInstance; -import com.yahoo.document.config.DocumentmanagerConfig; import com.yahoo.searchdefinition.SearchBuilder; -import com.yahoo.searchdefinition.UnprocessingSearchBuilder; import com.yahoo.searchdefinition.parser.ParseException; -import com.yahoo.vespa.model.VespaModel; -import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg; import org.junit.Test; -import org.xml.sax.SAXException; - -import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; /** - * Tests VDS+streaming configuration deriving + * Tests streaming configuration deriving * * @author bratseth */ @@ -33,22 +21,4 @@ public class MailTestCase extends AbstractExportingTestCase { assertCorrectDeriving(sb, dir); } - @Test - public void testMailDocumentsonlyDeriving() { - String root = "src/test/derived/mail/"; - File toDir = new File("temp/documentderiver/"); - if (!toDir.exists()) { - toDir.mkdir(); - } - List<String> files = new ArrayList<>(); - files.add(root + "mail.sd"); - Deriver.deriveDocuments(files, toDir.getPath()); - try { - assertEqualFiles(root + "onlydoc/documentmanager.cfg", - toDir.getPath() + "/documentmanager.cfg"); - } catch (IOException e) { - throw new RuntimeException("Exception while comparing files", e); - } - } - } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/StreamingStructTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/StreamingStructTestCase.java index 1691d463fad..1be9ee3f465 100755 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/StreamingStructTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/StreamingStructTestCase.java @@ -22,18 +22,7 @@ public class StreamingStructTestCase extends AbstractExportingTestCase { @Test public void testStreamingStructExplicitDefaultSummaryClass() throws IOException, ParseException { - // Tests an issue for mail in Vespa 4.1; specific overrides of default summary class assertCorrectDeriving("streamingstructdefault"); } - @Test - public void testStreamingStructDocumentsonlyDeriving() throws IOException { - String root = "src/test/derived/streamingstruct/"; - String temp = "temp/documentderiver/"; - new File(temp).mkdir(); - Deriver.deriveDocuments(Arrays.asList(root + "streamingstruct.sd"), temp); - assertEqualFiles(root + "/onlydoc/documentmanager.cfg", - temp + "/documentmanager.cfg"); - } - } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/AttributeIndexTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/AttributeIndexTestCase.java deleted file mode 100644 index 29ab2d9e8e8..00000000000 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/AttributeIndexTestCase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.searchdefinition.processing; - -import com.yahoo.searchdefinition.Search; -import com.yahoo.searchdefinition.SearchDefinitionTestCase; -import com.yahoo.searchdefinition.UnprocessingSearchBuilder; -import com.yahoo.searchdefinition.parser.ParseException; -import org.junit.Test; - -import java.io.IOException; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -/** - * Test AttributeIndex processor. - * - * @author hmusum - */ -public class AttributeIndexTestCase extends SearchDefinitionTestCase { - @Test - public void testAttributeIndex() throws IOException, ParseException { - Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/attributeindex.sd"); - - assertTrue(search.getConcreteField("nosettings").getAttributes().get("nosettings") != null); - - assertTrue(search.getConcreteField("specifyname").getAttributes().get("newname") != null); - - assertTrue(search.getConcreteField("specifyname2").getAttributes().get("newname2") != null); - - assertTrue(search.getConcreteField("withstaticrankname").getAttributes().get("withstaticrankname") != null); - - assertTrue(search.getConcreteField("withstaticrankname").getAttributes().get("someothername") != null); - } -} diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/AttributePropertiesTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/AttributePropertiesTestCase.java deleted file mode 100644 index 3a0fedfd550..00000000000 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/AttributePropertiesTestCase.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.searchdefinition.processing; - -import com.yahoo.config.model.application.provider.BaseDeployLogger; -import com.yahoo.searchdefinition.RankProfileRegistry; -import com.yahoo.searchdefinition.Search; -import com.yahoo.searchdefinition.SearchDefinitionTestCase; -import com.yahoo.searchdefinition.UnprocessingSearchBuilder; -import com.yahoo.searchdefinition.parser.ParseException; -import com.yahoo.vespa.model.container.search.QueryProfiles; -import org.junit.Test; - -import java.io.IOException; - -import static org.junit.Assert.fail; -/** - * Test AttributeProperties processor. - * - * @author hmusum - */ -public class AttributePropertiesTestCase extends SearchDefinitionTestCase { - - @Test - public void testInvalidAttributeProperties() throws IOException, ParseException { - try { - Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/attributeproperties1.sd"); - new AttributeProperties(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles()).process(true, false); - fail("attribute property should not be set"); - } catch (RuntimeException e) { - // empty - } - } - - @Test - public void testValidAttributeProperties() throws IOException, ParseException { - Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/attributeproperties2.sd"); - new AttributeProperties(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles()).process(true, false); - } - -} diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/BoldingTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/BoldingTestCase.java index 1ab8b054cb7..ac3ba1d98d9 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/BoldingTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/BoldingTestCase.java @@ -4,8 +4,8 @@ package com.yahoo.searchdefinition.processing; import com.yahoo.config.model.application.provider.BaseDeployLogger; import com.yahoo.searchdefinition.RankProfileRegistry; import com.yahoo.searchdefinition.Search; +import com.yahoo.searchdefinition.SearchBuilder; import com.yahoo.searchdefinition.SearchDefinitionTestCase; -import com.yahoo.searchdefinition.UnprocessingSearchBuilder; import com.yahoo.searchdefinition.parser.ParseException; import com.yahoo.vespa.model.container.search.QueryProfiles; import org.junit.Test; @@ -23,7 +23,7 @@ public class BoldingTestCase extends SearchDefinitionTestCase { @Test public void testBoldingNonString() throws IOException, ParseException { try { - Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/processing/boldnonstring.sd"); + Search search = SearchBuilder.buildFromFile("src/test/processing/boldnonstring.sd"); new Bolding(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles()).process(true, false); fail(); } catch (IllegalArgumentException e) { diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/IntegerIndex2AttributeTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/IntegerIndex2AttributeTestCase.java index 29bba224f46..a8ba762b32b 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/IntegerIndex2AttributeTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/IntegerIndex2AttributeTestCase.java @@ -4,8 +4,8 @@ package com.yahoo.searchdefinition.processing; import com.yahoo.config.model.application.provider.BaseDeployLogger; import com.yahoo.searchdefinition.RankProfileRegistry; import com.yahoo.searchdefinition.Search; +import com.yahoo.searchdefinition.SearchBuilder; import com.yahoo.searchdefinition.SearchDefinitionTestCase; -import com.yahoo.searchdefinition.UnprocessingSearchBuilder; import com.yahoo.searchdefinition.document.SDField; import com.yahoo.searchdefinition.parser.ParseException; import com.yahoo.vespa.model.container.search.QueryProfiles; @@ -15,6 +15,7 @@ import java.io.IOException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; + /** * @author baldersheim */ @@ -22,8 +23,7 @@ public class IntegerIndex2AttributeTestCase extends SearchDefinitionTestCase { @Test public void testIntegerIndex2Attribute() throws IOException, ParseException { - Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/integerindex2attribute.sd"); - search.process(); + Search search = SearchBuilder.buildFromFile("src/test/examples/integerindex2attribute.sd"); new IntegerIndex2Attribute(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles()).process(true, false); SDField f; diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/SummaryFieldsMustHaveValidSourceTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/SummaryFieldsMustHaveValidSourceTestCase.java index d0c1bf8b0ca..dbcfc8c202d 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/SummaryFieldsMustHaveValidSourceTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/SummaryFieldsMustHaveValidSourceTestCase.java @@ -2,8 +2,11 @@ package com.yahoo.searchdefinition.processing; import com.yahoo.config.model.application.provider.BaseDeployLogger; -import com.yahoo.searchdefinition.*; +import com.yahoo.searchdefinition.RankProfileRegistry; +import com.yahoo.searchdefinition.Search; +import com.yahoo.searchdefinition.SearchBuilder; +import com.yahoo.searchdefinition.SearchDefinitionTestCase; import com.yahoo.searchdefinition.parser.ParseException; import com.yahoo.vespa.model.container.search.QueryProfiles; import org.junit.Test; @@ -11,17 +14,14 @@ import org.junit.Test; import java.io.IOException; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; public class SummaryFieldsMustHaveValidSourceTestCase extends SearchDefinitionTestCase { @Test public void requireThatInvalidSourceIsCaught() throws IOException, ParseException { - Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/invalidsummarysource.sd"); - search.process(); try { - new SummaryFieldsMustHaveValidSource(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles()).process(true, false); + SearchBuilder.buildFromFile("src/test/examples/invalidsummarysource.sd"); fail("This should throw and never get here"); } catch (IllegalArgumentException e) { assertEquals("For search 'invalidsummarysource', summary class 'baz', summary field 'cox': there is no valid source 'nonexistingfield'.", e.getMessage()); @@ -30,10 +30,8 @@ public class SummaryFieldsMustHaveValidSourceTestCase extends SearchDefinitionTe @Test public void requireThatInvalidImplicitSourceIsCaught() throws IOException, ParseException { - Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/invalidimplicitsummarysource.sd"); - search.process(); try { - new SummaryFieldsMustHaveValidSource(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles()).process(true, false); + SearchBuilder.buildFromFile("src/test/examples/invalidimplicitsummarysource.sd"); fail("This should throw and never get here"); } catch (IllegalArgumentException e) { assertEquals("For search 'invalidsummarysource', summary class 'baz', summary field 'cox': there is no valid source 'cox'.", e.getMessage()); @@ -42,10 +40,8 @@ public class SummaryFieldsMustHaveValidSourceTestCase extends SearchDefinitionTe @Test public void requireThatInvalidSelfReferingSingleSource() throws IOException, ParseException { - Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/invalidselfreferringsummary.sd"); - search.process(); try { - new SummaryFieldsMustHaveValidSource(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles()).process(true, false); + SearchBuilder.buildFromFile("src/test/examples/invalidselfreferringsummary.sd"); fail("This should throw and never get here"); } catch (IllegalArgumentException e) { assertEquals("For search 'invalidselfreferringsummary', summary class 'withid', summary field 'w': there is no valid source 'w'.", e.getMessage()); @@ -54,8 +50,7 @@ public class SummaryFieldsMustHaveValidSourceTestCase extends SearchDefinitionTe @Test public void requireThatDocumentIdIsAllowedToPass() throws IOException, ParseException { - Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/documentidinsummary.sd"); - search.process(); + Search search = SearchBuilder.buildFromFile("src/test/examples/documentidinsummary.sd"); BaseDeployLogger deployLogger = new BaseDeployLogger(); RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); new SummaryFieldsMustHaveValidSource(search, deployLogger, rankProfileRegistry, new QueryProfiles()).process(true, false); |