use of org.flywaydb.core.api.callback.Context in project spring-boot by spring-projects.
the class Flyway6xAutoConfigurationTests method callbacksAreConfiguredAndOrdered.
@Test
void callbacksAreConfiguredAndOrdered() {
this.contextRunner.withUserConfiguration(DataSourceAutoConfiguration.class, CallbackConfiguration.class).run((context) -> {
assertThat(context).hasSingleBean(Flyway.class);
Flyway flyway = context.getBean(Flyway.class);
Callback callbackOne = context.getBean("callbackOne", Callback.class);
Callback callbackTwo = context.getBean("callbackTwo", Callback.class);
assertThat(flyway.getConfiguration().getCallbacks()).hasSize(2);
assertThat(flyway.getConfiguration().getCallbacks()).containsExactly(callbackTwo, callbackOne);
InOrder orderedCallbacks = inOrder(callbackOne, callbackTwo);
orderedCallbacks.verify(callbackTwo).handle(any(Event.class), any(Context.class));
orderedCallbacks.verify(callbackOne).handle(any(Event.class), any(Context.class));
});
}
use of org.flywaydb.core.api.callback.Context in project spring-boot by spring-projects.
the class FlywayAutoConfigurationTests method callbacksAreConfiguredAndOrderedByName.
@Test
void callbacksAreConfiguredAndOrderedByName() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class, CallbackConfiguration.class).run((context) -> {
assertThat(context).hasSingleBean(Flyway.class);
Flyway flyway = context.getBean(Flyway.class);
Callback callbackOne = context.getBean("callbackOne", Callback.class);
Callback callbackTwo = context.getBean("callbackTwo", Callback.class);
assertThat(flyway.getConfiguration().getCallbacks()).hasSize(2);
InOrder orderedCallbacks = inOrder(callbackOne, callbackTwo);
orderedCallbacks.verify(callbackTwo).handle(any(Event.class), any(Context.class));
orderedCallbacks.verify(callbackOne).handle(any(Event.class), any(Context.class));
});
}
use of org.flywaydb.core.api.callback.Context in project spring-boot by spring-projects.
the class Flyway7xAutoConfigurationTests method callbacksAreConfigured.
@Test
void callbacksAreConfigured() {
this.contextRunner.withUserConfiguration(DataSourceAutoConfiguration.class, CallbackConfiguration.class).run((context) -> {
assertThat(context).hasSingleBean(Flyway.class);
Flyway flyway = context.getBean(Flyway.class);
Callback callbackOne = context.getBean("callbackOne", Callback.class);
Callback callbackTwo = context.getBean("callbackTwo", Callback.class);
assertThat(flyway.getConfiguration().getCallbacks()).hasSize(2);
assertThat(flyway.getConfiguration().getCallbacks()).containsExactlyInAnyOrder(callbackTwo, callbackOne);
then(callbackOne).should(atLeastOnce()).handle(any(Event.class), any(Context.class));
then(callbackTwo).should(atLeastOnce()).handle(any(Event.class), any(Context.class));
});
}
Aggregations