diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-11-05 11:09:51 +0100 |
---|---|---|
committer | gjoranv <gv@oath.com> | 2019-01-21 15:09:25 +0100 |
commit | cfc7c2bc1aaddbe183bdc5f73bff433070d602da (patch) | |
tree | 46b69dcced0d07de43aa4b2dc8d7571e19346b0b /container-search/src/test/java/com/yahoo/prelude/searcher | |
parent | 3c5531d7cb6557bfea6dc6f1f0d77b96a0569b54 (diff) |
Remove deprecated code
Diffstat (limited to 'container-search/src/test/java/com/yahoo/prelude/searcher')
3 files changed, 0 insertions, 138 deletions
diff --git a/container-search/src/test/java/com/yahoo/prelude/searcher/test/FieldCollapsingSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/searcher/test/FieldCollapsingSearcherTestCase.java index bf86ca4544b..4875121a501 100644 --- a/container-search/src/test/java/com/yahoo/prelude/searcher/test/FieldCollapsingSearcherTestCase.java +++ b/container-search/src/test/java/com/yahoo/prelude/searcher/test/FieldCollapsingSearcherTestCase.java @@ -336,11 +336,6 @@ public class FieldCollapsingSearcherTestCase { assertHit("http://acme.org/h.html", 6,1,r.hits().get(1)); } - // This test depends on DocumentSourceSearcher filling the hits - // with whatever data it got, ignoring actual summary arguments - // in the fill call, then saying the hits are filled for the - // ignored argument. Rewrite to contain different summaries if - // DocumentSourceSearcher gets extended. @Test public void testFieldCollapsingTwoPhaseSelectSummary() { // Set up diff --git a/container-search/src/test/java/com/yahoo/prelude/searcher/test/QuerySnapshotSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/searcher/test/QuerySnapshotSearcherTestCase.java deleted file mode 100644 index 7b92e2c1a7c..00000000000 --- a/container-search/src/test/java/com/yahoo/prelude/searcher/test/QuerySnapshotSearcherTestCase.java +++ /dev/null @@ -1,52 +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.prelude.searcher.test; - -import com.google.common.util.concurrent.MoreExecutors; -import com.yahoo.component.chain.Chain; -import com.yahoo.language.simple.SimpleLinguistics; -import com.yahoo.search.Query; -import com.yahoo.search.Result; -import com.yahoo.search.Searcher; -import com.yahoo.search.rendering.RendererRegistry; -import com.yahoo.search.result.Hit; -import com.yahoo.prelude.searcher.QuerySnapshotSearcher; -import com.yahoo.search.searchchain.Execution; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; - -/** - * @author bratseth - */ -public class QuerySnapshotSearcherTestCase { - - @Test - public void test() { - Searcher searcher=new QuerySnapshotSearcher(); - Result result = doSearch(searcher, new Query(), 0,10); - Hit hit=result.hits().get(0); - assertEquals(String.valueOf(Double.POSITIVE_INFINITY), - hit.getRelevance().toString()); - } - - private Result doSearch(Searcher searcher, Query query, int offset, int hits) { - query.setOffset(offset); - query.setHits(hits); - return createExecution(searcher).search(query); - } - - private Execution createExecution(Searcher searcher) { - Execution.Context context = new Execution.Context(null, null, null, new RendererRegistry(MoreExecutors.directExecutor()), new SimpleLinguistics()); - return new Execution(chainedAsSearchChain(searcher), context); - } - - private Chain<Searcher> chainedAsSearchChain(Searcher topOfChain) { - List<Searcher> searchers = new ArrayList<>(); - searchers.add(topOfChain); - return new Chain<>(searchers); - } - -} diff --git a/container-search/src/test/java/com/yahoo/prelude/searcher/test/QueryValidatingSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/searcher/test/QueryValidatingSearcherTestCase.java deleted file mode 100644 index 3967ac63e36..00000000000 --- a/container-search/src/test/java/com/yahoo/prelude/searcher/test/QueryValidatingSearcherTestCase.java +++ /dev/null @@ -1,81 +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.prelude.searcher.test; - -import com.google.common.util.concurrent.MoreExecutors; -import com.yahoo.component.chain.Chain; -import com.yahoo.language.simple.SimpleLinguistics; -import com.yahoo.search.rendering.RendererRegistry; -import com.yahoo.search.result.Hit; -import com.yahoo.search.Query; -import com.yahoo.search.Result; -import com.yahoo.search.Searcher; -import com.yahoo.search.searchchain.Execution; -import com.yahoo.search.searchchain.testutil.DocumentSourceSearcher; -import com.yahoo.prelude.searcher.QueryValidatingSearcher; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -/** - * Tests correct denial of query. - * - * @author Steinar Knutsen - */ -public class QueryValidatingSearcherTestCase { - - @Test - public void testBasic() { - // Setup - Map<Searcher, Searcher> chained = new HashMap<>(); - Query query = new Query("?query=test"); - - Result result = new Result(query); - result.hits().add(new Hit("ymail://1111111111/AQAAAP7JgwEAj6XjQQAAAO/+ggA=",950)); - - Searcher validator = new QueryValidatingSearcher(); - DocumentSourceSearcher source = new DocumentSourceSearcher(); - chained.put(validator, source); - source.addResult(query, result); - - // Exercise - Result returnedResult = doSearch(validator, query, 0, 10, chained); - - // Validate - assertEquals(1, returnedResult.getHitCount()); - assertNull(returnedResult.hits().getError()); - - returnedResult = doSearch(validator, query, 0, 1001, chained); - assertEquals(0, returnedResult.getConcreteHitCount()); - assertEquals(4, returnedResult.hits().getError().getCode()); - - returnedResult = doSearch(validator, query, 1001, 10, chained); - assertEquals(0, returnedResult.getConcreteHitCount()); - assertEquals(4, returnedResult.hits().getError().getCode()); - } - - private Result doSearch(Searcher searcher, Query query, int offset, int hits, Map<Searcher, Searcher> chained) { - query.setOffset(offset); - query.setHits(hits); - return createExecution(searcher, chained).search(query); - } - - private Chain<Searcher> chainedAsSearchChain(Searcher topOfChain, Map<Searcher, Searcher> chained) { - List<Searcher> searchers = new ArrayList<>(); - for (Searcher current = topOfChain; current != null; current = chained.get(current)) { - searchers.add(current); - } - return new Chain<>(searchers); - } - - private Execution createExecution(Searcher searcher, Map<Searcher, Searcher> chained) { - Execution.Context context = new Execution.Context(null, null, null, new RendererRegistry(MoreExecutors.directExecutor()), new SimpleLinguistics()); - return new Execution(chainedAsSearchChain(searcher, chained), context); - } - -} |