@Test public void testApplyToUri() throws URISyntaxException { URI uri = new URI("http: Assert.assertEquals(uri, ClientUtils.applyToUri(uri, null)); DiscoveryInstance instance = Mockito.mock(DiscoveryInstance.class); Mockito.when(instance.isForceSsl()).thenReturn(false); Mockito.when(instance.getHost()).thenReturn("test"); Mockito.when(instance.getPort()).thenReturn(100); Assert.assertEquals(new URI("http: Mockito.when(instance.isForceSsl()).thenReturn(true); Assert.assertEquals(new URI("https: }
public static URI applyToUri(URI uri, DiscoveryInstance instance) { if ( instance != null ) { try { String scheme = instance.isForceSsl() ? "https" : ((uri.getScheme() != null) ? uri.getScheme() : "http"); return new URI(scheme, uri.getUserInfo(), instance.getHost(), instance.getPort(), uri.getRawPath(), uri.getRawQuery(), uri.getRawFragment()); } catch ( URISyntaxException e ) { log.error("Could not parse uri", e); throw new RuntimeException(e); } } return uri; }
ClientUtils { public static URI applyToUri(URI uri, DiscoveryInstance instance) { if ( instance != null ) { try { String scheme = instance.isForceSsl() ? "https" : ((uri.getScheme() != null) ? uri.getScheme() : "http"); return new URI(scheme, uri.getUserInfo(), instance.getHost(), instance.getPort(), uri.getRawPath(), uri.getRawQuery(), uri.getRawFragment()); } catch ( URISyntaxException e ) { log.error("Could not parse uri", e); throw new RuntimeException(e); } } return uri; } }
ClientUtils { public static URI applyToUri(URI uri, DiscoveryInstance instance) { if ( instance != null ) { try { String scheme = instance.isForceSsl() ? "https" : ((uri.getScheme() != null) ? uri.getScheme() : "http"); return new URI(scheme, uri.getUserInfo(), instance.getHost(), instance.getPort(), uri.getRawPath(), uri.getRawQuery(), uri.getRawFragment()); } catch ( URISyntaxException e ) { log.error("Could not parse uri", e); throw new RuntimeException(e); } } return uri; } private  ClientUtils(); }
ClientUtils { public static URI applyToUri(URI uri, DiscoveryInstance instance) { if ( instance != null ) { try { String scheme = instance.isForceSsl() ? "https" : ((uri.getScheme() != null) ? uri.getScheme() : "http"); return new URI(scheme, uri.getUserInfo(), instance.getHost(), instance.getPort(), uri.getRawPath(), uri.getRawQuery(), uri.getRawFragment()); } catch ( URISyntaxException e ) { log.error("Could not parse uri", e); throw new RuntimeException(e); } } return uri; } private  ClientUtils(); static String hostToServiceName(String host); static String serviceNameToUriForm(String serviceName); static String serviceNameToUriForm(String serviceName, String path); static String serviceNameToHost(String serviceName); static String serviceNameToHost(String serviceName, String path); static DiscoveryInstance hostToInstance(Discovery discovery, String host); static URI applyToUri(URI uri, DiscoveryInstance instance); }
ClientUtils { public static URI applyToUri(URI uri, DiscoveryInstance instance) { if ( instance != null ) { try { String scheme = instance.isForceSsl() ? "https" : ((uri.getScheme() != null) ? uri.getScheme() : "http"); return new URI(scheme, uri.getUserInfo(), instance.getHost(), instance.getPort(), uri.getRawPath(), uri.getRawQuery(), uri.getRawFragment()); } catch ( URISyntaxException e ) { log.error("Could not parse uri", e); throw new RuntimeException(e); } } return uri; } private  ClientUtils(); static String hostToServiceName(String host); static String serviceNameToUriForm(String serviceName); static String serviceNameToUriForm(String serviceName, String path); static String serviceNameToHost(String serviceName); static String serviceNameToHost(String serviceName, String path); static DiscoveryInstance hostToInstance(Discovery discovery, String host); static URI applyToUri(URI uri, DiscoveryInstance instance); static final String HOST_SUBSTITUTION_TOKEN; }