diff options
author | Arnstein Ressem <aressem@gmail.com> | 2021-12-10 15:38:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-10 15:38:21 +0100 |
commit | 08555794357171dbd299d80ed3e8d353c7b79e9f (patch) | |
tree | b5dd60f1938f743c9798e401f3b29b30aad830a2 /container-search/src/test/java/com/yahoo/search/searchchain | |
parent | 8ff6429daf9a695f2fa5d45a8033c75fdadfcfe2 (diff) |
Revert "Add zone info to query profile context"
Diffstat (limited to 'container-search/src/test/java/com/yahoo/search/searchchain')
-rw-r--r-- | container-search/src/test/java/com/yahoo/search/searchchain/config/test/SearchChainConfigurerTestCase.java | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/searchchain/config/test/SearchChainConfigurerTestCase.java b/container-search/src/test/java/com/yahoo/search/searchchain/config/test/SearchChainConfigurerTestCase.java index d6e99ec3a44..a642d14b368 100644 --- a/container-search/src/test/java/com/yahoo/search/searchchain/config/test/SearchChainConfigurerTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/searchchain/config/test/SearchChainConfigurerTestCase.java @@ -5,7 +5,6 @@ import com.yahoo.config.search.IntConfig; import com.yahoo.config.search.StringConfig; import com.yahoo.container.core.config.HandlersConfigurerDi; import com.yahoo.container.core.config.testutil.HandlersConfigurerTestWrapper; -import com.yahoo.lang.MutableInteger; import com.yahoo.search.Query; import com.yahoo.search.Result; import com.yahoo.search.Searcher; @@ -39,7 +38,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertThat; @@ -131,7 +129,7 @@ public class SearchChainConfigurerTestCase { @Test public void testConfigurableSearcher() { - HandlersConfigurerTestWrapper configurer = new HandlersConfigurerTestWrapper("dir:" + testDir); + HandlersConfigurerTestWrapper configurer=new HandlersConfigurerTestWrapper("dir:" + testDir); SearchChain configurable = getSearchChainRegistryFrom(configurer).getComponent("configurable"); assertNotNull(configurable); @@ -139,8 +137,9 @@ public class SearchChainConfigurerTestCase { Searcher s = configurable.searchers().get(0); assertThat(s, instanceOf(ConfigurableSearcher.class)); ConfigurableSearcher searcher = (ConfigurableSearcher)s; - assertEquals("Value from int.cfg file", 7, searcher.intConfig.intVal()); - assertEquals("Value from string.cfg file", "com.yahoo.search.searchchain.config.test", searcher.stringConfig.stringVal()); + assertThat("Value from int.cfg file", searcher.intConfig.intVal(), is(7)); + assertThat("Value from string.cfg file", searcher.stringConfig.stringVal(), + is("com.yahoo.search.searchchain.config.test")); configurer.shutdown(); } @@ -343,7 +342,7 @@ public class SearchChainConfigurerTestCase { if (append) { Pattern p = Pattern.compile("^[a-z]+" + "\\[\\d+\\]\\.id (.+)"); BufferedReader reader = new BufferedReader(new InputStreamReader( - new FileInputStream(componentsFile), StandardCharsets.UTF_8)); + new FileInputStream(new File(componentsFile)), StandardCharsets.UTF_8)); while ((line = reader.readLine()) != null) { Matcher m = p.matcher(line); if (m.matches() && !m.group(1).equals(HandlersConfigurerDi.RegistriesHack.class.getName())) { @@ -354,7 +353,7 @@ public class SearchChainConfigurerTestCase { reader.close(); } BufferedReader reader = new BufferedReader(new InputStreamReader( - new FileInputStream(configFile), StandardCharsets.UTF_8)); + new FileInputStream(new File(configFile)), StandardCharsets.UTF_8)); Pattern component = Pattern.compile("^" + componentType + "\\[\\d+\\]\\.id (.+)"); while ((line = reader.readLine()) != null) { Matcher m = component.matcher(line); @@ -367,22 +366,13 @@ public class SearchChainConfigurerTestCase { buf.append("components[").append(i++).append("].id ").append(HandlersConfigurerDi.RegistriesHack.class.getName()).append("\n"); if (componentType.equals("components")) - i = addStandardComponents(i, buf); + buf.append("components[").append(i++).append("].id ").append(ExecutionFactory.class.getName()).append("\n"); buf.insert(0, "components["+i+"]\n"); - Writer writer = new OutputStreamWriter(new FileOutputStream(componentsFile), StandardCharsets.UTF_8); + Writer writer = new OutputStreamWriter(new FileOutputStream(new File(componentsFile)), StandardCharsets.UTF_8); writer.write(buf.toString()); writer.flush(); writer.close(); } - private static int addStandardComponents(int i, StringBuilder builder) { - addComponent(ExecutionFactory.class.getName(), i++, builder); - return i; - } - - private static void addComponent(String component, int i, StringBuilder builder) { - builder.append("components[").append(i).append("].id ").append(component).append("\n"); - } - } |