@Test public void testGetSubjectSchema() { try { Schema schema = mock(Schema.class); ResponseEntity entity = mock(ResponseEntity.class); when(service.restTemplate.getForEntity( "${kafka.schema.registry.url}/subjects/sub/versions/ver", Schema.class)).thenReturn(entity); when(entity.getBody()).thenReturn(schema); service.getSubjectSchema("sub", "ver"); assertTrue(true); } catch (Throwable t) { fail("Cannot get all tables from all dbs"); } }
@Override public Schema getSubjectSchema(String subject, String version) { String path = "/subjects/" + subject + "/versions/" + version; String regUrl = registryUrl(path); ResponseEntity<Schema> res = restTemplate.getForEntity(regUrl, Schema.class); Schema result = res.getBody(); return result; }
KafkaSchemaServiceImpl implements KafkaSchemaService { @Override public Schema getSubjectSchema(String subject, String version) { String path = "/subjects/" + subject + "/versions/" + version; String regUrl = registryUrl(path); ResponseEntity<Schema> res = restTemplate.getForEntity(regUrl, Schema.class); Schema result = res.getBody(); return result; } }
KafkaSchemaServiceImpl implements KafkaSchemaService { @Override public Schema getSubjectSchema(String subject, String version) { String path = "/subjects/" + subject + "/versions/" + version; String regUrl = registryUrl(path); ResponseEntity<Schema> res = restTemplate.getForEntity(regUrl, Schema.class); Schema result = res.getBody(); return result; }  }
KafkaSchemaServiceImpl implements KafkaSchemaService { @Override public Schema getSubjectSchema(String subject, String version) { String path = "/subjects/" + subject + "/versions/" + version; String regUrl = registryUrl(path); ResponseEntity<Schema> res = restTemplate.getForEntity(regUrl, Schema.class); Schema result = res.getBody(); return result; }  @Override SchemaString getSchemaString(Integer id); @Override Iterable<String> getSubjects(); @Override Iterable<Integer> getSubjectVersions(String subject); @Override Schema getSubjectSchema(String subject, String version); @Override Config getTopLevelConfig(); @Override Config getSubjectLevelConfig(String subject); }
KafkaSchemaServiceImpl implements KafkaSchemaService { @Override public Schema getSubjectSchema(String subject, String version) { String path = "/subjects/" + subject + "/versions/" + version; String regUrl = registryUrl(path); ResponseEntity<Schema> res = restTemplate.getForEntity(regUrl, Schema.class); Schema result = res.getBody(); return result; }  @Override SchemaString getSchemaString(Integer id); @Override Iterable<String> getSubjects(); @Override Iterable<Integer> getSubjectVersions(String subject); @Override Schema getSubjectSchema(String subject, String version); @Override Config getTopLevelConfig(); @Override Config getSubjectLevelConfig(String subject);  }