diff --git a/src/test/java/org/elasticsearch/test/unit/index/percolator/PercolatorExecutorTests.java b/src/test/java/org/elasticsearch/test/unit/index/percolator/PercolatorExecutorTests.java index 2889d949aa0..5ecb9fd002d 100644 --- a/src/test/java/org/elasticsearch/test/unit/index/percolator/PercolatorExecutorTests.java +++ b/src/test/java/org/elasticsearch/test/unit/index/percolator/PercolatorExecutorTests.java @@ -42,7 +42,9 @@ import org.elasticsearch.index.settings.IndexSettingsModule; import org.elasticsearch.index.similarity.SimilarityModule; import org.elasticsearch.indices.query.IndicesQueriesModule; import org.elasticsearch.script.ScriptModule; +import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPoolModule; +import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -57,6 +59,8 @@ import static org.hamcrest.Matchers.*; @Test public class PercolatorExecutorTests { + private Injector injector; + private PercolatorExecutor percolatorExecutor; @BeforeClass @@ -65,7 +69,7 @@ public class PercolatorExecutorTests { //.put("index.cache.filter.type", "none") .build(); Index index = new Index("test"); - Injector injector = new ModulesBuilder().add( + injector = new ModulesBuilder().add( new SettingsModule(settings), new ThreadPoolModule(settings), new ScriptModule(settings), @@ -90,6 +94,11 @@ public class PercolatorExecutorTests { percolatorExecutor = injector.getInstance(PercolatorExecutor.class); } + @AfterClass + public void close() { + injector.getInstance(ThreadPool.class).shutdownNow(); + } + @Test public void testSimplePercolator() throws Exception { // introduce the doc diff --git a/src/test/java/org/elasticsearch/test/unit/index/query/SimpleIndexQueryParserTests.java b/src/test/java/org/elasticsearch/test/unit/index/query/SimpleIndexQueryParserTests.java index 8c4ff964eaf..219fe048aab 100644 --- a/src/test/java/org/elasticsearch/test/unit/index/query/SimpleIndexQueryParserTests.java +++ b/src/test/java/org/elasticsearch/test/unit/index/query/SimpleIndexQueryParserTests.java @@ -52,7 +52,9 @@ import org.elasticsearch.index.settings.IndexSettingsModule; import org.elasticsearch.index.similarity.SimilarityModule; import org.elasticsearch.indices.query.IndicesQueriesModule; import org.elasticsearch.script.ScriptModule; +import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPoolModule; +import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -73,6 +75,8 @@ import static org.hamcrest.Matchers.*; @Test public class SimpleIndexQueryParserTests { + private Injector injector; + private IndexQueryParserService queryParser; @BeforeClass @@ -81,7 +85,7 @@ public class SimpleIndexQueryParserTests { .put("index.cache.filter.type", "none") .build(); Index index = new Index("test"); - Injector injector = new ModulesBuilder().add( + injector = new ModulesBuilder().add( new SettingsModule(settings), new ThreadPoolModule(settings), new IndicesQueriesModule(), @@ -108,6 +112,11 @@ public class SimpleIndexQueryParserTests { this.queryParser = injector.getInstance(IndexQueryParserService.class); } + @AfterClass + public void close() { + injector.getInstance(ThreadPool.class).shutdownNow(); + } + private IndexQueryParserService queryParser() throws IOException { return this.queryParser; } diff --git a/src/test/java/org/elasticsearch/test/unit/index/query/guice/IndexQueryParserModuleTests.java b/src/test/java/org/elasticsearch/test/unit/index/query/guice/IndexQueryParserModuleTests.java index d8ca138e145..53245f542ee 100644 --- a/src/test/java/org/elasticsearch/test/unit/index/query/guice/IndexQueryParserModuleTests.java +++ b/src/test/java/org/elasticsearch/test/unit/index/query/guice/IndexQueryParserModuleTests.java @@ -37,6 +37,7 @@ import org.elasticsearch.index.settings.IndexSettingsModule; import org.elasticsearch.index.similarity.SimilarityModule; import org.elasticsearch.indices.query.IndicesQueriesModule; import org.elasticsearch.script.ScriptModule; +import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPoolModule; import org.testng.annotations.Test; @@ -90,5 +91,7 @@ public class IndexQueryParserModuleTests { MyJsonFilterParser myJsonFilterParser = (MyJsonFilterParser) indexQueryParserService.filterParser("my"); assertThat(myJsonFilterParser.names()[0], equalTo("my")); assertThat(myJsonFilterParser.settings().get("param2"), equalTo("value2")); + + injector.getInstance(ThreadPool.class).shutdownNow(); } } diff --git a/src/test/java/org/elasticsearch/test/unit/index/query/plugin/IndexQueryParserPlugin2Tests.java b/src/test/java/org/elasticsearch/test/unit/index/query/plugin/IndexQueryParserPlugin2Tests.java index 6f98b2fd16b..1d9d027cfb5 100644 --- a/src/test/java/org/elasticsearch/test/unit/index/query/plugin/IndexQueryParserPlugin2Tests.java +++ b/src/test/java/org/elasticsearch/test/unit/index/query/plugin/IndexQueryParserPlugin2Tests.java @@ -38,6 +38,7 @@ import org.elasticsearch.index.settings.IndexSettingsModule; import org.elasticsearch.index.similarity.SimilarityModule; import org.elasticsearch.indices.query.IndicesQueriesModule; import org.elasticsearch.script.ScriptModule; +import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPoolModule; import org.testng.annotations.Test; @@ -86,5 +87,7 @@ public class IndexQueryParserPlugin2Tests { PluginJsonFilterParser myJsonFilterParser = (PluginJsonFilterParser) indexQueryParserService.filterParser("my"); assertThat(myJsonFilterParser.names()[0], equalTo("my")); + + injector.getInstance(ThreadPool.class).shutdownNow(); } } \ No newline at end of file diff --git a/src/test/java/org/elasticsearch/test/unit/index/query/plugin/IndexQueryParserPluginTests.java b/src/test/java/org/elasticsearch/test/unit/index/query/plugin/IndexQueryParserPluginTests.java index 94621cc81e1..4a8aee2212c 100644 --- a/src/test/java/org/elasticsearch/test/unit/index/query/plugin/IndexQueryParserPluginTests.java +++ b/src/test/java/org/elasticsearch/test/unit/index/query/plugin/IndexQueryParserPluginTests.java @@ -38,6 +38,7 @@ import org.elasticsearch.index.settings.IndexSettingsModule; import org.elasticsearch.index.similarity.SimilarityModule; import org.elasticsearch.indices.query.IndicesQueriesModule; import org.elasticsearch.script.ScriptModule; +import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPoolModule; import org.testng.annotations.Test; @@ -95,5 +96,7 @@ public class IndexQueryParserPluginTests { PluginJsonFilterParser myJsonFilterParser = (PluginJsonFilterParser) indexQueryParserService.filterParser("my"); assertThat(myJsonFilterParser.names()[0], equalTo("my")); + + injector.getInstance(ThreadPool.class).shutdownNow(); } } \ No newline at end of file