use of com.synopsys.integration.blackduck.api.manual.temporary.component.ProjectRequest in project blackduck-common by blackducksoftware.
the class ProjectAssignmentServiceTestIT method testGetAssignedUsersFromProjectView.
@Test
public void testGetAssignedUsersFromProjectView() throws IllegalArgumentException, IntegrationException {
Long timestamp = (new Date()).getTime();
String testProjectName = "hub-common-it-ProjectAssignmentServiceTest-" + timestamp;
ProjectRequest projectRequest = new ProjectRequest();
projectRequest.setName(testProjectName);
ProjectVersionWrapper projectVersionWrapper = ProjectAssignmentServiceTestIT.blackDuckServicesFactory.createProjectService().createProject(projectRequest);
ProjectAssignmentServiceTestIT.project = projectVersionWrapper.getProjectView();
System.out.println("projectUrl: " + ProjectAssignmentServiceTestIT.project.getHref());
List<AssignedUserView> assignedUsers = ProjectAssignmentServiceTestIT.blackDuckServicesFactory.createProjectUsersService().getAssignedUsersToProject(ProjectAssignmentServiceTestIT.project);
assertFalse(assignedUsers.isEmpty());
assertEquals(1, assignedUsers.size());
assertEquals("sysadmin", assignedUsers.get(0).getName());
}
use of com.synopsys.integration.blackduck.api.manual.temporary.component.ProjectRequest in project blackduck-common by blackducksoftware.
the class ProjectServiceTestIT method testCreateProjectWithTwoVersions.
@Test
public void testCreateProjectWithTwoVersions() throws Exception {
// first create a new project with a single version
String projectName = "createWithTwo" + Instant.now().toString();
String projectVersionName = "1.0.0";
ProjectSyncModel projectSyncModel = ProjectSyncModel.createWithDefaults(projectName, projectVersionName);
ProjectRequest projectRequest = projectSyncModel.createProjectRequest();
ProjectServiceTestIT.projectService.createProject(projectRequest);
Optional<ProjectVersionWrapper> projectVersionWrapper = ProjectServiceTestIT.projectService.getProjectVersion(projectName, projectVersionName);
ProjectServiceTestIT.project = projectVersionWrapper.get().getProjectView();
List<ProjectVersionView> projectVersionViews = ProjectServiceTestIT.blackDuckApiClient.getAllResponses(ProjectServiceTestIT.project.metaVersionsLink());
assertEquals(1, projectVersionViews.size());
Optional<ProjectVersionView> latestProjectVersionView = ProjectServiceTestIT.projectService.getNewestProjectVersion(ProjectServiceTestIT.project);
assertTrue(latestProjectVersionView.isPresent());
assertEquals("1.0.0", latestProjectVersionView.get().getVersionName());
ProjectVersionRequest projectVersionRequest = projectRequest.getVersionRequest();
projectVersionRequest.setVersionName("2.0.0");
ProjectServiceTestIT.projectService.createProjectVersion(ProjectServiceTestIT.project, projectVersionRequest);
List<ProjectVersionView> projectVersionViewsAfterUpdate = ProjectServiceTestIT.blackDuckApiClient.getAllResponses(ProjectServiceTestIT.project.metaVersionsLink());
assertEquals(2, projectVersionViewsAfterUpdate.size());
latestProjectVersionView = ProjectServiceTestIT.projectService.getNewestProjectVersion(ProjectServiceTestIT.project);
assertTrue(latestProjectVersionView.isPresent());
assertEquals("2.0.0", latestProjectVersionView.get().getVersionName());
}
use of com.synopsys.integration.blackduck.api.manual.temporary.component.ProjectRequest in project blackduck-common by blackducksoftware.
the class ProjectServiceTestIT method testCreatingProjectWithoutVersion.
@Test
public void testCreatingProjectWithoutVersion() throws Exception {
String projectName = "create" + Instant.now().toString();
ProjectRequest projectRequest = new ProjectRequest();
projectRequest.setName(projectName);
ProjectServiceTestIT.projectService.createProject(projectRequest);
ProjectServiceTestIT.project = ProjectServiceTestIT.projectService.getProjectByName(projectName).get();
assertEquals(projectName, ProjectServiceTestIT.project.getName());
}
use of com.synopsys.integration.blackduck.api.manual.temporary.component.ProjectRequest in project blackduck-common by blackducksoftware.
the class ProjectServiceTestIT method testJapaneseCharacterSupport.
@Test
public void testJapaneseCharacterSupport() throws IntegrationException {
deleteProjectIfExists(JAPANESE_PROJECT_NAME);
int initialProjectCount = ProjectServiceTestIT.projectService.getAllProjects().size();
ProjectSyncModel projectSyncModel = ProjectSyncModel.createWithDefaults(JAPANESE_PROJECT_NAME, JAPANESE_VERSION_NAME);
ProjectRequest projectRequest = projectSyncModel.createProjectRequest();
ProjectServiceTestIT.projectService.createProject(projectRequest);
Optional<ProjectVersionWrapper> optionalProjectVersionWrapper = ProjectServiceTestIT.projectService.getProjectVersion(JAPANESE_PROJECT_NAME, JAPANESE_VERSION_NAME);
assertTrue(optionalProjectVersionWrapper.isPresent());
int currentProjectCount = ProjectServiceTestIT.projectService.getAllProjects().size();
assertEquals(initialProjectCount + 1, currentProjectCount);
ProjectServiceTestIT.blackDuckApiClient.delete(optionalProjectVersionWrapper.get().getProjectView());
currentProjectCount = ProjectServiceTestIT.projectService.getAllProjects().size();
assertEquals(initialProjectCount, currentProjectCount);
}
use of com.synopsys.integration.blackduck.api.manual.temporary.component.ProjectRequest in project blackduck-common by blackducksoftware.
the class ProjectServiceTestIT method testCloning.
@Test
public void testCloning() throws Exception {
// first create a new project with a single version
String projectName = "create" + Instant.now().toString();
String projectVersionName = "1.0.0";
ProjectSyncModel projectSyncModel = ProjectSyncModel.createWithDefaults(projectName, projectVersionName);
ProjectRequest projectRequest = projectSyncModel.createProjectRequest();
ProjectServiceTestIT.projectService.createProject(projectRequest);
Optional<ProjectVersionWrapper> projectVersionWrapper = ProjectServiceTestIT.projectService.getProjectVersion(projectName, projectVersionName);
ProjectServiceTestIT.project = projectVersionWrapper.get().getProjectView();
ProjectVersionView projectVersionView = projectVersionWrapper.get().getProjectVersionView();
assertNotNull(ProjectServiceTestIT.project);
assertNotNull(projectVersionView);
HttpUrl projectUrl = ProjectServiceTestIT.project.getHref();
HttpUrl projectVersionUrl = projectVersionView.getHref();
List<ProjectVersionView> projectVersionViews = ProjectServiceTestIT.blackDuckApiClient.getAllResponses(ProjectServiceTestIT.project.metaVersionsLink());
assertEquals(1, projectVersionViews.size());
ProjectServiceTestIT.project.setCloneCategories(Arrays.asList(ProjectCloneCategoriesType.COMPONENT_DATA));
ProjectServiceTestIT.blackDuckApiClient.put(ProjectServiceTestIT.project);
ProjectVersionRequest projectVersionRequest = new ProjectVersionRequest();
projectVersionRequest.setCloneFromReleaseUrl(projectVersionUrl.string());
projectVersionRequest.setVersionName("1.0.0-clone");
projectVersionRequest.setPhase(ProjectVersionPhaseType.DEVELOPMENT);
projectVersionRequest.setDistribution(ProjectVersionDistributionType.OPENSOURCE);
ProjectServiceTestIT.projectService.createProjectVersion(ProjectServiceTestIT.project, projectVersionRequest);
projectVersionViews = ProjectServiceTestIT.blackDuckApiClient.getAllResponses(ProjectServiceTestIT.project.metaVersionsLink());
assertEquals(2, projectVersionViews.size());
}
Aggregations