moved workflowtesting module into folder, fixed number of warnings (#2603)

This commit is contained in:
Konstantins Vedenins 2021-12-20 11:21:34 +02:00 committed by GitHub
parent 8e9bee5283
commit 834475cfca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 51 additions and 41 deletions

View file

@ -371,9 +371,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.Retention", "src\modul
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflowtesting", "workflowtesting", "{1B0F0880-8390-4A1C-9AE8-D13427626794}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.WorkflowTesting", "src\modules\Elsa.WorkflowTesting\Elsa.WorkflowTesting.csproj", "{0327324E-0B80-4A6A-A7D6-DD521657666F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.WorkflowTesting", "src\modules\workflowtesting\Elsa.WorkflowTesting\Elsa.WorkflowTesting.csproj", "{0327324E-0B80-4A6A-A7D6-DD521657666F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.WorkflowTesting.Api", "src\modules\Elsa.WorkflowTesting.Api\Elsa.WorkflowTesting.Api.csproj", "{4A4DC44E-D50F-49B8-A9DE-DED26FC05166}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.WorkflowTesting.Api", "src\modules\workflowtesting\Elsa.WorkflowTesting.Api\Elsa.WorkflowTesting.Api.csproj", "{4A4DC44E-D50F-49B8-A9DE-DED26FC05166}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.Samples.UniqueCorrelatedWorkflows", "src\samples\aspnet\Elsa.Samples.UniqueCorrelatedWorkflows\Elsa.Samples.UniqueCorrelatedWorkflows.csproj", "{4CD8293D-4544-4A23-BDEF-15B66D5E924F}"
EndProject

View file

@ -4,11 +4,21 @@
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Elsa.Activities.RabbitMq</RootNamespace>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<Authors>Elsa Contributors</Authors>
<Description>Elsa is a set of workflow libraries and tools that enable lean and mean workflowing capabilities in any .NET Core application.
This package provides activities to send and receive messages using Rabbit MQ.</Description>
<Copyright>2021</Copyright>
<PackageProjectUrl>https://github.com/elsa-workflows/elsa-core</PackageProjectUrl>
<RepositoryUrl>https://github.com/elsa-workflows/elsa-core</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>elsa, workflows</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\Elsa.Core\Elsa.Core.csproj" />
<ProjectReference Include="..\..\modules\Elsa.WorkflowTesting\Elsa.WorkflowTesting.csproj" />
<ProjectReference Include="..\..\modules\workflowtesting\Elsa.WorkflowTesting\Elsa.WorkflowTesting.csproj" />
</ItemGroup>
<ItemGroup>

View file

@ -15,7 +15,7 @@ namespace Elsa.Activities.RabbitMq.Services
public class Client : IClient
{
private BuiltinHandlerActivator _activator;
private IBus _bus;
private IBus? _bus;
public RabbitMqBusConfiguration Configuration { get; }
@ -53,7 +53,7 @@ namespace Elsa.Activities.RabbitMq.Services
{
if (_bus == null) ConfigureAsOneWayClient();
await _bus.Advanced.Topics.Publish(Configuration.RoutingKey, message, Configuration.Headers);
await _bus!.Advanced.Topics.Publish(Configuration.RoutingKey, message, Configuration.Headers);
}
public void Dispose()
@ -63,13 +63,13 @@ namespace Elsa.Activities.RabbitMq.Services
public void StartClient()
{
if (_bus.Advanced.Workers.Count == 0)
if (_bus?.Advanced.Workers.Count == 0)
_bus.Advanced.Workers.SetNumberOfWorkers(1);
}
public void StopClient()
{
if (_bus.Advanced.Workers.Count == 1)
if (_bus?.Advanced.Workers.Count == 1)
_bus.Advanced.Workers.SetNumberOfWorkers(0);
}

View file

@ -97,7 +97,7 @@ namespace Elsa.Activities.RabbitMq.Services
var routingKey = await activity.EvaluatePropertyValueAsync(x => x.RoutingKey, cancellationToken);
var headers = await activity.EvaluatePropertyValueAsync(x => x.Headers, cancellationToken);
var config = new RabbitMqBusConfiguration(connectionString, routingKey, headers);
var config = new RabbitMqBusConfiguration(connectionString!, routingKey!, headers!);
yield return config!;
}

View file

@ -1,5 +1,5 @@
using Elsa.Events;
using Elsa.Testing.Events;
using Elsa.WorkflowTesting.Events;
using MediatR;
using System;
using System.Threading;

View file

@ -1,9 +0,0 @@
namespace Elsa.WorkflowTesting.Api.Models
{
public class WorkflowTestExecuteRequest
{
public string? WorkflowDefinitionId { get; init; }
public int Version { get; init; }
public string? SignalRConnectionId { get; init; }
}
}

View file

@ -1,8 +0,0 @@
namespace Elsa.WorkflowTesting.Api.Models
{
public class WorkflowTestRestartFromActivityRequest : WorkflowTestExecuteRequest
{
public string ActivityId { get; init; }
public string LastWorkflowInstanceId { get; init; }
}
}

View file

@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\server\Elsa.Server.Api\Elsa.Server.Api.csproj" />
<ProjectReference Include="..\..\..\server\Elsa.Server.Api\Elsa.Server.Api.csproj" />
<ProjectReference Include="..\Elsa.WorkflowTesting\Elsa.WorkflowTesting.csproj" />
</ItemGroup>

View file

@ -1,6 +1,6 @@
using Elsa.Server.Api.ActionFilters;
using Elsa.Testing.Api.Models;
using Elsa.Testing.Events;
using Elsa.WorkflowTesting.Events;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

View file

@ -0,0 +1,9 @@
namespace Elsa.WorkflowTesting.Api.Models
{
public class WorkflowTestExecuteRequest
{
public string WorkflowDefinitionId { get; init; } = default!;
public int Version { get; init; }
public string SignalRConnectionId { get; init; } = default!;
}
}

View file

@ -0,0 +1,8 @@
namespace Elsa.WorkflowTesting.Api.Models
{
public class WorkflowTestRestartFromActivityRequest : WorkflowTestExecuteRequest
{
public string ActivityId { get; init; } = default!;
public string LastWorkflowInstanceId { get; init; } = default!;
}
}

View file

@ -2,6 +2,6 @@ namespace Elsa.Testing.Api.Models
{
public class WorkflowTestStopRequest
{
public string WorkflowInstanceId { get; init; }
public string WorkflowInstanceId { get; init; } = default!;
}
}

View file

@ -11,8 +11,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\Elsa.Abstractions\Elsa.Abstractions.csproj" />
<ProjectReference Include="..\..\core\Elsa.Core\Elsa.Core.csproj" />
<ProjectReference Include="..\..\..\core\Elsa.Abstractions\Elsa.Abstractions.csproj" />
<ProjectReference Include="..\..\..\core\Elsa.Core\Elsa.Core.csproj" />
</ItemGroup>
</Project>

View file

@ -1,6 +1,6 @@
using MediatR;
namespace Elsa.Testing.Events
namespace Elsa.WorkflowTesting.Events
{
public class WorkflowTestExecutionStopped : INotification
{

View file

@ -54,7 +54,7 @@ namespace Elsa.WorkflowTesting.Services
var workflow = await InstantiateStartableWorkflow(startableWorkflowDefinition, cancellationToken);
var previousActivityData = GetActivityDataFromLastWorkflowInstance(workflow.WorkflowInstance, lastWorkflowInstance, workflowBlueprint, activityId);
var previousActivityData = GetActivityDataFromLastWorkflowInstance(lastWorkflowInstance, workflowBlueprint, activityId);
MergeActivityDataIntoInstance(workflow.WorkflowInstance, previousActivityData);
@ -80,7 +80,7 @@ namespace Elsa.WorkflowTesting.Services
}
}
private IDictionary<string, IDictionary<string, object?>> GetActivityDataFromLastWorkflowInstance(WorkflowInstance currentWorkflowInstance, WorkflowInstance lastWorkflowInstance, IWorkflowBlueprint workflowBlueprint, string startingActivityId)
private IDictionary<string, IDictionary<string, object?>> GetActivityDataFromLastWorkflowInstance(WorkflowInstance lastWorkflowInstance, IWorkflowBlueprint workflowBlueprint, string startingActivityId)
{
IDictionary<string, IDictionary<string, object?>> CollectSourceActivityData(string targetActivityId, IDictionary<string, IDictionary<string, object?>> activityDataAccumulator)
{

View file

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\..\..\configureawait.props" />
<PropertyGroup>
@ -37,8 +37,8 @@
<ProjectReference Include="..\..\..\locking\Elsa.DistributedLocking.AzureBlob\Elsa.DistributedLocking.AzureBlob.csproj" />
<ProjectReference Include="..\..\..\locking\Elsa.DistributedLocking.Redis\Elsa.DistributedLocking.Redis.csproj" />
<ProjectReference Include="..\..\..\locking\Elsa.DistributedLocking.SqlServer\Elsa.DistributedLocking.SqlServer.csproj" />
<ProjectReference Include="..\..\..\modules\Elsa.WorkflowTesting.Api\Elsa.WorkflowTesting.Api.csproj" />
<ProjectReference Include="..\..\..\modules\Elsa.WorkflowTesting\Elsa.WorkflowTesting.csproj" />
<ProjectReference Include="..\..\..\modules\workflowtesting\Elsa.WorkflowTesting.Api\Elsa.WorkflowTesting.Api.csproj" />
<ProjectReference Include="..\..\..\modules\workflowtesting\Elsa.WorkflowTesting\Elsa.WorkflowTesting.csproj" />
<ProjectReference Include="..\..\..\modules\retention\Elsa.Retention\Elsa.Retention.csproj" />
<ProjectReference Include="..\..\..\modules\workflowsettings\Elsa.WorkflowSettings.Api\Elsa.WorkflowSettings.Api.csproj" />
<ProjectReference Include="..\..\..\modules\workflowsettings\Elsa.WorkflowSettings.Persistence.EntityFramework.MySql\Elsa.WorkflowSettings.Persistence.EntityFramework.MySql.csproj" />

View file

@ -19,7 +19,7 @@ namespace Elsa.Samples.RabbitMqWorker.Workflows
{
builder
.Timer(Duration.FromSeconds(5))
.MessageReceived(_connectionString, "Podcasts.Weather", null)
.MessageReceived(_connectionString, "Podcasts.Weather", default!)
.WriteLine(context =>
{
var message = context.GetInput<string>();

View file

@ -20,7 +20,7 @@ namespace Elsa.Samples.RabbitMqWorker.Workflows
builder
.Timer(Duration.FromSeconds(5))
.WriteLine("Sending a weather update with the \"Podcasts.Weather\" topic.")
.SendTopicMessage(_connectionString, "Podcasts.Weather", null, "Cloudy with a chance of meatballs");
.SendTopicMessage(_connectionString, "Podcasts.Weather", default!, "Cloudy with a chance of meatballs");
}
}
}

View file

@ -21,8 +21,8 @@ namespace Elsa.Samples.RabbitMqWorker.Workflows
return $"Start! - correlationId: {correlationId}";
})
.SendTopicMessage(_connectionString, "Greetings", null, "Greetings from RabbitMQ")
.MessageReceived(_connectionString, "Greetings", null)
.SendTopicMessage(_connectionString, "Greetings", default!, "Greetings from RabbitMQ")
.MessageReceived(_connectionString, "Greetings", default!)
.WriteLine(ctx => "End: " + (string)ctx.Input);
}