• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

HicServices / RDMP / 6237307473

19 Sep 2023 04:02PM UTC coverage: 57.015% (-0.4%) from 57.44%
6237307473

push

github

web-flow
Feature/rc4 (#1570)

* Syntax tidying
* Dependency updates
* Event handling singletons (ThrowImmediately and co)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: James A Sutherland <>
Co-authored-by: James Friel <jfriel001@dundee.ac.uk>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

10734 of 20259 branches covered (0.0%)

Branch coverage included in aggregate %.

5922 of 5922 new or added lines in 565 files covered. (100.0%)

30687 of 52390 relevant lines covered (58.57%)

7361.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

74.07
/Rdmp.Core/DataLoad/Engine/LoadExecution/Components/RuntimeTaskPackager.cs
1
// Copyright (c) The University of Dundee 2018-2019
2
// This file is part of the Research Data Management Platform (RDMP).
3
// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
4
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
5
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.
6

7
using System;
8
using System.Collections.Generic;
9
using System.Linq;
10
using Rdmp.Core.Curation.Data;
11
using Rdmp.Core.Curation.Data.DataLoad;
12
using Rdmp.Core.DataLoad.Engine.LoadExecution.Components.Arguments;
13
using Rdmp.Core.DataLoad.Engine.LoadExecution.Components.Runtime;
14
using Rdmp.Core.Repositories;
15

16
namespace Rdmp.Core.DataLoad.Engine.LoadExecution.Components;
17

18
/// <summary>
19
/// Converts multiple user defined DLE ProcessTasks into a single hydrated CompositeDataLoadComponent.  This involves converting the ProcessTasks
20
/// (which are user defined class names, argument values etc) into instances of IRuntimeTask.  You can either call CreateCompositeDataLoadComponentFor
21
/// to create a generic CompositeDataLoadComponent containing all the IRuntimeTasks or you can get the IRuntimeTask list directly and use it yourself in
22
/// a more advanced DataLoadComponent (e.g. PopulateRAW - See usages in HICDataLoadFactory)
23
/// </summary>
24
public class RuntimeTaskPackager
25
{
26
    public readonly IEnumerable<IProcessTask> ProcessTasks;
27
    private readonly Dictionary<LoadStage, IStageArgs> _loadArgsDictionary;
28
    private readonly IEnumerable<ICatalogue> _cataloguesToLoad;
29
    private readonly ICatalogueRepository _repository;
30

31
    public RuntimeTaskPackager(IEnumerable<IProcessTask> processTasks,
46✔
32
        Dictionary<LoadStage, IStageArgs> loadArgsDictionary, IEnumerable<ICatalogue> cataloguesToLoad,
46✔
33
        ICatalogueRepository repository)
46✔
34
    {
35
        ProcessTasks = processTasks;
46✔
36
        _loadArgsDictionary = loadArgsDictionary;
46✔
37
        _cataloguesToLoad = cataloguesToLoad;
46✔
38
        _repository = repository;
46✔
39
    }
46✔
40

41
    public List<IRuntimeTask> GetRuntimeTasksForStage(LoadStage loadStage)
42
    {
43
        var tasksForThisLoadStage = ProcessTasks.Where(task => task.LoadStage == loadStage).ToList();
490✔
44

45
        if (!tasksForThisLoadStage.Any())
230✔
46
            return new List<IRuntimeTask>();
182✔
47

48
        var factory = new RuntimeTaskFactory(_repository);
48✔
49
        return tasksForThisLoadStage
48✔
50
            .Select(processTask => RuntimeTaskFactory.Create(processTask, _loadArgsDictionary[processTask.LoadStage]))
52✔
51
            .Cast<IRuntimeTask>().OrderBy(task => task.ProcessTask.Order).ToList();
100✔
52
    }
53

54
    public IEnumerable<IRuntimeTask> GetAllRuntimeTasks()
55
    {
56
        var runtimeTasks = new List<IRuntimeTask>();
×
57

58
        foreach (LoadStage loadStage in Enum.GetValues(typeof(LoadStage)))
×
59
            runtimeTasks.AddRange(GetRuntimeTasksForStage(loadStage));
×
60

61
        return runtimeTasks;
×
62
    }
63

64
    public CompositeDataLoadComponent CreateCompositeDataLoadComponentFor(LoadStage loadStage,
65
        string descriptionForComponent)
66
    {
67
        var tasks = GetRuntimeTasksForStage(loadStage)
138✔
68
            .Select(task => RuntimeTaskFactory.Create(task.ProcessTask, _loadArgsDictionary[loadStage]))
×
69
            .Cast<IDataLoadComponent>().ToList();
138✔
70

71
        return new CompositeDataLoadComponent(tasks) { Description = descriptionForComponent };
138✔
72
    }
73
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc