Skip to content

Commit

Permalink
Revert "deleteUser has again a path parameter"
Browse files Browse the repository at this point in the history
This reverts commit fa214e8.
  • Loading branch information
salvatore-coppola committed Oct 4, 2023
1 parent f401847 commit e95867b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
Expand Down Expand Up @@ -116,11 +115,12 @@ public Response createUser(final UserDTO userName) {

@DELETE
@RolesAllowed(REST_ROLE_NAME)
@Path("/users/{userName}")
public Response deleteUser(@PathParam("userName") final String userName) {
@Path("/users")
@Consumes(MediaType.APPLICATION_JSON)
public Response deleteUser(final UserDTO userName) {
try {
logger.debug(DEBUG_MESSAGE, "deleteUser");
this.identityService.deleteUser(userName);
this.identityService.deleteUser(userName.getUserName());
} catch (Exception e) {
throw DefaultExceptionHandler.toWebApplicationException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ public void shouldInvokeDeleteUserSuccessfully() {

givenUser(new UserDTO("testuser", Collections.emptySet(), true, false, "testpassw"));

whenRequestIsPerformed(new MethodSpec(METHOD_SPEC_DELETE, MQTT_METHOD_SPEC_DEL),
"/users/" + this.user.getUserName());
whenRequestIsPerformed(new MethodSpec(METHOD_SPEC_DELETE, MQTT_METHOD_SPEC_DEL), "/users",
gson.toJson(this.user));

thenRequestSucceeds();
thenResponseBodyIsEmpty();
Expand Down Expand Up @@ -168,6 +168,33 @@ private static void givenIdentityService() {
when(identityServiceMock.getUserConfig()).thenReturn(userConfigs);
}

// @Test
// public void shouldRethrowWebApplicationExceptionOnReloadSecurityPolicyFingerprint() throws KuraException {
// givenFailingIdentityService();
//
// whenRequestIsPerformed(new MethodSpec(METHOD_SPEC_POST), "/security-policy-fingerprint/reload");
//
// thenResponseCodeIs(Status.INTERNAL_SERVER_ERROR.getStatusCode());
// }
//
// @Test
// public void shouldRethrowWebApplicationExceptionOnReloadCommandLineFingerprint() throws KuraException {
// givenFailingIdentityService();
//
// whenRequestIsPerformed(new MethodSpec(METHOD_SPEC_POST), "/command-line-fingerprint/reload");
//
// thenResponseCodeIs(Status.INTERNAL_SERVER_ERROR.getStatusCode());
// }
//
// @Test
// public void shouldRethrowWebApplicationExceptionOnGetDebugStatus() throws KuraException {
// givenFailingIdentityService();
//
// whenRequestIsPerformed(new MethodSpec(METHOD_SPEC_GET), "/debug-enabled");
//
// thenResponseCodeIs(Status.INTERNAL_SERVER_ERROR.getStatusCode());
// }

@BeforeClass
public static void setUp() throws Exception {
createIdentityServiceMock();
Expand Down

0 comments on commit e95867b

Please sign in to comment.