use of org.apache.avro.RandomData in project beam by apache.
the class AvroUtilsTest method avroToBeamRoundTrip.
@Property(trials = 1000)
@SuppressWarnings("unchecked")
public void avroToBeamRoundTrip(@From(RecordSchemaGenerator.class) org.apache.avro.Schema avroSchema) {
Schema schema = AvroUtils.toBeamSchema(avroSchema);
Iterable iterable = new RandomData(avroSchema, 10);
List<GenericRecord> records = Lists.newArrayList((Iterable<GenericRecord>) iterable);
for (GenericRecord record : records) {
Row row = AvroUtils.toBeamRowStrict(record, schema);
GenericRecord out = AvroUtils.toGenericRecord(row, avroSchema);
assertEquals(record, out);
}
}
use of org.apache.avro.RandomData in project beam by apache.
the class AvroUtilsTest method supportsAnyAvroSchema.
@Property(trials = 1000)
@SuppressWarnings("unchecked")
public void supportsAnyAvroSchema(@From(RecordSchemaGenerator.class) org.apache.avro.Schema avroSchema) {
Schema schema = AvroUtils.toBeamSchema(avroSchema);
Iterable iterable = new RandomData(avroSchema, 10);
List<GenericRecord> records = Lists.newArrayList((Iterable<GenericRecord>) iterable);
for (GenericRecord record : records) {
AvroUtils.toBeamRowStrict(record, schema);
}
}
Aggregations