@Test public void shouldStartAutomaticMigration() { MigrationOnStartupListener listener = new MigrationOnStartupListener( fireflyService, true); listener.onApplicationEvent(new ApplicationStartupEvent()); verify(fireflyService).migrate(); }
@Override public void onApplicationEvent(ApplicationStartupEvent applicationStartupEvent) { if (automaticMigration) { LOG.debug("Starting automatic migration after startup."); fireflyService.migrate(); } else { LOG.debug("Skipping automatic migration. To change this set the parameter 'firefly.migrationOnStartup' to true."); fireflyService.simulate(); } }
MigrationOnStartupListener implements ApplicationListener<ApplicationStartupEvent>, ApplicationContextAware, InitializingBean { @Override public void onApplicationEvent(ApplicationStartupEvent applicationStartupEvent) { if (automaticMigration) { LOG.debug("Starting automatic migration after startup."); fireflyService.migrate(); } else { LOG.debug("Skipping automatic migration. To change this set the parameter 'firefly.migrationOnStartup' to true."); fireflyService.simulate(); } } }
MigrationOnStartupListener implements ApplicationListener<ApplicationStartupEvent>, ApplicationContextAware, InitializingBean { @Override public void onApplicationEvent(ApplicationStartupEvent applicationStartupEvent) { if (automaticMigration) { LOG.debug("Starting automatic migration after startup."); fireflyService.migrate(); } else { LOG.debug("Skipping automatic migration. To change this set the parameter 'firefly.migrationOnStartup' to true."); fireflyService.simulate(); } } @Autowired  MigrationOnStartupListener(FireflyService fireflyService,
                                      @Value("${firefly.migrationOnStartup:false}") boolean automaticMigration); }
MigrationOnStartupListener implements ApplicationListener<ApplicationStartupEvent>, ApplicationContextAware, InitializingBean { @Override public void onApplicationEvent(ApplicationStartupEvent applicationStartupEvent) { if (automaticMigration) { LOG.debug("Starting automatic migration after startup."); fireflyService.migrate(); } else { LOG.debug("Skipping automatic migration. To change this set the parameter 'firefly.migrationOnStartup' to true."); fireflyService.simulate(); } } @Autowired  MigrationOnStartupListener(FireflyService fireflyService,
                                      @Value("${firefly.migrationOnStartup:false}") boolean automaticMigration); @Override void onApplicationEvent(ApplicationStartupEvent applicationStartupEvent); @Override void afterPropertiesSet(); @Override void setApplicationContext(ApplicationContext applicationContext); }
MigrationOnStartupListener implements ApplicationListener<ApplicationStartupEvent>, ApplicationContextAware, InitializingBean { @Override public void onApplicationEvent(ApplicationStartupEvent applicationStartupEvent) { if (automaticMigration) { LOG.debug("Starting automatic migration after startup."); fireflyService.migrate(); } else { LOG.debug("Skipping automatic migration. To change this set the parameter 'firefly.migrationOnStartup' to true."); fireflyService.simulate(); } } @Autowired  MigrationOnStartupListener(FireflyService fireflyService,
                                      @Value("${firefly.migrationOnStartup:false}") boolean automaticMigration); @Override void onApplicationEvent(ApplicationStartupEvent applicationStartupEvent); @Override void afterPropertiesSet(); @Override void setApplicationContext(ApplicationContext applicationContext);  }