@Test public void testGetSchema() throws Exception { byte[] bytes = client.getSchema("c0", "foo", 1); Assert.assertNotNull(bytes); String str = Bytes.toString(bytes); Assert.assertEquals("{\"foo\" : \"test\"}", str); }
public byte[] getSchema(String namespace, String id, long version) throws URISyntaxException, IOException, RestClientException { URL url = concat(new URI(baseUrl), String.format("contexts/%s/schemas/%s/versions/%d", namespace, id, version)).toURL(); Response<SchemaInfo> response = request(url, "GET", new TypeToken<Response<SchemaInfo>>() { }.getType()); if (response.getCount() == 1) { return Bytes.fromHexString(response.getValues().get(0).getSpecification()); } return null; }
SchemaRegistryClient { public byte[] getSchema(String namespace, String id, long version) throws URISyntaxException, IOException, RestClientException { URL url = concat(new URI(baseUrl), String.format("contexts/%s/schemas/%s/versions/%d", namespace, id, version)).toURL(); Response<SchemaInfo> response = request(url, "GET", new TypeToken<Response<SchemaInfo>>() { }.getType()); if (response.getCount() == 1) { return Bytes.fromHexString(response.getValues().get(0).getSpecification()); } return null; } }
SchemaRegistryClient { public byte[] getSchema(String namespace, String id, long version) throws URISyntaxException, IOException, RestClientException { URL url = concat(new URI(baseUrl), String.format("contexts/%s/schemas/%s/versions/%d", namespace, id, version)).toURL(); Response<SchemaInfo> response = request(url, "GET", new TypeToken<Response<SchemaInfo>>() { }.getType()); if (response.getCount() == 1) { return Bytes.fromHexString(response.getValues().get(0).getSpecification()); } return null; } SchemaRegistryClient(String baseUrl); }
SchemaRegistryClient { public byte[] getSchema(String namespace, String id, long version) throws URISyntaxException, IOException, RestClientException { URL url = concat(new URI(baseUrl), String.format("contexts/%s/schemas/%s/versions/%d", namespace, id, version)).toURL(); Response<SchemaInfo> response = request(url, "GET", new TypeToken<Response<SchemaInfo>>() { }.getType()); if (response.getCount() == 1) { return Bytes.fromHexString(response.getValues().get(0).getSpecification()); } return null; } SchemaRegistryClient(String baseUrl); static SchemaRegistryClient getInstance(ExecutorContext context); byte[] getSchema(String namespace, String id, long version); byte[] getSchema(String namespace, String id); List<Long> getVersions(String namespace, String id); String getBaseUrl(); String getAcceptEncoding(); void setAcceptEncoding(String acceptEncoding); int getConnectionTimeout(); void setConnectionTimeout(int connectionTimeout); int getReadTimeout(); void setReadTimeout(int readTimeout); }
SchemaRegistryClient { public byte[] getSchema(String namespace, String id, long version) throws URISyntaxException, IOException, RestClientException { URL url = concat(new URI(baseUrl), String.format("contexts/%s/schemas/%s/versions/%d", namespace, id, version)).toURL(); Response<SchemaInfo> response = request(url, "GET", new TypeToken<Response<SchemaInfo>>() { }.getType()); if (response.getCount() == 1) { return Bytes.fromHexString(response.getValues().get(0).getSpecification()); } return null; } SchemaRegistryClient(String baseUrl); static SchemaRegistryClient getInstance(ExecutorContext context); byte[] getSchema(String namespace, String id, long version); byte[] getSchema(String namespace, String id); List<Long> getVersions(String namespace, String id); String getBaseUrl(); String getAcceptEncoding(); void setAcceptEncoding(String acceptEncoding); int getConnectionTimeout(); void setConnectionTimeout(int connectionTimeout); int getReadTimeout(); void setReadTimeout(int readTimeout);  }