Interface TestApplication<T extends TestApplication<T>>

All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
TestGateway<T>
All Known Implementing Classes:
TestRestoreApp, TestStandaloneBroker, TestStandaloneGateway

public interface TestApplication<T extends TestApplication<T>> extends AutoCloseable
  • Method Summary

    Modifier and Type
    Method
    Description
    default URI
    actuatorUri(String... paths)
    Returns the address to access the actuators of this node from outside the container network of this node.
    default String
    address(int port)
    Returns the address of this node for the given port.
    default String
    Returns the address of this node for the given port.
    default T
    Convenience method to wait for a probe for a default timeout of 30 seconds.
    default T
    await(TestHealthProbe probe, Duration timeout)
    Blocks and waits until the given health probe succeeds, or the given timeout is reached.
    <V> V
    bean(Class<V> type)
    If the application is started (e.g.
    default void
     
    Returns the default health actuator for this application.
    default String
    Returns the hostname of this node, such that it is visible to hosts from the outside of the Docker network.
    boolean
    Returns true if this node can act as a gateway (e.g.
    boolean
    Returns whether the underlying application is started yet; does not include any probes
    default int
    Returns the actual port for the given logical port.
    default URI
    Returns the address to access the monitoring API of this node from outside the container network of this node.
    Returns this node's unique cluster ID
    default void
    Probes for the given health probe; throws an exception on failure.
    <V> V
    property(String property, Class<V> type, V fallback)
    If the application is started (e.g.
    Convenience method to return the appropriate concrete type
    Starts the node in a blocking fashion.
    Attempts to stop the container gracefully in a blocking fashion.
    default URI
    uri(String scheme, TestZeebePort port, String... paths)
    Returns the address of this node for the given port and scheme as a URI.
    default URI
    Returns the address of this node for the given port and scheme as a URI.
    default T
     
    Configures additional active Spring profiles.
    <V> T
    withBean(String qualifier, V bean, Class<V> type)
    When the underlying application is started, all beans of the given type will resolve to the given value.
    withProperty(String key, Object value)
    Configures Spring via properties.
  • Method Details

    • start

      T start()
      Starts the node in a blocking fashion.
    • stop

      T stop()
      Attempts to stop the container gracefully in a blocking fashion.
    • isStarted

      boolean isStarted()
      Returns whether the underlying application is started yet; does not include any probes
    • close

      default void close()
      Specified by:
      close in interface AutoCloseable
    • self

      T self()
      Convenience method to return the appropriate concrete type
    • withBean

      <V> T withBean(String qualifier, V bean, Class<V> type)
      When the underlying application is started, all beans of the given type will resolve to the given value. The qualifier is useful for cases where more than one beans of the same type are defined with different qualifiers.
      Type Parameters:
      V - the bean type
      Parameters:
      qualifier - the bean name/qualifier
      bean - the object to inject as the bean value
      type - the type to be resolved/autowired
      Returns:
      itself for chaining
    • nodeId

      MemberId nodeId()
      Returns this node's unique cluster ID
    • host

      default String host()
      Returns the hostname of this node, such that it is visible to hosts from the outside of the Docker network.
      Returns:
      the hostname of this node
    • mappedPort

      default int mappedPort(TestZeebePort port)
      Returns the actual port for the given logical port.
    • address

      default String address(int port)
      Returns the address of this node for the given port.
      Parameters:
      port - the target port
      Returns:
      externally accessible address for port
    • address

      default String address(TestZeebePort port)
      Returns the address of this node for the given port.
      Parameters:
      port - the target port
      Returns:
      externally accessible address for port
    • uri

      default URI uri(String scheme, TestZeebePort port, String... paths)
      Returns the address of this node for the given port and scheme as a URI.
      Parameters:
      scheme - the URI scheme, e.g. http, or https
      port - the target port
      Returns:
      externally accessible address for port
    • uri

      default URI uri(String scheme, TestZeebePort port, SequencedCollection<String> paths)
      Returns the address of this node for the given port and scheme as a URI.
      Parameters:
      scheme - the URI scheme, e.g. http, or https
      port - the target port
      Returns:
      externally accessible address for port
    • monitoringUri

      default URI monitoringUri(String... paths)
      Returns the address to access the monitoring API of this node from outside the container network of this node. This method returns a URI which is scheme and context path aware.
      Returns:
      the external monitoring address
    • actuatorUri

      default URI actuatorUri(String... paths)
      Returns the address to access the actuators of this node from outside the container network of this node. This method returns a URI which is scheme and context-path aware, as well as actuator path aware.
      Returns:
      the external actuator address
    • healthActuator

      HealthActuator healthActuator()
      Returns the default health actuator for this application.
    • probe

      default void probe(TestHealthProbe probe)
      Probes for the given health probe; throws an exception on failure.
    • isGateway

      boolean isGateway()
      Returns true if this node can act as a gateway (e.g. broker with embedded gateway)
    • await

      default T await(TestHealthProbe probe, Duration timeout)
      Blocks and waits until the given health probe succeeds, or the given timeout is reached.
      Parameters:
      probe - the type of probe to await
    • await

      default T await(TestHealthProbe probe)
      Convenience method to wait for a probe for a default timeout of 30 seconds.
    • bean

      <V> V bean(Class<V> type)
      If the application is started (e.g. isStarted(), resolves and returns (i.e. auto-wires) the first bean of the given type.
      Type Parameters:
      V - the expected bean type
      Parameters:
      type - the expected bean type
      Returns:
      the bean (if any was resolved), or null
    • property

      <V> V property(String property, Class<V> type, V fallback)
      If the application is started (e.g. isStarted(), resolves and returns the value for this property, or a given fallback if there was none set. If the application is not started, it will look it up only in the property overrides (e.g. withProperty(String, Object).
      Type Parameters:
      V - the expected property type type
      Parameters:
      property - the key identifying this property
      type - the expected type of the property value
      fallback - a default value if the property is not set
      Returns:
      the value of this (if any was resolved), or the fallback value
    • withProperty

      T withProperty(String key, Object value)
      Configures Spring via properties. This does not work with properties that would be applied to injected beans (e.g. via withBean(String, Object, Class)), since there will be property resolution for these beans.
      Parameters:
      key - the property key
      value - the new value
      Returns:
      itself for chaining
    • withAdditionalProfile

      T withAdditionalProfile(String profile)
      Configures additional active Spring profiles.
      Parameters:
      profile - the profile ID
      Returns:
      itself for chaining
    • withAdditionalProfile

      default T withAdditionalProfile(Profile profile)
      See Also: