@Test public void addRequiredField() { FileDescriptor updatedFile = mutateFile(fileBuilder -> fileBuilder.getMessageTypeBuilderList().forEach(message -> { if (message.getName().equals("MySimpleRecord")) { message.addField(DescriptorProtos.FieldDescriptorProto.newBuilder() .setLabel(DescriptorProtos.FieldDescriptorProto.Label.LABEL_REQUIRED) .setType(DescriptorProtos.FieldDescriptorProto.Type.TYPE_INT32) .setName("new_int_field") .setNumber(message.getFieldList().stream().mapToInt(DescriptorProtos.FieldDescriptorProto::getNumber).max().getAsInt() + 1) ); } }) ); assertInvalid("required field added to record type", TestRecords1Proto.getDescriptor(), updatedFile); RecordMetaData metaData1 = RecordMetaData.build(TestRecords1Proto.getDescriptor()); RecordMetaData metaData2 = replaceRecordsDescriptor(metaData1, updatedFile); assertInvalid("required field added to record type", metaData1, metaData2); }
@Nonnull public static Builder newBuilder() { return new Builder(DEFAULT_INSTANCE); }
MetaDataEvolutionValidator { @Nonnull public static Builder newBuilder() { return new Builder(DEFAULT_INSTANCE); } }
MetaDataEvolutionValidator { @Nonnull public static Builder newBuilder() { return new Builder(DEFAULT_INSTANCE); } private  MetaDataEvolutionValidator(); private  MetaDataEvolutionValidator(@Nonnull Builder builder); }
MetaDataEvolutionValidator { @Nonnull public static Builder newBuilder() { return new Builder(DEFAULT_INSTANCE); } private  MetaDataEvolutionValidator(); private  MetaDataEvolutionValidator(@Nonnull Builder builder); void validate(@Nonnull RecordMetaData oldMetaData, @Nonnull RecordMetaData newMetaData); @SuppressWarnings("PMD.CompareObjectsWithEquals") void validateUnion(@Nonnull Descriptor oldUnionDescriptor, @Nonnull Descriptor newUnionDescriptor); @Nonnull IndexMaintainerRegistry getIndexMaintainerRegistry(); boolean allowsNoVersionChange(); boolean allowsNoSinceVersion(); boolean allowsIndexRebuilds(); boolean allowsMissingFormerIndexNames(); boolean allowsOlderFormerIndexAddedVersions(); boolean allowsUnsplitToSplit(); boolean disallowsTypeRenames(); @Nonnull Builder asBuilder(); @Nonnull static Builder newBuilder(); @Nonnull static MetaDataEvolutionValidator getDefaultInstance(); }
MetaDataEvolutionValidator { @Nonnull public static Builder newBuilder() { return new Builder(DEFAULT_INSTANCE); } private  MetaDataEvolutionValidator(); private  MetaDataEvolutionValidator(@Nonnull Builder builder); void validate(@Nonnull RecordMetaData oldMetaData, @Nonnull RecordMetaData newMetaData); @SuppressWarnings("PMD.CompareObjectsWithEquals") void validateUnion(@Nonnull Descriptor oldUnionDescriptor, @Nonnull Descriptor newUnionDescriptor); @Nonnull IndexMaintainerRegistry getIndexMaintainerRegistry(); boolean allowsNoVersionChange(); boolean allowsNoSinceVersion(); boolean allowsIndexRebuilds(); boolean allowsMissingFormerIndexNames(); boolean allowsOlderFormerIndexAddedVersions(); boolean allowsUnsplitToSplit(); boolean disallowsTypeRenames(); @Nonnull Builder asBuilder(); @Nonnull static Builder newBuilder(); @Nonnull static MetaDataEvolutionValidator getDefaultInstance();  }