test_class.file: modules/flowable-rest/src/test/java/org/flowable/rest/service/api/identity/GroupMembershipResourceTest.java
test_class.identifier: GroupMembershipResourceTest
test_class.superclass: extends BaseSpringRestTestCase
test_case.body: @Test
      public void testDeleteMembership() throws Exception {
          try {
              Group testGroup = identityService.newGroup("testgroup");
              testGroup.setName("Test group");
              testGroup.setType("Test type");
              identityService.saveGroup(testGroup);
  
              User testUser = identityService.newUser("testuser");
              identityService.saveUser(testUser);
  
              identityService.createMembership("testuser", "testgroup");
  
              HttpDelete httpDelete = new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_GROUP_MEMBERSHIP, "testgroup", "testuser"));
              CloseableHttpResponse response = executeRequest(httpDelete, HttpStatus.SC_NO_CONTENT);
              closeResponse(response);
  
              // Check if membership is actually deleted
              assertThat(identityService.createUserQuery().memberOfGroup("testgroup").singleResult()).isNull();
          } finally {
              try {
                  identityService.deleteGroup("testgroup");
              } catch (Throwable ignore) {
                  // Ignore, since the group may not have been created in the test
                  // or already deleted
              }
  
              try {
                  identityService.deleteUser("testuser");
              } catch (Throwable ignore) {
                  // Ignore, since the group may not have been created in the test
                  // or already deleted
              }
          }
      }
test_case.class_method_signature: GroupMembershipResourceTest.testDeleteMembership()
test_case.full_signature: @Test public void testDeleteMembership()
test_case.identifier: testDeleteMembership
test_case.invocations: newGroup setName setType saveGroup newUser saveUser createMembership createRelativeResourceUrl executeRequest closeResponse isNull assertThat singleResult memberOfGroup createUserQuery deleteGroup deleteUser
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testDeleteMembership()
focal_class.file: modules/flowable-rest/src/main/java/org/flowable/rest/service/api/identity/GroupMembershipResource.java
focal_class.identifier: GroupMembershipResource
focal_class.class_method_signature: GroupMembershipResource.deleteMembership(@ApiParam(name = "groupId") @PathVariable("groupId") String groupId, @ApiParam(name = "userId") @PathVariable("userId") String userId, HttpServletRequest request, HttpServletResponse response)
focal_class.full_signature: @ApiOperation(value = "Delete a member from a group", tags = { "Groups" }) @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the group was found and the member has been deleted. The response body is left empty intentionally."), @ApiResponse(code = 404, message = "Indicates the requested group was not found or that the user is not a member of the group. The status description contains additional information about the error.") }) @DeleteMapping("/identity/groups/{groupId}/members/{userId}") public void deleteMembership(@ApiParam(name = "groupId") @PathVariable("groupId") String groupId, @ApiParam(name = "userId") @PathVariable("userId") String userId, HttpServletRequest request, HttpServletResponse response)
focal_class.identifier: deleteMembership
focal_class.modifiers: @ApiOperation(value = "Delete a member from a group", tags = { "Groups" }) @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the group was found and the member has been deleted. The response body is left empty intentionally."), @ApiResponse(code = 404, message = "Indicates the requested group was not found or that the user is not a member of the group. The status description contains additional information about the error.") }) @DeleteMapping("/identity/groups/{groupId}/members/{userId}") public
focal_class.parameters: (@ApiParam(name = "groupId") @PathVariable("groupId") String groupId, @ApiParam(name = "userId") @PathVariable("userId") String userId, HttpServletRequest request, HttpServletResponse response)
focal_class.return: void
focal_class.signature: void deleteMembership(@ApiParam(name = "groupId") @PathVariable("groupId") String groupId, @ApiParam(name = "userId") @PathVariable("userId") String userId, HttpServletRequest request, HttpServletResponse response)
focal_class.superclass: extends BaseGroupResource
focal_method.body: @ApiOperation(value = "Delete a member from a group", tags = { "Groups" })
      @ApiResponses(value = {
              @ApiResponse(code = 204, message = "Indicates the group was found and the member has been deleted. The response body is left empty intentionally."),
              @ApiResponse(code = 404, message = "Indicates the requested group was not found or that the user is not a member of the group. The status description contains additional information about the error.")
      })
      @DeleteMapping("/identity/groups/{groupId}/members/{userId}")
      public void deleteMembership(@ApiParam(name = "groupId") @PathVariable("groupId") String groupId, @ApiParam(name = "userId") @PathVariable("userId") String userId, HttpServletRequest request, HttpServletResponse response) {
  
          Group group = getGroupFromRequest(groupId);
  
          // Check if user is not a member of group since API does not return typed exception
          if (identityService.createUserQuery().memberOfGroup(group.getId()).userId(userId).count() != 1) {
              throw new FlowableObjectNotFoundException("User '" + userId + "' is not part of group '" + group.getId() + "'.", null);
          }
  
          identityService.deleteMembership(userId, group.getId());
          response.setStatus(HttpStatus.NO_CONTENT.value());
      }
focal_method.class_method_signature: GroupMembershipResource.deleteMembership(@ApiParam(name = "groupId") @PathVariable("groupId") String groupId, @ApiParam(name = "userId") @PathVariable("userId") String userId, HttpServletRequest request, HttpServletResponse response)
focal_method.full_signature: @ApiOperation(value = "Delete a member from a group", tags = { "Groups" }) @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the group was found and the member has been deleted. The response body is left empty intentionally."), @ApiResponse(code = 404, message = "Indicates the requested group was not found or that the user is not a member of the group. The status description contains additional information about the error.") }) @DeleteMapping("/identity/groups/{groupId}/members/{userId}") public void deleteMembership(@ApiParam(name = "groupId") @PathVariable("groupId") String groupId, @ApiParam(name = "userId") @PathVariable("userId") String userId, HttpServletRequest request, HttpServletResponse response)
focal_method.identifier: deleteMembership
focal_method.invocations: getGroupFromRequest count userId memberOfGroup createUserQuery getId getId deleteMembership getId setStatus value
focal_method.modifiers: @ApiOperation(value = "Delete a member from a group", tags = { "Groups" }) @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the group was found and the member has been deleted. The response body is left empty intentionally."), @ApiResponse(code = 404, message = "Indicates the requested group was not found or that the user is not a member of the group. The status description contains additional information about the error.") }) @DeleteMapping("/identity/groups/{groupId}/members/{userId}") public
focal_method.parameters: (@ApiParam(name = "groupId") @PathVariable("groupId") String groupId, @ApiParam(name = "userId") @PathVariable("userId") String userId, HttpServletRequest request, HttpServletResponse response)
focal_method.return: void
focal_method.signature: void deleteMembership(@ApiParam(name = "groupId") @PathVariable("groupId") String groupId, @ApiParam(name = "userId") @PathVariable("userId") String userId, HttpServletRequest request, HttpServletResponse response)