Skip to content

Commit

Permalink
#332 add test
Browse files Browse the repository at this point in the history
  • Loading branch information
jemacineiras committed Feb 29, 2024
1 parent d147850 commit 65a724d
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 72 deletions.
70 changes: 35 additions & 35 deletions pom-maven-central.xml
Original file line number Diff line number Diff line change
Expand Up @@ -365,20 +365,21 @@
<jaxb-api.version>2.4.0-b180830.0359</jaxb-api.version>
<jdk.version>17</jdk.version>
<jmeter.lib.scope>provided</jmeter.lib.scope>
<jmeter.version>5.6.2</jmeter.version>
<json-path.version>2.6.0</json-path.version>
<junit-jupiter-api.version>5.8.2</junit-jupiter-api.version>
<kafka-schema-registry-client.version>7.1.1</kafka-schema-registry-client.version>
<apicurio-registry.version>2.4.3.Final</apicurio-registry.version>
<kafka.version>3.5.1</kafka.version>
<jmeter.version>5.6.3</jmeter.version>
<json-path.version>2.9.0</json-path.version>
<junit-jupiter-api.version>5.10.1</junit-jupiter-api.version>
<kafka-schema-registry-client.version>7.5.1</kafka-schema-registry-client.version>
<apicurio-registry.version>2.5.8.Final</apicurio-registry.version>
<kafka.version>3.6.1</kafka.version>
<lombok.version>1.18.22</lombok.version>
<minimal-json.version>0.9.5</minimal-json.version>
<mockito-core.version>4.2.0</mockito-core.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<rest-assured.version>4.5.0</rest-assured.version>
<slf4j-api.version>2.0.0-alpha1</slf4j-api.version>
<slf4j-api.version>2.0.11</slf4j-api.version>
<wiremock-junit5.version>1.3.1</wiremock-junit5.version>
<wiremock.version>2.35.1</wiremock.version>
<jackson-core.version>2.15.2</jackson-core.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -406,22 +407,21 @@
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
<version>${avro.version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.24.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.15.2</version>
<version>${jackson-core.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.15.2</version>
<version>${jackson-core.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
Expand All @@ -434,16 +434,6 @@
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-schema-registry-client</artifactId>
<version>${kafka-schema-registry-client.version}</version>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-avro-serializer</artifactId>
<version>${kafka-schema-registry-client.version}</version>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-json-serializer</artifactId>
Expand Down Expand Up @@ -476,6 +466,16 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-common</artifactId>
<version>1.8.20</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>1.8.20</version>
</dependency>
<dependency>
<groupId>io.apicurio</groupId>
<artifactId>apicurio-registry-serdes-avro-serde</artifactId>
Expand All @@ -499,7 +499,7 @@
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro-protobuf</artifactId>
<version>1.11.2</version>
<version>1.11.3</version>
</dependency>
<dependency>
<groupId>com.github.os72</groupId>
Expand All @@ -509,18 +509,18 @@
<dependency>
<groupId>com.squareup.wire</groupId>
<artifactId>wire-java-generator</artifactId>
<version>4.0.1</version>
<version>4.9.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-common-protos</artifactId>
<version>2.24.0</version>
<version>2.30.0</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.24.3</version>
<version>3.25.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand All @@ -541,7 +541,7 @@
<dependency>
<groupId>com.github.curious-odd-man</groupId>
<artifactId>rgxgen</artifactId>
<version>1.3</version>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
Expand All @@ -557,7 +557,7 @@
<dependency>
<groupId>com.github.charithe</groupId>
<artifactId>kafka-junit</artifactId>
<version>4.2.0</version>
<version>4.2.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -690,7 +690,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
<version>3.2.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
Expand Down Expand Up @@ -725,7 +725,7 @@
<plugin>
<groupId>com.github.ekryd.sortpom</groupId>
<artifactId>sortpom-maven-plugin</artifactId>
<version>3.0.0</version>
<version>3.3.0</version>
<executions>
<execution>
<goals>
Expand All @@ -738,7 +738,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.9.0</version>
<version>3.10.0</version>
<configuration>
<optimize>true</optimize>
<showDeprecation>true</showDeprecation>
Expand Down Expand Up @@ -777,7 +777,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<version>3.2.2</version>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
Expand Down
64 changes: 32 additions & 32 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -365,20 +365,21 @@
<jaxb-api.version>2.4.0-b180830.0359</jaxb-api.version>
<jdk.version>17</jdk.version>
<jmeter.lib.scope>provided</jmeter.lib.scope>
<jmeter.version>5.6.2</jmeter.version>
<jmeter.version>5.6.3</jmeter.version>
<json-path.version>2.9.0</json-path.version>
<junit-jupiter-api.version>5.8.2</junit-jupiter-api.version>
<kafka-schema-registry-client.version>7.1.1</kafka-schema-registry-client.version>
<apicurio-registry.version>2.4.3.Final</apicurio-registry.version>
<kafka.version>3.5.1</kafka.version>
<junit-jupiter-api.version>5.10.1</junit-jupiter-api.version>
<kafka-schema-registry-client.version>7.5.1</kafka-schema-registry-client.version>
<apicurio-registry.version>2.5.8.Final</apicurio-registry.version>
<kafka.version>3.6.1</kafka.version>
<lombok.version>1.18.22</lombok.version>
<minimal-json.version>0.9.5</minimal-json.version>
<mockito-core.version>4.2.0</mockito-core.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<rest-assured.version>4.5.0</rest-assured.version>
<slf4j-api.version>2.0.0-alpha1</slf4j-api.version>
<slf4j-api.version>2.0.11</slf4j-api.version>
<wiremock-junit5.version>1.3.1</wiremock-junit5.version>
<wiremock.version>2.35.1</wiremock.version>
<jackson-core.version>2.15.2</jackson-core.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -406,22 +407,21 @@
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
<version>${avro.version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.24.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.15.2</version>
<version>${jackson-core.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.15.2</version>
<version>${jackson-core.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
Expand All @@ -434,16 +434,6 @@
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-schema-registry-client</artifactId>
<version>${kafka-schema-registry-client.version}</version>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-avro-serializer</artifactId>
<version>${kafka-schema-registry-client.version}</version>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-json-serializer</artifactId>
Expand Down Expand Up @@ -476,6 +466,16 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-common</artifactId>
<version>1.8.20</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>1.8.20</version>
</dependency>
<dependency>
<groupId>io.apicurio</groupId>
<artifactId>apicurio-registry-serdes-avro-serde</artifactId>
Expand All @@ -499,7 +499,7 @@
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro-protobuf</artifactId>
<version>1.11.2</version>
<version>1.11.3</version>
</dependency>
<dependency>
<groupId>com.github.os72</groupId>
Expand All @@ -509,7 +509,7 @@
<dependency>
<groupId>com.squareup.wire</groupId>
<artifactId>wire-java-generator</artifactId>
<version>4.0.1</version>
<version>4.9.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -541,7 +541,7 @@
<dependency>
<groupId>com.github.curious-odd-man</groupId>
<artifactId>rgxgen</artifactId>
<version>1.3</version>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
Expand All @@ -557,7 +557,7 @@
<dependency>
<groupId>com.github.charithe</groupId>
<artifactId>kafka-junit</artifactId>
<version>4.2.0</version>
<version>4.2.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -690,7 +690,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
<version>3.2.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
Expand Down Expand Up @@ -725,7 +725,7 @@
<plugin>
<groupId>com.github.ekryd.sortpom</groupId>
<artifactId>sortpom-maven-plugin</artifactId>
<version>3.0.0</version>
<version>3.3.0</version>
<executions>
<execution>
<goals>
Expand All @@ -738,7 +738,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.9.0</version>
<version>3.10.0</version>
<configuration>
<optimize>true</optimize>
<showDeprecation>true</showDeprecation>
Expand Down Expand Up @@ -777,7 +777,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<version>3.2.2</version>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ private static void extractOneOfs(final MessageElement field, final List<FieldVa
.isAncestorRequired(isAncestorRequired).build());
} else if (nestedTypes.containsKey(subField.getType())) {
final MessageElement clonedField = new MessageElement(field.getLocation(), field.getName(), field.getDocumentation(), field.getNestedTypes(), field.getOptions(),
field.getReserveds(), oneOfElement.getFields(), Collections.emptyList(), field.getExtensions(), field.getGroups());
field.getReserveds(), oneOfElement.getFields(), Collections.emptyList(), field.getExtensions(), field.getGroups(),
field.getExtendDeclarations());
processField(clonedField, completeFieldList, Collections.emptyList(), isAncestorRequired, nestedTypes);
} else {
completeFieldList.add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ void testProtobufGoogleTypes() throws IOException {
final List<FieldValueMapping> fieldValueMappingList = List.of(
FieldValueMapping.builder().fieldName("id").fieldType("Int32Value").required(true).isAncestorRequired(true).build(),
FieldValueMapping.builder().fieldName("occurrence_id").fieldType("StringValue").fieldValueList("Isabel").required(true).isAncestorRequired(true).build(),
FieldValueMapping.builder().fieldName("load_number").fieldType("Int32Value").required(true).isAncestorRequired(true).build());
FieldValueMapping.builder().fieldName("load_number").fieldType("Int32Value").required(true).isAncestorRequired(true).build(),
FieldValueMapping.builder().fieldName("date").fieldType("DateValue").required(true).isAncestorRequired(true).build(),
FieldValueMapping.builder().fieldName("timeofday").fieldType("TimeOfDateValue").required(true).isAncestorRequired(true).build());
final SchemaProcessor protobufSchemaProcessor = new SchemaProcessor();
protobufSchemaProcessor.processSchema(SchemaTypeEnum.PROTOBUF, new ParsedSchema(testFile, SchemaTypeEnum.PROTOBUF.name()),
confluentBaseSchemaMetadata, fieldValueMappingList);
Expand All @@ -112,9 +114,11 @@ void testProtobufGoogleTypes() throws IOException {
Assertions.assertThat(message).isNotNull().isInstanceOf(EnrichedRecord.class);
Assertions.assertThat(message.getGenericRecord()).isNotNull();
Assertions.assertThat(secondValue).isEqualTo("Isabel");
Assertions.assertThat(assertKeys).hasSize(3).containsExactlyInAnyOrder("abc.Incident.id",
Assertions.assertThat(assertKeys).hasSize(5).containsExactlyInAnyOrder("abc.Incident.id",
"abc.Incident.occurrence_id",
"abc.Incident.load_number");
"abc.Incident.load_number",
"abc.Incident.date",
"abc.Incident.timeofday");
}

@Test
Expand Down
4 changes: 3 additions & 1 deletion src/test/resources/proto-files/googleTypesTest.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ message Incident {
.google.protobuf.Int32Value id = 1;
.google.protobuf.StringValue occurrence_id = 2;
.google.protobuf.StringValue load_number = 3;

.google.type.Date date = 4;
.google.type.TimeOfDay timeofday = 5;

}

0 comments on commit 65a724d

Please sign in to comment.