@Test(expected = IllegalArgumentException.class) public void checkCompatibilityUsingBadMessage() throws Exception { SchemaDiff.compare(badMessageSchema, badMessageSchema); }
public static List<Difference> compare( final ProtobufSchema original, final ProtobufSchema update ) { Map<String, SchemaReference> originalReferences = original.references().stream() .collect(Collectors.toMap(SchemaReference::getName, r -> r)); Map<String, SchemaReference> updateReferences = update.references().stream() .collect(Collectors.toMap(SchemaReference::getName, r -> r)); Map<String, ProtoFileElement> originalDependencies = original.dependencies(); Map<String, ProtoFileElement> updateDependencies = update.dependencies(); final Context ctx = new Context(COMPATIBLE_CHANGES); collectContextInfoForRefs(ctx, originalReferences, originalDependencies, true); collectContextInfoForRefs(ctx, updateReferences, updateDependencies, false); compare(ctx, original.rawSchema(), update.rawSchema()); return ctx.getDifferences(); }
SchemaDiff { public static List<Difference> compare( final ProtobufSchema original, final ProtobufSchema update ) { Map<String, SchemaReference> originalReferences = original.references().stream() .collect(Collectors.toMap(SchemaReference::getName, r -> r)); Map<String, SchemaReference> updateReferences = update.references().stream() .collect(Collectors.toMap(SchemaReference::getName, r -> r)); Map<String, ProtoFileElement> originalDependencies = original.dependencies(); Map<String, ProtoFileElement> updateDependencies = update.dependencies(); final Context ctx = new Context(COMPATIBLE_CHANGES); collectContextInfoForRefs(ctx, originalReferences, originalDependencies, true); collectContextInfoForRefs(ctx, updateReferences, updateDependencies, false); compare(ctx, original.rawSchema(), update.rawSchema()); return ctx.getDifferences(); } }
SchemaDiff { public static List<Difference> compare( final ProtobufSchema original, final ProtobufSchema update ) { Map<String, SchemaReference> originalReferences = original.references().stream() .collect(Collectors.toMap(SchemaReference::getName, r -> r)); Map<String, SchemaReference> updateReferences = update.references().stream() .collect(Collectors.toMap(SchemaReference::getName, r -> r)); Map<String, ProtoFileElement> originalDependencies = original.dependencies(); Map<String, ProtoFileElement> updateDependencies = update.dependencies(); final Context ctx = new Context(COMPATIBLE_CHANGES); collectContextInfoForRefs(ctx, originalReferences, originalDependencies, true); collectContextInfoForRefs(ctx, updateReferences, updateDependencies, false); compare(ctx, original.rawSchema(), update.rawSchema()); return ctx.getDifferences(); }  }
SchemaDiff { public static List<Difference> compare( final ProtobufSchema original, final ProtobufSchema update ) { Map<String, SchemaReference> originalReferences = original.references().stream() .collect(Collectors.toMap(SchemaReference::getName, r -> r)); Map<String, SchemaReference> updateReferences = update.references().stream() .collect(Collectors.toMap(SchemaReference::getName, r -> r)); Map<String, ProtoFileElement> originalDependencies = original.dependencies(); Map<String, ProtoFileElement> updateDependencies = update.dependencies(); final Context ctx = new Context(COMPATIBLE_CHANGES); collectContextInfoForRefs(ctx, originalReferences, originalDependencies, true); collectContextInfoForRefs(ctx, updateReferences, updateDependencies, false); compare(ctx, original.rawSchema(), update.rawSchema()); return ctx.getDifferences(); }  static List<Difference> compare(
      final ProtobufSchema original,
      final ProtobufSchema update
  ); static Optional<FieldElement> findField(String name, List<FieldElement> options); static void compareTypeElements(
      final Context ctx, final List<TypeElement> original, final List<TypeElement> update
  ); }
SchemaDiff { public static List<Difference> compare( final ProtobufSchema original, final ProtobufSchema update ) { Map<String, SchemaReference> originalReferences = original.references().stream() .collect(Collectors.toMap(SchemaReference::getName, r -> r)); Map<String, SchemaReference> updateReferences = update.references().stream() .collect(Collectors.toMap(SchemaReference::getName, r -> r)); Map<String, ProtoFileElement> originalDependencies = original.dependencies(); Map<String, ProtoFileElement> updateDependencies = update.dependencies(); final Context ctx = new Context(COMPATIBLE_CHANGES); collectContextInfoForRefs(ctx, originalReferences, originalDependencies, true); collectContextInfoForRefs(ctx, updateReferences, updateDependencies, false); compare(ctx, original.rawSchema(), update.rawSchema()); return ctx.getDifferences(); }  static List<Difference> compare(
      final ProtobufSchema original,
      final ProtobufSchema update
  ); static Optional<FieldElement> findField(String name, List<FieldElement> options); static void compareTypeElements(
      final Context ctx, final List<TypeElement> original, final List<TypeElement> update
  ); static final Set<Difference.Type> COMPATIBLE_CHANGES; }