@Test public void testCreateAuthorizationResourceWithUppercaseUsername() { UserAuthorizationService userAuthorizationService= new UserAuthorizationService("Jdoe"); ResourceInstance result = userAuthorizationService.createAuthorizationResource("id"); assertEquals("jdoe", result.getKeyValueMap().get(Resource.Type.User)); }
protected ResourceInstance createAuthorizationResource(String authorizationId) { Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>(); mapIds.put(Resource.Type.User, StringUtils.lowerCase(username)); mapIds.put(Resource.Type.UserAuthorization, authorizationId); return createResource(Resource.Type.UserAuthorization, mapIds); }
UserAuthorizationService extends BaseService { protected ResourceInstance createAuthorizationResource(String authorizationId) { Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>(); mapIds.put(Resource.Type.User, StringUtils.lowerCase(username)); mapIds.put(Resource.Type.UserAuthorization, authorizationId); return createResource(Resource.Type.UserAuthorization, mapIds); } }
UserAuthorizationService extends BaseService { protected ResourceInstance createAuthorizationResource(String authorizationId) { Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>(); mapIds.put(Resource.Type.User, StringUtils.lowerCase(username)); mapIds.put(Resource.Type.UserAuthorization, authorizationId); return createResource(Resource.Type.UserAuthorization, mapIds); } UserAuthorizationService(String username); }
UserAuthorizationService extends BaseService { protected ResourceInstance createAuthorizationResource(String authorizationId) { Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>(); mapIds.put(Resource.Type.User, StringUtils.lowerCase(username)); mapIds.put(Resource.Type.UserAuthorization, authorizationId); return createResource(Resource.Type.UserAuthorization, mapIds); } UserAuthorizationService(String username); @GET @Produces("text/plain") Response getAuthorizations(@Context HttpHeaders headers, @Context UriInfo ui); @GET @Path("{authorization_id}") @Produces("text/plain") Response getAuthorization(@Context HttpHeaders headers, @Context UriInfo ui,
                                   @PathParam("authorization_id") String authorizationId); }
UserAuthorizationService extends BaseService { protected ResourceInstance createAuthorizationResource(String authorizationId) { Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>(); mapIds.put(Resource.Type.User, StringUtils.lowerCase(username)); mapIds.put(Resource.Type.UserAuthorization, authorizationId); return createResource(Resource.Type.UserAuthorization, mapIds); } UserAuthorizationService(String username); @GET @Produces("text/plain") Response getAuthorizations(@Context HttpHeaders headers, @Context UriInfo ui); @GET @Path("{authorization_id}") @Produces("text/plain") Response getAuthorization(@Context HttpHeaders headers, @Context UriInfo ui,
                                   @PathParam("authorization_id") String authorizationId);  }