Schema.java 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. package com.provectus.kafka.ui.models;
  2. import com.provectus.kafka.ui.api.model.SchemaType;
  3. import lombok.Data;
  4. import lombok.experimental.Accessors;
  5. import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
  6. @Data
  7. @Accessors(chain = true)
  8. public class Schema {
  9. private String name, valuePath;
  10. private SchemaType type;
  11. public static Schema createSchemaAvro() {
  12. return new Schema().setName("schema_avro-" + randomAlphabetic(5))
  13. .setType(SchemaType.AVRO)
  14. .setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schemas/schema_avro_value.json");
  15. }
  16. public static Schema createSchemaJson() {
  17. return new Schema().setName("schema_json-" + randomAlphabetic(5))
  18. .setType(SchemaType.JSON)
  19. .setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schemas/schema_json_Value.json");
  20. }
  21. public static Schema createSchemaProtobuf() {
  22. return new Schema().setName("schema_protobuf-" + randomAlphabetic(5))
  23. .setType(SchemaType.PROTOBUF)
  24. .setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schemas/schema_protobuf_value.txt");
  25. }
  26. }