final AvroData avroData = new AvroData(1); final org.apache.kafka.connect.data.Schema ksqlSchema = SchemaUtil.getOptionalSchema(avroData.toConnectSchema(avroSchema));
@Before public void setup() throws Exception { record = getFile("complex_objects.json"); val = BsonDocument.parse(record); builder = SchemaBuilder.struct().name("complex"); avroData = new AvroData(100); converter = new MongoDataConverter(ArrayEncoding.ARRAY); }
generator, new AvroData(1), generator.schema(), ordersSchema, new SessionManager(), "orderid");
public GenericRecordToStruct() { this.avroData = new AvroData(CACHE_SIZE); }
public GenericRecordToStruct() { this.avroData = new AvroData(CACHE_SIZE); }
@Override public void configure(Map<String, String> properties) { SchemaRegistrySchemaRetrieverConfig config = new SchemaRegistrySchemaRetrieverConfig(properties); schemaRegistryClient = new CachedSchemaRegistryClient(config.getString(config.LOCATION_CONFIG), 0); avroData = new AvroData(config.getInt(config.AVRO_DATA_CACHE_SIZE_CONFIG)); }
avroData = new AvroData(schemaCacheSize); hdfsWriter = new DataWriter(connectorConfig, context, avroData); recover(assignment);
@Test public void testRetrieveSchema() throws Exception { final TableId table = TableId.of("test", "kafka_topic"); final String testTopic = "kafka-topic"; final String testSubject = "kafka-topic-value"; final String testAvroSchemaString = "{\"type\": \"record\", " + "\"name\": \"testrecord\", " + "\"fields\": [{\"name\": \"f1\", \"type\": \"string\"}]}"; final SchemaMetadata testSchemaMetadata = new SchemaMetadata(1, 1, testAvroSchemaString); SchemaRegistryClient schemaRegistryClient = mock(SchemaRegistryClient.class); when(schemaRegistryClient.getLatestSchemaMetadata(testSubject)).thenReturn(testSchemaMetadata); SchemaRegistrySchemaRetriever testSchemaRetriever = new SchemaRegistrySchemaRetriever( schemaRegistryClient, new AvroData(0) ); Schema expectedKafkaConnectSchema = SchemaBuilder.struct().field("f1", Schema.STRING_SCHEMA).name("testrecord").build(); assertEquals(expectedKafkaConnectSchema, testSchemaRetriever.retrieveSchema(table, testTopic)); } }