* fix(bpmn): let a process with only a plain start event publish (#8078) An imported root BpmnProcess is an ITrigger with CanStartWorkflow set (IsRootScope). For a process whose start events carry no event definition it rightly returns no payloads, but TriggerIndexer then stored a null-payload placeholder row and ValidateWorkflowRequestHandler refused publication with "Trigger should have a payload". That blocked import, bind, publish and run for most Camunda models. Adds an additive, opt-in seam: TriggerIndexingContext.RegistersNoTriggers. A trigger that sets it and returns no payloads gets no row. It has no effect when the trigger returns payloads, and a trigger that throws still gets the placeholder, so a failure is never read as a deliberate decline. Every other ITrigger indexes exactly as before. BpmnProcess sets it only for a root scope none of whose start events carries an event definition. A declared start that resolves to nothing, such as a process whose only start is a refused timer, keeps the placeholder and still fails publication. Nested scopes are opted out before that check and are unchanged, and IsRootScope/CanStartWorkflow semantics are untouched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * test(bpmn): publish for real in the stale-after-publish tests Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * test(bpmn): name the publish helper for what it does Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
24 lines
1.1 KiB
C#
24 lines
1.1 KiB
C#
using Elsa.Workflows.Management;
|
|
using Xunit;
|
|
|
|
namespace Elsa.Bpmn.Interchange.IntegrationTests.Support;
|
|
|
|
/// <summary>
|
|
/// Publishes the latest version of a definition through the real <see cref="IWorkflowDefinitionPublisher"/> — the
|
|
/// one place every test that needs a published-then-edited definition goes through, rather than each duplicating
|
|
/// this call and its success assertion.
|
|
/// </summary>
|
|
internal static class DefinitionPublishing
|
|
{
|
|
/// <summary>
|
|
/// Publishes the latest version of <paramref name="definitionId"/> via <paramref name="publisher"/>, asserting
|
|
/// success so a refusal — e.g. #8078's "Trigger should have a payload" for a none-start BPMN process — fails the
|
|
/// test loudly with the publisher's own validation messages rather than leaving the definition unpublished.
|
|
/// </summary>
|
|
public static async Task PublishLatestAsync(IWorkflowDefinitionPublisher publisher, string definitionId)
|
|
{
|
|
var result = await publisher.PublishAsync(definitionId);
|
|
Assert.True(result.Succeeded, string.Join("; ", result.ValidationErrors.Select(e => e.Message)));
|
|
}
|
|
}
|