Add project files.

This commit is contained in:
2025-08-18 17:11:43 +03:30
parent 807dc263be
commit e5eb10d604
3943 changed files with 223719 additions and 0 deletions
@@ -0,0 +1,84 @@
using Elsa.Testing.Shared;
using Xunit.Abstractions;
namespace Elsa.Workflows.IntegrationTests.Scenarios.ParentChildOutputMapping;
/// <summary>
/// Tests for mapping an activity's output directly to the workflow's output definition.
/// </summary>
public class Tests
{
private readonly CapturingTextWriter _capturingTextWriter = new();
private readonly IServiceProvider _services;
public Tests(ITestOutputHelper testOutputHelper)
{
_services = new TestApplicationBuilder(testOutputHelper).WithCapturingTextWriter(_capturingTextWriter).Build();
}
[Fact(DisplayName = "Parent workflow receives output from child workflow.")]
public async Task Test1()
{
// Populate registries.
await _services.PopulateRegistriesAsync();
// Import child workflow.
var sumFileName = "Scenarios/ParentChildOutputMapping/Workflows/sum.json";
await _services.ImportWorkflowDefinitionAsync(sumFileName);
// Import parent workflow.
var calculatorFileName = "Scenarios/ParentChildOutputMapping/Workflows/calculator.json";
var workflowDefinition = await _services.ImportWorkflowDefinitionAsync(calculatorFileName);
// Execute.
await _services.RunWorkflowUntilEndAsync(workflowDefinition.DefinitionId);
// Assert expected output.
var lines = _capturingTextWriter.Lines.ToList();
Assert.Equal(new[] { "Result: 9" }, lines);
}
[Fact(DisplayName = "Multiple parent/child workflows receive output from child workflows even when using same output names.")]
public async Task Test2()
{
// Populate registries.
await _services.PopulateRegistriesAsync();
// Import workflows.
await _services.ImportWorkflowDefinitionAsync("Scenarios/ParentChildOutputMapping/Workflows/a.json");
await _services.ImportWorkflowDefinitionAsync("Scenarios/ParentChildOutputMapping/Workflows/b.json");
await _services.ImportWorkflowDefinitionAsync("Scenarios/ParentChildOutputMapping/Workflows/c.json");
// Import root workflow.
var workflowDefinition = await _services.ImportWorkflowDefinitionAsync("Scenarios/ParentChildOutputMapping/Workflows/d.json");
// Execute.
await _services.RunWorkflowUntilEndAsync(workflowDefinition.DefinitionId);
// Assert expected output.
var lines = _capturingTextWriter.Lines.ToList();
Assert.Equal(new[] { "FooBar" }, lines);
}
[Fact(DisplayName = "Parent workflow receives output from child workflow when using SetOutput activity.")]
public async Task Test3()
{
// Populate registries.
await _services.PopulateRegistriesAsync();
// Import child workflow.
var producerFileName = "Scenarios/ParentChildOutputMapping/Workflows/producer.json";
await _services.ImportWorkflowDefinitionAsync(producerFileName);
// Import parent workflow.
var consumerFileName = "Scenarios/ParentChildOutputMapping/Workflows/consumer.json";
var workflowDefinition = await _services.ImportWorkflowDefinitionAsync(consumerFileName);
// Execute.
await _services.RunWorkflowUntilEndAsync(workflowDefinition.DefinitionId);
// Assert expected output.
var lines = _capturingTextWriter.Lines.ToList();
Assert.Equal(new[] { "Foo" }, lines);
}
}
@@ -0,0 +1,89 @@
{
"id": "5d8015cea7b44c96",
"definitionId": "7fe314161d2d2ac6",
"name": "A",
"createdAt": "2023-11-15T13:55:38.86581+00:00",
"version": 1,
"toolVersion": "3.0.0.0",
"variables": [],
"inputs": [],
"outputs": [
{
"type": "Object",
"name": "Output1",
"displayName": "Output 1",
"category": "Primitives",
"isArray": false
}
],
"outcomes": [],
"customProperties": {
"Elsa:WorkflowContextProviderTypes": []
},
"isReadonly": false,
"isLatest": true,
"isPublished": true,
"options": {
"usableAsActivity": true,
"autoUpdateConsumingWorkflows": true
},
"root": {
"type": "Elsa.Flowchart",
"version": 1,
"id": "d84ccfca1b90bc0c",
"nodeId": "Workflow1:d84ccfca1b90bc0c",
"metadata": {},
"customProperties": {
"source": "FlowchartJsonConverter.cs:47",
"notFoundConnections": [],
"canStartWorkflow": false,
"runAsynchronously": false
},
"activities": [
{
"outputName": {
"typeName": "String",
"expression": {
"type": "Literal",
"value": "Output1"
},
"memoryReference": {
"id": "a6389a28e986c6ff:input-0"
}
},
"outputValue": {
"typeName": "Object",
"expression": {
"type": "Literal",
"value": "Foo"
},
"memoryReference": {
"id": "a6389a28e986c6ff:input-1"
}
},
"id": "a6389a28e986c6ff",
"nodeId": "Workflow1:d84ccfca1b90bc0c:a6389a28e986c6ff",
"name": "SetOutput1",
"type": "Elsa.SetOutput",
"version": 1,
"customProperties": {
"canStartWorkflow": false,
"runAsynchronously": false
},
"metadata": {
"designer": {
"position": {
"x": -60,
"y": 240
},
"size": {
"width": 107.734375,
"height": 50
}
}
}
}
],
"connections": []
}
}
@@ -0,0 +1,86 @@
{
"id": "d5221501eeb78037",
"definitionId": "8c751e0c53821439",
"name": "B",
"createdAt": "2023-11-15T13:59:18.773434+00:00",
"version": 1,
"toolVersion": "3.0.0.0",
"variables": [],
"inputs": [],
"outputs": [
{
"type": "Object",
"name": "Output1",
"displayName": "Output 1",
"category": "Primitives",
"isArray": false
}
],
"outcomes": [],
"customProperties": {
"Elsa:WorkflowContextProviderTypes": []
},
"isReadonly": false,
"isLatest": true,
"isPublished": true,
"options": {
"usableAsActivity": true,
"autoUpdateConsumingWorkflows": true
},
"root": {
"type": "Elsa.Flowchart",
"version": 1,
"id": "49a24a01a4c318de",
"nodeId": "Workflow1:49a24a01a4c318de",
"metadata": {},
"customProperties": {
"source": "FlowchartJsonConverter.cs:47",
"notFoundConnections": [],
"canStartWorkflow": false,
"runAsynchronously": false
},
"activities": [
{
"script": {
"typeName": "String",
"expression": {
"type": "Literal",
"value": "return \u0022Bar\u0022;"
},
"memoryReference": {
"id": "247da1e267d76f80:input-0"
}
},
"possibleOutcomes": null,
"result": {
"typeName": "Object",
"memoryReference": {
"id": "Output1"
}
},
"id": "247da1e267d76f80",
"nodeId": "Workflow1:49a24a01a4c318de:247da1e267d76f80",
"name": "RunCSharp1",
"type": "Elsa.RunCSharp",
"version": 1,
"customProperties": {
"canStartWorkflow": false,
"runAsynchronously": false
},
"metadata": {
"designer": {
"position": {
"x": -200,
"y": -140
},
"size": {
"width": 83.640625,
"height": 50
}
}
}
}
],
"connections": []
}
}
@@ -0,0 +1,130 @@
{
"id": "c4041d72854d317c",
"definitionId": "8472bcf9ca261e55",
"name": "C",
"createdAt": "2023-11-15T14:05:30.708042+00:00",
"version": 6,
"toolVersion": "3.0.0.0",
"variables": [],
"inputs": [],
"outputs": [
{
"type": "Object",
"name": "Output1",
"displayName": "Output 1",
"category": "Primitives",
"isArray": false
},
{
"type": "Object",
"name": "Output2",
"displayName": "Output 2",
"category": "Primitives",
"isArray": false
}
],
"outcomes": [],
"customProperties": {
"Elsa:WorkflowContextProviderTypes": []
},
"isReadonly": false,
"isLatest": true,
"isPublished": true,
"options": {
"usableAsActivity": true,
"autoUpdateConsumingWorkflows": true
},
"root": {
"type": "Elsa.Flowchart",
"version": 1,
"id": "6ee60c9988b58904",
"nodeId": "Workflow1:6ee60c9988b58904",
"metadata": {},
"customProperties": {
"source": "FlowchartJsonConverter.cs:47",
"notFoundConnections": [],
"canStartWorkflow": false,
"runAsynchronously": false
},
"activities": [
{
"workflowDefinitionId": "7fe314161d2d2ac6",
"workflowDefinitionVersionId": "5d8015cea7b44c96",
"latestAvailablePublishedVersion": 1,
"latestAvailablePublishedVersionId": "5d8015cea7b44c96",
"id": "67daca2a2fc729b6",
"nodeId": "Workflow1:6ee60c9988b58904:67daca2a2fc729b6",
"name": "A1",
"type": "A",
"version": 1,
"customProperties": {
"canStartWorkflow": false,
"runAsynchronously": false
},
"metadata": {
"designer": {
"position": {
"x": -311.5,
"y": -145
},
"size": {
"width": 41.59375,
"height": 50
}
}
},
"output1": {
"typeName": "Object",
"memoryReference": {
"id": "Output1"
}
}
},
{
"workflowDefinitionId": "8c751e0c53821439",
"workflowDefinitionVersionId": "d5221501eeb78037",
"latestAvailablePublishedVersion": 1,
"latestAvailablePublishedVersionId": "d5221501eeb78037",
"id": "d152d5815dcdea0d",
"nodeId": "Workflow1:6ee60c9988b58904:d152d5815dcdea0d",
"name": "B1",
"type": "B",
"version": 1,
"customProperties": {
"canStartWorkflow": false,
"runAsynchronously": false
},
"metadata": {
"designer": {
"position": {
"x": -194.5,
"y": -145
},
"size": {
"width": 41.125,
"height": 50
}
}
},
"output1": {
"typeName": "Object",
"memoryReference": {
"id": "Output2"
}
}
}
],
"connections": [
{
"source": {
"activity": "67daca2a2fc729b6",
"port": "Done"
},
"target": {
"activity": "d152d5815dcdea0d",
"port": "In"
}
}
]
}
}
@@ -0,0 +1,137 @@
{
"id": "Wv2qJngeBUy6nauIj3WZxg",
"definitionId": "g-yf4Gck40S_T1E5pW8OVA",
"name": "Calculator",
"createdAt": "2023-10-18T17:22:19.425264+00:00",
"version": 5,
"toolVersion": "3.0.0.0",
"variables": [
{
"id": "1a3c8e08fbf04b42b01f5df8e6296b74",
"name": "TheSum",
"typeName": "Int32",
"isArray": false,
"storageDriverTypeName": "Elsa.Workflows.Services.WorkflowStorageDriver, Elsa.Workflows.Core"
}
],
"inputs": [],
"outputs": [],
"outcomes": [],
"customProperties": {},
"isReadonly": false,
"isLatest": true,
"isPublished": true,
"options": {
"autoUpdateConsumingWorkflows": false
},
"root": {
"type": "Elsa.Flowchart",
"version": 1,
"id": "GGOfdS1e60-vuDvSskzt6A",
"metadata": {},
"customProperties": {
"source": "FlowchartJsonConverter.cs:46",
"notFoundConnections": [],
"canStartWorkflow": false,
"runAsynchronously": false
},
"activities": [
{
"workflowDefinitionId": "P4X-srRSDUeKpFHiDXMW-w",
"workflowDefinitionVersionId": "E02197RyVk6VyofGoO6YJQ",
"latestAvailablePublishedVersion": 3,
"latestAvailablePublishedVersionId": "E02197RyVk6VyofGoO6YJQ",
"id": "WDS8owJicUuwae0D5GPbZw",
"name": "Sum1",
"type": "Sum",
"version": 3,
"customProperties": {
"canStartWorkflow": false,
"runAsynchronously": false
},
"metadata": {
"designer": {
"position": {
"x": -150.5,
"y": -173
},
"size": {
"width": 94.765625,
"height": 116.015625
}
}
},
"a": {
"typeName": "Int32",
"expression": {
"type": "Literal",
"value": "4"
},
"memoryReference": {
"id": "WDS8owJicUuwae0D5GPbZw:input-0"
}
},
"b": {
"typeName": "Int32",
"expression": {
"type": "Literal",
"value": "5"
},
"memoryReference": {
"id": "WDS8owJicUuwae0D5GPbZw:input-1"
}
},
"result": {
"typeName": "Int32",
"memoryReference": {
"id": "1a3c8e08fbf04b42b01f5df8e6296b74"
}
}
},
{
"text": {
"typeName": "String",
"expression": {
"type": "JavaScript",
"value": "\u0060Result: ${getTheSum()}\u0060"
},
"memoryReference": {
"id": "NDqbEDwcIUu7zJ0FDxbHdg:input-0"
}
},
"id": "NDqbEDwcIUu7zJ0FDxbHdg",
"name": "WriteLine1",
"type": "Elsa.WriteLine",
"version": 1,
"customProperties": {
"canStartWorkflow": false,
"runAsynchronously": false
},
"metadata": {
"designer": {
"position": {
"x": 80,
"y": -139.9921875
},
"size": {
"width": 139.296875,
"height": 50
}
}
}
}
],
"connections": [
{
"source": {
"activity": "WDS8owJicUuwae0D5GPbZw",
"port": "Done"
},
"target": {
"activity": "NDqbEDwcIUu7zJ0FDxbHdg",
"port": "In"
}
}
]
}
}
@@ -0,0 +1,125 @@
{
"id": "cae99c483081a2c",
"definitionId": "a7e44620e65e7184",
"name": "Consumer",
"createdAt": "2023-11-17T19:47:21.937582+00:00",
"version": 3,
"toolVersion": "3.0.0.0",
"variables": [
{
"id": "137ac38a229059f0",
"name": "Variable1",
"typeName": "Object",
"isArray": false,
"storageDriverTypeName": "Elsa.Workflows.Services.WorkflowStorageDriver, Elsa.Workflows.Core"
}
],
"inputs": [],
"outputs": [],
"outcomes": [],
"customProperties": {
"Elsa:WorkflowContextProviderTypes": []
},
"isReadonly": false,
"isLatest": true,
"isPublished": true,
"options": {
"usableAsActivity": false,
"autoUpdateConsumingWorkflows": true
},
"root": {
"type": "Elsa.Flowchart",
"version": 1,
"id": "cv7o3nnxp1dkxp1n",
"nodeId": "Workflow1:cv7o3nnxp1dkxp1n",
"metadata": {
"displayText": "Flowchart1"
},
"customProperties": {
"source": "FlowchartJsonConverter.cs:47",
"notFoundConnections": [],
"canStartWorkflow": false,
"runAsynchronously": false
},
"activities": [
{
"workflowDefinitionId": "69d6496437ff9d33",
"workflowDefinitionVersionId": "5c020d0052fb2860",
"latestAvailablePublishedVersion": 2,
"latestAvailablePublishedVersionId": "5c020d0052fb2860",
"id": "xcyl3fg7gg2uxcd4",
"nodeId": "Workflow1:cv7o3nnxp1dkxp1n:xcyl3fg7gg2uxcd4",
"name": "InternalPremiumCalculationGeneric1",
"type": "Producer",
"version": 2,
"customProperties": {
"canStartWorkflow": false,
"runAsynchronously": false
},
"metadata": {
"designer": {
"position": {
"x": 2280,
"y": 2420
},
"size": {
"width": 318.140625,
"height": 50
}
}
},
"output1": {
"typeName": "Object",
"memoryReference": {
"id": "137ac38a229059f0"
}
}
},
{
"text": {
"typeName": "String",
"expression": {
"type": "CSharp",
"value": "return Variables.Variable1.ToString();"
},
"memoryReference": {
"id": "b3b9071594676f52:input-0"
}
},
"id": "b3b9071594676f52",
"nodeId": "Workflow1:cv7o3nnxp1dkxp1n:b3b9071594676f52",
"name": "WriteLine1",
"type": "Elsa.WriteLine",
"version": 1,
"customProperties": {
"canStartWorkflow": false,
"runAsynchronously": false
},
"metadata": {
"designer": {
"position": {
"x": 2695.5703125,
"y": 2420
},
"size": {
"width": 139.296875,
"height": 50
}
}
}
}
],
"connections": [
{
"source": {
"activity": "xcyl3fg7gg2uxcd4",
"port": "Done"
},
"target": {
"activity": "b3b9071594676f52",
"port": "In"
}
}
]
}
}
@@ -0,0 +1,135 @@
{
"id": "cbf12a4a3d1a52ef",
"definitionId": "133353946cd83e1d",
"name": "D",
"createdAt": "2023-11-15T14:07:04.052579+00:00",
"version": 1,
"toolVersion": "3.0.0.0",
"variables": [
{
"id": "f1106ece80fd17a8",
"name": "Variable1",
"typeName": "Object",
"isArray": false,
"storageDriverTypeName": "Elsa.Workflows.Services.WorkflowStorageDriver, Elsa.Workflows.Core"
},
{
"id": "3a8b25edc9bf109",
"name": "Variable2",
"typeName": "Object",
"isArray": false,
"storageDriverTypeName": "Elsa.Workflows.Services.WorkflowStorageDriver, Elsa.Workflows.Core"
}
],
"inputs": [],
"outputs": [],
"outcomes": [],
"customProperties": {
"Elsa:WorkflowContextProviderTypes": []
},
"isReadonly": false,
"isLatest": true,
"isPublished": true,
"options": {
"autoUpdateConsumingWorkflows": false
},
"root": {
"type": "Elsa.Flowchart",
"version": 1,
"id": "26838161a6f32e2e",
"nodeId": "Workflow1:26838161a6f32e2e",
"metadata": {},
"customProperties": {
"source": "FlowchartJsonConverter.cs:47",
"notFoundConnections": [],
"canStartWorkflow": false,
"runAsynchronously": false
},
"activities": [
{
"workflowDefinitionId": "8472bcf9ca261e55",
"workflowDefinitionVersionId": "c4041d72854d317c",
"latestAvailablePublishedVersion": 6,
"latestAvailablePublishedVersionId": "c4041d72854d317c",
"id": "db7bda6a28d8de82",
"nodeId": "Workflow1:26838161a6f32e2e:db7bda6a28d8de82",
"name": "C1",
"type": "C",
"version": 6,
"customProperties": {
"canStartWorkflow": false,
"runAsynchronously": false
},
"metadata": {
"designer": {
"position": {
"x": -298.5,
"y": -168
},
"size": {
"width": 41.578125,
"height": 50
}
}
},
"output1": {
"typeName": "Object",
"memoryReference": {
"id": "f1106ece80fd17a8"
}
},
"output2": {
"typeName": "Object",
"memoryReference": {
"id": "3a8b25edc9bf109"
}
}
},
{
"text": {
"typeName": "String",
"expression": {
"type": "CSharp",
"value": "return $\u0022{Variables.Variable1}{Variables.Variable2}\u0022;"
},
"memoryReference": {
"id": "a815c4cf1e668419:input-0"
}
},
"id": "a815c4cf1e668419",
"nodeId": "Workflow1:26838161a6f32e2e:a815c4cf1e668419",
"name": "WriteLine1",
"type": "Elsa.WriteLine",
"version": 1,
"customProperties": {
"canStartWorkflow": false,
"runAsynchronously": false
},
"metadata": {
"designer": {
"position": {
"x": -139.5,
"y": -168
},
"size": {
"width": 139.296875,
"height": 50
}
}
}
}
],
"connections": [
{
"source": {
"activity": "db7bda6a28d8de82",
"port": "Done"
},
"target": {
"activity": "a815c4cf1e668419",
"port": "In"
}
}
]
}
}
@@ -0,0 +1,92 @@
{
"id": "5c020d0052fb2860",
"definitionId": "69d6496437ff9d33",
"name": "Producer",
"createdAt": "2023-11-17T19:45:52.798011+00:00",
"version": 2,
"toolVersion": "3.0.0.0",
"variables": [],
"inputs": [],
"outputs": [
{
"type": "Object",
"name": "Output1",
"displayName": "Output 1",
"category": "Primitives",
"isArray": false
}
],
"outcomes": [],
"customProperties": {
"Elsa:WorkflowContextProviderTypes": []
},
"isReadonly": false,
"isLatest": true,
"isPublished": true,
"options": {
"usableAsActivity": true,
"autoUpdateConsumingWorkflows": true
},
"root": {
"type": "Elsa.Flowchart",
"version": 1,
"id": "nn98bbdkmvkbkuda",
"nodeId": "Workflow1:nn98bbdkmvkbkuda",
"metadata": {
"displayText": "Flowchart1"
},
"customProperties": {
"source": "FlowchartJsonConverter.cs:47",
"notFoundConnections": [],
"canStartWorkflow": false,
"runAsynchronously": false
},
"activities": [
{
"outputName": {
"typeName": "String",
"expression": {
"type": "Literal",
"value": "Output1"
},
"memoryReference": {
"id": "825749ed-b1ad-48f0-aa51-f739c71420a4"
}
},
"outputValue": {
"typeName": "Object",
"expression": {
"type": "Literal",
"value": "Foo"
},
"memoryReference": {
"id": "427d771a-a3e2-4a1c-bb40-c1f4ccf3d0c7"
}
},
"id": "4c9j38qta2bmc096",
"nodeId": "Workflow1:nn98bbdkmvkbkuda:4c9j38qta2bmc096",
"name": "SetOutput1",
"type": "Elsa.SetOutput",
"version": 1,
"customProperties": {
"canStartWorkflow": false,
"runAsynchronously": false
},
"metadata": {
"designer": {
"position": {
"x": 400,
"y": 40
},
"size": {
"width": 175.578125,
"height": 50
}
},
"displayText": ""
}
}
],
"connections": []
}
}
@@ -0,0 +1,102 @@
{
"id": "E02197RyVk6VyofGoO6YJQ",
"definitionId": "P4X-srRSDUeKpFHiDXMW-w",
"name": "Sum",
"createdAt": "2023-10-18T16:37:20.670222+00:00",
"version": 3,
"toolVersion": "3.0.0.0",
"variables": [],
"inputs": [
{
"uiHint": "singleline",
"storageDriverType": "Elsa.Workflows.Services.WorkflowStorageDriver, Elsa.Workflows.Core",
"type": "Int32",
"name": "A",
"displayName": "A",
"category": "Primitives",
"isArray": false
},
{
"uiHint": "singleline",
"storageDriverType": "Elsa.Workflows.Services.WorkflowStorageDriver, Elsa.Workflows.Core",
"type": "Int32",
"name": "B",
"displayName": "B",
"category": "Primitives",
"isArray": false
}
],
"outputs": [
{
"type": "Int32",
"name": "Result",
"displayName": "Result",
"category": "Primitives",
"isArray": false
}
],
"outcomes": [],
"customProperties": {},
"isReadonly": false,
"isLatest": true,
"isPublished": true,
"options": {
"usableAsActivity": true,
"autoUpdateConsumingWorkflows": true,
"activityCategory": "Custom"
},
"root": {
"type": "Elsa.Flowchart",
"version": 1,
"id": "4FUOkS0zNUGe8JyVY3Sqmw",
"metadata": {},
"customProperties": {
"source": "FlowchartJsonConverter.cs:46",
"notFoundConnections": [],
"canStartWorkflow": false,
"runAsynchronously": false
},
"activities": [
{
"possibleOutcomes": null,
"script": {
"typeName": "String",
"expression": {
"type": "Literal",
"value": "getA() \u002B getB()"
},
"memoryReference": {
"id": "weO38K8Dfk-cSK8KVIiQMg:input-1"
}
},
"result": {
"typeName": "Object",
"memoryReference": {
"id": "Result"
}
},
"id": "weO38K8Dfk-cSK8KVIiQMg",
"name": "RunJavaScript1",
"type": "Elsa.RunJavaScript",
"version": 1,
"customProperties": {
"canStartWorkflow": false,
"runAsynchronously": false
},
"metadata": {
"designer": {
"position": {
"x": -240,
"y": 300
},
"size": {
"width": 175.6875,
"height": 50
}
}
}
}
],
"connections": []
}
}