Interface ZeebeTestEngine


public interface ZeebeTestEngine
The engine used to execute processes. This engine is a stripped down version of the actual Zeebe Engine. It's intended for testing purposes only.
  • Method Details

    • start

      void start()
      Starts the test engine
    • stop

      void stop()
      Stops the test engine
    • getRecordStreamSource

      RecordStreamSource getRecordStreamSource()
      Returns:
      the RecordStreamSource of this test engine
    • createClient

      io.camunda.zeebe.client.ZeebeClient createClient()
      Returns:
      a newly created ZeebeClient
    • createClient

      io.camunda.zeebe.client.ZeebeClient createClient(com.fasterxml.jackson.databind.ObjectMapper customObjectMapper)
      Returns:
      a newly created ZeebeClient with custom mapper
    • getGatewayAddress

      String getGatewayAddress()
      Returns:
      the address at which the gateway is reachable
    • increaseTime

      void increaseTime(Duration timeToAdd)
      Increases the time of the test engine. Increasing the time can be useful for triggering timers with a date in the future.
      Parameters:
      timeToAdd - the amount of time to increase the engine with
    • waitForIdleState

      void waitForIdleState(Duration timeout) throws InterruptedException, TimeoutException
      The engine is in an idle state when there is nothing left to do for it. In this state, the engine is waiting for an external command sent by a client, or for an event to trigger. For example, when a timer expires the engine may need to continue orchestrating some process instance(s).

      On a technical level, idle state is defined by

      • The point in time when all current records in the commit log have been processed by the engine
      • This is insufficient, however, because the engine might still be in the process of writing follow-up records
      • Therefore, when the first idle state is detected, a grace period (30ms) starts. If no new records come in during that grace period, then at the end of the grace period callbacks are notified
      Parameters:
      timeout - the maximum amount of time to wait before idle state has been reached
      Throws:
      InterruptedException - if the current thread was interrupted while waiting
      TimeoutException - if the engine has not reached an idle state before the timeout
    • waitForBusyState

      void waitForBusyState(Duration timeout) throws InterruptedException, TimeoutException
      Waits for the engine to reach a busy state. We consider the engine to be in a busy state when new records are being processed since we started waiting.
      Parameters:
      timeout - the maximum amount of time to wait before busy state has been reached
      Throws:
      InterruptedException - if the current thread was interrupted while waiting
      TimeoutException - if the engine has not reached a busy state before the timeout