-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
343 issue refactor schema registry sampler (#373)
* [WIP] Apicurio integration * 302 Fix some unit test. In progress... * 302 Add wiremock server stubs * [WIP] Apicurio integration * 302 Fix some unit test. In progress... * 302 Add wiremock server stubs * [WIP] Apicurio integration * 302 Fix some unit test. In progress... * 302 Add wiremock server stubs * feat: add files in schemaRegistry adapter impl. Pending SchemaResgistryFactory * 343 Fix integration issues * add ParsedSchemaAdapter * feat: refactor parseSchemaParser * feat: change creatorFactory * feat:error casting protobufSchema * 343 Fix casting error to ProtobufSchema * feat:error casting protobufSchema * feat: type json ok * changed version in poms * changed version in poms, resolve posible null in getParsedSchema * Update src/main/java/com/sngular/kloadgen/sampler/schemaregistry/adapter/impl/ConfluentParsedSchemaMetadata.java Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com> * changed return getType in ConfluentParsedSchemaMetadata * changed remove variable Reference in ConfluentParsedSchemaMetadata * resolve nullPointer getSchema and "UnnecessarilyFullyQualified" * resolve nullPointer getSchema and "UnnecessarilyFullyQualified" * resolve nullPointer getSchema * add final in variables and removed unused imports * delete apicurioParsedSchema duplicated, add license in jmeterhelper and changed size buffer serializer avro * delete avroAdapter --------- Co-authored-by: mseijasm <miguel.seijas@sngular.com> Co-authored-by: Raúl Abad <raul.abad@sngular.com> Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
- Loading branch information
1 parent
dd931dd
commit d6e397b
Showing
19 changed files
with
490 additions
and
285 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/com/sngular/kloadgen/sampler/schemaregistry/adapter/impl/BaseParsedSchema.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.sngular.kloadgen.sampler.schemaregistry.adapter.impl; | ||
|
||
import org.apache.avro.Schema.Parser; | ||
|
||
public class BaseParsedSchema <T extends ParsedSchemaAdapter> extends Parser { | ||
|
||
private final T parsedSchemaAdapter; | ||
|
||
public BaseParsedSchema(T parsedSchemaAdapter) {this.parsedSchemaAdapter = parsedSchemaAdapter;} | ||
|
||
|
||
public T getParsedSchemaAdapter(){ | ||
return parsedSchemaAdapter; | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
...m/sngular/kloadgen/sampler/schemaregistry/adapter/impl/ConfluentParsedSchemaMetadata.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.sngular.kloadgen.sampler.schemaregistry.adapter.impl; | ||
|
||
import java.util.List; | ||
|
||
import io.confluent.kafka.schemaregistry.ParsedSchema; | ||
import io.confluent.kafka.schemaregistry.client.rest.entities.SchemaReference; | ||
import io.confluent.kafka.schemaregistry.protobuf.ProtobufSchema; | ||
import lombok.Getter; | ||
import org.apache.avro.Schema; | ||
|
||
@Getter | ||
public class ConfluentParsedSchemaMetadata extends ParsedSchemaAdapter { | ||
|
||
private String schemaType; | ||
|
||
private String name; | ||
|
||
private String canonicalString; | ||
|
||
private Object rawSchema; | ||
|
||
private ConfluentParsedSchemaMetadata(ParsedSchema parsedSchema){ | ||
this.schemaType = parsedSchema.schemaType(); | ||
this.name = parsedSchema.name(); | ||
this.canonicalString = parsedSchema.canonicalString(); | ||
this.rawSchema = parsedSchema.rawSchema(); | ||
} | ||
|
||
private ConfluentParsedSchemaMetadata(Schema schema){ | ||
this.schemaType = schema.getType().getName(); | ||
this.name = schema.getName(); | ||
} | ||
|
||
public ConfluentParsedSchemaMetadata(ProtobufSchema schema){ | ||
this.schemaType = schema.schemaType(); | ||
this.name = schema.name(); | ||
this.rawSchema = schema.rawSchema(); | ||
this.canonicalString = schema.canonicalString(); | ||
} | ||
|
||
public ConfluentParsedSchemaMetadata() { | ||
|
||
} | ||
|
||
public static ParsedSchemaAdapter parse(final ParsedSchema parsedSchema) { | ||
return new ConfluentParsedSchemaMetadata(parsedSchema); | ||
} | ||
|
||
public static ParsedSchemaAdapter parse(final Schema schema) { | ||
return new ConfluentParsedSchemaMetadata(schema); | ||
} | ||
public static ParsedSchemaAdapter parse (final ProtobufSchema schema){ | ||
return new ConfluentParsedSchemaMetadata(schema); | ||
} | ||
|
||
@Override | ||
public String getType() { | ||
return this.schemaType; | ||
} | ||
|
||
@Override | ||
public Object getRawSchema() { | ||
return this.rawSchema; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...in/java/com/sngular/kloadgen/sampler/schemaregistry/adapter/impl/ParsedSchemaAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.sngular.kloadgen.sampler.schemaregistry.adapter.impl; | ||
|
||
public abstract class ParsedSchemaAdapter { | ||
public abstract <T> T getType(); | ||
|
||
public abstract <T> T getRawSchema(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.