@Override public CompatibilityResult validate(T toSchema, T existingSchema) { return CompatibilityResult.createCompatibleResult(existingSchema.toString()); } }
/** * Returns {@link CompatibilityResult} instance with {@link CompatibilityResult#isCompatible()} as false and {@link CompatibilityResult#getErrorMessage()} as given {@code errorMessage} * @param errorMessage error message * @param errorLocation location of the error * @param schema schema for which this incompatibility result is returned. * */ public static CompatibilityResult createIncompatibleResult(String errorMessage, String errorLocation, String schema) { return new CompatibilityResult(false, errorMessage, errorLocation, schema); }
private static void checkCompatibility(SchemaVersionService schemaVersionService, SchemaMetadata schemaMetadata, String toSchemaText, String fromSchemaText) throws IncompatibleSchemaException { CompatibilityResult compatibilityResult = schemaVersionService.checkForCompatibility(schemaMetadata, toSchemaText, fromSchemaText); if (!compatibilityResult.isCompatible()) { String errMsg = String.format("Given schema is not compatible with latest schema versions. \n" + "Error location: [%s] \n" + "Error encountered is: [%s]", compatibilityResult.getErrorLocation(), compatibilityResult.getErrorMessage()); throw new IncompatibleSchemaException(errMsg); } }
latestSchemaVersionInfo.getSchemaText(), schemaMetadata.getCompatibility()); if (!compatibilityResult.isCompatible()) { LOG.info("Received schema is not compatible with the latest schema versions [{}] with schema name [{}]", latestSchemaVersionInfo.getVersion(), schemaName); schemaVersionInfo.getSchemaText(), schemaMetadata.getCompatibility()); if (!compatibilityResult.isCompatible()) { LOG.info("Received schema is not compatible with one of the schema versions [{}] with schema name [{}]", schemaVersionInfo.getVersion(), schemaName); return compatibilityResult != null ? compatibilityResult : CompatibilityResult.createCompatibleResult(toSchema);
@Override public boolean isCompatibleWithAllVersions(String schemaBranchName, String schemaName, String toSchemaText) throws SchemaNotFoundException, SchemaBranchNotFoundException { return checkCompatibility(schemaBranchName,schemaName, toSchemaText).isCompatible(); }
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()); }
private static void checkCompatibility(SchemaVersionService schemaVersionService, SchemaMetadata schemaMetadata, String toSchemaText, String fromSchemaText) throws IncompatibleSchemaException { CompatibilityResult compatibilityResult = schemaVersionService.checkForCompatibility(schemaMetadata, toSchemaText, fromSchemaText); if (!compatibilityResult.isCompatible()) { String errMsg = String.format("Given schema is not compatible with latest schema versions. \n" + "Error location: [%s] \n" + "Error encountered is: [%s]", compatibilityResult.getErrorLocation(), compatibilityResult.getErrorMessage()); throw new IncompatibleSchemaException(errMsg); } }
@Override public CompatibilityResult validate(T toSchema, T existingSchema) { CompatibilityResult compatibilityResult = schemaValidator.validate(toSchema, existingSchema); if (compatibilityResult.isCompatible()) { compatibilityResult = schemaValidator.validate(existingSchema, toSchema); } return compatibilityResult; } }
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()); }
CompatibilityResult compatibilityResult = checkCompatibility(schemaBranchName, schemaName, schemaVersion .getSchemaText()); if (!compatibilityResult.isCompatible()) { String errMsg = String.format("Given schema is not compatible with latest schema versions. \n" + "Error location: [%s] \n" + "Error encountered is: [%s]", compatibilityResult.getErrorLocation(), compatibilityResult.getErrorMessage()); LOG.error(errMsg); throw new IncompatibleSchemaException(errMsg);
@Override public CompatibilityResult validate(T toSchema, T existingSchema) { CompatibilityResult compatibilityResult = schemaValidator.validate(toSchema, existingSchema); if (compatibilityResult.isCompatible()) { compatibilityResult = schemaValidator.validate(existingSchema, toSchema); } return compatibilityResult; } }
@Override public CompatibilityResult validate(T toSchema, T existingSchema) { return CompatibilityResult.createCompatibleResult(existingSchema.toString()); } }
/** * @param schema schema to which compatibility is successful. * @return compatibility successful result for the given schema. */ public static CompatibilityResult createCompatibleResult(String schema) { return new CompatibilityResult(true, schema); } }
@Override public boolean isCompatibleWithAllVersions(String schemaName, String toSchemaText) throws SchemaNotFoundException, SchemaBranchNotFoundException { return schemaRegistry.checkCompatibility(schemaName, toSchemaText).isCompatible(); }
/** * Returns {@link CompatibilityResult} instance with {@link CompatibilityResult#isCompatible()} as false and {@link CompatibilityResult#getErrorMessage()} as given {@code errorMessage} * @param errorMessage error message * @param errorLocation location of the error * @param schema schema for which this incompatibility result is returned. * */ public static CompatibilityResult createIncompatibleResult(String errorMessage, String errorLocation, String schema) { return new CompatibilityResult(false, errorMessage, errorLocation, schema); }
/** * @param schema schema to which compatibility is successful. * @return compatibility successful result for the given schema. */ public static CompatibilityResult createCompatibleResult(String schema) { return new CompatibilityResult(true, schema); } }