Search in sources :

Example 1 with LinkSingleResponse

use of com.synopsys.integration.blackduck.api.core.response.LinkSingleResponse in project hub-alert by blackducksoftware.

the class BlackDuckMessageComponentVersionUpgradeGuidanceServiceTest method requestUpgradeGuidanceItemsBomTest.

@Test
public void requestUpgradeGuidanceItemsBomTest() throws IntegrationException {
    HttpUrl httpUrl = new HttpUrl("https://fake-url");
    UrlSingleResponse<ComponentVersionUpgradeGuidanceView> expectedUrl = new UrlSingleResponse<>(httpUrl, ComponentVersionUpgradeGuidanceView.class);
    ComponentVersionUpgradeGuidanceView upgradeGuidanceView = createUpgradeGuidance(true);
    BlackDuckApiClient blackDuckApiClient = createBlackDuckApiClient(expectedUrl, upgradeGuidanceView);
    LinkSingleResponse<ComponentVersionUpgradeGuidanceView> upgradeGuidanceLink = new LinkSingleResponse<>("upgrade-guidance", ComponentVersionUpgradeGuidanceView.class);
    ProjectVersionComponentVersionView bomComponent = createBomComponent(upgradeGuidanceLink, expectedUrl);
    BlackDuckMessageComponentVersionUpgradeGuidanceService upgradeGuidanceService = new BlackDuckMessageComponentVersionUpgradeGuidanceService(blackDuckApiClient);
    ComponentUpgradeGuidance componentUpgradeGuidance = upgradeGuidanceService.requestUpgradeGuidanceItems(bomComponent);
    assertTrue(componentUpgradeGuidance.getLongTermUpgradeGuidance().isPresent());
    assertTrue(componentUpgradeGuidance.getShortTermUpgradeGuidance().isPresent());
}
Also used : UrlSingleResponse(com.synopsys.integration.blackduck.api.core.response.UrlSingleResponse) ComponentUpgradeGuidance(com.synopsys.integration.alert.processor.api.extract.model.project.ComponentUpgradeGuidance) BlackDuckApiClient(com.synopsys.integration.blackduck.service.BlackDuckApiClient) LinkSingleResponse(com.synopsys.integration.blackduck.api.core.response.LinkSingleResponse) HttpUrl(com.synopsys.integration.rest.HttpUrl) ComponentVersionUpgradeGuidanceView(com.synopsys.integration.blackduck.api.generated.response.ComponentVersionUpgradeGuidanceView) ProjectVersionComponentVersionView(com.synopsys.integration.blackduck.api.generated.view.ProjectVersionComponentVersionView) Test(org.junit.jupiter.api.Test)

Aggregations

ComponentUpgradeGuidance (com.synopsys.integration.alert.processor.api.extract.model.project.ComponentUpgradeGuidance)1 LinkSingleResponse (com.synopsys.integration.blackduck.api.core.response.LinkSingleResponse)1 UrlSingleResponse (com.synopsys.integration.blackduck.api.core.response.UrlSingleResponse)1 ComponentVersionUpgradeGuidanceView (com.synopsys.integration.blackduck.api.generated.response.ComponentVersionUpgradeGuidanceView)1 ProjectVersionComponentVersionView (com.synopsys.integration.blackduck.api.generated.view.ProjectVersionComponentVersionView)1 BlackDuckApiClient (com.synopsys.integration.blackduck.service.BlackDuckApiClient)1 HttpUrl (com.synopsys.integration.rest.HttpUrl)1 Test (org.junit.jupiter.api.Test)1