Tests: restart the action manager between tests.

Original commit: elastic/x-pack-elasticsearch@73bc51717b
This commit is contained in:
Martijn van Groningen 2014-11-24 21:33:30 +01:00
parent 98bb60e4ba
commit 4eca3c86a0
4 changed files with 13 additions and 6 deletions

View File

@ -216,9 +216,9 @@ public class AlertManager extends AbstractComponent {
* For testing only to clear the alerts and actions between tests.
*/
public void clear() {
scheduler.clearAlerts();
scheduler.clear();
alertsStore.clear();
actionManager.clear();
actionManager.restart();
}
private void internalStop() {

View File

@ -140,7 +140,7 @@ public class AlertsStore extends AbstractComponent {
}
/**
* Clears the in-memory representation of the alerts
* Exists for testing purposes
*/
public void clear() {
alertMap.clear();

View File

@ -135,8 +135,12 @@ public class AlertActionManager extends AbstractComponent {
return started.get();
}
public void clear() {
actionsToBeProcessed.clear();
/**
* Exists for testing purposes.
*/
public void restart() {
stop();
doStart();
}
private void doStart() {

View File

@ -98,7 +98,10 @@ public class AlertScheduler extends AbstractComponent {
}
}
public void clearAlerts() {
/**
* Exists for testing purposes
*/
public void clear() {
try {
if (scheduler != null) {
scheduler.clear();