-
Notifications
You must be signed in to change notification settings - Fork 564
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
fix(engine): Added null-check to ProcessMessageStartEventMessageNameValidator #7764
Conversation
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.
Looks good and works 👍
Please have a look at my suggestion 🍰
@Test | ||
public void shouldRejectDeploymentWhenNoMessageReferenced() { | ||
// given | ||
final BpmnModelInstance definition = | ||
Bpmn.createExecutableProcess("processId") | ||
.startEvent("startEvent") | ||
.messageEventDefinition() | ||
.id("messageEvent") | ||
.done(); | ||
|
||
// when | ||
final Record<DeploymentRecordValue> deployment = | ||
ENGINE.deployment().withXmlResource("process.bpmn", definition).expectRejection().deploy(); | ||
|
||
// then | ||
Assertions.assertThat(deployment) | ||
.hasRejectionType(RejectionType.INVALID_ARGUMENT) | ||
.hasRejectionReason( | ||
"Expected to deploy new resources, but encountered the following errors:\n" | ||
+ "'process.bpmn': - Element: messageEvent\n" | ||
+ " - ERROR: Must reference a message\n"); | ||
} | ||
|
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.
❌ First of all, the test case is nicely written 👍 Since the class contains already many test cases, we should add the new test case somewhere else.
The unit test ProcessMessageStartEventMessageNameValidatorTest
would be an option. The downside is that it just test the validator itself.
I suggest creating a new test class for message validation tests. It could look similar to TimerValidationTest
(without the parameterized style) and follow the "new" JUnit 5 style.
In order to verify the expected message using ProcessValidationUtil
. We need to add the ZeebeDesignTimeValidators
to the validation result.
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 like it 🥇
One more JUnit 5 test 🚀
bors -r |
Did you mean "r-"? |
bors r+ |
Build failed: |
bors retry |
Build succeeded: |
@remcowesterhoud let's backport this fix to |
/backport |
Backport failed for Please cherry-pick the changes locally. git fetch origin stable/1.0
git worktree add -d .worktree/backport-7764-to-stable/1.0 origin/stable/1.0
cd .worktree/backport-7764-to-stable/1.0
git checkout -b backport-7764-to-stable/1.0
ancref=$(git merge-base 73de24c042080c6261acab1c7aeb4a0c189a7e84 2add92eae7c4dbe16dbc25ce9129772b9167b2a3)
git cherry-pick -x $ancref..2add92eae7c4dbe16dbc25ce9129772b9167b2a3 |
Successfully created backport PR #7791 for |
7793: Backport 7764 to stable/1.0 r=saig0 a=remcowesterhoud ## Description Backport of #7764 to stable/1.0. ProcessValidationUtil class did not exist yet in the stable branch. I had changes so I needed to add this class to resolve the conflict. ## Related issues relates to #5510 Co-authored-by: Remco Westerhoud <remco@westerhoud.nl>
Description
Fix for NPE during validation of new deployment.
Related issues
closes #5510
Definition of Done
Not all items need to be done depending on the issue and the pull request.
Code changes:
backport stable/0.25
) to the PR, in case that fails you need to create backports manually.Testing:
Documentation: