/** * Get a schema given an id * @param id * @return * @throws IOException * @throws SchemaRegistryException */ @Override public Schema getById(MD5Digest id) throws IOException, SchemaRegistryException { if (_schemaHashMap.containsKey(id)) { return _schemaHashMap.get(id); } else { throw new SchemaRegistryException("Could not find schema with id : " + id.asString()); } }
String schemaUrl = this.url + GET_RESOURCE_BY_ID + key.asString();
@Test public void testValidString() throws NoSuchAlgorithmException, UnsupportedEncodingException { String message = "3432rdaesdfdsf2443223 234 324324 23423 e23e 23d"; byte[] md5digest = MessageDigest.getInstance("MD5").digest(message.getBytes("UTF-8")); String md5String = DigestUtils.md5Hex(message); Assert.assertNotNull(md5digest); MD5Digest md5 = MD5Digest.fromBytes(md5digest); Assert.assertEquals(md5.asString(), md5String); Assert.assertEquals(md5.asBytes(), md5digest); MD5Digest otherMd5 = MD5Digest.fromString(md5String); Assert.assertEquals(otherMd5.asBytes(), md5.asBytes()); }
/** * Get a schema given an id * @param id * @return * @throws IOException * @throws SchemaRegistryException */ @Override public Schema getById(MD5Digest id) throws IOException, SchemaRegistryException { if (_schemaHashMap.containsKey(id)) { return _schemaHashMap.get(id); } else { throw new SchemaRegistryException("Could not find schema with id : " + id.asString()); } }
String schemaUrl = this.url + GET_RESOURCE_BY_ID + key.asString();