Package io.camunda.zeebe.qa.util.cluster
Class TestStandaloneBroker
java.lang.Object
io.camunda.zeebe.qa.util.cluster.TestStandaloneBroker
- All Implemented Interfaces:
TestApplication<TestStandaloneBroker>,TestGateway<TestStandaloneBroker>,AutoCloseable
Represents an instance of the
StandaloneBroker Spring application.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<V> VIf the application is started (e.g.Returns the broker configurationReturns the health actuator for this broker.protected String[]Returns the command line arguments that will be passed when the application is started.protected org.springframework.boot.builder.SpringApplicationBuilderReturns a builder which can be modified to enable more profiles, inject beans, etc.Returns the gateway configuration for this node.Returns the health actuator for this gateway.Returns the address used by clients to interact with the gateway.Returns the default health actuator for this application.host()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 probesintmappedPort(TestZeebePort port) Returns the actual port for the given logical port.Returns a new pre-configured client builder for this gatewaynodeId()Returns this node's unique cluster ID<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.toString()withAdditionalProfile(String profile) Configures additional active Spring profiles.When the underlying application is started, all beans of the given type will resolve to the given value.Modifies the broker configuration.withExporter(String id, Consumer<ExporterCfg> modifier) Adds or replaces a new exporter with the given ID.withGatewayConfig(Consumer<GatewayCfg> modifier) Allows modifying the gateway configuration.withProperty(String key, Object value) Configures Spring via properties.withRecordingExporter(boolean useRecordingExporter) Enables/disables usage of the recording exporter usingRECORDING_EXPORTER_IDas its unique ID.withWorkingDirectory(Path directory) Sets the broker's working directory, aka its data directory.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.camunda.zeebe.qa.util.cluster.TestApplication
actuatorUri, address, address, await, await, bean, close, isStarted, monitoringUri, probe, property, start, stop, uri, uri, withAdditionalProfile, withAdditionalProfile, withBean, withPropertyMethods inherited from interface io.camunda.zeebe.qa.util.cluster.TestGateway
awaitCompleteTopology, awaitCompleteTopology, restAddress
-
Constructor Details
-
TestStandaloneBroker
public TestStandaloneBroker()
-
-
Method Details
-
mappedPort
Description copied from interface:TestApplicationReturns the actual port for the given logical port.- Specified by:
mappedPortin interfaceTestApplication<TestStandaloneBroker>
-
createSpringBuilder
protected org.springframework.boot.builder.SpringApplicationBuilder createSpringBuilder()Returns a builder which can be modified to enable more profiles, inject beans, etc. Sub-classes can override this to customize the behavior of the test application. -
self
Description copied from interface:TestApplicationConvenience method to return the appropriate concrete type- Specified by:
selfin interfaceTestApplication<TestStandaloneBroker>
-
nodeId
Description copied from interface:TestApplicationReturns this node's unique cluster ID- Specified by:
nodeIdin interfaceTestApplication<TestStandaloneBroker>
-
host
Description copied from interface:TestApplicationReturns the hostname of this node, such that it is visible to hosts from the outside of the Docker network.- Specified by:
hostin interfaceTestApplication<TestStandaloneBroker>- Returns:
- the hostname of this node
-
healthActuator
Description copied from interface:TestApplicationReturns the default health actuator for this application.- Specified by:
healthActuatorin interfaceTestApplication<TestStandaloneBroker>- Specified by:
healthActuatorin interfaceTestGateway<TestStandaloneBroker>
-
isGateway
public boolean isGateway()Description copied from interface:TestApplicationReturns true if this node can act as a gateway (e.g. broker with embedded gateway)- Specified by:
isGatewayin interfaceTestApplication<TestStandaloneBroker>- Specified by:
isGatewayin interfaceTestGateway<TestStandaloneBroker>
-
grpcAddress
Description copied from interface:TestGatewayReturns the address used by clients to interact with the gateway.You can build your client like this:
@{code ZeebeClient.newClientBuilder() .gatewayAddress(gateway.gatewayAddress()) .usePlaintext() .build(); }- Specified by:
grpcAddressin interfaceTestGateway<TestStandaloneBroker>- Returns:
- the address for the gRPC gateway
-
gatewayHealth
Description copied from interface:TestGatewayReturns the health actuator for this gateway. You can use this to check for liveness, readiness, and startup.- Specified by:
gatewayHealthin interfaceTestGateway<TestStandaloneBroker>
-
withGatewayConfig
Description copied from interface:TestGatewayAllows modifying the gateway configuration. Changes will not take effect until the node is restarted.- Specified by:
withGatewayConfigin interfaceTestGateway<TestStandaloneBroker>
-
gatewayConfig
Description copied from interface:TestGatewayReturns the gateway configuration for this node.- Specified by:
gatewayConfigin interfaceTestGateway<TestStandaloneBroker>
-
newClientBuilder
Description copied from interface:TestGatewayReturns a new pre-configured client builder for this gateway- Specified by:
newClientBuilderin interfaceTestGateway<TestStandaloneBroker>
-
brokerConfig
Returns the broker configuration -
withBrokerConfig
public TestStandaloneBroker withBrokerConfig(Consumer<BrokerConfiguration.BrokerProperties> modifier) Modifies the broker configuration. Will still mutate the configuration if the broker is started, but likely has no effect until it's restarted. -
brokerHealth
Returns the health actuator for this broker. You can use this to check for liveness, readiness, and startup. -
withRecordingExporter
Enables/disables usage of the recording exporter usingRECORDING_EXPORTER_IDas its unique ID.- Parameters:
useRecordingExporter- if true, will enable the exporter; if false, will remove it from the config- Returns:
- itself for chaining
-
withExporter
Adds or replaces a new exporter with the given ID. If it was already existing, the existing configuration is passed to the modifier. If it's new, a blank configuration is passed.- Parameters:
id- the ID of the exportermodifier- a configuration function- Returns:
- itself for chaining
-
withWorkingDirectory
Sets the broker's working directory, aka its data directory. If a path is given, the broker will not delete it on shutdown.- Parameters:
directory- path to the broker's root data directory- Returns:
- itself for chaining
-
start
Description copied from interface:TestApplicationStarts the node in a blocking fashion.- Specified by:
startin interfaceTestApplication<T extends io.camunda.zeebe.qa.util.cluster.TestSpringApplication<T>>
-
stop
Description copied from interface:TestApplicationAttempts to stop the container gracefully in a blocking fashion.- Specified by:
stopin interfaceTestApplication<T extends io.camunda.zeebe.qa.util.cluster.TestSpringApplication<T>>
-
isStarted
public boolean isStarted()Description copied from interface:TestApplicationReturns whether the underlying application is started yet; does not include any probes- Specified by:
isStartedin interfaceTestApplication<T extends io.camunda.zeebe.qa.util.cluster.TestSpringApplication<T>>
-
withBean
Description copied from interface:TestApplicationWhen 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.- Specified by:
withBeanin interfaceTestApplication<T extends io.camunda.zeebe.qa.util.cluster.TestSpringApplication<T>>- 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
-
bean
Description copied from interface:TestApplicationIf the application is started (e.g.TestApplication.isStarted(), resolves and returns (i.e. auto-wires) the first bean of the given type.- Specified by:
beanin interfaceTestApplication<T extends io.camunda.zeebe.qa.util.cluster.TestSpringApplication<T>>- Type Parameters:
V- the expected bean type- Parameters:
type- the expected bean type- Returns:
- the bean (if any was resolved), or null
-
property
Description copied from interface:TestApplicationIf the application is started (e.g.TestApplication.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.TestApplication.withProperty(String, Object).- Specified by:
propertyin interfaceTestApplication<T extends io.camunda.zeebe.qa.util.cluster.TestSpringApplication<T>>- 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
Description copied from interface:TestApplicationConfigures Spring via properties. This does not work with properties that would be applied to injected beans (e.g. viaTestApplication.withBean(String, Object, Class)), since there will be property resolution for these beans.- Specified by:
withPropertyin interfaceTestApplication<T extends io.camunda.zeebe.qa.util.cluster.TestSpringApplication<T>>- Parameters:
key- the property keyvalue- the new value- Returns:
- itself for chaining
-
withAdditionalProfile
Description copied from interface:TestApplicationConfigures additional active Spring profiles.- Specified by:
withAdditionalProfilein interfaceTestApplication<T extends io.camunda.zeebe.qa.util.cluster.TestSpringApplication<T>>- Parameters:
profile- the profile ID- Returns:
- itself for chaining
-
commandLineArgs
Returns the command line arguments that will be passed when the application is started. -
toString
-