Class ContainerEngines
ContainerEngine instances based on either containers
(ZeebeContainer) or clusters (ZeebeCluster).
In each case, you can configure a grace period for which to wait for events. This may help you
deal with asynchronicity in your tests in a more succinct way. For example, instead of wrapping
an assertion in an `Awaitility` block, you could configure a grace period of 10 seconds and use
BpmnAssert as you normally would. When the
assertion reaches the end of its stream, it will wait up to the grace period for new events
before giving up. This means, in our example, it would wait up to 10 seconds for new events. Once
a new event comes in during the grace period, that period is reset.
There are some differences with the normal ZeebeTestEngine implementations from the
zeebe-process-test project, notably in how we wait for idle/busy states. As there are no external
ways to do so with a real Zeebe engine, we define these states as:
- idle: no records were exported for at least 1 second since the call
- busy: a new record was exported within the timeout since the call
-
Method Summary
Modifier and TypeMethodDescriptionstatic ContainerEngineof()Returns a container engine pointing to a defaultZeebeContainer, with a non-delayed record stream.static ContainerEngineof(ZeebeCluster cluster) Returns a container engine pointing to a configuredZeebeCluster, with a non-delayed record stream.static ContainerEngineof(ZeebeContainer container) Returns a container engine pointing to the providedZeebeContainer, with a non-delayed record stream.static ContainerEngineReturns a container engine pointing to a defaultZeebeContainer.static ContainerEngineof(Duration timeout, ZeebeCluster cluster) Returns a container engine pointing to a configuredZeebeCluster.static ContainerEngineof(Duration timeout, ZeebeContainer container) Returns a container engine pointing to a configuredZeebeContainer.
-
Method Details
-
of
Returns a container engine pointing to a defaultZeebeContainer, with a non-delayed record stream.If you wish to customize the container, consider declaring it separately and using
of(ZeebeContainer).- Returns:
- a single-container engine
-
of
Returns a container engine pointing to a defaultZeebeContainer. When the underlying record stream reaches the end, it will wait up to at mosttimeoutduration for new events. If a new event comes in within that grace period, the timeout is reset.You can use this to succinctly deal with asynchronicity in your tests, instead of wrapping with Awaitility.
If you wish to customize the container, consider declaring it separately and using
of(Duration, ZeebeContainer).- Parameters:
timeout- the grace period to wait for new exported events- Returns:
- a single-container engine with a grace period
-
of
Returns a container engine pointing to the providedZeebeContainer, with a non-delayed record stream.- Returns:
- a single-container engine
-
of
Returns a container engine pointing to a configuredZeebeContainer. When the underlying record stream reaches the end, it will wait up to at mosttimeoutduration for new events. If a new event comes in within that grace period, the timeout is reset.You can use this to succinctly deal with asynchronicity in your tests, instead of wrapping with Awaitility.
- Parameters:
timeout- the grace period to wait for new exported events- Returns:
- a single-container engine with a grace period
-
of
Returns a container engine pointing to a configuredZeebeCluster, with a non-delayed record stream.Records will be streamed from all partition leaders at the same time, so you can run assertions across your whole cluster easily.
When manipulating the clock through the
ZeebeTestEngineinterface, it will manipulate the clock of all brokers at the same time.When obtaining a gateway, it will return a random available healthy gateway.
- Returns:
- a single-container engine
-
of
Returns a container engine pointing to a configuredZeebeCluster. When the underlying record stream reaches the end, it will wait up to at mosttimeoutduration for new events. If a new event comes in within that grace period, the timeout is reset.You can use this to succinctly deal with asynchronicity in your tests, instead of wrapping with Awaitility.
Records will be streamed from all partition leaders at the same time, so you can run assertions across your whole cluster easily.
When manipulating the clock through the
ZeebeTestEngineinterface, it will manipulate the clock of all brokers at the same time.When obtaining a gateway, it will return a random available healthy gateway.
- Parameters:
timeout- the grace period to wait for new exported events- Returns:
- a single-container engine with a grace period
-