public class SuspendTest extends ComponentTestCase {
@Test
public void test() {
AlertManager manager = lookup(AlertManager.class);
AlertEntity entity = new AlertEntity();
entity.setDate(new Date()).setContent("test").setLevel("error");
entity.setMetric("testMetric").setType(AlertType.Network.getName()).setGroup("testGroup");
try {
manager.addAlert(entity);
TimeUnit.SECONDS.sleep(1);
} catch (Exception ex) {
}
Assert.assertTrue(manager.isSuspend(entity.getKey(), 1));
try {
TimeUnit.SECONDS.sleep(65);
} catch (InterruptedException e) {
}
Assert.assertFalse(manager.isSuspend(entity.getKey(), 1));
}