Search in sources :

Example 16 with ProjectView

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

the class ProviderDataAccessorTest method createProjectView2.

private ProjectView createProjectView2() throws IntegrationException {
    String href2 = "https://localhost:8443";
    ProjectView projectView2 = new ProjectView();
    ResourceMetadata resourceMetadata2 = new ResourceMetadata();
    resourceMetadata2.setHref(new HttpUrl(href2));
    projectView2.setMeta(resourceMetadata2);
    return projectView2;
}
Also used : ProjectView(com.synopsys.integration.blackduck.api.generated.view.ProjectView) ResourceMetadata(com.synopsys.integration.blackduck.api.core.ResourceMetadata) HttpUrl(com.synopsys.integration.rest.HttpUrl)

Example 17 with ProjectView

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

the class ProviderDataAccessorTest method getProjectByHrefTest.

@Test
void getProjectByHrefTest() throws IntegrationException {
    ProjectView projectView = createProjectView1();
    Mockito.when(blackDuckApiClient.getResponse(Mockito.any(HttpUrl.class), Mockito.eq(ProjectView.class))).thenReturn(projectView);
    BlackDuckProviderDataAccessor blackDuckProviderDataAccessor = new BlackDuckProviderDataAccessor(configurationModelConfigurationAccessor, blackDuckPropertiesFactory);
    Optional<ProviderProject> projectByHref = blackDuckProviderDataAccessor.getProjectByHref(providerConfiguration.getConfigurationId(), HREF_1);
    assertTrue(projectByHref.isPresent());
    ProviderProject providerProject = projectByHref.get();
    assertEquals(HREF_1, providerProject.getHref());
}
Also used : ProjectView(com.synopsys.integration.blackduck.api.generated.view.ProjectView) ProviderProject(com.synopsys.integration.alert.common.persistence.model.ProviderProject) HttpUrl(com.synopsys.integration.rest.HttpUrl) Test(org.junit.jupiter.api.Test)

Example 18 with ProjectView

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

the class ProviderDataAccessorTest method createProjectViewWithVersionsLink.

private ProjectView createProjectViewWithVersionsLink() throws IntegrationException {
    ProjectView projectView = new ProjectView();
    ResourceMetadata resourceMetadata = new ResourceMetadata();
    resourceMetadata.setHref(new HttpUrl(HREF_1));
    ResourceLink versionLink = new ResourceLink();
    versionLink.setRel(ProjectView.VERSIONS_LINK);
    versionLink.setHref(new HttpUrl("https://versionsHref.com"));
    resourceMetadata.setLinks(List.of(versionLink));
    projectView.setMeta(resourceMetadata);
    return projectView;
}
Also used : ResourceLink(com.synopsys.integration.blackduck.api.core.ResourceLink) ProjectView(com.synopsys.integration.blackduck.api.generated.view.ProjectView) ResourceMetadata(com.synopsys.integration.blackduck.api.core.ResourceMetadata) HttpUrl(com.synopsys.integration.rest.HttpUrl)

Example 19 with ProjectView

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

the class ProviderDataAccessorTest method createProjectView1.

private ProjectView createProjectView1() throws IntegrationException {
    ProjectView projectView = new ProjectView();
    ResourceMetadata resourceMetadata = new ResourceMetadata();
    resourceMetadata.setHref(new HttpUrl(HREF_1));
    projectView.setMeta(resourceMetadata);
    return projectView;
}
Also used : ProjectView(com.synopsys.integration.blackduck.api.generated.view.ProjectView) ResourceMetadata(com.synopsys.integration.blackduck.api.core.ResourceMetadata) HttpUrl(com.synopsys.integration.rest.HttpUrl)

Example 20 with ProjectView

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

the class BlackDuckProjectSyncTaskTest method createProjectView.

private ProjectView createProjectView(String name, String description, String href) throws IntegrationException {
    HttpUrl projectUrl = new HttpUrl(href);
    ResourceLink usersLink = new ResourceLink();
    usersLink.setRel(ProjectView.USERS_LINK);
    usersLink.setHref(projectUrl.appendRelativeUrl(ProjectView.USERS_LINK));
    ResourceMetadata resourceMetadata = new ResourceMetadata();
    resourceMetadata.setHref(new HttpUrl(href));
    resourceMetadata.setLinks(List.of(usersLink));
    ProjectView projectView = new ProjectView();
    projectView.setName(name);
    projectView.setDescription(description);
    projectView.setMeta(resourceMetadata);
    return projectView;
}
Also used : ResourceLink(com.synopsys.integration.blackduck.api.core.ResourceLink) ProjectView(com.synopsys.integration.blackduck.api.generated.view.ProjectView) ResourceMetadata(com.synopsys.integration.blackduck.api.core.ResourceMetadata) HttpUrl(com.synopsys.integration.rest.HttpUrl)

Aggregations

ProjectView (com.synopsys.integration.blackduck.api.generated.view.ProjectView)21 HttpUrl (com.synopsys.integration.rest.HttpUrl)15 BlackDuckServicesFactory (com.synopsys.integration.blackduck.service.BlackDuckServicesFactory)9 BlackDuckApiClient (com.synopsys.integration.blackduck.service.BlackDuckApiClient)8 IntegrationException (com.synopsys.integration.exception.IntegrationException)7 ProviderProject (com.synopsys.integration.alert.common.persistence.model.ProviderProject)6 ProjectVersionView (com.synopsys.integration.blackduck.api.generated.view.ProjectVersionView)6 Test (org.junit.jupiter.api.Test)5 ResourceMetadata (com.synopsys.integration.blackduck.api.core.ResourceMetadata)4 UserView (com.synopsys.integration.blackduck.api.generated.view.UserView)4 ConfigurationModel (com.synopsys.integration.alert.common.persistence.model.ConfigurationModel)3 ApiDiscovery (com.synopsys.integration.blackduck.api.generated.discovery.ApiDiscovery)3 AlertRuntimeException (com.synopsys.integration.alert.api.common.model.exception.AlertRuntimeException)2 BlackDuckProperties (com.synopsys.integration.alert.provider.blackduck.BlackDuckProperties)2 ResourceLink (com.synopsys.integration.blackduck.api.core.ResourceLink)2 BlackDuckPageDefinition (com.synopsys.integration.blackduck.http.BlackDuckPageDefinition)2 BlackDuckPageResponse (com.synopsys.integration.blackduck.http.BlackDuckPageResponse)2 BlackDuckRequestBuilder (com.synopsys.integration.blackduck.http.BlackDuckRequestBuilder)2 ProjectUsersService (com.synopsys.integration.blackduck.service.dataservice.ProjectUsersService)2 ProjectVersionWrapper (com.synopsys.integration.blackduck.service.model.ProjectVersionWrapper)2