Skip to content

Commit

Permalink
Merge de los cambios en master
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertoSngular committed Nov 3, 2023
1 parent 3aca586 commit 5fe43ef
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 65 deletions.
96 changes: 48 additions & 48 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,17 +191,6 @@
</roles>
<timezone>Europe/Madrid</timezone>
</developer>
<developer>
<id>AnxoGomezSngular</id>
<name>Anxo Gómez Sánchez</name>
<email>[email protected]</email>
<organization>Sngular</organization>
<organizationUrl>https://sngular.github.io/</organizationUrl>
<roles>
<role>Developer</role>
</roles>
<timezone>Europe/Madrid</timezone>
</developer>
<developer>
<id>pedrogarcia</id>
<name>Pedro Garcia</name>
Expand All @@ -224,17 +213,6 @@
</roles>
<timezone>Europe/Madrid</timezone>
</developer>
<developer>
<id>nuriaricorf</id>
<name>Nuria Rico Freire</name>
<email>[email protected]</email>
<organization>Sngular</organization>
<organizationUrl>https://sngular.github.io/</organizationUrl>
<roles>
<role>Junior Developer</role>
</roles>
<timezone>Europe/Madrid</timezone>
</developer>
<developer>
<id>rabad-sng</id>
<name>Raúl Abad</name>
Expand Down Expand Up @@ -301,6 +279,17 @@
</roles>
<timezone>Europe/Madrid</timezone>
</developer>
<developer>
<id>RobertoSngular</id>
<name>Roberto Riveira Veiga</name>
<email>[email protected]</email>
<organization>Sngular</organization>
<organizationUrl>https://www.sngular.com</organizationUrl>
<roles>
<role>Trainee Backend Developer</role>
</roles>
<timezone>Europe/Madrid</timezone>
</developer>
</developers>

<scm>
Expand All @@ -321,24 +310,24 @@
</distributionManagement>

<properties>
<assertj-core.version>3.24.2</assertj-core.version>
<assertj-core.version>3.22.0</assertj-core.version>
<assertj-json.version>1.2.0</assertj-json.version>
<jsonassert.version>1.5.1</jsonassert.version>
<avro.version>1.11.2</avro.version>
<avro.version>1.11.0</avro.version>
<commons-beanutils.version>1.9.4</commons-beanutils.version>
<commons-collections4.version>4.4</commons-collections4.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
<gson.version>2.8.6</gson.version>
<guava.version>32.0.0-jre</guava.version>
<jaxb-api.version>2.4.0-b180830.0359</jaxb-api.version>
<jdk.version>17</jdk.version>
<jdk.version>11</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>
<apicurio-registry.version>2.4.1.Final</apicurio-registry.version>
<kafka.version>3.1.0</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>
Expand All @@ -350,6 +339,17 @@
</properties>

<dependencies>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>jorphan</artifactId>
<version>${jmeter.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
Expand All @@ -365,6 +365,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>com.eclipsesource.minimal-json</groupId>
<artifactId>minimal-json</artifactId>
Expand All @@ -384,12 +389,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.15.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.15.2</version>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
Expand Down Expand Up @@ -467,7 +467,7 @@
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro-protobuf</artifactId>
<version>1.11.2</version>
<version>1.11.0</version>
</dependency>
<dependency>
<groupId>com.github.os72</groupId>
Expand All @@ -480,11 +480,6 @@
<version>4.0.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-common-protos</artifactId>
<version>2.24.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down Expand Up @@ -514,7 +509,7 @@
<dependency>
<groupId>com.github.everit-org.json-schema</groupId>
<artifactId>org.everit.json.schema</artifactId>
<version>1.14.2</version>
<version>1.14.0</version>
</dependency>
<!-- Options -->
<dependency>
Expand Down Expand Up @@ -701,13 +696,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.6.0</version>
<configuration>
<optimize>true</optimize>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<source>16</source>
<target>16</target>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -740,7 +735,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
Expand All @@ -760,6 +755,10 @@
<version>${jmeter.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.apache.jmeter</groupId>
<artifactId>jorphan</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
Expand Down Expand Up @@ -791,16 +790,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<version>2.4.2</version>
<configuration>
<filters>
<filter>
<excludes>
<exclude>org/apache/jmeter/jmeter.properties</exclude>
</excludes>
<includes>
<include>*.proto</include>
</includes>
</filter>
</filters>
<finalName>${project.artifactId}-${project.version}</finalName>
Expand Down Expand Up @@ -829,6 +825,10 @@
<artifactId>ApacheJMeter_java</artifactId>
<version>${jmeter.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.jmeter</groupId>
<artifactId>jorphan</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public SchemaRegistryConfigElementBeanInfo() {

super(SchemaRegistryConfigElement.class);

createPropertyGroup("schema_registry_config", new String[]{SchemaRegistryConfigElementValue.SCHEMA_REGISTRY_NAME, SchemaRegistryConfigElementValue.SCHEMA_REGISTRY_PROPERTIES,
SchemaRegistryConfigElementValue.SCHEMA_REGISTRY_URL});
createPropertyGroup("schema_registry_config", new String[]{SchemaRegistryConfigElementValue.SCHEMA_REGISTRY_NAME,
SchemaRegistryConfigElementValue.SCHEMA_REGISTRY_PROPERTIES, SchemaRegistryConfigElementValue.SCHEMA_REGISTRY_URL});

final PropertyDescriptor schemaRegistryName = property(SchemaRegistryConfigElementValue.SCHEMA_REGISTRY_NAME);
schemaRegistryName.setPropertyEditorClass(SchemaRegistryNamePropertyEditor.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.sngular.kloadgen.extractor;

import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
Expand Down Expand Up @@ -35,9 +34,8 @@ public static List<FieldValueMapping> flatPropertiesList(final ParsedSchema pars
return ExtractorFactory.getExtractor(parserSchema.schemaType()).processSchema(parserSchema, SchemaRegistryEnum.CONFLUENT);
}

public static List<String> schemaTypesList(final File schemaFile, final String schemaType, final String registry) throws IOException {
return ExtractorFactory.getExtractor(schemaType).getSchemaNameList(readLineByLine(schemaFile.getPath()),
ExtractorFactory.getSchemaRegistry(registry));
public static String readSchemaFile(final String filePath) throws IOException {
return readLineByLine(filePath);
}

private static String readLineByLine(final String filePath) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import com.sngular.kloadgen.extractor.extractors.Extractor;
import com.sngular.kloadgen.extractor.extractors.ExtractorRegistry;
import com.sngular.kloadgen.model.FieldValueMapping;
import io.confluent.kafka.schemaregistry.ParsedSchema;
import io.confluent.kafka.schemaregistry.json.JsonSchema;


public class JsonExtractor implements ExtractorRegistry<Object> {
Expand All @@ -18,6 +20,10 @@ public final List<FieldValueMapping> processSchema(final Object schemaReceived,
return SCHEMA_REGISTRY_MAP.get(registryEnum).processSchema(schemaReceived);
}

public final ParsedSchema processSchema(final String fileContent) {
return new JsonSchema(fileContent);
}

public final List<String> getSchemaNameList(final String schema, final SchemaRegistryEnum registryEnum) {
return SCHEMA_REGISTRY_MAP.get(registryEnum).getSchemaNameList(schema);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import com.sngular.kloadgen.extractor.extractors.ExtractorRegistry;
import com.sngular.kloadgen.model.FieldValueMapping;
import com.squareup.wire.schema.internal.parser.ProtoFileElement;
import io.confluent.kafka.schemaregistry.ParsedSchema;
import io.confluent.kafka.schemaregistry.protobuf.ProtobufSchema;

public class ProtobuffExtractor implements ExtractorRegistry<Object> {

Expand All @@ -25,6 +27,10 @@ public final List<FieldValueMapping> processSchema(final Object schemaReceived,
return resultSchema;
}

public final ParsedSchema processSchema(final String fileContent) {
return new ProtobufSchema(fileContent);
}

public final List<String> getSchemaNameList(final String schema, final SchemaRegistryEnum registryEnum) {
return SCHEMA_REGISTRY_MAP.get(registryEnum).getSchemaNameList(schema);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

import javax.xml.bind.DatatypeConverter;

import javax.xml.bind.DatatypeConverter;

import com.google.protobuf.Descriptors.Descriptor;
import com.google.protobuf.DynamicMessage;
import io.confluent.kafka.schemaregistry.protobuf.MessageIndexes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ void testFlatPropertiesListWithProtobuf() throws IOException {
Assertions.assertThat(result).isNotNull();
}


@Test
@DisplayName("Test readSchemaFile with AVRO")
void testReadSchemaFile() throws IOException{
final String testFilePath = fileHelper.getFile("/avro-files/embedded-avros-example-test.avsc").toPath().toString();


final var result = SchemaExtractor.readSchemaFile(testFilePath);
Assertions.assertThat(result).isNotNull();
}

@Test
@DisplayName("Test flatPropertiesList throws exception schema type not supported")
void testFlatPropertiesListWithException() {
Expand All @@ -131,13 +142,4 @@ void testFlatPropertiesListWithException() {

}

@Test
@DisplayName("Test readSchemaFile with AVRO")
void testReadSchemaFile() throws IOException, RestClientException {
final String testFilePath = fileHelper.getFile("/avro-files/embedded-avros-example-test.avsc").toPath().toString();


final var result = SchemaExtractor.readSchemaFile(testFilePath);
Assertions.assertThat(result).isNotNull();
}
}

0 comments on commit 5fe43ef

Please sign in to comment.