Search in sources :

Example 1 with ProjectVersionPhaseType

use of com.synopsys.integration.blackduck.api.manual.temporary.enumeration.ProjectVersionPhaseType in project synopsys-detect by blackducksoftware.

the class DetectConfigurationFactory method createDetectProjectServiceOptions.

public ProjectSyncOptions createDetectProjectServiceOptions() {
    ProjectVersionPhaseType projectVersionPhase = detectConfiguration.getValue(DetectProperties.DETECT_PROJECT_VERSION_PHASE);
    ProjectVersionDistributionType projectVersionDistribution = detectConfiguration.getValue(DetectProperties.DETECT_PROJECT_VERSION_DISTRIBUTION);
    Integer projectTier = detectConfiguration.getNullableValue(DetectProperties.DETECT_PROJECT_TIER);
    String projectDescription = detectConfiguration.getNullableValue(DetectProperties.DETECT_PROJECT_DESCRIPTION);
    String projectVersionNotes = detectConfiguration.getNullableValue(DetectProperties.DETECT_PROJECT_VERSION_NOTES);
    List<ProjectCloneCategoriesType> cloneCategories = detectConfiguration.getValue(DetectProperties.DETECT_PROJECT_CLONE_CATEGORIES).representedValues();
    Boolean projectLevelAdjustments = detectConfiguration.getValue(DetectProperties.DETECT_PROJECT_LEVEL_ADJUSTMENTS);
    Boolean forceProjectVersionUpdate = detectConfiguration.getValue(DetectProperties.DETECT_PROJECT_VERSION_UPDATE);
    String projectVersionNickname = detectConfiguration.getNullableValue(DetectProperties.DETECT_PROJECT_VERSION_NICKNAME);
    return new ProjectSyncOptions(projectVersionPhase, projectVersionDistribution, projectTier, projectDescription, projectVersionNotes, cloneCategories, forceProjectVersionUpdate, projectVersionNickname, projectLevelAdjustments);
}
Also used : ProjectVersionDistributionType(com.synopsys.integration.blackduck.api.generated.enumeration.ProjectVersionDistributionType) ProjectVersionPhaseType(com.synopsys.integration.blackduck.api.manual.temporary.enumeration.ProjectVersionPhaseType) ProjectCloneCategoriesType(com.synopsys.integration.blackduck.api.generated.enumeration.ProjectCloneCategoriesType) ProjectSyncOptions(com.synopsys.integration.detect.workflow.blackduck.project.options.ProjectSyncOptions)

Example 2 with ProjectVersionPhaseType

use of com.synopsys.integration.blackduck.api.manual.temporary.enumeration.ProjectVersionPhaseType in project blackduck-common by blackducksoftware.

the class ComprehensiveCookbookTestIT method createProjectVersionSingleCall.

@Test
public void createProjectVersionSingleCall() throws Exception {
    String testProjectName = intHttpClientTestHelper.getProperty("TEST_CREATE_PROJECT");
    ProjectService projectService = blackDuckServicesFactory.createProjectService();
    BlackDuckApiClient blackDuckApiClient = blackDuckServicesFactory.getBlackDuckApiClient();
    IntLogger logger = blackDuckServicesFactory.getLogger();
    // delete the project, if it exists
    intHttpClientTestHelper.deleteIfProjectExists(logger, projectService, blackDuckApiClient, testProjectName);
    // get the count of all projects now
    int projectCount = blackDuckApiClient.getAllResponses(apiDiscovery.metaProjectsLink()).size();
    String versionName = "RestConnectionTest";
    ProjectVersionDistributionType distribution = ProjectVersionDistributionType.INTERNAL;
    ProjectVersionPhaseType phase = ProjectVersionPhaseType.DEVELOPMENT;
    ProjectSyncModel projectSyncModel = new ProjectSyncModel(testProjectName, versionName);
    projectSyncModel.setPhase(phase);
    projectSyncModel.setDistribution(distribution);
    ProjectRequest projectRequest = projectSyncModel.createProjectRequest();
    // create the project
    ProjectVersionWrapper projectVersionWrapper = projectService.createProject(projectRequest);
    ProjectView projectItem = projectVersionWrapper.getProjectView();
    Optional<ProjectView> projectItemFromName = projectService.getProjectByName(testProjectName);
    // should return the same project
    assertTrue(projectItemFromName.isPresent());
    assertEquals(projectItem.toString(), projectItemFromName.get().toString());
    int projectCountAfterCreate = blackDuckApiClient.getAllResponses(apiDiscovery.metaProjectsLink()).size();
    assertTrue(projectCountAfterCreate > projectCount);
    Optional<ProjectVersionView> projectVersionItem = projectService.getProjectVersion(projectItem, versionName);
    assertTrue(projectVersionItem.isPresent());
    assertEquals(versionName, projectVersionItem.get().getVersionName());
    // should return the same project version
    assertEquals(projectVersionWrapper.getProjectVersionView().toString(), projectVersionItem.get().toString());
}
Also used : ProjectSyncModel(com.synopsys.integration.blackduck.service.model.ProjectSyncModel) ProjectVersionDistributionType(com.synopsys.integration.blackduck.api.generated.enumeration.ProjectVersionDistributionType) ProjectVersionPhaseType(com.synopsys.integration.blackduck.api.manual.temporary.enumeration.ProjectVersionPhaseType) ProjectService(com.synopsys.integration.blackduck.service.dataservice.ProjectService) BlackDuckApiClient(com.synopsys.integration.blackduck.service.BlackDuckApiClient) SilentIntLogger(com.synopsys.integration.log.SilentIntLogger) IntLogger(com.synopsys.integration.log.IntLogger) ProjectRequest(com.synopsys.integration.blackduck.api.manual.temporary.component.ProjectRequest) ProjectVersionView(com.synopsys.integration.blackduck.api.generated.view.ProjectVersionView) ProjectView(com.synopsys.integration.blackduck.api.generated.view.ProjectView) ProjectVersionWrapper(com.synopsys.integration.blackduck.service.model.ProjectVersionWrapper) Test(org.junit.jupiter.api.Test)

Aggregations

ProjectVersionDistributionType (com.synopsys.integration.blackduck.api.generated.enumeration.ProjectVersionDistributionType)2 ProjectVersionPhaseType (com.synopsys.integration.blackduck.api.manual.temporary.enumeration.ProjectVersionPhaseType)2 ProjectCloneCategoriesType (com.synopsys.integration.blackduck.api.generated.enumeration.ProjectCloneCategoriesType)1 ProjectVersionView (com.synopsys.integration.blackduck.api.generated.view.ProjectVersionView)1 ProjectView (com.synopsys.integration.blackduck.api.generated.view.ProjectView)1 ProjectRequest (com.synopsys.integration.blackduck.api.manual.temporary.component.ProjectRequest)1 BlackDuckApiClient (com.synopsys.integration.blackduck.service.BlackDuckApiClient)1 ProjectService (com.synopsys.integration.blackduck.service.dataservice.ProjectService)1 ProjectSyncModel (com.synopsys.integration.blackduck.service.model.ProjectSyncModel)1 ProjectVersionWrapper (com.synopsys.integration.blackduck.service.model.ProjectVersionWrapper)1 ProjectSyncOptions (com.synopsys.integration.detect.workflow.blackduck.project.options.ProjectSyncOptions)1 IntLogger (com.synopsys.integration.log.IntLogger)1 SilentIntLogger (com.synopsys.integration.log.SilentIntLogger)1 Test (org.junit.jupiter.api.Test)1