-
Notifications
You must be signed in to change notification settings - Fork 15
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: add assertions for message variables #1195
base: main
Are you sure you want to change the base?
feat: add assertions for message variables #1195
Conversation
Test Results 24 files 24 suites 12s ⏱️ Results for commit c357eb6. ♻️ This comment has been updated with latest results. |
adds `hasVariable` and `hasVariableWithValue` to `MessageAssert`, similar to `ProcessInstanceAssert`
8a716ce
to
8de00a7
Compare
hasVariable
and hasVariableWithValue
to MessageAssert
I fixed the formatting problems and swapped the title and description. |
@sephiroth-j thank you for your contribution. 👍 I checked the changes but I'm unsure about the use case. Do you want to check the variables of a published message? Note Heads up! We are building a new Java testing library for Camunda 8.6. The new library will replace Zeebe Process Test. |
Yes, exactly. Right now, you need to retrieve a process instance that may have been created after the message was received to be able to check the variables. But it makes no sense if the client's task is only to publish a specific message with specific variables. It could also be that no process instance was created at all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sephiroth-j the changes look good. 👍
I have two minor comments before we can merge the PR. Please have a look. 🍪
@@ -234,4 +237,51 @@ private List<Long> getProcessInstanceKeysForCorrelatedMessageStartEvent() { | |||
.map(record -> record.getValue().getProcessInstanceKey()) | |||
.collect(Collectors.toList()); | |||
} | |||
|
|||
private Map<String, Object> getVariables() { | |||
return StreamFilter.processMessageSubscription(recordStream) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ We should get the variables of the message from the message records.
A process message subscription is only written when a message is correlated to a process instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use StreamFilter.message(recordStream)
for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ We need to add the API module as a test dependency. The dependency plugin fails with the message:
[INFO] --- maven-dependency-plugin:3.6.1:analyze-only (analyze) @ zeebe-process-test-assertions ---
Error: Used undeclared dependencies found:
Error: io.camunda:zeebe-process-test-api:jar:8.6.0-alpha2-rc2-SNAPSHOT:compile
Error: Non-test scoped test only dependencies found:
Error: io.camunda:zeebe-process-test-api:jar:8.6.0-alpha2-rc2-SNAPSHOT:compile
Add the following test dependency to the module pom.xml
:
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-process-test-api</artifactId>
<scope>test</scope>
</dependency>
I'm getting the following build error on the main branch. Any ideas?
|
For some reason, the jar file zeebe-client-java-8.6.0-20240625.094240-1041 does not contain any class files. All jar files currently available at https://artifacts.camunda.com/ui/native/zeebe-io-snapshots/io/camunda/zeebe-client-java/8.6.0-SNAPSHOT/ are affected! |
@sephiroth-j yes, in
|
Okay, then please update your main branch first and let me know when that's done so I can rebase my feature branch again. |
Description
Adds
hasVariable
andhasVariableWithValue
toMessageAssert
, similar toProcessInstanceAssert
.Related issues
Definition of Done
Not all items need to be done depending on the issue and the pull request.
Code changes:
Testing:
Documentation: