@Override public String getResultantSchema(String schemaText) throws InvalidSchemaException, SchemaNotFoundException { AvroSchemaResolver avroSchemaResolver = new AvroSchemaResolver(getSchemaVersionRetriever()); return avroSchemaResolver.resolveSchema(schemaText); }
/** * Gets the type of this result. * * @return the type of this result. */ public SchemaCompatibilityType getType() { return result.getCompatibility(); }
@Override public List<SchemaFieldInfo> generateFields(String schemaText) throws InvalidSchemaException, SchemaNotFoundException { AvroFieldsGenerator avroFieldsGenerator = new AvroFieldsGenerator(); return avroFieldsGenerator.generateFields(new Schema.Parser().parse(getResultantSchema(schemaText))); }
public CompatibilityResult validate(Schema readerSchema, Schema writerSchema) { SchemaPairCompatibility schemaPairCompatibility = checkReaderWriterCompatibility(readerSchema, writerSchema); SchemaCompatibilityResult result = schemaPairCompatibility.getResult(); return result.getCompatibility() == SchemaCompatibilityType.COMPATIBLE ? CompatibilityResult.createCompatibleResult(writerSchema.toString()) : CompatibilityResult.createIncompatibleResult(result.getMessage(), result.getLocation(), writerSchema.toString()); }
@Override public CompatibilityResult checkCompatibility(String toSchemaText, String existingSchemaText, SchemaCompatibility existingSchemaCompatibility) { return AvroSchemaValidator .of(existingSchemaCompatibility) .validate(new Schema.Parser().parse(toSchemaText), new Schema.Parser().parse(existingSchemaText)); }
@Test public void testConfluentBasicApisMixWithInvalidIncompatibleSchemas() throws Exception { String subjectName = testName(); doTestAPIsMixWithIncompatibleInvalidSchemas(subjectName); }
public List<SchemaFieldInfo> generateFields(Schema rootSchema) { List<SchemaFieldInfo> schemaFieldInfos = new ArrayList<>(); parse(rootSchema, schemaFieldInfos); return schemaFieldInfos; }
/** * {@inheritDoc} */ @Override public String toString() { return String.format( "SchemaCompatibilityResult{compatibility:%s, type:%s, readerSubset:%s, writerSubset:%s, message:%s, location:%s}", compatibility, schemaIncompatibilityType, readerSubset, writerSubset, message, getLocation()); }
@Test public void testRedirectPaths() throws Exception { String[] paths = {"/", "/subjects/", "/schemas/ids/", "/subjects", "/schemas/ids", "/subjects/1/", "/schemas/ids/2"}; doTestForwardRedirectPaths(paths, false); }
private void _testByStoringSchemaIdInHeaderOrPayload(String topicName, Object msg) throws InterruptedException { _testByStoringSchemaIdInHeaderOrPayload(topicName, msg, false); _testByStoringSchemaIdInHeaderOrPayload(topicName, msg, true); }
public void stopCluster() { after(); } }
public void startCluster() { try { before(); } catch (Throwable throwable) { throw new RuntimeException(throwable); } }
@Override public String getResultantSchema(String schemaText) throws InvalidSchemaException, SchemaNotFoundException { AvroSchemaResolver avroSchemaResolver = new AvroSchemaResolver(getSchemaVersionRetriever()); return avroSchemaResolver.resolveSchema(schemaText); }
@Override public List<SchemaFieldInfo> generateFields(String schemaText) throws InvalidSchemaException, SchemaNotFoundException { AvroFieldsGenerator avroFieldsGenerator = new AvroFieldsGenerator(); return avroFieldsGenerator.generateFields(new Schema.Parser().parse(getResultantSchema(schemaText))); }
public CompatibilityResult validate(Schema readerSchema, Schema writerSchema) { SchemaPairCompatibility schemaPairCompatibility = checkReaderWriterCompatibility(readerSchema, writerSchema); SchemaCompatibilityResult result = schemaPairCompatibility.getResult(); return result.getCompatibility() == SchemaCompatibilityType.COMPATIBLE ? CompatibilityResult.createCompatibleResult(writerSchema.toString()) : CompatibilityResult.createIncompatibleResult(result.getMessage(), result.getLocation(), writerSchema.toString()); }
@Override public CompatibilityResult checkCompatibility(String toSchemaText, String existingSchemaText, SchemaCompatibility existingSchemaCompatibility) { return AvroSchemaValidator .of(existingSchemaCompatibility) .validate(new Schema.Parser().parse(toSchemaText), new Schema.Parser().parse(existingSchemaText)); }
/** * Gets the type of this result. * * @return the type of this result. */ public SchemaCompatibilityType getType() { return result.getCompatibility(); }
public List<SchemaFieldInfo> generateFields(Schema rootSchema) { List<SchemaFieldInfo> schemaFieldInfos = new ArrayList<>(); parse(rootSchema, schemaFieldInfos); return schemaFieldInfos; }
/** * {@inheritDoc} */ @Override public String toString() { return String.format( "SchemaCompatibilityResult{compatibility:%s, type:%s, readerSubset:%s, writerSubset:%s, message:%s, location:%s}", compatibility, schemaIncompatibilityType, readerSubset, writerSubset, message, getLocation()); }
@Test public void testNonRedirectForwardPaths() throws Exception { final String[] paths = {"/ui", "/api/v1/confluent/", "/401.html", "/ui/401/html"}; doTestForwardRedirectPaths(paths, true); }