@Test public void testLoad_dataModels_successfulLoad() throws Exception { String base = String.format("http: HTTPSchemaLoader client = new HTTPSchemaLoader(base, "manifest.json"); SetValuedMap<String, Schema> glossary = client.load(); Assert.assertNotNull(glossary); Assert.assertEquals(1, glossary.size()); Set<Schema> dataModels = glossary.get(DATA_MODEL_NAME); Assert.assertEquals(1, dataModels.size()); Schema dataModel = (Schema) dataModels.toArray()[0]; Assert.assertEquals(DATA_MODEL_NAME, dataModel.getFullName()); Assert.assertEquals(1, dataModel.getFields().size()); Assert.assertNotNull(dataModel.getField("TEST_MODEL")); Schema model = dataModel.getField("TEST_MODEL").schema(); Assert.assertNotNull(model); Schema modelType = model.getTypes().stream() .filter(t -> t.getType() == Schema.Type.RECORD) .findFirst() .orElse(null); Assert.assertNotNull(modelType); Assert.assertEquals("TEST_MODEL", modelType.getName()); Assert.assertEquals(1, modelType.getFields().size()); Assert.assertNotNull(modelType.getField("int_field")); }
@Override public SetValuedMap<String, Schema> load() throws IOException { Manifest manifest = downloadResource(baseUrl, manifestName, is -> gson.fromJson(new InputStreamReader(is), Manifest.class)); if (manifest == null) { throw new IOException("unable to download the manifest resource."); } return downloadSchemas(manifest); }
HTTPSchemaLoader implements AvroSchemaLoader { @Override public SetValuedMap<String, Schema> load() throws IOException { Manifest manifest = downloadResource(baseUrl, manifestName, is -> gson.fromJson(new InputStreamReader(is), Manifest.class)); if (manifest == null) { throw new IOException("unable to download the manifest resource."); } return downloadSchemas(manifest); } }
HTTPSchemaLoader implements AvroSchemaLoader { @Override public SetValuedMap<String, Schema> load() throws IOException { Manifest manifest = downloadResource(baseUrl, manifestName, is -> gson.fromJson(new InputStreamReader(is), Manifest.class)); if (manifest == null) { throw new IOException("unable to download the manifest resource."); } return downloadSchemas(manifest); } HTTPSchemaLoader(String baseUrl, String manifestName); }
HTTPSchemaLoader implements AvroSchemaLoader { @Override public SetValuedMap<String, Schema> load() throws IOException { Manifest manifest = downloadResource(baseUrl, manifestName, is -> gson.fromJson(new InputStreamReader(is), Manifest.class)); if (manifest == null) { throw new IOException("unable to download the manifest resource."); } return downloadSchemas(manifest); } HTTPSchemaLoader(String baseUrl, String manifestName); @Override SetValuedMap<String, Schema> load(); }
HTTPSchemaLoader implements AvroSchemaLoader { @Override public SetValuedMap<String, Schema> load() throws IOException { Manifest manifest = downloadResource(baseUrl, manifestName, is -> gson.fromJson(new InputStreamReader(is), Manifest.class)); if (manifest == null) { throw new IOException("unable to download the manifest resource."); } return downloadSchemas(manifest); } HTTPSchemaLoader(String baseUrl, String manifestName); @Override SetValuedMap<String, Schema> load();  }