use of io.gravitee.alert.api.condition.Condition in project gravitee-management-rest-api by gravitee-io.
the class ApplicationAlertServiceTest method prepareForCreation.
@NotNull
private void prepareForCreation(NewAlertTriggerEntity newAlert) {
// recipients
when(membershipService.getMembershipsByReference(MembershipReferenceType.APPLICATION, APPLICATION_ID)).thenReturn(Collections.emptySet());
UserEntity user1 = new UserEntity();
user1.setEmail("user1@mail.gio");
UserEntity user2 = new UserEntity();
user2.setEmail("user2@mail.gio");
Set<UserEntity> users = new HashSet<>();
users.add(user1);
users.add(user2);
when(userService.findByIds(any())).thenReturn(users);
// body
List<Condition> conditions = new ArrayList<>();
conditions.add(RateCondition.of(ThresholdRangeCondition.between("response.status", 200D, 299D).build()).duration(10L, TimeUnit.MINUTES).greaterThan(5D).build());
newAlert.setConditions(conditions);
}
Aggregations