Search in sources :

Example 1 with PolicyInfo

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

the class RuleViolationNotificationMessageExtractorTest method createPolicyInfo.

private PolicyInfo createPolicyInfo() {
    PolicyInfo policyInfo = new PolicyInfo();
    policyInfo.setPolicyName(COMPONENT_POLICY.getPolicyName());
    policyInfo.setPolicy(COMPONENT_POLICY_URL);
    policyInfo.setSeverity(PolicyRuleSeverityType.MAJOR.name());
    return policyInfo;
}
Also used : PolicyInfo(com.synopsys.integration.blackduck.api.manual.component.PolicyInfo)

Example 2 with PolicyInfo

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

the class RuleViolationClearedNotificationMessageExtractorTest method createPolicyInfo.

private PolicyInfo createPolicyInfo() {
    PolicyInfo policyInfo = new PolicyInfo();
    policyInfo.setPolicyName(COMPONENT_POLICY.getPolicyName());
    policyInfo.setPolicy(COMPONENT_POLICY_URL);
    policyInfo.setSeverity(PolicyRuleSeverityType.MAJOR.name());
    return policyInfo;
}
Also used : PolicyInfo(com.synopsys.integration.blackduck.api.manual.component.PolicyInfo)

Example 3 with PolicyInfo

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

the class PolicyOverrideUniquePolicyNotificationContentTest method getContentTest.

@Test
public void getContentTest() {
    String componentName = "Component Name";
    String componentVersionName = "Component Version Name";
    String firstName = "firstname";
    String lastName = "lastname";
    PolicyInfo policyInfo = new PolicyInfo();
    String policy = "http://policyUrl";
    String bomComponentVersionPolicyStatus = "Some policy status";
    String bomComponent = "http://bomComponentUrl";
    PolicyOverrideUniquePolicyNotificationContent notificationContent = new PolicyOverrideUniquePolicyNotificationContent(PROJECT_NAME, PROJECT_VERSION_NAME, PROJECT_VERSION_URL, componentName, componentVersionName, firstName, lastName, policyInfo, policy, bomComponentVersionPolicyStatus, bomComponent);
    assertEquals(PROJECT_NAME, notificationContent.getProjectName());
    assertEquals(PROJECT_VERSION_NAME, notificationContent.getProjectVersionName());
    assertEquals(PROJECT_VERSION_URL, notificationContent.getProjectVersionUrl());
    assertEquals(componentName, notificationContent.getComponentName());
    assertEquals(componentVersionName, notificationContent.getComponentVersionName());
    assertEquals(firstName, notificationContent.getFirstName());
    assertEquals(lastName, notificationContent.getLastName());
    assertEquals(policyInfo, notificationContent.getPolicyInfo());
    assertEquals(policy, notificationContent.getPolicy());
    assertEquals(bomComponentVersionPolicyStatus, notificationContent.getBomComponentVersionPolicyStatus());
    assertEquals(bomComponent, notificationContent.getBomComponent());
}
Also used : PolicyInfo(com.synopsys.integration.blackduck.api.manual.component.PolicyInfo) Test(org.junit.jupiter.api.Test)

Example 4 with PolicyInfo

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

the class BlackDuckResponseTestUtility method createRuleViolationNotificationContent.

private RuleViolationNotificationContent createRuleViolationNotificationContent(String projectName, String projectVersionName) {
    RuleViolationNotificationContent notificationContent = new RuleViolationNotificationContent();
    notificationContent.setProjectName(projectName);
    notificationContent.setProjectVersionName(projectVersionName);
    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));
    return notificationContent;
}
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)

Example 5 with PolicyInfo

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

the class PolicyOverrideNotificationMessageExtractorTest method createPolicyOverrideUniquePolicyNotificationContent.

private PolicyOverrideUniquePolicyNotificationContent createPolicyOverrideUniquePolicyNotificationContent() {
    String projectName = "Project";
    String projectVersionName = "ProjectVersionName";
    String projectVersion = "http://projectVersionUrl";
    String componentName = COMPONENT.getValue();
    String componentVersionName = COMPONENT_VERSION.getValue();
    String firstName = "firstName";
    String lastName = "lastName";
    String policy = "http://policyUrl";
    String bomComponentVersionPolicyStatus = "BomComponentVersionPolicyStatus";
    String bomComponent = "http://bomComponentUrl";
    PolicyInfo policyInfo = new PolicyInfo();
    policyInfo.setPolicyName(COMPONENT_POLICY.getPolicyName());
    return new PolicyOverrideUniquePolicyNotificationContent(projectName, projectVersionName, projectVersion, componentName, componentVersionName, firstName, lastName, policyInfo, policy, bomComponentVersionPolicyStatus, bomComponent);
}
Also used : PolicyInfo(com.synopsys.integration.blackduck.api.manual.component.PolicyInfo) PolicyOverrideUniquePolicyNotificationContent(com.synopsys.integration.alert.provider.blackduck.processor.model.PolicyOverrideUniquePolicyNotificationContent)

Aggregations

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