Skip to content

Commit

Permalink
Merge branch 'release/4.1.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
tznind committed Aug 4, 2020
2 parents 4664d62 + 6cb9327 commit 1534cc9
Show file tree
Hide file tree
Showing 38 changed files with 654 additions and 77 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**RDMP Version**
Displayed in the task bar of the software e.g. v4.1.5

**Error with Stack Trace**
```
If applicable, paste the entire stack trace here, leave the triple quotes (```)
```

**Database Engine**
Sql Server, Oracle, MySql or Postgres.

**Additional context**
Add any other context about the problem here.
29 changes: 23 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
language: csharp
mono: none
dotnet: 2.2.100
language: generic
dist: bionic
os: linux

addons:
postgresql: "10"
apt:
packages:
sources:
- sourceline: 'deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/prod bionic main'
key_url: 'https://packages.microsoft.com/keys/microsoft.asc'
- sourceline: 'deb [arch=amd64,arm64,armhf] https://packages.microsoft.com/ubuntu/18.04/mssql-server-2019 bionic main'

services:
- postgresql
- mysql

env:
global:
- MSSQL_SA_PASSWORD="YourStrong!Passw0rd"
- ACCEPT_EULA=Y
- MSSQL_PID='developer'

cache:
directories:
- $HOME/.local/share/NuGet/
- $HOME/.nuget

before_script:
- sudo docker run --name=mssql-server-linux-latest -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=YourStrong!Passw0rd' -p 1433:1433 -d microsoft/mssql-server-linux:2017-latest
- sudo apt install libc6-dev
- sudo apt install libgdiplus
- sudo apt-get install -y --no-install-recommends libc6-dev libgdiplus dotnet-sdk-2.2 dotnet-sdk-3.1
- sudo apt-get install -y --no-install-recommends mssql-tools mssql-server
- sudo /opt/mssql/bin/mssql-conf -n setup accept-eula

script:
- dotnet publish "./Tools/rdmp" -r linux-x64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using Rdmp.UI.Icons;
using Rdmp.UI.ItemActivation;
using Rdmp.UI.Refreshing;
using Rdmp.UI.SimpleControls;
using Rdmp.UI.SingleControlForms;
using Rdmp.UI.TestsAndSetup.ServicePropogation;
using ResearchDataManagementPlatform.WindowManagement.ContentWindowTracking.Persistence;
Expand Down Expand Up @@ -123,6 +124,9 @@ private void AddControlToDockContent(IActivateItems activator, Control control,D
if (control is IConsultableBeforeClosing consult)
content.FormClosing += consult.ConsultAboutClosing;

if(control is ISaveableUI saveable)
content.FormClosing += (s,e)=>saveable.GetObjectSaverButton()?.CheckForUnsavedChangesAnOfferToSave();

content.KeyPreview = true;

if (content is RDMPSingleControlTab tab)
Expand Down
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

...

## [4.1.6] - 2020-08-04

### Added

- Added 'Save Changes' prompt when closing tabs
- Added Import command for bringing in one or more [CohortIdentificationConfiguration] into an existing container (like Merge / UnMerge but for existing configurations)
- Added checks for LoadProgress dates being in sensible ranges during DLE

### Fixed

- Fixed [bug when parsing lists of ints in CLI](https://github.com/HicServices/RDMP/issues/84)

## [4.1.5] - 2020-07-14

### Added
Expand Down Expand Up @@ -486,7 +498,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed Culture (e.g. en-us) not being passed correctly in DelimitedFlatFileAttacher
- Fixed bug where Updater would show older versions of RDMP as installable 'updates'

[Unreleased]: https://github.com/HicServices/RDMP/compare/v4.1.5...develop
[Unreleased]: https://github.com/HicServices/RDMP/compare/v4.1.6...develop
[4.1.6]: https://github.com/HicServices/RDMP/compare/v4.1.5...v4.1.6
[4.1.5]: https://github.com/HicServices/RDMP/compare/v4.1.4...v4.1.5
[4.1.4]: https://github.com/HicServices/RDMP/compare/v4.1.3...v4.1.4
[4.1.3]: https://github.com/HicServices/RDMP/compare/v4.1.2...v4.1.3
Expand Down Expand Up @@ -535,3 +548,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[Pipeline]: ./Documentation/CodeTutorials/Glossary.md#Pipeline

[Lookup]: ./Documentation/CodeTutorials/Glossary.md#Lookup
[CohortIdentificationConfiguration]: ./Documentation/CodeTutorials/Glossary.md#CohortIdentificationConfiguration
2 changes: 1 addition & 1 deletion Documentation/CodeTutorials/Packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
| CsvHelper | [GitHub](https://github.com/JoshClose/CsvHelper) | [15.0.5](https://www.nuget.org/packages/CsvHelper/15.0.5) | MS-PL / Apache 2.0 | Enables reading/writing CSV files |
| NPOI | [GitHub](https://github.com/tonyqus/npoi) | [2.4.1](https://www.nuget.org/packages/NPOI/2.4.1) | Apache 2.0 | Enables reading/writing Microsoft Excel files |
| ExcelNumberFormat | [GitHub](https://github.com/andersnm/ExcelNumberFormat) | [1.0.10](https://www.nuget.org/packages/ExcelNumberFormat/1.0.10) |[MIT](https://opensource.org/licenses/MIT) | Handles translating number formats from Excel formats into usable values | |
| [NLog](https://nlog-project.org/) | [GitHub](https://github.com/NLog/NLog) | [4.7.2](https://www.nuget.org/packages/NLog/4.7.2) | [BSD 3-Clause](https://github.com/NLog/NLog/blob/dev/LICENSE.txt) | Flexible user configurable logging | |
| [NLog](https://nlog-project.org/) | [GitHub](https://github.com/NLog/NLog) | [4.7.3](https://www.nuget.org/packages/NLog/4.7.3) | [BSD 3-Clause](https://github.com/NLog/NLog/blob/dev/LICENSE.txt) | Flexible user configurable logging | |
| HIC.FAnsiSql |[GitHub](https://github.com/HicServices/FAnsiSql) | [1.0.2](https://www.nuget.org/packages/HIC.FansiSql/1.0.2) | [GPL 3.0](https://www.gnu.org/licenses/gpl-3.0.html) | [DBMS] abstraction layer |
| HIC.BadMedicine | [GitHub](https://github.com/HicServices/BadMedicine) | [0.1.6](https://www.nuget.org/packages/HIC.BadMedicine/0.1.6) | [GPL 3.0](https://www.gnu.org/licenses/gpl-3.0.html) | Generate Test Datasets for tests/exericses |
| SSH.NET | [GitHub](https://github.com/sshnet/SSH.NET) | [2016.1.0](https://www.nuget.org/packages/SSH.NET/2016.1.0) | [MIT](https://github.com/sshnet/SSH.NET/blob/develop/LICENSE) | Enables fetching files from SFTP servers |
Expand Down
2 changes: 1 addition & 1 deletion Plugins/Plugin.Test/Plugin.Test.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<dependency id="SSH.NET" version="2016.1.0" />
<dependency id="NUnit" version="3.12.0" />
<dependency id="Moq" version="4.14.5" />
<dependency id="NLog" version="4.7.2" />
<dependency id="NLog" version="4.7.3" />
<dependency id="YamlDotNet" version="8.1.2" />
<dependency id="Microsoft.NET.Test.Sdk" version="16.6.1" />
<dependency id="ExcelNumberFormat" version="1.0.10" />
Expand Down
2 changes: 1 addition & 1 deletion Plugins/Plugin.UI/Plugin.UI.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<dependency id="ObjectListView.Official" version="2.9.1" />
<dependency id="CommandLineParser" version="2.8.0" />
<dependency id="SSH.NET" version="2016.1.0" />
<dependency id="NLog" version="4.7.2" />
<dependency id="NLog" version="4.7.3" />
<dependency id="ExcelNumberFormat" version="1.0.10" />
<dependency id="NPOI" version="2.4.1" />
<dependency id="System.Runtime.Loader" version="4.3.0" />
Expand Down
2 changes: 1 addition & 1 deletion Plugins/Plugin/Plugin.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<dependency id="CommandLineParser" version="2.8.0" />
<dependency id="SSH.NET" version="2016.1.0" />
<dependency id="HIC.FAnsiSql" version="1.0.2" />
<dependency id="NLog" version="4.7.2" />
<dependency id="NLog" version="4.7.3" />
<dependency id="HIC.BadMedicine" version="0.1.6" />
<dependency id="ExcelNumberFormat" version="1.0.10" />
<dependency id="NPOI" version="2.4.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,44 @@ public void TestSimpleUnMerge()
Assert.IsFalse(results[1].RootCohortAggregateContainer.GetAllAggregateConfigurationsRecursively().Intersect(new []{ aggregate1,aggregate2,aggregate3}).Any(),"Expected new aggregates to be new!");

}

[Test]
public void TestSimpleImportCic()
{
var merger = new CohortIdentificationConfigurationMerger(CatalogueRepository);

var cic1 = new CohortIdentificationConfiguration(CatalogueRepository,"cic1");
var cic2 = new CohortIdentificationConfiguration(CatalogueRepository,"cic2");

cic1.CreateRootContainerIfNotExists();
var root1 = cic1.RootCohortAggregateContainer;
root1.Name = "Root1";
root1.SaveToDatabase();
root1.AddChild(aggregate1,1);

cic2.CreateRootContainerIfNotExists();
var root2 = cic2.RootCohortAggregateContainer;
root2.Name = "Root2";
root2.SaveToDatabase();
root2.AddChild(aggregate2,2);

Assert.AreEqual(1,cic1.RootCohortAggregateContainer.GetAllAggregateConfigurationsRecursively().Count);
Assert.AreEqual(1,cic2.RootCohortAggregateContainer.GetAllAggregateConfigurationsRecursively().Count);

int numberOfCicsBefore = CatalogueRepository.GetAllObjects<CohortIdentificationConfiguration>().Count();

//import 2 into 1
merger.Import(new []{cic2 },cic1.RootCohortAggregateContainer);

//no new cics
Assert.AreEqual(numberOfCicsBefore,CatalogueRepository.GetAllObjects<CohortIdentificationConfiguration>().Count());

// cic 1 should now have both aggregates
Assert.AreEqual(2,cic1.RootCohortAggregateContainer.GetAllAggregateConfigurationsRecursively().Count);

Assert.AreEqual("Root1",cic1.RootCohortAggregateContainer.Name);
Assert.AreEqual("Root2",cic1.RootCohortAggregateContainer.GetSubContainers()[0].Name);

}
}
}
11 changes: 11 additions & 0 deletions Rdmp.Core.Tests/CommandExecution/CommandCliTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using Moq;
using Rdmp.Core.CommandExecution;
using Rdmp.Core.CommandLine.Interactive;
using ReusableLibraryCode.Checks;
Expand Down Expand Up @@ -35,5 +37,14 @@ protected CommandInvoker GetInvoker()

return invoker;
}

protected Mock<IBasicActivateItems> GetMockActivator()
{
var mock = new Mock<IBasicActivateItems>();
mock.Setup(m => m.RepositoryLocator).Returns(RepositoryLocator);
mock.Setup(m => m.GetDelegates()).Returns(new List<CommandInvokerDelegate>());
mock.Setup(m => m.Show(It.IsAny<string>()));
return mock;
}
}
}
62 changes: 62 additions & 0 deletions Rdmp.Core.Tests/CommandExecution/ExecuteCommandListTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright (c) The University of Dundee 2018-2019
// This file is part of the Research Data Management Platform (RDMP).
// 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.
// 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.
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.

using Moq;
using NUnit.Framework;
using Rdmp.Core.CommandExecution.AtomicCommands;
using Rdmp.Core.CommandLine.Interactive.Picking;
using Rdmp.Core.Curation.Data;
using System.Text.RegularExpressions;

namespace Rdmp.Core.Tests.CommandExecution
{
class TestsExecuteCommandList : CommandCliTests
{
[Test]
public void Test_ExecuteCommandList_NoCataloguesParsing()
{
foreach(var cat in RepositoryLocator.CatalogueRepository.GetAllObjects<Catalogue>())
cat.DeleteInDatabase();

Assert.IsEmpty(RepositoryLocator.CatalogueRepository.GetAllObjects<Catalogue>());

GetInvoker().ExecuteCommand(typeof(ExecuteCommandList),
new CommandLineObjectPicker(new string[]{ "Catalogue"}, RepositoryLocator));
}

[Test]
public void Test_ExecuteCommandList_OneCatalogueParsing()
{
var c = WhenIHaveA<Catalogue>();

GetInvoker().ExecuteCommand(typeof(ExecuteCommandList),
new CommandLineObjectPicker(new string[]{ "Catalogue"}, RepositoryLocator));

c.DeleteInDatabase();
}
[Test]
public void Test_ExecuteCommandList_OneCatalogue()
{
var c = WhenIHaveA<Catalogue>();
c.Name = "fff";
c.SaveToDatabase();

var mock = GetMockActivator();

var cmd = new ExecuteCommandList(mock.Object,new []{c});
Assert.IsFalse(cmd.IsImpossible,cmd.ReasonCommandImpossible);

cmd.Execute();

string contents = Regex.Escape($"{c.ID}:fff");

// Called once
mock.Verify(m => m.Show(It.IsRegex(contents)), Times.Once());

c.DeleteInDatabase();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (c) The University of Dundee 2018-2019
// This file is part of the Research Data Management Platform (RDMP).
// 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.
// 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.
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.

using NUnit.Framework;
using Rdmp.Core.CommandExecution.AtomicCommands;
using Rdmp.Core.CommandLine.Interactive.Picking;
using Rdmp.Core.Curation.Data;
using Rdmp.Core.Curation.Data.DataLoad;
using System;
using System.Collections.Generic;
using System.Text;

namespace Rdmp.Core.Tests.CommandExecution
{
class TestExecuteCommandAssociateCatalogueWithLoadMetadata : CommandCliTests
{

[Test]
public void TestExecuteCommandAssociateCatalogueWithLoadMetadata_Simple()
{
var cata1 = new Catalogue(RepositoryLocator.CatalogueRepository,"fff");
var cata2 = new Catalogue(RepositoryLocator.CatalogueRepository,"bbb");

Assert.IsNull(cata1.LoadMetadata);
Assert.IsNull(cata2.LoadMetadata);

var lmd = new LoadMetadata(RepositoryLocator.CatalogueRepository,"mylmd");

GetInvoker().ExecuteCommand(typeof(ExecuteCommandAssociateCatalogueWithLoadMetadata),
new CommandLineObjectPicker(new[]{$"LoadMetadata:{lmd.ID}", "Catalogue:fff"}, RepositoryLocator));

cata1.RevertToDatabaseState();
cata2.RevertToDatabaseState();

Assert.AreEqual(lmd.ID,cata1.LoadMetadata_ID);
Assert.IsNull(cata2.LoadMetadata);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,8 @@

namespace Rdmp.Core.Tests.CommandExecution
{
class TestExecuteCommandDescribeCommand : UnitTests
class TestExecuteCommandDescribeCommand : CommandCliTests
{
private Mock<IBasicActivateItems> GetMock()
{
var mock = new Mock<IBasicActivateItems>();
mock.Setup(m => m.RepositoryLocator).Returns(RepositoryLocator);
mock.Setup(m => m.GetDelegates()).Returns(new List<CommandInvokerDelegate>());
mock.Setup(m => m.Show(It.IsAny<string>()));
return mock;
}

/// <summary>
/// Asserts that the help text <paramref name="forCommand"/> matches your <paramref name="expectedHelp"/> text
Expand All @@ -34,7 +26,7 @@ private Mock<IBasicActivateItems> GetMock()
/// <param name="forCommand"></param>
private void AssertHelpIs(string expectedHelp, Type forCommand)
{
var mock = GetMock();
var mock = GetMockActivator();

var cmd = new ExecuteCommandDescribeCommand(mock.Object, forCommand);
Assert.IsFalse(cmd.IsImpossible,cmd.ReasonCommandImpossible);
Expand Down
Loading

0 comments on commit 1534cc9

Please sign in to comment.