Search in sources :

Example 6 with ProjectVersionComponentVersionLicensesView

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

the class BlackDuckMessageAttributesUtilsTest method testGetLicenseLinkableItems.

@Test
public void testGetLicenseLinkableItems() {
    String licenseValue = "License Display 1";
    ProjectVersionComponentVersionView projectVersionComponentView = new ProjectVersionComponentVersionView();
    List<ProjectVersionComponentVersionLicensesView> projectVersionComponentLicensesViews = new ArrayList<>();
    ProjectVersionComponentVersionLicensesView projectVersionComponentLicensesView1 = new ProjectVersionComponentVersionLicensesView();
    projectVersionComponentLicensesView1.setLicenseDisplay(licenseValue);
    projectVersionComponentLicensesViews.add(projectVersionComponentLicensesView1);
    ProjectVersionComponentVersionLicensesView projectVersionComponentLicensesView2 = new ProjectVersionComponentVersionLicensesView();
    projectVersionComponentLicensesView2.setLicenseDisplay("License Display 2");
    projectVersionComponentLicensesViews.add(projectVersionComponentLicensesView2);
    projectVersionComponentView.setLicenses(projectVersionComponentLicensesViews);
    LinkableItem licenseLinkableItem = BlackDuckMessageAttributesUtils.extractLicense(projectVersionComponentView);
    assertEquals(licenseValue, licenseLinkableItem.getValue());
}
Also used : LinkableItem(com.synopsys.integration.alert.common.message.model.LinkableItem) ProjectVersionComponentVersionLicensesView(com.synopsys.integration.blackduck.api.generated.component.ProjectVersionComponentVersionLicensesView) ArrayList(java.util.ArrayList) ProjectVersionComponentVersionView(com.synopsys.integration.blackduck.api.generated.view.ProjectVersionComponentVersionView) Test(org.junit.jupiter.api.Test)

Example 7 with ProjectVersionComponentVersionLicensesView

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

the class BlackDuckResponseTestUtility method createProjectVersionComponentVersionView.

public ProjectVersionComponentVersionView createProjectVersionComponentVersionView() throws IntegrationException {
    ProjectVersionComponentVersionView projectVersionComponentVersionView = new ProjectVersionComponentVersionView();
    projectVersionComponentVersionView.setComponentName("component name");
    projectVersionComponentVersionView.setComponentVersion("http://component-version-url");
    projectVersionComponentVersionView.setComponentVersionName("component version name");
    projectVersionComponentVersionView.setPolicyStatus(ProjectVersionComponentPolicyStatusType.IN_VIOLATION);
    projectVersionComponentVersionView.setUsages(List.of(UsageType.DYNAMICALLY_LINKED));
    ProjectVersionComponentVersionLicensesView projectVersionComponentVersionLicensesView = new ProjectVersionComponentVersionLicensesView();
    projectVersionComponentVersionLicensesView.setLicense("http://license-link");
    projectVersionComponentVersionLicensesView.setLicenseDisplay("license-display");
    projectVersionComponentVersionView.setLicenses(List.of(projectVersionComponentVersionLicensesView));
    ResourceLink resourceLink = new ResourceLink();
    resourceLink.setHref(new HttpUrl("https://resource-url"));
    resourceLink.setRel("policy-rules");
    ResourceMetadata meta = new ResourceMetadata();
    meta.setHref(new HttpUrl("https://meta-url"));
    meta.setLinks(List.of(resourceLink));
    projectVersionComponentVersionView.setMeta(meta);
    return projectVersionComponentVersionView;
}
Also used : ProjectVersionComponentVersionLicensesView(com.synopsys.integration.blackduck.api.generated.component.ProjectVersionComponentVersionLicensesView) ResourceLink(com.synopsys.integration.blackduck.api.core.ResourceLink) ResourceMetadata(com.synopsys.integration.blackduck.api.core.ResourceMetadata) HttpUrl(com.synopsys.integration.rest.HttpUrl) ProjectVersionComponentVersionView(com.synopsys.integration.blackduck.api.generated.view.ProjectVersionComponentVersionView)

Example 8 with ProjectVersionComponentVersionLicensesView

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

the class RuleViolationClearedNotificationMessageExtractorTest method createProjectVersionComponentVersionView.

private ProjectVersionComponentVersionView createProjectVersionComponentVersionView() throws IntegrationException {
    ProjectVersionComponentVersionView projectVersionComponentVersionView = new ProjectVersionComponentVersionView();
    projectVersionComponentVersionView.setComponentName(COMPONENT.getValue());
    projectVersionComponentVersionView.setComponentVersion(COMPONENT_VERSION_URL);
    projectVersionComponentVersionView.setComponentVersionName(COMPONENT_VERSION.getValue());
    projectVersionComponentVersionView.setPolicyStatus(ProjectVersionComponentPolicyStatusType.IN_VIOLATION);
    projectVersionComponentVersionView.setUsages(List.of(UsageType.DYNAMICALLY_LINKED));
    ProjectVersionComponentVersionLicensesView projectVersionComponentVersionLicensesView = new ProjectVersionComponentVersionLicensesView();
    projectVersionComponentVersionLicensesView.setLicense("http://licenseLink");
    projectVersionComponentVersionLicensesView.setLicenseDisplay(LICENSE_DISPLAY);
    projectVersionComponentVersionView.setLicenses(List.of(projectVersionComponentVersionLicensesView));
    ResourceLink resourceLink = new ResourceLink();
    resourceLink.setHref(new HttpUrl("https://someHref"));
    resourceLink.setRel("policy-rules");
    ResourceMetadata meta = new ResourceMetadata();
    meta.setHref(new HttpUrl("https://someUrl"));
    meta.setLinks(List.of(resourceLink));
    projectVersionComponentVersionView.setMeta(meta);
    return projectVersionComponentVersionView;
}
Also used : ProjectVersionComponentVersionLicensesView(com.synopsys.integration.blackduck.api.generated.component.ProjectVersionComponentVersionLicensesView) ResourceLink(com.synopsys.integration.blackduck.api.core.ResourceLink) ResourceMetadata(com.synopsys.integration.blackduck.api.core.ResourceMetadata) HttpUrl(com.synopsys.integration.rest.HttpUrl) ProjectVersionComponentVersionView(com.synopsys.integration.blackduck.api.generated.view.ProjectVersionComponentVersionView)

Example 9 with ProjectVersionComponentVersionLicensesView

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

the class PolicyOverrideNotificationMessageExtractorTest method createProjectVersionComponentVersionView.

private ProjectVersionComponentVersionView createProjectVersionComponentVersionView() throws IntegrationException {
    ProjectVersionComponentVersionView projectVersionComponentVersionView = new ProjectVersionComponentVersionView();
    projectVersionComponentVersionView.setComponentName(COMPONENT.getValue());
    projectVersionComponentVersionView.setComponentVersion(COMPONENT_VERSION_URL);
    projectVersionComponentVersionView.setComponentVersionName(COMPONENT_VERSION.getValue());
    projectVersionComponentVersionView.setPolicyStatus(ProjectVersionComponentPolicyStatusType.IN_VIOLATION);
    projectVersionComponentVersionView.setUsages(List.of(UsageType.DYNAMICALLY_LINKED));
    ProjectVersionComponentVersionLicensesView projectVersionComponentVersionLicensesView = new ProjectVersionComponentVersionLicensesView();
    projectVersionComponentVersionLicensesView.setLicense("http://licenseLink");
    projectVersionComponentVersionLicensesView.setLicenseDisplay(LICENSE_DISPLAY);
    projectVersionComponentVersionView.setLicenses(List.of(projectVersionComponentVersionLicensesView));
    ResourceLink resourceLink = new ResourceLink();
    resourceLink.setHref(new HttpUrl("https://someHref"));
    resourceLink.setRel("policy-rules");
    ResourceMetadata meta = new ResourceMetadata();
    meta.setHref(new HttpUrl("https://someUrl"));
    meta.setLinks(List.of(resourceLink));
    projectVersionComponentVersionView.setMeta(meta);
    return projectVersionComponentVersionView;
}
Also used : ProjectVersionComponentVersionLicensesView(com.synopsys.integration.blackduck.api.generated.component.ProjectVersionComponentVersionLicensesView) ResourceLink(com.synopsys.integration.blackduck.api.core.ResourceLink) ResourceMetadata(com.synopsys.integration.blackduck.api.core.ResourceMetadata) HttpUrl(com.synopsys.integration.rest.HttpUrl) ProjectVersionComponentVersionView(com.synopsys.integration.blackduck.api.generated.view.ProjectVersionComponentVersionView)

Aggregations

ProjectVersionComponentVersionLicensesView (com.synopsys.integration.blackduck.api.generated.component.ProjectVersionComponentVersionLicensesView)9 ProjectVersionComponentVersionView (com.synopsys.integration.blackduck.api.generated.view.ProjectVersionComponentVersionView)9 ResourceMetadata (com.synopsys.integration.blackduck.api.core.ResourceMetadata)7 HttpUrl (com.synopsys.integration.rest.HttpUrl)7 ResourceLink (com.synopsys.integration.blackduck.api.core.ResourceLink)6 LinkableItem (com.synopsys.integration.alert.common.message.model.LinkableItem)2 ArrayList (java.util.ArrayList)2 Test (org.junit.jupiter.api.Test)2 RiskProfileCountsView (com.synopsys.integration.blackduck.api.generated.component.RiskProfileCountsView)1 RiskProfileView (com.synopsys.integration.blackduck.api.generated.view.RiskProfileView)1 VersionBomOriginView (com.synopsys.integration.blackduck.api.manual.temporary.component.VersionBomOriginView)1