Class MarkUnsupportedSagaTestFixtureCalls

java.lang.Object
org.openrewrite.Recipe
org.axonframework.migration.MarkUnsupportedSagaTestFixtureCalls
All Implemented Interfaces:
Cloneable

public class MarkUnsupportedSagaTestFixtureCalls extends org.openrewrite.Recipe
Leaves a // TODO(axon4to5): marker on the Axon Framework 4 SagaTestFixture usage that the fixture ported by axoniq-legacy-test no longer supports, keeping every call in place.

The ported fixture keeps the Axon Framework 4 API where Axon Framework 5 allows it. Where it does not, the test either stops compiling or fails at run time, and what to do instead depends on what the test meant to verify, so the recipe marks the statement and leaves the decision to the developer:

  • withTransienceCheckDisabled() is a deprecated-for-removal no-op: Sagas get no field injection, so there is no transience check to disable;
  • expectScheduledEvent*, expectNoScheduledEvent* and expectNoScheduledEvents() throw an UnsupportedOperationException, because the event scheduler is not ported;
  • registerCommandGateway(..) and registerListenerInvocationErrorHandler(..) are removed, as Axon Framework 5 has neither a gateway factory nor a listener invocation error handler;
  • a variable declared as the Saga FixtureConfiguration cannot be stopped, while the ported fixture runs a started configuration that must be stopped after each test;
  • givenAPublished, andThenAPublished, whenPublishingA and publishes take metadata as a Map<String, String> instead of a Map<String, ?>, so passing a variable declared with other values, such as a Map<String, Object>, no longer compiles.
registerResourceInjector(..) is not handled here: MarkSagaResourceInjection marks it. The marker goes on the enclosing statement, so a call inside a multi-line fixture chain is flagged above the chain. Java sources only. Idempotent.
Since:
5.4.0
Author:
Mateusz Nowak
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.openrewrite.Recipe

    org.openrewrite.Recipe.Builder, org.openrewrite.Recipe.DelegatingRecipe
  • Field Summary

    Fields inherited from class org.openrewrite.Recipe

    contributors, examples, PANIC
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
    org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext>
     

    Methods inherited from class org.openrewrite.Recipe

    addDataTable, aggregateDataTableDescriptors, builder, buildRecipeList, causesAnotherCycle, clone, createRecipeDescriptor, equals, getContributors, getDataTableDescriptors, getDescriptor, getEstimatedEffortPerOccurrence, getExamples, getInstanceName, getInstanceNameSuffix, getJacksonPolymorphicTypeTag, getMaintainers, getName, getRecipeList, getTags, hashCode, maxCycles, noop, onComplete, run, run, run, setContributors, setExamples, validate, validate, validateAll, validateAll, withOptions

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MarkUnsupportedSagaTestFixtureCalls

      public MarkUnsupportedSagaTestFixtureCalls()
  • Method Details

    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in class org.openrewrite.Recipe
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in class org.openrewrite.Recipe
    • getVisitor

      public org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> getVisitor()
      Overrides:
      getVisitor in class org.openrewrite.Recipe