DefaultSchemaRegistryClient implements ISchemaRegistryClient { @Override public List<String> getSchemaBranches(String schemaMetadataName) { if(LOG.isDebugEnabled()) { LOG.debug("==> DefaultSchemaRegistryClient.getSchemaBranches( " + schemaMetadataName + " )"); } ArrayList<String> res = new ArrayList<>(); WebTarget target = currentSchemaRegistryTargets().schemasTarget.path(encode(schemaMetadataName) + "/branches"); try { Response response = login.doAction(() -> target.request(MediaType.APPLICATION_JSON_TYPE).get(Response.class)); if(LOG.isDebugEnabled()) { LOG.debug("DefaultSchemaRegistryClient.getSchemaBranches(): 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 branchInfo = entity; String smName = (String) branchInfo.get("schemaMetadataName"); if (smName.matches(schemaMetadataName)) { String bName = (String) branchInfo.get("name"); res.add(bName); } } } catch (Exception e) { throw new RuntimeException(e); } if(LOG.isDebugEnabled()) { LOG.debug("<== DefaultSchemaRegistryClient.getSchemaBranches( " + schemaMetadataName + " ): " + res.size() + " branches 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 getSchemaBranches() { List<String> branches = client.getSchemaBranches("Schema1"); assertTrue(branches.isEmpty()); branches = client.getSchemaBranches("Schema3"); assertThat(branches.size(), is(1)); assertThat(branches.get(0), is("MASTER")); }