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

HicServices / RDMP / 10418436530

16 Aug 2024 10:21AM UTC coverage: 57.215% (-0.009%) from 57.224%
10418436530

push

github

JFriel
update data load chainer

11099 of 20852 branches covered (53.23%)

Branch coverage included in aggregate %.

1 of 11 new or added lines in 2 files covered. (9.09%)

1 existing line in 1 file now uncovered.

31372 of 53378 relevant lines covered (58.77%)

7843.83 hits per line

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

0.0
/Rdmp.Core/DataLoad/Modules/DataProvider/DataLoadDataProvider.cs
1
// Copyright (c) The University of Dundee 2024-2024
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 FAnsi.Discovery;
8
using Rdmp.Core.CommandLine.Options;
9
using Rdmp.Core.CommandLine.Runners;
10
using Rdmp.Core.Curation;
11
using Rdmp.Core.Curation.Data;
12
using Rdmp.Core.Curation.Data.DataLoad;
13
using Rdmp.Core.DataFlowPipeline;
14
using Rdmp.Core.DataLoad.Engine.DataProvider;
15
using Rdmp.Core.DataLoad.Engine.Job;
16
using Rdmp.Core.Repositories;
17
using Rdmp.Core.ReusableLibraryCode.Checks;
18
using Rdmp.Core.ReusableLibraryCode.Progress;
19
using Rdmp.Core.ReusableLibraryCode.Settings;
20
using Rdmp.Core.Startup;
21
using System;
22

23
namespace Rdmp.Core.DataLoad.Modules.DataProvider;
24

25
/// <summary>
26
/// Triggers another data load run
27
/// Checks are run during initial checks of primary data load, and assumed to be correct hwne running post-load
28
/// </summary>
29
public class DataLoadDataProvider : IDataProvider
30
{
31
    [DemandsInitialization("The Data Load you wish to run", Mandatory = true)]
32
    public LoadMetadata DataLoad { get; set; }
×
33

34
    private IRDMPPlatformRepositoryServiceLocator _repositoryLocator;
35

36
    private DleRunner _runner;
37
    private ICheckNotifier _checker;
38
    private IDataLoadEventListener _listener;
39

40
    public void Check(ICheckNotifier notifier)
41
    {
42
        if (DataLoad is null)
×
43
        {
44
            notifier.OnCheckPerformed(new CheckEventArgs("No LoadMetadata Configured", CheckResult.Fail));
×
45
        }
46
        var catalogueString = UserSettings.CatalogueConnectionString;
×
47

48
        var dataExportManagerConnectionString = UserSettings.DataExportConnectionString;
×
49

50
        LinkedRepositoryProvider newrepo;
51

52
        try
53
        {
54
            newrepo = new LinkedRepositoryProvider(catalogueString, dataExportManagerConnectionString);
×
55
        }
×
56
        catch (Exception ex)
×
57
        {
58
            throw new CorruptRepositoryConnectionDetailsException(
×
59
                $"Unable to create {nameof(LinkedRepositoryProvider)}", ex);
×
60
        }
61
        var finder = newrepo;
×
62
        var dleOptions = new DleOptions()
×
63
        {
×
64
            LoadMetadata = DataLoad.ID.ToString(),
×
65
            Command = CommandLineActivity.check,
×
66
        };
×
67
        _runner = new DleRunner(dleOptions);
×
68
        _checker = notifier;
×
69
        _listener = new FromCheckNotifierToDataLoadEventListener(notifier);
×
70
        var exitCode = _runner.Run(finder, _listener, notifier, new GracefulCancellationToken());
×
71
    }
×
72

73
    public ExitCodeType Fetch(IDataLoadJob job, GracefulCancellationToken cancellationToken)
74
    {
75
        var dleOptions = new DleOptions()
×
76
        {
×
77
            LoadMetadata = DataLoad.ID.ToString(),
×
NEW
78
            Command = CommandLineActivity.check,
×
79
        };
×
80
        _runner = new DleRunner(dleOptions);
×
81

82
        _repositoryLocator = job.RepositoryLocator;
×
83
        var exitCode = _runner.Run(_repositoryLocator, job, _checker, cancellationToken);
×
NEW
84
        if(exitCode == 0)
×
85
        {
NEW
86
            dleOptions = new DleOptions()
×
NEW
87
            {
×
NEW
88
                LoadMetadata = DataLoad.ID.ToString(),
×
NEW
89
                Command = CommandLineActivity.run,
×
NEW
90
            };
×
NEW
91
            _runner = new DleRunner(dleOptions);
×
92

NEW
93
            _repositoryLocator = job.RepositoryLocator;
×
NEW
94
            exitCode = _runner.Run(_repositoryLocator, job, _checker, cancellationToken);
×
95
        }
UNCOV
96
        return (ExitCodeType)exitCode;
×
97
    }
98

99
    public void Initialize(ILoadDirectory directory, DiscoveredDatabase dbInfo)
100
    {
101
        _checker = new ToMemoryCheckNotifier(new AcceptAllCheckNotifier());//checker is not populated when running the data provider
×
102

103
    }
×
104

105
    public void LoadCompletedSoDispose(ExitCodeType exitCode, IDataLoadEventListener postLoadEventsListener)
106
    {
107
    }
×
108
}
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