return Response.noContent().build();
}
@Override
public Response testSubscription(@PathParam("checkId") String checkId, @PathParam("subscriptionId") final String subscriptionId) {
Check check = checksStore.getCheck(checkId);
if (check == null) {
return Response.status(Response.Status.NOT_FOUND).build();
}
Collection<Subscription> subscriptions = Collections2.filter(check.getSubscriptions(), new Predicate<Subscription>() {
@Override
public boolean apply(Subscription subscription) {
return subscription.getId().equals(subscriptionId);
}
});
if (subscriptions.size() != 1) {
return Response.status(Response.Status.NOT_FOUND).build();
}
check.setState(AlertType.ERROR);
Subscription subscription = subscriptions.iterator().next();
List<Alert> interestingAlerts = new ArrayList<Alert>();
Alert alert = new Alert()
.withTarget(check.getTarget())
.withValue(BigDecimal.valueOf(0.0))
.withWarn(check.getWarn())
.withError(check.getError())
.withFromType(AlertType.OK)
.withToType(AlertType.ERROR)
.withTimestamp(new DateTime());
interestingAlerts.add(alert);
for (NotificationService notificationService : notificationServices) {