From 03c5d90f0788620e2660955a0a037d959e7c3384 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 24 Sep 2024 15:43:58 +0200 Subject: [PATCH] TANGO-2130 : Updated and refactored tests --- ...gleBigQueryAvroToProtoConverterTest.groovy | 371 ----------------- .../ConvertAndCastPrimitivesTest.groovy | 94 +++++ .../ConvertArrayOfPrimitivesTest.groovy | 110 +++++ .../conversions/ConvertPrimitivesTest.groovy | 177 ++++++++ .../ConvertRecordWithPrimitivesTest.groovy | 62 +++ .../src/test/resources/2130/int.avsc | 11 - .../src/test/resources/2130/int.proto | 5 - .../src/test/resources/schemas/enum.avsc | 18 - ...e-changed-from-nullable-to-required-1.avsc | 13 - ...e-changed-from-nullable-to-required-2.avsc | 12 - ...ullable-record-with-required-fields-1.avsc | 13 - ...ullable-record-with-required-fields-2.avsc | 29 -- ...-record-with-nested-required-fields-1.avsc | 13 - ...-record-with-nested-required-fields-2.avsc | 39 -- ...y-added-record-with-required-fields-1.avsc | 13 - ...y-added-record-with-required-fields-2.avsc | 28 -- .../schemas/evolution/priceListChanged-2.avsc | 349 ---------------- .../schemas/evolution/priceListChanged-3.avsc | 378 ------------------ .../schemas/logical-types/bytesDecimal.avsc | 16 - .../logical-types/bytesDecimalJavaClass.avsc | 17 - .../schemas/logical-types/fixedDecimal.avsc | 18 - .../logical-types/fixedDecimalJavaClass.avsc | 19 - .../schemas/logical-types/fixedDuration.avsc | 16 - .../schemas/logical-types/intDate.avsc | 14 - .../schemas/logical-types/intTimeMillis.avsc | 14 - .../logical-types/intTimeMillisJavaClass.avsc | 15 - .../schemas/logical-types/longTimeMicros.avsc | 14 - .../longTimeMicrosJavaClass.avsc | 15 - .../logical-types/longTimestampMicros.avsc | 14 - .../longTimestampMicrosJavaClass.avsc | 15 - .../logical-types/longTimestampMillis.avsc | 14 - .../longTimestampMillisJavaClass.avsc | 15 - .../schemas/logical-types/stringUuid.avsc | 14 - .../schemas/map-with-values-map.avsc | 17 - .../schemas/metadata-field/metadata.avsc | 16 - .../src/test/resources/schemas/nested.avsc | 36 -- .../src/test/resources/schemas/null.avsc | 11 - .../record-primitives/empty-inner-record.avsc | 19 - .../record-primitives/empty-schema.avsc | 7 - .../union/union-less-than-two-types.avsc | 11 - .../union/union-more-than-two-types.avsc | 11 - .../union/union-null-at-second-position.avsc | 11 - .../schemas/union/union-without-null.avsc | 11 - 43 files changed, 443 insertions(+), 1672 deletions(-) delete mode 100644 hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/GoogleBigQueryAvroToProtoConverterTest.groovy create mode 100644 hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/conversions/ConvertAndCastPrimitivesTest.groovy create mode 100644 hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/conversions/ConvertArrayOfPrimitivesTest.groovy create mode 100644 hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/conversions/ConvertPrimitivesTest.groovy create mode 100644 hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/conversions/ConvertRecordWithPrimitivesTest.groovy delete mode 100644 hermes-consumers/src/test/resources/2130/int.avsc delete mode 100644 hermes-consumers/src/test/resources/2130/int.proto delete mode 100644 hermes-consumers/src/test/resources/schemas/enum.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/evolution/mode-changed-from-nullable-to-required-1.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/evolution/mode-changed-from-nullable-to-required-2.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/evolution/newly-added-nullable-record-with-required-fields-1.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/evolution/newly-added-nullable-record-with-required-fields-2.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/evolution/newly-added-record-with-nested-required-fields-1.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/evolution/newly-added-record-with-nested-required-fields-2.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/evolution/newly-added-record-with-required-fields-1.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/evolution/newly-added-record-with-required-fields-2.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/evolution/priceListChanged-2.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/evolution/priceListChanged-3.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/logical-types/bytesDecimal.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/logical-types/bytesDecimalJavaClass.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/logical-types/fixedDecimal.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/logical-types/fixedDecimalJavaClass.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/logical-types/fixedDuration.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/logical-types/intDate.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/logical-types/intTimeMillis.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/logical-types/intTimeMillisJavaClass.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/logical-types/longTimeMicros.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/logical-types/longTimeMicrosJavaClass.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/logical-types/longTimestampMicros.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/logical-types/longTimestampMicrosJavaClass.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/logical-types/longTimestampMillis.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/logical-types/longTimestampMillisJavaClass.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/logical-types/stringUuid.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/map-with-values-map.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/metadata-field/metadata.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/nested.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/null.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/record-primitives/empty-inner-record.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/record-primitives/empty-schema.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/union/union-less-than-two-types.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/union/union-more-than-two-types.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/union/union-null-at-second-position.avsc delete mode 100644 hermes-consumers/src/test/resources/schemas/union/union-without-null.avsc diff --git a/hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/GoogleBigQueryAvroToProtoConverterTest.groovy b/hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/GoogleBigQueryAvroToProtoConverterTest.groovy deleted file mode 100644 index b9eca889c7..0000000000 --- a/hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/GoogleBigQueryAvroToProtoConverterTest.groovy +++ /dev/null @@ -1,371 +0,0 @@ -package pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro - -import com.google.cloud.bigquery.storage.v1.TableFieldSchema -import com.google.cloud.bigquery.storage.v1.TableSchema -import com.google.protobuf.Descriptors -import com.google.protobuf.DynamicMessage -import org.apache.avro.Schema -import org.apache.avro.SchemaBuilder -import org.apache.avro.generic.GenericData -import org.apache.avro.generic.GenericRecord -import org.apache.avro.generic.GenericRecordBuilder -import org.junit.jupiter.api.Test -import pl.allegro.tech.hermes.consumers.consumer.Message -import spock.lang.Specification -import spock.lang.Unroll -import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.AvroTrait -import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.* - -import java.nio.ByteBuffer - -class GoogleBigQueryAvroToProtoConverterTest extends Specification implements AvroTrait { - @Test - void convertPrimitivesToProtoMessage() { - - given: - Schema schema = getSchemaFromResources("${suite}/${avroType}") - String fieldName = "field" - GenericRecord record = new GenericRecordBuilder(schema).set(fieldName, avroValue).build() - GoogleBigQueryAvroToProtoConverter converter = new GoogleBigQueryAvroToProtoConverter() - - when: - DynamicMessage message = converter.convertToProtoMessage(protoDescriptor, record) - - - then: - message != null - println(message) - def field = message.getDescriptorForType().findFieldByName(fieldName) - def converted_value = message.getField(field) - record.hasField(fieldName) == message.hasField(field) - transformResult(converted_value) == expectedProtoValue - - - where: - suite | avroType | protoDescriptor | avroValue | expectedProtoValue | transformResult - "primitives" | "string" | StringProto.PrimitivesString.getDescriptor() | "value" | "value" | { c -> c } - "primitives" | "int" | Int32Proto.PrimitivesInt32.getDescriptor() | 12 | 12 | { c -> c } - "primitives" | "long" | Int64Proto.PrimitivesInt64.getDescriptor() | 12l | 12l | { c -> c } - "primitives" | "boolean" | Int64Proto.PrimitivesInt64.getDescriptor() | 12l | 12l | { c -> c } -/*-->*/ "primitives" | "boolean" | BoolProto.PrimitivesBool.getDescriptor() | true | true | { c -> c } - "primitives" | "bytes" | BytesProto.PrimitivesBytes.getDescriptor() | ByteBuffer.wrap("123".getBytes()) | "123" | { c -> new String(c.bytes) } - "primitives" | "float" | FloatProto.PrimitivesFloat.getDescriptor() | 1.234f | 1.234f | { c -> c } - "primitives" | "double" | DoubleProto.PrimitivesDouble.getDescriptor() | 1.234d | 1.234d | { c -> c } - - - } - - void convertPrimitivesToProtoMessageWithCasting() { - - given: - Schema schema = getSchemaFromResources("${suite}/${avroType}") - String fieldName = "field" - GenericRecord record = new GenericRecordBuilder(schema).set(fieldName, avroValue).build() - GoogleBigQueryAvroToProtoConverter converter = new GoogleBigQueryAvroToProtoConverter() - - when: - DynamicMessage message = converter.convertToProtoMessage(protoDescriptor, record) - - - then: - message != null - println(message) - def field = message.getDescriptorForType().findFieldByName(fieldName) - def converted_value = message.getField(field) - if (field.getDefaultValue() != avroValue) { - record.hasField(fieldName) == message.hasField(field) - } - transformResult(converted_value) == expectedProtoValue - - - where: - suite | avroType | protoDescriptor | avroValue | expectedProtoValue | transformResult - "primitives" | "string" | StringProto.PrimitivesString.getDescriptor() | "value" | "value" | { c -> c } - "primitives" | "string" | StringProto.PrimitivesString.getDescriptor() | 12 | "12" | { c -> c } - "primitives" | "string" | StringProto.PrimitivesString.getDescriptor() | 12l | "12" | { c -> c } - "primitives" | "string" | StringProto.PrimitivesString.getDescriptor() | 12f | "12.0" | { c -> c } - "primitives" | "string" | StringProto.PrimitivesString.getDescriptor() | 12d | "12.0" | { c -> c } - - "primitives" | "int" | Int32Proto.PrimitivesInt32.getDescriptor() | 12 | 12 | { c -> c } - "primitives" | "long" | Int32Proto.PrimitivesInt32.getDescriptor() | 12l | 12 | { c -> c } - "primitives" | "float" | Int32Proto.PrimitivesInt32.getDescriptor() | 12f | 12 | { c -> c } - "primitives" | "double" | Int32Proto.PrimitivesInt32.getDescriptor() | 12d | 12 | { c -> c } - "primitives" | "string" | Int32Proto.PrimitivesInt32.getDescriptor() | "12" | 12 | { c -> c } - "primitives" | "boolean" | Int32Proto.PrimitivesInt32.getDescriptor() | true | 1 | { c -> c } - "primitives" | "boolean" | Int32Proto.PrimitivesInt32.getDescriptor() | false | 0 | { c -> c } -// - "primitives" | "int" | Int64Proto.PrimitivesInt64.getDescriptor() | 12 | 12l | { c -> c } - "primitives" | "long" | Int64Proto.PrimitivesInt64.getDescriptor() | 12l | 12l | { c -> c } - "primitives" | "float" | Int64Proto.PrimitivesInt64.getDescriptor() | 12f | 12l | { c -> c } - "primitives" | "double" | Int64Proto.PrimitivesInt64.getDescriptor() | 12d | 12l | { c -> c } - "primitives" | "string" | Int64Proto.PrimitivesInt64.getDescriptor() | "12.0" | 12l | { c -> c } - "primitives" | "boolean" | Int64Proto.PrimitivesInt64.getDescriptor() | true | 1l | { c -> c } - "primitives" | "boolean" | Int64Proto.PrimitivesInt64.getDescriptor() | false | 0l | { c -> c } - - "primitives" | "int" | FloatProto.PrimitivesFloat.getDescriptor() | 12 | 12.0f | { c -> c } - "primitives" | "long" | FloatProto.PrimitivesFloat.getDescriptor() | 12l | 12.0f | { c -> c } - "primitives" | "float" | FloatProto.PrimitivesFloat.getDescriptor() | 12.234f | 12.234f | { c -> c } - "primitives" | "double" | FloatProto.PrimitivesFloat.getDescriptor() | 12.234d | 12.234f | { c -> c } - "primitives" | "string" | FloatProto.PrimitivesFloat.getDescriptor() | "12.234" | 12.234f | { c -> c } - "primitives" | "boolean" | FloatProto.PrimitivesFloat.getDescriptor() | true | 1f | { c -> c } - "primitives" | "boolean" | FloatProto.PrimitivesFloat.getDescriptor() | false | 0f | { c -> c } - - "primitives" | "int" | DoubleProto.PrimitivesDouble.getDescriptor() | 12 | 12.0d | { c -> c } - "primitives" | "long" | DoubleProto.PrimitivesDouble.getDescriptor() | 12l | 12.0d | { c -> c } - "primitives" | "float" | DoubleProto.PrimitivesDouble.getDescriptor() | 12.5f | 12.5d | { c -> c } - "primitives" | "double" | DoubleProto.PrimitivesDouble.getDescriptor() | 12.234d | 12.234d | { c -> c } - "primitives" | "string" | DoubleProto.PrimitivesDouble.getDescriptor() | "12.234" | 12.234d | { c -> c } - "primitives" | "boolean" | DoubleProto.PrimitivesDouble.getDescriptor() | true | 1d | { c -> c } - "primitives" | "boolean" | DoubleProto.PrimitivesDouble.getDescriptor() | false | 0d | { c -> c } - - "primitives" | "boolean" | BoolProto.PrimitivesBool.getDescriptor() | true | true | { c -> c } - "primitives" | "boolean" | BoolProto.PrimitivesBool.getDescriptor() | false | false | { c -> c } - "primitives" | "string" | BoolProto.PrimitivesBool.getDescriptor() | "true" | true | { c -> c } - "primitives" | "string" | BoolProto.PrimitivesBool.getDescriptor() | "false" | false | { c -> c } - "primitives" | "boolean" | BoolProto.PrimitivesBool.getDescriptor() | 1 | true | { c -> c } - "primitives" | "boolean" | BoolProto.PrimitivesBool.getDescriptor() | 0 | false | { c -> c } - } - - @Test - void convertNullablePrimitivesToProtoMessage() { - - given: - Schema schema = getSchemaFromResources("${suite}/${avroType}") - String fieldName = "field" - GenericRecord record = new GenericRecordBuilder(schema).set(fieldName, avroValue).build() - GoogleBigQueryAvroToProtoConverter converter = new GoogleBigQueryAvroToProtoConverter() - - when: - DynamicMessage message = converter.convertToProtoMessage(protoDescriptor, record) - - - then: - message != null - println(message) - def field = message.getDescriptorForType().findFieldByName(fieldName) -// record.hasField(fieldName) == message.hasField(field) - def converted_value = message.hasField(field) ? (message.getField(field)) : null - transformResult(converted_value) == expectedProtoValue - - - where: - suite | avroType | protoDescriptor | avroValue | expectedProtoValue | transformResult - "nullable-primitives" | "long" | NInt64Proto.NullablePrimitivesInt64.getDescriptor() | 12 | 12l | { c -> c } - "nullable-primitives" | "string" | NStringProto.NullablePrimitivesString.getDescriptor() | null | null | { c -> c } - "nullable-primitives" | "string" | NStringProto.NullablePrimitivesString.getDescriptor() | "value" | "value" | { c -> c } - "nullable-primitives" | "int" | NInt32Proto.NullablePrimitivesInt32.getDescriptor() | 12 | 12 | { c -> c } - "nullable-primitives" | "long" | NInt64Proto.NullablePrimitivesInt64.getDescriptor() | 12l | 12l | { c -> c } - "nullable-primitives" | "boolean" | NInt64Proto.NullablePrimitivesInt64.getDescriptor() | 12l | 12l | { c -> c } -/*-->*/ "nullable-primitives" | "boolean" | NBoolProto.NullablePrimitivesBool.getDescriptor() | true | true | { c -> c } - "nullable-primitives" | "bytes" | NBytesProto.NullablePrimitivesBytes.getDescriptor() | ByteBuffer.wrap("123".getBytes()) | "123" | { c -> new String(c.bytes) } - "nullable-primitives" | "float" | NFloatProto.NullablePrimitivesFloat.getDescriptor() | 1.234f | 1.234f | { c -> c } - "nullable-primitives" | "double" | NDoubleProto.NullablePrimitivesDouble.getDescriptor() | 1.234d | 1.234d | { c -> c } - - - } - - @Test - void convertNullableWithNullPrimitivesToProtoMessage() { - - given: - Schema schema = getSchemaFromResources("${suite}/${avroType}") - String fieldName = "field" - GenericRecord record = new GenericRecordBuilder(schema).set(fieldName, avroValue).build() - GoogleBigQueryAvroToProtoConverter converter = new GoogleBigQueryAvroToProtoConverter() - - when: - DynamicMessage message = converter.convertToProtoMessage(protoDescriptor, record) - - - then: - message != null - println(message) - def field = message.getDescriptorForType().findFieldByName(fieldName) - record.hasField(fieldName) == !message.hasField(field) - def converted_value = message.hasField(field) ? (message.getField(field)) : null - transformResult(converted_value) == expectedProtoValue - - - where: - suite | avroType | protoDescriptor | avroValue | expectedProtoValue | transformResult - "nullable-primitives" | "string" | NStringProto.NullablePrimitivesString.getDescriptor() | null | null | { c -> c } - "nullable-primitives" | "int" | NInt32Proto.NullablePrimitivesInt32.getDescriptor() | null | null | { c -> c } - "nullable-primitives" | "long" | NInt64Proto.NullablePrimitivesInt64.getDescriptor() | null | null | { c -> c } - "nullable-primitives" | "boolean" | NInt64Proto.NullablePrimitivesInt64.getDescriptor() | null | null | { c -> c } -/*-->*/ "nullable-primitives" | "boolean" | NBoolProto.NullablePrimitivesBool.getDescriptor() | null | null | { c -> c } - "nullable-primitives" | "bytes" | NBytesProto.NullablePrimitivesBytes.getDescriptor() | null | null | { c -> c } - "nullable-primitives" | "float" | NFloatProto.NullablePrimitivesFloat.getDescriptor() | null | null | { c -> c } - "nullable-primitives" | "double" | NDoubleProto.NullablePrimitivesDouble.getDescriptor() | null | null | { c -> c } - - - } - - @Test - void convertDefaultPrimitivesToProtoMessage() { - - given: - Schema schema = getSchemaFromResources("${suite}/${avroType}") - String fieldName = "field" - GenericRecord record = fieldExists ? new GenericRecordBuilder(schema).set(fieldName, null).build() : new GenericRecordBuilder(schema).build() - GoogleBigQueryAvroToProtoConverter converter = new GoogleBigQueryAvroToProtoConverter() - - when: - DynamicMessage message = converter.convertToProtoMessage(protoDescriptor, record) - - - then: - message != null - println(message) - def field = message.getDescriptorForType().findFieldByName(fieldName) -// record.hasField(fieldName) == !message.hasField(field) - def converted_value = message.hasField(field) ? (message.getField(field)) : null - transformResult(converted_value) == expectedProtoValue - - - where: - suite | avroType | fieldExists | protoDescriptor | expectedProtoValue | transformResult - "default-primitives" | "string" | true | NStringProto.NullablePrimitivesString.getDescriptor() | null | { c -> c } - "default-primitives" | "int" | true | NInt32Proto.NullablePrimitivesInt32.getDescriptor() | null | { c -> c } - "default-primitives" | "long" | true | NInt64Proto.NullablePrimitivesInt64.getDescriptor() | null | { c -> c } - "default-primitives" | "boolean" | true | NInt64Proto.NullablePrimitivesInt64.getDescriptor() | null | { c -> c } - "default-primitives" | "boolean" | true | NBoolProto.NullablePrimitivesBool.getDescriptor() | null | { c -> c } - "default-primitives" | "bytes" | true | NBytesProto.NullablePrimitivesBytes.getDescriptor() | null | { c -> c } - "default-primitives" | "float" | true | NFloatProto.NullablePrimitivesFloat.getDescriptor() | null | { c -> c } - "default-primitives" | "double" | true | NDoubleProto.NullablePrimitivesDouble.getDescriptor() | null | { c -> c } - "default-primitives" | "string" | false | NStringProto.NullablePrimitivesString.getDescriptor() | "Z sejmu dla Faktów Katarzyna Bolesna-Mordęga" | { c -> c } - "default-primitives" | "int" | false | NInt32Proto.NullablePrimitivesInt32.getDescriptor() | 997 | { c -> c } - "default-primitives" | "long" | false | NInt64Proto.NullablePrimitivesInt64.getDescriptor() | 1614322339997 | { c -> c } - "default-primitives" | "boolean" | false | NBoolProto.NullablePrimitivesBool.getDescriptor() | true | { c -> c } - "default-primitives" | "bytes" | false | NBytesProto.NullablePrimitivesBytes.getDescriptor() | "\u0074\u0065\u0073\u0074".getBytes() | { c -> c.bytes } - "default-primitives" | "float" | false | NFloatProto.NullablePrimitivesFloat.getDescriptor() | 3.14f | { c -> c } - "default-primitives" | "double" | false | NDoubleProto.NullablePrimitivesDouble.getDescriptor() | 3.14d | { c -> c } - - - } - - @Test - void convertArrayPrimitivesToProtoMessage() { - - given: - Schema schema = getSchemaFromResources("${suite}/${avroType}") - String fieldName = "field" - GenericRecord record = new GenericRecordBuilder(schema).set(fieldName, avroValue).build() - GoogleBigQueryAvroToProtoConverter converter = new GoogleBigQueryAvroToProtoConverter() - - when: - DynamicMessage message = converter.convertToProtoMessage(protoDescriptor, record) - - - then: - message != null - println(message) - def field = message.getDescriptorForType().findFieldByName(fieldName) - def converted_value = message.getField(field).collect { transformResult(it) } - converted_value == expectedProtoValue - - - where: - suite | avroType | protoDescriptor | avroValue | expectedProtoValue | transformResult - "array-primitives" | "string" | ArrayStringProto.ArrayPrimitivesString.getDescriptor() | [] | [] | { c -> c } - "array-primitives" | "int" | ArrayInt32Proto.ArrayPrimitivesInt32.getDescriptor() | [] | [] | { c -> c } - "array-primitives" | "long" | ArrayInt64Proto.ArrayPrimitivesInt64.getDescriptor() | [] | [] | { c -> c } - "array-primitives" | "boolean" | ArrayInt64Proto.ArrayPrimitivesInt64.getDescriptor() | [] | [] | { c -> c } - "array-primitives" | "boolean" | ArrayBoolProto.ArrayPrimitivesBool.getDescriptor() | [] | [] | { c -> c } - "array-primitives" | "bytes" | ArrayBytesProto.ArrayPrimitivesBytes.getDescriptor() | [] | [] | { c -> c } - "array-primitives" | "float" | ArrayFloatProto.ArrayPrimitivesFloat.getDescriptor() | [] | [] | { c -> c } - "array-primitives" | "double" | ArrayDoubleProto.ArrayPrimitivesDouble.getDescriptor() | [] | [] | { c -> c } - "array-primitives" | "string" | ArrayStringProto.ArrayPrimitivesString.getDescriptor() | ["a", "b", "c"] | ["a", "b", "c"] | { c -> c } - "array-primitives" | "int" | ArrayInt32Proto.ArrayPrimitivesInt32.getDescriptor() | [1, 2, 3] | [1, 2, 3] | { c -> c } - "array-primitives" | "long" | ArrayInt64Proto.ArrayPrimitivesInt64.getDescriptor() | [4l, 5l, 6l] | [4l, 5l, 6l] | { c -> c } - "array-primitives" | "boolean" | ArrayBoolProto.ArrayPrimitivesBool.getDescriptor() | [true, true, false] | [true, true, false] | { c -> c } - "array-primitives" | "bytes" | ArrayBytesProto.ArrayPrimitivesBytes.getDescriptor() | [ByteBuffer.wrap("123".getBytes()), ByteBuffer.wrap("456".getBytes())] | ["123".bytes, "456".bytes] | { c -> c.bytes } - "array-primitives" | "float" | ArrayFloatProto.ArrayPrimitivesFloat.getDescriptor() | [3.14f, 6.28f] | [3.14f, 6.28f] | { c -> c } - "array-primitives" | "double" | ArrayDoubleProto.ArrayPrimitivesDouble.getDescriptor() | [3.14d, 6.28d] | [3.14d, 6.28d] | { c -> c } - - - } - - @Test - void convertMapPrimitivesToProtoMessage() { - - given: - Schema schema = getSchemaFromResources("${suite}/${avroType}") - String fieldName = "field" - GenericRecord record = new GenericRecordBuilder(schema).set(fieldName, avroValue).build() - GoogleBigQueryAvroToProtoConverter converter = new GoogleBigQueryAvroToProtoConverter() - - when: - DynamicMessage message = converter.convertToProtoMessage(protoDescriptor, record) - - - then: - message != null - println(message) - def field = message.getDescriptorForType().findFieldByName(fieldName) - def converted_value = message.getField(field).toString().replace("\n", " ") - converted_value == expectedProtoValue - - - where: - suite | avroType | protoDescriptor | avroValue | expectedProtoValue | transformResult - "map-primitives" | "string" | StringToStringProto.PrimitivesStringToString.getDescriptor() | [:] | "[]" | { c -> c } - "map-primitives" | "int" | StringToInt32Proto.PrimitivesStringToInt32.getDescriptor() | [:] | "[]" | { c -> c } - "map-primitives" | "long" | StringToInt64Proto.PrimitivesStringToInt64.getDescriptor() | [:] | "[]" | { c -> c } - "map-primitives" | "boolean" | StringToInt64Proto.PrimitivesStringToInt64.getDescriptor() | [:] | "[]" | { c -> c } - "map-primitives" | "boolean" | StringToBoolProto.PrimitivesStringToBool.getDescriptor() | [:] | "[]" | { c -> c } - "map-primitives" | "bytes" | StringToBytesProto.PrimitivesStringToBytes.getDescriptor() | [:] | "[]" | { c -> c } - "map-primitives" | "float" | StringToFloatProto.PrimitivesStringToFloat.getDescriptor() | [:] | "[]" | { c -> c } - "map-primitives" | "double" | StringToDoubleProto.PrimitivesStringToDouble.getDescriptor() | [:] | "[]" | { c -> c } - "map-primitives" | "string" | StringToStringProto.PrimitivesStringToString.getDescriptor() | ["a": "a", "b": "b", "c": "c"] | "[key: \"a\" value: \"a\" , key: \"b\" value: \"b\" , key: \"c\" value: \"c\" ]" | { c -> c } - "map-primitives" | "int" | StringToInt32Proto.PrimitivesStringToInt32.getDescriptor() | ["a": 1, "b": 2, "c": 3] | "[key: \"a\" value: 1 , key: \"b\" value: 2 , key: \"c\" value: 3 ]" | { c -> c } - "map-primitives" | "long" | StringToInt64Proto.PrimitivesStringToInt64.getDescriptor() | ["a": 4l, "b": 5l, "c": 6l] | "[key: \"a\" value: 4 , key: \"b\" value: 5 , key: \"c\" value: 6 ]" | { c -> c } - "map-primitives" | "boolean" | StringToBoolProto.PrimitivesStringToBool.getDescriptor() | ["a": true, "b": true, "c": false] | "[key: \"a\" value: true , key: \"b\" value: true , key: \"c\" value: false ]" | { c -> c } - "map-primitives" | "bytes" | StringToBytesProto.PrimitivesStringToBytes.getDescriptor() | ["a": ByteBuffer.wrap("123".getBytes()), "b": ByteBuffer.wrap("456".getBytes())] | "[key: \"a\" value: \"123\" , key: \"b\" value: \"456\" ]" | { c -> c } - "map-primitives" | "float" | StringToFloatProto.PrimitivesStringToFloat.getDescriptor() | ["a": 3.14f, "b": 6.28f] | "[key: \"a\" value: 3.14 , key: \"b\" value: 6.28 ]" | { c -> c } - "map-primitives" | "double" | StringToDoubleProto.PrimitivesStringToDouble.getDescriptor() | ["a": 3.14d, "b": 6.28d] | "[key: \"a\" value: 3.14 , key: \"b\" value: 6.28 ]" | { c -> c } - - - } - - @Test - void convertRecordPrimitivesToProtoMessage() { - - given: - Schema schema = getSchemaFromResources("${suite}/${avroType}") - String fieldName = "field" - String valueFieldName = "value_field" -// GenericRecord record = fieldExists ? new GenericRecordBuilder(schema).set(fieldName, null).build() : new GenericRecordBuilder(schema).build() - GenericRecord record = new GenericRecordBuilder(schema).set( - fieldName, - new GenericRecordBuilder(schema.getField(fieldName).schema()).set(valueFieldName, avroValue).build() - ).build() - GoogleBigQueryAvroToProtoConverter converter = new GoogleBigQueryAvroToProtoConverter() - - when: - DynamicMessage message = converter.convertToProtoMessage(protoDescriptor, record) - - - then: - message != null - println(message) - def field = message.getDescriptorForType().findFieldByName(fieldName) - def convertedFieldValue = message.getField(field).toString().replace("\\", "").replace("\n", "") - def expectedRecord = "value_field: ${expectedProtoValue}".replace("\\", "").replace("\n", "") -// record.hasField(fieldName) == !message.hasField(field)def converted_value = message.hasField(field) ? (message.getField(field)) : null - expectedRecord == convertedFieldValue - - - where: - suite | avroType | protoDescriptor | avroValue | expectedProtoValue | transformResult - "record-primitives" | "string" | RecordStringProto.RecordPrimitivesString.getDescriptor() | "value" | "\"value\"" | { c -> c } - "record-primitives" | "int" | RecordInt32Proto.RecordPrimitivesInt32.getDescriptor() | 12 | 12 | { c -> c } - "record-primitives" | "long" | RecordInt64Proto.RecordPrimitivesInt64.getDescriptor() | 12l | 12l | { c -> c } - "record-primitives" | "boolean" | RecordInt64Proto.RecordPrimitivesInt64.getDescriptor() | 12l | 12l | { c -> c } -/*-->*/ "record-primitives" | "boolean" | RecordBoolProto.RecordPrimitivesBool.getDescriptor() | true | true | { c -> c } - "record-primitives" | "bytes" | RecordBytesProto.RecordPrimitivesBytes.getDescriptor() | ByteBuffer.wrap("123".getBytes()) | "\"123\"" | { c -> new String(c.bytes) } - "record-primitives" | "float" | RecordFloatProto.RecordPrimitivesFloat.getDescriptor() | 1.234f | 1.234f | { c -> c } - "record-primitives" | "double" | RecordDoubleProto.RecordPrimitivesDouble.getDescriptor() | 1.234d | 1.234d | { c -> c } - - - } -} diff --git a/hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/conversions/ConvertAndCastPrimitivesTest.groovy b/hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/conversions/ConvertAndCastPrimitivesTest.groovy new file mode 100644 index 0000000000..164d9d1797 --- /dev/null +++ b/hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/conversions/ConvertAndCastPrimitivesTest.groovy @@ -0,0 +1,94 @@ +package pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.conversions + +import com.google.protobuf.DynamicMessage +import org.apache.avro.Schema +import org.apache.avro.generic.GenericRecord +import org.apache.avro.generic.GenericRecordBuilder +import org.junit.jupiter.api.Test +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.AvroTrait +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.GoogleBigQueryAvroToProtoConverter +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.BoolProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.DoubleProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.FloatProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.Int32Proto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.Int64Proto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.StringProto +import spock.lang.Specification + +class ConvertAndCastPrimitivesTest extends Specification implements AvroTrait{ + + @Test + + void 'should convert and cast primitive types'() { + + given: + Schema schema = getSchemaFromResources("${suite}/${avroType}") + String fieldName = "field" + GenericRecord record = new GenericRecordBuilder(schema).set(fieldName, avroValue).build() + GoogleBigQueryAvroToProtoConverter converter = new GoogleBigQueryAvroToProtoConverter() + + when: + DynamicMessage message = converter.convertToProtoMessage(protoDescriptor, record) + + + then: + message != null + println(message) + def field = message.getDescriptorForType().findFieldByName(fieldName) + def converted_value = message.getField(field) + if (field.getDefaultValue() != avroValue) { + record.hasField(fieldName) == message.hasField(field) + } + transformResult(converted_value) == expectedProtoValue + + + where: + suite | avroType | protoDescriptor | avroValue | expectedProtoValue | transformResult + "primitives" | "string" | StringProto.PrimitivesString.getDescriptor() | "value" | "value" | { c -> c } + "primitives" | "string" | StringProto.PrimitivesString.getDescriptor() | 12 | "12" | { c -> c } + "primitives" | "string" | StringProto.PrimitivesString.getDescriptor() | 12l | "12" | { c -> c } + "primitives" | "string" | StringProto.PrimitivesString.getDescriptor() | 12f | "12.0" | { c -> c } + "primitives" | "string" | StringProto.PrimitivesString.getDescriptor() | 12d | "12.0" | { c -> c } + + "primitives" | "int" | Int32Proto.PrimitivesInt32.getDescriptor() | 12 | 12 | { c -> c } + "primitives" | "long" | Int32Proto.PrimitivesInt32.getDescriptor() | 12l | 12 | { c -> c } + "primitives" | "float" | Int32Proto.PrimitivesInt32.getDescriptor() | 12f | 12 | { c -> c } + "primitives" | "double" | Int32Proto.PrimitivesInt32.getDescriptor() | 12d | 12 | { c -> c } + "primitives" | "string" | Int32Proto.PrimitivesInt32.getDescriptor() | "12" | 12 | { c -> c } + "primitives" | "boolean" | Int32Proto.PrimitivesInt32.getDescriptor() | true | 1 | { c -> c } + "primitives" | "boolean" | Int32Proto.PrimitivesInt32.getDescriptor() | false | 0 | { c -> c } + + "primitives" | "int" | Int64Proto.PrimitivesInt64.getDescriptor() | 12 | 12l | { c -> c } + "primitives" | "long" | Int64Proto.PrimitivesInt64.getDescriptor() | 12l | 12l | { c -> c } + "primitives" | "float" | Int64Proto.PrimitivesInt64.getDescriptor() | 12f | 12l | { c -> c } + "primitives" | "double" | Int64Proto.PrimitivesInt64.getDescriptor() | 12d | 12l | { c -> c } + "primitives" | "string" | Int64Proto.PrimitivesInt64.getDescriptor() | "12.0" | 12l | { c -> c } + "primitives" | "boolean" | Int64Proto.PrimitivesInt64.getDescriptor() | true | 1l | { c -> c } + "primitives" | "boolean" | Int64Proto.PrimitivesInt64.getDescriptor() | false | 0l | { c -> c } + + "primitives" | "int" | FloatProto.PrimitivesFloat.getDescriptor() | 12 | 12.0f | { c -> c } + "primitives" | "long" | FloatProto.PrimitivesFloat.getDescriptor() | 12l | 12.0f | { c -> c } + "primitives" | "float" | FloatProto.PrimitivesFloat.getDescriptor() | 12.234f | 12.234f | { c -> c } + "primitives" | "double" | FloatProto.PrimitivesFloat.getDescriptor() | 12.234d | 12.234f | { c -> c } + "primitives" | "string" | FloatProto.PrimitivesFloat.getDescriptor() | "12.234" | 12.234f | { c -> c } + "primitives" | "boolean" | FloatProto.PrimitivesFloat.getDescriptor() | true | 1f | { c -> c } + "primitives" | "boolean" | FloatProto.PrimitivesFloat.getDescriptor() | false | 0f | { c -> c } + + "primitives" | "int" | DoubleProto.PrimitivesDouble.getDescriptor() | 12 | 12.0d | { c -> c } + "primitives" | "long" | DoubleProto.PrimitivesDouble.getDescriptor() | 12l | 12.0d | { c -> c } + "primitives" | "float" | DoubleProto.PrimitivesDouble.getDescriptor() | 12.5f | 12.5d | { c -> c } + "primitives" | "double" | DoubleProto.PrimitivesDouble.getDescriptor() | 12.234d | 12.234d | { c -> c } + "primitives" | "string" | DoubleProto.PrimitivesDouble.getDescriptor() | "12.234" | 12.234d | { c -> c } + "primitives" | "boolean" | DoubleProto.PrimitivesDouble.getDescriptor() | true | 1d | { c -> c } + "primitives" | "boolean" | DoubleProto.PrimitivesDouble.getDescriptor() | false | 0d | { c -> c } + + "primitives" | "boolean" | BoolProto.PrimitivesBool.getDescriptor() | true | true | { c -> c } + "primitives" | "boolean" | BoolProto.PrimitivesBool.getDescriptor() | false | false | { c -> c } + "primitives" | "string" | BoolProto.PrimitivesBool.getDescriptor() | "true" | true | { c -> c } + "primitives" | "string" | BoolProto.PrimitivesBool.getDescriptor() | "false" | false | { c -> c } + "primitives" | "string" | BoolProto.PrimitivesBool.getDescriptor() | "True" | true | { c -> c } + "primitives" | "string" | BoolProto.PrimitivesBool.getDescriptor() | "False" | false | { c -> c } + "primitives" | "boolean" | BoolProto.PrimitivesBool.getDescriptor() | 1 | true | { c -> c } + "primitives" | "boolean" | BoolProto.PrimitivesBool.getDescriptor() | 0 | false | { c -> c } + } +} diff --git a/hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/conversions/ConvertArrayOfPrimitivesTest.groovy b/hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/conversions/ConvertArrayOfPrimitivesTest.groovy new file mode 100644 index 0000000000..b9e7fbf36a --- /dev/null +++ b/hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/conversions/ConvertArrayOfPrimitivesTest.groovy @@ -0,0 +1,110 @@ +package pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.conversions + +import com.google.protobuf.DynamicMessage +import org.apache.avro.Schema +import org.apache.avro.generic.GenericRecord +import org.apache.avro.generic.GenericRecordBuilder +import org.junit.jupiter.api.Test +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.AvroTrait +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.GoogleBigQueryAvroToProtoConverter +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.ArrayBoolProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.ArrayBytesProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.ArrayDoubleProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.ArrayFloatProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.ArrayInt32Proto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.ArrayInt64Proto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.ArrayStringProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.StringToBoolProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.StringToBytesProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.StringToDoubleProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.StringToFloatProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.StringToInt32Proto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.StringToInt64Proto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.StringToStringProto +import spock.lang.Specification + +import java.nio.ByteBuffer + +class ConvertArrayOfPrimitivesTest extends Specification implements AvroTrait { + + @Test + void 'should convert array primitive types'() { + + given: + Schema schema = getSchemaFromResources("${suite}/${avroType}") + String fieldName = "field" + GenericRecord record = new GenericRecordBuilder(schema).set(fieldName, avroValue).build() + GoogleBigQueryAvroToProtoConverter converter = new GoogleBigQueryAvroToProtoConverter() + + when: + DynamicMessage message = converter.convertToProtoMessage(protoDescriptor, record) + + + then: + message != null + println(message) + def field = message.getDescriptorForType().findFieldByName(fieldName) + def converted_value = message.getField(field).collect { transformResult(it) } + converted_value == expectedProtoValue + + + where: + suite | avroType | protoDescriptor | avroValue | expectedProtoValue | transformResult + "array-primitives" | "string" | ArrayStringProto.ArrayPrimitivesString.getDescriptor() | [] | [] | { c -> c } + "array-primitives" | "int" | ArrayInt32Proto.ArrayPrimitivesInt32.getDescriptor() | [] | [] | { c -> c } + "array-primitives" | "long" | ArrayInt64Proto.ArrayPrimitivesInt64.getDescriptor() | [] | [] | { c -> c } + "array-primitives" | "boolean" | ArrayInt64Proto.ArrayPrimitivesInt64.getDescriptor() | [] | [] | { c -> c } + "array-primitives" | "boolean" | ArrayBoolProto.ArrayPrimitivesBool.getDescriptor() | [] | [] | { c -> c } + "array-primitives" | "bytes" | ArrayBytesProto.ArrayPrimitivesBytes.getDescriptor() | [] | [] | { c -> c } + "array-primitives" | "float" | ArrayFloatProto.ArrayPrimitivesFloat.getDescriptor() | [] | [] | { c -> c } + "array-primitives" | "double" | ArrayDoubleProto.ArrayPrimitivesDouble.getDescriptor() | [] | [] | { c -> c } + "array-primitives" | "string" | ArrayStringProto.ArrayPrimitivesString.getDescriptor() | ["a", "b", "c"] | ["a", "b", "c"] | { c -> c } + "array-primitives" | "int" | ArrayInt32Proto.ArrayPrimitivesInt32.getDescriptor() | [1, 2, 3] | [1, 2, 3] | { c -> c } + "array-primitives" | "long" | ArrayInt64Proto.ArrayPrimitivesInt64.getDescriptor() | [4l, 5l, 6l] | [4l, 5l, 6l] | { c -> c } + "array-primitives" | "boolean" | ArrayBoolProto.ArrayPrimitivesBool.getDescriptor() | [true, true, false] | [true, true, false] | { c -> c } + "array-primitives" | "bytes" | ArrayBytesProto.ArrayPrimitivesBytes.getDescriptor() | [ByteBuffer.wrap("123".getBytes()), ByteBuffer.wrap("456".getBytes())] | ["123".bytes, "456".bytes] | { c -> c.bytes } + "array-primitives" | "float" | ArrayFloatProto.ArrayPrimitivesFloat.getDescriptor() | [3.14f, 6.28f] | [3.14f, 6.28f] | { c -> c } + "array-primitives" | "double" | ArrayDoubleProto.ArrayPrimitivesDouble.getDescriptor() | [3.14d, 6.28d] | [3.14d, 6.28d] | { c -> c } + } + + @Test + void 'should convert map of primitive types'() { + + given: + Schema schema = getSchemaFromResources("${suite}/${avroType}") + String fieldName = "field" + GenericRecord record = new GenericRecordBuilder(schema).set(fieldName, avroValue).build() + GoogleBigQueryAvroToProtoConverter converter = new GoogleBigQueryAvroToProtoConverter() + + when: + DynamicMessage message = converter.convertToProtoMessage(protoDescriptor, record) + + + then: + message != null + println(message) + def field = message.getDescriptorForType().findFieldByName(fieldName) + def converted_value = message.getField(field).toString().replace("\n", " ") + converted_value == expectedProtoValue + + + where: + suite | avroType | protoDescriptor | avroValue | expectedProtoValue | transformResult + "map-primitives" | "string" | StringToStringProto.PrimitivesStringToString.getDescriptor() | [:] | "[]" | { c -> c } + "map-primitives" | "int" | StringToInt32Proto.PrimitivesStringToInt32.getDescriptor() | [:] | "[]" | { c -> c } + "map-primitives" | "long" | StringToInt64Proto.PrimitivesStringToInt64.getDescriptor() | [:] | "[]" | { c -> c } + "map-primitives" | "boolean" | StringToInt64Proto.PrimitivesStringToInt64.getDescriptor() | [:] | "[]" | { c -> c } + "map-primitives" | "boolean" | StringToBoolProto.PrimitivesStringToBool.getDescriptor() | [:] | "[]" | { c -> c } + "map-primitives" | "bytes" | StringToBytesProto.PrimitivesStringToBytes.getDescriptor() | [:] | "[]" | { c -> c } + "map-primitives" | "float" | StringToFloatProto.PrimitivesStringToFloat.getDescriptor() | [:] | "[]" | { c -> c } + "map-primitives" | "double" | StringToDoubleProto.PrimitivesStringToDouble.getDescriptor() | [:] | "[]" | { c -> c } + "map-primitives" | "string" | StringToStringProto.PrimitivesStringToString.getDescriptor() | ["a": "a", "b": "b", "c": "c"] | "[key: \"a\" value: \"a\" , key: \"b\" value: \"b\" , key: \"c\" value: \"c\" ]" | { c -> c } + "map-primitives" | "int" | StringToInt32Proto.PrimitivesStringToInt32.getDescriptor() | ["a": 1, "b": 2, "c": 3] | "[key: \"a\" value: 1 , key: \"b\" value: 2 , key: \"c\" value: 3 ]" | { c -> c } + "map-primitives" | "long" | StringToInt64Proto.PrimitivesStringToInt64.getDescriptor() | ["a": 4l, "b": 5l, "c": 6l] | "[key: \"a\" value: 4 , key: \"b\" value: 5 , key: \"c\" value: 6 ]" | { c -> c } + "map-primitives" | "boolean" | StringToBoolProto.PrimitivesStringToBool.getDescriptor() | ["a": true, "b": true, "c": false] | "[key: \"a\" value: true , key: \"b\" value: true , key: \"c\" value: false ]" | { c -> c } + "map-primitives" | "bytes" | StringToBytesProto.PrimitivesStringToBytes.getDescriptor() | ["a": ByteBuffer.wrap("123".getBytes()), "b": ByteBuffer.wrap("456".getBytes())] | "[key: \"a\" value: \"123\" , key: \"b\" value: \"456\" ]" | { c -> c } + "map-primitives" | "float" | StringToFloatProto.PrimitivesStringToFloat.getDescriptor() | ["a": 3.14f, "b": 6.28f] | "[key: \"a\" value: 3.14 , key: \"b\" value: 6.28 ]" | { c -> c } + "map-primitives" | "double" | StringToDoubleProto.PrimitivesStringToDouble.getDescriptor() | ["a": 3.14d, "b": 6.28d] | "[key: \"a\" value: 3.14 , key: \"b\" value: 6.28 ]" | { c -> c } + + } +} diff --git a/hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/conversions/ConvertPrimitivesTest.groovy b/hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/conversions/ConvertPrimitivesTest.groovy new file mode 100644 index 0000000000..504f831a23 --- /dev/null +++ b/hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/conversions/ConvertPrimitivesTest.groovy @@ -0,0 +1,177 @@ +package pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.conversions + +import com.google.protobuf.DynamicMessage +import org.apache.avro.Schema +import org.apache.avro.generic.GenericRecord +import org.apache.avro.generic.GenericRecordBuilder +import org.junit.jupiter.api.Test +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.AvroTrait +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.GoogleBigQueryAvroToProtoConverter +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.BoolProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.BytesProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.DoubleProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.FloatProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.Int32Proto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.Int64Proto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.NBoolProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.NBytesProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.NDoubleProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.NFloatProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.NInt32Proto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.NInt64Proto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.NStringProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.StringProto +import spock.lang.Specification + +import java.nio.ByteBuffer + +class ConvertPrimitivesTest extends Specification implements AvroTrait{ + @Test + void 'should convert primitive types'() { + + given: + Schema schema = getSchemaFromResources("${suite}/${avroType}") + String fieldName = "field" + GenericRecord record = new GenericRecordBuilder(schema).set(fieldName, avroValue).build() + GoogleBigQueryAvroToProtoConverter converter = new GoogleBigQueryAvroToProtoConverter() + + when: + DynamicMessage message = converter.convertToProtoMessage(protoDescriptor, record) + + + then: + message != null + println(message) + def field = message.getDescriptorForType().findFieldByName(fieldName) + def converted_value = message.getField(field) + record.hasField(fieldName) == message.hasField(field) + transformResult(converted_value) == expectedProtoValue + + + where: + suite | avroType | protoDescriptor | avroValue | expectedProtoValue | transformResult + "primitives" | "string" | StringProto.PrimitivesString.getDescriptor() | "value" | "value" | { c -> c } + "primitives" | "int" | Int32Proto.PrimitivesInt32.getDescriptor() | 12 | 12 | { c -> c } + "primitives" | "long" | Int64Proto.PrimitivesInt64.getDescriptor() | 12l | 12l | { c -> c } + "primitives" | "boolean" | BoolProto.PrimitivesBool.getDescriptor() | true | true | { c -> c } + "primitives" | "bytes" | BytesProto.PrimitivesBytes.getDescriptor() | ByteBuffer.wrap("123".getBytes()) | "123" | { c -> new String(c.bytes) } + "primitives" | "float" | FloatProto.PrimitivesFloat.getDescriptor() | 1.234f | 1.234f | { c -> c } + "primitives" | "double" | DoubleProto.PrimitivesDouble.getDescriptor() | 1.234d | 1.234d | { c -> c } + } + + @Test + void 'should convert nullable primitive types'() { + + given: + Schema schema = getSchemaFromResources("${suite}/${avroType}") + String fieldName = "field" + GenericRecord record = new GenericRecordBuilder(schema).set(fieldName, avroValue).build() + GoogleBigQueryAvroToProtoConverter converter = new GoogleBigQueryAvroToProtoConverter() + + when: + DynamicMessage message = converter.convertToProtoMessage(protoDescriptor, record) + + + then: + message != null + println(message) + def field = message.getDescriptorForType().findFieldByName(fieldName) + def converted_value = message.hasField(field) ? (message.getField(field)) : null + transformResult(converted_value) == expectedProtoValue + + + where: + suite | avroType | protoDescriptor | avroValue | expectedProtoValue | transformResult + "nullable-primitives" | "long" | NInt64Proto.NullablePrimitivesInt64.getDescriptor() | 12 | 12l | { c -> c } + "nullable-primitives" | "string" | NStringProto.NullablePrimitivesString.getDescriptor() | null | null | { c -> c } + "nullable-primitives" | "string" | NStringProto.NullablePrimitivesString.getDescriptor() | "value" | "value" | { c -> c } + "nullable-primitives" | "int" | NInt32Proto.NullablePrimitivesInt32.getDescriptor() | 12 | 12 | { c -> c } + "nullable-primitives" | "long" | NInt64Proto.NullablePrimitivesInt64.getDescriptor() | 12l | 12l | { c -> c } + "nullable-primitives" | "boolean" | NBoolProto.NullablePrimitivesBool.getDescriptor() | true | true | { c -> c } + "nullable-primitives" | "bytes" | NBytesProto.NullablePrimitivesBytes.getDescriptor() | ByteBuffer.wrap("123".getBytes()) | "123" | { c -> new String(c.bytes) } + "nullable-primitives" | "float" | NFloatProto.NullablePrimitivesFloat.getDescriptor() | 1.234f | 1.234f | { c -> c } + "nullable-primitives" | "double" | NDoubleProto.NullablePrimitivesDouble.getDescriptor() | 1.234d | 1.234d | { c -> c } + + + } + + @Test + void 'should convert nullable primitive types when null'() { + + given: + Schema schema = getSchemaFromResources("${suite}/${avroType}") + String fieldName = "field" + GenericRecord record = new GenericRecordBuilder(schema).set(fieldName, avroValue).build() + GoogleBigQueryAvroToProtoConverter converter = new GoogleBigQueryAvroToProtoConverter() + + when: + DynamicMessage message = converter.convertToProtoMessage(protoDescriptor, record) + + + then: + message != null + println(message) + def field = message.getDescriptorForType().findFieldByName(fieldName) + record.hasField(fieldName) == !message.hasField(field) + def converted_value = message.hasField(field) ? (message.getField(field)) : null + transformResult(converted_value) == expectedProtoValue + + + where: + suite | avroType | protoDescriptor | avroValue | expectedProtoValue | transformResult + "nullable-primitives" | "string" | NStringProto.NullablePrimitivesString.getDescriptor() | null | null | { c -> c } + "nullable-primitives" | "int" | NInt32Proto.NullablePrimitivesInt32.getDescriptor() | null | null | { c -> c } + "nullable-primitives" | "long" | NInt64Proto.NullablePrimitivesInt64.getDescriptor() | null | null | { c -> c } + "nullable-primitives" | "boolean" | NInt64Proto.NullablePrimitivesInt64.getDescriptor() | null | null | { c -> c } + "nullable-primitives" | "bytes" | NBytesProto.NullablePrimitivesBytes.getDescriptor() | null | null | { c -> c } + "nullable-primitives" | "float" | NFloatProto.NullablePrimitivesFloat.getDescriptor() | null | null | { c -> c } + "nullable-primitives" | "double" | NDoubleProto.NullablePrimitivesDouble.getDescriptor() | null | null | { c -> c } + + + } + + @Test + void 'should convert primitive types with default values'() { + + given: + Schema schema = getSchemaFromResources("${suite}/${avroType}") + String fieldName = "field" + GenericRecord record = fieldExists ? new GenericRecordBuilder(schema).set(fieldName, null).build() : new GenericRecordBuilder(schema).build() + GoogleBigQueryAvroToProtoConverter converter = new GoogleBigQueryAvroToProtoConverter() + + when: + DynamicMessage message = converter.convertToProtoMessage(protoDescriptor, record) + + + then: + message != null + println(message) + def field = message.getDescriptorForType().findFieldByName(fieldName) + def converted_value = message.hasField(field) ? (message.getField(field)) : null + transformResult(converted_value) == expectedProtoValue + + + where: + suite | avroType | fieldExists | protoDescriptor | expectedProtoValue | transformResult + "default-primitives" | "string" | true | NStringProto.NullablePrimitivesString.getDescriptor() | null | { c -> c } + "default-primitives" | "int" | true | NInt32Proto.NullablePrimitivesInt32.getDescriptor() | null | { c -> c } + "default-primitives" | "long" | true | NInt64Proto.NullablePrimitivesInt64.getDescriptor() | null | { c -> c } + "default-primitives" | "boolean" | true | NInt64Proto.NullablePrimitivesInt64.getDescriptor() | null | { c -> c } + "default-primitives" | "boolean" | true | NBoolProto.NullablePrimitivesBool.getDescriptor() | null | { c -> c } + "default-primitives" | "bytes" | true | NBytesProto.NullablePrimitivesBytes.getDescriptor() | null | { c -> c } + "default-primitives" | "float" | true | NFloatProto.NullablePrimitivesFloat.getDescriptor() | null | { c -> c } + "default-primitives" | "double" | true | NDoubleProto.NullablePrimitivesDouble.getDescriptor() | null | { c -> c } + "default-primitives" | "string" | false | NStringProto.NullablePrimitivesString.getDescriptor() | "Z sejmu dla Faktów Katarzyna Bolesna-Mordęga" | { c -> c } + "default-primitives" | "int" | false | NInt32Proto.NullablePrimitivesInt32.getDescriptor() | 997 | { c -> c } + "default-primitives" | "long" | false | NInt64Proto.NullablePrimitivesInt64.getDescriptor() | 1614322339997 | { c -> c } + "default-primitives" | "boolean" | false | NBoolProto.NullablePrimitivesBool.getDescriptor() | true | { c -> c } + "default-primitives" | "bytes" | false | NBytesProto.NullablePrimitivesBytes.getDescriptor() | "\u0074\u0065\u0073\u0074".getBytes() | { c -> c.bytes } + "default-primitives" | "float" | false | NFloatProto.NullablePrimitivesFloat.getDescriptor() | 3.14f | { c -> c } + "default-primitives" | "double" | false | NDoubleProto.NullablePrimitivesDouble.getDescriptor() | 3.14d | { c -> c } + + + } + + + +} diff --git a/hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/conversions/ConvertRecordWithPrimitivesTest.groovy b/hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/conversions/ConvertRecordWithPrimitivesTest.groovy new file mode 100644 index 0000000000..bf97789ef9 --- /dev/null +++ b/hermes-consumers/src/test/groovy/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/avro/conversions/ConvertRecordWithPrimitivesTest.groovy @@ -0,0 +1,62 @@ +package pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.conversions + +import com.google.protobuf.DynamicMessage +import org.apache.avro.Schema +import org.apache.avro.generic.GenericRecord +import org.apache.avro.generic.GenericRecordBuilder +import org.junit.jupiter.api.Test +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.AvroTrait +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.GoogleBigQueryAvroToProtoConverter +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.RecordBoolProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.RecordBytesProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.RecordDoubleProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.RecordFloatProto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.RecordInt32Proto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.RecordInt64Proto +import pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery.avro.descriptor.RecordStringProto +import spock.lang.Specification + +import java.nio.ByteBuffer + +class ConvertRecordWithPrimitivesTest extends Specification implements AvroTrait { + @Test + void 'should convert record with primitive types'() { + + given: + Schema schema = getSchemaFromResources("${suite}/${avroType}") + String fieldName = "field" + String valueFieldName = "value_field" + GenericRecord record = new GenericRecordBuilder(schema).set( + fieldName, + new GenericRecordBuilder(schema.getField(fieldName).schema()).set(valueFieldName, avroValue).build() + ).build() + GoogleBigQueryAvroToProtoConverter converter = new GoogleBigQueryAvroToProtoConverter() + + when: + DynamicMessage message = converter.convertToProtoMessage(protoDescriptor, record) + + + then: + message != null + println(message) + def field = message.getDescriptorForType().findFieldByName(fieldName) + def convertedFieldValue = message.getField(field).toString().replace("\\", "").replace("\n", "") + def expectedRecord = "value_field: ${expectedProtoValue}".replace("\\", "").replace("\n", "") + expectedRecord == convertedFieldValue + + + where: + suite | avroType | protoDescriptor | avroValue | expectedProtoValue | transformResult + "record-primitives" | "string" | RecordStringProto.RecordPrimitivesString.getDescriptor() | "value" | "\"value\"" | { c -> c } + "record-primitives" | "int" | RecordInt32Proto.RecordPrimitivesInt32.getDescriptor() | 12 | 12 | { c -> c } + "record-primitives" | "long" | RecordInt64Proto.RecordPrimitivesInt64.getDescriptor() | 12l | 12l | { c -> c } + "record-primitives" | "boolean" | RecordInt64Proto.RecordPrimitivesInt64.getDescriptor() | 12l | 12l | { c -> c } + "record-primitives" | "boolean" | RecordBoolProto.RecordPrimitivesBool.getDescriptor() | true | true | { c -> c } + "record-primitives" | "bytes" | RecordBytesProto.RecordPrimitivesBytes.getDescriptor() | ByteBuffer.wrap("123".getBytes()) | "\"123\"" | { c -> new String(c.bytes) } + "record-primitives" | "float" | RecordFloatProto.RecordPrimitivesFloat.getDescriptor() | 1.234f | 1.234f | { c -> c } + "record-primitives" | "double" | RecordDoubleProto.RecordPrimitivesDouble.getDescriptor() | 1.234d | 1.234d | { c -> c } + + + } + +} diff --git a/hermes-consumers/src/test/resources/2130/int.avsc b/hermes-consumers/src/test/resources/2130/int.avsc deleted file mode 100644 index 272001a2d3..0000000000 --- a/hermes-consumers/src/test/resources/2130/int.avsc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "name": "Primitives", - "type": "record", - "fields": [ - { - "name": "int_field", - "type": "int" - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/2130/int.proto b/hermes-consumers/src/test/resources/2130/int.proto deleted file mode 100644 index b055fd6af8..0000000000 --- a/hermes-consumers/src/test/resources/2130/int.proto +++ /dev/null @@ -1,5 +0,0 @@ - syntax="proto3"; - -message Primitives { - required int32 int_field; -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/enum.avsc b/hermes-consumers/src/test/resources/schemas/enum.avsc deleted file mode 100644 index 06b71021be..0000000000 --- a/hermes-consumers/src/test/resources/schemas/enum.avsc +++ /dev/null @@ -1,18 +0,0 @@ -{ - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "name": "Enum", - "type": "record", - "fields": [ - { - "name": "enum_field", - "type": { - "name": "EnumTypeName", - "type": "enum", - "symbols": [ - "S1", - "S2" - ] - } - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/evolution/mode-changed-from-nullable-to-required-1.avsc b/hermes-consumers/src/test/resources/schemas/evolution/mode-changed-from-nullable-to-required-1.avsc deleted file mode 100644 index 14f9773fa3..0000000000 --- a/hermes-consumers/src/test/resources/schemas/evolution/mode-changed-from-nullable-to-required-1.avsc +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "test", - "doc": "Doc", - "type": "record", - "fields": [ - { - "name": "test", - "type":["null", "string" ], - "doc": "test", - "default": null - } - ] -} diff --git a/hermes-consumers/src/test/resources/schemas/evolution/mode-changed-from-nullable-to-required-2.avsc b/hermes-consumers/src/test/resources/schemas/evolution/mode-changed-from-nullable-to-required-2.avsc deleted file mode 100644 index 4894fdf98a..0000000000 --- a/hermes-consumers/src/test/resources/schemas/evolution/mode-changed-from-nullable-to-required-2.avsc +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "test", - "doc": "Doc", - "type": "record", - "fields": [ - { - "name": "test", - "type": "string", - "doc": "test" - } - ] -} diff --git a/hermes-consumers/src/test/resources/schemas/evolution/newly-added-nullable-record-with-required-fields-1.avsc b/hermes-consumers/src/test/resources/schemas/evolution/newly-added-nullable-record-with-required-fields-1.avsc deleted file mode 100644 index 14f9773fa3..0000000000 --- a/hermes-consumers/src/test/resources/schemas/evolution/newly-added-nullable-record-with-required-fields-1.avsc +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "test", - "doc": "Doc", - "type": "record", - "fields": [ - { - "name": "test", - "type":["null", "string" ], - "doc": "test", - "default": null - } - ] -} diff --git a/hermes-consumers/src/test/resources/schemas/evolution/newly-added-nullable-record-with-required-fields-2.avsc b/hermes-consumers/src/test/resources/schemas/evolution/newly-added-nullable-record-with-required-fields-2.avsc deleted file mode 100644 index a26ff832ca..0000000000 --- a/hermes-consumers/src/test/resources/schemas/evolution/newly-added-nullable-record-with-required-fields-2.avsc +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "test", - "doc": "Doc", - "type": "record", - "fields": [ - { - "name": "test", - "type":["null", "string" ], - "doc": "test", - "default": null - }, - { - "name": "rec", - "doc": "record", - "type": ["null", { - "type": "record", - "name": "Test2", - "fields": [ - { - "name": "test2", - "doc": "test2", - "type": "string" - } - ] - }], - "default": null - } - ] -} diff --git a/hermes-consumers/src/test/resources/schemas/evolution/newly-added-record-with-nested-required-fields-1.avsc b/hermes-consumers/src/test/resources/schemas/evolution/newly-added-record-with-nested-required-fields-1.avsc deleted file mode 100644 index 14f9773fa3..0000000000 --- a/hermes-consumers/src/test/resources/schemas/evolution/newly-added-record-with-nested-required-fields-1.avsc +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "test", - "doc": "Doc", - "type": "record", - "fields": [ - { - "name": "test", - "type":["null", "string" ], - "doc": "test", - "default": null - } - ] -} diff --git a/hermes-consumers/src/test/resources/schemas/evolution/newly-added-record-with-nested-required-fields-2.avsc b/hermes-consumers/src/test/resources/schemas/evolution/newly-added-record-with-nested-required-fields-2.avsc deleted file mode 100644 index 483afec7ac..0000000000 --- a/hermes-consumers/src/test/resources/schemas/evolution/newly-added-record-with-nested-required-fields-2.avsc +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "test", - "doc": "Doc", - "type": "record", - "fields": [ - { - "name": "test", - "type":["null", "string" ], - "doc": "test", - "default": null - }, - { - "name": "rec", - "doc": "record", - "type": { - "type": "record", - "name": "Test2", - "fields": [ - { - "name": "test2", - "doc": "test2", - "type": { - "name": "Nested", - "type": "record", - "doc": "test", - "fields": [ - { - "type": "string", - "name": "nestedField", - "doc": "nested" - } - ] - } - } - ] - } - } - ] -} diff --git a/hermes-consumers/src/test/resources/schemas/evolution/newly-added-record-with-required-fields-1.avsc b/hermes-consumers/src/test/resources/schemas/evolution/newly-added-record-with-required-fields-1.avsc deleted file mode 100644 index 14f9773fa3..0000000000 --- a/hermes-consumers/src/test/resources/schemas/evolution/newly-added-record-with-required-fields-1.avsc +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "test", - "doc": "Doc", - "type": "record", - "fields": [ - { - "name": "test", - "type":["null", "string" ], - "doc": "test", - "default": null - } - ] -} diff --git a/hermes-consumers/src/test/resources/schemas/evolution/newly-added-record-with-required-fields-2.avsc b/hermes-consumers/src/test/resources/schemas/evolution/newly-added-record-with-required-fields-2.avsc deleted file mode 100644 index 5209021070..0000000000 --- a/hermes-consumers/src/test/resources/schemas/evolution/newly-added-record-with-required-fields-2.avsc +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "test", - "doc": "Doc", - "type": "record", - "fields": [ - { - "name": "test", - "type":["null", "string" ], - "doc": "test", - "default": null - }, - { - "name": "rec", - "doc": "record", - "type": { - "type": "record", - "name": "Test2", - "fields": [ - { - "name": "test2", - "doc": "test2", - "type": "string" - } - ] - } - } - ] -} diff --git a/hermes-consumers/src/test/resources/schemas/evolution/priceListChanged-2.avsc b/hermes-consumers/src/test/resources/schemas/evolution/priceListChanged-2.avsc deleted file mode 100644 index e4f8845eb1..0000000000 --- a/hermes-consumers/src/test/resources/schemas/evolution/priceListChanged-2.avsc +++ /dev/null @@ -1,349 +0,0 @@ -{ - "type": "record", - "name": "priceListChanged", - "namespace": "pl.allegro.offer.delivery.v1", - "doc": "Offer pricelist change event", - "fields": [ - { - "name": "__metadata", - "type": [ - "null", - { - "type": "map", - "values": "string" - } - ], - "doc": "Field internally used by Hermes to propagate metadata.", - "default": null - }, - { - "name": "eventTime", - "type": "string", - "doc": "Event time" - }, - { - "name": "priceList", - "type": { - "type": "record", - "name": "NotifyPriceList", - "fields": [ - { - "name": "id", - "type": "string", - "doc": "id" - }, - { - "name": "offerId", - "type": "string", - "doc": "offer id" - }, - { - "name": "lastModified", - "type": "string", - "doc": "last modified" - }, - { - "name": "shippingRates", - "type": [ - "null", - { - "type": "record", - "name": "ShippingRatesRef", - "doc": "shipping rates reference", - "fields": [ - { - "name": "id", - "type": "string", - "doc": "id" - } - ] - } - ], - "doc": "shipping rates", - "default": null - }, - { - "name": "items", - "type": { - "type": "array", - "items": { - "type": "record", - "name": "NotifyPriceListElement", - "doc": "notify price list element", - "fields": [ - { - "name": "deliveryMethod", - "type": { - "type": "record", - "name": "NotifyDeliveryMethod", - "fields": [ - { - "name": "id", - "type": "string", - "doc": "id" - }, - { - "name": "qeppoId", - "type": [ - "null", - "int" - ], - "doc": "Qeppo id", - "default": null - } - ] - }, - "doc": "delivery method" - }, - { - "name": "firstItemPrice", - "type": { - "type": "record", - "name": "Money", - "doc": "money", - "fields": [ - { - "name": "amount", - "type": "string", - "doc": "amount" - }, - { - "name": "currency", - "type": "string", - "doc": "currency" - } - ] - }, - "doc": "first item price" - }, - { - "name": "nextItemPrice", - "type": [ - "null", - "Money" - ], - "doc": "next item price", - "default": null - }, - { - "name": "packageSize", - "type": "int", - "doc": "package size" - }, - { - "name": "shippingTime", - "type": [ - "null", - { - "type": "record", - "name": "ShippingTime", - "doc": "shipping time", - "fields": [ - { - "name": "from", - "type": "string", - "doc": "from" - }, - { - "name": "to", - "type": "string", - "doc": "to" - } - ] - } - ], - "doc": "shipping time", - "default": null - }, - { - "name": "maxPackageWeight", - "type": [ - "null", - { - "type": "record", - "name": "PackageWeight", - "doc": "package weight", - "fields": [ - { - "name": "value", - "type": { - "type": "string", - "java-class": "java.math.BigDecimal" - }, - "doc": "value" - }, - { - "name": "unit", - "type": "string", - "doc": "unit" - } - ] - } - ], - "doc": "max package weight", - "default": null - } - ] - }, - "java-class": "java.util.List" - }, - "doc": "items" - }, - { - "name": "location", - "type": { - "type": "record", - "name": "PriceListLocation", - "doc": "price list location", - "fields": [ - { - "name": "city", - "type": [ - "null", - "string" - ], - "doc": "city", - "default": null - }, - { - "name": "state", - "type": [ - "null", - "string" - ], - "doc": "state", - "default": null - }, - { - "name": "postcode", - "type": [ - "null", - "string" - ], - "doc": "postcode", - "default": null - }, - { - "name": "country", - "type": [ - "null", - "string" - ], - "doc": "country", - "default": null - } - ] - }, - "doc": "location" - }, - { - "name": "sendingAbroad", - "type": "boolean", - "doc": "sending abroad" - }, - { - "name": "estimatedShippingTime", - "type": [ - "null", - "string" - ], - "doc": "estimated shipping time", - "default": null - }, - { - "name": "additionalInfo", - "type": [ - "null", - "string" - ], - "doc": "additional info", - "default": null - }, - { - "name": "flags", - "type": { - "type": "record", - "name": "Flags", - "fields": [ - { - "name": "freeReturn", - "type": "boolean", - "doc": "free return" - }, - { - "name": "freeDelivery", - "type": "boolean", - "doc": "free delivery" - }, - { - "name": "useCostPerWeight", - "type": "boolean", - "doc": "use cost per weight" - }, - { - "name": "selfPickup", - "type": "boolean", - "doc": "self pickup" - } - ] - }, - "doc": "flags" - }, - { - "name": "shippingCost", - "type": { - "type": "record", - "name": "ShippingCost", - "doc": "shipping cost", - "fields": [ - { - "name": "lowest", - "type": [ - "null", - "Money" - ], - "doc": "lowest", - "default": null - }, - { - "name": "freeDelivery", - "type": "boolean", - "doc": "free delivery" - } - ] - }, - "doc": "shipping cost" - } - ] - }, - "doc": "Price list" - }, - { - "name": "updatedPaths", - "type": { - "type": "array", - "items": "string", - "java-class": "java.util.List" - }, - "doc": "Updated paths" - }, - { - "name": "cause", - "type": "string", - "doc": "cause" - }, - { - "name": "removedMarketplaces", - "type": [ - "null", - { - "type": "array", - "items": "string", - "java-class": "java.util.List" - } - ], - "doc": "removed marketplaces", - "default": null - } - ] -} diff --git a/hermes-consumers/src/test/resources/schemas/evolution/priceListChanged-3.avsc b/hermes-consumers/src/test/resources/schemas/evolution/priceListChanged-3.avsc deleted file mode 100644 index 4f46ab4294..0000000000 --- a/hermes-consumers/src/test/resources/schemas/evolution/priceListChanged-3.avsc +++ /dev/null @@ -1,378 +0,0 @@ -{ - "type": "record", - "name": "priceListChanged", - "namespace": "pl.allegro.offer.delivery.v1", - "doc": "Offer pricelist change event", - "fields": [ - { - "name": "__metadata", - "type": [ - "null", - { - "type": "map", - "values": "string" - } - ], - "doc": "Field internally used by Hermes to propagate metadata.", - "default": null - }, - { - "name": "eventTime", - "type": "string", - "doc": "Event time" - }, - { - "name": "priceList", - "type": { - "type": "record", - "name": "NotifyPriceList", - "fields": [ - { - "name": "id", - "type": "string", - "doc": "id" - }, - { - "name": "offerId", - "type": "string", - "doc": "offer id" - }, - { - "name": "lastModified", - "type": "string", - "doc": "last modified" - }, - { - "name": "shippingRates", - "type": [ - "null", - { - "type": "record", - "name": "ShippingRatesRef", - "doc": "shipping rates reference", - "fields": [ - { - "name": "id", - "type": "string", - "doc": "id" - }, - { - "name": "lastModified", - "type": "string", - "doc": "last modified" - } - ] - } - ], - "doc": "shipping rates", - "default": null - }, - { - "name": "items", - "type": { - "type": "array", - "items": { - "type": "record", - "name": "NotifyPriceListElement", - "doc": "notify price list element", - "fields": [ - { - "name": "deliveryMethod", - "type": { - "type": "record", - "name": "NotifyDeliveryMethod", - "fields": [ - { - "name": "id", - "type": "string", - "doc": "id" - }, - { - "name": "qeppoId", - "type": [ - "null", - "int" - ], - "doc": "Qeppo id", - "default": null - } - ] - }, - "doc": "delivery method" - }, - { - "name": "firstItemPrice", - "type": { - "type": "record", - "name": "Money", - "doc": "money", - "fields": [ - { - "name": "amount", - "type": "string", - "doc": "amount" - }, - { - "name": "currency", - "type": "string", - "doc": "currency" - } - ] - }, - "doc": "first item price" - }, - { - "name": "nextItemPrice", - "type": [ - "null", - "Money" - ], - "doc": "next item price", - "default": null - }, - { - "name": "packageSize", - "type": "int", - "doc": "package size" - }, - { - "name": "shippingTime", - "type": [ - "null", - { - "type": "record", - "name": "ShippingTime", - "doc": "shipping time", - "fields": [ - { - "name": "from", - "type": "string", - "doc": "from" - }, - { - "name": "to", - "type": "string", - "doc": "to" - } - ] - } - ], - "doc": "shipping time", - "default": null - }, - { - "name": "maxPackageWeight", - "type": [ - "null", - { - "type": "record", - "name": "PackageWeight", - "doc": "package weight", - "fields": [ - { - "name": "value", - "type": { - "type": "string", - "java-class": "java.math.BigDecimal" - }, - "doc": "value" - }, - { - "name": "unit", - "type": "string", - "doc": "unit" - } - ] - } - ], - "doc": "max package weight", - "default": null - } - ] - }, - "java-class": "java.util.List" - }, - "doc": "items" - }, - { - "name": "location", - "type": { - "type": "record", - "name": "PriceListLocation", - "doc": "price list location", - "fields": [ - { - "name": "city", - "type": [ - "null", - "string" - ], - "doc": "city", - "default": null - }, - { - "name": "state", - "type": [ - "null", - "string" - ], - "doc": "state", - "default": null - }, - { - "name": "postcode", - "type": [ - "null", - "string" - ], - "doc": "postcode", - "default": null - }, - { - "name": "country", - "type": [ - "null", - "string" - ], - "doc": "country", - "default": null - } - ] - }, - "doc": "location" - }, - { - "name": "sendingAbroad", - "type": "boolean", - "doc": "sending abroad" - }, - { - "name": "estimatedShippingTime", - "type": [ - "null", - "string" - ], - "doc": "estimated shipping time", - "default": null - }, - { - "name": "additionalInfo", - "type": [ - "null", - "string" - ], - "doc": "additional info", - "default": null - }, - { - "name": "flags", - "type": { - "type": "record", - "name": "Flags", - "fields": [ - { - "name": "freeReturn", - "type": "boolean", - "doc": "free return" - }, - { - "name": "freeDelivery", - "type": "boolean", - "doc": "free delivery" - }, - { - "name": "useCostPerWeight", - "type": "boolean", - "doc": "use cost per weight" - }, - { - "name": "selfPickup", - "type": "boolean", - "doc": "self pickup" - } - ] - }, - "doc": "flags" - }, - { - "name": "shippingCost", - "type": { - "type": "record", - "name": "ShippingCost", - "doc": "shipping cost", - "fields": [ - { - "name": "lowest", - "type": [ - "null", - "Money" - ], - "doc": "lowest", - "default": null - }, - { - "name": "freeDelivery", - "type": "boolean", - "doc": "free delivery" - } - ] - }, - "doc": "shipping cost" - } - ] - }, - "doc": "Price list" - }, - { - "name": "updatedPaths", - "type": { - "type": "array", - "items": "string", - "java-class": "java.util.List" - }, - "doc": "Updated paths" - }, - { - "name": "cause", - "type": "string", - "doc": "cause" - }, - { - "name": "removedMarketplaces", - "type": [ - "null", - { - "type": "array", - "items": "string", - "java-class": "java.util.List" - } - ], - "doc": "removed marketplaces", - "default": null - }, - { - "name": "notificationHints", - "type": [ - "null", - { - "type": "record", - "name": "NotificationHints", - "doc": "notification hints", - "fields": [ - { - "name": "targetMarketplaces", - "type": { - "type": "array", - "items": "string", - "java-class": "java.util.List" - }, - "doc": "target marketplaces" - } - ] - } - ], - "doc": "notification hints", - "default": null - } - ] -} diff --git a/hermes-consumers/src/test/resources/schemas/logical-types/bytesDecimal.avsc b/hermes-consumers/src/test/resources/schemas/logical-types/bytesDecimal.avsc deleted file mode 100644 index c80cf6936d..0000000000 --- a/hermes-consumers/src/test/resources/schemas/logical-types/bytesDecimal.avsc +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "record", - "name": "LogicalTypes", - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "fields": [ - { - "name": "bytesDecimal", - "type": { - "type": "bytes", - "logicalType": "decimal", - "precision": 14, - "scale": 2 - } - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/logical-types/bytesDecimalJavaClass.avsc b/hermes-consumers/src/test/resources/schemas/logical-types/bytesDecimalJavaClass.avsc deleted file mode 100644 index 5a770e71f9..0000000000 --- a/hermes-consumers/src/test/resources/schemas/logical-types/bytesDecimalJavaClass.avsc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "type": "record", - "name": "LogicalTypes", - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "fields": [ - { - "name": "bytesDecimal", - "type": { - "type": "bytes", - "logicalType": "decimal", - "java-class": "java.math.BigDecimal", - "precision": 14, - "scale": 2 - } - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/logical-types/fixedDecimal.avsc b/hermes-consumers/src/test/resources/schemas/logical-types/fixedDecimal.avsc deleted file mode 100644 index fdca2c2da8..0000000000 --- a/hermes-consumers/src/test/resources/schemas/logical-types/fixedDecimal.avsc +++ /dev/null @@ -1,18 +0,0 @@ -{ - "type": "record", - "name": "LogicalTypes", - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "fields": [ - { - "name": "fixedDecimal", - "type": { - "name": "Fixed", - "type": "fixed", - "logicalType": "decimal", - "precision": 4, - "scale": 2, - "size": 8 - } - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/logical-types/fixedDecimalJavaClass.avsc b/hermes-consumers/src/test/resources/schemas/logical-types/fixedDecimalJavaClass.avsc deleted file mode 100644 index ca6b96e5d5..0000000000 --- a/hermes-consumers/src/test/resources/schemas/logical-types/fixedDecimalJavaClass.avsc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "record", - "name": "LogicalTypes", - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "fields": [ - { - "name": "fixedDecimal", - "type": { - "name": "Fixed", - "type": "fixed", - "logicalType": "decimal", - "java-class": "java.math.BigDecimal", - "precision": 4, - "scale": 2, - "size": 8 - } - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/logical-types/fixedDuration.avsc b/hermes-consumers/src/test/resources/schemas/logical-types/fixedDuration.avsc deleted file mode 100644 index 639111ee0b..0000000000 --- a/hermes-consumers/src/test/resources/schemas/logical-types/fixedDuration.avsc +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "record", - "name": "LogicalTypes", - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "fields": [ - { - "name": "fixedDuration", - "type": { - "name": "fixedDuration", - "type": "fixed", - "size": 12, - "logicalType": "duration" - } - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/logical-types/intDate.avsc b/hermes-consumers/src/test/resources/schemas/logical-types/intDate.avsc deleted file mode 100644 index 0e1db6bd5f..0000000000 --- a/hermes-consumers/src/test/resources/schemas/logical-types/intDate.avsc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "type": "record", - "name": "LogicalTypes", - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "fields": [ - { - "name": "intDate", - "type": { - "type": "int", - "logicalType": "date" - } - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/logical-types/intTimeMillis.avsc b/hermes-consumers/src/test/resources/schemas/logical-types/intTimeMillis.avsc deleted file mode 100644 index 5cd1b77c60..0000000000 --- a/hermes-consumers/src/test/resources/schemas/logical-types/intTimeMillis.avsc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "type": "record", - "name": "LogicalTypes", - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "fields": [ - { - "name": "intTimeMillis", - "type": { - "type": "int", - "logicalType": "time-millis" - } - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/logical-types/intTimeMillisJavaClass.avsc b/hermes-consumers/src/test/resources/schemas/logical-types/intTimeMillisJavaClass.avsc deleted file mode 100644 index 0fb1bc4eb2..0000000000 --- a/hermes-consumers/src/test/resources/schemas/logical-types/intTimeMillisJavaClass.avsc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "record", - "name": "LogicalTypes", - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "fields": [ - { - "name": "intTimeMillis", - "type": { - "type": "int", - "logicalType": "time-millis", - "java-class": "java.time.LocalTime" - } - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/logical-types/longTimeMicros.avsc b/hermes-consumers/src/test/resources/schemas/logical-types/longTimeMicros.avsc deleted file mode 100644 index 5a56dd2df7..0000000000 --- a/hermes-consumers/src/test/resources/schemas/logical-types/longTimeMicros.avsc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "type": "record", - "name": "LogicalTypes", - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "fields": [ - { - "name": "longTimeMicros", - "type": { - "type": "long", - "logicalType": "time-micros" - } - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/logical-types/longTimeMicrosJavaClass.avsc b/hermes-consumers/src/test/resources/schemas/logical-types/longTimeMicrosJavaClass.avsc deleted file mode 100644 index aacf42a602..0000000000 --- a/hermes-consumers/src/test/resources/schemas/logical-types/longTimeMicrosJavaClass.avsc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "record", - "name": "LogicalTypes", - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "fields": [ - { - "name": "longTimeMicros", - "type": { - "type": "long", - "logicalType": "time-micros", - "java-class": "java.time.LocalTime" - } - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/logical-types/longTimestampMicros.avsc b/hermes-consumers/src/test/resources/schemas/logical-types/longTimestampMicros.avsc deleted file mode 100644 index 18d89c63db..0000000000 --- a/hermes-consumers/src/test/resources/schemas/logical-types/longTimestampMicros.avsc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "type": "record", - "name": "LogicalTypes", - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "fields": [ - { - "name": "longTimestampMicros", - "type": { - "type": "long", - "logicalType": "timestamp-micros" - } - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/logical-types/longTimestampMicrosJavaClass.avsc b/hermes-consumers/src/test/resources/schemas/logical-types/longTimestampMicrosJavaClass.avsc deleted file mode 100644 index dd114cccc2..0000000000 --- a/hermes-consumers/src/test/resources/schemas/logical-types/longTimestampMicrosJavaClass.avsc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "record", - "name": "LogicalTypes", - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "fields": [ - { - "name": "longTimestampMicros", - "type": { - "type": "long", - "logicalType": "timestamp-micros", - "java-class": "java.time.Instant" - } - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/logical-types/longTimestampMillis.avsc b/hermes-consumers/src/test/resources/schemas/logical-types/longTimestampMillis.avsc deleted file mode 100644 index 5f961dedc0..0000000000 --- a/hermes-consumers/src/test/resources/schemas/logical-types/longTimestampMillis.avsc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "type": "record", - "name": "LogicalTypes", - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "fields": [ - { - "name": "longTimestampMillis", - "type": { - "type": "long", - "logicalType": "timestamp-millis" - } - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/logical-types/longTimestampMillisJavaClass.avsc b/hermes-consumers/src/test/resources/schemas/logical-types/longTimestampMillisJavaClass.avsc deleted file mode 100644 index 0ecb7ff26c..0000000000 --- a/hermes-consumers/src/test/resources/schemas/logical-types/longTimestampMillisJavaClass.avsc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "record", - "name": "LogicalTypes", - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "fields": [ - { - "name": "longTimestampMillis", - "type": { - "type": "long", - "logicalType": "timestamp-millis", - "java-class": "java.time.Instant" - } - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/logical-types/stringUuid.avsc b/hermes-consumers/src/test/resources/schemas/logical-types/stringUuid.avsc deleted file mode 100644 index 46ceb31d39..0000000000 --- a/hermes-consumers/src/test/resources/schemas/logical-types/stringUuid.avsc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "type": "record", - "name": "LogicalTypes", - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "fields": [ - { - "name": "stringUuid", - "type": { - "type": "string", - "logicalType": "uuid" - } - } - ] -} diff --git a/hermes-consumers/src/test/resources/schemas/map-with-values-map.avsc b/hermes-consumers/src/test/resources/schemas/map-with-values-map.avsc deleted file mode 100644 index 1427504ce8..0000000000 --- a/hermes-consumers/src/test/resources/schemas/map-with-values-map.avsc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "name": "MapNested", - "type": "record", - "fields": [ - { - "name": "map_field", - "type": { - "type": "map", - "values": { - "type": "map", - "values": "string" - } - } - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/metadata-field/metadata.avsc b/hermes-consumers/src/test/resources/schemas/metadata-field/metadata.avsc deleted file mode 100644 index cccb4c604b..0000000000 --- a/hermes-consumers/src/test/resources/schemas/metadata-field/metadata.avsc +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "record", - "name": "MetadataField", - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "fields": [ - { - "name": "__metadata", - "type": ["null", { - "type": "map", - "values": "string" - }], - "doc": "Field internally used by Hermes to propagate metadata.", - "default": null - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/nested.avsc b/hermes-consumers/src/test/resources/schemas/nested.avsc deleted file mode 100644 index dec14c2bd2..0000000000 --- a/hermes-consumers/src/test/resources/schemas/nested.avsc +++ /dev/null @@ -1,36 +0,0 @@ -{ - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "name": "Nested", - "type": "record", - "fields": [ - { - "name": "level1Record", - "type": ["null", { - "type": "record", - "name": "Level3Record", - "fields": [{ - "name": "level4Array", - "type": { - "type": "array", - "items": { - "type": "map", - "values": { - "type": "record", - "name": "Level5Record", - "fields": [ - { - "name": "level6String", - "default": "null", - "type": [ - "null", "string" - ] - } - ] - } - } - } - }] - }] - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/null.avsc b/hermes-consumers/src/test/resources/schemas/null.avsc deleted file mode 100644 index 928d557f4d..0000000000 --- a/hermes-consumers/src/test/resources/schemas/null.avsc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "name": "Null", - "type": "record", - "fields": [ - { - "name": "null_field", - "type": "null" - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/record-primitives/empty-inner-record.avsc b/hermes-consumers/src/test/resources/schemas/record-primitives/empty-inner-record.avsc deleted file mode 100644 index 4ecb3028a5..0000000000 --- a/hermes-consumers/src/test/resources/schemas/record-primitives/empty-inner-record.avsc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "name": "RecordPrimitives", - "type": "record", - "fields": [ - { - "type": "string", - "name": "field" - }, - { - "name": "test2", - "type": { - "name": "test2", - "type": "record", - "fields": [] - } - } - ] -} diff --git a/hermes-consumers/src/test/resources/schemas/record-primitives/empty-schema.avsc b/hermes-consumers/src/test/resources/schemas/record-primitives/empty-schema.avsc deleted file mode 100644 index 35a8e5115e..0000000000 --- a/hermes-consumers/src/test/resources/schemas/record-primitives/empty-schema.avsc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "name": "RecordPrimitives", - "type": "record", - "fields": [ - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/union/union-less-than-two-types.avsc b/hermes-consumers/src/test/resources/schemas/union/union-less-than-two-types.avsc deleted file mode 100644 index 0811f5a62c..0000000000 --- a/hermes-consumers/src/test/resources/schemas/union/union-less-than-two-types.avsc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "name": "Enum", - "type": "record", - "fields": [ - { - "name": "enum_field", - "type": ["int"] - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/union/union-more-than-two-types.avsc b/hermes-consumers/src/test/resources/schemas/union/union-more-than-two-types.avsc deleted file mode 100644 index 35f39b4755..0000000000 --- a/hermes-consumers/src/test/resources/schemas/union/union-more-than-two-types.avsc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "name": "Enum", - "type": "record", - "fields": [ - { - "name": "enum_field", - "type": ["int", "long", "string"] - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/union/union-null-at-second-position.avsc b/hermes-consumers/src/test/resources/schemas/union/union-null-at-second-position.avsc deleted file mode 100644 index 1809607060..0000000000 --- a/hermes-consumers/src/test/resources/schemas/union/union-null-at-second-position.avsc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "name": "Enum", - "type": "record", - "fields": [ - { - "name": "union_field", - "type": ["int", "null"] - } - ] -} \ No newline at end of file diff --git a/hermes-consumers/src/test/resources/schemas/union/union-without-null.avsc b/hermes-consumers/src/test/resources/schemas/union/union-without-null.avsc deleted file mode 100644 index a5880680ed..0000000000 --- a/hermes-consumers/src/test/resources/schemas/union/union-without-null.avsc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "namespace": "pl.allegro.bigdata.avro.gcpavrotools", - "name": "Enum", - "type": "record", - "fields": [ - { - "name": "enum_field", - "type": ["int", "long"] - } - ] -} \ No newline at end of file