@Test public void testCannotResolveIp() { ConfigParameter.cachedCloudHost = null; String result = resolveCloudHost(new UtilityHttpClient() { @Override public String performGetRequest(String url) throws Exception { return null; } }); assertTrue(result == null); }
public static String resolveCloudHost(UtilityHttpClient httpClient) { if (cachedCloudHost == null) { String value = null; LOGGER.debug("Attempting to get AWS host information"); try { String response = httpClient.performGetRequest("http: if (response != null && response.contains("amazonaws.com")) { value = response; LOGGER.debug(format("Found AWS hostname: %s", value)); } else if (response != null && "".equals(response)) { response = httpClient.performGetRequest("http: if (response != null) { value = response; LOGGER.debug(format( "Couldn't find AWS hostname, but did find AWS public ip: %s", value)); } } } catch (Exception e) { LOGGER.debug(format("failed to get value due to exception with message: %s ", e.getMessage())); } cachedCloudHost = value; } return cachedCloudHost; }
ConfigParameter { public static String resolveCloudHost(UtilityHttpClient httpClient) { if (cachedCloudHost == null) { String value = null; LOGGER.debug("Attempting to get AWS host information"); try { String response = httpClient.performGetRequest("http: if (response != null && response.contains("amazonaws.com")) { value = response; LOGGER.debug(format("Found AWS hostname: %s", value)); } else if (response != null && "".equals(response)) { response = httpClient.performGetRequest("http: if (response != null) { value = response; LOGGER.debug(format( "Couldn't find AWS hostname, but did find AWS public ip: %s", value)); } } } catch (Exception e) { LOGGER.debug(format("failed to get value due to exception with message: %s ", e.getMessage())); } cachedCloudHost = value; } return cachedCloudHost; } }
ConfigParameter { public static String resolveCloudHost(UtilityHttpClient httpClient) { if (cachedCloudHost == null) { String value = null; LOGGER.debug("Attempting to get AWS host information"); try { String response = httpClient.performGetRequest("http: if (response != null && response.contains("amazonaws.com")) { value = response; LOGGER.debug(format("Found AWS hostname: %s", value)); } else if (response != null && "".equals(response)) { response = httpClient.performGetRequest("http: if (response != null) { value = response; LOGGER.debug(format( "Couldn't find AWS hostname, but did find AWS public ip: %s", value)); } } } catch (Exception e) { LOGGER.debug(format("failed to get value due to exception with message: %s ", e.getMessage())); } cachedCloudHost = value; } return cachedCloudHost; }  }
ConfigParameter { public static String resolveCloudHost(UtilityHttpClient httpClient) { if (cachedCloudHost == null) { String value = null; LOGGER.debug("Attempting to get AWS host information"); try { String response = httpClient.performGetRequest("http: if (response != null && response.contains("amazonaws.com")) { value = response; LOGGER.debug(format("Found AWS hostname: %s", value)); } else if (response != null && "".equals(response)) { response = httpClient.performGetRequest("http: if (response != null) { value = response; LOGGER.debug(format( "Couldn't find AWS hostname, but did find AWS public ip: %s", value)); } } } catch (Exception e) { LOGGER.debug(format("failed to get value due to exception with message: %s ", e.getMessage())); } cachedCloudHost = value; } return cachedCloudHost; }  static String resolveAndReplace(char[] chars, int offset, int length, Map<String, String> parameterValuePairs,
            Properties configuration, List<String> errors); static String resolveCloudHost(UtilityHttpClient httpClient); static String resolveHostname(); static String resolveCloudInstanceId(UtilityHttpClient httpClient); }
ConfigParameter { public static String resolveCloudHost(UtilityHttpClient httpClient) { if (cachedCloudHost == null) { String value = null; LOGGER.debug("Attempting to get AWS host information"); try { String response = httpClient.performGetRequest("http: if (response != null && response.contains("amazonaws.com")) { value = response; LOGGER.debug(format("Found AWS hostname: %s", value)); } else if (response != null && "".equals(response)) { response = httpClient.performGetRequest("http: if (response != null) { value = response; LOGGER.debug(format( "Couldn't find AWS hostname, but did find AWS public ip: %s", value)); } } } catch (Exception e) { LOGGER.debug(format("failed to get value due to exception with message: %s ", e.getMessage())); } cachedCloudHost = value; } return cachedCloudHost; }  static String resolveAndReplace(char[] chars, int offset, int length, Map<String, String> parameterValuePairs,
            Properties configuration, List<String> errors); static String resolveCloudHost(UtilityHttpClient httpClient); static String resolveHostname(); static String resolveCloudInstanceId(UtilityHttpClient httpClient); static String cachedCloudHost; static String cachedCloudInstanceId; }