Search in sources :

Example 6 with UserGroupView

use of com.synopsys.integration.blackduck.api.generated.view.UserGroupView in project blackduck-common by blackducksoftware.

the class UserGroupService method createUserGroup.

public UserGroupView createUserGroup(UserGroupRequest userGroupRequest) throws IntegrationException {
    HttpUrl userGroupUrl = blackDuckApiClient.post(apiDiscovery.metaUsergroupsLink().getUrl(), userGroupRequest);
    UserGroupView userGroupView = blackDuckApiClient.getResponse(userGroupUrl, UserGroupView.class);
    return userGroupView;
}
Also used : UserGroupView(com.synopsys.integration.blackduck.api.generated.view.UserGroupView) HttpUrl(com.synopsys.integration.rest.HttpUrl)

Example 7 with UserGroupView

use of com.synopsys.integration.blackduck.api.generated.view.UserGroupView 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

UserGroupView (com.synopsys.integration.blackduck.api.generated.view.UserGroupView)7 HttpUrl (com.synopsys.integration.rest.HttpUrl)4 AssignedUserGroupView (com.synopsys.integration.blackduck.api.manual.temporary.response.AssignedUserGroupView)3 UserView (com.synopsys.integration.blackduck.api.generated.view.UserView)2 IntegrationException (com.synopsys.integration.exception.IntegrationException)2 ProjectView (com.synopsys.integration.blackduck.api.generated.view.ProjectView)1 RoleAssignmentView (com.synopsys.integration.blackduck.api.generated.view.RoleAssignmentView)1 AssignedUserGroupRequest (com.synopsys.integration.blackduck.api.manual.temporary.component.AssignedUserGroupRequest)1 UserGroupRequest (com.synopsys.integration.blackduck.api.manual.temporary.component.UserGroupRequest)1 AssignedUserView (com.synopsys.integration.blackduck.api.manual.temporary.view.AssignedUserView)1 BlackDuckIntegrationException (com.synopsys.integration.blackduck.exception.BlackDuckIntegrationException)1 BlackDuckApiClient (com.synopsys.integration.blackduck.service.BlackDuckApiClient)1 BlackDuckServicesFactory (com.synopsys.integration.blackduck.service.BlackDuckServicesFactory)1 BlackDuckRegistrationService (com.synopsys.integration.blackduck.service.dataservice.BlackDuckRegistrationService)1 UserGroupService (com.synopsys.integration.blackduck.service.dataservice.UserGroupService)1 UserService (com.synopsys.integration.blackduck.service.dataservice.UserService)1 DetectUserFriendlyException (com.synopsys.integration.detect.configuration.DetectUserFriendlyException)1 SilentIntLogger (com.synopsys.integration.log.SilentIntLogger)1 Slf4jIntLogger (com.synopsys.integration.log.Slf4jIntLogger)1 ConnectionResult (com.synopsys.integration.rest.client.ConnectionResult)1