use of com.epam.ta.reportportal.entity.project.email.LaunchAttributeRule in project service-api by reportportal.
the class NotificationConfigConverterTest method getSenderCases.
private static Set<SenderCase> getSenderCases() {
Set<SenderCase> senderCases = new HashSet<>();
senderCases.add(getCase());
final LaunchAttributeRule launchAttributeRule = new LaunchAttributeRule();
launchAttributeRule.setId(1L);
launchAttributeRule.setKey("key");
launchAttributeRule.setValue("value");
senderCases.add(new SenderCase(Sets.newHashSet("recipent3", "recipient8"), Sets.newHashSet("launch1", "launch5", "launch10"), Sets.newHashSet(launchAttributeRule), SendCase.ALWAYS, true));
return senderCases;
}
use of com.epam.ta.reportportal.entity.project.email.LaunchAttributeRule in project service-api by reportportal.
the class NotificationConfigConverterTest method getCase.
private static SenderCase getCase() {
final LaunchAttributeRule launchAttributeRule = new LaunchAttributeRule();
launchAttributeRule.setId(2L);
launchAttributeRule.setKey("key1");
launchAttributeRule.setValue("value1");
return new SenderCase(Sets.newHashSet("recipent1", "recipient2"), Sets.newHashSet("launch1", "launch2", "launch3"), Sets.newHashSet(launchAttributeRule), SendCase.MORE_10, true);
}
use of com.epam.ta.reportportal.entity.project.email.LaunchAttributeRule in project service-api by reportportal.
the class LaunchNotificationSubscriber method isAttributesMatched.
/**
* Validate matching of finished launch tags and project settings for emailing
*
* @param launch Launch to be evaluated
* @return TRUE if tags matched
*/
@VisibleForTesting
private static boolean isAttributesMatched(Launch launch, Set<LaunchAttributeRule> launchAttributeRules) {
if (CollectionUtils.isEmpty(launchAttributeRules)) {
return true;
}
return launch.getAttributes().stream().filter(attribute -> !attribute.isSystem()).map(attribute -> {
ItemAttributeResource attributeResource = new ItemAttributeResource();
attributeResource.setKey(attribute.getKey());
attributeResource.setValue(attribute.getValue());
return attributeResource;
}).collect(Collectors.toSet()).containsAll(launchAttributeRules.stream().map(NotificationConfigConverter.TO_ATTRIBUTE_RULE_RESOURCE).collect(Collectors.toSet()));
}
Aggregations