Search in sources :

Example 1 with SchemaVersionRetriever

use of com.hortonworks.registries.schemaregistry.SchemaVersionRetriever in project registry by hortonworks.

the class AbstractAvroSnapshotDeserializer method doInit.

@Override
public void doInit(Map<String, ?> config) {
    super.doInit(config);
    SchemaVersionRetriever schemaVersionRetriever = createSchemaVersionRetriever();
    avroSchemaResolver = new AvroSchemaResolver(schemaVersionRetriever);
    useSpecificAvroReader = (boolean) getValue(config, SPECIFIC_AVRO_READER, false);
}
Also used : SchemaVersionRetriever(com.hortonworks.registries.schemaregistry.SchemaVersionRetriever) AvroSchemaResolver(com.hortonworks.registries.schemaregistry.avro.AvroSchemaResolver)

Example 2 with SchemaVersionRetriever

use of com.hortonworks.registries.schemaregistry.SchemaVersionRetriever 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);
}
Also used : SchemaVersionRetriever(com.hortonworks.registries.schemaregistry.SchemaVersionRetriever) SchemaIdVersion(com.hortonworks.registries.schemaregistry.SchemaIdVersion) SchemaVersionKey(com.hortonworks.registries.schemaregistry.SchemaVersionKey) Before(org.junit.Before)

Aggregations

SchemaVersionRetriever (com.hortonworks.registries.schemaregistry.SchemaVersionRetriever)2 SchemaIdVersion (com.hortonworks.registries.schemaregistry.SchemaIdVersion)1 SchemaVersionKey (com.hortonworks.registries.schemaregistry.SchemaVersionKey)1 AvroSchemaResolver (com.hortonworks.registries.schemaregistry.avro.AvroSchemaResolver)1 Before (org.junit.Before)1