Failing infrastructure unit tests (stub HttpMessageHandler, fakes): - FlowableWorkflowClient starts a process with the registrationId variable and returns the instance id; acquires OpenZaakAanmaken jobs (topic/workerId/lock) and parses their registrationId; completes a job with the zaakUrl variable — request URIs match flowable-rest's service/ and external-job-api/ paths. - AclHttpClient POSTs the bsn to the ACL and returns the zaak URL. - InMemoryRegistrationStore saves/reads/upserts by id. - OpenZaakJobProcessor acquires, opens a zaak, completes the job; leaves a failing job uncompleted for redelivery; polls harmlessly when idle. Adapters are stubs so the tests compile and fail on their assertions; the green commit implements them against the REST contract verified on a live Flowable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
using System.Net;
|
|
using Big.Infrastructure;
|
|
|
|
namespace Big.Tests;
|
|
|
|
public class AclHttpClientTests
|
|
{
|
|
private static AclHttpClient Client(StubHandler handler) => new(
|
|
new HttpClient(handler), new AclOptions { BaseUrl = new("http://acl/") });
|
|
|
|
[Fact]
|
|
public async Task Opens_a_zaak_by_posting_the_bsn_and_returns_the_zaak_url()
|
|
{
|
|
var capture = new RequestCapture();
|
|
var client = Client(capture.Responds(HttpStatusCode.OK,
|
|
"""{"zaakUrl":"http://openzaak/zaken/api/v1/zaken/abc"}"""));
|
|
|
|
var url = await client.OpenZaakAsync("123456782");
|
|
|
|
Assert.Equal("http://openzaak/zaken/api/v1/zaken/abc", url.ToString());
|
|
Assert.Equal(HttpMethod.Post, capture.Seen!.Method);
|
|
Assert.Equal("http://acl/zaken", capture.Seen.RequestUri!.ToString());
|
|
Assert.Contains("\"bsn\":\"123456782\"", capture.Body);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Throws_when_the_acl_rejects_the_request()
|
|
{
|
|
var capture = new RequestCapture();
|
|
var client = Client(capture.Responds(HttpStatusCode.BadGateway));
|
|
|
|
await Assert.ThrowsAsync<HttpRequestException>(() => client.OpenZaakAsync("123456782"));
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Throws_when_the_acl_returns_an_empty_body()
|
|
{
|
|
var capture = new RequestCapture();
|
|
var client = Client(capture.Responds(HttpStatusCode.OK, "null"));
|
|
|
|
await Assert.ThrowsAsync<InvalidOperationException>(() => client.OpenZaakAsync("123456782"));
|
|
}
|
|
}
|