Skip to content

Commit

Permalink
update SchemaComparator configuration call
Browse files Browse the repository at this point in the history
  • Loading branch information
li-ukumar committed Jan 26, 2024
1 parent 6a69749 commit 3117297
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down

0 comments on commit 3117297

Please sign in to comment.