fix tests to shutdown threadpool
This commit is contained in:
parent
0a459f7ceb
commit
7b3b130a62
|
@ -42,7 +42,9 @@ import org.elasticsearch.index.settings.IndexSettingsModule;
|
||||||
import org.elasticsearch.index.similarity.SimilarityModule;
|
import org.elasticsearch.index.similarity.SimilarityModule;
|
||||||
import org.elasticsearch.indices.query.IndicesQueriesModule;
|
import org.elasticsearch.indices.query.IndicesQueriesModule;
|
||||||
import org.elasticsearch.script.ScriptModule;
|
import org.elasticsearch.script.ScriptModule;
|
||||||
|
import org.elasticsearch.threadpool.ThreadPool;
|
||||||
import org.elasticsearch.threadpool.ThreadPoolModule;
|
import org.elasticsearch.threadpool.ThreadPoolModule;
|
||||||
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -57,6 +59,8 @@ import static org.hamcrest.Matchers.*;
|
||||||
@Test
|
@Test
|
||||||
public class PercolatorExecutorTests {
|
public class PercolatorExecutorTests {
|
||||||
|
|
||||||
|
private Injector injector;
|
||||||
|
|
||||||
private PercolatorExecutor percolatorExecutor;
|
private PercolatorExecutor percolatorExecutor;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
|
@ -65,7 +69,7 @@ public class PercolatorExecutorTests {
|
||||||
//.put("index.cache.filter.type", "none")
|
//.put("index.cache.filter.type", "none")
|
||||||
.build();
|
.build();
|
||||||
Index index = new Index("test");
|
Index index = new Index("test");
|
||||||
Injector injector = new ModulesBuilder().add(
|
injector = new ModulesBuilder().add(
|
||||||
new SettingsModule(settings),
|
new SettingsModule(settings),
|
||||||
new ThreadPoolModule(settings),
|
new ThreadPoolModule(settings),
|
||||||
new ScriptModule(settings),
|
new ScriptModule(settings),
|
||||||
|
@ -90,6 +94,11 @@ public class PercolatorExecutorTests {
|
||||||
percolatorExecutor = injector.getInstance(PercolatorExecutor.class);
|
percolatorExecutor = injector.getInstance(PercolatorExecutor.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public void close() {
|
||||||
|
injector.getInstance(ThreadPool.class).shutdownNow();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimplePercolator() throws Exception {
|
public void testSimplePercolator() throws Exception {
|
||||||
// introduce the doc
|
// introduce the doc
|
||||||
|
|
|
@ -52,7 +52,9 @@ import org.elasticsearch.index.settings.IndexSettingsModule;
|
||||||
import org.elasticsearch.index.similarity.SimilarityModule;
|
import org.elasticsearch.index.similarity.SimilarityModule;
|
||||||
import org.elasticsearch.indices.query.IndicesQueriesModule;
|
import org.elasticsearch.indices.query.IndicesQueriesModule;
|
||||||
import org.elasticsearch.script.ScriptModule;
|
import org.elasticsearch.script.ScriptModule;
|
||||||
|
import org.elasticsearch.threadpool.ThreadPool;
|
||||||
import org.elasticsearch.threadpool.ThreadPoolModule;
|
import org.elasticsearch.threadpool.ThreadPoolModule;
|
||||||
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -73,6 +75,8 @@ import static org.hamcrest.Matchers.*;
|
||||||
@Test
|
@Test
|
||||||
public class SimpleIndexQueryParserTests {
|
public class SimpleIndexQueryParserTests {
|
||||||
|
|
||||||
|
private Injector injector;
|
||||||
|
|
||||||
private IndexQueryParserService queryParser;
|
private IndexQueryParserService queryParser;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
|
@ -81,7 +85,7 @@ public class SimpleIndexQueryParserTests {
|
||||||
.put("index.cache.filter.type", "none")
|
.put("index.cache.filter.type", "none")
|
||||||
.build();
|
.build();
|
||||||
Index index = new Index("test");
|
Index index = new Index("test");
|
||||||
Injector injector = new ModulesBuilder().add(
|
injector = new ModulesBuilder().add(
|
||||||
new SettingsModule(settings),
|
new SettingsModule(settings),
|
||||||
new ThreadPoolModule(settings),
|
new ThreadPoolModule(settings),
|
||||||
new IndicesQueriesModule(),
|
new IndicesQueriesModule(),
|
||||||
|
@ -108,6 +112,11 @@ public class SimpleIndexQueryParserTests {
|
||||||
this.queryParser = injector.getInstance(IndexQueryParserService.class);
|
this.queryParser = injector.getInstance(IndexQueryParserService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public void close() {
|
||||||
|
injector.getInstance(ThreadPool.class).shutdownNow();
|
||||||
|
}
|
||||||
|
|
||||||
private IndexQueryParserService queryParser() throws IOException {
|
private IndexQueryParserService queryParser() throws IOException {
|
||||||
return this.queryParser;
|
return this.queryParser;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ import org.elasticsearch.index.settings.IndexSettingsModule;
|
||||||
import org.elasticsearch.index.similarity.SimilarityModule;
|
import org.elasticsearch.index.similarity.SimilarityModule;
|
||||||
import org.elasticsearch.indices.query.IndicesQueriesModule;
|
import org.elasticsearch.indices.query.IndicesQueriesModule;
|
||||||
import org.elasticsearch.script.ScriptModule;
|
import org.elasticsearch.script.ScriptModule;
|
||||||
|
import org.elasticsearch.threadpool.ThreadPool;
|
||||||
import org.elasticsearch.threadpool.ThreadPoolModule;
|
import org.elasticsearch.threadpool.ThreadPoolModule;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -90,5 +91,7 @@ public class IndexQueryParserModuleTests {
|
||||||
MyJsonFilterParser myJsonFilterParser = (MyJsonFilterParser) indexQueryParserService.filterParser("my");
|
MyJsonFilterParser myJsonFilterParser = (MyJsonFilterParser) indexQueryParserService.filterParser("my");
|
||||||
assertThat(myJsonFilterParser.names()[0], equalTo("my"));
|
assertThat(myJsonFilterParser.names()[0], equalTo("my"));
|
||||||
assertThat(myJsonFilterParser.settings().get("param2"), equalTo("value2"));
|
assertThat(myJsonFilterParser.settings().get("param2"), equalTo("value2"));
|
||||||
|
|
||||||
|
injector.getInstance(ThreadPool.class).shutdownNow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ import org.elasticsearch.index.settings.IndexSettingsModule;
|
||||||
import org.elasticsearch.index.similarity.SimilarityModule;
|
import org.elasticsearch.index.similarity.SimilarityModule;
|
||||||
import org.elasticsearch.indices.query.IndicesQueriesModule;
|
import org.elasticsearch.indices.query.IndicesQueriesModule;
|
||||||
import org.elasticsearch.script.ScriptModule;
|
import org.elasticsearch.script.ScriptModule;
|
||||||
|
import org.elasticsearch.threadpool.ThreadPool;
|
||||||
import org.elasticsearch.threadpool.ThreadPoolModule;
|
import org.elasticsearch.threadpool.ThreadPoolModule;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -86,5 +87,7 @@ public class IndexQueryParserPlugin2Tests {
|
||||||
|
|
||||||
PluginJsonFilterParser myJsonFilterParser = (PluginJsonFilterParser) indexQueryParserService.filterParser("my");
|
PluginJsonFilterParser myJsonFilterParser = (PluginJsonFilterParser) indexQueryParserService.filterParser("my");
|
||||||
assertThat(myJsonFilterParser.names()[0], equalTo("my"));
|
assertThat(myJsonFilterParser.names()[0], equalTo("my"));
|
||||||
|
|
||||||
|
injector.getInstance(ThreadPool.class).shutdownNow();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -38,6 +38,7 @@ import org.elasticsearch.index.settings.IndexSettingsModule;
|
||||||
import org.elasticsearch.index.similarity.SimilarityModule;
|
import org.elasticsearch.index.similarity.SimilarityModule;
|
||||||
import org.elasticsearch.indices.query.IndicesQueriesModule;
|
import org.elasticsearch.indices.query.IndicesQueriesModule;
|
||||||
import org.elasticsearch.script.ScriptModule;
|
import org.elasticsearch.script.ScriptModule;
|
||||||
|
import org.elasticsearch.threadpool.ThreadPool;
|
||||||
import org.elasticsearch.threadpool.ThreadPoolModule;
|
import org.elasticsearch.threadpool.ThreadPoolModule;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -95,5 +96,7 @@ public class IndexQueryParserPluginTests {
|
||||||
|
|
||||||
PluginJsonFilterParser myJsonFilterParser = (PluginJsonFilterParser) indexQueryParserService.filterParser("my");
|
PluginJsonFilterParser myJsonFilterParser = (PluginJsonFilterParser) indexQueryParserService.filterParser("my");
|
||||||
assertThat(myJsonFilterParser.names()[0], equalTo("my"));
|
assertThat(myJsonFilterParser.names()[0], equalTo("my"));
|
||||||
|
|
||||||
|
injector.getInstance(ThreadPool.class).shutdownNow();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue