< Summary

Information
Class: Elsa.Scheduling.Features.SchedulingFeature
Assembly: Elsa.Scheduling
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Scheduling/Features/SchedulingFeature.cs
Line coverage
100%
Covered lines: 33
Uncovered lines: 0
Coverable lines: 33
Total lines: 73
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_WorkflowScheduler()100%11100%
get_CronParser()100%11100%
Apply()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Scheduling/Features/SchedulingFeature.cs

#LineLine coverage
 1using Elsa.Common.Features;
 2using Elsa.Common.Multitenancy;
 3using Elsa.Expressions.Options;
 4using Elsa.Extensions;
 5using Elsa.Features.Abstractions;
 6using Elsa.Features.Attributes;
 7using Elsa.Features.Services;
 8using Elsa.Scheduling.Bookmarks;
 9using Elsa.Scheduling.Handlers;
 10using Elsa.Scheduling.Services;
 11using Elsa.Scheduling.StartupTasks;
 12using Elsa.Scheduling.TriggerPayloadValidators;
 13using Elsa.Workflows.Management.Features;
 14using Microsoft.Extensions.DependencyInjection;
 15
 16namespace Elsa.Scheduling.Features;
 17
 18/// <summary>
 19/// Provides scheduling features to the system.
 20/// </summary>
 21[DependsOn(typeof(SystemClockFeature))]
 22public class SchedulingFeature : FeatureBase
 23{
 24    /// <inheritdoc />
 21325    public SchedulingFeature(IModule module) : base(module)
 26    {
 21327    }
 28
 29    /// <summary>
 30    /// Gets or sets the trigger scheduler.
 31    /// </summary>
 105032    public Func<IServiceProvider, IWorkflowScheduler> WorkflowScheduler { get; set; } = sp => sp.GetRequiredService<Defa
 33
 34    /// <summary>
 35    /// Gets or sets the CRON parser.
 36    /// </summary>
 42937    public Func<IServiceProvider, ICronParser> CronParser { get; set; } = sp => sp.GetRequiredService<CronosCronParser>(
 38
 39    /// <inheritdoc />
 40    public override void Apply()
 41    {
 21342        Services
 21343            .AddSingleton<UpdateTenantSchedules>()
 7244            .AddSingleton<ITenantDeletedEvent>(sp => sp.GetRequiredService<UpdateTenantSchedules>())
 21345            .AddSingleton<IScheduler, LocalScheduler>()
 21346            .AddSingleton<CronosCronParser>()
 21347            .AddSingleton(CronParser)
 21348            .AddScoped<ITriggerScheduler, DefaultTriggerScheduler>()
 21349            .AddScoped<IBookmarkScheduler, DefaultBookmarkScheduler>()
 21350            .AddScoped<DefaultWorkflowScheduler>()
 21351            .AddScoped(WorkflowScheduler)
 21352            .AddStartupTask<CreateSchedulesStartupTask>()
 21353            .AddHandlersFrom<ScheduleWorkflows>()
 21354
 21355            //Trigger payload validators.
 21356            .AddTriggerPayloadValidator<CronTriggerPayloadValidator, CronTriggerPayload>()
 21357
 21358            // Graceful shutdown: register scheduled-trigger ingress for diagnostic visibility (FR-006).
 21359            .AddSingleton<Elsa.Workflows.Runtime.IIngressSource, Elsa.Scheduling.IngressSources.ScheduledTriggerIngressS
 60
 21361        Services.Configure<ExpressionOptions>(options =>
 21362        {
 19363            options.AddTypeAlias<CronBookmarkPayload>();
 19364            options.AddTypeAlias<CronTriggerPayload>();
 19365            options.AddTypeAlias<DelayPayload>();
 19366            options.AddTypeAlias<StartAtPayload>();
 19367            options.AddTypeAlias<TimerBookmarkPayload>();
 19368            options.AddTypeAlias<TimerTriggerPayload>();
 40669        });
 70
 42671        Module.Configure<WorkflowManagementFeature>(management => management.AddActivitiesFrom<SchedulingFeature>());
 21372    }
 73}