-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Task/rdmp-100 Allow project specific extraction updates #1733
Merged
bpeacock001
merged 10 commits into
develop
from
task/RDMP-100-allow-project-specific-extraction-updates
Feb 13, 2024
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e55d30a
allow project specific extraction categories to change
JFriel e95fdaa
add tests
JFriel a9e40e2
tidy up code
JFriel 6246e39
Merge branch 'develop' into task/RDMP-100-allow-project-specific-extr…
JFriel f1dd324
Merge branch 'develop' of https://github.com/HicServices/RDMP into ta…
JFriel ffc9211
Merge branch 'task/RDMP-100-allow-project-specific-extraction-updates…
JFriel a2b7f76
Merge branch 'develop' into task/RDMP-100-allow-project-specific-extr…
JFriel 1440162
Merge branch 'develop' into task/RDMP-100-allow-project-specific-extr…
JFriel 903c93a
tidy up imports
JFriel 7c5c163
Merge branch 'develop' into task/RDMP-100-allow-project-specific-extr…
JFriel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
Rdmp.Core.Tests/CommandExecution/ExecuteCommandChangeExtractionCategoryTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Copyright (c) The University of Dundee 2024-2024 | ||
// 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; | ||
using Rdmp.Core.CommandExecution.AtomicCommands; | ||
using Rdmp.Core.Curation.Data; | ||
using Rdmp.Core.Repositories; | ||
using System.Linq; | ||
using Tests.Common; | ||
using NSubstitute; | ||
using NSubstitute.Extensions; | ||
using Rdmp.Core.DataExport.Data; | ||
using Rdmp.Core.Curation.Data.Aggregation; | ||
using static Org.BouncyCastle.Math.EC.ECCurve; | ||
namespace Rdmp.Core.Tests.CommandExecution; | ||
|
||
public class ExecuteCommandChangeExtractionCategoryTests : DatabaseTests | ||
{ | ||
private Catalogue _cata1; | ||
private TableInfo _t1; | ||
private ColumnInfo _c1; | ||
private CatalogueItem _ci1; | ||
|
||
private ExtractionInformation _extractionInfo1; | ||
|
||
[Test] | ||
public void TestProjectSpecificCatalogueChangeToSuplemental() | ||
{ | ||
//change project specific to supplemental | ||
_cata1 =new Catalogue(CatalogueRepository, "Dataset1"); | ||
_t1 = new TableInfo(CatalogueRepository, "T1"); | ||
|
||
_c1 = new ColumnInfo(CatalogueRepository, "PrivateIdentifierA", "varchar(10)", _t1); | ||
|
||
_ci1 = new CatalogueItem(CatalogueRepository, _cata1, "PrivateIdentifierA"); | ||
|
||
_extractionInfo1 = new ExtractionInformation(CatalogueRepository, _ci1, _c1, _c1.ToString()) | ||
{ | ||
Order = 123, | ||
ExtractionCategory = ExtractionCategory.ProjectSpecific, | ||
IsExtractionIdentifier = true | ||
}; | ||
_extractionInfo1.CatalogueItem.Catalogue.InjectKnown(new CatalogueExtractabilityStatus(true, true)); | ||
|
||
ExtractionInformation[] eid = { _extractionInfo1 }; | ||
var cmd = new ExecuteCommandChangeExtractionCategory(new ThrowImmediatelyActivator(RepositoryLocator), eid, ExtractionCategory.Supplemental); | ||
Assert.DoesNotThrow(() => cmd.Execute()); | ||
Assert.That(_extractionInfo1.ExtractionCategory, Is.EqualTo(ExtractionCategory.Supplemental)); | ||
} | ||
|
||
[Test] | ||
public void TestExtractionCategoryCatalogueChangeFromSupplementalToCore() | ||
{ | ||
//change a project specific column to core | ||
_cata1 = new Catalogue(CatalogueRepository, "Dataset1"); | ||
_t1 = new TableInfo(CatalogueRepository, "T1"); | ||
|
||
_c1 = new ColumnInfo(CatalogueRepository, "PrivateIdentifierA", "varchar(10)", _t1); | ||
|
||
_ci1 = new CatalogueItem(CatalogueRepository, _cata1, "PrivateIdentifierA"); | ||
|
||
_extractionInfo1 = new ExtractionInformation(CatalogueRepository, _ci1, _c1, _c1.ToString()) | ||
{ | ||
Order = 123, | ||
ExtractionCategory = ExtractionCategory.Supplemental, | ||
IsExtractionIdentifier = true | ||
}; | ||
_extractionInfo1.CatalogueItem.Catalogue.InjectKnown(new CatalogueExtractabilityStatus(true, true)); | ||
|
||
ExtractionInformation[] eid = { _extractionInfo1 }; | ||
var cmd = new ExecuteCommandChangeExtractionCategory(new ThrowImmediatelyActivator(RepositoryLocator), eid, ExtractionCategory.Core); | ||
Assert.DoesNotThrow(() => cmd.Execute()); | ||
Assert.That(_extractionInfo1.ExtractionCategory, Is.EqualTo(ExtractionCategory.ProjectSpecific)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another stray Bouncycastle inclusion?