From 31172979e2af744ea4220403e8039c051563b025 Mon Sep 17 00:00:00 2001 From: Uttam Kumar Date: Thu, 25 Jan 2024 16:12:38 -0800 Subject: [PATCH] update SchemaComparator configuration call --- .../main/java/com/linkedin/data/avro/SchemaTranslator.java | 4 ++-- .../java/com/linkedin/data/avro/TestCustomAvroSchema.java | 4 ++-- .../test/java/com/linkedin/data/avro/TestDataTranslator.java | 4 ++-- .../linkedin/data/avro/TestFilteredSchemaDataTranslation.java | 4 ++-- .../linkedin/data/avro/TestSchemaTranslatorBijectivity.java | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/data-avro/src/main/java/com/linkedin/data/avro/SchemaTranslator.java b/data-avro/src/main/java/com/linkedin/data/avro/SchemaTranslator.java index f561fd7d6a..99c73cd86e 100644 --- a/data-avro/src/main/java/com/linkedin/data/avro/SchemaTranslator.java +++ b/data-avro/src/main/java/com/linkedin/data/avro/SchemaTranslator.java @@ -174,8 +174,8 @@ public static DataSchema avroToDataSchema(String avroSchemaInJson, AvroToDataSch } // Compare using configuration equivalent to STRICT, except ignore TRANSLATED_FROM_SOURCE_OPTION if (!ConfigurableSchemaComparator.equals(avroSchemaFromEmbedded, avroSchemaFromJson, - new SchemaComparisonConfiguration(true, true, true, false, true, true, - Collections.singleton((TRANSLATED_FROM_SOURCE_OPTION))))) { + SchemaComparisonConfiguration.STRICT.jsonPropNamesToIgnore( + Collections.singleton(SchemaTranslator.TRANSLATED_FROM_SOURCE_OPTION)))) { throw new IllegalArgumentException( "Embedded schema does not translate to input Avro schema: " + avroSchemaInJson); } diff --git a/data-avro/src/test/java/com/linkedin/data/avro/TestCustomAvroSchema.java b/data-avro/src/test/java/com/linkedin/data/avro/TestCustomAvroSchema.java index e53763354f..3ef9087647 100644 --- a/data-avro/src/test/java/com/linkedin/data/avro/TestCustomAvroSchema.java +++ b/data-avro/src/test/java/com/linkedin/data/avro/TestCustomAvroSchema.java @@ -329,8 +329,8 @@ private void translate(String dataSchemaFieldsJson, String avroSchemaFieldsJson, Assert.assertFalse(avroSchema.getProp(SchemaTranslator.TRANSLATED_FROM_SOURCE_OPTION).isEmpty()); Assert.assertTrue( ConfigurableSchemaComparator.equals(avroSchema, Schema.parse(fullAvroSchemaJson), - new SchemaComparisonConfiguration(true, true, true, false, true, true, - Collections.singleton((SchemaTranslator.TRANSLATED_FROM_SOURCE_OPTION))))); + SchemaComparisonConfiguration.STRICT.jsonPropNamesToIgnore( + Collections.singleton(SchemaTranslator.TRANSLATED_FROM_SOURCE_OPTION)))); if (debug) { diff --git a/data-avro/src/test/java/com/linkedin/data/avro/TestDataTranslator.java b/data-avro/src/test/java/com/linkedin/data/avro/TestDataTranslator.java index b3423027a5..6f68dcb268 100644 --- a/data-avro/src/test/java/com/linkedin/data/avro/TestDataTranslator.java +++ b/data-avro/src/test/java/com/linkedin/data/avro/TestDataTranslator.java @@ -1886,8 +1886,8 @@ public void testPegasusDefaultToAvroOptionalTranslation(Object... testSchemaText Assert.assertFalse(avroSchema.getProp(SchemaTranslator.TRANSLATED_FROM_SOURCE_OPTION).isEmpty()); Assert.assertTrue(ConfigurableSchemaComparator.equals(avroSchema, expectedAvroSchema, - new SchemaComparisonConfiguration(true, true, true, false, true, true, - Collections.singleton((SchemaTranslator.TRANSLATED_FROM_SOURCE_OPTION))))); + SchemaComparisonConfiguration.STRICT.jsonPropNamesToIgnore( + Collections.singleton(SchemaTranslator.TRANSLATED_FROM_SOURCE_OPTION)))); //Have a DataMap from pegasus schema DataMap dataMap = TestUtil.dataMapFromString(dataMapString); diff --git a/data-avro/src/test/java/com/linkedin/data/avro/TestFilteredSchemaDataTranslation.java b/data-avro/src/test/java/com/linkedin/data/avro/TestFilteredSchemaDataTranslation.java index 5f60f1ac70..0f14aabe3b 100644 --- a/data-avro/src/test/java/com/linkedin/data/avro/TestFilteredSchemaDataTranslation.java +++ b/data-avro/src/test/java/com/linkedin/data/avro/TestFilteredSchemaDataTranslation.java @@ -97,8 +97,8 @@ public void testFilteredAvroSchemaDataTranslation() throws IOException Assert.assertFalse(filteredAvroSchema.getProp(SchemaTranslator.TRANSLATED_FROM_SOURCE_OPTION).isEmpty()); Assert.assertTrue(ConfigurableSchemaComparator.equals(filteredAvroSchema, expectedAvroSchema, - new SchemaComparisonConfiguration(true, true, true, false, true, true, - Collections.singleton((SchemaTranslator.TRANSLATED_FROM_SOURCE_OPTION))))); + SchemaComparisonConfiguration.STRICT.jsonPropNamesToIgnore( + Collections.singleton(SchemaTranslator.TRANSLATED_FROM_SOURCE_OPTION)))); while (i < row.length) { diff --git a/data-avro/src/test/java/com/linkedin/data/avro/TestSchemaTranslatorBijectivity.java b/data-avro/src/test/java/com/linkedin/data/avro/TestSchemaTranslatorBijectivity.java index 90019033fd..bbec10d09e 100644 --- a/data-avro/src/test/java/com/linkedin/data/avro/TestSchemaTranslatorBijectivity.java +++ b/data-avro/src/test/java/com/linkedin/data/avro/TestSchemaTranslatorBijectivity.java @@ -61,8 +61,8 @@ public void testAvroConversion_correctlyConverted(String filePath, String avroRo Assert.assertFalse(resultingAvroSchema.getProp(SchemaTranslator.TRANSLATED_FROM_SOURCE_OPTION).isEmpty()); Assert.assertTrue(ConfigurableSchemaComparator.equals(resultingAvroSchema, initialAvroSchema, - new SchemaComparisonConfiguration(true, true, true, false, true, true, - Collections.singleton((SchemaTranslator.TRANSLATED_FROM_SOURCE_OPTION)))), + SchemaComparisonConfiguration.STRICT.jsonPropNamesToIgnore( + Collections.singleton(SchemaTranslator.TRANSLATED_FROM_SOURCE_OPTION))), initialAvroSchema + " ---------- " + resultingAvroSchema.toString()); }