@Test public void testShutdownActivityNotRunning() throws Exception { tryActivityStateAction(new ActivityAction() { @Override public void doit(String activityUuid) { liveActivityRuntime.shutdownLiveActivity(activityUuid); } }, ActivityState.READY, ActivityState.READY); }
@Override public void shutdownLiveActivity(final String uuid) { try { LiveActivityRunner liveActivityRunner = getLiveActivityRunnerByUuid(uuid, false); if (liveActivityRunner != null) { getSpaceEnvironment().getExtendedLog().formatInfo("Shutting down activity: %s", liveActivityRunner.getDisplayName()); attemptActivityShutdown(liveActivityRunner); } else { InstalledLiveActivity liveActivity = liveActivityRepository.getInstalledLiveActivityByUuid(uuid); if (liveActivity != null) { getSpaceEnvironment().getExtendedLog().formatInfo("Shutting down activity (wasn't running): %s", liveActivity.getDisplayName()); publishActivityStatus(uuid, LiveActivityRunner.INITIAL_ACTIVITY_STATUS); } else { getSpaceEnvironment().getExtendedLog() .formatError("Startup of live activity failed, does not exist on controller: %s", uuid); ActivityStatus status = new ActivityStatus(ActivityState.DOESNT_EXIST, "Activity does not exist"); publishActivityStatus(uuid, status); } } } catch (Throwable e) { getSpaceEnvironment().getExtendedLog().formatError(e, "Error during shutdown of live activity: %s", uuid); ActivityStatus status = new ActivityStatus(ActivityState.SHUTDOWN_FAILURE, e.getMessage()); publishActivityStatus(uuid, status); } }
StandardLiveActivityRuntime extends BaseActivityRuntime implements LiveActivityRuntime, LiveActivityRunnerListener { @Override public void shutdownLiveActivity(final String uuid) { try { LiveActivityRunner liveActivityRunner = getLiveActivityRunnerByUuid(uuid, false); if (liveActivityRunner != null) { getSpaceEnvironment().getExtendedLog().formatInfo("Shutting down activity: %s", liveActivityRunner.getDisplayName()); attemptActivityShutdown(liveActivityRunner); } else { InstalledLiveActivity liveActivity = liveActivityRepository.getInstalledLiveActivityByUuid(uuid); if (liveActivity != null) { getSpaceEnvironment().getExtendedLog().formatInfo("Shutting down activity (wasn't running): %s", liveActivity.getDisplayName()); publishActivityStatus(uuid, LiveActivityRunner.INITIAL_ACTIVITY_STATUS); } else { getSpaceEnvironment().getExtendedLog() .formatError("Startup of live activity failed, does not exist on controller: %s", uuid); ActivityStatus status = new ActivityStatus(ActivityState.DOESNT_EXIST, "Activity does not exist"); publishActivityStatus(uuid, status); } } } catch (Throwable e) { getSpaceEnvironment().getExtendedLog().formatError(e, "Error during shutdown of live activity: %s", uuid); ActivityStatus status = new ActivityStatus(ActivityState.SHUTDOWN_FAILURE, e.getMessage()); publishActivityStatus(uuid, status); } } }
StandardLiveActivityRuntime extends BaseActivityRuntime implements LiveActivityRuntime, LiveActivityRunnerListener { @Override public void shutdownLiveActivity(final String uuid) { try { LiveActivityRunner liveActivityRunner = getLiveActivityRunnerByUuid(uuid, false); if (liveActivityRunner != null) { getSpaceEnvironment().getExtendedLog().formatInfo("Shutting down activity: %s", liveActivityRunner.getDisplayName()); attemptActivityShutdown(liveActivityRunner); } else { InstalledLiveActivity liveActivity = liveActivityRepository.getInstalledLiveActivityByUuid(uuid); if (liveActivity != null) { getSpaceEnvironment().getExtendedLog().formatInfo("Shutting down activity (wasn't running): %s", liveActivity.getDisplayName()); publishActivityStatus(uuid, LiveActivityRunner.INITIAL_ACTIVITY_STATUS); } else { getSpaceEnvironment().getExtendedLog() .formatError("Startup of live activity failed, does not exist on controller: %s", uuid); ActivityStatus status = new ActivityStatus(ActivityState.DOESNT_EXIST, "Activity does not exist"); publishActivityStatus(uuid, status); } } } catch (Throwable e) { getSpaceEnvironment().getExtendedLog().formatError(e, "Error during shutdown of live activity: %s", uuid); ActivityStatus status = new ActivityStatus(ActivityState.SHUTDOWN_FAILURE, e.getMessage()); publishActivityStatus(uuid, status); } } StandardLiveActivityRuntime(LiveActivityRuntimeComponentFactory liveActivityRuntimeComponentFactory,
      LocalLiveActivityRepository liveActivityRepository, ActivityInstallationManager activityInstallationManager,
      LiveActivityLogFactory activityLogFactory, LiveActivityConfigurationManager configurationManager,
      LiveActivityStorageManager activityStorageManager, AlertStatusManager alertStatusManager,
      SequentialEventQueue eventQueue, RemoteLiveActivityRuntimeMonitorService runtimeDebugService,
      InteractiveSpacesEnvironment spaceEnvironment); }
StandardLiveActivityRuntime extends BaseActivityRuntime implements LiveActivityRuntime, LiveActivityRunnerListener { @Override public void shutdownLiveActivity(final String uuid) { try { LiveActivityRunner liveActivityRunner = getLiveActivityRunnerByUuid(uuid, false); if (liveActivityRunner != null) { getSpaceEnvironment().getExtendedLog().formatInfo("Shutting down activity: %s", liveActivityRunner.getDisplayName()); attemptActivityShutdown(liveActivityRunner); } else { InstalledLiveActivity liveActivity = liveActivityRepository.getInstalledLiveActivityByUuid(uuid); if (liveActivity != null) { getSpaceEnvironment().getExtendedLog().formatInfo("Shutting down activity (wasn't running): %s", liveActivity.getDisplayName()); publishActivityStatus(uuid, LiveActivityRunner.INITIAL_ACTIVITY_STATUS); } else { getSpaceEnvironment().getExtendedLog() .formatError("Startup of live activity failed, does not exist on controller: %s", uuid); ActivityStatus status = new ActivityStatus(ActivityState.DOESNT_EXIST, "Activity does not exist"); publishActivityStatus(uuid, status); } } } catch (Throwable e) { getSpaceEnvironment().getExtendedLog().formatError(e, "Error during shutdown of live activity: %s", uuid); ActivityStatus status = new ActivityStatus(ActivityState.SHUTDOWN_FAILURE, e.getMessage()); publishActivityStatus(uuid, status); } } StandardLiveActivityRuntime(LiveActivityRuntimeComponentFactory liveActivityRuntimeComponentFactory,
      LocalLiveActivityRepository liveActivityRepository, ActivityInstallationManager activityInstallationManager,
      LiveActivityLogFactory activityLogFactory, LiveActivityConfigurationManager configurationManager,
      LiveActivityStorageManager activityStorageManager, AlertStatusManager alertStatusManager,
      SequentialEventQueue eventQueue, RemoteLiveActivityRuntimeMonitorService runtimeDebugService,
      InteractiveSpacesEnvironment spaceEnvironment); @Override void addRuntimeListener(LiveActivityRuntimeListener listener); @Override void removeRuntimeListener(LiveActivityRuntimeListener listener); @Override void startup(); @Override void shutdown(); @Override void startupAllActivities(); @Override void shutdownAllActivities(); @Override List<InstalledLiveActivity> getAllInstalledLiveActivities(); @Override void startupLiveActivity(String uuid); @Override void shutdownLiveActivity(final String uuid); @Override void statusLiveActivity(String uuid); @Override void activateLiveActivity(String uuid); @Override void deactivateLiveActivity(String uuid); @Override void configureLiveActivity(String uuid, Map<String, String> configuration); @Override void cleanLiveActivityTmpData(String uuid); @Override void cleanLiveActivityPermanentData(String uuid); @Override void initializeActivityInstance(InstalledLiveActivity installedActivity,
      ActivityFilesystem activityFilesystem, Activity instance, Configuration configuration, Log activityLog,
      ActivityExecutionContext executionContext); @Override void onNoInstanceActivityStatusEvent(LiveActivityRunner liveActivityRunner); @Override Log getActivityLog(InstalledLiveActivity installedActivity, Configuration configuration,
      ActivityFilesystem activityFilesystem); @Override void releaseActivityLog(Log activityLog); @Override LiveActivityRunner getLiveActivityRunnerByUuid(String uuid); @Override boolean hasLiveActivitiesRunning(); @Override boolean isLiveActivityRunning(String uuid); Collection<LiveActivityRunner> getAllActiveActivities(); @Override void setLiveActivityStatusPublisher(LiveActivityStatusPublisher liveActivityStatusPublisher); @Override LiveActivityRunnerFactory getLiveActivityRunnerFactory(); @Override LiveActivityStorageManager getLiveActivityStorageManager(); }
StandardLiveActivityRuntime extends BaseActivityRuntime implements LiveActivityRuntime, LiveActivityRunnerListener { @Override public void shutdownLiveActivity(final String uuid) { try { LiveActivityRunner liveActivityRunner = getLiveActivityRunnerByUuid(uuid, false); if (liveActivityRunner != null) { getSpaceEnvironment().getExtendedLog().formatInfo("Shutting down activity: %s", liveActivityRunner.getDisplayName()); attemptActivityShutdown(liveActivityRunner); } else { InstalledLiveActivity liveActivity = liveActivityRepository.getInstalledLiveActivityByUuid(uuid); if (liveActivity != null) { getSpaceEnvironment().getExtendedLog().formatInfo("Shutting down activity (wasn't running): %s", liveActivity.getDisplayName()); publishActivityStatus(uuid, LiveActivityRunner.INITIAL_ACTIVITY_STATUS); } else { getSpaceEnvironment().getExtendedLog() .formatError("Startup of live activity failed, does not exist on controller: %s", uuid); ActivityStatus status = new ActivityStatus(ActivityState.DOESNT_EXIST, "Activity does not exist"); publishActivityStatus(uuid, status); } } } catch (Throwable e) { getSpaceEnvironment().getExtendedLog().formatError(e, "Error during shutdown of live activity: %s", uuid); ActivityStatus status = new ActivityStatus(ActivityState.SHUTDOWN_FAILURE, e.getMessage()); publishActivityStatus(uuid, status); } } StandardLiveActivityRuntime(LiveActivityRuntimeComponentFactory liveActivityRuntimeComponentFactory,
      LocalLiveActivityRepository liveActivityRepository, ActivityInstallationManager activityInstallationManager,
      LiveActivityLogFactory activityLogFactory, LiveActivityConfigurationManager configurationManager,
      LiveActivityStorageManager activityStorageManager, AlertStatusManager alertStatusManager,
      SequentialEventQueue eventQueue, RemoteLiveActivityRuntimeMonitorService runtimeDebugService,
      InteractiveSpacesEnvironment spaceEnvironment); @Override void addRuntimeListener(LiveActivityRuntimeListener listener); @Override void removeRuntimeListener(LiveActivityRuntimeListener listener); @Override void startup(); @Override void shutdown(); @Override void startupAllActivities(); @Override void shutdownAllActivities(); @Override List<InstalledLiveActivity> getAllInstalledLiveActivities(); @Override void startupLiveActivity(String uuid); @Override void shutdownLiveActivity(final String uuid); @Override void statusLiveActivity(String uuid); @Override void activateLiveActivity(String uuid); @Override void deactivateLiveActivity(String uuid); @Override void configureLiveActivity(String uuid, Map<String, String> configuration); @Override void cleanLiveActivityTmpData(String uuid); @Override void cleanLiveActivityPermanentData(String uuid); @Override void initializeActivityInstance(InstalledLiveActivity installedActivity,
      ActivityFilesystem activityFilesystem, Activity instance, Configuration configuration, Log activityLog,
      ActivityExecutionContext executionContext); @Override void onNoInstanceActivityStatusEvent(LiveActivityRunner liveActivityRunner); @Override Log getActivityLog(InstalledLiveActivity installedActivity, Configuration configuration,
      ActivityFilesystem activityFilesystem); @Override void releaseActivityLog(Log activityLog); @Override LiveActivityRunner getLiveActivityRunnerByUuid(String uuid); @Override boolean hasLiveActivitiesRunning(); @Override boolean isLiveActivityRunning(String uuid); Collection<LiveActivityRunner> getAllActiveActivities(); @Override void setLiveActivityStatusPublisher(LiveActivityStatusPublisher liveActivityStatusPublisher); @Override LiveActivityRunnerFactory getLiveActivityRunnerFactory(); @Override LiveActivityStorageManager getLiveActivityStorageManager();  }