{
// translate from Avro back to Pegasus
DataMap dataMapResult = DataTranslator.genericRecordToDataMap(avroRecord, recordDataSchema, avroSchema);
ValidationResult vr = ValidateDataAgainstSchema.validate(dataMap,
recordDataSchema,
new ValidationOptions(RequiredMode.MUST_BE_PRESENT,
CoercionMode.NORMAL));
DataMap fixedInputDataMap = (DataMap) vr.getFixed();
assertTrue(vr.isValid());
if (oneWay == false)
{
assertEquals(dataMapResult, fixedInputDataMap);
}
// serialize avroRecord to binary and back
byte[] avroBytes = AvroUtil.bytesFromGenericRecord(avroRecord);
GenericRecord avroRecordFromBytes = AvroUtil.genericRecordFromBytes(avroBytes, avroRecord.getSchema());
byte[] avroBytesAgain = AvroUtil.bytesFromGenericRecord(avroRecordFromBytes);
assertEquals(avroBytes, avroBytesAgain);
// check result of roundtrip binary serialization
DataMap dataMapFromBinaryResult = DataTranslator.genericRecordToDataMap(avroRecordFromBytes, recordDataSchema, avroSchema);
vr = ValidateDataAgainstSchema.validate(dataMapFromBinaryResult,
recordDataSchema,
new ValidationOptions(RequiredMode.MUST_BE_PRESENT,
CoercionMode.NORMAL));
fixedInputDataMap = (DataMap) vr.getFixed();
assertTrue(vr.isValid());
if (oneWay == false)
{