@Test public void testMockSabClient() throws IOException { SabClient sabClient = new SabClientConfig().mockSabClient("user", "password", "http: assertEquals(2, sabClient.roles(URN_COLLAB_PERSON_EXAMPLE_COM_ADMIN).size()); assertEquals(0, sabClient.roles("Nope").size()); }
public List<String> roles(String userId) { String request = request(userId); ResponseEntity<byte[]> response = restTemplate.exchange(sabEndpoint, HttpMethod.POST, new HttpEntity<> (request), byte[].class); try { List<String> roles = parser.parse(new ByteArrayInputStream(response.getBody())); LOG.debug("Retrieved SAB roles with request: {} and response: {}", request, response); return roles; } catch (Exception e) { throw new RuntimeException(e); } }
SabClient { public List<String> roles(String userId) { String request = request(userId); ResponseEntity<byte[]> response = restTemplate.exchange(sabEndpoint, HttpMethod.POST, new HttpEntity<> (request), byte[].class); try { List<String> roles = parser.parse(new ByteArrayInputStream(response.getBody())); LOG.debug("Retrieved SAB roles with request: {} and response: {}", request, response); return roles; } catch (Exception e) { throw new RuntimeException(e); } } }
SabClient { public List<String> roles(String userId) { String request = request(userId); ResponseEntity<byte[]> response = restTemplate.exchange(sabEndpoint, HttpMethod.POST, new HttpEntity<> (request), byte[].class); try { List<String> roles = parser.parse(new ByteArrayInputStream(response.getBody())); LOG.debug("Retrieved SAB roles with request: {} and response: {}", request, response); return roles; } catch (Exception e) { throw new RuntimeException(e); } } SabClient(String sabUserName, String sabPassword, String sabEndpoint); }
SabClient { public List<String> roles(String userId) { String request = request(userId); ResponseEntity<byte[]> response = restTemplate.exchange(sabEndpoint, HttpMethod.POST, new HttpEntity<> (request), byte[].class); try { List<String> roles = parser.parse(new ByteArrayInputStream(response.getBody())); LOG.debug("Retrieved SAB roles with request: {} and response: {}", request, response); return roles; } catch (Exception e) { throw new RuntimeException(e); } } SabClient(String sabUserName, String sabPassword, String sabEndpoint); List<String> roles(String userId); }
SabClient { public List<String> roles(String userId) { String request = request(userId); ResponseEntity<byte[]> response = restTemplate.exchange(sabEndpoint, HttpMethod.POST, new HttpEntity<> (request), byte[].class); try { List<String> roles = parser.parse(new ByteArrayInputStream(response.getBody())); LOG.debug("Retrieved SAB roles with request: {} and response: {}", request, response); return roles; } catch (Exception e) { throw new RuntimeException(e); } } SabClient(String sabUserName, String sabPassword, String sabEndpoint); List<String> roles(String userId);  }