• 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

7.14
/Rdmp.Core/DataLoad/Modules/Mutilators/DQEPostLoadRunner.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.CommandExecution;
9
using Rdmp.Core.CommandLine.Options;
10
using Rdmp.Core.CommandLine.Runners;
11
using Rdmp.Core.Curation.Data;
12
using Rdmp.Core.Curation.Data.DataLoad;
13
using Rdmp.Core.Curation.Data.Defaults;
14
using Rdmp.Core.DataFlowPipeline;
15
using Rdmp.Core.DataLoad.Engine.Job;
16
using Rdmp.Core.DataLoad.Engine.Mutilators;
17
using Rdmp.Core.ReusableLibraryCode.Checks;
18
using Rdmp.Core.ReusableLibraryCode.Progress;
19
using System;
20
using System.Linq;
21

22
namespace Rdmp.Core.DataLoad.Modules.Mutilators;
23

24
/// <summary>
25
/// This component will run the DQE engine on the associated catalogue after the data load has ran
26
/// </summary>
27
public class DQEPostLoadRunner : IMutilateDataTables
28
{
29

30
    public void Check(ICheckNotifier notifier)
31
    {
32
    }
×
33

34
    public void Initialize(DiscoveredDatabase dbInfo, LoadStage loadStage)
35
    {
36
        if (loadStage != LoadStage.PostLoad)
4!
37
        {
38
            throw new Exception("DQL Runner can only be done in the PostLoad stage.");
4✔
39
        }
40
    }
×
41

42
    public void LoadCompletedSoDispose(ExitCodeType exitCode, IDataLoadEventListener postLoadEventsListener)
43
    {
44
    }
×
45

46
    public ExitCodeType Mutilate(IDataLoadJob job)
47
    {
48
        var dqeServer = job.RepositoryLocator.CatalogueRepository.GetDefaultFor(PermissableDefaults.DQE);
×
49
        if (dqeServer == null)
×
50
        {
51
            job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning,
×
52
            "There is no DQE server. DQE will not be run."));
×
UNCOV
53
            return ExitCodeType.Success;
×
54
        }
55
        var lmdID = job.LoadMetadata.ID;
×
56
        var linkage = job.RepositoryLocator.CatalogueRepository.GetAllObjectsWhere<LoadMetadataCatalogueLinkage>("LoadMetadataID", lmdID);
×
UNCOV
57
        foreach (var link in linkage)
×
58
        {
59
            var catalogue = job.RepositoryLocator.CatalogueRepository.GetAllObjectsWhere<Catalogue>("ID", link.CatalogueID).FirstOrDefault();
×
UNCOV
60
            if (catalogue is null) continue;
×
61
            if (catalogue.TimeCoverage_ExtractionInformation_ID == null)
×
62
            {
63
                job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning,
×
UNCOV
64
               $"Catalogue '{catalogue.Name}' does not have a Time Coverage column set. DQE will not be run"));
×
65
            }
66

UNCOV
67
            if (string.IsNullOrWhiteSpace(catalogue.ValidatorXML))
×
68
            {
69
                job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning,
×
70
                 $"Catalogue '{catalogue.Name}' does not have any validation rules configured.DQE will not be run."));
×
71
            }
72

73
            DqeOptions options = new()
×
74
            {
×
75
                Catalogue = catalogue.ID.ToString(),
×
76
                Command = CommandLineActivity.run
×
77
            };
×
78
            var runner = RunnerFactory.CreateRunner(new ThrowImmediatelyActivator(job.RepositoryLocator), options);
×
79
            runner.Run(job.RepositoryLocator, ThrowImmediatelyDataLoadEventListener.Quiet, new AcceptAllCheckNotifier(),
×
80
                        new GracefulCancellationToken());
×
81
        }
82
        return ExitCodeType.Success;
×
83

84
    }
85
}
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