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

HicServices / RDMP / 10214502522

02 Aug 2024 11:01AM UTC coverage: 57.295% (-0.004%) from 57.299%
10214502522

push

github

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

11089 of 20820 branches covered (53.26%)

Branch coverage included in aggregate %.

66 of 116 new or added lines in 8 files covered. (56.9%)

1 existing line in 1 file now uncovered.

31368 of 53282 relevant lines covered (58.87%)

7983.81 hits per line

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

7.32
/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
    {
NEW
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
        }
NEW
40
    }
×
41

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

46
    public ExitCodeType Mutilate(IDataLoadJob job)
47
    {
NEW
48
        var lmdID = job.LoadMetadata.ID;
×
NEW
49
        var linkage = job.RepositoryLocator.CatalogueRepository.GetAllObjectsWhere<LoadMetadataCatalogueLinkage>("LoadMetadataID", lmdID).FirstOrDefault();
×
NEW
50
        var catalogue = job.RepositoryLocator.CatalogueRepository.GetAllObjectsWhere<Catalogue>("ID", linkage.CatalogueID).FirstOrDefault();
×
NEW
51
        if (catalogue is null) return ExitCodeType.Success;
×
NEW
52
        if (catalogue.TimeCoverage_ExtractionInformation_ID == null)
×
53
        {
NEW
54
            job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning,
×
NEW
55
           "Catalogue does not have a Time Coverage column set. DQE will not be run"));
×
NEW
56
            return ExitCodeType.Success;
×
57
        }
58

NEW
59
        if (string.IsNullOrWhiteSpace(catalogue.ValidatorXML))
×
60
        {
NEW
61
            job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning,
×
NEW
62
            "Catalogue does not have any validation rules configured.DQE will not be run."));
×
NEW
63
            return ExitCodeType.Success;
×
64
        }
NEW
65
        var dqeServer = job.RepositoryLocator.CatalogueRepository.GetDefaultFor(PermissableDefaults.DQE);
×
NEW
66
        if (dqeServer == null)
×
67
        {
NEW
68
            job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning,
×
NEW
69
            "There is no DQE server. DQE will not be run."));
×
NEW
70
            return ExitCodeType.Success;
×
71
        }
72

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

NEW
82
        return ExitCodeType.Success;
×
83
    }
84
}
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