@Test public void executeQuery() throws IOException { HttpResponse response = TestUtil.mockHttpResponseWithFile(200, "OK", "query.json"); when(httpClient.execute(any(HttpUriRequest.class))).thenReturn(response); IRemoteClient.QueryResult queryResult = client.executeQuery("SELECT 1 as val", Collections.emptyList(), new HashMap<String, String>()); assertEquals(1, queryResult.columnMeta.size()); Iterable<Object> iterable = queryResult.iterable; ArrayList<Object> list = Lists.newArrayList(iterable); assertEquals(1, list.size()); }
@Override public QueryResult executeQuery(String sql, List<Object> paramValues, Map<String, String> queryToggles) throws IOException { SQLResponseStub queryResp = executeKylinQuery(sql, convertParameters(paramValues), queryToggles); if (queryResp.getIsException()) throw new IOException(queryResp.getExceptionMessage()); List<ColumnMetaData> metas = convertColumnMeta(queryResp); List<Object> data = convertResultData(queryResp, metas); return new QueryResult(metas, data); }
KylinClient implements IRemoteClient { @Override public QueryResult executeQuery(String sql, List<Object> paramValues, Map<String, String> queryToggles) throws IOException { SQLResponseStub queryResp = executeKylinQuery(sql, convertParameters(paramValues), queryToggles); if (queryResp.getIsException()) throw new IOException(queryResp.getExceptionMessage()); List<ColumnMetaData> metas = convertColumnMeta(queryResp); List<Object> data = convertResultData(queryResp, metas); return new QueryResult(metas, data); } }
KylinClient implements IRemoteClient { @Override public QueryResult executeQuery(String sql, List<Object> paramValues, Map<String, String> queryToggles) throws IOException { SQLResponseStub queryResp = executeKylinQuery(sql, convertParameters(paramValues), queryToggles); if (queryResp.getIsException()) throw new IOException(queryResp.getExceptionMessage()); List<ColumnMetaData> metas = convertColumnMeta(queryResp); List<Object> data = convertResultData(queryResp, metas); return new QueryResult(metas, data); } KylinClient(KylinConnectionInfo connInfo); }
KylinClient implements IRemoteClient { @Override public QueryResult executeQuery(String sql, List<Object> paramValues, Map<String, String> queryToggles) throws IOException { SQLResponseStub queryResp = executeKylinQuery(sql, convertParameters(paramValues), queryToggles); if (queryResp.getIsException()) throw new IOException(queryResp.getExceptionMessage()); List<ColumnMetaData> metas = convertColumnMeta(queryResp); List<Object> data = convertResultData(queryResp, metas); return new QueryResult(metas, data); } 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 QueryResult executeQuery(String sql, List<Object> paramValues, Map<String, String> queryToggles) throws IOException { SQLResponseStub queryResp = executeKylinQuery(sql, convertParameters(paramValues), queryToggles); if (queryResp.getIsException()) throw new IOException(queryResp.getExceptionMessage()); List<ColumnMetaData> metas = convertColumnMeta(queryResp); List<Object> data = convertResultData(queryResp, metas); return new QueryResult(metas, data); } 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();  }