Tests: Made sure that resources are properly cleaned up after test classes extending from AbstractAlertsSingleNodeTests have been completed

Original commit: elastic/x-pack-elasticsearch@4621b76fe1
This commit is contained in:
Martijn van Groningen 2015-03-04 12:10:59 +01:00
parent 5903ea7493
commit f28dee2e44

View File

@ -9,6 +9,7 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.alerts.AlertsLifeCycleService;
import org.elasticsearch.alerts.support.init.proxy.ClientProxy;
import org.elasticsearch.alerts.support.init.proxy.ScriptServiceProxy;
import org.elasticsearch.client.Requests;
@ -16,6 +17,7 @@ import org.elasticsearch.common.Priority;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.test.ElasticsearchSingleNodeTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import java.util.Collections;
import java.util.Map;
@ -28,9 +30,14 @@ import static org.hamcrest.Matchers.equalTo;
*/
public abstract class AbstractAlertsSingleNodeTests extends ElasticsearchSingleNodeTest {
@BeforeClass
public static void initSuite() throws Exception {
getInstanceFromNode(AlertsLifeCycleService.class).start();
}
@AfterClass
public static void cleanupSuite() throws Exception {
node().stop();
getInstanceFromNode(AlertsLifeCycleService.class).stop();
}
@Override