Merge pull request #2539 from guusdk/KEYCLOAK-2767

KEYCLOAK-2767: Should return a primitive if possible.
This commit is contained in:
Stian Thorgersen 2016-04-07 15:41:33 +02:00
commit 63ad95a766
3 changed files with 4 additions and 5 deletions

View file

@ -29,7 +29,6 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.util.List; import java.util.List;
import java.util.Map;
public interface UsersResource { public interface UsersResource {
@ -55,7 +54,7 @@ public interface UsersResource {
@Path("count") @Path("count")
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
Map<String, Integer> count(); Integer count();
@Path("{id}") @Path("{id}")
UserResource get(@PathParam("id") String id); UserResource get(@PathParam("id") String id);

View file

@ -685,10 +685,10 @@ public class UsersResource {
@GET @GET
@NoCache @NoCache
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public Map<String, Integer> getUsersCount() { public Integer getUsersCount() {
auth.requireView(); auth.requireView();
return Collections.singletonMap("count", session.users().getUsersCount(realm)); return session.users().getUsersCount(realm);
} }
@Path("{id}/role-mappings") @Path("{id}/role-mappings")

View file

@ -235,7 +235,7 @@ public class UserTest extends AbstractClientTest {
public void count() { public void count() {
createUsers(); createUsers();
Integer count = realm.users().count().get("count"); Integer count = realm.users().count();
assertEquals(9, count.intValue()); assertEquals(9, count.intValue());
} }