@Test public void testWithClient() { LoadBalancedResourceDetails details = spy(new LoadBalancedResourceDetails(client)); details.setAccessTokenUri(ACCESS_TOKEN_URI); assertThat(details.getAccessTokenUri()).isEqualTo(ACCESS_TOKEN_URI); verify(client, never()).reconstructURI(any(), any()); List<Event> events = recorder.play(); assertThat(events).isEmpty(); }
@Override public String getAccessTokenUri() { if (loadBalancerClient != null && tokenServiceId != null && !tokenServiceId.isEmpty()) { try { return loadBalancerClient.reconstructURI( loadBalancerClient.choose(tokenServiceId), new URI(super.getAccessTokenUri()) ).toString(); } catch (URISyntaxException e) { log.error(EXCEPTION_MESSAGE, e.getMessage()); return super.getAccessTokenUri(); } } else { return super.getAccessTokenUri(); } }
LoadBalancedResourceDetails extends ClientCredentialsResourceDetails { @Override public String getAccessTokenUri() { if (loadBalancerClient != null && tokenServiceId != null && !tokenServiceId.isEmpty()) { try { return loadBalancerClient.reconstructURI( loadBalancerClient.choose(tokenServiceId), new URI(super.getAccessTokenUri()) ).toString(); } catch (URISyntaxException e) { log.error(EXCEPTION_MESSAGE, e.getMessage()); return super.getAccessTokenUri(); } } else { return super.getAccessTokenUri(); } } }
LoadBalancedResourceDetails extends ClientCredentialsResourceDetails { @Override public String getAccessTokenUri() { if (loadBalancerClient != null && tokenServiceId != null && !tokenServiceId.isEmpty()) { try { return loadBalancerClient.reconstructURI( loadBalancerClient.choose(tokenServiceId), new URI(super.getAccessTokenUri()) ).toString(); } catch (URISyntaxException e) { log.error(EXCEPTION_MESSAGE, e.getMessage()); return super.getAccessTokenUri(); } } else { return super.getAccessTokenUri(); } } LoadBalancedResourceDetails(LoadBalancerClient loadBalancerClient); }
LoadBalancedResourceDetails extends ClientCredentialsResourceDetails { @Override public String getAccessTokenUri() { if (loadBalancerClient != null && tokenServiceId != null && !tokenServiceId.isEmpty()) { try { return loadBalancerClient.reconstructURI( loadBalancerClient.choose(tokenServiceId), new URI(super.getAccessTokenUri()) ).toString(); } catch (URISyntaxException e) { log.error(EXCEPTION_MESSAGE, e.getMessage()); return super.getAccessTokenUri(); } } else { return super.getAccessTokenUri(); } } LoadBalancedResourceDetails(LoadBalancerClient loadBalancerClient); @Override String getAccessTokenUri(); String getTokenServiceId(); void setTokenServiceId(String tokenServiceId); }
LoadBalancedResourceDetails extends ClientCredentialsResourceDetails { @Override public String getAccessTokenUri() { if (loadBalancerClient != null && tokenServiceId != null && !tokenServiceId.isEmpty()) { try { return loadBalancerClient.reconstructURI( loadBalancerClient.choose(tokenServiceId), new URI(super.getAccessTokenUri()) ).toString(); } catch (URISyntaxException e) { log.error(EXCEPTION_MESSAGE, e.getMessage()); return super.getAccessTokenUri(); } } else { return super.getAccessTokenUri(); } } LoadBalancedResourceDetails(LoadBalancerClient loadBalancerClient); @Override String getAccessTokenUri(); String getTokenServiceId(); void setTokenServiceId(String tokenServiceId); static final String EXCEPTION_MESSAGE; }