test(domain): withdrawal cancels the workflow via the Beoordelen task's execution (refs #12)
The WithdrawRegistration handler delivers the withdrawal message to the open Beoordelen task's execution; the Workflow Client PUTs messageEventReceived (RegistratieIngetrokken). BeoordelingTask now carries its executionId. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -158,13 +158,14 @@ public class FlowableWorkflowClientTests
|
||||
var capture = new RequestCapture();
|
||||
var client = Client(capture.Responds(HttpStatusCode.OK,
|
||||
$$"""
|
||||
{"data":[{"id":"task-1","variables":[{"name":"registrationId","type":"string","value":"{{rid}}"}]}],"total":1}
|
||||
{"data":[{"id":"task-1","executionId":"exec-1","variables":[{"name":"registrationId","type":"string","value":"{{rid}}"}]}],"total":1}
|
||||
"""));
|
||||
|
||||
var tasks = await client.GetOpenBeoordelingenAsync();
|
||||
|
||||
var task = Assert.Single(tasks);
|
||||
Assert.Equal("task-1", task.TaskId);
|
||||
Assert.Equal("exec-1", task.ExecutionId);
|
||||
Assert.Equal(rid, task.RegistrationId);
|
||||
Assert.Equal(HttpMethod.Post, capture.Seen!.Method);
|
||||
Assert.Equal("http://flowable/flowable-rest/service/query/tasks",
|
||||
@@ -242,6 +243,32 @@ public class FlowableWorkflowClientTests
|
||||
Assert.Contains($"\"value\":\"{expected}\"", capture.Body);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Withdraw_beoordeling_delivers_the_message_to_the_task_execution()
|
||||
{
|
||||
var capture = new RequestCapture();
|
||||
var client = Client(capture.Responds(HttpStatusCode.OK));
|
||||
|
||||
await client.WithdrawBeoordelingAsync("exec-1");
|
||||
|
||||
// A PUT messageEventReceived on the execution trips the Beoordelen boundary event (ADR-0014).
|
||||
Assert.Equal(HttpMethod.Put, capture.Seen!.Method);
|
||||
Assert.Equal("http://flowable/flowable-rest/service/runtime/executions/exec-1",
|
||||
capture.Seen.RequestUri!.ToString());
|
||||
Assert.Equal("rest-admin:test", DecodeBasic(capture.Seen));
|
||||
Assert.Contains("\"action\":\"messageEventReceived\"", capture.Body);
|
||||
Assert.Contains("\"messageName\":\"RegistratieIngetrokken\"", capture.Body);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Withdraw_beoordeling_throws_when_flowable_rejects_the_request()
|
||||
{
|
||||
var capture = new RequestCapture();
|
||||
var client = Client(capture.Responds(HttpStatusCode.InternalServerError));
|
||||
|
||||
await Assert.ThrowsAsync<HttpRequestException>(() => client.WithdrawBeoordelingAsync("exec-1"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Complete_beoordeling_throws_when_flowable_rejects_the_request()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user