Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions guidelines/mwm-workflow-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ This section contains the IG configuration. Specifically, it contains the follow
| Property | Type | Description |
|------|------|------|
|ae_title|str|The AE title for this workflow. Only data sent to this AE title will be processed by this workflow.|
|data_origins|list[str]|List of possible origin systems. These should be registered with the informatics gateway.|
|data_origins|Optional[list[str]]|List of possible origin systems. These should be registered with the informatics gateway.|
|export_destinations|list[str]|List of possible destinations for the output of tasks in this workflow. Informatics gateways can subscribe to notifications of output to these destinations.|

```json
Expand Down Expand Up @@ -171,7 +171,7 @@ The task also requires these extra attributes:-

| Property | Type | Description |
|------|------|------|
|args|object|An object that will be available to the task plugin when executing this task. This schema of this object is defined by the plugin itself.|
|args|optional[object]|An object that will be available to the task plugin when executing this task. This schema of this object is defined by the plugin itself.|
|artifacts|[ArtifactMap](#artifacts)|Input & output artifacts of this task.


Expand All @@ -187,7 +187,7 @@ The root level Task object contains an optional ArtifactMap object:
| Property | Type | Description |
|------|------|------|
|input|list[Artifact]|List of artifacts that are needed by this task.
|output|list[Artifact]|List of artifacts that are generated by this task.
|output|optional[list[Artifact]]|List of artifacts that are generated by this task.


#### Artifact
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,11 @@ public static bool IsInformaticsGatewayValid(string source, InformaticsGateway i
var valid = true;

valid &= ValidationExtensions.IsAeTitleValid(informaticsGateway.GetType().Name, informaticsGateway.AeTitle, validationErrors);
valid &= IsDataOriginsValid(informaticsGateway.GetType().Name, informaticsGateway.DataOrigins, validationErrors);
valid &= IsExportDestinationsValid(informaticsGateway.GetType().Name, informaticsGateway.ExportDestinations, validationErrors);

return valid;
}

public static bool IsDataOriginsValid(string source, string[] dataOrigins, IList<string> validationErrors = null)
{
Guard.Against.NullOrWhiteSpace(source, nameof(source));

if (dataOrigins?.Length > 0) return true;

validationErrors?.Add($"'{dataOrigins}' is not a valid Informatics Gateway - {nameof(dataOrigins)} (source: {source}).");

return false;
}

public static bool IsExportDestinationsValid(string source, string[] exportDestinations, IList<string> validationErrors = null)
{
Guard.Against.NullOrWhiteSpace(source, nameof(source));
Expand All @@ -128,7 +116,6 @@ public static bool IsTaskObjectValid(string source, TaskObject taskObject, IList
valid &= IsTaskIdValid(taskObject.Id, taskObject.Id, validationErrors);
valid &= IsTaskDescriptionValid(taskObject.Id, taskObject.Description, validationErrors);
valid &= IsTaskTypeValid(taskObject.Id, taskObject.Type, validationErrors);
valid &= IsArgsValid(taskObject.Id, taskObject.Args, validationErrors);

return valid;
}
Expand Down Expand Up @@ -166,18 +153,6 @@ public static bool IsTaskTypeValid(string source, string taskType, IList<string>
return false;
}

public static bool IsArgsValid(string source, Dictionary<string, string> args, IList<string> validationErrors = null)
{
Guard.Against.NullOrWhiteSpace(source, nameof(source));

if (!args.IsNullOrEmpty()) return true;

var jsontext = JsonConvert.SerializeObject(args);
validationErrors?.Add($"'{jsontext}' is not a valid {nameof(args)} (source: {source}).");

return false;
}

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ Scenario Outline: Update workflow with invalid details
| /workflows/c86a437d-d026-4bdf-b1df-c7a6372b89e3 | Invalid_Workflow_Name_Length | is not a valid Workflow Name |
| /workflows/c86a437d-d026-4bdf-b1df-c7a6372b89e3 | Invalid_Workflow_Desc_Length | is not a valid Workflow Description |
| /workflows/c86a437d-d026-4bdf-b1df-c7a6372b89e3 | Invalid_Workflow_AETitle_Length | is not a valid AE Title |
| /workflows/c86a437d-d026-4bdf-b1df-c7a6372b89e3 | Invalid_Workflow_DataOrg | is not a valid Informatics Gateway - dataOrigins |
| /workflows/c86a437d-d026-4bdf-b1df-c7a6372b89e3 | Invalid_Workflow_ExportDest | is not a valid Informatics Gateway - exportDestinations |
| /workflows/c86a437d-d026-4bdf-b1df-c7a6372b89e3 | Invalid_Workflow_TaskDesc_Length | is not a valid taskDescription |
| /workflows/c86a437d-d026-4bdf-b1df-c7a6372b89e3 | Invalid_Workflow_TaskType_Length | is not a valid taskType |
Expand Down Expand Up @@ -133,6 +132,13 @@ Scenario: Add workflow with valid details
When I send a POST request
Then I will get a 201 response

@AddWorkflows
Scenario: Add workflow with valid empty details
Given I have an endpoint /workflows
And I have a body Basic_Workflow_2
When I send a POST request
Then I will get a 201 response

@AddWorkflows
Scenario Outline: Add workflow with invalid details
Given I have an endpoint /workflows
Expand All @@ -145,7 +151,6 @@ Scenario Outline: Add workflow with invalid details
| Invalid_Workflow_Name_Length | is not a valid Workflow Name |
| Invalid_Workflow_Desc_Length | is not a valid Workflow Description |
| Invalid_Workflow_AETitle_Length | is not a valid AE Title |
| Invalid_Workflow_DataOrg | is not a valid Informatics Gateway - dataOrigins |
| Invalid_Workflow_ExportDest | is not a valid Informatics Gateway - exportDestinations |
| Invalid_Workflow_TaskDesc_Length | is not a valid taskDescription |
| Invalid_Workflow_TaskType_Length | is not a valid taskType |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,34 @@ public static class WorkflowObjectsTestData
}
},
new WorkflowObjectTestData()
{
Name = "Basic_Workflow_2",
Workflow = new Workflow()
{
Name = "Basic update",
Description = "Basic workflow update",
Version = "1",
Tasks = new TaskObject[]
{
new TaskObject
{
Id = "basic_id_with-legal-chars",
Type = "Basic_task",
Description = "Basic Workflow update Task update",
Artifacts = new ArtifactMap()
{
Input = new Artifact[] {}
}
}
},
InformaticsGateway = new InformaticsGateway()
{
AeTitle = "Update",
ExportDestinations = new string[]{"test"}
}
}
},
new WorkflowObjectTestData()
{
Name = "Invalid_Workflow_Name_Length",
Workflow = new Workflow()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ public void ValidateWorkflow_ValidatesAWorkflow_ReturnsTrueAndHasCorrectValidati

Assert.True(workflowHasErrors);

Assert.Equal(26, results.Errors.Count);
Assert.Equal(14, results.Errors.Count);

var successPath = "rootTask => taskSucessdesc1 => taskSucessdesc2";
Assert.Contains(successPath, results.SuccessfulPaths);
Expand Down