@Test public void changeFormerIndexVersion() { RecordMetaDataBuilder metaData1Builder = RecordMetaData.newBuilder().setRecords(TestRecords1Proto.getDescriptor()); metaData1Builder.removeIndex("MySimpleRecord$str_value_indexed"); RecordMetaData metaData1 = metaData1Builder.getRecordMetaData(); RecordMetaDataProto.MetaData.Builder metaData2ProtoBuilder = metaData1.toProto() .toBuilder() .setVersion(metaData1.getVersion() + 1); metaData2ProtoBuilder.setFormerIndexes(0, metaData2ProtoBuilder.getFormerIndexesBuilder(0).setRemovedVersion(metaData1.getVersion() + 1)); RecordMetaData metaData2 = RecordMetaData.build(metaData2ProtoBuilder.build()); assertInvalid("removed version of former index differs from prior version", metaData1, metaData2); metaData2ProtoBuilder.setFormerIndexes(0, metaData2ProtoBuilder.getFormerIndexesBuilder(0).setRemovedVersion(metaData1.getVersion()).setAddedVersion(metaData1.getVersion() - 2)); metaData2 = RecordMetaData.build(metaData2ProtoBuilder.build()); assertInvalid("added version of former index differs from prior version", metaData1, metaData2); metaData2ProtoBuilder.setFormerIndexes(0, metaData2ProtoBuilder.getFormerIndexesBuilder(0).clearAddedVersion()); metaData2 = RecordMetaData.build(metaData2ProtoBuilder.build()); assertInvalid("added version of former index differs from prior version", 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();  }