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

HicServices / RDMP / 11457925069

pending completion
11457925069

push

github

JFriel
Merge branch 'develop' of https://github.com/HicServices/RDMP

11207 of 21044 branches covered (53.26%)

Branch coverage included in aggregate %.

25 of 51 new or added lines in 3 files covered. (49.02%)

705 existing lines in 27 files now uncovered.

31728 of 53779 relevant lines covered (59.0%)

4115.97 hits per line

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

78.57
/Rdmp.Core/DataLoad/Engine/LoadExecution/Components/Runtime/DataProviderRuntimeTask.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 Rdmp.Core.CommandExecution;
9
using Rdmp.Core.Curation.Data.DataLoad;
10
using Rdmp.Core.DataFlowPipeline;
11
using Rdmp.Core.DataLoad.Engine.DataProvider;
12
using Rdmp.Core.DataLoad.Engine.Job;
13
using Rdmp.Core.DataLoad.Engine.LoadExecution.Components.Arguments;
14
using Rdmp.Core.Repositories;
15
using Rdmp.Core.ReusableLibraryCode.Checks;
16
using Rdmp.Core.ReusableLibraryCode.Progress;
17

18
namespace Rdmp.Core.DataLoad.Engine.LoadExecution.Components.Runtime;
19

20
/// <summary>
21
/// RuntimeTask that hosts an IDataProvider.  The instance is hydrated from the users configuration (ProcessTask and ProcessTaskArguments) See
22
/// RuntimeArgumentCollection
23
/// </summary>
24
public class DataProviderRuntimeTask : RuntimeTask, IMEFRuntimeTask
25
{
26
    public IDataProvider Provider { get; private set; }
54✔
UNCOV
27
    public ICheckable MEFPluginClassInstance => Provider;
×
28

29
    private IBasicActivateItems _activator;
30

31
    public DataProviderRuntimeTask(IProcessTask task, RuntimeArgumentCollection args)
32
        : base(task, args)
12✔
33
    {
34
        var classNameToInstantiate = task.Path;
12✔
35

36
        if (string.IsNullOrWhiteSpace(task.Path))
12✔
37
            throw new ArgumentException(
2✔
38
                $"Path is blank for ProcessTask '{task}' - it should be a class name of type {nameof(IDataProvider)}");
2✔
39

40
        Provider = MEF.CreateA<IDataProvider>(classNameToInstantiate);
10✔
41
        if(Provider is IInteractiveCheckable)
10!
42
        {
UNCOV
43
            ((IInteractiveCheckable)Provider).SetActivator(_activator);
×
44
        }
45

46
        try
47
        {
48
            SetPropertiesForClass(RuntimeArguments, Provider);
10✔
49
        }
6✔
50
        catch (Exception e)
4✔
51
        {
52
            throw new Exception($"Error when trying to set the properties for '{task.Name}'", e);
4✔
53
        }
54

55
        Provider.Initialize(args.StageSpecificArguments.RootDir, RuntimeArguments.StageSpecificArguments.DbInfo);
6✔
56
    }
6✔
57

58
    public override ExitCodeType Run(IDataLoadJob job, GracefulCancellationToken cancellationToken)
59
    {
60
        job.OnNotify(this,
2✔
61
            new NotifyEventArgs(ProgressEventType.Information, $"About to run Task '{ProcessTask.Name}'"));
2✔
62

63
        job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information,
2✔
64
            $"About to fetch data using class {Provider.GetType().FullName}"));
2✔
65
        if (Provider is IInteractiveCheckable)
2!
66
        {
UNCOV
67
            ((IInteractiveCheckable)Provider).SetActivator(_activator);
×
68
        }
69
        return Provider.Fetch(job, cancellationToken);
2✔
70
    }
71

UNCOV
72
    public override bool Exists() => true;
×
73

74
    public override void Abort(IDataLoadEventListener postLoadEventListener)
75
    {
76
    }
×
77

78
    public void SetActivator(IBasicActivateItems activator)
79
    {
80
        _activator = activator;
4✔
81
    }
4✔
82

83
    public override void LoadCompletedSoDispose(ExitCodeType exitCode, IDataLoadEventListener postLoadEventListener)
84
    {
85
        Provider.LoadCompletedSoDispose(exitCode, postLoadEventListener);
2✔
86
    }
2✔
87

88
    public override void Check(ICheckNotifier checker)
89
    {
90
        if (Provider is IInteractiveCheckable)
4!
91
        {
UNCOV
92
            ((IInteractiveCheckable)Provider).SetActivator(_activator);
×
93
        }
94
        new MandatoryPropertyChecker(Provider).Check(checker);
4✔
95
        Provider.Check(checker);
2✔
96
    }
2✔
97
}
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

© 2025 Coveralls, Inc