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

HicServices / RDMP / 6245535001

20 Sep 2023 07:44AM UTC coverage: 57.013%. First build
6245535001

push

github

web-flow
8.1.0 Release (#1628)

* Bump Newtonsoft.Json from 13.0.1 to 13.0.2

Bumps [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) from 13.0.1 to 13.0.2.
- [Release notes](https://github.com/JamesNK/Newtonsoft.Json/releases)
- [Commits](https://github.com/JamesNK/Newtonsoft.Json/compare/13.0.1...13.0.2)

---
updated-dependencies:
- dependency-name: Newtonsoft.Json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump NLog from 5.0.5 to 5.1.0

Bumps [NLog](https://github.com/NLog/NLog) from 5.0.5 to 5.1.0.
- [Release notes](https://github.com/NLog/NLog/releases)
- [Changelog](https://github.com/NLog/NLog/blob/dev/CHANGELOG.md)
- [Commits](https://github.com/NLog/NLog/compare/v5.0.5...v5.1.0)

---
updated-dependencies:
- dependency-name: NLog
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump NLog from 5.0.5 to 5.1.0

* Fix -r flag - should have been --results-directory all along

* Bump Newtonsoft.Json from 13.0.1 to 13.0.2

* Bump YamlDotNet from 12.0.2 to 12.1.0

Bumps [YamlDotNet](https://github.com/aaubry/YamlDotNet) from 12.0.2 to 12.1.0.
- [Release notes](https://github.com/aaubry/YamlDotNet/releases)
- [Commits](https://github.com/aaubry/YamlDotNet/compare/v12.0.2...v12.1.0)

---
updated-dependencies:
- dependency-name: YamlDotNet
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump Moq from 4.18.2 to 4.18.3

Bumps [Moq](https://github.com/moq/moq4) from 4.18.2 to 4.18.3.
- [Release notes](https://github.com/moq/moq4/releases)
- [Changelog](https://github.com/moq/moq4/blob/main/CHANGELOG.md)
- [Commits](https://github.com/moq/moq4/compare/v4.18.2...v4.18.3)

---
updated-dependencies:
- dependency-name: Moq
... (continued)

10732 of 20257 branches covered (0.0%)

Branch coverage included in aggregate %.

48141 of 48141 new or added lines in 1086 files covered. (100.0%)

30685 of 52388 relevant lines covered (58.57%)

7387.88 hits per line

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

76.32
/Rdmp.Core/Curation/Data/ConnectionStringKeyword.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 System.Collections.Generic;
9
using System.Data.Common;
10
using FAnsi;
11
using FAnsi.Discovery.ConnectionStringDefaults;
12
using Rdmp.Core.MapsDirectlyToDatabaseTable;
13
using Rdmp.Core.Repositories;
14
using Rdmp.Core.ReusableLibraryCode.Annotations;
15
using Rdmp.Core.ReusableLibraryCode.Checks;
16

17
namespace Rdmp.Core.Curation.Data;
18

19
/// <summary>
20
/// Describes a specific key/value pair that should always be used (unless overriden by an API requirement) in connection strings to servers of the given <see cref="DatabaseType"/>
21
/// by RDMP.  For example you could specify Encrypt = true to force all connections made to go through SSL (requires certificates / certificate validation etc).  Be careful when creating
22
/// these as they apply to all users of the system and can make servers unreachable if a syntactically valid but unresolvable connection string is created.
23
/// 
24
/// <para>Checks will ensure that the keyword is a valid connection string keyword for the given <see cref="DatabaseType"/> and thus you will not get syntactically illegal connection strings</para>
25
/// </summary>
26
public class ConnectionStringKeyword : DatabaseEntity, INamed, ICheckable
27
{
28
    #region Database Properties
29

30
    private DatabaseType _databaseType;
31
    private string _name;
32
    private string _value;
33

34
    #endregion
35

36
    /// <summary>
37
    /// The DBMS (Oracle / MySql etc) which this keyword should be used when connecting to
38
    /// </summary>
39
    public DatabaseType DatabaseType
40
    {
41
        get => _databaseType;
1,518✔
42
        set => SetField(ref _databaseType, value);
3,044✔
43
    }
44

45
    /// <summary>
46
    /// The name of the keyword.  Must be a valid connection string key for the <see cref="DatabaseType"/> e.g. IntegratedSecurity
47
    /// </summary>
48
    [NotNull]
49
    public string Name
50
    {
51
        get => _name;
1,510✔
52
        set => SetField(ref _name, value);
3,044✔
53
    }
54

55
    /// <summary>
56
    /// The value to write into the connection string for the keyword e.g.  sspi
57
    /// </summary>
58
    public string Value
59
    {
60
        get => _value;
1,508✔
61
        set => SetField(ref _value, value);
3,044✔
62
    }
63

64
    public ConnectionStringKeyword()
×
65
    {
66
    }
×
67

68
    /// <summary>
69
    /// Defines a new keyword that should be set on all connections to databases of <see cref="DatabaseType"/> when making new connections
70
    /// </summary>
71
    /// <param name="repository"></param>
72
    /// <param name="databaseType"></param>
73
    /// <param name="keyword"></param>
74
    /// <param name="value"></param>
75
    public ConnectionStringKeyword(ICatalogueRepository repository, DatabaseType databaseType, string keyword,
1,394✔
76
        string value)
1,394✔
77
    {
78
        repository.InsertAndHydrate(this, new Dictionary<string, object>
1,394✔
79
        {
1,394✔
80
            { "DatabaseType", databaseType.ToString() },
1,394✔
81
            { "Name", keyword },
1,394✔
82
            { "Value", value }
1,394✔
83
        });
1,394✔
84

85
        if (ID == 0 || Repository != repository)
1,394!
86
            throw new ArgumentException("Repository failed to properly hydrate this class");
×
87
    }
1,394✔
88

89
    internal ConnectionStringKeyword(ICatalogueRepository repository, DbDataReader r)
90
        : base(repository, r)
1,650✔
91
    {
92
        DatabaseType = (DatabaseType)Enum.Parse(typeof(DatabaseType), r["DatabaseType"].ToString());
1,650✔
93
        Name = r["Name"].ToString();
1,650✔
94
        Value = r["Value"] as string;
1,650✔
95
    }
1,650✔
96

97
    /// <inheritdoc/>
98
    public override string ToString() => Name;
×
99

100
    /// <summary>
101
    /// Checks that the keyword is valid syntax for the <see cref="DatabaseType"/> and can be set on a <see cref="DbConnectionStringBuilder"/>
102
    /// </summary>
103
    /// <param name="notifier"></param>
104
    public void Check(ICheckNotifier notifier)
105
    {
106
        try
107
        {
108
            var accumulator = new ConnectionStringKeywordAccumulator(DatabaseType);
58✔
109
            accumulator.AddOrUpdateKeyword(Name, Value, ConnectionStringKeywordPriority.SystemDefaultLow);
58✔
110
            notifier.OnCheckPerformed(new CheckEventArgs(
58✔
111
                "Integrity of keyword is ok according to ConnectionStringKeywordAccumulator", CheckResult.Success));
58✔
112
        }
58✔
113
        catch (Exception e)
×
114
        {
115
            notifier.OnCheckPerformed(new CheckEventArgs(e.Message, CheckResult.Fail, e));
×
116
        }
×
117
    }
58✔
118
}
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