Class WorkflowTestServices

java.lang.Object
io.axoniq.framework.workflow.runtime.test.fixture.WorkflowTestServices

public class WorkflowTestServices extends Object
Aggregates workflow runtime services used by workflow tests.

This type is a small convenience wrapper around AxonConfiguration. It resolves the runtime services that workflow tests commonly need, such as the WorkflowEngine, test event publication helpers, workflow configuration registry, and workflow history repository. It also exposes stepping-mode-only services through Optional, so callers can detect whether the underlying test configuration was started with stepping support.

Since:
5.4.0
Author:
Simon Zambrovski
  • Field Details

  • Method Details

    • from

      public static WorkflowTestServices from(AxonConfiguration configuration)
      Constructs a new WorkflowTestServices from the given AxonConfiguration.
      Parameters:
      configuration - configuration to use
      Returns:
      initialized services
    • from

      public static WorkflowTestServices from(AxonConfiguration configuration, String moduleName)
      Constructs a new WorkflowTestServices from the given AxonConfiguration, using the given moduleName as the name for the WorkflowModule under test.
      Parameters:
      configuration - configuration to use
      moduleName - name of the WorkflowModule under test
      Returns:
      initialized services
    • configuration

      public AxonConfiguration configuration()
      Returns the underlying Axon configuration
      Returns:
      configuration backing these test services
    • workflowEngine

      public WorkflowEngine workflowEngine()
      Returns the workflow engine used by the test runtime
      Returns:
      workflow engine
    • delayedPublisher

      public DelayedPublisher delayedPublisher()
      Returns the delayed event publisher used for integration-style test publication
      Returns:
      delayed publisher
    • eventPublisher

      public TestEventPublisher eventPublisher()
      Returns the test event publisher used to inject events into the workflow runtime
      Returns:
      test event publisher
    • workflowRegistry

      public WorkflowConfigurationRegistry<?> workflowRegistry()
      Returns the workflow configuration registry available to the test runtime
      Returns:
      workflow configuration registry
    • workflowCancellationService

      public WorkflowCancellationService workflowCancellationService()
      Returns the workflow cancellation service available to the test runtime
      Returns:
      workflow cancellation service
    • workflowHistoryRepository

      public WorkflowHistoryRepository workflowHistoryRepository()
      Returns the workflow history repository used by the test runtime
      Returns:
      workflow history repository
    • clock

      public Optional<TestClock> clock()
      Returns the stepping-mode test clock when the configuration provides one
      Returns:
      optional mutable test clock
    • executeStepActionResolver

      public Optional<ManualExecuteStepActionResolver> executeStepActionResolver()
      Returns the manual execute-step action resolver when the configuration provides one
      Returns:
      optional manual execute-step action resolver
    • timeoutScheduler

      public Optional<ManualWorkflowScheduler> timeoutScheduler()
      Returns the manual workflow scheduler when the configuration provides one
      Returns:
      optional manual workflow scheduler
    • shutdown

      public void shutdown()
      Shuts down the workflow test services and clears recorded workflow history