Search in sources :

Example 1 with UserGroupRequest

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

the class UserServiceTestIT method testAddingGroupToProject.

@Test
public void testAddingGroupToProject() throws IntegrationException {
    String userGroupName = "user-group-test" + System.currentTimeMillis();
    ProjectView projectView = null;
    UserGroupView userGroupView = null;
    try {
        projectView = createProjectView();
        UserGroupRequest userGroupRequest = new UserGroupRequest();
        userGroupRequest.setName(userGroupName);
        userGroupView = userGroupService.createUserGroup(userGroupRequest);
        List<UserGroupView> projectGroups = projectUsersService.getGroupsForProject(projectView);
        assertFalse(projectGroups.contains(userGroupView));
        projectUsersService.addGroupToProject(projectView, userGroupName);
        projectGroups = projectUsersService.getGroupsForProject(projectView);
        assertTrue(projectGroups.contains(userGroupView));
    } finally {
        deleteView(projectView);
        deleteView(userGroupView);
    }
}
Also used : UserGroupView(com.synopsys.integration.blackduck.api.generated.view.UserGroupView) UserGroupRequest(com.synopsys.integration.blackduck.api.manual.temporary.component.UserGroupRequest) ProjectView(com.synopsys.integration.blackduck.api.generated.view.ProjectView) Test(org.junit.jupiter.api.Test)

Aggregations

ProjectView (com.synopsys.integration.blackduck.api.generated.view.ProjectView)1 UserGroupView (com.synopsys.integration.blackduck.api.generated.view.UserGroupView)1 UserGroupRequest (com.synopsys.integration.blackduck.api.manual.temporary.component.UserGroupRequest)1 Test (org.junit.jupiter.api.Test)1