Package io.camunda.zeebe.test.exporter
Class ExporterIntegrationRule
java.lang.Object
org.junit.rules.ExternalResource
io.camunda.zeebe.test.exporter.ExporterIntegrationRule
- All Implemented Interfaces:
org.junit.rules.TestRule
@Deprecated(since="1.3.0",
forRemoval=true)
public class ExporterIntegrationRule
extends org.junit.rules.ExternalResource
Deprecated, for removal: This API element is subject to removal in a future version.
since 1.3.0. See issue 8143 for more information.
JUnit test rule to facilitate running integration tests for exporters.
Sets up an embedded broker, gateway, client, and provides convenience methods to:
- run a sample workload (e.g. deploy & create processes, setup a job worker, etc.)
- visit all exported records so far
- perform simple operations such as deployments, starting a job worker, etc.
start().
The broker is configured either implicitly through "zeebe.test.cfg.yaml" (found in the resource classpath) or explicitly through one of the configure methods.
An example integration test suite could look like:
public class MyExporterIT {
private final MyExporterConfig config = new MyExporterConfig();-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BpmnModelInstanceDeprecated, for removal: This API element is subject to removal in a future version. -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafter()Deprecated, for removal: This API element is subject to removal in a future version.org.junit.runners.model.Statementapply(org.junit.runners.model.Statement base, org.junit.runner.Description description) Deprecated, for removal: This API element is subject to removal in a future version.voidawaitProcessCompletion(long processInstanceKey) Deprecated, for removal: This API element is subject to removal in a future version.Blocks and wait until the process identified by the key has been completed.protected voidbefore()Deprecated, for removal: This API element is subject to removal in a future version.configure(InputStream yaml) Deprecated, for removal: This API element is subject to removal in a future version.Configures the broker to add whatever exporters are defined in the yaml represented by the input stream.<E extends Exporter>
ExporterIntegrationRuleDeprecated, for removal: This API element is subject to removal in a future version.Configures the broker to use the given exporter.<T,E extends Exporter>
ExporterIntegrationRuleDeprecated, for removal: This API element is subject to removal in a future version.Configures the broker to use the given exporter.createJobWorker(String type, JobHandler handler) Deprecated, for removal: This API element is subject to removal in a future version.Creates a new job worker that will handle jobs of type .longcreateProcessInstance(String processId, Map<String, Object> variables) Deprecated, for removal: This API element is subject to removal in a future version.Creates a process instance for the given process ID, with the given variables.voiddeployProcess(BpmnModelInstance process, String filename) Deprecated, for removal: This API element is subject to removal in a future version.Deploys the given process to the broker.Deprecated, for removal: This API element is subject to removal in a future version.Returns the current broker configuration.Deprecated, for removal: This API element is subject to removal in a future version.<T> TgetExporterConfiguration(String id, Class<T> configurationClass) Deprecated, for removal: This API element is subject to removal in a future version.Returns an instance of the configuration class for the given exporter.booleanDeprecated, for removal: This API element is subject to removal in a future version.voidDeprecated, for removal: This API element is subject to removal in a future version.Runs a sample workload on the broker, exporting several records of different types.voidpublishMessage(String messageName, String correlationKey) Deprecated, for removal: This API element is subject to removal in a future version.Publishes a new message to the broker.voidstart()Deprecated, for removal: This API element is subject to removal in a future version.Starts the broker and the client.voidstop()Deprecated, for removal: This API element is subject to removal in a future version.Stops the broker and destroys the client.voidvisitExportedRecords(Consumer<Record<?>> visitor) Deprecated, for removal: This API element is subject to removal in a future version.Visits all exported records in the order they were exported.
-
Field Details
-
SAMPLE_PROCESS
Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Constructor Details
-
ExporterIntegrationRule
public ExporterIntegrationRule()Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description) Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
applyin interfaceorg.junit.rules.TestRule- Overrides:
applyin classorg.junit.rules.ExternalResource
-
before
Deprecated, for removal: This API element is subject to removal in a future version.- Overrides:
beforein classorg.junit.rules.ExternalResource- Throws:
Throwable
-
after
protected void after()Deprecated, for removal: This API element is subject to removal in a future version.- Overrides:
afterin classorg.junit.rules.ExternalResource
-
getBrokerConfig
Deprecated, for removal: This API element is subject to removal in a future version.Returns the current broker configuration.- Returns:
- current broker configuration
-
getConfiguredExporters
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- the currently configured exporters
-
hasConfiguredExporters
public boolean hasConfiguredExporters()Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- true if any exporter has been configured for the broker, false otherwise
-
getExporterConfiguration
Deprecated, for removal: This API element is subject to removal in a future version.Returns an instance of the configuration class for the given exporter.- Type Parameters:
T- type of the configuration instance- Parameters:
id- the exporter IDconfigurationClass- the class to instantiate based on the exporter configuration- Returns:
- instantiated configuration class based on the exporter args map
-
configure
Deprecated, for removal: This API element is subject to removal in a future version.Configures the broker to add whatever exporters are defined in the yaml represented by the input stream.- Parameters:
yaml- input stream wrapping a yaml document
-
configure
public <T,E extends Exporter> ExporterIntegrationRule configure(String id, Class<E> exporterClass, T configuration) Deprecated, for removal: This API element is subject to removal in a future version.Configures the broker to use the given exporter.- Type Parameters:
T- type of the configurationE- type of the exporter- Parameters:
id- the exporter IDexporterClass- the exporter classconfiguration- the configuration to use
-
configure
public <E extends Exporter> ExporterIntegrationRule configure(String id, Class<E> exporterClass, Map<String, Object> arguments) Deprecated, for removal: This API element is subject to removal in a future version.Configures the broker to use the given exporter.- Type Parameters:
E- type of the exporter- Parameters:
id- the exporter IDexporterClass- the exporter classarguments- the arguments to pass during configuration
-
start
public void start()Deprecated, for removal: This API element is subject to removal in a future version.Starts the broker and the client. This is blocking and will return once the broker is ready to accept commands.- Throws:
IllegalStateException- if no exporter has previously been configured
-
stop
public void stop()Deprecated, for removal: This API element is subject to removal in a future version.Stops the broker and destroys the client. Does nothing if not started yet. -
performSampleWorkload
public void performSampleWorkload()Deprecated, for removal: This API element is subject to removal in a future version.Runs a sample workload on the broker, exporting several records of different types. -
visitExportedRecords
Deprecated, for removal: This API element is subject to removal in a future version.Visits all exported records in the order they were exported.- Parameters:
visitor- record consumer
-
deployProcess
Deprecated, for removal: This API element is subject to removal in a future version.Deploys the given process to the broker. Note that the filename must have the "bpmn" file extension, e.g. "resource.bpmn".- Parameters:
process- process to deployfilename- resource name, e.g. "process.bpmn"
-
createProcessInstance
Deprecated, for removal: This API element is subject to removal in a future version.Creates a process instance for the given process ID, with the given variables.- Parameters:
processId- BPMN process IDvariables- initial variables for the instance- Returns:
- unique ID used to interact with the instance
-
createJobWorker
Deprecated, for removal: This API element is subject to removal in a future version.Creates a new job worker that will handle jobs of type .Make sure to close the returned job worker.
- Parameters:
type- type of the jobs to handlehandler- handler- Returns:
- a new JobWorker
-
publishMessage
Deprecated, for removal: This API element is subject to removal in a future version.Publishes a new message to the broker.- Parameters:
messageName- name of the messagecorrelationKey- correlation key
-
awaitProcessCompletion
public void awaitProcessCompletion(long processInstanceKey) Deprecated, for removal: This API element is subject to removal in a future version.Blocks and wait until the process identified by the key has been completed.- Parameters:
processInstanceKey- ID of the process
-