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

HicServices / RDMP / 12084537692

29 Nov 2024 12:12PM UTC coverage: 57.449% (+0.06%) from 57.386%
12084537692

push

github

web-flow
Release: 8.4.0 (#2006)

* add changelog

* Bugfix/rdmp 253 filter ordering (#2007)

* add start

* partial

* tidy up code

* filter updates

* update db migrations

* update correct db

* update changelog

* add base creation sql

* fix create

* tidy up

* update insert

* tidy up

* interim

* style updates

* add some info

* start of where clause

* improved

* improved dates

* improve bookends

* add changelog

* update changelog

* improve ui with frequency

* tidy up for tests

* add summary

* rename chart

* interim people

* add people label

* better where

* move items around

* fix up tests

* tidy up code

* tidy up

* made db independant

* add changelog

* add missing file

* Bugfix/rdmp 259 delta load off by one issue (#2024)

* fix off by one issue

* update tests

* update changelog

* check for multi-server query

* update changelog

* update changelog

* Add override for RAW table date column in delta loads (#2052)

* fix table attacher special column issue

* add override

* add extra override

* fix tests

* tidy up

* add docs

* update deps

* add safe ref

* interim

* working check

* tidy up

* add changelog

* fix typos

* update typo

* fix typos

* fix typos

* Changes made to popup buttons (#2076)

* Changes made to popup buttons

* Bump the aws-sdk group with 4 updates (#2074)

Bumps the aws-sdk group with 4 updates: [AWSSDK.S3](https://github.com/aws/aws-sdk-net), [AWSSDK.SecurityToken](https://github.com/aws/aws-sdk-net), [AWSSDK.SSO](https://github.com/aws/aws-sdk-net) and [AWSSDK.SSOOIDC](https://github.com/aws/aws-sdk-net).


Updates `AWSSDK.S3` from 3.7.407 to 3.7.407.1
- [Release notes](https://github.com/aws/aws-sdk-net/releases)
- [Changelog](https://github.com/aws/aws-sdk-net/blob/main/SDK.CHANGELOG.MD)
- [Commits](https://github.com/aws/aws-sdk-net/commits)

Updates `AWSSD... (continued)

11298 of 21215 branches covered (53.25%)

Branch coverage included in aggregate %.

439 of 673 new or added lines in 30 files covered. (65.23%)

5 existing lines in 4 files now uncovered.

32146 of 54407 relevant lines covered (59.08%)

17105.99 hits per line

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

65.67
/Rdmp.Core/DataLoad/Modules/Mutilators/MatchingTablesMutilatorWithDataLoadJob.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 System;
8
using System.Diagnostics;
9
using System.Linq;
10
using System.Text.RegularExpressions;
11
using FAnsi.Discovery;
12
using Rdmp.Core.Curation.Data;
13
using Rdmp.Core.Curation.Data.DataLoad;
14
using Rdmp.Core.DataLoad.Engine.Job;
15
using Rdmp.Core.DataLoad.Engine.Mutilators;
16
using Rdmp.Core.ReusableLibraryCode.Checks;
17
using Rdmp.Core.ReusableLibraryCode.Progress;
18

19
namespace Rdmp.Core.DataLoad.Modules.Mutilators;
20

21
public abstract class MatchingTablesMutilatorWithDataLoadJob : IPluginMutilateDataTables
22
{
23
    private readonly LoadStage[] _allowedStages;
24

25
    [DemandsInitialization(
26
        "All tables matching this pattern which have a TableInfo defined in the load will be affected by this mutilation",
27
        DefaultValue = ".*")]
28
    public Regex TableRegexPattern { get; set; }
98✔
29

30
    [DemandsInitialization(
31
        "Overrides TableRegexPattern.  If this is set then the tables chosen will be mutilated instead")]
32
    public TableInfo[] OnlyTables { get; set; }
42✔
33

34
    [DemandsInitialization("How long to allow for each command to execute in seconds", DefaultValue = 600)]
35
    public int Timeout { get; set; }
56✔
36

37
    protected DiscoveredDatabase DbInfo;
38
    private LoadStage _loadStage;
39

40
    protected MatchingTablesMutilatorWithDataLoadJob(params LoadStage[] allowedStages)
28✔
41
    {
42
        _allowedStages = allowedStages;
28✔
43
    }
28✔
44

45
    public virtual void LoadCompletedSoDispose(ExitCodeType exitCode, IDataLoadEventListener postLoadEventsListener)
46
    {
47
    }
14✔
48

49
    public void Initialize(DiscoveredDatabase dbInfo, LoadStage loadStage)
50
    {
51
        if (_allowedStages != null && !_allowedStages.Contains(loadStage))
28!
NEW
52
            throw new NotSupportedException($"Mutilation {GetType()} is not allowed at stage {loadStage}");
×
53

54
        _loadStage = loadStage;
28✔
55
        DbInfo = dbInfo;
28✔
56
    }
28✔
57

58
    public ExitCodeType Mutilate(IDataLoadJob job)
59
    {
60
        if (TableRegexPattern != null)
14✔
61
            TableRegexPattern = new Regex(TableRegexPattern.ToString(), RegexOptions.IgnoreCase);
14✔
62

63
        foreach (var tableInfo in job.RegularTablesToLoad)
56✔
64
            if (OnlyTables != null && OnlyTables.Length != 0)
14!
65
            {
NEW
66
                if (OnlyTables.Contains(tableInfo))
×
NEW
67
                    FireMutilate(tableInfo, job);
×
68
            }
69
            else if (TableRegexPattern == null)
14!
70
            {
NEW
71
                throw new Exception("You must specify either TableRegexPattern or OnlyTables");
×
72
            }
73
            else if (TableRegexPattern.IsMatch(tableInfo.GetRuntimeName()))
14✔
74
            {
75
                FireMutilate(tableInfo, job);
14✔
76
            }
77

78
        return ExitCodeType.Success;
14✔
79
    }
80

81
    private void FireMutilate(ITableInfo tableInfo, IDataLoadJob job)
82
    {
83
        var tbl = DbInfo.ExpectTable(tableInfo.GetRuntimeName(_loadStage, job.Configuration.DatabaseNamer));
14✔
84

85
        if (!tbl.Exists())
14!
86
        {
NEW
87
            job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Error,
×
NEW
88
                $"Expected table {tbl} did not exist in RAW"));
×
89
        }
90
        else
91
        {
92
            job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information,
14✔
93
                $"About to run {GetType()} mutilation on table {tbl}"));
14✔
94
            var sw = new Stopwatch();
14✔
95
            sw.Start();
14✔
96
            MutilateTable(job, tableInfo, tbl);
14✔
97
            sw.Stop();
14✔
98
            job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information,
14✔
99
                $"{GetType()} mutilation on table {tbl} completed after {sw.ElapsedMilliseconds} ms"));
14✔
100
        }
101
    }
14✔
102

103
    protected abstract void MutilateTable(IDataLoadJob job, ITableInfo tableInfo, DiscoveredTable table);
104

105
    public virtual void Check(ICheckNotifier notifier)
106
    {
NEW
107
        if (TableRegexPattern == null && (OnlyTables == null || OnlyTables.Length == 0))
×
NEW
108
            notifier.OnCheckPerformed(new CheckEventArgs(
×
NEW
109
                "You must specify either a regex pattern (TableRegexPattern) or set OnlyTables for identifying tables which need to be processed",
×
NEW
110
                CheckResult.Fail));
×
NEW
111
    }
×
112
}
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