Search in sources :

Example 6 with RuleViolationNotificationContent

use of com.synopsys.integration.blackduck.api.manual.component.RuleViolationNotificationContent in project hub-alert by blackducksoftware.

the class NotificationProcessorTest method createRuleViolationNotificationView.

// ==============
// Helper methods
// ==============
private RuleViolationNotificationView createRuleViolationNotificationView(String projectName) {
    RuleViolationNotificationContent notificationContent = new RuleViolationNotificationContent();
    notificationContent.setProjectName(projectName);
    notificationContent.setProjectVersionName("a-project-version");
    notificationContent.setProjectVersion("https://a-project-version");
    notificationContent.setComponentVersionsInViolation(1);
    PolicyInfo policyInfo = new PolicyInfo();
    policyInfo.setPolicy("https://a-policy");
    policyInfo.setPolicyName("a policy");
    policyInfo.setSeverity(PolicyRuleSeverityType.MAJOR.name());
    notificationContent.setPolicyInfos(List.of(policyInfo));
    ComponentVersionStatus componentVersionStatus = new ComponentVersionStatus();
    componentVersionStatus.setBomComponent("https://bom-component");
    componentVersionStatus.setComponentName("component name");
    componentVersionStatus.setComponent("https://component");
    componentVersionStatus.setComponentVersionName("component-version name");
    componentVersionStatus.setComponentVersion("https://component-version");
    componentVersionStatus.setPolicies(List.of(policyInfo.getPolicy()));
    componentVersionStatus.setBomComponentVersionPolicyStatus(ProjectVersionComponentPolicyStatusType.IN_VIOLATION.name());
    componentVersionStatus.setComponentIssueLink("https://component-issues");
    notificationContent.setComponentVersionStatuses(List.of(componentVersionStatus));
    RuleViolationNotificationView notificationView = new RuleViolationNotificationView();
    notificationView.setContent(notificationContent);
    notificationView.setType(NotificationType.RULE_VIOLATION);
    return notificationView;
}
Also used : RuleViolationNotificationContent(com.synopsys.integration.blackduck.api.manual.component.RuleViolationNotificationContent) ComponentVersionStatus(com.synopsys.integration.blackduck.api.manual.component.ComponentVersionStatus) PolicyInfo(com.synopsys.integration.blackduck.api.manual.component.PolicyInfo) RuleViolationNotificationView(com.synopsys.integration.blackduck.api.manual.view.RuleViolationNotificationView)

Example 7 with RuleViolationNotificationContent

use of com.synopsys.integration.blackduck.api.manual.component.RuleViolationNotificationContent in project hub-alert by blackducksoftware.

the class NotificationRemovalTest method createRuleViolationNotificationView.

private RuleViolationNotificationView createRuleViolationNotificationView(String projectName) {
    RuleViolationNotificationContent notificationContent = new RuleViolationNotificationContent();
    notificationContent.setProjectName(projectName);
    notificationContent.setProjectVersionName("a-project-version");
    notificationContent.setProjectVersion("https://a-project-version");
    notificationContent.setComponentVersionsInViolation(1);
    PolicyInfo policyInfo = new PolicyInfo();
    policyInfo.setPolicy("https://a-policy");
    policyInfo.setPolicyName("a policy");
    policyInfo.setSeverity(PolicyRuleSeverityType.MAJOR.name());
    notificationContent.setPolicyInfos(List.of(policyInfo));
    ComponentVersionStatus componentVersionStatus = new ComponentVersionStatus();
    componentVersionStatus.setBomComponent("https://bom-component");
    componentVersionStatus.setComponentName("component name");
    componentVersionStatus.setComponent("https://component");
    componentVersionStatus.setComponentVersionName("component-version name");
    componentVersionStatus.setComponentVersion("https://component-version");
    componentVersionStatus.setPolicies(List.of(policyInfo.getPolicy()));
    componentVersionStatus.setBomComponentVersionPolicyStatus(ProjectVersionComponentPolicyStatusType.IN_VIOLATION.name());
    componentVersionStatus.setComponentIssueLink("https://component-issues");
    notificationContent.setComponentVersionStatuses(List.of(componentVersionStatus));
    RuleViolationNotificationView notificationView = new RuleViolationNotificationView();
    notificationView.setContent(notificationContent);
    notificationView.setType(NotificationType.RULE_VIOLATION);
    return notificationView;
}
Also used : RuleViolationNotificationContent(com.synopsys.integration.blackduck.api.manual.component.RuleViolationNotificationContent) ComponentVersionStatus(com.synopsys.integration.blackduck.api.manual.component.ComponentVersionStatus) PolicyInfo(com.synopsys.integration.blackduck.api.manual.component.PolicyInfo) RuleViolationNotificationView(com.synopsys.integration.blackduck.api.manual.view.RuleViolationNotificationView)

Aggregations

RuleViolationNotificationContent (com.synopsys.integration.blackduck.api.manual.component.RuleViolationNotificationContent)7 RuleViolationNotificationView (com.synopsys.integration.blackduck.api.manual.view.RuleViolationNotificationView)4 ComponentVersionStatus (com.synopsys.integration.blackduck.api.manual.component.ComponentVersionStatus)3 PolicyInfo (com.synopsys.integration.blackduck.api.manual.component.PolicyInfo)3 Test (org.junit.jupiter.api.Test)2 AlertNotificationModel (com.synopsys.integration.alert.common.rest.model.AlertNotificationModel)1 DetailedNotificationContent (com.synopsys.integration.alert.processor.api.detail.DetailedNotificationContent)1 RuleViolationUniquePolicyNotificationContent (com.synopsys.integration.alert.provider.blackduck.processor.model.RuleViolationUniquePolicyNotificationContent)1