@Test public void shouldDoNothingIfDatabaseHasAllMigrations() { mockery.checking( new Expectations() { { one(provider).getAppliedMigrations(); will(returnValue(Arrays.asList("second", "first"))); } }); Migrations migrationsToApply = migrator.getMigrationsToApply(); assertThat(migrationsToApply.size(), is(equalTo(0))); mockery.assertIsSatisfied(); }
@Test public void shouldReturnNonExecutedMigrationsIfThereAreAnyPending() { mockery.checking( new Expectations() { { one(provider).getAppliedMigrations(); will(returnValue(Arrays.asList("first"))); } }); Migrations migrationsToApply = migrator.getMigrationsToApply(); assertThat(migrationsToApply.size(), is(equalTo(1))); assertThat(migrationsToApply.getAll().iterator().next(), is(equalTo(second))); mockery.assertIsSatisfied(); }
public static List<AbstractMigrationRefactoring> forConcept( SNode callConcept, final SNode declarationConcept) { List<AbstractMigrationRefactoring> refactorings = ListSequence.fromList(new ArrayList<AbstractMigrationRefactoring>()); MigrationConfig config = getMigrationConfig(callConcept, declarationConcept); ListSequence.fromList(refactorings) .addSequence(ListSequence.fromList(Migrations.migrateConcept(config))); ListSequence.fromList(refactorings) .addSequence( ListSequence.fromList( SpecialMigrations.migrateSpecializedLinkAccess(config, declarationConcept))); return refactorings; }
public static void main(String... args) throws Exception { Migrations.migrate(); System.out.println("DB Migrated"); new DinoServer().start(); }