DefaultSchemaRegistryClient implements ISchemaRegistryClient { @Override public List<String> getSchemaNames(List<String> schemaGroups) { if(LOG.isDebugEnabled()) { LOG.debug("==> DefaultSchemaRegistryClient.getSchemaNames( " + schemaGroups + " )"); } ArrayList<String> res = new ArrayList<>(); WebTarget webTarget = currentSchemaRegistryTargets().schemasTarget; try { Response response = login.doAction(() -> webTarget.request(MediaType.APPLICATION_JSON_TYPE).get(Response.class)); if(LOG.isDebugEnabled()) { LOG.debug("DefaultSchemaRegistryClient.getSchemaNames(): 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"); for(String schemaGroup: schemaGroups) { if(group.matches(schemaGroup)) { String name = (String) schemaMetadata.get("name"); res.add(name); } } } } catch (Exception e) { throw new RuntimeException(e); } if(LOG.isDebugEnabled()) { LOG.debug("<== DefaultSchemaRegistryClient.getSchemaNames( " + schemaGroups + " ): " + res.size() + " schemaNames 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();  }
@Test public void getSchemaNames() { List<String> groups = new ArrayList<>(); groups.add("Group1"); groups.add("Group2"); List<String> schemas = client.getSchemaNames(groups); assertThat(schemas.size(), is(2)); assertTrue(schemas.contains("Schema1")); assertTrue(schemas.contains("Schema2")); }