/** * Configure via explicit declaration the migration path we can follow * @param v1 * @param v2 * @return */ @Singleton @Inject @Provides public VersionedMigrationSet<EdgeMetadataSerialization> getVersions(final EdgeMetadataSerializationV1Impl v1, final EdgeMetadataSerializationV2Impl v2){ //migrate from v1 to v2 MigrationRelationship<EdgeMetadataSerialization> v1Tov2 = new MigrationRelationship<>( v1, v2); //keep our curent tuple, v2, v2 MigrationRelationship<EdgeMetadataSerialization> current = new MigrationRelationship<EdgeMetadataSerialization>( v2, v2 ); //now create our set of versions VersionedMigrationSet<EdgeMetadataSerialization> set = new VersionedMigrationSet<>( v1Tov2, current ); return set; }
/** * Configure via explicit declaration the migration path we can follow */ @Singleton @Inject @Provides public VersionedMigrationSet<MvccLogEntrySerializationStrategy> getVersions( final MvccLogEntrySerializationStrategyV1Impl v1, final MvccLogEntrySerializationStrategyV2Impl v2) { //we must perform a migration from v1 to v3 in order to maintain consistency MigrationRelationship<MvccLogEntrySerializationStrategy> v1Tov2 = new MigrationRelationship<>( v1, v2 ); //note that we MUST migrate to v3 before our next migration, if v4 and v5 is implemented we will need a // v3->v5 and a v4->v5 set MigrationRelationship<MvccLogEntrySerializationStrategy> current = new MigrationRelationship<>( v2, v2 ); //now create our set of versions VersionedMigrationSet<MvccLogEntrySerializationStrategy> set = new VersionedMigrationSet<>( v1Tov2, current ); return set; }
/** * Configure via explicit declaration the migration path we can follow */ @Singleton @Inject @Provides public VersionedMigrationSet<UniqueValueSerializationStrategy> getVersions( final UniqueValueSerializationStrategyV1Impl v1, final UniqueValueSerializationStrategyV2Impl v2) { //we must perform a migration from v1 to v3 in order to maintain consistency MigrationRelationship<UniqueValueSerializationStrategy> v1Tov2 = new MigrationRelationship<>( v1, v2 ); //note that we MUST migrate to v3 before our next migration, if v4 and v5 is implemented we will need a // v3->v5 and a v4->v5 set MigrationRelationship<UniqueValueSerializationStrategy> current = new MigrationRelationship<>( v2, v2 ); //now create our set of versions VersionedMigrationSet<UniqueValueSerializationStrategy> set = new VersionedMigrationSet<>( v1Tov2, current ); return set; } }
/** * Configure via explicit declaration the migration path we can follow */ @Singleton @Inject @Provides public VersionedMigrationSet<MvccEntitySerializationStrategy> getVersions( final MvccEntitySerializationStrategyV1Impl v1, final MvccEntitySerializationStrategyV2Impl v2, final MvccEntitySerializationStrategyV3Impl v3 ) { //we must perform a migration from v1 to v3 in order to maintain consistency MigrationRelationship<MvccEntitySerializationStrategy> v1Tov3 = new MigrationRelationship<>( v1, v3 ); //we must migrate from 2 to 3, this is a bridge that must happen to maintain data consistency MigrationRelationship<MvccEntitySerializationStrategy> v2Tov3 = new MigrationRelationship<>( v2, v3 ); //note that we MUST migrate to v3 before our next migration, if v4 and v5 is implemented we will need a // v3->v5 and a v4->v5 set MigrationRelationship<MvccEntitySerializationStrategy> current = new MigrationRelationship<>( v3, v3 ); //now create our set of versions VersionedMigrationSet<MvccEntitySerializationStrategy> set = new VersionedMigrationSet<>( v1Tov3, v2Tov3, current ); return set; }
@Test( expected = IllegalArgumentException.class ) public void testNoInput() { new VersionedMigrationSet<TestVersionImpl>(); }
new VersionedMigrationSet<>( relationship1_3, relationship2_3, current );
new VersionedMigrationSet<>( relationship1_3, relationship2_3, relationship3_6, relationship4_6, current );