Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: JUnit extension injects Zeebe client #224

Merged
merged 1 commit into from
Jan 11, 2023
Merged

Conversation

saig0
Copy link
Collaborator

@saig0 saig0 commented Jan 11, 2023

If the test class has a field with the type of the Zeebe client then the JUnit extension injects a Zeebe client for the current test run.

The injection can be used to start an external job worker or a process application for the test run.

@BpmnSpecRunner
class BpmnSpecExtensionInjectionTest(private val specRunner: SpecRunner) {

    private lateinit var zeebeClient: ZeebeClient

    @BeforeEach
    fun `start external worker`() {
        zeebeClient.newWorker()
            .jobType("task-a")
            .handler { client, job ->
                client.newCompleteCommand(job.key)
                    .variables(mapOf("a" to 5))
                    .send()
                    .join()
            }
            .open()
    }

}

If the test class has a field with the type of the Zeebe client then the JUnit extension injects a Zeebe client for the current test run.

The injection can be used to start an external job worker or a process application for the test run.
@saig0 saig0 merged commit df6e951 into main Jan 11, 2023
@saig0 saig0 deleted the junit-inject-zeebe-client branch January 11, 2023 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant