@Test public void newIndexFromThePast() { RecordMetaData metaData1 = RecordMetaData.build(TestRecords1Proto.getDescriptor()); Index newIndex = new Index("newIndex", Key.Expressions.field("num_value_2")); newIndex.setAddedVersion(metaData1.getVersion() - 1); newIndex.setLastModifiedVersion(metaData1.getVersion() - 1); RecordMetaDataBuilder metaData2Builder = RecordMetaData.newBuilder().setRecords(TestRecords1Proto.getDescriptor()); metaData2Builder.addIndex(metaData2Builder.getRecordType("MySimpleRecord"), newIndex); metaData2Builder.setVersion(metaData1.getVersion() + 1); RecordMetaData metaData2 = metaData2Builder.getRecordMetaData(); assertInvalid("new index has version that is not newer than the old meta-data version", metaData1, metaData2); RecordMetaDataBuilder metaData3Builder = RecordMetaData.newBuilder().setRecords(TestRecords1Proto.getDescriptor()); newIndex.setAddedVersion(metaData1.getVersion()); metaData3Builder.addIndex(metaData2Builder.getRecordType("MySimpleRecord"), newIndex); metaData2Builder.setVersion(metaData1.getVersion() + 1); RecordMetaData metaData3 = metaData2.getRecordMetaData(); assertInvalid("new index has version that is not newer than the old meta-data version", metaData1, metaData3); }
@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();  }