use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributeResource in project service-api by reportportal.
the class ItemAttributeConverterTest method fromResource.
@Test
void fromResource() {
ItemAttributeResource resource = new ItemAttributeResource("key", "val");
final ItemAttribute itemAttribute = ItemAttributeConverter.FROM_RESOURCE.apply(resource);
assertEquals(itemAttribute.getKey(), resource.getKey());
assertEquals(itemAttribute.getValue(), resource.getValue());
assertEquals(itemAttribute.isSystem(), false);
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributeResource in project service-api by reportportal.
the class EmailRulesValidatorTest method validateEmptyLaunchAttributes.
@Test
void validateEmptyLaunchAttributes() {
ItemAttributeResource attribute = new ItemAttributeResource();
ReportPortalException exception = assertThrows(ReportPortalException.class, () -> EmailRulesValidator.validateLaunchAttribute(attribute));
assertEquals("Error in handled Request. Please, check specified parameters: 'Attribute' values cannot be empty. Please specify them or do not include in a request.'", exception.getMessage());
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributeResource in project service-api by reportportal.
the class EmailRulesValidatorTest method successfullyValidateLaunchAttribute.
@Test
void successfullyValidateLaunchAttribute() {
ItemAttributeResource attribute = new ItemAttributeResource();
attribute.setKey("key");
attribute.setValue("value");
EmailRulesValidator.validateLaunchAttribute(attribute);
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributeResource 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