@Test public void handlesNoAssociations() { when(clientDAO.getClientById(1)).thenReturn(Optional.of(client)); when(aclDAO.getGroupsFor(client)).thenReturn(Collections.emptySet()); when(aclDAO.getSanitizedSecretsFor(client)).thenReturn(ImmutableSet.of()); ClientDetailResponse response = resource.getClient(user, new LongParam("1")); assertThat(response.groups).isEmpty(); assertThat(response.secrets).isEmpty(); }
@Path("{clientId}") @Timed @ExceptionMetered @GET public ClientDetailResponse getClient(@Auth User user, @PathParam("clientId") LongParam clientId) { logger.info("User '{}' retrieving client id={}.", user, clientId); return clientDetailResponseFromId(clientId.get()); }
ClientsResource { @Path("{clientId}") @Timed @ExceptionMetered @GET public ClientDetailResponse getClient(@Auth User user, @PathParam("clientId") LongParam clientId) { logger.info("User '{}' retrieving client id={}.", user, clientId); return clientDetailResponseFromId(clientId.get()); } }
ClientsResource { @Path("{clientId}") @Timed @ExceptionMetered @GET public ClientDetailResponse getClient(@Auth User user, @PathParam("clientId") LongParam clientId) { logger.info("User '{}' retrieving client id={}.", user, clientId); return clientDetailResponseFromId(clientId.get()); } @Inject  ClientsResource(AclDAOFactory aclDAOFactory, ClientDAOFactory clientDAOFactory,
      AuditLog auditLog); @VisibleForTesting  ClientsResource(AclDAO aclDAO, ClientDAO clientDAO, AuditLog auditLog); }
ClientsResource { @Path("{clientId}") @Timed @ExceptionMetered @GET public ClientDetailResponse getClient(@Auth User user, @PathParam("clientId") LongParam clientId) { logger.info("User '{}' retrieving client id={}.", user, clientId); return clientDetailResponseFromId(clientId.get()); } @Inject  ClientsResource(AclDAOFactory aclDAOFactory, ClientDAOFactory clientDAOFactory,
      AuditLog auditLog); @VisibleForTesting  ClientsResource(AclDAO aclDAO, ClientDAO clientDAO, AuditLog auditLog); @Timed @ExceptionMetered @GET Response findClients(@Auth User user, @DefaultValue("") @QueryParam("name") String name); @Timed @ExceptionMetered @POST @Consumes(APPLICATION_JSON) Response createClient(@Auth User user,
      @Valid CreateClientRequestV2 createClientRequest); @Path("{clientId}") @Timed @ExceptionMetered @GET ClientDetailResponse getClient(@Auth User user,
      @PathParam("clientId") LongParam clientId); @Path("{clientId}") @Timed @ExceptionMetered @DELETE Response deleteClient(@Auth User user, @PathParam("clientId") LongParam clientId); }
ClientsResource { @Path("{clientId}") @Timed @ExceptionMetered @GET public ClientDetailResponse getClient(@Auth User user, @PathParam("clientId") LongParam clientId) { logger.info("User '{}' retrieving client id={}.", user, clientId); return clientDetailResponseFromId(clientId.get()); } @Inject  ClientsResource(AclDAOFactory aclDAOFactory, ClientDAOFactory clientDAOFactory,
      AuditLog auditLog); @VisibleForTesting  ClientsResource(AclDAO aclDAO, ClientDAO clientDAO, AuditLog auditLog); @Timed @ExceptionMetered @GET Response findClients(@Auth User user, @DefaultValue("") @QueryParam("name") String name); @Timed @ExceptionMetered @POST @Consumes(APPLICATION_JSON) Response createClient(@Auth User user,
      @Valid CreateClientRequestV2 createClientRequest); @Path("{clientId}") @Timed @ExceptionMetered @GET ClientDetailResponse getClient(@Auth User user,
      @PathParam("clientId") LongParam clientId); @Path("{clientId}") @Timed @ExceptionMetered @DELETE Response deleteClient(@Auth User user, @PathParam("clientId") LongParam clientId);  }