Interface GeneratorStrategy

All Known Implementing Classes:
BoundaryEventStrategy, BoundaryJobStrategy, CallActivityStrategy, DefaultHandlerStrategy, DefaultStrategy, EventStrategy, ExternalTaskStrategy, JobStrategy, MultiInstanceScopeStrategy, MultiInstanceStrategy, UserTaskStrategy

public interface GeneratorStrategy
Strategy, used per activity when generating a test case.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addHandlerField(com.squareup.javapoet.TypeSpec.Builder classBuilder)
    Adds a handler field to the class, if the activity is handled by a handler - e.g.:
    void
    addHandlerFieldAfter(com.squareup.javapoet.TypeSpec.Builder classBuilder)
    Adds a JobHandler field to the class, if an asynchronous continuation is configured after the activity - e.g.:
    void
    addHandlerFieldBefore(com.squareup.javapoet.TypeSpec.Builder classBuilder)
    Adds a JobHandler field to the class, if an asynchronous continuation is configured before the activity - e.g.:
    void
    addHandlerMethod(com.squareup.javapoet.TypeSpec.Builder classBuilder)
    Adds a "handle" method to the class, if the activity is handled by a handler - e.g.:
    void
    addHandlerMethodAfter(com.squareup.javapoet.TypeSpec.Builder classBuilder)
    Adds a method to the class, which provides a JobHandler, if an asynchronous continuation is configured after the activity - e.g.:
    void
    addHandlerMethodBefore(com.squareup.javapoet.TypeSpec.Builder classBuilder)
    Adds a method to the class, which provides a JobHandler, if an asynchronous continuation is configured before the activity - e.g.:
    void
    applyHandler(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
    Adds code to the execute/apply method, if the activity is handled by a handler and a wait state - e.g.:
    void
    applyHandlerAfter(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
    Adds code to the execute/apply method, if an asynchronous continuation is configured after the activity - e.g.:
    void
    applyHandlerBefore(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
    Adds code to the execute/apply method, if an asynchronous continuation is configured before the activity - e.g.:
    Returns the underlying activity.
    com.squareup.javapoet.CodeBlock
    Returns code for getting a handler field reference.
    com.squareup.javapoet.CodeBlock
    Returns code for getting an after handler field reference.
    com.squareup.javapoet.CodeBlock
    Returns code for getting a before handler field reference.
    com.squareup.javapoet.TypeName
    Returns the type name of the related handler or Void, if the activity is not handled by a specific handler.
    Gets the ID of the underlying activity as a literal.
    void
    hasPassed(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
    Adds code, which asserts that the process instance has passed an activity.
    void
    initHandler(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
    Adds code, which initializes a handler field.
    void
    initHandlerAfter(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
    Adds code, which initializes an after handler field.
    com.squareup.javapoet.CodeBlock
    Returns the statement that initializes the after handler.
    void
    initHandlerBefore(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
    Adds code, which initializes a before handler field.
    com.squareup.javapoet.CodeBlock
    Returns the statement that initializes the before handler.
    com.squareup.javapoet.CodeBlock
    Returns the statement that initializes the handler.
    void
    isWaitingAt(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
    Adds code, which asserts that the process instance is waiting at an activity.
    void
    setMultiInstanceParent(boolean multiInstanceParent)
    Set the multi instance parent indicator.
    boolean
    Determines if an asynchronous continuation after the activity should be handled or not.
    boolean
    Determines if an asynchronous continuation before the activity should be handled or not.
  • Method Details

    • addHandlerField

      void addHandlerField(com.squareup.javapoet.TypeSpec.Builder classBuilder)
      Adds a handler field to the class, if the activity is handled by a handler - e.g.:
       private UserTaskHandler approveUserTask;
       

      Otherwise, no field is added.

      Parameters:
      classBuilder - The class builder to use.
    • addHandlerFieldAfter

      void addHandlerFieldAfter(com.squareup.javapoet.TypeSpec.Builder classBuilder)
      Adds a JobHandler field to the class, if an asynchronous continuation is configured after the activity - e.g.:
       private JobHandler sendMailServiceTaskAfter;
       
      Parameters:
      classBuilder - The class builder to use.
    • addHandlerFieldBefore

      void addHandlerFieldBefore(com.squareup.javapoet.TypeSpec.Builder classBuilder)
      Adds a JobHandler field to the class, if an asynchronous continuation is configured before the activity - e.g.:
       private JobHandler sendMailServiceTaskBefore;
       
      Parameters:
      classBuilder - The class builder to use.
    • addHandlerMethod

      void addHandlerMethod(com.squareup.javapoet.TypeSpec.Builder classBuilder)
      Adds a "handle" method to the class, if the activity is handled by a handler - e.g.:
       public UserTaskHandler handleApproveUserTask() {
         return approveUserTask;
       }
       

      Otherwise, no field is added.

      Parameters:
      classBuilder - The class builder to use.
    • addHandlerMethodAfter

      void addHandlerMethodAfter(com.squareup.javapoet.TypeSpec.Builder classBuilder)
      Adds a method to the class, which provides a JobHandler, if an asynchronous continuation is configured after the activity - e.g.:
       public JobHandler handleSendMailServiceTaskAfter() {
         return sendMailServiceTaskAfter;
       }
       
      Parameters:
      classBuilder - The class builder to use.
    • addHandlerMethodBefore

      void addHandlerMethodBefore(com.squareup.javapoet.TypeSpec.Builder classBuilder)
      Adds a method to the class, which provides a JobHandler, if an asynchronous continuation is configured before the activity - e.g.:
       public JobHandler handleSendMailServiceTaskBefore() {
         return sendMailServiceTaskBefore;
       }
       
      Parameters:
      classBuilder - The class builder to use.
    • applyHandler

      void applyHandler(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
      Adds code to the execute/apply method, if the activity is handled by a handler and a wait state - e.g.:
       assertThat(pi).isWaitingAt("placeOrderExternalTask");
       instance.apply(placeOrderExternalTask)
       

      or the previous activity is an event based gateway.

      Parameters:
      methodBuilder - The method builder to use.
    • applyHandlerAfter

      void applyHandlerAfter(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
      Adds code to the execute/apply method, if an asynchronous continuation is configured after the activity - e.g.:
       assertThat(pi).isWaitingAt("sendMailServiceTask");
       instance.apply(sendMailServiceTaskAfter)
       
      Parameters:
      methodBuilder - The method builder to use.
    • applyHandlerBefore

      void applyHandlerBefore(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
      Adds code to the execute/apply method, if an asynchronous continuation is configured before the activity - e.g.:
       assertThat(pi).isWaitingAt("sendMailServiceTask");
       instance.apply(sendMailServiceTaskBefore)
       
      Parameters:
      methodBuilder - The method builder to use.
    • getActivity

      TestCaseActivity getActivity()
      Returns the underlying activity.
      Returns:
      The test case activity.
    • getHandler

      com.squareup.javapoet.CodeBlock getHandler()
      Returns code for getting a handler field reference. Normally a handler field is referenced using TestCaseActivity.getId() as literal, but in case of a multi instance scope a specific getHandler method must be called.

      Normally:

       approveUserTask
       

      Multi instance scope:

       getApproveUserTaskHandler(loopIndex)
       
      Returns:
      The handler reference code.
    • getHandlerAfter

      com.squareup.javapoet.CodeBlock getHandlerAfter()
      Returns code for getting an after handler field reference. Normally an after handler field is referenced using TestCaseActivity.getId() as literal + After, but in case of a multi instance scope a specific getHandler method must be called.

      Normally:

       approveUserTaskAfter
       

      Multi instance scope:

       getApproveUserTaskHandlerAfter(loopIndex)
       
      Returns:
      The after handler reference code.
    • getHandlerBefore

      com.squareup.javapoet.CodeBlock getHandlerBefore()
      Returns code for getting a before handler field reference. Normally a before handler field is referenced using TestCaseActivity.getId() as literal + Before, but in case of a multi instance scope a specific getHandler method must be called.

      Normally:

       approveUserTaskBefore
       

      Multi instance scope:

       getApproveUserTaskHandlerBefore(loopIndex)
       
      Returns:
      The before handler reference code.
    • getHandlerType

      com.squareup.javapoet.TypeName getHandlerType()
      Returns the type name of the related handler or Void, if the activity is not handled by a specific handler.
      Returns:
      The handler type name e.g. TypeName.get(UserTaskHandler.class).
    • getLiteral

      String getLiteral()
      Gets the ID of the underlying activity as a literal.
      Returns:
      The activity ID literal.
    • hasPassed

      void hasPassed(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
      Adds code, which asserts that the process instance has passed an activity.
      Parameters:
      methodBuilder - The method builder to use.
    • initHandler

      void initHandler(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
      Adds code, which initializes a handler field.
       approveUserTask = new UserTaskHandler(getProcessEngine(), "approveUserTask");
       
      Parameters:
      methodBuilder - The method builder to use.
      See Also:
    • initHandlerAfter

      void initHandlerAfter(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
      Adds code, which initializes an after handler field.
       approveUserTaskAfter = new JobHandler(getProcessEngine(), "approveUserTask");
       
      Parameters:
      methodBuilder - The method builder to use.
      See Also:
    • initHandlerAfterStatement

      com.squareup.javapoet.CodeBlock initHandlerAfterStatement()
      Returns the statement that initializes the after handler.
       new JobHandler(getProcessEngine(), "approveUserTask");
       
      Returns:
      The code.
    • initHandlerBefore

      void initHandlerBefore(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
      Adds code, which initializes a before handler field.
       approveUserTaskBefore = new JobHandler(getProcessEngine(), "approveUserTask");
       
      Parameters:
      methodBuilder - The method builder to use.
      See Also:
    • initHandlerBeforeStatement

      com.squareup.javapoet.CodeBlock initHandlerBeforeStatement()
      Returns the statement that initializes the before handler.
       new JobHandler(getProcessEngine(), "approveUserTask");
       
      Returns:
      The code.
    • initHandlerStatement

      com.squareup.javapoet.CodeBlock initHandlerStatement()
      Returns the statement that initializes the handler.
       new UserTaskHandler(getProcessEngine(), "approveUserTask");
       
      Returns:
      The code.
    • isWaitingAt

      void isWaitingAt(com.squareup.javapoet.MethodSpec.Builder methodBuilder)
      Adds code, which asserts that the process instance is waiting at an activity.
      Parameters:
      methodBuilder - The method builder to use.
    • setMultiInstanceParent

      void setMultiInstanceParent(boolean multiInstanceParent)
      Set the multi instance parent indicator.
      Parameters:
      multiInstanceParent - true, if the strategy is applied on a multi instance scope handler. Otherwise false.
    • shouldHandleAfter

      boolean shouldHandleAfter()
      Determines if an asynchronous continuation after the activity should be handled or not.
      Returns:
      true, if it should be handled. Otherwise false.
    • shouldHandleBefore

      boolean shouldHandleBefore()
      Determines if an asynchronous continuation before the activity should be handled or not.
      Returns:
      true, if it should be handled. Otherwise false.