/** * Return true if we're on an old version */ private MigrationRelationship<EdgeMetadataSerialization> getMigrationRelationShip() { return this.versions.getMigrationRelationship( migrationInfoCache.getVersion( GraphMigrationPlugin.PLUGIN_NAME ) ); }
/** * 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; }
new VersionedMigrationSet<>( relationship1_3, relationship2_3, current ); set.getMigrationRelationship( 0 ); fail( "I should throw an exception" ); MigrationRelationship<TestVersionImpl> migrationRelationship = set.getMigrationRelationship( 1 ); migrationRelationship = set.getMigrationRelationship( 2 ); migrationRelationship = set.getMigrationRelationship( 3 ); set.getMigrationRelationship( 4 ); fail( "I should throw an exception" );
new VersionedMigrationSet<>( relationship1_3, relationship2_3, relationship3_6, relationship4_6, current ); set.getMigrationRelationship( 0 ); fail( "I should throw an exception" ); MigrationRelationship<TestVersionImpl> migrationRelationship = set.getMigrationRelationship( 1 ); migrationRelationship = set.getMigrationRelationship( 2 ); migrationRelationship = set.getMigrationRelationship( 3 ); migrationRelationship = set.getMigrationRelationship( 4 ); migrationRelationship = set.getMigrationRelationship( 5 ); migrationRelationship = set.getMigrationRelationship( 6 ); set.getMigrationRelationship( 7 ); fail( "I should throw an exception" );
/** * Return true if we're on an old version */ private MigrationRelationship<MvccLogEntrySerializationStrategy> getMigrationRelationShip() { return this.versions .getMigrationRelationship( migrationInfoCache.getVersion( CollectionMigrationPlugin.PLUGIN_NAME ) ); } }
/** * 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; }
/** * Given the current system version, return the maximum migration version we can move to * @param currentVersion * @return */ public int getMaxVersion(final int currentVersion){ return getMigrationRelationship( currentVersion ).to.getImplementationVersion(); }
/** * 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; } }
/** * Return true if we're on an old version */ private MigrationRelationship<MvccEntitySerializationStrategy> getMigrationRelationShip() { return this.versions.getMigrationRelationship( migrationInfoCache.getVersion( CollectionMigrationPlugin.PLUGIN_NAME ) ); }
/** * 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; }
/** * Return true if we're on an old version */ private MigrationRelationship<UniqueValueSerializationStrategy> getMigrationRelationShip() { return this.versions .getMigrationRelationship( migrationInfoCache.getVersion( CollectionMigrationPlugin.PLUGIN_NAME ) ); }
@Test( expected = IllegalArgumentException.class ) public void testNoInput() { new VersionedMigrationSet<TestVersionImpl>(); }
allVersions.getMigrationRelationship( currentVersion );
allVersions.getMigrationRelationship( currentVersion );
versions.getMigrationRelationship( startVersion.getVersion() ); versions.getMigrationRelationship( newVersion );