use of com.thinkbiganalytics.alerts.rest.model.Alert in project kylo by Teradata.
the class SlaIT method assertSuccessfulSlaAppearsNotInAlerts.
private void assertSuccessfulSlaAppearsNotInAlerts(String slaId) {
AlertRange range = getAlerts();
List<Alert> alerts = range.getAlerts();
Assert.assertFalse(anyAlertMatch(slaId, alerts));
}
use of com.thinkbiganalytics.alerts.rest.model.Alert in project kylo by Teradata.
the class SlaIT method assertFailedSlaAppearsInAlerts.
private void assertFailedSlaAppearsInAlerts(String slaId) {
AlertRange range = getAlerts();
List<Alert> alerts = range.getAlerts();
Assert.assertTrue(anyAlertMatch(slaId, alerts));
}
use of com.thinkbiganalytics.alerts.rest.model.Alert in project kylo by Teradata.
the class AlertsModel method toModel.
public com.thinkbiganalytics.alerts.rest.model.Alert toModel(com.thinkbiganalytics.alerts.api.Alert alert) {
com.thinkbiganalytics.alerts.api.Alert baseAlert = alert;
try {
if (Proxy.isProxyClass(alert.getClass())) {
SourceAlert sourceAlert = (SourceAlert) Proxy.getInvocationHandler(alert);
if (sourceAlert != null) {
baseAlert = sourceAlert.getWrappedAlert();
}
}
} catch (Exception e) {
// unable to get base alert from proxy. log the exception but continue
log.error("Unable to get base alert from wrapped proxy for : {}, {} ", alert, e.getMessage(), e);
}
com.thinkbiganalytics.alerts.rest.model.Alert result = new com.thinkbiganalytics.alerts.rest.model.Alert();
result.setId(alert.getId().toString());
result.setActionable(alert.isActionable());
result.setCreatedTime(alert.getCreatedTime());
result.setLevel(toModel(alert.getLevel()));
result.setState(toModel(alert.getState()));
result.setType(alert.getType());
result.setDescription(alert.getDescription());
result.setCleared(alert.isCleared());
result.setContent(alert.getContent() != null ? alert.getContent().toString() : null);
result.setSubtype(alert.getSubtype());
alert.getEvents().forEach(e -> result.getEvents().add(toModel(e)));
if (baseAlert instanceof EntityAlert) {
result.setEntityId(((EntityAlert) baseAlert).getEntityId() != null ? ((EntityAlert) baseAlert).getEntityId().toString() : null);
result.setEntityType(((EntityAlert) baseAlert).getEntityType());
}
return result;
}
Aggregations