@Test public void connect() throws IOException { HttpResponse response = mock(HttpResponse.class); when(httpClient.execute(any(HttpUriRequest.class))).thenReturn(response); when(response.getStatusLine()).thenReturn(new BasicStatusLine(HTTP_1_1, 200, "OK")); client.connect(); }
@Override public void connect() throws IOException { HttpPost post = new HttpPost(baseUrl() + "/kylin/api/user/authentication"); addHttpHeaders(post); StringEntity requestEntity = new StringEntity("{}", ContentType.create("application/json", "UTF-8")); post.setEntity(requestEntity); try { HttpResponse response = httpClient.execute(post); if (response.getStatusLine().getStatusCode() != 200 && response.getStatusLine().getStatusCode() != 201) { throw asIOException(post, response); } } finally { post.releaseConnection(); } }
KylinClient implements IRemoteClient { @Override public void connect() throws IOException { HttpPost post = new HttpPost(baseUrl() + "/kylin/api/user/authentication"); addHttpHeaders(post); StringEntity requestEntity = new StringEntity("{}", ContentType.create("application/json", "UTF-8")); post.setEntity(requestEntity); try { HttpResponse response = httpClient.execute(post); if (response.getStatusLine().getStatusCode() != 200 && response.getStatusLine().getStatusCode() != 201) { throw asIOException(post, response); } } finally { post.releaseConnection(); } } }
KylinClient implements IRemoteClient { @Override public void connect() throws IOException { HttpPost post = new HttpPost(baseUrl() + "/kylin/api/user/authentication"); addHttpHeaders(post); StringEntity requestEntity = new StringEntity("{}", ContentType.create("application/json", "UTF-8")); post.setEntity(requestEntity); try { HttpResponse response = httpClient.execute(post); if (response.getStatusLine().getStatusCode() != 200 && response.getStatusLine().getStatusCode() != 201) { throw asIOException(post, response); } } finally { post.releaseConnection(); } } KylinClient(KylinConnectionInfo connInfo); }
KylinClient implements IRemoteClient { @Override public void connect() throws IOException { HttpPost post = new HttpPost(baseUrl() + "/kylin/api/user/authentication"); addHttpHeaders(post); StringEntity requestEntity = new StringEntity("{}", ContentType.create("application/json", "UTF-8")); post.setEntity(requestEntity); try { HttpResponse response = httpClient.execute(post); if (response.getStatusLine().getStatusCode() != 200 && response.getStatusLine().getStatusCode() != 201) { throw asIOException(post, response); } } finally { post.releaseConnection(); } } KylinClient(KylinConnectionInfo connInfo); @SuppressWarnings("rawtypes") static Class convertType(int sqlType); static Object wrapObject(String value, int sqlType); @Override void connect(); @Override KMetaProject retrieveMetaData(String project); @Override QueryResult executeQuery(String sql, List<Object> paramValues,
            Map<String, String> queryToggles); @Override void close(); }
KylinClient implements IRemoteClient { @Override public void connect() throws IOException { HttpPost post = new HttpPost(baseUrl() + "/kylin/api/user/authentication"); addHttpHeaders(post); StringEntity requestEntity = new StringEntity("{}", ContentType.create("application/json", "UTF-8")); post.setEntity(requestEntity); try { HttpResponse response = httpClient.execute(post); if (response.getStatusLine().getStatusCode() != 200 && response.getStatusLine().getStatusCode() != 201) { throw asIOException(post, response); } } finally { post.releaseConnection(); } } KylinClient(KylinConnectionInfo connInfo); @SuppressWarnings("rawtypes") static Class convertType(int sqlType); static Object wrapObject(String value, int sqlType); @Override void connect(); @Override KMetaProject retrieveMetaData(String project); @Override QueryResult executeQuery(String sql, List<Object> paramValues,
            Map<String, String> queryToggles); @Override void close();  }