Package io.camunda.zeebe.qa.util.cluster
Interface TestApplication<T extends TestApplication<T>>
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
TestGateway<T>
- All Known Implementing Classes:
TestRestoreApp,TestStandaloneBroker,TestStandaloneGateway
-
Method Summary
Modifier and TypeMethodDescriptiondefault URIactuatorUri(String... paths) Returns the address to access the actuators of this node from outside the container network of this node.default Stringaddress(int port) Returns the address of this node for the given port.default Stringaddress(TestZeebePort port) Returns the address of this node for the given port.default Tawait(TestHealthProbe probe) Convenience method to wait for a probe for a default timeout of 30 seconds.default Tawait(TestHealthProbe probe, Duration timeout) Blocks and waits until the given health probe succeeds, or the given timeout is reached.<V> VIf the application is started (e.g.default voidclose()Returns the default health actuator for this application.default Stringhost()Returns the hostname of this node, such that it is visible to hosts from the outside of the Docker network.booleanReturns true if this node can act as a gateway (e.g.booleanReturns whether the underlying application is started yet; does not include any probesdefault intmappedPort(TestZeebePort port) Returns the actual port for the given logical port.default URImonitoringUri(String... paths) Returns the address to access the monitoring API of this node from outside the container network of this node.nodeId()Returns this node's unique cluster IDdefault voidprobe(TestHealthProbe probe) Probes for the given health probe; throws an exception on failure.<V> VIf the application is started (e.g.self()Convenience method to return the appropriate concrete typestart()Starts the node in a blocking fashion.stop()Attempts to stop the container gracefully in a blocking fashion.default URIuri(String scheme, TestZeebePort port, String... paths) Returns the address of this node for the given port and scheme as a URI.default URIuri(String scheme, TestZeebePort port, SequencedCollection<String> paths) Returns the address of this node for the given port and scheme as a URI.default TwithAdditionalProfile(Profile profile) withAdditionalProfile(String profile) Configures additional active Spring profiles.<V> TWhen 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:
closein interfaceAutoCloseable
-
self
T self()Convenience method to return the appropriate concrete type -
withBean
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/qualifierbean- the object to inject as the bean valuetype- the type to be resolved/autowired- Returns:
- itself for chaining
-
nodeId
MemberId nodeId()Returns this node's unique cluster ID -
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
Returns the actual port for the given logical port. -
address
Returns the address of this node for the given port.- Parameters:
port- the target port- Returns:
- externally accessible address for
port
-
address
Returns the address of this node for the given port.- Parameters:
port- the target port- Returns:
- externally accessible address for
port
-
uri
Returns the address of this node for the given port and scheme as a URI.- Parameters:
scheme- the URI scheme, e.g. http, or httpsport- the target port- Returns:
- externally accessible address for
port
-
uri
Returns the address of this node for the given port and scheme as a URI.- Parameters:
scheme- the URI scheme, e.g. http, or httpsport- the target port- Returns:
- externally accessible address for
port
-
monitoringUri
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
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
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
Blocks and waits until the given health probe succeeds, or the given timeout is reached.- Parameters:
probe- the type of probe to await
-
await
Convenience method to wait for a probe for a default timeout of 30 seconds. -
bean
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
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 propertytype- the expected type of the property valuefallback- a default value if the property is not set- Returns:
- the value of this (if any was resolved), or the fallback value
-
withProperty
Configures Spring via properties. This does not work with properties that would be applied to injected beans (e.g. viawithBean(String, Object, Class)), since there will be property resolution for these beans.- Parameters:
key- the property keyvalue- the new value- Returns:
- itself for chaining
-
withAdditionalProfile
Configures additional active Spring profiles.- Parameters:
profile- the profile ID- Returns:
- itself for chaining
-