HttpUtil { public static <T> T executeGet( final String url, final Class<T> valueType ) { if ( StringUtils.isBlank( url ) || valueType == null ) { logger.warn( "In executeGet, either url is null or blank or value type is null." ); return null; } logger.info( "In executeGet, Invoking GET on {}. Response Type: {}", url, valueType.getSimpleName() ); return HttpUtil.executeGet( url, HttpUtil.getResponseHandler( valueType ), HttpUtil.getHttpClient() ); }  static com.vmware.vrack.hms.common.HttpResponse executeRequest( String url, RequestMethod requestMethod,
                                                                           String requestBody ); static String buildUrl( List<String> list ); static T executeGet( final String url, final Class<T> valueType ); static T executeGet( final String url, final TypeReference<T> typeRef ); static HttpResponse executeGet( final String url ); static T executePost( final String url, final Object requestBody, final Class<T> valueType ); static T executePost( final String url, final Object requestBody, final TypeReference<T> typeRef ); static T executePost( final String url, final Class<T> valueType ); static T executePost( final String url, final TypeReference<T> typeRef ); static HttpResponse executePost( final String url ); static HttpResponse executePost( final String url, final Object requestBody ); static HttpResponse executePostWithBasicAuth( final String url, final String userName,
                                                         final String password ); static T executePostWithBasicAuth( final String url, final String userName, final String password,
                                                  final TypeReference<T> typeRef ); static T executePostWithBasicAuth( final String url, final String userName, final String password,
                                                  final Class<T> valueType ); static HttpClient getHttpClient(); static HttpResponse executePut( final String url ); static HttpResponse executePut( final String apiUrl, final String requestBody ); static final String RESP_CODE; static final String RESP_BODY; }
@Test public void testExecuteGet() { HttpResponse httpResponse = HttpUtil.executeGet( "http: assertNotNull( httpResponse ); assertTrue( httpResponse instanceof HttpResponse ); assertTrue( httpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK ); }
@Test public void testExecuteGetWithValueType() { HmsServiceState hmsServiceState = HttpUtil.executeGet( "http: assertNotNull( hmsServiceState ); assertTrue( hmsServiceState instanceof HmsServiceState ); }
@Test public void testExecuteGetWithTypeRef() { TypeReference<Map<String, AboutResponse>> typeRef = new TypeReference<Map<String, AboutResponse>>() { }; Map<String, AboutResponse> response = HttpUtil.executeGet( "http: assertNotNull( response ); }