@Test(expected = AssertionError.class) public void retrieveMetaDataWithWrongProject() throws IOException { client.retrieveMetaData("defualt2"); }
@Override public KMetaProject retrieveMetaData(String project) throws IOException { assert connInfo.getProject().equals(project); String url = baseUrl() + "/kylin/api/tables_and_columns?project=" + project; HttpGet get = new HttpGet(url); addHttpHeaders(get); HttpResponse response = httpClient.execute(get); try { if (response.getStatusLine().getStatusCode() != 200 && response.getStatusLine().getStatusCode() != 201) { throw asIOException(get, response); } List<TableMetaStub> tableMetaStubs = jsonMapper.readValue(response.getEntity().getContent(), new TypeReference<List<TableMetaStub>>() { }); List<KMetaTable> tables = convertMetaTables(tableMetaStubs); List<KMetaSchema> schemas = convertMetaSchemas(tables); List<KMetaCatalog> catalogs = convertMetaCatalogs(schemas); return new KMetaProject(project, catalogs); } finally { get.releaseConnection(); } }
KylinClient implements IRemoteClient { @Override public KMetaProject retrieveMetaData(String project) throws IOException { assert connInfo.getProject().equals(project); String url = baseUrl() + "/kylin/api/tables_and_columns?project=" + project; HttpGet get = new HttpGet(url); addHttpHeaders(get); HttpResponse response = httpClient.execute(get); try { if (response.getStatusLine().getStatusCode() != 200 && response.getStatusLine().getStatusCode() != 201) { throw asIOException(get, response); } List<TableMetaStub> tableMetaStubs = jsonMapper.readValue(response.getEntity().getContent(), new TypeReference<List<TableMetaStub>>() { }); List<KMetaTable> tables = convertMetaTables(tableMetaStubs); List<KMetaSchema> schemas = convertMetaSchemas(tables); List<KMetaCatalog> catalogs = convertMetaCatalogs(schemas); return new KMetaProject(project, catalogs); } finally { get.releaseConnection(); } } }
KylinClient implements IRemoteClient { @Override public KMetaProject retrieveMetaData(String project) throws IOException { assert connInfo.getProject().equals(project); String url = baseUrl() + "/kylin/api/tables_and_columns?project=" + project; HttpGet get = new HttpGet(url); addHttpHeaders(get); HttpResponse response = httpClient.execute(get); try { if (response.getStatusLine().getStatusCode() != 200 && response.getStatusLine().getStatusCode() != 201) { throw asIOException(get, response); } List<TableMetaStub> tableMetaStubs = jsonMapper.readValue(response.getEntity().getContent(), new TypeReference<List<TableMetaStub>>() { }); List<KMetaTable> tables = convertMetaTables(tableMetaStubs); List<KMetaSchema> schemas = convertMetaSchemas(tables); List<KMetaCatalog> catalogs = convertMetaCatalogs(schemas); return new KMetaProject(project, catalogs); } finally { get.releaseConnection(); } } KylinClient(KylinConnectionInfo connInfo); }
KylinClient implements IRemoteClient { @Override public KMetaProject retrieveMetaData(String project) throws IOException { assert connInfo.getProject().equals(project); String url = baseUrl() + "/kylin/api/tables_and_columns?project=" + project; HttpGet get = new HttpGet(url); addHttpHeaders(get); HttpResponse response = httpClient.execute(get); try { if (response.getStatusLine().getStatusCode() != 200 && response.getStatusLine().getStatusCode() != 201) { throw asIOException(get, response); } List<TableMetaStub> tableMetaStubs = jsonMapper.readValue(response.getEntity().getContent(), new TypeReference<List<TableMetaStub>>() { }); List<KMetaTable> tables = convertMetaTables(tableMetaStubs); List<KMetaSchema> schemas = convertMetaSchemas(tables); List<KMetaCatalog> catalogs = convertMetaCatalogs(schemas); return new KMetaProject(project, catalogs); } finally { get.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 KMetaProject retrieveMetaData(String project) throws IOException { assert connInfo.getProject().equals(project); String url = baseUrl() + "/kylin/api/tables_and_columns?project=" + project; HttpGet get = new HttpGet(url); addHttpHeaders(get); HttpResponse response = httpClient.execute(get); try { if (response.getStatusLine().getStatusCode() != 200 && response.getStatusLine().getStatusCode() != 201) { throw asIOException(get, response); } List<TableMetaStub> tableMetaStubs = jsonMapper.readValue(response.getEntity().getContent(), new TypeReference<List<TableMetaStub>>() { }); List<KMetaTable> tables = convertMetaTables(tableMetaStubs); List<KMetaSchema> schemas = convertMetaSchemas(tables); List<KMetaCatalog> catalogs = convertMetaCatalogs(schemas); return new KMetaProject(project, catalogs); } finally { get.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();  }