@Test public void getSchemaGroups() { List<String> groups = client.getSchemaGroups(); assertThat(groups.size(), is(3)); assertTrue(groups.contains("Group1")); assertTrue(groups.contains("Group2")); assertTrue(groups.contains("Group3")); }
@Override public List<String> getSchemaGroups() { if(LOG.isDebugEnabled()) { LOG.debug("==> DefaultSchemaRegistryClient.getSchemaGroups()"); } ArrayList<String> res = new ArrayList<>(); WebTarget webResource = currentSchemaRegistryTargets().schemasTarget; try { Response response = login.doAction(() -> webResource.request(MediaType.APPLICATION_JSON_TYPE).get(Response.class)); if(LOG.isDebugEnabled()) { LOG.debug("DefaultSchemaRegistryClient.getSchemaGroups(): response statusCode = " + response.getStatus()); } JSONArray mDataList = new JSONObject(response.readEntity(String.class)).getJSONArray("entities"); int len = mDataList.length(); for(int i = 0; i < len; i++) { JSONObject entity = mDataList.getJSONObject(i); JSONObject schemaMetadata = (JSONObject)entity.get("schemaMetadata"); String group = (String) schemaMetadata.get("schemaGroup"); res.add(group); } } catch (Exception e) { throw new RuntimeException(e); } if(LOG.isDebugEnabled()) { LOG.debug("<== DefaultSchemaRegistryClient.getSchemaGroups(): " + res.size() + " schemaGroups found"); } return res; }
DefaultSchemaRegistryClient implements ISchemaRegistryClient { @Override public List<String> getSchemaGroups() { if(LOG.isDebugEnabled()) { LOG.debug("==> DefaultSchemaRegistryClient.getSchemaGroups()"); } ArrayList<String> res = new ArrayList<>(); WebTarget webResource = currentSchemaRegistryTargets().schemasTarget; try { Response response = login.doAction(() -> webResource.request(MediaType.APPLICATION_JSON_TYPE).get(Response.class)); if(LOG.isDebugEnabled()) { LOG.debug("DefaultSchemaRegistryClient.getSchemaGroups(): response statusCode = " + response.getStatus()); } JSONArray mDataList = new JSONObject(response.readEntity(String.class)).getJSONArray("entities"); int len = mDataList.length(); for(int i = 0; i < len; i++) { JSONObject entity = mDataList.getJSONObject(i); JSONObject schemaMetadata = (JSONObject)entity.get("schemaMetadata"); String group = (String) schemaMetadata.get("schemaGroup"); res.add(group); } } catch (Exception e) { throw new RuntimeException(e); } if(LOG.isDebugEnabled()) { LOG.debug("<== DefaultSchemaRegistryClient.getSchemaGroups(): " + res.size() + " schemaGroups found"); } return res; } }
DefaultSchemaRegistryClient implements ISchemaRegistryClient { @Override public List<String> getSchemaGroups() { if(LOG.isDebugEnabled()) { LOG.debug("==> DefaultSchemaRegistryClient.getSchemaGroups()"); } ArrayList<String> res = new ArrayList<>(); WebTarget webResource = currentSchemaRegistryTargets().schemasTarget; try { Response response = login.doAction(() -> webResource.request(MediaType.APPLICATION_JSON_TYPE).get(Response.class)); if(LOG.isDebugEnabled()) { LOG.debug("DefaultSchemaRegistryClient.getSchemaGroups(): response statusCode = " + response.getStatus()); } JSONArray mDataList = new JSONObject(response.readEntity(String.class)).getJSONArray("entities"); int len = mDataList.length(); for(int i = 0; i < len; i++) { JSONObject entity = mDataList.getJSONObject(i); JSONObject schemaMetadata = (JSONObject)entity.get("schemaMetadata"); String group = (String) schemaMetadata.get("schemaGroup"); res.add(group); } } catch (Exception e) { throw new RuntimeException(e); } if(LOG.isDebugEnabled()) { LOG.debug("<== DefaultSchemaRegistryClient.getSchemaGroups(): " + res.size() + " schemaGroups found"); } return res; } DefaultSchemaRegistryClient(Map<String, ?> conf); }
DefaultSchemaRegistryClient implements ISchemaRegistryClient { @Override public List<String> getSchemaGroups() { if(LOG.isDebugEnabled()) { LOG.debug("==> DefaultSchemaRegistryClient.getSchemaGroups()"); } ArrayList<String> res = new ArrayList<>(); WebTarget webResource = currentSchemaRegistryTargets().schemasTarget; try { Response response = login.doAction(() -> webResource.request(MediaType.APPLICATION_JSON_TYPE).get(Response.class)); if(LOG.isDebugEnabled()) { LOG.debug("DefaultSchemaRegistryClient.getSchemaGroups(): response statusCode = " + response.getStatus()); } JSONArray mDataList = new JSONObject(response.readEntity(String.class)).getJSONArray("entities"); int len = mDataList.length(); for(int i = 0; i < len; i++) { JSONObject entity = mDataList.getJSONObject(i); JSONObject schemaMetadata = (JSONObject)entity.get("schemaMetadata"); String group = (String) schemaMetadata.get("schemaGroup"); res.add(group); } } catch (Exception e) { throw new RuntimeException(e); } if(LOG.isDebugEnabled()) { LOG.debug("<== DefaultSchemaRegistryClient.getSchemaGroups(): " + res.size() + " schemaGroups found"); } return res; } DefaultSchemaRegistryClient(Map<String, ?> conf); @Override List<String> getSchemaGroups(); @Override List<String> getSchemaNames(List<String> schemaGroups); @Override List<String> getSchemaBranches(String schemaMetadataName); @Override void checkConnection(); }
DefaultSchemaRegistryClient implements ISchemaRegistryClient { @Override public List<String> getSchemaGroups() { if(LOG.isDebugEnabled()) { LOG.debug("==> DefaultSchemaRegistryClient.getSchemaGroups()"); } ArrayList<String> res = new ArrayList<>(); WebTarget webResource = currentSchemaRegistryTargets().schemasTarget; try { Response response = login.doAction(() -> webResource.request(MediaType.APPLICATION_JSON_TYPE).get(Response.class)); if(LOG.isDebugEnabled()) { LOG.debug("DefaultSchemaRegistryClient.getSchemaGroups(): response statusCode = " + response.getStatus()); } JSONArray mDataList = new JSONObject(response.readEntity(String.class)).getJSONArray("entities"); int len = mDataList.length(); for(int i = 0; i < len; i++) { JSONObject entity = mDataList.getJSONObject(i); JSONObject schemaMetadata = (JSONObject)entity.get("schemaMetadata"); String group = (String) schemaMetadata.get("schemaGroup"); res.add(group); } } catch (Exception e) { throw new RuntimeException(e); } if(LOG.isDebugEnabled()) { LOG.debug("<== DefaultSchemaRegistryClient.getSchemaGroups(): " + res.size() + " schemaGroups found"); } return res; } DefaultSchemaRegistryClient(Map<String, ?> conf); @Override List<String> getSchemaGroups(); @Override List<String> getSchemaNames(List<String> schemaGroups); @Override List<String> getSchemaBranches(String schemaMetadataName); @Override void checkConnection();  }