## What & why
S-17: a BIG inscription is valid for a fixed term; before it lapses the zorgprofessional must herregistreren. This adds a **daily herregistratie reminder sweep**.
- **Domain:** `Approve(ingeschrevenOp)` now stamps the inscription moment; `HerregistratieVoor` derives the deadline (inscription + 5-year validity); `HerregistratieReminderDue(asOf)` is the single rule (inside the 90-day window, inscribed, not yet reminded); `MarkHerregistratieReminderVerstuurd()` is idempotent.
- **Store:** `FindDueForHerregistratieReminderAsync(asOf)` — the sweep's candidate set, filtered on the aggregate's own rule (no duplicated policy).
- **Application:** `HerregistratieReminderSweep` — pure over the store + an injected `TimeProvider`; flags + persists each due inscription, returns the reminded ids.
- **Infra/API:** `HerregistratieReminderJob` (Quartz `IJob`) fires the sweep on a daily cron (03:00, overridable via `Quartz__Cron`) and logs the count. `GET /registrations/{id}` surfaces `herregistratieVoor` + `herregistratieReminderVerstuurd`.
**Decisions (both raised with you before coding):** use Quartz.NET as the PRD names it — a genuine cron concern, distinct from the queue-draining pumps, which stay as-is (**ADR-0022**, proposal #120); and the reminder's observable effect is a flag on the aggregate + a log line (no outbound notification infra in v1). No coupling rule (§8) is touched — Quartz is internal to the Domain Service.
Closes #18
Closes #120
## Definition of Done
- [x] Linked Gitea issue (above).
- [x] Failing test committed before the implementation (red→green per layer: domain rule, store query, sweep).
- [x] Implementation makes the test pass; refactor commit for the 90-day knob.
- [x] Conventional Commits referencing the issue (`refs #18`).
- [ ] CI green — awaiting Gitea Actions.
- [ ] `docker compose up` reaches green health checks within 3 minutes — API boots locally with Quartz initialised; verified in CI compose smoke.
- [x] Docs updated — ADR-0022, demo-script, BACKLOG.
- [x] ADR added — `docs/architecture/adr-0022-quartz-scheduler.md`.
- [x] Demo note in `docs/demo-script.md`.
## Notes for reviewers
- **Ripple:** `Approve()` gained the inscription moment, so the two approving handlers (`ApproveRegistration`, `BeoordeelRegistratie`) now take an injected `TimeProvider`; existing tests pass a fixed clock. All three `IRegistrationStore` implementers (prod, unit fake, acceptance) got the new query.
- **Calibration knobs:** validity (5y) and reminder lead time (90d) are domain constants marked with `ponytail:` comments; promotion path to beheer config (S-15) noted in the ADR.
- **Mutation:** the Quartz job shell is excluded from Stryker, mirroring the pumps; all rule/sweep/query logic is covered.
- Local: 152 domain unit tests green; API boots with the Quartz scheduler and `/health` green.
Reviewed-on: #121
This commit was merged in pull request #121.
This commit is contained in:
+2
-2
@@ -257,9 +257,9 @@ Split (issue #11 closed) into two independently-demoable slices per §13 — the
|
||||
|
||||
**Outcome:** Traces span portal → BFF → Domain → ACL → OpenZaak and portal → BFF → Domain → Flowable. Grafana dashboards pre-built for golden signals.
|
||||
|
||||
### S-17 · Quartz.NET scheduler — herregistratie reminder sweep
|
||||
### S-17 · Quartz.NET scheduler — herregistratie reminder sweep ✅
|
||||
|
||||
**Outcome:** Nightly job that finds entries within 90 days of expiry and emits a domain event. (No outbound notification in v1 — logged.)
|
||||
**Outcome:** Daily Quartz.NET cron job finds inscriptions within 90 days of their herregistratie deadline and reminds each (flag on the aggregate + log). No outbound notification and no domain event in v1 — the reminder is the persisted flag, surfaced on the read model (ADR-0022, #120). Quartz fires time-triggered sweeps; the existing pumps stay as queue-drainers.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
# ADR-0022: Quartz.NET for time-triggered fleet sweeps
|
||||
|
||||
- **Status:** Accepted
|
||||
- **Date:** 2026-07-23
|
||||
- **Deciders:** Respellion engineering
|
||||
- **Slice:** S-17 (#18) · **Proposal issue:** #120
|
||||
|
||||
## Context
|
||||
|
||||
A BIG inscription is valid for a fixed term; before it lapses the zorgprofessional
|
||||
must herregistreren. S-17 adds a **herregistratie reminder sweep**: once a day,
|
||||
scan the register for inscriptions whose deadline is within the reminder window and
|
||||
remind each one.
|
||||
|
||||
The Domain Service already runs periodic background work — `OpenZaakJobPump`,
|
||||
`BeoordelingEscalatiePump`, `RegistratieVerlopenPump`. Those are **continuous job
|
||||
pollers**: they drain Flowable's external-task/job queues at-least-once, picking up
|
||||
work as soon as it is parked, on a short poll interval. The reminder sweep is a
|
||||
different shape of work: **time-triggered**, once a day, over our own store — there
|
||||
is no queue to drain and no "as soon as possible" requirement.
|
||||
|
||||
The PRD already names the scheduler component: "Scheduler (Quartz.NET): fleet-wide
|
||||
sweeps (expiry, reminders)" (§39, §94). Adding Quartz.NET is nonetheless a new
|
||||
dependency, so this decision is recorded before the code lands (CLAUDE.md §14).
|
||||
|
||||
## Decision
|
||||
|
||||
**Use Quartz.NET for time-triggered fleet sweeps, starting with the herregistratie
|
||||
reminder sweep. Leave the existing pumps as `BackgroundService` job pollers.**
|
||||
|
||||
- `HerregistratieReminderJob` (a Quartz `IJob`) is fired by a cron trigger — daily
|
||||
at 03:00 by default, overridable with `Quartz__Cron`. It is a thin shell: it
|
||||
resolves the pure `HerregistratieReminderSweep` (application layer) and logs how
|
||||
many reminders went out.
|
||||
- The sweep's rule lives in the domain: `Registration.HerregistratieReminderDue(asOf)`,
|
||||
which the store query and the sweep both build on. The sweep marks each reminded
|
||||
inscription (`HerregistratieReminderVerstuurd`), so a re-fire reminds no one twice
|
||||
(§8.6).
|
||||
|
||||
Two options were rejected:
|
||||
|
||||
1. **A `BackgroundService` with a 24h `Task.Delay`.** No new dependency, but it
|
||||
drifts to process-start time, has no cron/misfire semantics, and contradicts the
|
||||
PRD's named component. A daily "run at 03:00" is exactly what cron scheduling is
|
||||
for.
|
||||
2. **Migrating the three pumps onto Quartz too, for one mechanism.** Rejected: the
|
||||
pumps are not schedulers. Forcing a "run at time T" tool onto "drain this queue
|
||||
continuously" work is churn and a boundary change for negative benefit. The
|
||||
teachable distinction is worth keeping: **pumps drain queues; Quartz fires
|
||||
sweeps.**
|
||||
|
||||
## Consequences
|
||||
|
||||
**Positive**
|
||||
|
||||
- Cron scheduling with restart-stable timing and misfire handling, for free.
|
||||
- The reminder rule is one domain method, reused by the store query and the sweep;
|
||||
the scheduler owns none of the policy.
|
||||
- The reference app now demonstrates the intended Scheduler component.
|
||||
|
||||
**Negative / costs**
|
||||
|
||||
- One new dependency (`Quartz`, `Quartz.Extensions.Hosting`) in the Domain Service.
|
||||
- Two periodic-work mechanisms coexist (pumps + Quartz). Deliberate — they model
|
||||
two genuinely different concerns, documented here.
|
||||
|
||||
**Follow-up**
|
||||
|
||||
- The validity term (5 years) and reminder lead time (16 weeks) are domain
|
||||
calibration knobs; promote them to beheer config (S-15) if a demo needs them
|
||||
per-catalogus.
|
||||
- The Quartz job stores its schedule in RAM (`RAMJobStore`); a persistent/clustered
|
||||
store is a later concern if the Domain Service is scaled out.
|
||||
|
||||
## Coupling rules touched (CLAUDE.md §8)
|
||||
|
||||
None. Quartz is internal to the Domain Service and drives an application use case
|
||||
over the store port. No ZGW or Flowable coupling is added; the sweep talks to no
|
||||
peer module.
|
||||
@@ -5,6 +5,35 @@ copy-pasteable walkthrough against a local `make up` stack.
|
||||
|
||||
---
|
||||
|
||||
## S-17 — herregistratie reminder sweep on a Quartz cron (#18, ADR-0022)
|
||||
|
||||
**Outcome:** an inscription (INGESCHREVEN) now carries the moment it was entered in the register, from
|
||||
which its herregistratie deadline is derived (inscription + 5-year validity). A **Quartz.NET** cron job
|
||||
in the Domain Service sweeps once a day (03:00, overridable via `Quartz__Cron`): every inscription
|
||||
inside the 90-day window before its deadline is flagged `HerregistratieReminderVerstuurd` and logged.
|
||||
The sweep is idempotent — a re-fire reminds no one twice — and is a deliberately different mechanism
|
||||
from the queue-draining pumps (Quartz fires time-triggered sweeps; pumps drain Flowable queues,
|
||||
ADR-0022). There is no outbound notification in v1: the reminder is the flag on the aggregate plus a
|
||||
log line.
|
||||
|
||||
```bash
|
||||
# 1. The domain unit tests prove the rule and the sweep end to end (rule → store query → sweep):
|
||||
cd services/domain && dotnet test Big.Tests/Big.Tests.csproj \
|
||||
--filter "FullyQualifiedName~Herregistratie|FullyQualifiedName~ReminderSweep"
|
||||
# → the reminder is due once the 90-day window opens, not before; a reminded inscription is skipped
|
||||
# on the next sweep; the sweep flags + persists every due inscription and returns their ids.
|
||||
|
||||
# 2. The read model surfaces the deadline once a registration is approved — the field the sweep acts on:
|
||||
curl -s localhost:8000/registrations/<id> | jq '{status, herregistratieVoor, herregistratieReminderVerstuurd}'
|
||||
# → after approval: herregistratieVoor is inscription + 5 years; the flag flips true once swept.
|
||||
```
|
||||
|
||||
**The path:** `Registration.Approve(now)` stamps `IngeschrevenOp` → daily Quartz `HerregistratieReminderJob`
|
||||
→ `HerregistratieReminderSweep` → `IRegistrationStore.FindDueForHerregistratieReminderAsync` (filtered by
|
||||
the aggregate's own `HerregistratieReminderDue` rule) → `MarkHerregistratieReminderVerstuurd` + log.
|
||||
|
||||
---
|
||||
|
||||
## S-B04 — `make local` completes the whole flow with no manual seeding (#110, ADR-0020)
|
||||
|
||||
**Outcome:** the host-browser stack (`make local`) now self-seeds at bring-up — it publishes the BIG
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
<ProjectReference Include="..\Big.Infrastructure\Big.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Quartz.Extensions.Hosting" Version="3.18.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Big.Application;
|
||||
using Big.Domain;
|
||||
using Big.Infrastructure;
|
||||
using Quartz;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
@@ -15,6 +16,10 @@ builder.Services.AddSingleton(sp => sp.GetRequiredService<IConfiguration>()
|
||||
// The in-memory registration store is shared between the submit endpoint and the worker (ADR-0009).
|
||||
builder.Services.AddSingleton<IRegistrationStore, InMemoryRegistrationStore>();
|
||||
|
||||
// The system clock, injected wherever a use case needs "now" (e.g. stamping the inscription moment
|
||||
// on approval, S-17). Injected as TimeProvider so tests can substitute a fixed clock.
|
||||
builder.Services.AddSingleton(TimeProvider.System);
|
||||
|
||||
// The Workflow Client is one type behind two ports (start side + worker side); both resolve to the
|
||||
// same HttpClient-backed implementation — the only code that talks to Flowable (§8.2).
|
||||
builder.Services.AddHttpClient<FlowableWorkflowClient>();
|
||||
@@ -36,6 +41,7 @@ builder.Services.AddScoped<OpenZaakJobProcessor>();
|
||||
builder.Services.AddScoped<BeoordelingEscalatieProcessor>();
|
||||
builder.Services.AddScoped<ExpireRegistrationWorker>();
|
||||
builder.Services.AddScoped<RegistratieVerlopenProcessor>();
|
||||
builder.Services.AddScoped<HerregistratieReminderSweep>();
|
||||
|
||||
// The hosted external-task job worker polls Flowable and drives OpenZaakAanmaken to completion.
|
||||
builder.Services.AddHostedService<OpenZaakJobPump>();
|
||||
@@ -46,6 +52,19 @@ builder.Services.AddHostedService<BeoordelingEscalatiePump>();
|
||||
// parks and expires each lapsed registration to VERLOPEN (S-10a, ADR-0017).
|
||||
builder.Services.AddHostedService<RegistratieVerlopenPump>();
|
||||
|
||||
// The herregistratie reminder sweep runs on a daily cron via Quartz.NET (S-17, ADR-0022) — a
|
||||
// time-triggered fleet sweep, deliberately a different mechanism from the queue-draining pumps above.
|
||||
// The cron is overridable with Quartz__Cron; it defaults to 03:00 daily.
|
||||
builder.Services.AddQuartz(q =>
|
||||
{
|
||||
var jobKey = new JobKey("herregistratie-reminder");
|
||||
q.AddJob<HerregistratieReminderJob>(jobKey);
|
||||
q.AddTrigger(t => t
|
||||
.ForJob(jobKey)
|
||||
.WithCronSchedule(builder.Configuration["Quartz:Cron"] ?? "0 0 3 * * ?"));
|
||||
});
|
||||
builder.Services.AddQuartzHostedService(o => o.WaitForJobsToComplete = true);
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.MapGet("/health", () => "Healthy");
|
||||
@@ -165,7 +184,8 @@ app.MapGet("/registrations/{id}", async (string id, IRegistrationStore store, Ca
|
||||
return registration is null
|
||||
? Results.NotFound()
|
||||
: Results.Ok(new RegistrationResponse(
|
||||
registration.Id.ToString(), registration.Status.ToString(), registration.ZaakUrl?.ToString()));
|
||||
registration.Id.ToString(), registration.Status.ToString(), registration.ZaakUrl?.ToString(),
|
||||
registration.HerregistratieVoor?.ToString("O"), registration.HerregistratieReminderVerstuurd));
|
||||
});
|
||||
|
||||
await app.RunAsync();
|
||||
@@ -178,6 +198,11 @@ public sealed record WithdrawRequest(string Bsn);
|
||||
|
||||
public sealed record ProvideDocumentsRequest(string Bsn, string ContentBase64, string? FileName = null, string? ContentType = null);
|
||||
|
||||
public sealed record RegistrationResponse(string RegistrationId, string Status, string? ZaakUrl);
|
||||
public sealed record RegistrationResponse(
|
||||
string RegistrationId,
|
||||
string Status,
|
||||
string? ZaakUrl,
|
||||
string? HerregistratieVoor = null,
|
||||
bool HerregistratieReminderVerstuurd = false);
|
||||
|
||||
public partial class Program;
|
||||
|
||||
@@ -12,7 +12,7 @@ public sealed record ApproveRegistrationCommand(RegistrationId RegistrationId);
|
||||
/// zaak status is the projection's source of truth (it flows back over NRC); the aggregate transition
|
||||
/// keeps the domain's own view consistent.
|
||||
/// </summary>
|
||||
public sealed class ApproveRegistration(IRegistrationStore store, IAclClient acl)
|
||||
public sealed class ApproveRegistration(IRegistrationStore store, IAclClient acl, TimeProvider clock)
|
||||
{
|
||||
public async Task HandleAsync(ApproveRegistrationCommand command, CancellationToken ct = default)
|
||||
{
|
||||
@@ -30,7 +30,7 @@ public sealed class ApproveRegistration(IRegistrationStore store, IAclClient acl
|
||||
$"Registration {command.RegistrationId} has no zaak yet; it cannot be approved.");
|
||||
|
||||
await acl.ApproveZaakAsync(registration.ZaakUrl, ct);
|
||||
registration.Approve();
|
||||
registration.Approve(clock.GetUtcNow());
|
||||
await store.SaveAsync(registration, ct);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public sealed record BeoordeelRegistratieCommand(RegistrationId RegistrationId,
|
||||
/// decisions are idempotent — a repeated or redelivered decision that matches the current terminal
|
||||
/// state is a no-op, so the ACL is not called and the task not completed twice.
|
||||
/// </summary>
|
||||
public sealed class BeoordeelRegistratie(IRegistrationStore store, IAclClient acl, IUserTaskClient tasks)
|
||||
public sealed class BeoordeelRegistratie(IRegistrationStore store, IAclClient acl, IUserTaskClient tasks, TimeProvider clock)
|
||||
{
|
||||
public async Task HandleAsync(BeoordeelRegistratieCommand command, CancellationToken ct = default)
|
||||
{
|
||||
@@ -44,7 +44,7 @@ public sealed class BeoordeelRegistratie(IRegistrationStore store, IAclClient ac
|
||||
throw new InvalidOperationException(
|
||||
$"Registration {command.RegistrationId} has no zaak yet; it cannot be approved.");
|
||||
await acl.ApproveZaakAsync(registration.ZaakUrl, ct);
|
||||
registration.Approve();
|
||||
registration.Approve(clock.GetUtcNow());
|
||||
break;
|
||||
|
||||
case BeoordelingsBesluit.Afwijzen:
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
using Big.Domain;
|
||||
|
||||
namespace Big.Application;
|
||||
|
||||
/// <summary>
|
||||
/// The herregistratie reminder sweep (S-17): find the inscriptions whose herregistratie deadline is
|
||||
/// within the reminder window and have not yet been reminded, mark each reminded, and persist it. Pure
|
||||
/// application logic over ports — it knows nothing of Quartz; the scheduled job that fires it on a cron
|
||||
/// lives in Infrastructure (mirroring how the pumps' processors are pure and the pump is the shell).
|
||||
/// Idempotent: <see cref="Registration.MarkHerregistratieReminderVerstuurd"/> drops an inscription from
|
||||
/// the next sweep's candidate set, so a re-fire reminds no one twice. Returns the reminded ids so the
|
||||
/// caller can observe the sweep's effect — the reminder itself is the flag persisted on the aggregate.
|
||||
/// </summary>
|
||||
public sealed class HerregistratieReminderSweep(IRegistrationStore store, TimeProvider clock)
|
||||
{
|
||||
public async Task<IReadOnlyList<RegistrationId>> SweepAsync(CancellationToken ct = default)
|
||||
{
|
||||
var due = await store.FindDueForHerregistratieReminderAsync(clock.GetUtcNow(), ct);
|
||||
|
||||
var reminded = new List<RegistrationId>(due.Count);
|
||||
foreach (var registration in due)
|
||||
{
|
||||
registration.MarkHerregistratieReminderVerstuurd();
|
||||
await store.SaveAsync(registration, ct);
|
||||
reminded.Add(registration.Id);
|
||||
}
|
||||
|
||||
return reminded;
|
||||
}
|
||||
}
|
||||
@@ -107,6 +107,13 @@ public interface IRegistrationStore
|
||||
/// registration, or <c>null</c> if they have none in flight. Lets the self-service portal resume
|
||||
/// an existing registration after a refresh (S-26); terminal registrations are not resumed.</summary>
|
||||
Task<Registration?> FindOpenByBsnAsync(string bsn, CancellationToken ct = default);
|
||||
|
||||
/// <summary>The inscriptions whose herregistratie reminder is due as of <paramref name="asOf"/> and
|
||||
/// not yet sent — the herregistratie reminder sweep's candidate set (S-17). The predicate is the
|
||||
/// aggregate's own <see cref="Registration.HerregistratieReminderDue"/> rule, so the store never
|
||||
/// duplicates the herregistratie policy.</summary>
|
||||
Task<IReadOnlyList<Registration>> FindDueForHerregistratieReminderAsync(
|
||||
DateTimeOffset asOf, CancellationToken ct = default);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -92,11 +92,12 @@ public sealed class Registration
|
||||
|
||||
/// <summary>
|
||||
/// Approve the registration — the behandelaar's decision to enter it in the register. Advances a
|
||||
/// submitted or in-behandeling registration to <see cref="RegistrationStatus.Ingeschreven"/>.
|
||||
/// Requires an opened zaak (the approval sets that zaak's status via the ACL); a registration that
|
||||
/// has already been decided cannot be approved again.
|
||||
/// submitted or in-behandeling registration to <see cref="RegistrationStatus.Ingeschreven"/> and
|
||||
/// records <paramref name="ingeschrevenOp"/> as the moment of inscription, which starts the
|
||||
/// herregistratie clock (S-17). Requires an opened zaak (the approval sets that zaak's status via
|
||||
/// the ACL); a registration that has already been decided cannot be approved again.
|
||||
/// </summary>
|
||||
public void Approve()
|
||||
public void Approve(DateTimeOffset ingeschrevenOp)
|
||||
{
|
||||
if (ZaakUrl is null)
|
||||
throw new InvalidOperationException(
|
||||
@@ -104,6 +105,54 @@ public sealed class Registration
|
||||
|
||||
RequireOpenForDecision(nameof(Approve));
|
||||
Status = RegistrationStatus.Ingeschreven;
|
||||
IngeschrevenOp = ingeschrevenOp;
|
||||
}
|
||||
|
||||
// --- Herregistratie (S-17) — RED stubs, implemented in the green commit ---------------------
|
||||
|
||||
/// <summary>How long a BIG inscription stays valid before herregistratie is required.</summary>
|
||||
// ponytail: fixed 5-year term — a calibration knob, not a config surface. If a demo needs it
|
||||
// per-catalogus, promote it to policy passed in from the beheer config (S-15).
|
||||
public static readonly TimeSpan HerregistratieGeldigheid = TimeSpan.FromDays(365 * 5);
|
||||
|
||||
/// <summary>How long before the deadline the herregistratie reminder is sent (S-17: 90 days).</summary>
|
||||
// ponytail: fixed 90-day lead time — calibration knob; same promotion path as HerregistratieGeldigheid.
|
||||
public static readonly TimeSpan Herinneringstermijn = TimeSpan.FromDays(90);
|
||||
|
||||
/// <summary>When the registration was entered in the register, once approved; the start of its
|
||||
/// herregistratie clock. Null until it is <see cref="RegistrationStatus.Ingeschreven"/>.</summary>
|
||||
public DateTimeOffset? IngeschrevenOp { get; private set; }
|
||||
|
||||
/// <summary>The date by which herregistratie must happen: inscription + validity. Null until
|
||||
/// inscribed.</summary>
|
||||
public DateTimeOffset? HerregistratieVoor =>
|
||||
IngeschrevenOp is DateTimeOffset ingeschrevenOp ? ingeschrevenOp + HerregistratieGeldigheid : null;
|
||||
|
||||
/// <summary>Whether the herregistratie reminder has been sent for this inscription (S-17).</summary>
|
||||
public bool HerregistratieReminderVerstuurd { get; private set; }
|
||||
|
||||
/// <summary>Whether, as of <paramref name="asOf"/>, this registration is due a herregistratie
|
||||
/// reminder: it is inscribed, the reminder window before its deadline has opened, and it has not
|
||||
/// already been reminded. Once inside the window it stays due until reminded (an overdue inscription
|
||||
/// is still due). This is the single rule the store query and the sweep both build on.</summary>
|
||||
public bool HerregistratieReminderDue(DateTimeOffset asOf) =>
|
||||
Status == RegistrationStatus.Ingeschreven
|
||||
&& !HerregistratieReminderVerstuurd
|
||||
&& IngeschrevenOp is DateTimeOffset ingeschrevenOp
|
||||
&& asOf >= ingeschrevenOp + HerregistratieGeldigheid - Herinneringstermijn;
|
||||
|
||||
/// <summary>Record that the herregistratie reminder has been sent. Idempotent — a re-sweep is a
|
||||
/// no-op (§8.6); only an inscribed registration can be reminded.</summary>
|
||||
public void MarkHerregistratieReminderVerstuurd()
|
||||
{
|
||||
if (HerregistratieReminderVerstuurd)
|
||||
return;
|
||||
|
||||
if (Status != RegistrationStatus.Ingeschreven)
|
||||
throw new InvalidOperationException(
|
||||
$"Registration {Id} is {Status}; only an INGESCHREVEN registration can be sent a herregistratie reminder.");
|
||||
|
||||
HerregistratieReminderVerstuurd = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0" />
|
||||
<PackageReference Include="Quartz" Version="3.18.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using Big.Application;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Quartz;
|
||||
|
||||
namespace Big.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// The Quartz job that fires the herregistratie reminder sweep on a cron schedule (S-17, ADR-0022).
|
||||
/// A deliberately thin shell — it resolves the pure <see cref="HerregistratieReminderSweep"/> (Quartz's
|
||||
/// MS-DI job factory gives each fire its own scope) and logs how many reminders went out; all the
|
||||
/// sweep logic is unit-tested in the application layer. Quartz drives this — rather than a
|
||||
/// BackgroundService poll loop like the pumps — because it is a time-triggered fleet sweep, not a
|
||||
/// queue to drain (the distinction recorded in ADR-0022). <see cref="DisallowConcurrentExecutionAttribute"/>
|
||||
/// stops a slow sweep overlapping the next fire against the shared store.
|
||||
/// </summary>
|
||||
[DisallowConcurrentExecution]
|
||||
public sealed class HerregistratieReminderJob(
|
||||
HerregistratieReminderSweep sweep, ILogger<HerregistratieReminderJob> logger) : IJob
|
||||
{
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
var reminded = await sweep.SweepAsync(context.CancellationToken);
|
||||
logger.LogInformation(
|
||||
"Herregistratie-sweep voltooid: {Count} herinnering(en) verstuurd.", reminded.Count);
|
||||
}
|
||||
}
|
||||
@@ -26,4 +26,9 @@ public sealed class InMemoryRegistrationStore : IRegistrationStore
|
||||
public Task<Registration?> FindOpenByBsnAsync(string bsn, CancellationToken ct = default)
|
||||
=> Task.FromResult(_byId.Values.FirstOrDefault(r =>
|
||||
r.Bsn == bsn && r.Status is RegistrationStatus.Ingediend or RegistrationStatus.InBehandeling));
|
||||
|
||||
public Task<IReadOnlyList<Registration>> FindDueForHerregistratieReminderAsync(
|
||||
DateTimeOffset asOf, CancellationToken ct = default)
|
||||
=> Task.FromResult<IReadOnlyList<Registration>>(
|
||||
_byId.Values.Where(r => r.HerregistratieReminderDue(asOf)).ToList());
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ApproveRegistrationTests
|
||||
var acl = new FakeAclClient();
|
||||
var registration = WithZaak();
|
||||
store.Seed(registration);
|
||||
var handler = new ApproveRegistration(store, acl);
|
||||
var handler = new ApproveRegistration(store, acl, TimeProvider.System);
|
||||
|
||||
await handler.HandleAsync(new ApproveRegistrationCommand(registration.Id));
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ApproveRegistrationTests
|
||||
{
|
||||
var store = new FakeRegistrationStore();
|
||||
var acl = new FakeAclClient();
|
||||
var handler = new ApproveRegistration(store, acl);
|
||||
var handler = new ApproveRegistration(store, acl, TimeProvider.System);
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => handler.HandleAsync(null!));
|
||||
Assert.Equal(0, acl.ApproveCallCount);
|
||||
@@ -47,7 +47,7 @@ public class ApproveRegistrationTests
|
||||
{
|
||||
var store = new FakeRegistrationStore();
|
||||
var acl = new FakeAclClient();
|
||||
var handler = new ApproveRegistration(store, acl);
|
||||
var handler = new ApproveRegistration(store, acl, TimeProvider.System);
|
||||
|
||||
var ex = await Assert.ThrowsAsync<InvalidOperationException>(
|
||||
() => handler.HandleAsync(new ApproveRegistrationCommand(RegistrationId.New())));
|
||||
@@ -62,7 +62,7 @@ public class ApproveRegistrationTests
|
||||
var acl = new FakeAclClient();
|
||||
var registration = Registration.Submit("123456782"); // no zaak yet
|
||||
store.Seed(registration);
|
||||
var handler = new ApproveRegistration(store, acl);
|
||||
var handler = new ApproveRegistration(store, acl, TimeProvider.System);
|
||||
|
||||
var ex = await Assert.ThrowsAsync<InvalidOperationException>(
|
||||
() => handler.HandleAsync(new ApproveRegistrationCommand(registration.Id)));
|
||||
@@ -77,7 +77,7 @@ public class ApproveRegistrationTests
|
||||
var acl = new FakeAclClient();
|
||||
var registration = WithZaak();
|
||||
store.Seed(registration);
|
||||
var handler = new ApproveRegistration(store, acl);
|
||||
var handler = new ApproveRegistration(store, acl, TimeProvider.System);
|
||||
|
||||
await handler.HandleAsync(new ApproveRegistrationCommand(registration.Id));
|
||||
await handler.HandleAsync(new ApproveRegistrationCommand(registration.Id));
|
||||
|
||||
@@ -29,7 +29,7 @@ public class BeoordeelRegistratieTests
|
||||
var registration = WithZaak();
|
||||
store.Seed(registration);
|
||||
var tasks = TaskFor(registration);
|
||||
var handler = new BeoordeelRegistratie(store, acl, tasks);
|
||||
var handler = new BeoordeelRegistratie(store, acl, tasks, TimeProvider.System);
|
||||
|
||||
await handler.HandleAsync(new BeoordeelRegistratieCommand(registration.Id, BeoordelingsBesluit.Goedkeuren));
|
||||
|
||||
@@ -50,7 +50,7 @@ public class BeoordeelRegistratieTests
|
||||
var registration = WithZaak();
|
||||
store.Seed(registration);
|
||||
var tasks = TaskFor(registration);
|
||||
var handler = new BeoordeelRegistratie(store, acl, tasks);
|
||||
var handler = new BeoordeelRegistratie(store, acl, tasks, TimeProvider.System);
|
||||
|
||||
await handler.HandleAsync(new BeoordeelRegistratieCommand(registration.Id, BeoordelingsBesluit.Afwijzen));
|
||||
|
||||
@@ -69,7 +69,7 @@ public class BeoordeelRegistratieTests
|
||||
var registration = WithZaak();
|
||||
registration.TakeIntoBehandeling();
|
||||
store.Seed(registration);
|
||||
var handler = new BeoordeelRegistratie(store, acl, TaskFor(registration));
|
||||
var handler = new BeoordeelRegistratie(store, acl, TaskFor(registration), TimeProvider.System);
|
||||
|
||||
await handler.HandleAsync(new BeoordeelRegistratieCommand(registration.Id, BeoordelingsBesluit.Goedkeuren));
|
||||
|
||||
@@ -81,7 +81,7 @@ public class BeoordeelRegistratieTests
|
||||
{
|
||||
var store = new FakeRegistrationStore();
|
||||
var acl = new FakeAclClient();
|
||||
var handler = new BeoordeelRegistratie(store, acl, new FakeUserTaskClient([]));
|
||||
var handler = new BeoordeelRegistratie(store, acl, new FakeUserTaskClient([]), TimeProvider.System);
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => handler.HandleAsync(null!));
|
||||
Assert.Equal(0, acl.ApproveCallCount);
|
||||
@@ -93,7 +93,7 @@ public class BeoordeelRegistratieTests
|
||||
{
|
||||
var store = new FakeRegistrationStore();
|
||||
var acl = new FakeAclClient();
|
||||
var handler = new BeoordeelRegistratie(store, acl, new FakeUserTaskClient([]));
|
||||
var handler = new BeoordeelRegistratie(store, acl, new FakeUserTaskClient([]), TimeProvider.System);
|
||||
|
||||
var ex = await Assert.ThrowsAsync<InvalidOperationException>(() =>
|
||||
handler.HandleAsync(new BeoordeelRegistratieCommand(RegistrationId.New(), BeoordelingsBesluit.Goedkeuren)));
|
||||
@@ -108,7 +108,7 @@ public class BeoordeelRegistratieTests
|
||||
var acl = new FakeAclClient();
|
||||
var registration = Registration.Submit("123456782"); // no zaak yet
|
||||
store.Seed(registration);
|
||||
var handler = new BeoordeelRegistratie(store, acl, TaskFor(registration));
|
||||
var handler = new BeoordeelRegistratie(store, acl, TaskFor(registration), TimeProvider.System);
|
||||
|
||||
var ex = await Assert.ThrowsAsync<InvalidOperationException>(() =>
|
||||
handler.HandleAsync(new BeoordeelRegistratieCommand(registration.Id, BeoordelingsBesluit.Goedkeuren)));
|
||||
@@ -123,7 +123,7 @@ public class BeoordeelRegistratieTests
|
||||
var acl = new FakeAclClient();
|
||||
var registration = WithZaak();
|
||||
store.Seed(registration);
|
||||
var handler = new BeoordeelRegistratie(store, acl, TaskFor(registration));
|
||||
var handler = new BeoordeelRegistratie(store, acl, TaskFor(registration), TimeProvider.System);
|
||||
|
||||
await handler.HandleAsync(new BeoordeelRegistratieCommand(registration.Id, BeoordelingsBesluit.Goedkeuren));
|
||||
await handler.HandleAsync(new BeoordeelRegistratieCommand(registration.Id, BeoordelingsBesluit.Goedkeuren));
|
||||
@@ -139,7 +139,7 @@ public class BeoordeelRegistratieTests
|
||||
var acl = new FakeAclClient();
|
||||
var registration = WithZaak();
|
||||
store.Seed(registration);
|
||||
var handler = new BeoordeelRegistratie(store, acl, TaskFor(registration));
|
||||
var handler = new BeoordeelRegistratie(store, acl, TaskFor(registration), TimeProvider.System);
|
||||
|
||||
await handler.HandleAsync(new BeoordeelRegistratieCommand(registration.Id, BeoordelingsBesluit.Afwijzen));
|
||||
await handler.HandleAsync(new BeoordeelRegistratieCommand(registration.Id, BeoordelingsBesluit.Afwijzen));
|
||||
@@ -158,7 +158,7 @@ public class BeoordeelRegistratieTests
|
||||
var registration = WithZaak();
|
||||
store.Seed(registration);
|
||||
var tasks = new FakeUserTaskClient([]); // no open task for this registration
|
||||
var handler = new BeoordeelRegistratie(store, acl, tasks);
|
||||
var handler = new BeoordeelRegistratie(store, acl, tasks, TimeProvider.System);
|
||||
|
||||
await handler.HandleAsync(new BeoordeelRegistratieCommand(registration.Id, BeoordelingsBesluit.Goedkeuren));
|
||||
|
||||
|
||||
@@ -26,6 +26,11 @@ internal sealed class FakeRegistrationStore : IRegistrationStore
|
||||
=> Task.FromResult(_byId.Values.FirstOrDefault(r =>
|
||||
r.Bsn == bsn && r.Status is RegistrationStatus.Ingediend or RegistrationStatus.InBehandeling));
|
||||
|
||||
public Task<IReadOnlyList<Registration>> FindDueForHerregistratieReminderAsync(
|
||||
DateTimeOffset asOf, CancellationToken ct = default)
|
||||
=> Task.FromResult<IReadOnlyList<Registration>>(
|
||||
_byId.Values.Where(r => r.HerregistratieReminderDue(asOf)).ToList());
|
||||
|
||||
public void Seed(Registration registration) => _byId[registration.Id] = registration;
|
||||
}
|
||||
|
||||
@@ -85,6 +90,13 @@ internal sealed class FakeUserTaskClient(IReadOnlyList<BeoordelingTask> open) :
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A <see cref="TimeProvider"/> pinned to a fixed instant, so time-based use cases (the
|
||||
/// herregistratie sweep, S-17) are deterministic without the TimeProvider.Testing package.</summary>
|
||||
internal sealed class FixedClock(DateTimeOffset now) : TimeProvider
|
||||
{
|
||||
public override DateTimeOffset GetUtcNow() => now;
|
||||
}
|
||||
|
||||
/// <summary>A fake ACL client that records the bsn it was asked to open a zaak for and returns a
|
||||
/// fixed zaak URL.</summary>
|
||||
internal sealed class FakeAclClient(Uri? zaakUrl = null) : IAclClient
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
using Big.Application;
|
||||
using Big.Domain;
|
||||
|
||||
namespace Big.Tests;
|
||||
|
||||
// S-17 (#18): the sweep behind the Quartz job. It reminds every inscription whose herregistratie
|
||||
// reminder is due, marks each so a re-fire is a no-op (§8.6), and returns the reminded ids. Pure over
|
||||
// the store + an injected clock — no Quartz here.
|
||||
public class HerregistratieReminderSweepTests
|
||||
{
|
||||
private static readonly DateTimeOffset Now = new(2026, 7, 23, 0, 0, 0, TimeSpan.Zero);
|
||||
|
||||
private static Registration Inscribed(string bsn, DateTimeOffset ingeschrevenOp)
|
||||
{
|
||||
var registration = Registration.Submit(bsn);
|
||||
registration.AttachZaak(FakeAclClient.DefaultZaakUrl);
|
||||
registration.Approve(ingeschrevenOp);
|
||||
return registration;
|
||||
}
|
||||
|
||||
// Inscribed exactly (geldigheid - herinneringstermijn) before Now: the reminder window is open.
|
||||
private static Registration Due(string bsn)
|
||||
=> Inscribed(bsn, Now - Registration.HerregistratieGeldigheid + Registration.Herinneringstermijn);
|
||||
|
||||
[Fact]
|
||||
public async Task Reminds_and_persists_every_due_inscription_and_returns_their_ids()
|
||||
{
|
||||
var store = new FakeRegistrationStore();
|
||||
var a = Due("123456782");
|
||||
var b = Due("111111110");
|
||||
var freshlyInscribed = Inscribed("222222222", Now); // not yet in the window
|
||||
store.Seed(a);
|
||||
store.Seed(b);
|
||||
store.Seed(freshlyInscribed);
|
||||
|
||||
var reminded = await new HerregistratieReminderSweep(store, new FixedClock(Now)).SweepAsync();
|
||||
|
||||
Assert.Equal(new HashSet<RegistrationId> { a.Id, b.Id }, reminded.ToHashSet());
|
||||
Assert.True((await store.GetAsync(a.Id))!.HerregistratieReminderVerstuurd);
|
||||
Assert.True((await store.GetAsync(b.Id))!.HerregistratieReminderVerstuurd);
|
||||
Assert.False((await store.GetAsync(freshlyInscribed.Id))!.HerregistratieReminderVerstuurd);
|
||||
Assert.Equal(2, store.SaveCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task A_second_sweep_reminds_no_one_again()
|
||||
{
|
||||
var store = new FakeRegistrationStore();
|
||||
store.Seed(Due("123456782"));
|
||||
var sweep = new HerregistratieReminderSweep(store, new FixedClock(Now));
|
||||
|
||||
await sweep.SweepAsync();
|
||||
var second = await sweep.SweepAsync();
|
||||
|
||||
Assert.Empty(second);
|
||||
Assert.Equal(1, store.SaveCount); // only the first sweep persisted anything
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Reminds_no_one_when_nothing_is_due()
|
||||
{
|
||||
var store = new FakeRegistrationStore();
|
||||
store.Seed(Inscribed("123456782", Now)); // freshly inscribed — deadline is 5 years off
|
||||
|
||||
Assert.Empty(await new HerregistratieReminderSweep(store, new FixedClock(Now)).SweepAsync());
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class InMemoryRegistrationStoreTests
|
||||
switch (transition)
|
||||
{
|
||||
case nameof(Registration.Withdraw): registration.Withdraw(); break;
|
||||
case nameof(Registration.Approve): registration.Approve(); break;
|
||||
case nameof(Registration.Approve): registration.Approve(DateTimeOffset.UtcNow); break;
|
||||
case nameof(Registration.Reject): registration.Reject(); break;
|
||||
case nameof(Registration.Expire): registration.Expire(); break;
|
||||
}
|
||||
@@ -96,4 +96,27 @@ public class InMemoryRegistrationStoreTests
|
||||
|
||||
Assert.Null(await store.FindOpenByBsnAsync("123456782"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Finds_only_the_inscriptions_due_for_a_herregistratie_reminder()
|
||||
{
|
||||
var now = new DateTimeOffset(2026, 7, 23, 0, 0, 0, TimeSpan.Zero);
|
||||
var store = new InMemoryRegistrationStore();
|
||||
|
||||
var due = Registration.Submit("123456782");
|
||||
due.AttachZaak(new Uri("http://openzaak/zaken/api/v1/zaken/abc"));
|
||||
due.Approve(now - Registration.HerregistratieGeldigheid + Registration.Herinneringstermijn);
|
||||
await store.SaveAsync(due);
|
||||
|
||||
var freshlyInscribed = Registration.Submit("111111110");
|
||||
freshlyInscribed.AttachZaak(new Uri("http://openzaak/zaken/api/v1/zaken/def"));
|
||||
freshlyInscribed.Approve(now);
|
||||
await store.SaveAsync(freshlyInscribed);
|
||||
|
||||
await store.SaveAsync(Registration.Submit("222222222")); // still INGEDIEND — never inscribed
|
||||
|
||||
var result = await store.FindDueForHerregistratieReminderAsync(now);
|
||||
|
||||
Assert.Equal([due.Id], result.Select(r => r.Id).ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
using Big.Domain;
|
||||
|
||||
namespace Big.Tests;
|
||||
|
||||
// S-17 (#18): a BIG inscription is valid for a fixed term; before it lapses the zorgprofessional must
|
||||
// herregistreren. The aggregate records when it was inscribed, derives the herregistratie deadline, and
|
||||
// answers whether a reminder is due as of a given moment — the single rule the Quartz sweep and the
|
||||
// store query both build on. All arithmetic is against an explicit "now" so it is wall-clock-free.
|
||||
public class RegistrationHerregistratieTests
|
||||
{
|
||||
private static readonly DateTimeOffset Now = new(2026, 7, 23, 0, 0, 0, TimeSpan.Zero);
|
||||
|
||||
// The moment the reminder window opens: inscribed exactly (geldigheid - herinneringstermijn) ago.
|
||||
private static DateTimeOffset InscribedSoDueAt(DateTimeOffset asOf)
|
||||
=> asOf - Registration.HerregistratieGeldigheid + Registration.Herinneringstermijn;
|
||||
|
||||
private static Registration Inscribed(DateTimeOffset ingeschrevenOp)
|
||||
{
|
||||
var registration = Registration.Submit("123456782");
|
||||
registration.AttachZaak(FakeAclClient.DefaultZaakUrl);
|
||||
registration.Approve(ingeschrevenOp);
|
||||
return registration;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Approving_records_the_inscription_moment_and_the_herregistratie_deadline()
|
||||
{
|
||||
var registration = Inscribed(Now);
|
||||
|
||||
Assert.Equal(Now, registration.IngeschrevenOp);
|
||||
Assert.Equal(Now + Registration.HerregistratieGeldigheid, registration.HerregistratieVoor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_reminder_is_due_the_moment_the_window_before_the_deadline_opens()
|
||||
{
|
||||
var registration = Inscribed(InscribedSoDueAt(Now));
|
||||
|
||||
Assert.True(registration.HerregistratieReminderDue(Now));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_reminder_is_not_yet_due_one_day_before_the_window_opens()
|
||||
{
|
||||
var registration = Inscribed(InscribedSoDueAt(Now) + TimeSpan.FromDays(1));
|
||||
|
||||
Assert.False(registration.HerregistratieReminderDue(Now));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_registration_that_is_not_ingeschreven_is_never_due_and_has_no_deadline()
|
||||
{
|
||||
var registration = Registration.Submit("123456782"); // INGEDIEND, never inscribed
|
||||
|
||||
Assert.Null(registration.IngeschrevenOp);
|
||||
Assert.Null(registration.HerregistratieVoor);
|
||||
Assert.False(registration.HerregistratieReminderDue(Now));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_reminded_registration_is_no_longer_due()
|
||||
{
|
||||
var registration = Inscribed(InscribedSoDueAt(Now));
|
||||
|
||||
registration.MarkHerregistratieReminderVerstuurd();
|
||||
|
||||
Assert.True(registration.HerregistratieReminderVerstuurd);
|
||||
Assert.False(registration.HerregistratieReminderDue(Now));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Marking_the_reminder_sent_twice_is_idempotent()
|
||||
{
|
||||
var registration = Inscribed(InscribedSoDueAt(Now));
|
||||
|
||||
registration.MarkHerregistratieReminderVerstuurd();
|
||||
registration.MarkHerregistratieReminderVerstuurd();
|
||||
|
||||
Assert.True(registration.HerregistratieReminderVerstuurd);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Marking_a_reminder_on_a_registration_that_is_not_ingeschreven_is_rejected()
|
||||
{
|
||||
var registration = Registration.Submit("123456782");
|
||||
|
||||
var ex = Assert.Throws<InvalidOperationException>(() => registration.MarkHerregistratieReminderVerstuurd());
|
||||
Assert.Contains("INGESCHREVEN", ex.Message);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,9 @@ namespace Big.Tests;
|
||||
|
||||
public class RegistrationTests
|
||||
{
|
||||
// A fixed inscription moment for the approval tests; its exact value is irrelevant to them.
|
||||
private static readonly DateTimeOffset Ingeschreven = new(2026, 1, 1, 0, 0, 0, TimeSpan.Zero);
|
||||
|
||||
[Fact]
|
||||
public void Submitting_a_registration_starts_in_ingediend()
|
||||
{
|
||||
@@ -103,7 +106,7 @@ public class RegistrationTests
|
||||
var registration = Registration.Submit("123456782");
|
||||
registration.AttachZaak(new Uri("http://openzaak/zaken/api/v1/zaken/abc"));
|
||||
|
||||
registration.Approve();
|
||||
registration.Approve(Ingeschreven);
|
||||
|
||||
Assert.Equal(RegistrationStatus.Ingeschreven, registration.Status);
|
||||
}
|
||||
@@ -113,7 +116,7 @@ public class RegistrationTests
|
||||
{
|
||||
var registration = Registration.Submit("123456782");
|
||||
|
||||
var ex = Assert.Throws<InvalidOperationException>(() => registration.Approve());
|
||||
var ex = Assert.Throws<InvalidOperationException>(() => registration.Approve(Ingeschreven));
|
||||
|
||||
Assert.Contains("no zaak", ex.Message, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.Equal(RegistrationStatus.Ingediend, registration.Status);
|
||||
@@ -124,9 +127,9 @@ public class RegistrationTests
|
||||
{
|
||||
var registration = Registration.Submit("123456782");
|
||||
registration.AttachZaak(new Uri("http://openzaak/zaken/api/v1/zaken/abc"));
|
||||
registration.Approve();
|
||||
registration.Approve(Ingeschreven);
|
||||
|
||||
var ex = Assert.Throws<InvalidOperationException>(() => registration.Approve());
|
||||
var ex = Assert.Throws<InvalidOperationException>(() => registration.Approve(Ingeschreven));
|
||||
Assert.Contains("only an INGEDIEND", ex.Message);
|
||||
Assert.Equal(RegistrationStatus.Ingeschreven, registration.Status);
|
||||
}
|
||||
@@ -157,7 +160,7 @@ public class RegistrationTests
|
||||
{
|
||||
var registration = Registration.Submit("123456782");
|
||||
registration.AttachZaak(new Uri("http://openzaak/zaken/api/v1/zaken/abc"));
|
||||
registration.Approve();
|
||||
registration.Approve(Ingeschreven);
|
||||
|
||||
var ex = Assert.Throws<InvalidOperationException>(() => registration.TakeIntoBehandeling());
|
||||
Assert.Contains("only an INGEDIEND", ex.Message);
|
||||
@@ -171,7 +174,7 @@ public class RegistrationTests
|
||||
registration.AttachZaak(new Uri("http://openzaak/zaken/api/v1/zaken/abc"));
|
||||
registration.TakeIntoBehandeling();
|
||||
|
||||
registration.Approve();
|
||||
registration.Approve(Ingeschreven);
|
||||
|
||||
Assert.Equal(RegistrationStatus.Ingeschreven, registration.Status);
|
||||
}
|
||||
@@ -218,7 +221,7 @@ public class RegistrationTests
|
||||
var approveEx = Assert.Throws<InvalidOperationException>(() =>
|
||||
{
|
||||
registration.AttachZaak(new Uri("http://openzaak/zaken/api/v1/zaken/abc"));
|
||||
registration.Approve();
|
||||
registration.Approve(Ingeschreven);
|
||||
});
|
||||
Assert.Contains("IN_BEHANDELING", approveEx.Message);
|
||||
|
||||
@@ -277,7 +280,7 @@ public class RegistrationTests
|
||||
{
|
||||
var registration = Registration.Submit("123456782");
|
||||
registration.AttachZaak(new Uri("http://openzaak/zaken/api/v1/zaken/abc"));
|
||||
registration.Approve();
|
||||
registration.Approve(Ingeschreven);
|
||||
|
||||
var ex = Assert.Throws<InvalidOperationException>(() => registration.Withdraw());
|
||||
Assert.Contains("only an INGEDIEND", ex.Message);
|
||||
@@ -336,7 +339,7 @@ public class RegistrationTests
|
||||
{
|
||||
var registration = Registration.Submit("123456782");
|
||||
registration.AttachZaak(new Uri("http://openzaak/zaken/api/v1/zaken/abc"));
|
||||
registration.Approve();
|
||||
registration.Approve(Ingeschreven);
|
||||
|
||||
var ex = Assert.Throws<InvalidOperationException>(() => registration.Expire());
|
||||
Assert.Contains("only an INGEDIEND", ex.Message);
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
"mutate": [
|
||||
"!**/OpenZaakJobPump.cs",
|
||||
"!**/BeoordelingEscalatiePump.cs",
|
||||
"!**/RegistratieVerlopenPump.cs"
|
||||
"!**/RegistratieVerlopenPump.cs",
|
||||
"!**/HerregistratieReminderJob.cs"
|
||||
],
|
||||
"thresholds": {
|
||||
"high": 95,
|
||||
|
||||
@@ -40,7 +40,7 @@ public sealed class EenRegistratieBeoordelenSteps
|
||||
|
||||
[When("the behandelaar decides \"(.*)\"")]
|
||||
public async Task WhenTheBehandelaarDecides(string besluit)
|
||||
=> await new BeoordeelRegistratie(_store, _acl, _tasks).HandleAsync(
|
||||
=> await new BeoordeelRegistratie(_store, _acl, _tasks, TimeProvider.System).HandleAsync(
|
||||
new BeoordeelRegistratieCommand(_id, Enum.Parse<BeoordelingsBesluit>(besluit, ignoreCase: true)));
|
||||
|
||||
[Then("the registration has status \"(.*)\"")]
|
||||
|
||||
@@ -221,4 +221,9 @@ public sealed class InMemoryRegistrationStore : IRegistrationStore
|
||||
public Task<Registration?> FindOpenByBsnAsync(string bsn, CancellationToken ct = default)
|
||||
=> Task.FromResult(_byId.Values.FirstOrDefault(r =>
|
||||
r.Bsn == bsn && r.Status is RegistrationStatus.Ingediend or RegistrationStatus.InBehandeling));
|
||||
|
||||
public Task<IReadOnlyList<Registration>> FindDueForHerregistratieReminderAsync(
|
||||
DateTimeOffset asOf, CancellationToken ct = default)
|
||||
=> Task.FromResult<IReadOnlyList<Registration>>(
|
||||
_byId.Values.Where(r => r.HerregistratieReminderDue(asOf)).ToList());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user