InstanceFSM { @OnTransit public void onInstanceSnapshotting(@Event InstanceSnapshottingEvent event) { Instance instance = event.getInstance(); if (event.isSync()) { LOG.info("Marking instance {} ({}) as snapshotting", instance.getName(), instance.getId()); instance.setState(InstanceState.SNAPSHOTTING); } instancesAware.saveInstance(instance); } @Autowired  InstanceFSM(OperationProcessor operationProcessor, InstancesAware instancesAware, CloudConfigurationProvider cloudConfigurationProvider, EventBus eventBus, MailSender mailSender); @BeforeTransit void beforeTransit(@Event InstanceEvent instanceEvent); @OnTransit void onInstanceQueued(@Event InstanceQueuedEvent event); @OnTransit void onInstanceLaunching(@Event InstanceLaunchingEvent event); @OnTransit void onInstanceLaunched(@Event InstanceLaunchedEvent event); @OnTransit void onInstanceRebooting(@Event InstanceRebootingEvent event); @OnTransit void onInstanceHardRebooting(@Event InstanceHardRebootingEvent event); @OnTransit void onInstanceShuttingDown(@Event InstanceShuttingDownEvent event); @OnTransit void onInstanceShutoff(@Event InstanceShutOffEvent event); @OnTransit void onInstancePausing(@Event InstancePausingEvent event); @OnTransit void onInstancePaused(@Event InstancePausedEvent event); @OnTransit void onInstanceResuming(@Event InstanceResumingEvent event); @OnTransit void onInstanceRebuilding(@Event InstanceRebuildingEvent event); @OnTransit void onInstanceResizing(@Event InstanceResizingEvent event); @OnTransit void onInstanceStarting(@Event InstanceStartingEvent event); @OnTransit void onInstanceSuspending(@Event InstanceSuspendingEvent event); @OnTransit void onInstanceSuspended(@Event InstanceSuspendedEvent event); @OnTransit void onInstanceMigrating(@Event InstanceMigratingEvent event); @OnTransit void onInstanceDeleting(@Event InstanceDeletingEvent event); @OnTransit void onInstanceRenaming(@Event InstanceRenamingEvent event); @OnTransit void onInstanceSnapshotting(@Event InstanceSnapshottingEvent event); @OnTransit void onInstanceError(@FromState InstanceEvent from, @Event InstanceErrorEvent event); @OnException void onUnsupportedOperationException(UnsupportedOperationException e);  }
@Test public void testOnInstanceSnapshotting() { testOnInstanceSyncEvent(InstanceSnapshottingEvent.class, SNAPSHOTTING); }