@Test public void listClients() { Client clientA = new FakeClient("clientA",DEFAULT_CONTEXT, true); Client clientB = new FakeClient("clientB",DEFAULT_CONTEXT, true); Client clientC = new FakeClient("clientC",DEFAULT_CONTEXT, true); Clients clients = () -> asList((Client) clientA, clientB, clientC).iterator(); ClientApplicationRestController controller = new ClientApplicationRestController(clients, new DefaultClientIdRegistry()); List<Client> clientList = controller.listClients(null).collect(Collectors.toList()); assertEquals(3, clientList.size()); assertTrue(clientList.contains(clientA)); assertTrue(clientList.contains(clientB)); assertTrue(clientList.contains(clientC)); }
@GetMapping("clients") public Stream<Client> listClients(Principal principal) { auditLog.info("[{}] Request for a list of all connected clients.", AuditLog.username(principal)); return StreamSupport.stream(clients.spliterator(), false); }
ClientApplicationRestController { @GetMapping("clients") public Stream<Client> listClients(Principal principal) { auditLog.info("[{}] Request for a list of all connected clients.", AuditLog.username(principal)); return StreamSupport.stream(clients.spliterator(), false); } }
ClientApplicationRestController { @GetMapping("clients") public Stream<Client> listClients(Principal principal) { auditLog.info("[{}] Request for a list of all connected clients.", AuditLog.username(principal)); return StreamSupport.stream(clients.spliterator(), false); } ClientApplicationRestController(Clients clients, ClientIdRegistry clientIdRegistry); }
ClientApplicationRestController { @GetMapping("clients") public Stream<Client> listClients(Principal principal) { auditLog.info("[{}] Request for a list of all connected clients.", AuditLog.username(principal)); return StreamSupport.stream(clients.spliterator(), false); } ClientApplicationRestController(Clients clients, ClientIdRegistry clientIdRegistry); @GetMapping("{component}/instances") Iterable getComponentInstances(@PathVariable("component") String component,
                                          @RequestParam("context") String context, Principal principal); @GetMapping("clients") Stream<Client> listClients(Principal principal); @GetMapping("clientIds") Printable listClientIds(Principal principal); }
ClientApplicationRestController { @GetMapping("clients") public Stream<Client> listClients(Principal principal) { auditLog.info("[{}] Request for a list of all connected clients.", AuditLog.username(principal)); return StreamSupport.stream(clients.spliterator(), false); } ClientApplicationRestController(Clients clients, ClientIdRegistry clientIdRegistry); @GetMapping("{component}/instances") Iterable getComponentInstances(@PathVariable("component") String component,
                                          @RequestParam("context") String context, Principal principal); @GetMapping("clients") Stream<Client> listClients(Principal principal); @GetMapping("clientIds") Printable listClientIds(Principal principal);  }