diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-10-07 17:00:28 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-10-07 17:05:04 +0200 |
commit | e8f2842df4e486af6b31e2ffbc1d5569b8d26850 (patch) | |
tree | b4aa7928ebf4ab6dc85f039325138857a24b4eaa /container-search/src/test/java/com/yahoo/prelude | |
parent | 6cd3e5387169803041c5628178181ee15e7b929c (diff) |
- Use the default threadpool for federation.
- Move test classes into the same package as the code to avoid making test only methods public.
- Deprecate old AsyncExecution.search/fill methods and let them run in its own thread.
There should be no external usage of this class.
Diffstat (limited to 'container-search/src/test/java/com/yahoo/prelude')
-rw-r--r-- | container-search/src/test/java/com/yahoo/prelude/searcher/test/BlendingSearcherTestCase.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/container-search/src/test/java/com/yahoo/prelude/searcher/test/BlendingSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/searcher/test/BlendingSearcherTestCase.java index cf0758a5c47..69d66c6341f 100644 --- a/container-search/src/test/java/com/yahoo/prelude/searcher/test/BlendingSearcherTestCase.java +++ b/container-search/src/test/java/com/yahoo/prelude/searcher/test/BlendingSearcherTestCase.java @@ -6,6 +6,8 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import com.yahoo.component.ComponentId; import com.yahoo.component.chain.Chain; @@ -27,6 +29,8 @@ import com.yahoo.search.searchchain.Execution; import com.yahoo.search.searchchain.SearchChain; import com.yahoo.search.searchchain.SearchChainRegistry; import com.yahoo.search.searchchain.testutil.DocumentSourceSearcher; +import org.junit.After; +import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -45,7 +49,19 @@ public class BlendingSearcherTestCase { private static final double delta = 0.00000001; - public static class BlendingSearcherWrapper extends Searcher { + private ExecutorService executor; + + @Before + public void setUp() throws Exception { + executor = Executors.newFixedThreadPool(16); + } + + @After + public void tearDown() { + assertEquals(0, executor.shutdownNow().size()); + } + + public class BlendingSearcherWrapper extends Searcher { private SearchChain blendingChain; private final FederationConfig.Builder builder = new FederationConfig.Builder(); @@ -111,7 +127,7 @@ public class BlendingSearcherTestCase { StrictContractsConfig contracts = new StrictContractsConfig.Builder().build(); FederationSearcher fedSearcher = - new FederationSearcher(new FederationConfig(builder), contracts, new ComponentRegistry<>()); + new FederationSearcher(new FederationConfig(builder), contracts, new ComponentRegistry<>(), executor); BlendingSearcher blendingSearcher = new BlendingSearcher(blendingField); blendingChain = new SearchChain(ComponentId.createAnonymousComponentId("blendingChain"), blendingSearcher, fedSearcher); return true; |