use of com.hortonworks.registries.schemaregistry.SchemaVersionKey in project registry by hortonworks.
the class AvroCompositeSchemasTest method testComposites.
@Before
public void testComposites() throws Exception {
versions = new HashMap<>();
versions.put("utils", cretaeSchemaVersionInfo("/avro/composites/util.avsc"));
versions.put("account", cretaeSchemaVersionInfo("/avro/composites/account.avsc"));
versions.put("account-cyclic", cretaeSchemaVersionInfo("/avro/composites/account-cyclic.avsc"));
versions.put("account-dep", cretaeSchemaVersionInfo("/avro/composites/account-dep.avsc"));
avroSchemaProvider = new AvroSchemaProvider();
SchemaVersionRetriever schemaVersionRetriever = new SchemaVersionRetriever() {
@Override
public SchemaVersionInfo retrieveSchemaVersion(SchemaVersionKey key) throws SchemaNotFoundException {
return versions.get(key.getSchemaName());
}
@Override
public SchemaVersionInfo retrieveSchemaVersion(SchemaIdVersion key) throws SchemaNotFoundException {
return null;
}
};
Map<String, Object> config = Collections.singletonMap(SchemaProvider.SCHEMA_VERSION_RETRIEVER_CONFIG, schemaVersionRetriever);
avroSchemaProvider.init(config);
}
use of com.hortonworks.registries.schemaregistry.SchemaVersionKey in project registry by hortonworks.
the class SchemaVersionInfoCache method invalidateSchema.
public void invalidateSchema(SchemaVersionInfoCache.Key key) {
LOG.debug("Invalidating cache entry for key [{}]", key);
loadingCache.invalidate(key);
SchemaVersionKey schemaVersionKey = key.schemaIdVersion != null ? idWithNameVersion.get(key.schemaIdVersion) : key.schemaVersionKey;
// it can be null if it is not accessed earlier.
if (schemaVersionKey != null) {
loadingCache.invalidate(Key.of(schemaVersionKey));
List<SchemaIdVersion> schemaIdVersions = nameVersionWithIds.get(schemaVersionKey);
if (schemaIdVersions != null) {
for (SchemaIdVersion schemaIdVersion : schemaIdVersions) {
loadingCache.invalidate(Key.of(schemaIdVersion));
}
}
}
}
Aggregations